< prev index next >

src/hotspot/share/runtime/stackValue.cpp

Print this page

275   if (!reg_map->in_cont()) {
276     address value_addr = loc.is_register()
277       // Value was in a callee-save register
278       ? reg_map->location(VMRegImpl::as_VMReg(loc.register_number()), fr->sp())
279       // Else value was directly saved on the stack. The frame's original stack pointer,
280       // before any extension by its callee (due to Compiler1 linkage on SPARC), must be used.
281       : ((address)fr->unextended_sp()) + loc.stack_offset();
282 
283     assert(value_addr == nullptr || reg_map->thread() == nullptr || reg_map->thread()->is_in_usable_stack(value_addr), INTPTR_FORMAT, p2i(value_addr));
284     return value_addr;
285   }
286 
287   address value_addr = loc.is_register()
288     ? reg_map->as_RegisterMap()->stack_chunk()->reg_to_location(*fr, reg_map->as_RegisterMap(), VMRegImpl::as_VMReg(loc.register_number()))
289     : reg_map->as_RegisterMap()->stack_chunk()->usp_offset_to_location(*fr, loc.stack_offset());
290 
291   assert(value_addr == nullptr || Continuation::is_in_usable_stack(value_addr, reg_map->as_RegisterMap()) || (reg_map->thread() != nullptr && reg_map->thread()->is_in_usable_stack(value_addr)), INTPTR_FORMAT, p2i(value_addr));
292   return value_addr;
293 }
294 
295 BasicLock* StackValue::resolve_monitor_lock(const frame* fr, Location location) {
296   assert(location.is_stack(), "for now we only look at the stack");
297   int word_offset = location.stack_offset() / wordSize;
298   // (stack picture)
299   // high: [     ]  word_offset + 1
300   // low   [     ]  word_offset
301   //
302   // sp->  [     ]  0
303   // the word_offset is the distance from the stack pointer to the lowest address
304   // The frame's original stack pointer, before any extension by its callee
305   // (due to Compiler1 linkage on SPARC), must be used.
306   return (BasicLock*) (fr->unextended_sp() + word_offset);
307 }
308 
309 
310 #ifndef PRODUCT
311 
312 void StackValue::print_on(outputStream* st) const {
313   switch(_type) {
314     case T_INT:
315       st->print("%d (int) %f (float) %x (hex)",  *(int *)&_integer_value, *(float *)&_integer_value,  *(int *)&_integer_value);
316       break;
317 
318     case T_OBJECT:
319       if (_handle_value() != nullptr) {
320         _handle_value()->print_value_on(st);
321       } else {
322         st->print("null");
323       }
324       st->print(" <" INTPTR_FORMAT ">", p2i(_handle_value()));
325       break;
326 

275   if (!reg_map->in_cont()) {
276     address value_addr = loc.is_register()
277       // Value was in a callee-save register
278       ? reg_map->location(VMRegImpl::as_VMReg(loc.register_number()), fr->sp())
279       // Else value was directly saved on the stack. The frame's original stack pointer,
280       // before any extension by its callee (due to Compiler1 linkage on SPARC), must be used.
281       : ((address)fr->unextended_sp()) + loc.stack_offset();
282 
283     assert(value_addr == nullptr || reg_map->thread() == nullptr || reg_map->thread()->is_in_usable_stack(value_addr), INTPTR_FORMAT, p2i(value_addr));
284     return value_addr;
285   }
286 
287   address value_addr = loc.is_register()
288     ? reg_map->as_RegisterMap()->stack_chunk()->reg_to_location(*fr, reg_map->as_RegisterMap(), VMRegImpl::as_VMReg(loc.register_number()))
289     : reg_map->as_RegisterMap()->stack_chunk()->usp_offset_to_location(*fr, loc.stack_offset());
290 
291   assert(value_addr == nullptr || Continuation::is_in_usable_stack(value_addr, reg_map->as_RegisterMap()) || (reg_map->thread() != nullptr && reg_map->thread()->is_in_usable_stack(value_addr)), INTPTR_FORMAT, p2i(value_addr));
292   return value_addr;
293 }
294 
295 BasicLock* StackValue::resolve_monitor_lock(const frame& fr, Location location) {
296   assert(location.is_stack(), "for now we only look at the stack");
297   int word_offset = location.stack_offset() / wordSize;
298   // (stack picture)
299   // high: [     ]  word_offset + 1
300   // low   [     ]  word_offset
301   //
302   // sp->  [     ]  0
303   // the word_offset is the distance from the stack pointer to the lowest address
304   // The frame's original stack pointer, before any extension by its callee
305   // (due to Compiler1 linkage on SPARC), must be used.
306   return (BasicLock*) (fr.unextended_sp() + word_offset);
307 }
308 
309 
310 #ifndef PRODUCT
311 
312 void StackValue::print_on(outputStream* st) const {
313   switch(_type) {
314     case T_INT:
315       st->print("%d (int) %f (float) %x (hex)",  *(int *)&_integer_value, *(float *)&_integer_value,  *(int *)&_integer_value);
316       break;
317 
318     case T_OBJECT:
319       if (_handle_value() != nullptr) {
320         _handle_value()->print_value_on(st);
321       } else {
322         st->print("null");
323       }
324       st->print(" <" INTPTR_FORMAT ">", p2i(_handle_value()));
325       break;
326 
< prev index next >