src/share/vm/prims/jvmtiEnvBase.cpp

changeset 1046
2f716c0acb64
parent 1044
ea20d7ce26b0
child 1253
b109e761e927
equal deleted inserted replaced
1045:70998f2e05ef 1046:2f716c0acb64
89 } 89 }
90 90
91 if (_globally_initialized == false) { 91 if (_globally_initialized == false) {
92 globally_initialize(); 92 globally_initialize();
93 } 93 }
94 }
95
96
97 bool
98 JvmtiEnvBase::is_valid() {
99 jint value = 0;
100
101 // This object might not be a JvmtiEnvBase so we can't assume
102 // the _magic field is properly aligned. Get the value in a safe
103 // way and then check against JVMTI_MAGIC.
104
105 switch (sizeof(_magic)) {
106 case 2:
107 value = Bytes::get_native_u2((address)&_magic);
108 break;
109
110 case 4:
111 value = Bytes::get_native_u4((address)&_magic);
112 break;
113
114 case 8:
115 value = Bytes::get_native_u8((address)&_magic);
116 break;
117
118 default:
119 guarantee(false, "_magic field is an unexpected size");
120 }
121
122 return value == JVMTI_MAGIC;
94 } 123 }
95 124
96 125
97 JvmtiEnvBase::JvmtiEnvBase() : _env_event_enable() { 126 JvmtiEnvBase::JvmtiEnvBase() : _env_event_enable() {
98 _env_local_storage = NULL; 127 _env_local_storage = NULL;

mercurial