< prev index next >

src/share/vm/runtime/frame.cpp

Print this page
rev 12854 : [mq]: gcinterface.patch


 871     if (!_is_static) oop_at_offset_do(_offset+1); // do the receiver
 872     iterate_parameters();
 873   }
 874 
 875 };
 876 
 877 oop* frame::interpreter_callee_receiver_addr(Symbol* signature) {
 878   ArgumentSizeComputer asc(signature);
 879   int size = asc.size();
 880   return (oop *)interpreter_frame_tos_at(size);
 881 }
 882 
 883 
 884 void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache) {
 885   assert(is_interpreted_frame(), "Not an interpreted frame");
 886   assert(map != NULL, "map must be set");
 887   Thread *thread = Thread::current();
 888   methodHandle m (thread, interpreter_frame_method());
 889   jint      bci = interpreter_frame_bci();
 890 
 891   assert(!Universe::heap()->is_in(m()),
 892           "must be valid oop");
 893   assert(m->is_method(), "checking frame value");
 894   assert((m->is_native() && bci == 0)  ||
 895          (!m->is_native() && bci >= 0 && bci < m->code_size()),
 896          "invalid bci value");
 897 
 898   // Handle the monitor elements in the activation
 899   for (
 900     BasicObjectLock* current = interpreter_frame_monitor_end();
 901     current < interpreter_frame_monitor_begin();
 902     current = next_monitor_in_interpreter_frame(current)
 903   ) {
 904 #ifdef ASSERT
 905     interpreter_frame_verify_monitor(current);
 906 #endif
 907     current->oops_do(f);
 908   }
 909 
 910   if (m->is_native()) {
 911     f->do_oop(interpreter_frame_temp_oop_addr());


1050 }
1051 
1052 
1053 // Get receiver out of callers frame, i.e. find parameter 0 in callers
1054 // frame.  Consult ADLC for where parameter 0 is to be found.  Then
1055 // check local reg_map for it being a callee-save register or argument
1056 // register, both of which are saved in the local frame.  If not found
1057 // there, it must be an in-stack argument of the caller.
1058 // Note: caller.sp() points to callee-arguments
1059 oop frame::retrieve_receiver(RegisterMap* reg_map) {
1060   frame caller = *this;
1061 
1062   // First consult the ADLC on where it puts parameter 0 for this signature.
1063   VMReg reg = SharedRuntime::name_for_receiver();
1064   oop* oop_adr = caller.oopmapreg_to_location(reg, reg_map);
1065   if (oop_adr == NULL) {
1066     guarantee(oop_adr != NULL, "bad register save location");
1067     return NULL;
1068   }
1069   oop r = *oop_adr;
1070   assert(Universe::heap()->is_in_or_null(r), "bad receiver: " INTPTR_FORMAT " (" INTX_FORMAT ")", p2i(r), p2i(r));
1071   return r;
1072 }
1073 
1074 
1075 oop* frame::oopmapreg_to_location(VMReg reg, const RegisterMap* reg_map) const {
1076   if(reg->is_reg()) {
1077     // If it is passed in a register, it got spilled in the stub frame.
1078     return (oop *)reg_map->location(reg);
1079   } else {
1080     int sp_offset_in_bytes = reg->reg2stack() * VMRegImpl::stack_slot_size;
1081     return (oop*)(((address)unextended_sp()) + sp_offset_in_bytes);
1082   }
1083 }
1084 
1085 BasicLock* frame::get_native_monitor() {
1086   nmethod* nm = (nmethod*)_cb;
1087   assert(_cb != NULL && _cb->is_nmethod() && nm->method()->is_native(),
1088          "Should not call this unless it's a native nmethod");
1089   int byte_offset = in_bytes(nm->native_basic_lock_sp_offset());
1090   assert(byte_offset >= 0, "should not see invalid offset");
1091   return (BasicLock*) &sp()[byte_offset / wordSize];
1092 }
1093 
1094 oop frame::get_native_receiver() {
1095   nmethod* nm = (nmethod*)_cb;
1096   assert(_cb != NULL && _cb->is_nmethod() && nm->method()->is_native(),
1097          "Should not call this unless it's a native nmethod");
1098   int byte_offset = in_bytes(nm->native_receiver_sp_offset());
1099   assert(byte_offset >= 0, "should not see invalid offset");
1100   oop owner = ((oop*) sp())[byte_offset / wordSize];
1101   assert( Universe::heap()->is_in(owner), "bad receiver" );
1102   return owner;
1103 }
1104 
1105 void frame::oops_entry_do(OopClosure* f, const RegisterMap* map) {
1106   assert(map != NULL, "map must be set");
1107   if (map->include_argument_oops()) {
1108     // must collect argument oops, as nobody else is doing it
1109     Thread *thread = Thread::current();
1110     methodHandle m (thread, entry_frame_call_wrapper()->callee_method());
1111     EntryFrameOopFinder finder(this, m->signature(), m->is_static());
1112     finder.arguments_do(f);
1113   }
1114   // Traverse the Handle Block saved in the entry frame
1115   entry_frame_call_wrapper()->oops_do(f);
1116 }
1117 
1118 
1119 void frame::oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache) {
1120 #ifndef PRODUCT
1121   // simulate GC crash here to dump java thread in error report




 871     if (!_is_static) oop_at_offset_do(_offset+1); // do the receiver
 872     iterate_parameters();
 873   }
 874 
 875 };
 876 
 877 oop* frame::interpreter_callee_receiver_addr(Symbol* signature) {
 878   ArgumentSizeComputer asc(signature);
 879   int size = asc.size();
 880   return (oop *)interpreter_frame_tos_at(size);
 881 }
 882 
 883 
 884 void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache) {
 885   assert(is_interpreted_frame(), "Not an interpreted frame");
 886   assert(map != NULL, "map must be set");
 887   Thread *thread = Thread::current();
 888   methodHandle m (thread, interpreter_frame_method());
 889   jint      bci = interpreter_frame_bci();
 890 
 891   assert(!GC::gc()->heap()->is_in(m()),
 892           "must be valid oop");
 893   assert(m->is_method(), "checking frame value");
 894   assert((m->is_native() && bci == 0)  ||
 895          (!m->is_native() && bci >= 0 && bci < m->code_size()),
 896          "invalid bci value");
 897 
 898   // Handle the monitor elements in the activation
 899   for (
 900     BasicObjectLock* current = interpreter_frame_monitor_end();
 901     current < interpreter_frame_monitor_begin();
 902     current = next_monitor_in_interpreter_frame(current)
 903   ) {
 904 #ifdef ASSERT
 905     interpreter_frame_verify_monitor(current);
 906 #endif
 907     current->oops_do(f);
 908   }
 909 
 910   if (m->is_native()) {
 911     f->do_oop(interpreter_frame_temp_oop_addr());


1050 }
1051 
1052 
1053 // Get receiver out of callers frame, i.e. find parameter 0 in callers
1054 // frame.  Consult ADLC for where parameter 0 is to be found.  Then
1055 // check local reg_map for it being a callee-save register or argument
1056 // register, both of which are saved in the local frame.  If not found
1057 // there, it must be an in-stack argument of the caller.
1058 // Note: caller.sp() points to callee-arguments
1059 oop frame::retrieve_receiver(RegisterMap* reg_map) {
1060   frame caller = *this;
1061 
1062   // First consult the ADLC on where it puts parameter 0 for this signature.
1063   VMReg reg = SharedRuntime::name_for_receiver();
1064   oop* oop_adr = caller.oopmapreg_to_location(reg, reg_map);
1065   if (oop_adr == NULL) {
1066     guarantee(oop_adr != NULL, "bad register save location");
1067     return NULL;
1068   }
1069   oop r = *oop_adr;
1070   assert(GC::gc()->heap()->is_in_or_null(r), "bad receiver: " INTPTR_FORMAT " (" INTX_FORMAT ")", p2i(r), p2i(r));
1071   return r;
1072 }
1073 
1074 
1075 oop* frame::oopmapreg_to_location(VMReg reg, const RegisterMap* reg_map) const {
1076   if(reg->is_reg()) {
1077     // If it is passed in a register, it got spilled in the stub frame.
1078     return (oop *)reg_map->location(reg);
1079   } else {
1080     int sp_offset_in_bytes = reg->reg2stack() * VMRegImpl::stack_slot_size;
1081     return (oop*)(((address)unextended_sp()) + sp_offset_in_bytes);
1082   }
1083 }
1084 
1085 BasicLock* frame::get_native_monitor() {
1086   nmethod* nm = (nmethod*)_cb;
1087   assert(_cb != NULL && _cb->is_nmethod() && nm->method()->is_native(),
1088          "Should not call this unless it's a native nmethod");
1089   int byte_offset = in_bytes(nm->native_basic_lock_sp_offset());
1090   assert(byte_offset >= 0, "should not see invalid offset");
1091   return (BasicLock*) &sp()[byte_offset / wordSize];
1092 }
1093 
1094 oop frame::get_native_receiver() {
1095   nmethod* nm = (nmethod*)_cb;
1096   assert(_cb != NULL && _cb->is_nmethod() && nm->method()->is_native(),
1097          "Should not call this unless it's a native nmethod");
1098   int byte_offset = in_bytes(nm->native_receiver_sp_offset());
1099   assert(byte_offset >= 0, "should not see invalid offset");
1100   oop owner = ((oop*) sp())[byte_offset / wordSize];
1101   assert( GC::gc()->heap()->is_in(owner), "bad receiver" );
1102   return owner;
1103 }
1104 
1105 void frame::oops_entry_do(OopClosure* f, const RegisterMap* map) {
1106   assert(map != NULL, "map must be set");
1107   if (map->include_argument_oops()) {
1108     // must collect argument oops, as nobody else is doing it
1109     Thread *thread = Thread::current();
1110     methodHandle m (thread, entry_frame_call_wrapper()->callee_method());
1111     EntryFrameOopFinder finder(this, m->signature(), m->is_static());
1112     finder.arguments_do(f);
1113   }
1114   // Traverse the Handle Block saved in the entry frame
1115   entry_frame_call_wrapper()->oops_do(f);
1116 }
1117 
1118 
1119 void frame::oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache) {
1120 #ifndef PRODUCT
1121   // simulate GC crash here to dump java thread in error report


< prev index next >