@@ -2827,10 +2827,35 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
28272827 return JNI_ERR;
28282828#endif // INCLUDE_MANAGEMENT
28292829#if INCLUDE_JVMCI
2830+ } else if (match_option (option, " -XX:-UseGraalJIT" )) {
2831+ FLAG_SET_CMDLINE (UseJVMCICompiler, false );
2832+ } else if (match_option (option, " -XX:+UseGraalJIT" )) {
2833+ if (!EnableJVMCIProduct) {
2834+ bool save = UnlockExperimentalVMOptions;
2835+ bool ok = JVMCIGlobals::enable_jvmci_product_mode (origin);
2836+ UnlockExperimentalVMOptions = save;
2837+ if (!ok) {
2838+ jio_fprintf (defaultStream::error_stream (),
2839+ " Unable to enable JVMCI in product mode" );
2840+ return JNI_ERR;
2841+ }
2842+ }
2843+
2844+ const char * jvmci_compiler = get_property (" jvmci.Compiler" );
2845+ if (jvmci_compiler != nullptr ) {
2846+ if (strcmp (jvmci_compiler, " graal" ) != 0 ) {
2847+ jio_fprintf (defaultStream::error_stream (),
2848+ " Value of jvmci.Compiler incompatible with +UseGraalJIT: %s" , jvmci_compiler);
2849+ return JNI_ERR;
2850+ }
2851+ } else if (!add_property (" jvmci.Compiler=graal" )) {
2852+ return JNI_ENOMEM;
2853+ }
2854+ FLAG_SET_CMDLINE (UseJVMCICompiler, true );
28302855 } else if (match_option (option, " -XX:-EnableJVMCIProduct" )) {
28312856 if (EnableJVMCIProduct) {
28322857 jio_fprintf (defaultStream::error_stream (),
2833- " -XX:-EnableJVMCIProduct cannot come after -XX:+EnableJVMCIProduct\n " );
2858+ " -XX:-EnableJVMCIProduct cannot come after -XX:+EnableJVMCIProduct or -XX:+UseGraalJIT \n " );
28342859 return JNI_EINVAL;
28352860 }
28362861 } else if (match_option (option, " -XX:+EnableJVMCIProduct" )) {
0 commit comments