mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 09:34:38 +02:00
6849968: 3/2 JVMTI tests fails on jdk5.0 with hs14
If a JVMTI agent asks for version 1.0, then it should get version 1.0 semantics. Reviewed-by: dholmes, ohair
This commit is contained in:
parent
8dd1b6ace1
commit
ce78944539
6 changed files with 81 additions and 14 deletions
|
@ -319,7 +319,27 @@ address JvmtiExport::get_field_modification_count_addr() {
|
|||
|
||||
jint
|
||||
JvmtiExport::get_jvmti_interface(JavaVM *jvm, void **penv, jint version) {
|
||||
/* To Do: add version checks */
|
||||
// The JVMTI_VERSION_INTERFACE_JVMTI part of the version number
|
||||
// has already been validated in JNI GetEnv().
|
||||
int major, minor, micro;
|
||||
|
||||
// micro version doesn't matter here (yet?)
|
||||
decode_version_values(version, &major, &minor, µ);
|
||||
switch (major) {
|
||||
case 1:
|
||||
switch (minor) {
|
||||
case 0: // version 1.0.<micro> is recognized
|
||||
case 1: // version 1.1.<micro> is recognized
|
||||
break;
|
||||
|
||||
default:
|
||||
return JNI_EVERSION; // unsupported minor version number
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return JNI_EVERSION; // unsupported major version number
|
||||
}
|
||||
|
||||
if (JvmtiEnv::get_phase() == JVMTI_PHASE_LIVE) {
|
||||
JavaThread* current_thread = (JavaThread*) ThreadLocalStorage::thread();
|
||||
|
@ -328,13 +348,13 @@ JvmtiExport::get_jvmti_interface(JavaVM *jvm, void **penv, jint version) {
|
|||
__ENTRY(jvmtiEnv*, JvmtiExport::get_jvmti_interface, current_thread)
|
||||
debug_only(VMNativeEntryWrapper __vew;)
|
||||
|
||||
JvmtiEnv *jvmti_env = JvmtiEnv::create_a_jvmti();
|
||||
JvmtiEnv *jvmti_env = JvmtiEnv::create_a_jvmti(version);
|
||||
*penv = jvmti_env->jvmti_external(); // actual type is jvmtiEnv* -- not to be confused with JvmtiEnv*
|
||||
return JNI_OK;
|
||||
|
||||
} else if (JvmtiEnv::get_phase() == JVMTI_PHASE_ONLOAD) {
|
||||
// not live, no thread to transition
|
||||
JvmtiEnv *jvmti_env = JvmtiEnv::create_a_jvmti();
|
||||
JvmtiEnv *jvmti_env = JvmtiEnv::create_a_jvmti(version);
|
||||
*penv = jvmti_env->jvmti_external(); // actual type is jvmtiEnv* -- not to be confused with JvmtiEnv*
|
||||
return JNI_OK;
|
||||
|
||||
|
@ -345,6 +365,15 @@ JvmtiExport::get_jvmti_interface(JavaVM *jvm, void **penv, jint version) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JvmtiExport::decode_version_values(jint version, int * major, int * minor,
|
||||
int * micro) {
|
||||
*major = (version & JVMTI_VERSION_MASK_MAJOR) >> JVMTI_VERSION_SHIFT_MAJOR;
|
||||
*minor = (version & JVMTI_VERSION_MASK_MINOR) >> JVMTI_VERSION_SHIFT_MINOR;
|
||||
*micro = (version & JVMTI_VERSION_MASK_MICRO) >> JVMTI_VERSION_SHIFT_MICRO;
|
||||
}
|
||||
|
||||
void JvmtiExport::enter_primordial_phase() {
|
||||
JvmtiEnvBase::set_phase(JVMTI_PHASE_PRIMORDIAL);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue