< prev index next >

src/share/vm/runtime/frame.cpp

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


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


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




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


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


< prev index next >