879 }
880
881 void arguments_do(OopClosure* f) {
882 _f = f;
883 if (!_is_static) oop_at_offset_do(_offset); // do the receiver
884 do_parameters_on(this);
885 }
886
887 };
888
889 oop* frame::interpreter_callee_receiver_addr(Symbol* signature) {
890 ArgumentSizeComputer asc(signature);
891 int size = asc.size();
892 return (oop *)interpreter_frame_tos_at(size);
893 }
894
895 oop frame::interpreter_callee_receiver(Symbol* signature) {
896 return *interpreter_callee_receiver_addr(signature);
897 }
898
899 void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache) const {
900 assert(is_interpreted_frame(), "Not an interpreted frame");
901 Thread *thread = Thread::current();
902 methodHandle m (thread, interpreter_frame_method());
903 jint bci = interpreter_frame_bci();
904
905 assert(!Universe::heap()->is_in(m()),
906 "must be valid oop");
907 assert(m->is_method(), "checking frame value");
908 assert((m->is_native() && bci == 0) ||
909 (!m->is_native() && bci >= 0 && bci < m->code_size()),
910 "invalid bci value");
911
912 // Handle the monitor elements in the activation
913 for (
914 BasicObjectLock* current = interpreter_frame_monitor_end();
915 current < interpreter_frame_monitor_begin();
916 current = next_monitor_in_interpreter_frame(current)
917 ) {
918 #ifdef ASSERT
919 interpreter_frame_verify_monitor(current);
920 #endif
921 current->oops_do(f);
922 }
923
924 if (m->is_native()) {
925 f->do_oop(interpreter_frame_temp_oop_addr());
926 }
927
928 // The method pointer in the frame might be the only path to the method's
929 // klass, and the klass needs to be kept alive while executing. The GCs
930 // don't trace through method pointers, so the mirror of the method's klass
931 // is installed as a GC root.
932 f->do_oop(interpreter_frame_mirror_addr());
933
934 int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals();
935
936 Symbol* signature = nullptr;
937 bool has_receiver = false;
938
939 // Process a callee's arguments if we are at a call site
940 // (i.e., if we are at an invoke bytecode)
941 // This is used sometimes for calling into the VM, not for another
942 // interpreted or compiled frame.
943 if (!m->is_native()) {
944 Bytecode_invoke call = Bytecode_invoke_check(m, bci);
945 if (map != nullptr && call.is_valid()) {
946 signature = call.signature();
947 has_receiver = call.has_receiver();
948 if (map->include_argument_oops() &&
949 interpreter_frame_expression_stack_size() > 0) {
950 ResourceMark rm(thread); // is this right ???
951 // we are at a call site & the expression stack is not empty
952 // => process callee's arguments
953 //
954 // Note: The expression stack can be empty if an exception
955 // occurred during method resolution/execution. In all
956 // cases we empty the expression stack completely be-
957 // fore handling the exception (the exception handling
958 // code in the interpreter calls a blocking runtime
959 // routine which can cause this code to be executed).
960 // (was bug gri 7/27/98)
961 oops_interpreted_arguments_do(signature, has_receiver, f);
962 }
963 }
964 }
965
966 InterpreterFrameClosure blk(this, max_locals, m->max_stack(), f);
967
968 // process locals & expression stack
969 InterpreterOopMap mask;
970 if (query_oop_map_cache) {
971 m->mask_for(m, bci, &mask);
972 } else {
973 OopMapCache::compute_one_oop_map(m, bci, &mask);
974 }
975 mask.iterate_oop(&blk);
976 }
977
978
979 void frame::oops_interpreted_arguments_do(Symbol* signature, bool has_receiver, OopClosure* f) const {
980 InterpretedArgumentOopFinder finder(signature, has_receiver, this, f);
981 finder.oops_do();
982 }
983
984 void frame::oops_nmethod_do(OopClosure* f, NMethodClosure* cf, DerivedOopClosure* df, DerivedPointerIterationMode derived_mode, const RegisterMap* reg_map) const {
985 assert(_cb != nullptr, "sanity check");
986 assert((oop_map() == nullptr) == (_cb->oop_maps() == nullptr), "frame and _cb must agree that oopmap is set or not");
987 if (oop_map() != nullptr) {
988 if (df != nullptr) {
989 _oop_map->oops_do(this, reg_map, f, df);
990 } else {
991 _oop_map->oops_do(this, reg_map, f, derived_mode);
992 }
993
994 // Preserve potential arguments for a callee. We handle this by dispatching
995 // on the codeblob. For c2i, we do
996 if (reg_map->include_argument_oops() && _cb->is_nmethod()) {
997 // Only nmethod preserves outgoing arguments at call.
|
879 }
880
881 void arguments_do(OopClosure* f) {
882 _f = f;
883 if (!_is_static) oop_at_offset_do(_offset); // do the receiver
884 do_parameters_on(this);
885 }
886
887 };
888
889 oop* frame::interpreter_callee_receiver_addr(Symbol* signature) {
890 ArgumentSizeComputer asc(signature);
891 int size = asc.size();
892 return (oop *)interpreter_frame_tos_at(size);
893 }
894
895 oop frame::interpreter_callee_receiver(Symbol* signature) {
896 return *interpreter_callee_receiver_addr(signature);
897 }
898
899 template <typename RegisterMapT>
900 void frame::oops_interpreted_do(OopClosure* f, const RegisterMapT* map, bool query_oop_map_cache) const {
901 assert(is_interpreted_frame(), "Not an interpreted frame");
902 Thread *thread = Thread::current();
903 methodHandle m (thread, interpreter_frame_method());
904 jint bci = interpreter_frame_bci();
905
906 assert(!Universe::heap()->is_in(m()),
907 "must be valid oop");
908 assert(m->is_method(), "checking frame value");
909 assert((m->is_native() && bci == 0) ||
910 (!m->is_native() && bci >= 0 && bci < m->code_size()),
911 "invalid bci value");
912
913 // Handle the monitor elements in the activation
914 for (
915 BasicObjectLock* current = interpreter_frame_monitor_end();
916 current < interpreter_frame_monitor_begin();
917 current = next_monitor_in_interpreter_frame(current)
918 ) {
919 #ifdef ASSERT
920 interpreter_frame_verify_monitor(current);
921 #endif
922 current->oops_do(f);
923 }
924
925 if (m->is_native()) {
926 f->do_oop(interpreter_frame_temp_oop_addr());
927 }
928
929 // The method pointer in the frame might be the only path to the method's
930 // klass, and the klass needs to be kept alive while executing. The GCs
931 // don't trace through method pointers, so the mirror of the method's klass
932 // is installed as a GC root.
933 f->do_oop(interpreter_frame_mirror_addr());
934
935 int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals();
936
937 // Process a callee's arguments if we are at a call site
938 // (i.e., if we are at an invoke bytecode)
939 // This is used sometimes for calling into the VM, not for another
940 // interpreted or compiled frame.
941 if (!m->is_native() && map != nullptr && map->include_argument_oops()) {
942 Bytecode_invoke call = Bytecode_invoke_check(m, bci);
943 if (call.is_valid() && interpreter_frame_expression_stack_size() > 0) {
944 ResourceMark rm(thread); // is this right ???
945 Symbol* signature = call.signature();
946 bool has_receiver = call.has_receiver();
947 // we are at a call site & the expression stack is not empty
948 // => process callee's arguments
949 //
950 // Note: The expression stack can be empty if an exception
951 // occurred during method resolution/execution. In all
952 // cases we empty the expression stack completely be-
953 // fore handling the exception (the exception handling
954 // code in the interpreter calls a blocking runtime
955 // routine which can cause this code to be executed).
956 // (was bug gri 7/27/98)
957 // if (dolog) {
958 // log_trace(continuations, tracking)("Processing arguments");
959 // }
960 oops_interpreted_arguments_do(signature, has_receiver, f);
961 }
962 }
963
964 InterpreterFrameClosure blk(this, max_locals, m->max_stack(), f);
965
966 // process locals & expression stack
967 InterpreterOopMap mask;
968 if (query_oop_map_cache) {
969 m->mask_for(m, bci, &mask);
970 } else {
971 OopMapCache::compute_one_oop_map(m, bci, &mask);
972 }
973 mask.iterate_oop(&blk);
974 }
975
976 template void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache) const;
977 template void frame::oops_interpreted_do(OopClosure* f, const SmallRegisterMapNoArgs* map, bool query_oop_map_cache) const;
978 template void frame::oops_interpreted_do(OopClosure* f, const SmallRegisterMapWithArgs* map, bool query_oop_map_cache) const;
979
980 void frame::oops_interpreted_arguments_do(Symbol* signature, bool has_receiver, OopClosure* f) const {
981 InterpretedArgumentOopFinder finder(signature, has_receiver, this, f);
982 finder.oops_do();
983 }
984
985 void frame::oops_nmethod_do(OopClosure* f, NMethodClosure* cf, DerivedOopClosure* df, DerivedPointerIterationMode derived_mode, const RegisterMap* reg_map) const {
986 assert(_cb != nullptr, "sanity check");
987 assert((oop_map() == nullptr) == (_cb->oop_maps() == nullptr), "frame and _cb must agree that oopmap is set or not");
988 if (oop_map() != nullptr) {
989 if (df != nullptr) {
990 _oop_map->oops_do(this, reg_map, f, df);
991 } else {
992 _oop_map->oops_do(this, reg_map, f, derived_mode);
993 }
994
995 // Preserve potential arguments for a callee. We handle this by dispatching
996 // on the codeblob. For c2i, we do
997 if (reg_map->include_argument_oops() && _cb->is_nmethod()) {
998 // Only nmethod preserves outgoing arguments at call.
|