3240 Method* moop = fr.interpreter_frame_method();
3241 int max_locals = moop->max_locals();
3242 // Allocate temp buffer, 1 word per local & 2 per active monitor
3243 int buf_size_words = max_locals + active_monitor_count * BasicObjectLock::size();
3244 intptr_t *buf = NEW_C_HEAP_ARRAY(intptr_t,buf_size_words, mtCode);
3245
3246 // Copy the locals. Order is preserved so that loading of longs works.
3247 // Since there's no GC I can copy the oops blindly.
3248 assert(sizeof(HeapWord)==sizeof(intptr_t), "fix this code");
3249 Copy::disjoint_words((HeapWord*)fr.interpreter_frame_local_at(max_locals-1),
3250 (HeapWord*)&buf[0],
3251 max_locals);
3252
3253 // Inflate locks. Copy the displaced headers. Be careful, there can be holes.
3254 int i = max_locals;
3255 for (BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
3256 kptr2 < fr.interpreter_frame_monitor_begin();
3257 kptr2 = fr.next_monitor_in_interpreter_frame(kptr2) ) {
3258 if (kptr2->obj() != nullptr) { // Avoid 'holes' in the monitor array
3259 BasicLock *lock = kptr2->lock();
3260 // Inflate so the object's header no longer refers to the BasicLock.
3261 if (lock->displaced_header().is_unlocked()) {
3262 // The object is locked and the resulting ObjectMonitor* will also be
3263 // locked so it can't be async deflated until ownership is dropped.
3264 // See the big comment in basicLock.cpp: BasicLock::move_to().
3265 ObjectSynchronizer::inflate_helper(kptr2->obj());
3266 }
3267 // Now the displaced header is free to move because the
3268 // object's header no longer refers to it.
3269 buf[i++] = (intptr_t)lock->displaced_header().value();
3270 buf[i++] = cast_from_oop<intptr_t>(kptr2->obj());
3271 }
3272 }
3273 assert(i - max_locals == active_monitor_count*2, "found the expected number of monitors");
3274
3275 RegisterMap map(current,
3276 RegisterMap::UpdateMap::skip,
3277 RegisterMap::ProcessFrames::include,
3278 RegisterMap::WalkContinuation::skip);
3279 frame sender = fr.sender(&map);
3280 if (sender.is_interpreted_frame()) {
3281 current->push_cont_fastpath(sender.sp());
3282 }
3283
3284 return buf;
3285 JRT_END
3286
3287 JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
3288 FREE_C_HEAP_ARRAY(intptr_t, buf);
3289 JRT_END
|
3240 Method* moop = fr.interpreter_frame_method();
3241 int max_locals = moop->max_locals();
3242 // Allocate temp buffer, 1 word per local & 2 per active monitor
3243 int buf_size_words = max_locals + active_monitor_count * BasicObjectLock::size();
3244 intptr_t *buf = NEW_C_HEAP_ARRAY(intptr_t,buf_size_words, mtCode);
3245
3246 // Copy the locals. Order is preserved so that loading of longs works.
3247 // Since there's no GC I can copy the oops blindly.
3248 assert(sizeof(HeapWord)==sizeof(intptr_t), "fix this code");
3249 Copy::disjoint_words((HeapWord*)fr.interpreter_frame_local_at(max_locals-1),
3250 (HeapWord*)&buf[0],
3251 max_locals);
3252
3253 // Inflate locks. Copy the displaced headers. Be careful, there can be holes.
3254 int i = max_locals;
3255 for (BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
3256 kptr2 < fr.interpreter_frame_monitor_begin();
3257 kptr2 = fr.next_monitor_in_interpreter_frame(kptr2) ) {
3258 if (kptr2->obj() != nullptr) { // Avoid 'holes' in the monitor array
3259 BasicLock *lock = kptr2->lock();
3260 if (LockingMode == LM_LEGACY) {
3261 // Inflate so the object's header no longer refers to the BasicLock.
3262 if (lock->displaced_header().is_unlocked()) {
3263 // The object is locked and the resulting ObjectMonitor* will also be
3264 // locked so it can't be async deflated until ownership is dropped.
3265 // See the big comment in basicLock.cpp: BasicLock::move_to().
3266 ObjectSynchronizer::inflate_helper(kptr2->obj());
3267 }
3268 // Now the displaced header is free to move because the
3269 // object's header no longer refers to it.
3270 buf[i] = (intptr_t)lock->displaced_header().value();
3271 }
3272 #ifdef ASSERT
3273 else {
3274 buf[i] = badDispHeaderOSR;
3275 }
3276 #endif
3277 i++;
3278 buf[i++] = cast_from_oop<intptr_t>(kptr2->obj());
3279 }
3280 }
3281 assert(i - max_locals == active_monitor_count*2, "found the expected number of monitors");
3282
3283 RegisterMap map(current,
3284 RegisterMap::UpdateMap::skip,
3285 RegisterMap::ProcessFrames::include,
3286 RegisterMap::WalkContinuation::skip);
3287 frame sender = fr.sender(&map);
3288 if (sender.is_interpreted_frame()) {
3289 current->push_cont_fastpath(sender.sp());
3290 }
3291
3292 return buf;
3293 JRT_END
3294
3295 JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
3296 FREE_C_HEAP_ARRAY(intptr_t, buf);
3297 JRT_END
|