< prev index next >

src/hotspot/share/runtime/frame.cpp

Print this page




 429   return interpreter_frame_method()->bcp_from(bcp);
 430 }
 431 
 432 void frame::interpreter_frame_set_bcp(address bcp) {
 433   assert(is_interpreted_frame(), "interpreted frame expected");
 434   *interpreter_frame_bcp_addr() = (intptr_t)bcp;
 435 }
 436 
 437 address frame::interpreter_frame_mdp() const {
 438   assert(ProfileInterpreter, "must be profiling interpreter");
 439   assert(is_interpreted_frame(), "interpreted frame expected");
 440   return (address)*interpreter_frame_mdp_addr();
 441 }
 442 
 443 void frame::interpreter_frame_set_mdp(address mdp) {
 444   assert(is_interpreted_frame(), "interpreted frame expected");
 445   assert(ProfileInterpreter, "must be profiling interpreter");
 446   *interpreter_frame_mdp_addr() = (intptr_t)mdp;
 447 }
 448 
 449 intptr_t* frame::interpreter_frame_vt_alloc_ptr() const {
 450   assert(is_interpreted_frame(), "interpreted frame expected");
 451   return (intptr_t*)*interpreter_frame_vt_alloc_ptr_addr();
 452 }
 453 
 454 void frame::interpreter_frame_set_vt_alloc_ptr(intptr_t* ptr) {
 455   assert(is_interpreted_frame(), "interpreted frame expected");
 456   *interpreter_frame_vt_alloc_ptr_addr() = ptr;
 457 }
 458 
 459 BasicObjectLock* frame::next_monitor_in_interpreter_frame(BasicObjectLock* current) const {
 460   assert(is_interpreted_frame(), "Not an interpreted frame");
 461 #ifdef ASSERT
 462   interpreter_frame_verify_monitor(current);
 463 #endif
 464   BasicObjectLock* next = (BasicObjectLock*) (((intptr_t*) current) + interpreter_frame_monitor_size());
 465   return next;
 466 }
 467 
 468 BasicObjectLock* frame::previous_monitor_in_interpreter_frame(BasicObjectLock* current) const {
 469   assert(is_interpreted_frame(), "Not an interpreted frame");
 470 #ifdef ASSERT
 471 //   // This verification needs to be checked before being enabled
 472 //   interpreter_frame_verify_monitor(current);
 473 #endif
 474   BasicObjectLock* previous = (BasicObjectLock*) (((intptr_t*) current) - interpreter_frame_monitor_size());
 475   return previous;
 476 }
 477 
 478 // Interpreter locals and expression stack locations.


 744       st->print("v  blob " PTR_FORMAT, p2i(pc()));
 745     }
 746   } else {
 747     print_C_frame(st, buf, buflen, pc());
 748   }
 749 }
 750 
 751 
 752 /*
 753   The interpreter_frame_expression_stack_at method in the case of SPARC needs the
 754   max_stack value of the method in order to compute the expression stack address.
 755   It uses the Method* in order to get the max_stack value but during GC this
 756   Method* value saved on the frame is changed by reverse_and_push and hence cannot
 757   be used. So we save the max_stack value in the FrameClosure object and pass it
 758   down to the interpreter_frame_expression_stack_at method
 759 */
 760 class InterpreterFrameClosure : public OffsetClosure {
 761  private:
 762   frame* _fr;
 763   OopClosure* _f;
 764   BufferedValueClosure* _bvt_f;
 765   int    _max_locals;
 766   int    _max_stack;
 767   BufferedValuesDealiaser* _dealiaser;
 768 
 769  public:
 770   InterpreterFrameClosure(frame* fr, int max_locals, int max_stack,
 771                           OopClosure* f, BufferedValueClosure* bvt_f) {
 772     _fr         = fr;
 773     _max_locals = max_locals;
 774     _max_stack  = max_stack;
 775     _f          = f;
 776     _bvt_f      = bvt_f;
 777     _dealiaser  = NULL;
 778   }
 779 
 780   void offset_do(int offset) {
 781     oop* addr;
 782     if (offset < _max_locals) {
 783       addr = (oop*) _fr->interpreter_frame_local_at(offset);
 784       assert((intptr_t*)addr >= _fr->sp(), "must be inside the frame");
 785       if (!VTBuffer::is_in_vt_buffer(*addr)) {
 786         if (_f != NULL) {
 787           _f->do_oop(addr);
 788         }
 789       } else { // Buffered value types case
 790         assert(ValueTypesBufferMaxMemory > 0, "Sanity check");
 791         assert((*addr)->is_value(), "Only values can be buffered");
 792         if (_f != NULL) {
 793           dealiaser()->oops_do(_f, *addr);
 794         }
 795         if (_bvt_f != NULL) {
 796           _bvt_f->do_buffered_value(addr);
 797         }
 798       }
 799     } else {
 800       addr = (oop*) _fr->interpreter_frame_expression_stack_at((offset - _max_locals));
 801       // In case of exceptions, the expression stack is invalid and the esp will be reset to express
 802       // this condition. Therefore, we call f only if addr is 'inside' the stack (i.e., addr >= esp for Intel).
 803       bool in_stack;
 804       if (frame::interpreter_frame_expression_stack_direction() > 0) {
 805         in_stack = (intptr_t*)addr <= _fr->interpreter_frame_tos_address();
 806       } else {
 807         in_stack = (intptr_t*)addr >= _fr->interpreter_frame_tos_address();
 808       }
 809       if (in_stack) {
 810         if (!VTBuffer::is_in_vt_buffer(*addr)) {
 811           if (_f != NULL) {
 812             _f->do_oop(addr);
 813           }
 814         } else { // Buffered value types case
 815           assert(ValueTypesBufferMaxMemory > 0, "Sanity check");
 816           assert((*addr)->is_value(), "Only values can be buffered");
 817           if (_f != NULL) {
 818             dealiaser()->oops_do(_f, *addr);
 819           }
 820           if (_bvt_f != NULL) {
 821             _bvt_f->do_buffered_value(addr);
 822           }
 823         }
 824       }
 825     }
 826   }
 827 
 828   int max_locals()  { return _max_locals; }
 829   frame* fr()       { return _fr; }
 830 
 831  private:
 832   BufferedValuesDealiaser* dealiaser() {
 833     if (_dealiaser == NULL) {
 834       _dealiaser = Thread::current()->buffered_values_dealiaser();
 835       assert(_dealiaser != NULL, "Must not be NULL");
 836     }
 837     return _dealiaser;
 838   }
 839 };
 840 
 841 
 842 class InterpretedArgumentOopFinder: public SignatureInfo {
 843  private:
 844   OopClosure* _f;        // Closure to invoke
 845   int    _offset;        // TOS-relative offset, decremented with each argument
 846   bool   _has_receiver;  // true if the callee has a receiver
 847   frame* _fr;
 848   BufferedValuesDealiaser* _dealiaser;
 849 
 850   void set(int size, BasicType type) {
 851     _offset -= size;
 852     if (type == T_OBJECT || type == T_ARRAY || type == T_VALUETYPE) oop_offset_do();
 853   }
 854 
 855   void oop_offset_do() {
 856     oop* addr;
 857     addr = (oop*)_fr->interpreter_frame_tos_at(_offset);
 858     if (!VTBuffer::is_in_vt_buffer(*addr)) {
 859       _f->do_oop(addr);
 860     } else { // Buffered value types case
 861       assert((*addr)->is_value(), "Only values can be buffered");
 862       oop value = *addr;
 863       dealiaser()->oops_do(_f, value);
 864     }
 865   }
 866 
 867  public:
 868   InterpretedArgumentOopFinder(Symbol* signature, bool has_receiver, frame* fr, OopClosure* f) : SignatureInfo(signature), _has_receiver(has_receiver) {
 869     // compute size of arguments
 870     int args_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0);
 871     assert(!fr->is_interpreted_frame() ||
 872            args_size <= fr->interpreter_frame_expression_stack_size(),
 873             "args cannot be on stack anymore");
 874     // initialize InterpretedArgumentOopFinder
 875     _f         = f;
 876     _fr        = fr;
 877     _offset    = args_size;
 878     _dealiaser = NULL;
 879   }
 880 
 881   BufferedValuesDealiaser* dealiaser() {
 882     if (_dealiaser == NULL) {
 883       _dealiaser = Thread::current()->buffered_values_dealiaser();
 884       assert(_dealiaser != NULL, "Must not be NULL");
 885     }
 886     return _dealiaser;
 887   }
 888 
 889   void oops_do() {
 890     if (_has_receiver) {
 891       --_offset;
 892       oop_offset_do();
 893     }
 894     iterate_parameters();
 895   }
 896 };
 897 
 898 
 899 // Entry frame has following form (n arguments)
 900 //         +-----------+
 901 //   sp -> |  last arg |
 902 //         +-----------+
 903 //         :    :::    :
 904 //         +-----------+
 905 // (sp+n)->|  first arg|
 906 //         +-----------+
 907 
 908 
 909 
 910 // visits and GC's all the arguments in entry frame
 911 class EntryFrameOopFinder: public SignatureInfo {
 912  private:
 913   bool   _is_static;
 914   int    _offset;
 915   frame* _fr;
 916   OopClosure* _f;
 917   BufferedValuesDealiaser* _dealiaser;
 918 
 919   BufferedValuesDealiaser* dealiaser() {
 920     if (_dealiaser == NULL) {
 921       _dealiaser = Thread::current()->buffered_values_dealiaser();
 922       assert(_dealiaser != NULL, "Must not be NULL");
 923     }
 924     return _dealiaser;
 925   }
 926 
 927   void set(int size, BasicType type) {
 928     assert (_offset >= 0, "illegal offset");
 929     if (type == T_OBJECT || type == T_ARRAY || type == T_VALUETYPE) oop_at_offset_do(_offset);
 930     _offset -= size;
 931   }
 932 
 933   void oop_at_offset_do(int offset) {
 934     assert (offset >= 0, "illegal offset");
 935     oop* addr = (oop*) _fr->entry_frame_argument_at(offset);
 936     if (!VTBuffer::is_in_vt_buffer(*addr)) {
 937       _f->do_oop(addr);
 938     } else { // Buffered value types case
 939       assert((*addr)->is_value(), "Only values can be buffered");
 940       oop value = *addr;
 941       dealiaser()->oops_do(_f, value);
 942     }
 943   }
 944 
 945  public:
 946    EntryFrameOopFinder(frame* frame, Symbol* signature, bool is_static) : SignatureInfo(signature) {
 947      _f = NULL; // will be set later
 948      _fr = frame;
 949      _is_static = is_static;
 950      _offset = ArgumentSizeComputer(signature).size() - 1; // last parameter is at index 0
 951      _dealiaser = NULL;
 952    }
 953 
 954   void arguments_do(OopClosure* f) {
 955     _f = f;
 956     if (!_is_static) oop_at_offset_do(_offset+1); // do the receiver
 957     iterate_parameters();
 958   }
 959 
 960 };
 961 
 962 oop* frame::interpreter_callee_receiver_addr(Symbol* signature) {
 963   ArgumentSizeComputer asc(signature);
 964   int size = asc.size();
 965   return (oop *)interpreter_frame_tos_at(size);
 966 }
 967 
 968 
 969 void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache) {
 970   assert(is_interpreted_frame(), "Not an interpreted frame");
 971   assert(map != NULL, "map must be set");


 976   assert(!Universe::heap()->is_in(m()),
 977           "must be valid oop");
 978   assert(m->is_method(), "checking frame value");
 979   assert((m->is_native() && bci == 0)  ||
 980          (!m->is_native() && bci >= 0 && bci < m->code_size()),
 981          "invalid bci value");
 982 
 983   // Handle the monitor elements in the activation
 984   for (
 985     BasicObjectLock* current = interpreter_frame_monitor_end();
 986     current < interpreter_frame_monitor_begin();
 987     current = next_monitor_in_interpreter_frame(current)
 988   ) {
 989 #ifdef ASSERT
 990     interpreter_frame_verify_monitor(current);
 991 #endif
 992     current->oops_do(f);
 993   }
 994 
 995   if (m->is_native()) {
 996     assert(!VTBuffer::is_in_vt_buffer((oopDesc*)*interpreter_frame_temp_oop_addr()), "Sanity check");
 997     f->do_oop(interpreter_frame_temp_oop_addr());
 998   }
 999 
1000   // The method pointer in the frame might be the only path to the method's
1001   // klass, and the klass needs to be kept alive while executing. The GCs
1002   // don't trace through method pointers, so the mirror of the method's klass
1003   // is installed as a GC root.
1004   f->do_oop(interpreter_frame_mirror_addr());
1005 
1006   int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals();
1007 
1008   Symbol* signature = NULL;
1009   bool has_receiver = false;
1010 
1011   // Process a callee's arguments if we are at a call site
1012   // (i.e., if we are at an invoke bytecode)
1013   // This is used sometimes for calling into the VM, not for another
1014   // interpreted or compiled frame.
1015   if (!m->is_native()) {
1016     Bytecode_invoke call = Bytecode_invoke_check(m, bci);


1083   }
1084   // In cases where perm gen is collected, GC will want to mark
1085   // oops referenced from nmethods active on thread stacks so as to
1086   // prevent them from being collected. However, this visit should be
1087   // restricted to certain phases of the collection only. The
1088   // closure decides how it wants nmethods to be traced.
1089   if (cf != NULL)
1090     cf->do_code_blob(_cb);
1091 }
1092 
1093 class CompiledArgumentOopFinder: public SignatureInfo {
1094  protected:
1095   OopClosure*     _f;
1096   int             _offset;        // the current offset, incremented with each argument
1097   bool            _has_receiver;  // true if the callee has a receiver
1098   bool            _has_appendix;  // true if the call has an appendix
1099   frame           _fr;
1100   RegisterMap*    _reg_map;
1101   int             _arg_size;
1102   VMRegPair*      _regs;        // VMReg list of arguments
1103   BufferedValuesDealiaser* _dealiaser;
1104 
1105   BufferedValuesDealiaser* dealiaser() {
1106     if (_dealiaser == NULL) {
1107       _dealiaser = Thread::current()->buffered_values_dealiaser();
1108       assert(_dealiaser != NULL, "Must not be NULL");
1109     }
1110     return _dealiaser;
1111   }
1112 
1113   void set(int size, BasicType type) {
1114     if (type == T_OBJECT || type == T_ARRAY || type == T_VALUETYPE) handle_oop_offset();
1115     _offset += size;
1116   }
1117 
1118   virtual void handle_oop_offset() {
1119     // Extract low order register number from register array.
1120     // In LP64-land, the high-order bits are valid but unhelpful.
1121     assert(_offset < _arg_size, "out of bounds");
1122     VMReg reg = _regs[_offset].first();
1123     oop *loc = _fr.oopmapreg_to_location(reg, _reg_map);
1124     if (!VTBuffer::is_in_vt_buffer(*loc)) {
1125       _f->do_oop(loc);
1126     } else { // Buffered value types case
1127       assert((*loc)->is_value(), "Only values can be buffered");
1128       oop value = *loc;
1129       dealiaser()->oops_do(_f, value);
1130     }
1131   }
1132 
1133  public:
1134   CompiledArgumentOopFinder(Symbol* signature, bool has_receiver, bool has_appendix, OopClosure* f, frame fr, const RegisterMap* reg_map)
1135     : SignatureInfo(signature) {
1136 
1137     // initialize CompiledArgumentOopFinder
1138     _f         = f;
1139     _offset    = 0;
1140     _has_receiver = has_receiver;
1141     _has_appendix = has_appendix;
1142     _fr        = fr;
1143     _reg_map   = (RegisterMap*)reg_map;
1144     _regs = SharedRuntime::find_callee_arguments(signature, has_receiver, has_appendix, &_arg_size);
1145     _dealiaser = NULL;
1146   }
1147 
1148   void oops_do() {
1149     if (_has_receiver) {
1150       handle_oop_offset();
1151       _offset++;
1152     }
1153     iterate_parameters();
1154     if (_has_appendix) {
1155       handle_oop_offset();
1156       _offset++;
1157     }
1158   }
1159 };
1160 
1161 void frame::oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix,
1162                                        const RegisterMap* reg_map, OopClosure* f) {
1163   ResourceMark rm;
1164   CompiledArgumentOopFinder finder(signature, has_receiver, has_appendix, f, *this, reg_map);
1165   finder.oops_do();




 429   return interpreter_frame_method()->bcp_from(bcp);
 430 }
 431 
 432 void frame::interpreter_frame_set_bcp(address bcp) {
 433   assert(is_interpreted_frame(), "interpreted frame expected");
 434   *interpreter_frame_bcp_addr() = (intptr_t)bcp;
 435 }
 436 
 437 address frame::interpreter_frame_mdp() const {
 438   assert(ProfileInterpreter, "must be profiling interpreter");
 439   assert(is_interpreted_frame(), "interpreted frame expected");
 440   return (address)*interpreter_frame_mdp_addr();
 441 }
 442 
 443 void frame::interpreter_frame_set_mdp(address mdp) {
 444   assert(is_interpreted_frame(), "interpreted frame expected");
 445   assert(ProfileInterpreter, "must be profiling interpreter");
 446   *interpreter_frame_mdp_addr() = (intptr_t)mdp;
 447 }
 448 










 449 BasicObjectLock* frame::next_monitor_in_interpreter_frame(BasicObjectLock* current) const {
 450   assert(is_interpreted_frame(), "Not an interpreted frame");
 451 #ifdef ASSERT
 452   interpreter_frame_verify_monitor(current);
 453 #endif
 454   BasicObjectLock* next = (BasicObjectLock*) (((intptr_t*) current) + interpreter_frame_monitor_size());
 455   return next;
 456 }
 457 
 458 BasicObjectLock* frame::previous_monitor_in_interpreter_frame(BasicObjectLock* current) const {
 459   assert(is_interpreted_frame(), "Not an interpreted frame");
 460 #ifdef ASSERT
 461 //   // This verification needs to be checked before being enabled
 462 //   interpreter_frame_verify_monitor(current);
 463 #endif
 464   BasicObjectLock* previous = (BasicObjectLock*) (((intptr_t*) current) - interpreter_frame_monitor_size());
 465   return previous;
 466 }
 467 
 468 // Interpreter locals and expression stack locations.


 734       st->print("v  blob " PTR_FORMAT, p2i(pc()));
 735     }
 736   } else {
 737     print_C_frame(st, buf, buflen, pc());
 738   }
 739 }
 740 
 741 
 742 /*
 743   The interpreter_frame_expression_stack_at method in the case of SPARC needs the
 744   max_stack value of the method in order to compute the expression stack address.
 745   It uses the Method* in order to get the max_stack value but during GC this
 746   Method* value saved on the frame is changed by reverse_and_push and hence cannot
 747   be used. So we save the max_stack value in the FrameClosure object and pass it
 748   down to the interpreter_frame_expression_stack_at method
 749 */
 750 class InterpreterFrameClosure : public OffsetClosure {
 751  private:
 752   frame* _fr;
 753   OopClosure* _f;

 754   int    _max_locals;
 755   int    _max_stack;

 756 
 757  public:
 758   InterpreterFrameClosure(frame* fr, int max_locals, int max_stack,
 759                           OopClosure* f, BufferedValueClosure* bvt_f) {
 760     _fr         = fr;
 761     _max_locals = max_locals;
 762     _max_stack  = max_stack;
 763     _f          = f;


 764   }
 765 
 766   void offset_do(int offset) {
 767     oop* addr;
 768     if (offset < _max_locals) {
 769       addr = (oop*) _fr->interpreter_frame_local_at(offset);
 770       assert((intptr_t*)addr >= _fr->sp(), "must be inside the frame");

 771       if (_f != NULL) {
 772         _f->do_oop(addr);
 773       }










 774     } else {
 775       addr = (oop*) _fr->interpreter_frame_expression_stack_at((offset - _max_locals));
 776       // In case of exceptions, the expression stack is invalid and the esp will be reset to express
 777       // this condition. Therefore, we call f only if addr is 'inside' the stack (i.e., addr >= esp for Intel).
 778       bool in_stack;
 779       if (frame::interpreter_frame_expression_stack_direction() > 0) {
 780         in_stack = (intptr_t*)addr <= _fr->interpreter_frame_tos_address();
 781       } else {
 782         in_stack = (intptr_t*)addr >= _fr->interpreter_frame_tos_address();
 783       }
 784       if (in_stack) {

 785         if (_f != NULL) {
 786           _f->do_oop(addr);
 787         }










 788       }
 789     }
 790   }
 791 
 792   int max_locals()  { return _max_locals; }
 793   frame* fr()       { return _fr; }









 794 };
 795 
 796 
 797 class InterpretedArgumentOopFinder: public SignatureInfo {
 798  private:
 799   OopClosure* _f;        // Closure to invoke
 800   int    _offset;        // TOS-relative offset, decremented with each argument
 801   bool   _has_receiver;  // true if the callee has a receiver
 802   frame* _fr;

 803 
 804   void set(int size, BasicType type) {
 805     _offset -= size;
 806     if (type == T_OBJECT || type == T_ARRAY || type == T_VALUETYPE) oop_offset_do();
 807   }
 808 
 809   void oop_offset_do() {
 810     oop* addr;
 811     addr = (oop*)_fr->interpreter_frame_tos_at(_offset);

 812     _f->do_oop(addr);





 813   }
 814 
 815  public:
 816   InterpretedArgumentOopFinder(Symbol* signature, bool has_receiver, frame* fr, OopClosure* f) : SignatureInfo(signature), _has_receiver(has_receiver) {
 817     // compute size of arguments
 818     int args_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0);
 819     assert(!fr->is_interpreted_frame() ||
 820            args_size <= fr->interpreter_frame_expression_stack_size(),
 821             "args cannot be on stack anymore");
 822     // initialize InterpretedArgumentOopFinder
 823     _f         = f;
 824     _fr        = fr;
 825     _offset    = args_size;









 826   }
 827 
 828   void oops_do() {
 829     if (_has_receiver) {
 830       --_offset;
 831       oop_offset_do();
 832     }
 833     iterate_parameters();
 834   }
 835 };
 836 
 837 
 838 // Entry frame has following form (n arguments)
 839 //         +-----------+
 840 //   sp -> |  last arg |
 841 //         +-----------+
 842 //         :    :::    :
 843 //         +-----------+
 844 // (sp+n)->|  first arg|
 845 //         +-----------+
 846 
 847 
 848 
 849 // visits and GC's all the arguments in entry frame
 850 class EntryFrameOopFinder: public SignatureInfo {
 851  private:
 852   bool   _is_static;
 853   int    _offset;
 854   frame* _fr;
 855   OopClosure* _f;









 856 
 857   void set(int size, BasicType type) {
 858     assert (_offset >= 0, "illegal offset");
 859     if (type == T_OBJECT || type == T_ARRAY || type == T_VALUETYPE) oop_at_offset_do(_offset);
 860     _offset -= size;
 861   }
 862 
 863   void oop_at_offset_do(int offset) {
 864     assert (offset >= 0, "illegal offset");
 865     oop* addr = (oop*) _fr->entry_frame_argument_at(offset);

 866     _f->do_oop(addr);





 867   }
 868 
 869  public:
 870    EntryFrameOopFinder(frame* frame, Symbol* signature, bool is_static) : SignatureInfo(signature) {
 871      _f = NULL; // will be set later
 872      _fr = frame;
 873      _is_static = is_static;
 874      _offset = ArgumentSizeComputer(signature).size() - 1; // last parameter is at index 0

 875    }
 876 
 877   void arguments_do(OopClosure* f) {
 878     _f = f;
 879     if (!_is_static) oop_at_offset_do(_offset+1); // do the receiver
 880     iterate_parameters();
 881   }
 882 
 883 };
 884 
 885 oop* frame::interpreter_callee_receiver_addr(Symbol* signature) {
 886   ArgumentSizeComputer asc(signature);
 887   int size = asc.size();
 888   return (oop *)interpreter_frame_tos_at(size);
 889 }
 890 
 891 
 892 void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache) {
 893   assert(is_interpreted_frame(), "Not an interpreted frame");
 894   assert(map != NULL, "map must be set");


 899   assert(!Universe::heap()->is_in(m()),
 900           "must be valid oop");
 901   assert(m->is_method(), "checking frame value");
 902   assert((m->is_native() && bci == 0)  ||
 903          (!m->is_native() && bci >= 0 && bci < m->code_size()),
 904          "invalid bci value");
 905 
 906   // Handle the monitor elements in the activation
 907   for (
 908     BasicObjectLock* current = interpreter_frame_monitor_end();
 909     current < interpreter_frame_monitor_begin();
 910     current = next_monitor_in_interpreter_frame(current)
 911   ) {
 912 #ifdef ASSERT
 913     interpreter_frame_verify_monitor(current);
 914 #endif
 915     current->oops_do(f);
 916   }
 917 
 918   if (m->is_native()) {

 919     f->do_oop(interpreter_frame_temp_oop_addr());
 920   }
 921 
 922   // The method pointer in the frame might be the only path to the method's
 923   // klass, and the klass needs to be kept alive while executing. The GCs
 924   // don't trace through method pointers, so the mirror of the method's klass
 925   // is installed as a GC root.
 926   f->do_oop(interpreter_frame_mirror_addr());
 927 
 928   int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals();
 929 
 930   Symbol* signature = NULL;
 931   bool has_receiver = false;
 932 
 933   // Process a callee's arguments if we are at a call site
 934   // (i.e., if we are at an invoke bytecode)
 935   // This is used sometimes for calling into the VM, not for another
 936   // interpreted or compiled frame.
 937   if (!m->is_native()) {
 938     Bytecode_invoke call = Bytecode_invoke_check(m, bci);


1005   }
1006   // In cases where perm gen is collected, GC will want to mark
1007   // oops referenced from nmethods active on thread stacks so as to
1008   // prevent them from being collected. However, this visit should be
1009   // restricted to certain phases of the collection only. The
1010   // closure decides how it wants nmethods to be traced.
1011   if (cf != NULL)
1012     cf->do_code_blob(_cb);
1013 }
1014 
1015 class CompiledArgumentOopFinder: public SignatureInfo {
1016  protected:
1017   OopClosure*     _f;
1018   int             _offset;        // the current offset, incremented with each argument
1019   bool            _has_receiver;  // true if the callee has a receiver
1020   bool            _has_appendix;  // true if the call has an appendix
1021   frame           _fr;
1022   RegisterMap*    _reg_map;
1023   int             _arg_size;
1024   VMRegPair*      _regs;        // VMReg list of arguments









1025 
1026   void set(int size, BasicType type) {
1027     if (type == T_OBJECT || type == T_ARRAY || type == T_VALUETYPE) handle_oop_offset();
1028     _offset += size;
1029   }
1030 
1031   virtual void handle_oop_offset() {
1032     // Extract low order register number from register array.
1033     // In LP64-land, the high-order bits are valid but unhelpful.
1034     assert(_offset < _arg_size, "out of bounds");
1035     VMReg reg = _regs[_offset].first();
1036     oop *loc = _fr.oopmapreg_to_location(reg, _reg_map);

1037     _f->do_oop(loc);





1038   }
1039 
1040  public:
1041   CompiledArgumentOopFinder(Symbol* signature, bool has_receiver, bool has_appendix, OopClosure* f, frame fr, const RegisterMap* reg_map)
1042     : SignatureInfo(signature) {
1043 
1044     // initialize CompiledArgumentOopFinder
1045     _f         = f;
1046     _offset    = 0;
1047     _has_receiver = has_receiver;
1048     _has_appendix = has_appendix;
1049     _fr        = fr;
1050     _reg_map   = (RegisterMap*)reg_map;
1051     _regs = SharedRuntime::find_callee_arguments(signature, has_receiver, has_appendix, &_arg_size);

1052   }
1053 
1054   void oops_do() {
1055     if (_has_receiver) {
1056       handle_oop_offset();
1057       _offset++;
1058     }
1059     iterate_parameters();
1060     if (_has_appendix) {
1061       handle_oop_offset();
1062       _offset++;
1063     }
1064   }
1065 };
1066 
1067 void frame::oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix,
1068                                        const RegisterMap* reg_map, OopClosure* f) {
1069   ResourceMark rm;
1070   CompiledArgumentOopFinder finder(signature, has_receiver, has_appendix, f, *this, reg_map);
1071   finder.oops_do();


< prev index next >