--- old/src/share/vm/prims/jvmti.xml 2016-04-14 01:07:57.798516020 -0700 +++ new/src/share/vm/prims/jvmti.xml 2016-04-14 01:07:57.666509439 -0700 @@ -9994,6 +9994,17 @@ See . + + + Can generate the events early. + If this capability and + can_generate_all_class_hook_events + are enabled then the events + could be posted for classes loaded in the primordial phase. + See . + + @@ -12404,7 +12415,7 @@ - This event is sent when the VM obtains class file data, @@ -12420,7 +12431,12 @@ bytecode instrumentation for usage information.

- This event may be sent before the VM is initialized (the start + The timing of this event may depend on whether the agent has added the + + can_generate_early_class_hook_events + capability or not. + If the capability has been added then the VM posts the events in the primordial phase. + Otherwise, this event may be sent before the VM is initialized (the start phase). Some classes might not be compatible with the function (eg. ROMized classes) and this event will not be @@ -12470,6 +12486,7 @@ jvmpi + @@ -12542,7 +12559,7 @@ - The VM initialization event signals the start of the VM. + The VM start event signals the start of the VM. At this time JNI is live but the VM is not yet fully initialized. Once this event is generated, the agent is free to call any JNI function. This event signals the beginning of the start phase, @@ -14419,6 +14436,10 @@ - Add new capability can_generate_early_vmstart - Allow CompiledMethodLoad events at start phase + + Support for modules: + - Add new capability can_generate_early_class_hook_events + --- old/src/share/vm/prims/jvmtiEnvBase.hpp 2016-04-14 01:07:58.478549924 -0700 +++ new/src/share/vm/prims/jvmtiEnvBase.hpp 2016-04-14 01:07:58.358543941 -0700 @@ -162,6 +162,10 @@ jvmtiCapabilities *get_prohibited_capabilities() { return &_prohibited_capabilities; } + bool early_class_hook_env() { + return get_capabilities()->can_generate_early_class_hook_events != 0; + } + bool early_vmstart_env() { return get_capabilities()->can_generate_early_vmstart != 0; } --- old/src/share/vm/prims/jvmtiExport.cpp 2016-04-14 01:07:58.942573058 -0700 +++ new/src/share/vm/prims/jvmtiExport.cpp 2016-04-14 01:07:58.790565479 -0700 @@ -665,7 +665,7 @@ } void post_to_env(JvmtiEnv* env, bool caching_needed) { - if (env->phase() == JVMTI_PHASE_PRIMORDIAL) { + if (env->phase() == JVMTI_PHASE_PRIMORDIAL && !env->early_class_hook_env()) { return; } unsigned char *new_data = NULL; --- old/src/share/vm/prims/jvmtiManageCapabilities.cpp 2016-04-14 01:07:59.462598981 -0700 +++ new/src/share/vm/prims/jvmtiManageCapabilities.cpp 2016-04-14 01:07:59.358593796 -0700 @@ -134,6 +134,7 @@ jc.can_get_owned_monitor_stack_depth_info = 1; jc.can_get_current_contended_monitor = 1; jc.can_generate_early_vmstart = 1; + jc.can_generate_early_class_hook_events = 1; return jc; } @@ -454,6 +455,8 @@ tty->print_cr("can_generate_resource_exhaustion_threads_events"); if (cap->can_generate_early_vmstart) tty->print_cr("can_generate_early_vmstart"); + if (cap->can_generate_early_class_hook_events) + tty->print_cr("can_generate_early_class_hook_events"); } #endif