Mercurial > hg > truffle
comparison src/share/vm/prims/jvmtiEnvBase.cpp @ 612:afa80fa86d22
Merge
author | dcubed |
---|---|
date | Mon, 02 Mar 2009 14:43:36 -0700 |
parents | 2f716c0acb64 |
children | b109e761e927 |
comparison
equal
deleted
inserted
replaced
593:1b68c738c0d9 | 612:afa80fa86d22 |
---|---|
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; |
1320 JvmtiEnvBase::force_early_return(JavaThread* java_thread, jvalue value, TosState tos) { | 1349 JvmtiEnvBase::force_early_return(JavaThread* java_thread, jvalue value, TosState tos) { |
1321 JavaThread* current_thread = JavaThread::current(); | 1350 JavaThread* current_thread = JavaThread::current(); |
1322 HandleMark hm(current_thread); | 1351 HandleMark hm(current_thread); |
1323 uint32_t debug_bits = 0; | 1352 uint32_t debug_bits = 0; |
1324 | 1353 |
1354 // retrieve or create the state | |
1355 JvmtiThreadState* state = JvmtiThreadState::state_for(java_thread); | |
1356 if (state == NULL) { | |
1357 return JVMTI_ERROR_THREAD_NOT_ALIVE; | |
1358 } | |
1359 | |
1325 // Check if java_thread is fully suspended | 1360 // Check if java_thread is fully suspended |
1326 if (!is_thread_fully_suspended(java_thread, | 1361 if (!is_thread_fully_suspended(java_thread, |
1327 true /* wait for suspend completion */, | 1362 true /* wait for suspend completion */, |
1328 &debug_bits)) { | 1363 &debug_bits)) { |
1329 return JVMTI_ERROR_THREAD_NOT_SUSPENDED; | 1364 return JVMTI_ERROR_THREAD_NOT_SUSPENDED; |
1330 } | 1365 } |
1331 | |
1332 // retreive or create the state | |
1333 JvmtiThreadState* state = JvmtiThreadState::state_for(java_thread); | |
1334 | 1366 |
1335 // Check to see if a ForceEarlyReturn was already in progress | 1367 // Check to see if a ForceEarlyReturn was already in progress |
1336 if (state->is_earlyret_pending()) { | 1368 if (state->is_earlyret_pending()) { |
1337 // Probably possible for JVMTI clients to trigger this, but the | 1369 // Probably possible for JVMTI clients to trigger this, but the |
1338 // JPDA backend shouldn't allow this to happen | 1370 // JPDA backend shouldn't allow this to happen |