198 _next = NULL; |
198 _next = NULL; |
199 _internal = internal; |
199 _internal = internal; |
200 _writeable = writeable; |
200 _writeable = writeable; |
201 } |
201 } |
202 |
202 |
203 AgentLibrary::AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib) { |
203 AgentLibrary::AgentLibrary(const char* name, const char* options, |
|
204 bool is_absolute_path, void* os_lib, |
|
205 bool instrument_lib) { |
204 _name = AllocateHeap(strlen(name)+1, mtArguments); |
206 _name = AllocateHeap(strlen(name)+1, mtArguments); |
205 strcpy(_name, name); |
207 strcpy(_name, name); |
206 if (options == NULL) { |
208 if (options == NULL) { |
207 _options = NULL; |
209 _options = NULL; |
208 } else { |
210 } else { |
212 _is_absolute_path = is_absolute_path; |
214 _is_absolute_path = is_absolute_path; |
213 _os_lib = os_lib; |
215 _os_lib = os_lib; |
214 _next = NULL; |
216 _next = NULL; |
215 _state = agent_invalid; |
217 _state = agent_invalid; |
216 _is_static_lib = false; |
218 _is_static_lib = false; |
|
219 _is_instrument_lib = instrument_lib; |
217 } |
220 } |
218 |
221 |
219 // Check if head of 'option' matches 'name', and sets 'tail' to the remaining |
222 // Check if head of 'option' matches 'name', and sets 'tail' to the remaining |
220 // part of the option string. |
223 // part of the option string. |
221 static bool match_option(const JavaVMOption *option, const char* name, |
224 static bool match_option(const JavaVMOption *option, const char* name, |
286 _libraryList.add(new AgentLibrary(name, options, false, NULL)); |
289 _libraryList.add(new AgentLibrary(name, options, false, NULL)); |
287 } |
290 } |
288 |
291 |
289 void Arguments::add_init_agent(const char* name, char* options, bool absolute_path) { |
292 void Arguments::add_init_agent(const char* name, char* options, bool absolute_path) { |
290 _agentList.add(new AgentLibrary(name, options, absolute_path, NULL)); |
293 _agentList.add(new AgentLibrary(name, options, absolute_path, NULL)); |
|
294 } |
|
295 |
|
296 void Arguments::add_instrument_agent(const char* name, char* options, bool absolute_path) { |
|
297 _agentList.add(new AgentLibrary(name, options, absolute_path, NULL, true)); |
291 } |
298 } |
292 |
299 |
293 // Late-binding agents not started via arguments |
300 // Late-binding agents not started via arguments |
294 void Arguments::add_loaded_agent(AgentLibrary *agentLib) { |
301 void Arguments::add_loaded_agent(AgentLibrary *agentLib) { |
295 _agentList.add(agentLib); |
302 _agentList.add(agentLib); |
495 { "AssumeMP", JDK_Version::jdk(10),JDK_Version::undefined(), JDK_Version::undefined() }, |
502 { "AssumeMP", JDK_Version::jdk(10),JDK_Version::undefined(), JDK_Version::undefined() }, |
496 { "MonitorInUseLists", JDK_Version::jdk(10),JDK_Version::undefined(), JDK_Version::undefined() }, |
503 { "MonitorInUseLists", JDK_Version::jdk(10),JDK_Version::undefined(), JDK_Version::undefined() }, |
497 { "MaxRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, |
504 { "MaxRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, |
498 { "MinRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, |
505 { "MinRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, |
499 { "InitialRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, |
506 { "InitialRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, |
500 { "UseMembar", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) }, |
507 { "UseMembar", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, |
501 { "FastTLABRefill", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) }, |
508 { "FastTLABRefill", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) }, |
502 { "SafepointSpinBeforeYield", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) }, |
509 { "SafepointSpinBeforeYield", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) }, |
503 { "DeferThrSuspendLoopCount", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) }, |
510 { "DeferThrSuspendLoopCount", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) }, |
504 { "DeferPollingPageLoopCount", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) }, |
511 { "DeferPollingPageLoopCount", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) }, |
505 { "UseCGroupMemoryLimitForHeap", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::jdk(11) }, |
512 { "UseCGroupMemoryLimitForHeap", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::jdk(11) }, |
672 } |
679 } |
673 } |
680 } |
674 return false; |
681 return false; |
675 } |
682 } |
676 |
683 |
|
684 // Verifies the correctness of the entries in the special_jvm_flags table. |
|
685 // If there is a semantic error (i.e. a bug in the table) such as the obsoletion |
|
686 // version being earlier than the deprecation version, then a warning is issued |
|
687 // and verification fails - by returning false. If it is detected that the table |
|
688 // is out of date, with respect to the current version, then a warning is issued |
|
689 // but verification does not fail. This allows the VM to operate when the version |
|
690 // is first updated, without needing to update all the impacted flags at the |
|
691 // same time. |
677 static bool verify_special_jvm_flags() { |
692 static bool verify_special_jvm_flags() { |
678 bool success = true; |
693 bool success = true; |
679 for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) { |
694 for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) { |
680 const SpecialFlag& flag = special_jvm_flags[i]; |
695 const SpecialFlag& flag = special_jvm_flags[i]; |
681 if (lookup_special_flag(flag.name, i)) { |
696 if (lookup_special_flag(flag.name, i)) { |
708 |
723 |
709 // if flag has become obsolete it should not have a "globals" flag defined anymore. |
724 // if flag has become obsolete it should not have a "globals" flag defined anymore. |
710 if (!version_less_than(JDK_Version::current(), flag.obsolete_in)) { |
725 if (!version_less_than(JDK_Version::current(), flag.obsolete_in)) { |
711 if (Flag::find_flag(flag.name) != NULL) { |
726 if (Flag::find_flag(flag.name) != NULL) { |
712 warning("Global variable for obsolete special flag entry \"%s\" should be removed", flag.name); |
727 warning("Global variable for obsolete special flag entry \"%s\" should be removed", flag.name); |
713 success = false; |
|
714 } |
728 } |
715 } |
729 } |
716 } |
730 } |
717 |
731 |
718 if (!flag.expired_in.is_undefined()) { |
732 if (!flag.expired_in.is_undefined()) { |
719 // if flag has become expired it should not have a "globals" flag defined anymore. |
733 // if flag has become expired it should not have a "globals" flag defined anymore. |
720 if (!version_less_than(JDK_Version::current(), flag.expired_in)) { |
734 if (!version_less_than(JDK_Version::current(), flag.expired_in)) { |
721 if (Flag::find_flag(flag.name) != NULL) { |
735 if (Flag::find_flag(flag.name) != NULL) { |
722 warning("Global variable for expired flag entry \"%s\" should be removed", flag.name); |
736 warning("Global variable for expired flag entry \"%s\" should be removed", flag.name); |
723 success = false; |
|
724 } |
737 } |
725 } |
738 } |
726 } |
739 } |
727 |
740 |
728 } |
741 } |
2790 #else |
2803 #else |
2791 if (tail != NULL) { |
2804 if (tail != NULL) { |
2792 size_t length = strlen(tail) + 1; |
2805 size_t length = strlen(tail) + 1; |
2793 char *options = NEW_C_HEAP_ARRAY(char, length, mtArguments); |
2806 char *options = NEW_C_HEAP_ARRAY(char, length, mtArguments); |
2794 jio_snprintf(options, length, "%s", tail); |
2807 jio_snprintf(options, length, "%s", tail); |
2795 add_init_agent("instrument", options, false); |
2808 add_instrument_agent("instrument", options, false); |
2796 // java agents need module java.instrument |
2809 // java agents need module java.instrument |
2797 if (!create_numbered_property("jdk.module.addmods", "java.instrument", addmods_count++)) { |
2810 if (!create_numbered_property("jdk.module.addmods", "java.instrument", addmods_count++)) { |
2798 return JNI_ENOMEM; |
2811 return JNI_ENOMEM; |
2799 } |
2812 } |
2800 } |
2813 } |