3224 Method* moop = fr.interpreter_frame_method();
3225 int max_locals = moop->max_locals();
3226 // Allocate temp buffer, 1 word per local & 2 per active monitor
3227 int buf_size_words = max_locals + active_monitor_count * BasicObjectLock::size();
3228 intptr_t *buf = NEW_C_HEAP_ARRAY(intptr_t,buf_size_words, mtCode);
3229
3230 // Copy the locals. Order is preserved so that loading of longs works.
3231 // Since there's no GC I can copy the oops blindly.
3232 assert(sizeof(HeapWord)==sizeof(intptr_t), "fix this code");
3233 Copy::disjoint_words((HeapWord*)fr.interpreter_frame_local_at(max_locals-1),
3234 (HeapWord*)&buf[0],
3235 max_locals);
3236
3237 // Inflate locks. Copy the displaced headers. Be careful, there can be holes.
3238 int i = max_locals;
3239 for (BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
3240 kptr2 < fr.interpreter_frame_monitor_begin();
3241 kptr2 = fr.next_monitor_in_interpreter_frame(kptr2) ) {
3242 if (kptr2->obj() != NULL) { // Avoid 'holes' in the monitor array
3243 BasicLock *lock = kptr2->lock();
3244 // Inflate so the object's header no longer refers to the BasicLock.
3245 if (lock->displaced_header().is_unlocked()) {
3246 // The object is locked and the resulting ObjectMonitor* will also be
3247 // locked so it can't be async deflated until ownership is dropped.
3248 // See the big comment in basicLock.cpp: BasicLock::move_to().
3249 ObjectSynchronizer::inflate_helper(kptr2->obj());
3250 }
3251 // Now the displaced header is free to move because the
3252 // object's header no longer refers to it.
3253 buf[i++] = (intptr_t)lock->displaced_header().value();
3254 buf[i++] = cast_from_oop<intptr_t>(kptr2->obj());
3255 }
3256 }
3257 assert(i - max_locals == active_monitor_count*2, "found the expected number of monitors");
3258
3259 return buf;
3260 JRT_END
3261
3262 JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
3263 FREE_C_HEAP_ARRAY(intptr_t, buf);
3264 JRT_END
3265
3266 bool AdapterHandlerLibrary::contains(const CodeBlob* b) {
3267 AdapterHandlerTableIterator iter(_adapters);
3268 while (iter.has_next()) {
3269 AdapterHandlerEntry* a = iter.next();
3270 if (b == CodeCache::find_blob(a->get_i2c_entry())) return true;
3271 }
3272 return false;
3273 }
|
3224 Method* moop = fr.interpreter_frame_method();
3225 int max_locals = moop->max_locals();
3226 // Allocate temp buffer, 1 word per local & 2 per active monitor
3227 int buf_size_words = max_locals + active_monitor_count * BasicObjectLock::size();
3228 intptr_t *buf = NEW_C_HEAP_ARRAY(intptr_t,buf_size_words, mtCode);
3229
3230 // Copy the locals. Order is preserved so that loading of longs works.
3231 // Since there's no GC I can copy the oops blindly.
3232 assert(sizeof(HeapWord)==sizeof(intptr_t), "fix this code");
3233 Copy::disjoint_words((HeapWord*)fr.interpreter_frame_local_at(max_locals-1),
3234 (HeapWord*)&buf[0],
3235 max_locals);
3236
3237 // Inflate locks. Copy the displaced headers. Be careful, there can be holes.
3238 int i = max_locals;
3239 for (BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
3240 kptr2 < fr.interpreter_frame_monitor_begin();
3241 kptr2 = fr.next_monitor_in_interpreter_frame(kptr2) ) {
3242 if (kptr2->obj() != NULL) { // Avoid 'holes' in the monitor array
3243 BasicLock *lock = kptr2->lock();
3244 if (LockingMode == LM_LEGACY) {
3245 // Inflate so the object's header no longer refers to the BasicLock.
3246 if (lock->displaced_header().is_unlocked()) {
3247 // The object is locked and the resulting ObjectMonitor* will also be
3248 // locked so it can't be async deflated until ownership is dropped.
3249 // See the big comment in basicLock.cpp: BasicLock::move_to().
3250 ObjectSynchronizer::inflate_helper(kptr2->obj());
3251 }
3252 // Now the displaced header is free to move because the
3253 // object's header no longer refers to it.
3254 buf[i] = (intptr_t)lock->displaced_header().value();
3255 }
3256 #ifdef ASSERT
3257 else {
3258 buf[i] = badDispHeaderOSR;
3259 }
3260 #endif
3261 i++;
3262 buf[i++] = cast_from_oop<intptr_t>(kptr2->obj());
3263 }
3264 }
3265 assert(i - max_locals == active_monitor_count*2, "found the expected number of monitors");
3266
3267 return buf;
3268 JRT_END
3269
3270 JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
3271 FREE_C_HEAP_ARRAY(intptr_t, buf);
3272 JRT_END
3273
3274 bool AdapterHandlerLibrary::contains(const CodeBlob* b) {
3275 AdapterHandlerTableIterator iter(_adapters);
3276 while (iter.has_next()) {
3277 AdapterHandlerEntry* a = iter.next();
3278 if (b == CodeCache::find_blob(a->get_i2c_entry())) return true;
3279 }
3280 return false;
3281 }
|