< prev index next >

src/hotspot/share/runtime/vframeArray.cpp

Print this page

 70 #endif
 71 
 72   int index;
 73 
 74   {
 75     Thread* current_thread = Thread::current();
 76     ResourceMark rm(current_thread);
 77     HandleMark hm(current_thread);
 78 
 79     // Get the monitors off-stack
 80 
 81     GrowableArray<MonitorInfo*>* list = vf->monitors();
 82     if (list->is_empty()) {
 83       _monitors = NULL;
 84     } else {
 85 
 86       // Allocate monitor chunk
 87       _monitors = new MonitorChunk(list->length());
 88       vf->thread()->add_monitor_chunk(_monitors);
 89 
 90       // Migrate the BasicLocks from the stack to the monitor chunk
 91       for (index = 0; index < list->length(); index++) {
 92         MonitorInfo* monitor = list->at(index);
 93         assert(!monitor->owner_is_scalar_replaced() || realloc_failures, "object should be reallocated already");
 94         BasicObjectLock* dest = _monitors->at(index);
 95         if (monitor->owner_is_scalar_replaced()) {
 96           dest->set_obj(NULL);
 97         } else {
 98           assert(monitor->owner() == NULL || !monitor->owner()->is_unlocked(), "object must be null or locked");
 99           dest->set_obj(monitor->owner());
100           monitor->lock()->move_to(monitor->owner(), dest->lock());
101         }
102       }
103     }
104   }
105 
106   // Convert the vframe locals and expressions to off stack
107   // values. Because we will not gc all oops can be converted to
108   // intptr_t (i.e. a stack slot) and we are fine. This is
109   // good since we are inside a HandleMark and the oops in our
110   // collection would go away between packing them here and
111   // unpacking them in unpack_on_stack.
112 
113   // First the locals go off-stack
114 
115   // FIXME this seems silly it creates a StackValueCollection
116   // in order to get the size to then copy them and
117   // convert the types to intptr_t size slots. Seems like it
118   // could do it in place... Still uses less memory than the
119   // old way though
120 

291                                  callee_parameters,
292                                  callee_locals,
293                                  caller,
294                                  iframe(),
295                                  is_top_frame,
296                                  is_bottom_frame);
297 
298   // Update the pc in the frame object and overwrite the temporary pc
299   // we placed in the skeletal frame now that we finally know the
300   // exact interpreter address we should use.
301 
302   _frame.patch_pc(thread, pc);
303 
304   assert (!method()->is_synchronized() || locks > 0 || _removed_monitors || raw_bci() == SynchronizationEntryBCI, "synchronized methods must have monitors");
305 
306   BasicObjectLock* top = iframe()->interpreter_frame_monitor_begin();
307   for (int index = 0; index < locks; index++) {
308     top = iframe()->previous_monitor_in_interpreter_frame(top);
309     BasicObjectLock* src = _monitors->at(index);
310     top->set_obj(src->obj());
311     src->lock()->move_to(src->obj(), top->lock());
312   }
313   if (ProfileInterpreter) {
314     iframe()->interpreter_frame_set_mdp(0); // clear out the mdp.
315   }
316   iframe()->interpreter_frame_set_bcp(bcp);
317   if (ProfileInterpreter) {
318     MethodData* mdo = method()->method_data();
319     if (mdo != NULL) {
320       int bci = iframe()->interpreter_frame_bci();
321       if (use_next_mdp) ++bci;
322       address mdp = mdo->bci_to_dp(bci);
323       iframe()->interpreter_frame_set_mdp(mdp);
324     }
325   }
326 
327 #ifndef PRODUCT
328   if (PrintDeoptimizationDetails) {
329     tty->print_cr("Expressions size: %d", expressions()->size());
330   }
331 #endif // !PRODUCT

 70 #endif
 71 
 72   int index;
 73 
 74   {
 75     Thread* current_thread = Thread::current();
 76     ResourceMark rm(current_thread);
 77     HandleMark hm(current_thread);
 78 
 79     // Get the monitors off-stack
 80 
 81     GrowableArray<MonitorInfo*>* list = vf->monitors();
 82     if (list->is_empty()) {
 83       _monitors = NULL;
 84     } else {
 85 
 86       // Allocate monitor chunk
 87       _monitors = new MonitorChunk(list->length());
 88       vf->thread()->add_monitor_chunk(_monitors);
 89 
 90       // Migrate the BasicObjectLocks from the stack to the monitor chunk
 91       for (index = 0; index < list->length(); index++) {
 92         MonitorInfo* monitor = list->at(index);
 93         assert(!monitor->owner_is_scalar_replaced() || realloc_failures, "object should be reallocated already");
 94         BasicObjectLock* dest = _monitors->at(index);
 95         if (monitor->owner_is_scalar_replaced()) {
 96           dest->set_obj(NULL);
 97         } else {
 98           assert(monitor->owner() == NULL || !monitor->owner()->is_unlocked(), "object must be null or locked");
 99           dest->set_obj(monitor->owner());

100         }
101       }
102     }
103   }
104 
105   // Convert the vframe locals and expressions to off stack
106   // values. Because we will not gc all oops can be converted to
107   // intptr_t (i.e. a stack slot) and we are fine. This is
108   // good since we are inside a HandleMark and the oops in our
109   // collection would go away between packing them here and
110   // unpacking them in unpack_on_stack.
111 
112   // First the locals go off-stack
113 
114   // FIXME this seems silly it creates a StackValueCollection
115   // in order to get the size to then copy them and
116   // convert the types to intptr_t size slots. Seems like it
117   // could do it in place... Still uses less memory than the
118   // old way though
119 

290                                  callee_parameters,
291                                  callee_locals,
292                                  caller,
293                                  iframe(),
294                                  is_top_frame,
295                                  is_bottom_frame);
296 
297   // Update the pc in the frame object and overwrite the temporary pc
298   // we placed in the skeletal frame now that we finally know the
299   // exact interpreter address we should use.
300 
301   _frame.patch_pc(thread, pc);
302 
303   assert (!method()->is_synchronized() || locks > 0 || _removed_monitors || raw_bci() == SynchronizationEntryBCI, "synchronized methods must have monitors");
304 
305   BasicObjectLock* top = iframe()->interpreter_frame_monitor_begin();
306   for (int index = 0; index < locks; index++) {
307     top = iframe()->previous_monitor_in_interpreter_frame(top);
308     BasicObjectLock* src = _monitors->at(index);
309     top->set_obj(src->obj());

310   }
311   if (ProfileInterpreter) {
312     iframe()->interpreter_frame_set_mdp(0); // clear out the mdp.
313   }
314   iframe()->interpreter_frame_set_bcp(bcp);
315   if (ProfileInterpreter) {
316     MethodData* mdo = method()->method_data();
317     if (mdo != NULL) {
318       int bci = iframe()->interpreter_frame_bci();
319       if (use_next_mdp) ++bci;
320       address mdp = mdo->bci_to_dp(bci);
321       iframe()->interpreter_frame_set_mdp(mdp);
322     }
323   }
324 
325 #ifndef PRODUCT
326   if (PrintDeoptimizationDetails) {
327     tty->print_cr("Expressions size: %d", expressions()->size());
328   }
329 #endif // !PRODUCT
< prev index next >