706 if (in_stack) {
707 _f->do_oop(addr);
708 }
709 }
710 }
711
712 int max_locals() { return _max_locals; }
713 frame* fr() { return _fr; }
714 };
715
716
717 class InterpretedArgumentOopFinder: public SignatureInfo {
718 private:
719 OopClosure* _f; // Closure to invoke
720 int _offset; // TOS-relative offset, decremented with each argument
721 bool _has_receiver; // true if the callee has a receiver
722 frame* _fr;
723
724 void set(int size, BasicType type) {
725 _offset -= size;
726 if (type == T_OBJECT || type == T_ARRAY) oop_offset_do();
727 }
728
729 void oop_offset_do() {
730 oop* addr;
731 addr = (oop*)_fr->interpreter_frame_tos_at(_offset);
732 _f->do_oop(addr);
733 }
734
735 public:
736 InterpretedArgumentOopFinder(Symbol* signature, bool has_receiver, frame* fr, OopClosure* f) : SignatureInfo(signature), _has_receiver(has_receiver) {
737 // compute size of arguments
738 int args_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0);
739 assert(!fr->is_interpreted_frame() ||
740 args_size <= fr->interpreter_frame_expression_stack_size(),
741 "args cannot be on stack anymore");
742 // initialize InterpretedArgumentOopFinder
743 _f = f;
744 _fr = fr;
745 _offset = args_size;
746 }
759 // +-----------+
760 // sp -> | last arg |
761 // +-----------+
762 // : ::: :
763 // +-----------+
764 // (sp+n)->| first arg|
765 // +-----------+
766
767
768
769 // visits and GC's all the arguments in entry frame
770 class EntryFrameOopFinder: public SignatureInfo {
771 private:
772 bool _is_static;
773 int _offset;
774 frame* _fr;
775 OopClosure* _f;
776
777 void set(int size, BasicType type) {
778 assert (_offset >= 0, "illegal offset");
779 if (type == T_OBJECT || type == T_ARRAY) oop_at_offset_do(_offset);
780 _offset -= size;
781 }
782
783 void oop_at_offset_do(int offset) {
784 assert (offset >= 0, "illegal offset");
785 oop* addr = (oop*) _fr->entry_frame_argument_at(offset);
786 _f->do_oop(addr);
787 }
788
789 public:
790 EntryFrameOopFinder(frame* frame, Symbol* signature, bool is_static) : SignatureInfo(signature) {
791 _f = NULL; // will be set later
792 _fr = frame;
793 _is_static = is_static;
794 _offset = ArgumentSizeComputer(signature).size() - 1; // last parameter is at index 0
795 }
796
797 void arguments_do(OopClosure* f) {
798 _f = f;
799 if (!_is_static) oop_at_offset_do(_offset+1); // do the receiver
910 // oops referenced from nmethods active on thread stacks so as to
911 // prevent them from being collected. However, this visit should be
912 // restricted to certain phases of the collection only. The
913 // closure decides how it wants nmethods to be traced.
914 if (cf != NULL)
915 cf->do_code_blob(_cb);
916 }
917
918 class CompiledArgumentOopFinder: public SignatureInfo {
919 protected:
920 OopClosure* _f;
921 int _offset; // the current offset, incremented with each argument
922 bool _has_receiver; // true if the callee has a receiver
923 bool _has_appendix; // true if the call has an appendix
924 frame _fr;
925 RegisterMap* _reg_map;
926 int _arg_size;
927 VMRegPair* _regs; // VMReg list of arguments
928
929 void set(int size, BasicType type) {
930 if (type == T_OBJECT || type == T_ARRAY) handle_oop_offset();
931 _offset += size;
932 }
933
934 virtual void handle_oop_offset() {
935 // Extract low order register number from register array.
936 // In LP64-land, the high-order bits are valid but unhelpful.
937 VMReg reg = _regs[_offset].first();
938 oop *loc = _fr.oopmapreg_to_location(reg, _reg_map);
939 _f->do_oop(loc);
940 }
941
942 public:
943 CompiledArgumentOopFinder(Symbol* signature, bool has_receiver, bool has_appendix, OopClosure* f, frame fr, const RegisterMap* reg_map)
944 : SignatureInfo(signature) {
945
946 // initialize CompiledArgumentOopFinder
947 _f = f;
948 _offset = 0;
949 _has_receiver = has_receiver;
950 _has_appendix = has_appendix;
|
706 if (in_stack) {
707 _f->do_oop(addr);
708 }
709 }
710 }
711
712 int max_locals() { return _max_locals; }
713 frame* fr() { return _fr; }
714 };
715
716
717 class InterpretedArgumentOopFinder: public SignatureInfo {
718 private:
719 OopClosure* _f; // Closure to invoke
720 int _offset; // TOS-relative offset, decremented with each argument
721 bool _has_receiver; // true if the callee has a receiver
722 frame* _fr;
723
724 void set(int size, BasicType type) {
725 _offset -= size;
726 if (is_reference_type(type)) oop_offset_do();
727 }
728
729 void oop_offset_do() {
730 oop* addr;
731 addr = (oop*)_fr->interpreter_frame_tos_at(_offset);
732 _f->do_oop(addr);
733 }
734
735 public:
736 InterpretedArgumentOopFinder(Symbol* signature, bool has_receiver, frame* fr, OopClosure* f) : SignatureInfo(signature), _has_receiver(has_receiver) {
737 // compute size of arguments
738 int args_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0);
739 assert(!fr->is_interpreted_frame() ||
740 args_size <= fr->interpreter_frame_expression_stack_size(),
741 "args cannot be on stack anymore");
742 // initialize InterpretedArgumentOopFinder
743 _f = f;
744 _fr = fr;
745 _offset = args_size;
746 }
759 // +-----------+
760 // sp -> | last arg |
761 // +-----------+
762 // : ::: :
763 // +-----------+
764 // (sp+n)->| first arg|
765 // +-----------+
766
767
768
769 // visits and GC's all the arguments in entry frame
770 class EntryFrameOopFinder: public SignatureInfo {
771 private:
772 bool _is_static;
773 int _offset;
774 frame* _fr;
775 OopClosure* _f;
776
777 void set(int size, BasicType type) {
778 assert (_offset >= 0, "illegal offset");
779 if (is_reference_type(type)) oop_at_offset_do(_offset);
780 _offset -= size;
781 }
782
783 void oop_at_offset_do(int offset) {
784 assert (offset >= 0, "illegal offset");
785 oop* addr = (oop*) _fr->entry_frame_argument_at(offset);
786 _f->do_oop(addr);
787 }
788
789 public:
790 EntryFrameOopFinder(frame* frame, Symbol* signature, bool is_static) : SignatureInfo(signature) {
791 _f = NULL; // will be set later
792 _fr = frame;
793 _is_static = is_static;
794 _offset = ArgumentSizeComputer(signature).size() - 1; // last parameter is at index 0
795 }
796
797 void arguments_do(OopClosure* f) {
798 _f = f;
799 if (!_is_static) oop_at_offset_do(_offset+1); // do the receiver
910 // oops referenced from nmethods active on thread stacks so as to
911 // prevent them from being collected. However, this visit should be
912 // restricted to certain phases of the collection only. The
913 // closure decides how it wants nmethods to be traced.
914 if (cf != NULL)
915 cf->do_code_blob(_cb);
916 }
917
918 class CompiledArgumentOopFinder: public SignatureInfo {
919 protected:
920 OopClosure* _f;
921 int _offset; // the current offset, incremented with each argument
922 bool _has_receiver; // true if the callee has a receiver
923 bool _has_appendix; // true if the call has an appendix
924 frame _fr;
925 RegisterMap* _reg_map;
926 int _arg_size;
927 VMRegPair* _regs; // VMReg list of arguments
928
929 void set(int size, BasicType type) {
930 if (is_reference_type(type)) handle_oop_offset();
931 _offset += size;
932 }
933
934 virtual void handle_oop_offset() {
935 // Extract low order register number from register array.
936 // In LP64-land, the high-order bits are valid but unhelpful.
937 VMReg reg = _regs[_offset].first();
938 oop *loc = _fr.oopmapreg_to_location(reg, _reg_map);
939 _f->do_oop(loc);
940 }
941
942 public:
943 CompiledArgumentOopFinder(Symbol* signature, bool has_receiver, bool has_appendix, OopClosure* f, frame fr, const RegisterMap* reg_map)
944 : SignatureInfo(signature) {
945
946 // initialize CompiledArgumentOopFinder
947 _f = f;
948 _offset = 0;
949 _has_receiver = has_receiver;
950 _has_appendix = has_appendix;
|