progress on aot

This commit is contained in:
2026-02-16 21:58:45 -06:00
parent a1ee7dd458
commit 4b7cde9400
13 changed files with 789 additions and 421 deletions

View File

@@ -1009,6 +1009,7 @@ function execute_module(info)
env = inject_env(inject)
pkg = file_info.package
env.use = make_use_fn(pkg)
env = stone(env)
// Load compiled bytecode with env
used = mach_load(mod_resolve.symbol, env)
@@ -1044,6 +1045,7 @@ Shop.use = function use(path, package_context) {
if (embedded) {
embed_env = inject_env(SHOP_DEFAULT_INJECT)
embed_env.use = make_use_fn(package_context)
embed_env = stone(embed_env)
use_cache[embed_key] = mach_load(embedded, embed_env)
return use_cache[embed_key]
}
@@ -1608,6 +1610,7 @@ Shop.load_as_mach = function(path, pkg) {
inject = Shop.script_inject_for(file_info)
env = inject_env(inject)
env.use = make_use_fn(file_info.package)
env = stone(env)
return mach_load(compiled, env)
}
@@ -1697,9 +1700,15 @@ Shop.use_native = function(path, package_context) {
var handle = os.dylib_open(dylib_path)
if (!handle) { print('Failed to open native dylib: ' + dylib_path); disrupt }
// Build env with runtime functions and capabilities
var inject = Shop.script_inject_for(file_info)
var env = inject_env(inject)
env.use = make_use_fn(pkg)
env = stone(env)
if (sym_name)
return os.native_module_load_named(handle, sym_name)
return os.native_module_load(handle)
return os.native_module_load_named(handle, sym_name, env)
return os.native_module_load(handle, env)
}
return Shop