Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split up napi envs #15437

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/bun.js/bindings/BunProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,14 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionDlopen,
return JSValue::encode(jsUndefined());
}

JSC::EncodedJSValue (*napi_register_module_v1)(napi_env env, JSC::EncodedJSValue exports);
napi_value (*napi_register_module_v1)(napi_env env, napi_value exports);
#if OS(WINDOWS)
#define dlsym GetProcAddress
#endif

// TODO(@190n) look for node_register_module_vXYZ according to BuildOptions.reported_nodejs_version
// (bun/src/env.zig:36) and the table at https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json
napi_register_module_v1 = reinterpret_cast<JSC::EncodedJSValue (*)(napi_env, JSC::EncodedJSValue)>(
napi_register_module_v1 = reinterpret_cast<napi_value (*)(napi_env, napi_value)>(
dlsym(handle, "napi_register_module_v1"));

if (!napi_register_module_v1) {
Expand Down Expand Up @@ -442,7 +442,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionDlopen,
auto env = globalObject->makeNapiEnv(nmodule);

EncodedJSValue exportsValue = JSC::JSValue::encode(exports);
JSC::JSValue resultValue = JSValue::decode(napi_register_module_v1(env, exportsValue));
JSC::JSValue resultValue = JSValue::decode(reinterpret_cast<EncodedJSValue>(napi_register_module_v1(env, reinterpret_cast<napi_value>(exportsValue))));

RETURN_IF_EXCEPTION(scope, {});

Expand Down
2 changes: 1 addition & 1 deletion src/bun.js/bindings/ZigGlobalObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ class GlobalObject : public Bun::GlobalScope {

bool hasOverridenModuleResolveFilenameFunction = false;

WTF::Vector<std::unique_ptr<napi_env__>> m_napiEnvs;
WTF::Vector<std::unique_ptr<napi_env__>, 0> m_napiEnvs;
napi_env makeNapiEnv(const napi_module&);
napi_env makeNapiEnvForFFI();

Expand Down
Loading
Loading