19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "code/codeCache.hpp"
27 #include "code/vmreg.inline.hpp"
28 #include "compiler/abstractCompiler.hpp"
29 #include "compiler/disassembler.hpp"
30 #include "gc/shared/collectedHeap.inline.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "interpreter/oopMapCache.hpp"
33 #include "memory/resourceArea.hpp"
34 #include "memory/universe.inline.hpp"
35 #include "oops/markOop.hpp"
36 #include "oops/method.hpp"
37 #include "oops/methodData.hpp"
38 #include "oops/oop.inline.hpp"
39 #include "oops/verifyOopClosure.hpp"
40 #include "prims/methodHandles.hpp"
41 #include "runtime/frame.inline.hpp"
42 #include "runtime/handles.inline.hpp"
43 #include "runtime/javaCalls.hpp"
44 #include "runtime/monitorChunk.hpp"
45 #include "runtime/os.hpp"
46 #include "runtime/sharedRuntime.hpp"
47 #include "runtime/signature.hpp"
48 #include "runtime/stubCodeGenerator.hpp"
49 #include "runtime/stubRoutines.hpp"
50 #include "runtime/thread.inline.hpp"
51 #include "utilities/debug.hpp"
52 #include "utilities/decoder.hpp"
53 #include "utilities/formatBuffer.hpp"
54
55 RegisterMap::RegisterMap(JavaThread *thread, bool update_map) {
56 _thread = thread;
57 _update_map = update_map;
58 clear();
745 print_C_frame(st, buf, buflen, pc());
746 }
747 }
748
749
750 /*
751 The interpreter_frame_expression_stack_at method in the case of SPARC needs the
752 max_stack value of the method in order to compute the expression stack address.
753 It uses the Method* in order to get the max_stack value but during GC this
754 Method* value saved on the frame is changed by reverse_and_push and hence cannot
755 be used. So we save the max_stack value in the FrameClosure object and pass it
756 down to the interpreter_frame_expression_stack_at method
757 */
758 class InterpreterFrameClosure : public OffsetClosure {
759 private:
760 frame* _fr;
761 OopClosure* _f;
762 BufferedValueClosure* _bvt_f;
763 int _max_locals;
764 int _max_stack;
765
766 public:
767 InterpreterFrameClosure(frame* fr, int max_locals, int max_stack,
768 OopClosure* f, BufferedValueClosure* bvt_f) {
769 _fr = fr;
770 _max_locals = max_locals;
771 _max_stack = max_stack;
772 _f = f;
773 _bvt_f = bvt_f;
774 }
775
776 void offset_do(int offset) {
777 oop* addr;
778 if (offset < _max_locals) {
779 addr = (oop*) _fr->interpreter_frame_local_at(offset);
780 assert((intptr_t*)addr >= _fr->sp(), "must be inside the frame");
781 if (Universe::heap()->is_in_reserved_or_null(*addr)) {
782 if (_f != NULL) {
783 _f->do_oop(addr);
784 }
785 } else { // Buffered value types case
786 if (_f != NULL) {
787 oop* addr_mirror = (oop*)(*addr)->mark_addr();
788 _f->do_oop(addr_mirror);
789 }
790 if (_bvt_f != NULL) {
791 _bvt_f->do_buffered_value(addr);
792 }
793 }
794 } else {
795 addr = (oop*) _fr->interpreter_frame_expression_stack_at((offset - _max_locals));
796 // In case of exceptions, the expression stack is invalid and the esp will be reset to express
797 // this condition. Therefore, we call f only if addr is 'inside' the stack (i.e., addr >= esp for Intel).
798 bool in_stack;
799 if (frame::interpreter_frame_expression_stack_direction() > 0) {
800 in_stack = (intptr_t*)addr <= _fr->interpreter_frame_tos_address();
801 } else {
802 in_stack = (intptr_t*)addr >= _fr->interpreter_frame_tos_address();
803 }
804 if (in_stack) {
805 if (Universe::heap()->is_in_reserved_or_null(*addr)) {
806 if (_f != NULL) {
807 _f->do_oop(addr);
808 }
809 } else { // Buffered value types case
810 if (_f != NULL) {
811 oop* addr_mirror = (oop*)(*addr)->mark_addr();
812 _f->do_oop(addr_mirror);
813 }
814 if (_bvt_f != NULL) {
815 _bvt_f->do_buffered_value(addr);
816 }
817 }
818 }
819 }
820 }
821
822 int max_locals() { return _max_locals; }
823 frame* fr() { return _fr; }
824 };
825
826
827 class InterpretedArgumentOopFinder: public SignatureInfo {
828 private:
829 OopClosure* _f; // Closure to invoke
830 int _offset; // TOS-relative offset, decremented with each argument
831 bool _has_receiver; // true if the callee has a receiver
832 frame* _fr;
833
834 void set(int size, BasicType type) {
835 _offset -= size;
836 if (type == T_OBJECT || type == T_ARRAY || type == T_VALUETYPE) oop_offset_do();
837 }
838
839 void oop_offset_do() {
840 oop* addr;
841 addr = (oop*)_fr->interpreter_frame_tos_at(_offset);
842 _f->do_oop(addr);
843 }
844
845 public:
846 InterpretedArgumentOopFinder(Symbol* signature, bool has_receiver, frame* fr, OopClosure* f) : SignatureInfo(signature), _has_receiver(has_receiver) {
847 // compute size of arguments
848 int args_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0);
849 assert(!fr->is_interpreted_frame() ||
850 args_size <= fr->interpreter_frame_expression_stack_size(),
851 "args cannot be on stack anymore");
852 // initialize InterpretedArgumentOopFinder
853 _f = f;
854 _fr = fr;
855 _offset = args_size;
856 }
857
858 void oops_do() {
859 if (_has_receiver) {
860 --_offset;
861 oop_offset_do();
862 }
863 iterate_parameters();
864 }
865 };
866
867
868 // Entry frame has following form (n arguments)
869 // +-----------+
870 // sp -> | last arg |
871 // +-----------+
872 // : ::: :
873 // +-----------+
874 // (sp+n)->| first arg|
875 // +-----------+
876
877
878
879 // visits and GC's all the arguments in entry frame
880 class EntryFrameOopFinder: public SignatureInfo {
881 private:
882 bool _is_static;
883 int _offset;
884 frame* _fr;
885 OopClosure* _f;
886
887 void set(int size, BasicType type) {
888 assert (_offset >= 0, "illegal offset");
889 if (type == T_OBJECT || type == T_ARRAY || type == T_VALUETYPE) oop_at_offset_do(_offset);
890 _offset -= size;
891 }
892
893 void oop_at_offset_do(int offset) {
894 assert (offset >= 0, "illegal offset");
895 oop* addr = (oop*) _fr->entry_frame_argument_at(offset);
896 _f->do_oop(addr);
897 }
898
899 public:
900 EntryFrameOopFinder(frame* frame, Symbol* signature, bool is_static) : SignatureInfo(signature) {
901 _f = NULL; // will be set later
902 _fr = frame;
903 _is_static = is_static;
904 _offset = ArgumentSizeComputer(signature).size() - 1; // last parameter is at index 0
905 }
906
907 void arguments_do(OopClosure* f) {
908 _f = f;
909 if (!_is_static) oop_at_offset_do(_offset+1); // do the receiver
910 iterate_parameters();
911 }
912
913 };
914
915 oop* frame::interpreter_callee_receiver_addr(Symbol* signature) {
916 ArgumentSizeComputer asc(signature);
917 int size = asc.size();
918 return (oop *)interpreter_frame_tos_at(size);
919 }
920
921
922 void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache) {
923 assert(is_interpreted_frame(), "Not an interpreted frame");
924 assert(map != NULL, "map must be set");
929 assert(!Universe::heap()->is_in(m()),
930 "must be valid oop");
931 assert(m->is_method(), "checking frame value");
932 assert((m->is_native() && bci == 0) ||
933 (!m->is_native() && bci >= 0 && bci < m->code_size()),
934 "invalid bci value");
935
936 // Handle the monitor elements in the activation
937 for (
938 BasicObjectLock* current = interpreter_frame_monitor_end();
939 current < interpreter_frame_monitor_begin();
940 current = next_monitor_in_interpreter_frame(current)
941 ) {
942 #ifdef ASSERT
943 interpreter_frame_verify_monitor(current);
944 #endif
945 current->oops_do(f);
946 }
947
948 if (m->is_native()) {
949 f->do_oop(interpreter_frame_temp_oop_addr());
950 }
951
952 // The method pointer in the frame might be the only path to the method's
953 // klass, and the klass needs to be kept alive while executing. The GCs
954 // don't trace through method pointers, so the mirror of the method's klass
955 // is installed as a GC root.
956 f->do_oop(interpreter_frame_mirror_addr());
957
958 int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals();
959
960 Symbol* signature = NULL;
961 bool has_receiver = false;
962
963 // Process a callee's arguments if we are at a call site
964 // (i.e., if we are at an invoke bytecode)
965 // This is used sometimes for calling into the VM, not for another
966 // interpreted or compiled frame.
967 if (!m->is_native()) {
968 Bytecode_invoke call = Bytecode_invoke_check(m, bci);
1035 }
1036 // In cases where perm gen is collected, GC will want to mark
1037 // oops referenced from nmethods active on thread stacks so as to
1038 // prevent them from being collected. However, this visit should be
1039 // restricted to certain phases of the collection only. The
1040 // closure decides how it wants nmethods to be traced.
1041 if (cf != NULL)
1042 cf->do_code_blob(_cb);
1043 }
1044
1045 class CompiledArgumentOopFinder: public SignatureInfo {
1046 protected:
1047 OopClosure* _f;
1048 int _offset; // the current offset, incremented with each argument
1049 bool _has_receiver; // true if the callee has a receiver
1050 bool _has_appendix; // true if the call has an appendix
1051 frame _fr;
1052 RegisterMap* _reg_map;
1053 int _arg_size;
1054 VMRegPair* _regs; // VMReg list of arguments
1055
1056 void set(int size, BasicType type) {
1057 if (type == T_OBJECT || type == T_ARRAY || type == T_VALUETYPE) handle_oop_offset();
1058 _offset += size;
1059 }
1060
1061 virtual void handle_oop_offset() {
1062 // Extract low order register number from register array.
1063 // In LP64-land, the high-order bits are valid but unhelpful.
1064 assert(_offset < _arg_size, "out of bounds");
1065 VMReg reg = _regs[_offset].first();
1066 oop *loc = _fr.oopmapreg_to_location(reg, _reg_map);
1067 _f->do_oop(loc);
1068 }
1069
1070 public:
1071 CompiledArgumentOopFinder(Symbol* signature, bool has_receiver, bool has_appendix, OopClosure* f, frame fr, const RegisterMap* reg_map)
1072 : SignatureInfo(signature) {
1073
1074 // initialize CompiledArgumentOopFinder
1075 _f = f;
1076 _offset = 0;
1077 _has_receiver = has_receiver;
1078 _has_appendix = has_appendix;
1079 _fr = fr;
1080 _reg_map = (RegisterMap*)reg_map;
1081 _regs = SharedRuntime::find_callee_arguments(signature, has_receiver, has_appendix, &_arg_size);
1082 }
1083
1084 void oops_do() {
1085 if (_has_receiver) {
1086 handle_oop_offset();
1087 _offset++;
1088 }
1089 iterate_parameters();
1090 if (_has_appendix) {
1091 handle_oop_offset();
1092 _offset++;
1093 }
1094 }
1095 };
1096
1097 void frame::oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix,
1098 const RegisterMap* reg_map, OopClosure* f) {
1099 ResourceMark rm;
1100 CompiledArgumentOopFinder finder(signature, has_receiver, has_appendix, f, *this, reg_map);
1101 finder.oops_do();
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "code/codeCache.hpp"
27 #include "code/vmreg.inline.hpp"
28 #include "compiler/abstractCompiler.hpp"
29 #include "compiler/disassembler.hpp"
30 #include "gc/shared/collectedHeap.inline.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "interpreter/oopMapCache.hpp"
33 #include "memory/resourceArea.hpp"
34 #include "memory/universe.inline.hpp"
35 #include "oops/markOop.hpp"
36 #include "oops/method.hpp"
37 #include "oops/methodData.hpp"
38 #include "oops/oop.inline.hpp"
39 #include "oops/valueKlass.hpp"
40 #include "oops/verifyOopClosure.hpp"
41 #include "prims/methodHandles.hpp"
42 #include "runtime/frame.inline.hpp"
43 #include "runtime/handles.inline.hpp"
44 #include "runtime/javaCalls.hpp"
45 #include "runtime/monitorChunk.hpp"
46 #include "runtime/os.hpp"
47 #include "runtime/sharedRuntime.hpp"
48 #include "runtime/signature.hpp"
49 #include "runtime/stubCodeGenerator.hpp"
50 #include "runtime/stubRoutines.hpp"
51 #include "runtime/thread.inline.hpp"
52 #include "utilities/debug.hpp"
53 #include "utilities/decoder.hpp"
54 #include "utilities/formatBuffer.hpp"
55
56 RegisterMap::RegisterMap(JavaThread *thread, bool update_map) {
57 _thread = thread;
58 _update_map = update_map;
59 clear();
746 print_C_frame(st, buf, buflen, pc());
747 }
748 }
749
750
751 /*
752 The interpreter_frame_expression_stack_at method in the case of SPARC needs the
753 max_stack value of the method in order to compute the expression stack address.
754 It uses the Method* in order to get the max_stack value but during GC this
755 Method* value saved on the frame is changed by reverse_and_push and hence cannot
756 be used. So we save the max_stack value in the FrameClosure object and pass it
757 down to the interpreter_frame_expression_stack_at method
758 */
759 class InterpreterFrameClosure : public OffsetClosure {
760 private:
761 frame* _fr;
762 OopClosure* _f;
763 BufferedValueClosure* _bvt_f;
764 int _max_locals;
765 int _max_stack;
766 BufferedValuesDealiaser* _dealiaser;
767
768 public:
769 InterpreterFrameClosure(frame* fr, int max_locals, int max_stack,
770 OopClosure* f, BufferedValueClosure* bvt_f) {
771 _fr = fr;
772 _max_locals = max_locals;
773 _max_stack = max_stack;
774 _f = f;
775 _bvt_f = bvt_f;
776 _dealiaser = NULL;
777 }
778
779 void offset_do(int offset) {
780 oop* addr;
781 if (offset < _max_locals) {
782 addr = (oop*) _fr->interpreter_frame_local_at(offset);
783 assert((intptr_t*)addr >= _fr->sp(), "must be inside the frame");
784 if (!VTBuffer::is_in_vt_buffer(*addr)) {
785 if (_f != NULL) {
786 _f->do_oop(addr);
787 }
788 } else { // Buffered value types case
789 assert((*addr)->is_value(), "Only values can be buffered");
790 if (_f != NULL) {
791 dealiaser()->oops_do(_f, *addr);
792 }
793 if (_bvt_f != NULL) {
794 _bvt_f->do_buffered_value(addr);
795 }
796 }
797 } else {
798 addr = (oop*) _fr->interpreter_frame_expression_stack_at((offset - _max_locals));
799 // In case of exceptions, the expression stack is invalid and the esp will be reset to express
800 // this condition. Therefore, we call f only if addr is 'inside' the stack (i.e., addr >= esp for Intel).
801 bool in_stack;
802 if (frame::interpreter_frame_expression_stack_direction() > 0) {
803 in_stack = (intptr_t*)addr <= _fr->interpreter_frame_tos_address();
804 } else {
805 in_stack = (intptr_t*)addr >= _fr->interpreter_frame_tos_address();
806 }
807 if (in_stack) {
808 if (!VTBuffer::is_in_vt_buffer(*addr)) {
809 if (_f != NULL) {
810 _f->do_oop(addr);
811 }
812 } else { // Buffered value types case
813 assert((*addr)->is_value(), "Only values can be buffered");
814 if (_f != NULL) {
815 dealiaser()->oops_do(_f, *addr);
816 }
817 if (_bvt_f != NULL) {
818 _bvt_f->do_buffered_value(addr);
819 }
820 }
821 }
822 }
823 }
824
825 int max_locals() { return _max_locals; }
826 frame* fr() { return _fr; }
827
828 private:
829 BufferedValuesDealiaser* dealiaser() {
830 if (_dealiaser == NULL) {
831 _dealiaser = Thread::current()->buffered_values_dealiaser();
832 assert(_dealiaser != NULL, "Must not be NULL");
833 }
834 return _dealiaser;
835 }
836 };
837
838
839 class InterpretedArgumentOopFinder: public SignatureInfo {
840 private:
841 OopClosure* _f; // Closure to invoke
842 int _offset; // TOS-relative offset, decremented with each argument
843 bool _has_receiver; // true if the callee has a receiver
844 frame* _fr;
845 BufferedValuesDealiaser* _dealiaser;
846
847 void set(int size, BasicType type) {
848 _offset -= size;
849 if (type == T_OBJECT || type == T_ARRAY || type == T_VALUETYPE) oop_offset_do();
850 }
851
852 void oop_offset_do() {
853 oop* addr;
854 addr = (oop*)_fr->interpreter_frame_tos_at(_offset);
855 if (!VTBuffer::is_in_vt_buffer(*addr)) {
856 _f->do_oop(addr);
857 } else { // Buffered value types case
858 assert((*addr)->is_value(), "Only values can be buffered");
859 dealiaser()->oops_do(_f, *addr);
860 }
861 }
862
863 public:
864 InterpretedArgumentOopFinder(Symbol* signature, bool has_receiver, frame* fr, OopClosure* f) : SignatureInfo(signature), _has_receiver(has_receiver) {
865 // compute size of arguments
866 int args_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0);
867 assert(!fr->is_interpreted_frame() ||
868 args_size <= fr->interpreter_frame_expression_stack_size(),
869 "args cannot be on stack anymore");
870 // initialize InterpretedArgumentOopFinder
871 _f = f;
872 _fr = fr;
873 _offset = args_size;
874 _dealiaser = NULL;
875 }
876
877 BufferedValuesDealiaser* dealiaser() {
878 if (_dealiaser == NULL) {
879 _dealiaser = Thread::current()->buffered_values_dealiaser();
880 assert(_dealiaser != NULL, "Must not be NULL");
881 }
882 return _dealiaser;
883 }
884
885 void oops_do() {
886 if (_has_receiver) {
887 --_offset;
888 oop_offset_do();
889 }
890 iterate_parameters();
891 }
892 };
893
894
895 // Entry frame has following form (n arguments)
896 // +-----------+
897 // sp -> | last arg |
898 // +-----------+
899 // : ::: :
900 // +-----------+
901 // (sp+n)->| first arg|
902 // +-----------+
903
904
905
906 // visits and GC's all the arguments in entry frame
907 class EntryFrameOopFinder: public SignatureInfo {
908 private:
909 bool _is_static;
910 int _offset;
911 frame* _fr;
912 OopClosure* _f;
913 BufferedValuesDealiaser* _dealiaser;
914
915 BufferedValuesDealiaser* dealiaser() {
916 if (_dealiaser == NULL) {
917 _dealiaser = Thread::current()->buffered_values_dealiaser();
918 assert(_dealiaser != NULL, "Must not be NULL");
919 }
920 return _dealiaser;
921 }
922
923 void set(int size, BasicType type) {
924 assert (_offset >= 0, "illegal offset");
925 if (type == T_OBJECT || type == T_ARRAY || type == T_VALUETYPE) oop_at_offset_do(_offset);
926 _offset -= size;
927 }
928
929 void oop_at_offset_do(int offset) {
930 assert (offset >= 0, "illegal offset");
931 oop* addr = (oop*) _fr->entry_frame_argument_at(offset);
932 if (!VTBuffer::is_in_vt_buffer(*addr)) {
933 _f->do_oop(addr);
934 } else { // Buffered value types case
935 assert((*addr)->is_value(), "Only values can be buffered");
936 dealiaser()->oops_do(_f, *addr);
937 }
938 }
939
940 public:
941 EntryFrameOopFinder(frame* frame, Symbol* signature, bool is_static) : SignatureInfo(signature) {
942 _f = NULL; // will be set later
943 _fr = frame;
944 _is_static = is_static;
945 _offset = ArgumentSizeComputer(signature).size() - 1; // last parameter is at index 0
946 _dealiaser = NULL;
947 }
948
949 void arguments_do(OopClosure* f) {
950 _f = f;
951 if (!_is_static) oop_at_offset_do(_offset+1); // do the receiver
952 iterate_parameters();
953 }
954
955 };
956
957 oop* frame::interpreter_callee_receiver_addr(Symbol* signature) {
958 ArgumentSizeComputer asc(signature);
959 int size = asc.size();
960 return (oop *)interpreter_frame_tos_at(size);
961 }
962
963
964 void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache) {
965 assert(is_interpreted_frame(), "Not an interpreted frame");
966 assert(map != NULL, "map must be set");
971 assert(!Universe::heap()->is_in(m()),
972 "must be valid oop");
973 assert(m->is_method(), "checking frame value");
974 assert((m->is_native() && bci == 0) ||
975 (!m->is_native() && bci >= 0 && bci < m->code_size()),
976 "invalid bci value");
977
978 // Handle the monitor elements in the activation
979 for (
980 BasicObjectLock* current = interpreter_frame_monitor_end();
981 current < interpreter_frame_monitor_begin();
982 current = next_monitor_in_interpreter_frame(current)
983 ) {
984 #ifdef ASSERT
985 interpreter_frame_verify_monitor(current);
986 #endif
987 current->oops_do(f);
988 }
989
990 if (m->is_native()) {
991 assert(!VTBuffer::is_in_vt_buffer((oopDesc*)*interpreter_frame_temp_oop_addr()), "Sanity check");
992 f->do_oop(interpreter_frame_temp_oop_addr());
993 }
994
995 // The method pointer in the frame might be the only path to the method's
996 // klass, and the klass needs to be kept alive while executing. The GCs
997 // don't trace through method pointers, so the mirror of the method's klass
998 // is installed as a GC root.
999 f->do_oop(interpreter_frame_mirror_addr());
1000
1001 int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals();
1002
1003 Symbol* signature = NULL;
1004 bool has_receiver = false;
1005
1006 // Process a callee's arguments if we are at a call site
1007 // (i.e., if we are at an invoke bytecode)
1008 // This is used sometimes for calling into the VM, not for another
1009 // interpreted or compiled frame.
1010 if (!m->is_native()) {
1011 Bytecode_invoke call = Bytecode_invoke_check(m, bci);
1078 }
1079 // In cases where perm gen is collected, GC will want to mark
1080 // oops referenced from nmethods active on thread stacks so as to
1081 // prevent them from being collected. However, this visit should be
1082 // restricted to certain phases of the collection only. The
1083 // closure decides how it wants nmethods to be traced.
1084 if (cf != NULL)
1085 cf->do_code_blob(_cb);
1086 }
1087
1088 class CompiledArgumentOopFinder: public SignatureInfo {
1089 protected:
1090 OopClosure* _f;
1091 int _offset; // the current offset, incremented with each argument
1092 bool _has_receiver; // true if the callee has a receiver
1093 bool _has_appendix; // true if the call has an appendix
1094 frame _fr;
1095 RegisterMap* _reg_map;
1096 int _arg_size;
1097 VMRegPair* _regs; // VMReg list of arguments
1098 BufferedValuesDealiaser* _dealiaser;
1099
1100 BufferedValuesDealiaser* dealiaser() {
1101 if (_dealiaser == NULL) {
1102 _dealiaser = Thread::current()->buffered_values_dealiaser();
1103 assert(_dealiaser != NULL, "Must not be NULL");
1104 }
1105 return _dealiaser;
1106 }
1107
1108 void set(int size, BasicType type) {
1109 if (type == T_OBJECT || type == T_ARRAY || type == T_VALUETYPE) handle_oop_offset();
1110 _offset += size;
1111 }
1112
1113 virtual void handle_oop_offset() {
1114 // Extract low order register number from register array.
1115 // In LP64-land, the high-order bits are valid but unhelpful.
1116 assert(_offset < _arg_size, "out of bounds");
1117 VMReg reg = _regs[_offset].first();
1118 oop *loc = _fr.oopmapreg_to_location(reg, _reg_map);
1119 if (!VTBuffer::is_in_vt_buffer(*loc)) {
1120 _f->do_oop(loc);
1121 } else { // Buffered value types case
1122 assert((*loc)->is_value(), "Only values can be buffered");
1123 dealiaser()->oops_do(_f, *loc);
1124 }
1125 }
1126
1127 public:
1128 CompiledArgumentOopFinder(Symbol* signature, bool has_receiver, bool has_appendix, OopClosure* f, frame fr, const RegisterMap* reg_map)
1129 : SignatureInfo(signature) {
1130
1131 // initialize CompiledArgumentOopFinder
1132 _f = f;
1133 _offset = 0;
1134 _has_receiver = has_receiver;
1135 _has_appendix = has_appendix;
1136 _fr = fr;
1137 _reg_map = (RegisterMap*)reg_map;
1138 _regs = SharedRuntime::find_callee_arguments(signature, has_receiver, has_appendix, &_arg_size);
1139 _dealiaser = NULL;
1140 }
1141
1142 void oops_do() {
1143 if (_has_receiver) {
1144 handle_oop_offset();
1145 _offset++;
1146 }
1147 iterate_parameters();
1148 if (_has_appendix) {
1149 handle_oop_offset();
1150 _offset++;
1151 }
1152 }
1153 };
1154
1155 void frame::oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix,
1156 const RegisterMap* reg_map, OopClosure* f) {
1157 ResourceMark rm;
1158 CompiledArgumentOopFinder finder(signature, has_receiver, has_appendix, f, *this, reg_map);
1159 finder.oops_do();
|