1 /*
2 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
754 if (frame::interpreter_frame_expression_stack_direction() > 0) {
755 in_stack = (intptr_t*)addr <= _fr->interpreter_frame_tos_address();
756 } else {
757 in_stack = (intptr_t*)addr >= _fr->interpreter_frame_tos_address();
758 }
759 if (in_stack) {
760 _f->do_oop(addr);
761 }
762 }
763 }
764
765 int max_locals() { return _max_locals; }
766 frame* fr() { return _fr; }
767 };
768
769
770 class InterpretedArgumentOopFinder: public SignatureInfo {
771 private:
772 OopClosure* _f; // Closure to invoke
773 int _offset; // TOS-relative offset, decremented with each argument
774 bool _is_static; // true if the callee is a static method
775 frame* _fr;
776
777 void set(int size, BasicType type) {
778 _offset -= size;
779 if (type == T_OBJECT || type == T_ARRAY) oop_offset_do();
780 }
781
782 void oop_offset_do() {
783 oop* addr;
784 addr = (oop*)_fr->interpreter_frame_tos_at(_offset);
785 _f->do_oop(addr);
786 }
787
788 public:
789 InterpretedArgumentOopFinder(symbolHandle signature, bool is_static, frame* fr, OopClosure* f) : SignatureInfo(signature) {
790 // compute size of arguments
791 int args_size = ArgumentSizeComputer(signature).size() + (is_static ? 0 : 1);
792 assert(!fr->is_interpreted_frame() ||
793 args_size <= fr->interpreter_frame_expression_stack_size(),
794 "args cannot be on stack anymore");
795 // initialize InterpretedArgumentOopFinder
796 _f = f;
797 _fr = fr;
798 _offset = args_size;
799 _is_static = is_static;
800 }
801
802 void oops_do() {
803 if (!_is_static) {
804 --_offset;
805 oop_offset_do();
806 }
807 iterate_parameters();
808 }
809 };
810
811
812 // Entry frame has following form (n arguments)
813 // +-----------+
814 // sp -> | last arg |
815 // +-----------+
816 // : ::: :
817 // +-----------+
818 // (sp+n)->| first arg|
819 // +-----------+
820
821
822
823 // visits and GC's all the arguments in entry frame
895 // Interpreter frame in the midst of a call have a methodOop within the
896 // object.
897 interpreterState istate = get_interpreterState();
898 if (istate->msg() == BytecodeInterpreter::call_method) {
899 f->do_oop((oop*)&istate->_result._to_call._callee);
900 }
901
902 #endif /* CC_INTERP */
903
904 if (m->is_native()) {
905 #ifdef CC_INTERP
906 f->do_oop((oop*)&istate->_oop_temp);
907 #else
908 f->do_oop((oop*)( fp() + interpreter_frame_oop_temp_offset ));
909 #endif /* CC_INTERP */
910 }
911
912 int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals();
913
914 symbolHandle signature;
915 bool is_static = false;
916
917 // Process a callee's arguments if we are at a call site
918 // (i.e., if we are at an invoke bytecode)
919 // This is used sometimes for calling into the VM, not for another
920 // interpreted or compiled frame.
921 if (!m->is_native()) {
922 Bytecode_invoke *call = Bytecode_invoke_at_check(m, bci);
923 if (call != NULL) {
924 signature = symbolHandle(thread, call->signature());
925 is_static = call->is_invokestatic();
926 if (map->include_argument_oops() &&
927 interpreter_frame_expression_stack_size() > 0) {
928 ResourceMark rm(thread); // is this right ???
929 // we are at a call site & the expression stack is not empty
930 // => process callee's arguments
931 //
932 // Note: The expression stack can be empty if an exception
933 // occurred during method resolution/execution. In all
934 // cases we empty the expression stack completely be-
935 // fore handling the exception (the exception handling
936 // code in the interpreter calls a blocking runtime
937 // routine which can cause this code to be executed).
938 // (was bug gri 7/27/98)
939 oops_interpreted_arguments_do(signature, is_static, f);
940 }
941 }
942 }
943
944 if (TaggedStackInterpreter) {
945 // process locals & expression stack
946 InterpreterOopMap *mask = NULL;
947 #ifdef ASSERT
948 InterpreterOopMap oopmap_mask;
949 OopMapCache::compute_one_oop_map(m, bci, &oopmap_mask);
950 mask = &oopmap_mask;
951 #endif // ASSERT
952 oops_interpreted_locals_do(f, max_locals, mask);
953 oops_interpreted_expressions_do(f, signature, is_static,
954 m->max_stack(),
955 max_locals, mask);
956 } else {
957 InterpreterFrameClosure blk(this, max_locals, m->max_stack(), f);
958
959 // process locals & expression stack
960 InterpreterOopMap mask;
961 if (query_oop_map_cache) {
962 m->mask_for(bci, &mask);
963 } else {
964 OopMapCache::compute_one_oop_map(m, bci, &mask);
965 }
966 mask.iterate_oop(&blk);
967 }
968 }
969
970
971 void frame::oops_interpreted_locals_do(OopClosure *f,
972 int max_locals,
973 InterpreterOopMap *mask) {
975 for (int i = 0; i < max_locals; i++ ) {
976 Tag tag = interpreter_frame_local_tag(i);
977 if (tag == TagReference) {
978 oop* addr = (oop*) interpreter_frame_local_at(i);
979 assert((intptr_t*)addr >= sp(), "must be inside the frame");
980 f->do_oop(addr);
981 #ifdef ASSERT
982 } else {
983 assert(tag == TagValue, "bad tag value for locals");
984 oop* p = (oop*) interpreter_frame_local_at(i);
985 // Not always true - too bad. May have dead oops without tags in locals.
986 // assert(*p == NULL || !(*p)->is_oop(), "oop not tagged on interpreter locals");
987 assert(*p == NULL || !mask->is_oop(i), "local oop map mismatch");
988 #endif // ASSERT
989 }
990 }
991 }
992
993 void frame::oops_interpreted_expressions_do(OopClosure *f,
994 symbolHandle signature,
995 bool is_static,
996 int max_stack,
997 int max_locals,
998 InterpreterOopMap *mask) {
999 // There is no stack no matter what the esp is pointing to (native methods
1000 // might look like expression stack is nonempty).
1001 if (max_stack == 0) return;
1002
1003 // Point the top of the expression stack above arguments to a call so
1004 // arguments aren't gc'ed as both stack values for callee and callee
1005 // arguments in callee's locals.
1006 int args_size = 0;
1007 if (!signature.is_null()) {
1008 args_size = ArgumentSizeComputer(signature).size() + (is_static ? 0 : 1);
1009 }
1010
1011 intptr_t *tos_addr = interpreter_frame_tos_at(args_size);
1012 assert(args_size != 0 || tos_addr == interpreter_frame_tos_address(), "these are same");
1013 intptr_t *frst_expr = interpreter_frame_expression_stack_at(0);
1014 // In case of exceptions, the expression stack is invalid and the esp
1015 // will be reset to express this condition. Therefore, we call f only
1016 // if addr is 'inside' the stack (i.e., addr >= esp for Intel).
1017 bool in_stack;
1018 if (interpreter_frame_expression_stack_direction() > 0) {
1019 in_stack = (intptr_t*)frst_expr <= tos_addr;
1020 } else {
1021 in_stack = (intptr_t*)frst_expr >= tos_addr;
1022 }
1023 if (!in_stack) return;
1024
1025 jint stack_size = interpreter_frame_expression_stack_size() - args_size;
1026 for (int j = 0; j < stack_size; j++) {
1027 Tag tag = interpreter_frame_expression_stack_tag(j);
1028 if (tag == TagReference) {
1029 oop *addr = (oop*) interpreter_frame_expression_stack_at(j);
1030 f->do_oop(addr);
1031 #ifdef ASSERT
1032 } else {
1033 assert(tag == TagValue, "bad tag value for stack element");
1034 oop *p = (oop*) interpreter_frame_expression_stack_at((j));
1035 assert(*p == NULL || !mask->is_oop(j+max_locals), "stack oop map mismatch");
1036 #endif // ASSERT
1037 }
1038 }
1039 }
1040
1041 void frame::oops_interpreted_arguments_do(symbolHandle signature, bool is_static, OopClosure* f) {
1042 InterpretedArgumentOopFinder finder(signature, is_static, this, f);
1043 finder.oops_do();
1044 }
1045
1046 void frame::oops_code_blob_do(OopClosure* f, CodeBlobClosure* cf, const RegisterMap* reg_map) {
1047 assert(_cb != NULL, "sanity check");
1048 if (_cb->oop_maps() != NULL) {
1049 OopMapSet::oops_do(this, reg_map, f);
1050
1051 // Preserve potential arguments for a callee. We handle this by dispatching
1052 // on the codeblob. For c2i, we do
1053 if (reg_map->include_argument_oops()) {
1054 _cb->preserve_callee_argument_oops(*this, reg_map, f);
1055 }
1056 }
1057 // In cases where perm gen is collected, GC will want to mark
1058 // oops referenced from nmethods active on thread stacks so as to
1059 // prevent them from being collected. However, this visit should be
1060 // restricted to certain phases of the collection only. The
1061 // closure decides how it wants nmethods to be traced.
1062 if (cf != NULL)
1063 cf->do_code_blob(_cb);
1064 }
1065
1066 class CompiledArgumentOopFinder: public SignatureInfo {
1067 protected:
1068 OopClosure* _f;
1069 int _offset; // the current offset, incremented with each argument
1070 bool _is_static; // true if the callee is a static method
1071 frame _fr;
1072 RegisterMap* _reg_map;
1073 int _arg_size;
1074 VMRegPair* _regs; // VMReg list of arguments
1075
1076 void set(int size, BasicType type) {
1077 if (type == T_OBJECT || type == T_ARRAY) handle_oop_offset();
1078 _offset += size;
1079 }
1080
1081 virtual void handle_oop_offset() {
1082 // Extract low order register number from register array.
1083 // In LP64-land, the high-order bits are valid but unhelpful.
1084 VMReg reg = _regs[_offset].first();
1085 oop *loc = _fr.oopmapreg_to_location(reg, _reg_map);
1086 _f->do_oop(loc);
1087 }
1088
1089 public:
1090 CompiledArgumentOopFinder(symbolHandle signature, bool is_static, OopClosure* f, frame fr, const RegisterMap* reg_map)
1091 : SignatureInfo(signature) {
1092
1093 // initialize CompiledArgumentOopFinder
1094 _f = f;
1095 _offset = 0;
1096 _is_static = is_static;
1097 _fr = fr;
1098 _reg_map = (RegisterMap*)reg_map;
1099 _arg_size = ArgumentSizeComputer(signature).size() + (is_static ? 0 : 1);
1100
1101 int arg_size;
1102 _regs = SharedRuntime::find_callee_arguments(signature(), is_static, &arg_size);
1103 assert(arg_size == _arg_size, "wrong arg size");
1104 }
1105
1106 void oops_do() {
1107 if (!_is_static) {
1108 handle_oop_offset();
1109 _offset++;
1110 }
1111 iterate_parameters();
1112 }
1113 };
1114
1115 void frame::oops_compiled_arguments_do(symbolHandle signature, bool is_static, const RegisterMap* reg_map, OopClosure* f) {
1116 ResourceMark rm;
1117 CompiledArgumentOopFinder finder(signature, is_static, f, *this, reg_map);
1118 finder.oops_do();
1119 }
1120
1121
1122 // Get receiver out of callers frame, i.e. find parameter 0 in callers
1123 // frame. Consult ADLC for where parameter 0 is to be found. Then
1124 // check local reg_map for it being a callee-save register or argument
1125 // register, both of which are saved in the local frame. If not found
1126 // there, it must be an in-stack argument of the caller.
1127 // Note: caller.sp() points to callee-arguments
1128 oop frame::retrieve_receiver(RegisterMap* reg_map) {
1129 frame caller = *this;
1130
1131 // First consult the ADLC on where it puts parameter 0 for this signature.
1132 VMReg reg = SharedRuntime::name_for_receiver();
1133 oop r = *caller.oopmapreg_to_location(reg, reg_map);
1134 assert( Universe::heap()->is_in_or_null(r), "bad receiver" );
1135 return r;
1136 }
1137
|
1 /*
2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
754 if (frame::interpreter_frame_expression_stack_direction() > 0) {
755 in_stack = (intptr_t*)addr <= _fr->interpreter_frame_tos_address();
756 } else {
757 in_stack = (intptr_t*)addr >= _fr->interpreter_frame_tos_address();
758 }
759 if (in_stack) {
760 _f->do_oop(addr);
761 }
762 }
763 }
764
765 int max_locals() { return _max_locals; }
766 frame* fr() { return _fr; }
767 };
768
769
770 class InterpretedArgumentOopFinder: public SignatureInfo {
771 private:
772 OopClosure* _f; // Closure to invoke
773 int _offset; // TOS-relative offset, decremented with each argument
774 bool _has_receiver; // true if the callee has a receiver
775 frame* _fr;
776
777 void set(int size, BasicType type) {
778 _offset -= size;
779 if (type == T_OBJECT || type == T_ARRAY) oop_offset_do();
780 }
781
782 void oop_offset_do() {
783 oop* addr;
784 addr = (oop*)_fr->interpreter_frame_tos_at(_offset);
785 _f->do_oop(addr);
786 }
787
788 public:
789 InterpretedArgumentOopFinder(symbolHandle signature, bool has_receiver, frame* fr, OopClosure* f) : SignatureInfo(signature), _has_receiver(has_receiver) {
790 // compute size of arguments
791 int args_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0);
792 assert(!fr->is_interpreted_frame() ||
793 args_size <= fr->interpreter_frame_expression_stack_size(),
794 "args cannot be on stack anymore");
795 // initialize InterpretedArgumentOopFinder
796 _f = f;
797 _fr = fr;
798 _offset = args_size;
799 }
800
801 void oops_do() {
802 if (_has_receiver) {
803 --_offset;
804 oop_offset_do();
805 }
806 iterate_parameters();
807 }
808 };
809
810
811 // Entry frame has following form (n arguments)
812 // +-----------+
813 // sp -> | last arg |
814 // +-----------+
815 // : ::: :
816 // +-----------+
817 // (sp+n)->| first arg|
818 // +-----------+
819
820
821
822 // visits and GC's all the arguments in entry frame
894 // Interpreter frame in the midst of a call have a methodOop within the
895 // object.
896 interpreterState istate = get_interpreterState();
897 if (istate->msg() == BytecodeInterpreter::call_method) {
898 f->do_oop((oop*)&istate->_result._to_call._callee);
899 }
900
901 #endif /* CC_INTERP */
902
903 if (m->is_native()) {
904 #ifdef CC_INTERP
905 f->do_oop((oop*)&istate->_oop_temp);
906 #else
907 f->do_oop((oop*)( fp() + interpreter_frame_oop_temp_offset ));
908 #endif /* CC_INTERP */
909 }
910
911 int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals();
912
913 symbolHandle signature;
914 bool has_receiver = false;
915
916 // Process a callee's arguments if we are at a call site
917 // (i.e., if we are at an invoke bytecode)
918 // This is used sometimes for calling into the VM, not for another
919 // interpreted or compiled frame.
920 if (!m->is_native()) {
921 Bytecode_invoke *call = Bytecode_invoke_at_check(m, bci);
922 if (call != NULL) {
923 signature = symbolHandle(thread, call->signature());
924 has_receiver = call->has_receiver();
925 if (map->include_argument_oops() &&
926 interpreter_frame_expression_stack_size() > 0) {
927 ResourceMark rm(thread); // is this right ???
928 // we are at a call site & the expression stack is not empty
929 // => process callee's arguments
930 //
931 // Note: The expression stack can be empty if an exception
932 // occurred during method resolution/execution. In all
933 // cases we empty the expression stack completely be-
934 // fore handling the exception (the exception handling
935 // code in the interpreter calls a blocking runtime
936 // routine which can cause this code to be executed).
937 // (was bug gri 7/27/98)
938 oops_interpreted_arguments_do(signature, has_receiver, f);
939 }
940 }
941 }
942
943 if (TaggedStackInterpreter) {
944 // process locals & expression stack
945 InterpreterOopMap *mask = NULL;
946 #ifdef ASSERT
947 InterpreterOopMap oopmap_mask;
948 OopMapCache::compute_one_oop_map(m, bci, &oopmap_mask);
949 mask = &oopmap_mask;
950 #endif // ASSERT
951 oops_interpreted_locals_do(f, max_locals, mask);
952 oops_interpreted_expressions_do(f, signature, has_receiver,
953 m->max_stack(),
954 max_locals, mask);
955 } else {
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(bci, &mask);
962 } else {
963 OopMapCache::compute_one_oop_map(m, bci, &mask);
964 }
965 mask.iterate_oop(&blk);
966 }
967 }
968
969
970 void frame::oops_interpreted_locals_do(OopClosure *f,
971 int max_locals,
972 InterpreterOopMap *mask) {
974 for (int i = 0; i < max_locals; i++ ) {
975 Tag tag = interpreter_frame_local_tag(i);
976 if (tag == TagReference) {
977 oop* addr = (oop*) interpreter_frame_local_at(i);
978 assert((intptr_t*)addr >= sp(), "must be inside the frame");
979 f->do_oop(addr);
980 #ifdef ASSERT
981 } else {
982 assert(tag == TagValue, "bad tag value for locals");
983 oop* p = (oop*) interpreter_frame_local_at(i);
984 // Not always true - too bad. May have dead oops without tags in locals.
985 // assert(*p == NULL || !(*p)->is_oop(), "oop not tagged on interpreter locals");
986 assert(*p == NULL || !mask->is_oop(i), "local oop map mismatch");
987 #endif // ASSERT
988 }
989 }
990 }
991
992 void frame::oops_interpreted_expressions_do(OopClosure *f,
993 symbolHandle signature,
994 bool has_receiver,
995 int max_stack,
996 int max_locals,
997 InterpreterOopMap *mask) {
998 // There is no stack no matter what the esp is pointing to (native methods
999 // might look like expression stack is nonempty).
1000 if (max_stack == 0) return;
1001
1002 // Point the top of the expression stack above arguments to a call so
1003 // arguments aren't gc'ed as both stack values for callee and callee
1004 // arguments in callee's locals.
1005 int args_size = 0;
1006 if (!signature.is_null()) {
1007 args_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0);
1008 }
1009
1010 intptr_t *tos_addr = interpreter_frame_tos_at(args_size);
1011 assert(args_size != 0 || tos_addr == interpreter_frame_tos_address(), "these are same");
1012 intptr_t *frst_expr = interpreter_frame_expression_stack_at(0);
1013 // In case of exceptions, the expression stack is invalid and the esp
1014 // will be reset to express this condition. Therefore, we call f only
1015 // if addr is 'inside' the stack (i.e., addr >= esp for Intel).
1016 bool in_stack;
1017 if (interpreter_frame_expression_stack_direction() > 0) {
1018 in_stack = (intptr_t*)frst_expr <= tos_addr;
1019 } else {
1020 in_stack = (intptr_t*)frst_expr >= tos_addr;
1021 }
1022 if (!in_stack) return;
1023
1024 jint stack_size = interpreter_frame_expression_stack_size() - args_size;
1025 for (int j = 0; j < stack_size; j++) {
1026 Tag tag = interpreter_frame_expression_stack_tag(j);
1027 if (tag == TagReference) {
1028 oop *addr = (oop*) interpreter_frame_expression_stack_at(j);
1029 f->do_oop(addr);
1030 #ifdef ASSERT
1031 } else {
1032 assert(tag == TagValue, "bad tag value for stack element");
1033 oop *p = (oop*) interpreter_frame_expression_stack_at((j));
1034 assert(*p == NULL || !mask->is_oop(j+max_locals), "stack oop map mismatch");
1035 #endif // ASSERT
1036 }
1037 }
1038 }
1039
1040 void frame::oops_interpreted_arguments_do(symbolHandle signature, bool has_receiver, OopClosure* f) {
1041 InterpretedArgumentOopFinder finder(signature, has_receiver, this, f);
1042 finder.oops_do();
1043 }
1044
1045 void frame::oops_code_blob_do(OopClosure* f, CodeBlobClosure* cf, const RegisterMap* reg_map) {
1046 assert(_cb != NULL, "sanity check");
1047 if (_cb->oop_maps() != NULL) {
1048 OopMapSet::oops_do(this, reg_map, f);
1049
1050 // Preserve potential arguments for a callee. We handle this by dispatching
1051 // on the codeblob. For c2i, we do
1052 if (reg_map->include_argument_oops()) {
1053 _cb->preserve_callee_argument_oops(*this, reg_map, f);
1054 }
1055 }
1056 // In cases where perm gen is collected, GC will want to mark
1057 // oops referenced from nmethods active on thread stacks so as to
1058 // prevent them from being collected. However, this visit should be
1059 // restricted to certain phases of the collection only. The
1060 // closure decides how it wants nmethods to be traced.
1061 if (cf != NULL)
1062 cf->do_code_blob(_cb);
1063 }
1064
1065 class CompiledArgumentOopFinder: public SignatureInfo {
1066 protected:
1067 OopClosure* _f;
1068 int _offset; // the current offset, incremented with each argument
1069 bool _has_receiver; // true if the callee has a receiver
1070 frame _fr;
1071 RegisterMap* _reg_map;
1072 int _arg_size;
1073 VMRegPair* _regs; // VMReg list of arguments
1074
1075 void set(int size, BasicType type) {
1076 if (type == T_OBJECT || type == T_ARRAY) handle_oop_offset();
1077 _offset += size;
1078 }
1079
1080 virtual void handle_oop_offset() {
1081 // Extract low order register number from register array.
1082 // In LP64-land, the high-order bits are valid but unhelpful.
1083 VMReg reg = _regs[_offset].first();
1084 oop *loc = _fr.oopmapreg_to_location(reg, _reg_map);
1085 _f->do_oop(loc);
1086 }
1087
1088 public:
1089 CompiledArgumentOopFinder(symbolHandle signature, bool has_receiver, OopClosure* f, frame fr, const RegisterMap* reg_map)
1090 : SignatureInfo(signature) {
1091
1092 // initialize CompiledArgumentOopFinder
1093 _f = f;
1094 _offset = 0;
1095 _has_receiver = has_receiver;
1096 _fr = fr;
1097 _reg_map = (RegisterMap*)reg_map;
1098 _arg_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0);
1099
1100 int arg_size;
1101 _regs = SharedRuntime::find_callee_arguments(signature(), has_receiver, &arg_size);
1102 assert(arg_size == _arg_size, "wrong arg size");
1103 }
1104
1105 void oops_do() {
1106 if (_has_receiver) {
1107 handle_oop_offset();
1108 _offset++;
1109 }
1110 iterate_parameters();
1111 }
1112 };
1113
1114 void frame::oops_compiled_arguments_do(symbolHandle signature, bool has_receiver, const RegisterMap* reg_map, OopClosure* f) {
1115 ResourceMark rm;
1116 CompiledArgumentOopFinder finder(signature, has_receiver, f, *this, reg_map);
1117 finder.oops_do();
1118 }
1119
1120
1121 // Get receiver out of callers frame, i.e. find parameter 0 in callers
1122 // frame. Consult ADLC for where parameter 0 is to be found. Then
1123 // check local reg_map for it being a callee-save register or argument
1124 // register, both of which are saved in the local frame. If not found
1125 // there, it must be an in-stack argument of the caller.
1126 // Note: caller.sp() points to callee-arguments
1127 oop frame::retrieve_receiver(RegisterMap* reg_map) {
1128 frame caller = *this;
1129
1130 // First consult the ADLC on where it puts parameter 0 for this signature.
1131 VMReg reg = SharedRuntime::name_for_receiver();
1132 oop r = *caller.oopmapreg_to_location(reg, reg_map);
1133 assert( Universe::heap()->is_in_or_null(r), "bad receiver" );
1134 return r;
1135 }
1136
|