MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / loadNativeModule

Function loadNativeModule

runtime/src/native.js:102–118  ·  view source on GitHub ↗
(_spec, bytes, ctx)

Source from the content-addressed store, hash-verified

100
101/* Try custom loaders first; built-in Path A is the implicit fallback. */
102export async function loadNativeModule(_spec, bytes, ctx) {
103 const module = await WebAssembly.compile(bytes);
104
105 for (const loader of ctx.loaders) {
106 if (loader.match(module)) {
107 const result = await loader.load(module, ctx);
108 // Tag each fn with its dispatch kind so host_call_native picks the right path.
109 for (const fn of result.fns) fn.__edge_kind = result.kind;
110 annotateNames(result);
111 return result;
112 }
113 }
114
115 const result = await builtinWasmPdkLoader(module, ctx);
116 annotateNames(result);
117 return result;
118}
119
120/* Pair each fn with its declared name so deferred dispatch can route by name on the main thread. */
121function annotateNames({ names, fns }) {

Callers 1

bfsPrefetchFunction · 0.90

Calls 4

annotateNamesFunction · 0.85
builtinWasmPdkLoaderFunction · 0.85
compileMethod · 0.80
loadMethod · 0.80

Tested by

no test coverage detected