7777#endif
7878
7979#ifdef __APPLE__
80- #define LIBNODESVM_RELPATH " /lib/polyglot/libpolyglot.dylib"
80+ #define LIBNODESVM_RELPATH " /languages/nodejs/lib/libgraal-nodejs.dylib"
81+ #define LIBPOLYGLOT_RELPATH " /lib/polyglot/libpolyglot.dylib"
8182#define LIBJVM_RELPATH " /lib/server/libjvm.dylib"
8283#define LIBJLI_RELPATH " /lib/jli/libjli.dylib"
8384// libjli.dylib has moved in JDK 12, see https://bugs.openjdk.java.net/browse/JDK-8210931
8788#define LIBJVM_RELPATH " /lib/server/libjvm.so"
8889#define LIBJVM_RELPATH2 " /lib/sparcv9/server/libjvm.so"
8990#elif defined(_WIN32)
90- #define LIBNODESVM_RELPATH " \\ lib\\ polyglot\\ polyglot.dll"
91+ #define LIBNODESVM_RELPATH " \\ languages\\ nodejs\\ lib\\ graal-nodejs.dll"
92+ #define LIBPOLYGLOT_RELPATH " \\ lib\\ polyglot\\ polyglot.dll"
9193#define LIBJVM_RELPATH " \\ bin\\ server\\ jvm.dll"
9294#else
93- #define LIBNODESVM_RELPATH " /lib/polyglot/libpolyglot.so"
95+ #define LIBNODESVM_RELPATH " /languages/nodejs/lib/libgraal-nodejs.so"
96+ #define LIBPOLYGLOT_RELPATH " /lib/polyglot/libpolyglot.so"
9497#define LIBJVM_RELPATH " /lib/server/libjvm.so"
9598#define LIBJVM_RELPATH2 " /lib/amd64/server/libjvm.so"
9699#endif
@@ -237,8 +240,8 @@ v8::Isolate* GraalIsolate::New(v8::Isolate::CreateParams const& params, v8::Isol
237240 std::string node = nodeExe ();
238241
239242 std::string node_path = up (node);
240- bool graalvm8 = ends_with (node_path, file_separator + " jre" + file_separator + " languages" + file_separator + " js " + file_separator + " bin" );
241- bool graalvm11plus = ends_with (node_path, file_separator + " languages" + file_separator + " js " + file_separator + " bin" );
243+ bool graalvm8 = ends_with (node_path, file_separator + " jre" + file_separator + " languages" + file_separator + " nodejs " + file_separator + " bin" );
244+ bool graalvm11plus = ends_with (node_path, file_separator + " languages" + file_separator + " nodejs " + file_separator + " bin" );
242245 if (graalvm8 || graalvm11plus) {
243246 // Part of GraalVM: take precedence over any JAVA_HOME.
244247 // We set environment variables to ensure these values are correctly
@@ -248,7 +251,7 @@ v8::Isolate* GraalIsolate::New(v8::Isolate::CreateParams const& params, v8::Isol
248251
249252# ifdef LIBNODESVM_RELPATH
250253 bool force_native = false ;
251- std::string node_jvm_lib = graalvm_home + (graalvm8 ? file_separator + " jre" : " " ) + LIBNODESVM_RELPATH;
254+ std::string node_jvm_lib = graalvm_home + (graalvm8 ? file_separator + " jre" : " " ) + (polyglot ? LIBPOLYGLOT_RELPATH : LIBNODESVM_RELPATH) ;
252255 if (mode == kModeJVM ) {
253256 // will be set to appropriate libjvm path below
254257 UnsetEnv (" NODE_JVM_LIB" );
@@ -290,7 +293,7 @@ v8::Isolate* GraalIsolate::New(v8::Isolate::CreateParams const& params, v8::Isol
290293 SetEnv (" NODE_JVM_LIB" , jvmlib_path.c_str ());
291294 }
292295 if (access (jvmlib_path.c_str (), F_OK) == -1 ) {
293- fprintf (stderr, " Cannot find %s. Specify JAVA_HOME so $JAVA_HOME%s exists, or specify NODE_JVM_LIB directly.\n " , jvmlib_path.c_str (), LIBJVM_RELPATH);
296+ fprintf (stderr, " Cannot find %s. Rebuild the polyglot library with `gu rebuild-images libpolyglot`, specify JAVA_HOME so that $JAVA_HOME%s exists, or specify NODE_JVM_LIB directly.\n " , jvmlib_path.c_str (), LIBJVM_RELPATH);
294297 exit (1 );
295298 }
296299
@@ -1262,6 +1265,7 @@ jobject GraalIsolate::CorrectReturnValue(GraalValue* value, jobject null_replace
12621265int GraalIsolate::argc = 0 ;
12631266char ** GraalIsolate::argv = nullptr ;
12641267int GraalIsolate::mode = GraalIsolate::kModeDefault ;
1268+ bool GraalIsolate::polyglot = false ;
12651269bool GraalIsolate::use_classpath_env_var = false ;
12661270
12671271void GraalIsolate::SetPromiseHook (v8::PromiseHook promise_hook) {
0 commit comments