comparison src/share/vm/jvmci/jvmciRuntime.cpp @ 22511:df5a7841f92a

revived support for specifying JVMCI options in <jre>/lib/jvmci/options
author Doug Simon <doug.simon@oracle.com>
date Thu, 03 Sep 2015 14:47:36 +0200
parents 693e1df2b808
children feb4131657bb
comparison
equal deleted inserted replaced
22510:45723ab25426 22511:df5a7841f92a
661 JavaCalls::call_static(&result, klass, runtime, sig, args, CHECK_ABORT_(Handle())); 661 JavaCalls::call_static(&result, klass, runtime, sig, args, CHECK_ABORT_(Handle()));
662 } 662 }
663 return Handle((oop)result.get_jobject()); 663 return Handle((oop)result.get_jobject());
664 } 664 }
665 665
666 static bool jvmci_options_file_exists() {
667 const char* home = Arguments::get_java_home();
668 size_t path_len = strlen(home) + strlen("/lib/jvmci/options") + 1;
669 char path[JVM_MAXPATHLEN];
670 char sep = os::file_separator()[0];
671 jio_snprintf(path, JVM_MAXPATHLEN, "%s%clib%cjvmci%coptions", home, sep, sep, sep);
672 struct stat st;
673 return os::stat(path, &st) == 0;
674 }
675
666 void JVMCIRuntime::initialize_HotSpotJVMCIRuntime() { 676 void JVMCIRuntime::initialize_HotSpotJVMCIRuntime() {
667 if (JNIHandles::resolve(_HotSpotJVMCIRuntime_instance) == NULL) { 677 if (JNIHandles::resolve(_HotSpotJVMCIRuntime_instance) == NULL) {
668 Thread* THREAD = Thread::current(); 678 Thread* THREAD = Thread::current();
669 #ifdef ASSERT 679 #ifdef ASSERT
670 // This should only be called in the context of the JVMCI class being initialized 680 // This should only be called in the context of the JVMCI class being initialized
672 instanceKlassHandle klass = InstanceKlass::cast(load_required_class(name)); 682 instanceKlassHandle klass = InstanceKlass::cast(load_required_class(name));
673 assert(klass->is_being_initialized() && klass->is_reentrant_initialization(THREAD), 683 assert(klass->is_being_initialized() && klass->is_reentrant_initialization(THREAD),
674 "HotSpotJVMCIRuntime initialization should only be triggered through JVMCI initialization"); 684 "HotSpotJVMCIRuntime initialization should only be triggered through JVMCI initialization");
675 #endif 685 #endif
676 686
677 if (_options != NULL) { 687 bool parseOptionsFile = jvmci_options_file_exists();
688 if (_options != NULL || parseOptionsFile) {
678 JavaCallArguments args; 689 JavaCallArguments args;
679 oop options = java_lang_String::create_oop_from_str(_options, CHECK_ABORT); 690 oop options = java_lang_String::create_oop_from_str(_options, CHECK_ABORT);
680 args.push_oop(options); 691 args.push_oop(options);
692 args.push_int(parseOptionsFile);
681 callStatic("jdk/internal/jvmci/options/OptionsParser", 693 callStatic("jdk/internal/jvmci/options/OptionsParser",
682 "parseOptionsFromVM", 694 "parseOptionsFromVM",
683 "(Ljava/lang/String;)Ljava/lang/Boolean;", &args); 695 "(Ljava/lang/String;Z)Ljava/lang/Boolean;", &args);
684 } 696 }
685 697
686 if (_compiler != NULL) { 698 if (_compiler != NULL) {
687 JavaCallArguments args; 699 JavaCallArguments args;
688 oop compiler = java_lang_String::create_oop_from_str(_compiler, CHECK_ABORT); 700 oop compiler = java_lang_String::create_oop_from_str(_compiler, CHECK_ABORT);