< prev index next >

src/hotspot/share/runtime/frame.cpp

Print this page

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

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



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

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



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