< prev index next >

src/hotspot/share/runtime/stackValue.cpp

Print this page

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

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