< prev index next >

src/share/vm/runtime/frame.cpp

Print this page
rev 13143 : 8183001: Various inlining improvements
Reviewed-by: iklam, mikael, ehelin


1057 // check local reg_map for it being a callee-save register or argument
1058 // register, both of which are saved in the local frame.  If not found
1059 // there, it must be an in-stack argument of the caller.
1060 // Note: caller.sp() points to callee-arguments
1061 oop frame::retrieve_receiver(RegisterMap* reg_map) {
1062   frame caller = *this;
1063 
1064   // First consult the ADLC on where it puts parameter 0 for this signature.
1065   VMReg reg = SharedRuntime::name_for_receiver();
1066   oop* oop_adr = caller.oopmapreg_to_location(reg, reg_map);
1067   if (oop_adr == NULL) {
1068     guarantee(oop_adr != NULL, "bad register save location");
1069     return NULL;
1070   }
1071   oop r = *oop_adr;
1072   assert(Universe::heap()->is_in_or_null(r), "bad receiver: " INTPTR_FORMAT " (" INTX_FORMAT ")", p2i(r), p2i(r));
1073   return r;
1074 }
1075 
1076 
1077 oop* frame::oopmapreg_to_location(VMReg reg, const RegisterMap* reg_map) const {
1078   if(reg->is_reg()) {
1079     // If it is passed in a register, it got spilled in the stub frame.
1080     return (oop *)reg_map->location(reg);
1081   } else {
1082     int sp_offset_in_bytes = reg->reg2stack() * VMRegImpl::stack_slot_size;
1083     return (oop*)(((address)unextended_sp()) + sp_offset_in_bytes);
1084   }
1085 }
1086 
1087 BasicLock* frame::get_native_monitor() {
1088   nmethod* nm = (nmethod*)_cb;
1089   assert(_cb != NULL && _cb->is_nmethod() && nm->method()->is_native(),
1090          "Should not call this unless it's a native nmethod");
1091   int byte_offset = in_bytes(nm->native_basic_lock_sp_offset());
1092   assert(byte_offset >= 0, "should not see invalid offset");
1093   return (BasicLock*) &sp()[byte_offset / wordSize];
1094 }
1095 
1096 oop frame::get_native_receiver() {
1097   nmethod* nm = (nmethod*)_cb;
1098   assert(_cb != NULL && _cb->is_nmethod() && nm->method()->is_native(),
1099          "Should not call this unless it's a native nmethod");
1100   int byte_offset = in_bytes(nm->native_receiver_sp_offset());
1101   assert(byte_offset >= 0, "should not see invalid offset");
1102   oop owner = ((oop*) sp())[byte_offset / wordSize];
1103   assert( Universe::heap()->is_in(owner), "bad receiver" );
1104   return owner;
1105 }
1106 




1057 // check local reg_map for it being a callee-save register or argument
1058 // register, both of which are saved in the local frame.  If not found
1059 // there, it must be an in-stack argument of the caller.
1060 // Note: caller.sp() points to callee-arguments
1061 oop frame::retrieve_receiver(RegisterMap* reg_map) {
1062   frame caller = *this;
1063 
1064   // First consult the ADLC on where it puts parameter 0 for this signature.
1065   VMReg reg = SharedRuntime::name_for_receiver();
1066   oop* oop_adr = caller.oopmapreg_to_location(reg, reg_map);
1067   if (oop_adr == NULL) {
1068     guarantee(oop_adr != NULL, "bad register save location");
1069     return NULL;
1070   }
1071   oop r = *oop_adr;
1072   assert(Universe::heap()->is_in_or_null(r), "bad receiver: " INTPTR_FORMAT " (" INTX_FORMAT ")", p2i(r), p2i(r));
1073   return r;
1074 }
1075 
1076 










1077 BasicLock* frame::get_native_monitor() {
1078   nmethod* nm = (nmethod*)_cb;
1079   assert(_cb != NULL && _cb->is_nmethod() && nm->method()->is_native(),
1080          "Should not call this unless it's a native nmethod");
1081   int byte_offset = in_bytes(nm->native_basic_lock_sp_offset());
1082   assert(byte_offset >= 0, "should not see invalid offset");
1083   return (BasicLock*) &sp()[byte_offset / wordSize];
1084 }
1085 
1086 oop frame::get_native_receiver() {
1087   nmethod* nm = (nmethod*)_cb;
1088   assert(_cb != NULL && _cb->is_nmethod() && nm->method()->is_native(),
1089          "Should not call this unless it's a native nmethod");
1090   int byte_offset = in_bytes(nm->native_receiver_sp_offset());
1091   assert(byte_offset >= 0, "should not see invalid offset");
1092   oop owner = ((oop*) sp())[byte_offset / wordSize];
1093   assert( Universe::heap()->is_in(owner), "bad receiver" );
1094   return owner;
1095 }
1096 


< prev index next >