optimize frames; remove trampoline

This commit is contained in:
2026-02-18 22:37:48 -06:00
parent 27ca008f18
commit e004b2c472
14 changed files with 318 additions and 91 deletions

View File

@@ -434,6 +434,16 @@ function detect_host_target() {
var host_target = detect_host_target()
// Must match build.cm NATIVE_CACHE_VERSION to detect stale native artifacts.
def NATIVE_CACHE_VERSION = "native-v23"
function native_sanitize_flags() {
if (fd.is_file('.cell/asan_aot')) {
return ' -fsanitize=address -fno-omit-frame-pointer'
}
return ''
}
// Check for a native .cm dylib at the deterministic lib path
// Returns a native descriptor {_native, _handle, _sym}, or null if no native dylib exists
// Also checks staleness: if source has changed, the content-addressed build artifact
@@ -444,6 +454,7 @@ function try_native_mod_dylib(pkg, stem) {
var src = null
var host = null
var hash = null
var san_flags = null
var tc_ext = null
var build_path = null
var handle = null
@@ -456,7 +467,8 @@ function try_native_mod_dylib(pkg, stem) {
if (fd.is_file(src_path)) {
src = text(fd.slurp(src_path))
host = detect_host_target()
hash = content_hash(src + '\n' + host + '\nnative')
san_flags = native_sanitize_flags()
hash = content_hash(src + '\n' + host + '\nnative\n' + NATIVE_CACHE_VERSION + '\n' + san_flags)
tc_ext = dylib_ext
build_path = global_shop_path + '/build/' + hash + '.' + host + tc_ext
if (!fd.is_file(build_path)) return null
@@ -1918,4 +1930,4 @@ Shop.use_native = function(path, package_context) {
return os.native_module_load(handle, env)
}
return Shop
return Shop