< prev index next >

src/hotspot/share/runtime/frame.cpp

Print this page

 874   }
 875 
 876   void arguments_do(OopClosure* f) {
 877     _f = f;
 878     if (!_is_static)  oop_at_offset_do(_offset); // do the receiver
 879     do_parameters_on(this);
 880   }
 881 
 882 };
 883 
 884 oop* frame::interpreter_callee_receiver_addr(Symbol* signature) {
 885   ArgumentSizeComputer asc(signature);
 886   int size = asc.size();
 887   return (oop *)interpreter_frame_tos_at(size);
 888 }
 889 
 890 oop frame::interpreter_callee_receiver(Symbol* signature) {
 891   return *interpreter_callee_receiver_addr(signature);
 892 }
 893 
 894 void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache) const {

 895   assert(is_interpreted_frame(), "Not an interpreted frame");
 896   Thread *thread = Thread::current();
 897   methodHandle m (thread, interpreter_frame_method());
 898   jint      bci = interpreter_frame_bci();
 899 
 900   assert(!Universe::heap()->is_in(m()),
 901           "must be valid oop");
 902   assert(m->is_method(), "checking frame value");
 903   assert((m->is_native() && bci == 0)  ||
 904          (!m->is_native() && bci >= 0 && bci < m->code_size()),
 905          "invalid bci value");
 906 
 907   // Handle the monitor elements in the activation
 908   for (
 909     BasicObjectLock* current = interpreter_frame_monitor_end();
 910     current < interpreter_frame_monitor_begin();
 911     current = next_monitor_in_interpreter_frame(current)
 912   ) {
 913 #ifdef ASSERT
 914     interpreter_frame_verify_monitor(current);
 915 #endif
 916     current->oops_do(f);
 917   }
 918 
 919   if (m->is_native()) {
 920     f->do_oop(interpreter_frame_temp_oop_addr());
 921   }
 922 
 923   // The method pointer in the frame might be the only path to the method's
 924   // klass, and the klass needs to be kept alive while executing. The GCs
 925   // don't trace through method pointers, so the mirror of the method's klass
 926   // is installed as a GC root.
 927   f->do_oop(interpreter_frame_mirror_addr());
 928 
 929   int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals();
 930 
 931   Symbol* signature = nullptr;
 932   bool has_receiver = false;
 933 
 934   // Process a callee's arguments if we are at a call site
 935   // (i.e., if we are at an invoke bytecode)
 936   // This is used sometimes for calling into the VM, not for another
 937   // interpreted or compiled frame.
 938   if (!m->is_native()) {
 939     Bytecode_invoke call = Bytecode_invoke_check(m, bci);
 940     if (map != nullptr && call.is_valid()) {
 941       signature = call.signature();
 942       has_receiver = call.has_receiver();
 943       if (map->include_argument_oops() &&
 944           interpreter_frame_expression_stack_size() > 0) {
 945         ResourceMark rm(thread);  // is this right ???
 946         // we are at a call site & the expression stack is not empty
 947         // => process callee's arguments
 948         //
 949         // Note: The expression stack can be empty if an exception
 950         //       occurred during method resolution/execution. In all
 951         //       cases we empty the expression stack completely be-
 952         //       fore handling the exception (the exception handling
 953         //       code in the interpreter calls a blocking runtime
 954         //       routine which can cause this code to be executed).
 955         //       (was bug gri 7/27/98)
 956         oops_interpreted_arguments_do(signature, has_receiver, f);
 957       }
 958     }
 959   }
 960 
 961   InterpreterFrameClosure blk(this, max_locals, m->max_stack(), f);
 962 
 963   // process locals & expression stack
 964   InterpreterOopMap mask;
 965   if (query_oop_map_cache) {
 966     m->mask_for(m, bci, &mask);
 967   } else {
 968     OopMapCache::compute_one_oop_map(m, bci, &mask);
 969   }
 970   mask.iterate_oop(&blk);
 971 }
 972 



 973 
 974 void frame::oops_interpreted_arguments_do(Symbol* signature, bool has_receiver, OopClosure* f) const {
 975   InterpretedArgumentOopFinder finder(signature, has_receiver, this, f);
 976   finder.oops_do();
 977 }
 978 
 979 void frame::oops_nmethod_do(OopClosure* f, NMethodClosure* cf, DerivedOopClosure* df, DerivedPointerIterationMode derived_mode, const RegisterMap* reg_map) const {
 980   assert(_cb != nullptr, "sanity check");
 981   assert((oop_map() == nullptr) == (_cb->oop_maps() == nullptr), "frame and _cb must agree that oopmap is set or not");
 982   if (oop_map() != nullptr) {
 983     if (df != nullptr) {
 984       _oop_map->oops_do(this, reg_map, f, df);
 985     } else {
 986       _oop_map->oops_do(this, reg_map, f, derived_mode);
 987     }
 988 
 989     // Preserve potential arguments for a callee. We handle this by dispatching
 990     // on the codeblob. For c2i, we do
 991     if (reg_map->include_argument_oops() && _cb->is_nmethod()) {
 992       // Only nmethod preserves outgoing arguments at call.

 874   }
 875 
 876   void arguments_do(OopClosure* f) {
 877     _f = f;
 878     if (!_is_static)  oop_at_offset_do(_offset); // do the receiver
 879     do_parameters_on(this);
 880   }
 881 
 882 };
 883 
 884 oop* frame::interpreter_callee_receiver_addr(Symbol* signature) {
 885   ArgumentSizeComputer asc(signature);
 886   int size = asc.size();
 887   return (oop *)interpreter_frame_tos_at(size);
 888 }
 889 
 890 oop frame::interpreter_callee_receiver(Symbol* signature) {
 891   return *interpreter_callee_receiver_addr(signature);
 892 }
 893 
 894 template <typename RegisterMapT>
 895 void frame::oops_interpreted_do(OopClosure* f, const RegisterMapT* map, bool query_oop_map_cache) const {
 896   assert(is_interpreted_frame(), "Not an interpreted frame");
 897   Thread *thread = Thread::current();
 898   methodHandle m (thread, interpreter_frame_method());
 899   jint      bci = interpreter_frame_bci();
 900 
 901   assert(!Universe::heap()->is_in(m()),
 902           "must be valid oop");
 903   assert(m->is_method(), "checking frame value");
 904   assert((m->is_native() && bci == 0)  ||
 905          (!m->is_native() && bci >= 0 && bci < m->code_size()),
 906          "invalid bci value");
 907 
 908   // Handle the monitor elements in the activation
 909   for (
 910     BasicObjectLock* current = interpreter_frame_monitor_end();
 911     current < interpreter_frame_monitor_begin();
 912     current = next_monitor_in_interpreter_frame(current)
 913   ) {
 914 #ifdef ASSERT
 915     interpreter_frame_verify_monitor(current);
 916 #endif
 917     current->oops_do(f);
 918   }
 919 
 920   if (m->is_native()) {
 921     f->do_oop(interpreter_frame_temp_oop_addr());
 922   }
 923 
 924   // The method pointer in the frame might be the only path to the method's
 925   // klass, and the klass needs to be kept alive while executing. The GCs
 926   // don't trace through method pointers, so the mirror of the method's klass
 927   // is installed as a GC root.
 928   f->do_oop(interpreter_frame_mirror_addr());
 929 
 930   int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals();
 931 



 932   // Process a callee's arguments if we are at a call site
 933   // (i.e., if we are at an invoke bytecode)
 934   // This is used sometimes for calling into the VM, not for another
 935   // interpreted or compiled frame.
 936   if (!m->is_native() && map != nullptr && map->include_argument_oops()) {
 937     Bytecode_invoke call = Bytecode_invoke_check(m, bci);
 938     if (call.is_valid() && interpreter_frame_expression_stack_size() > 0) {
 939       ResourceMark rm(thread);  // is this right ???
 940       Symbol* signature = call.signature();
 941       bool has_receiver = call.has_receiver();
 942       // we are at a call site & the expression stack is not empty
 943       // => process callee's arguments
 944       //
 945       // Note: The expression stack can be empty if an exception
 946       //       occurred during method resolution/execution. In all
 947       //       cases we empty the expression stack completely be-
 948       //       fore handling the exception (the exception handling
 949       //       code in the interpreter calls a blocking runtime
 950       //       routine which can cause this code to be executed).
 951       //       (was bug gri 7/27/98)
 952       // if (dolog) {
 953       //   log_trace(continuations, tracking)("Processing arguments");
 954       // }
 955       oops_interpreted_arguments_do(signature, has_receiver, f);
 956     }
 957   }
 958 
 959   InterpreterFrameClosure blk(this, max_locals, m->max_stack(), f);
 960 
 961   // process locals & expression stack
 962   InterpreterOopMap mask;
 963   if (query_oop_map_cache) {
 964     m->mask_for(m, bci, &mask);
 965   } else {
 966     OopMapCache::compute_one_oop_map(m, bci, &mask);
 967   }
 968   mask.iterate_oop(&blk);
 969 }
 970 
 971 template void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache) const;
 972 template void frame::oops_interpreted_do(OopClosure* f, const SmallRegisterMapNoArgs* map, bool query_oop_map_cache) const;
 973 template void frame::oops_interpreted_do(OopClosure* f, const SmallRegisterMapWithArgs* map, bool query_oop_map_cache) const;
 974 
 975 void frame::oops_interpreted_arguments_do(Symbol* signature, bool has_receiver, OopClosure* f) const {
 976   InterpretedArgumentOopFinder finder(signature, has_receiver, this, f);
 977   finder.oops_do();
 978 }
 979 
 980 void frame::oops_nmethod_do(OopClosure* f, NMethodClosure* cf, DerivedOopClosure* df, DerivedPointerIterationMode derived_mode, const RegisterMap* reg_map) const {
 981   assert(_cb != nullptr, "sanity check");
 982   assert((oop_map() == nullptr) == (_cb->oop_maps() == nullptr), "frame and _cb must agree that oopmap is set or not");
 983   if (oop_map() != nullptr) {
 984     if (df != nullptr) {
 985       _oop_map->oops_do(this, reg_map, f, df);
 986     } else {
 987       _oop_map->oops_do(this, reg_map, f, derived_mode);
 988     }
 989 
 990     // Preserve potential arguments for a callee. We handle this by dispatching
 991     // on the codeblob. For c2i, we do
 992     if (reg_map->include_argument_oops() && _cb->is_nmethod()) {
 993       // Only nmethod preserves outgoing arguments at call.
< prev index next >