Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/frame.cpp @ 6948:e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 12 Nov 2012 23:14:12 +0100 |
parents | 957c266d8bc5 da91efe96a93 |
children | 291ffc492eb6 |
comparison
equal
deleted
inserted
replaced
6711:ae13cc658b80 | 6948:e522a00b91aa |
---|---|
27 #include "interpreter/interpreter.hpp" | 27 #include "interpreter/interpreter.hpp" |
28 #include "interpreter/oopMapCache.hpp" | 28 #include "interpreter/oopMapCache.hpp" |
29 #include "memory/resourceArea.hpp" | 29 #include "memory/resourceArea.hpp" |
30 #include "memory/universe.inline.hpp" | 30 #include "memory/universe.inline.hpp" |
31 #include "oops/markOop.hpp" | 31 #include "oops/markOop.hpp" |
32 #include "oops/methodDataOop.hpp" | 32 #include "oops/methodData.hpp" |
33 #include "oops/methodOop.hpp" | 33 #include "oops/method.hpp" |
34 #include "oops/oop.inline.hpp" | 34 #include "oops/oop.inline.hpp" |
35 #include "oops/oop.inline2.hpp" | 35 #include "oops/oop.inline2.hpp" |
36 #include "prims/methodHandles.hpp" | 36 #include "prims/methodHandles.hpp" |
37 #include "runtime/frame.inline.hpp" | 37 #include "runtime/frame.inline.hpp" |
38 #include "runtime/handles.inline.hpp" | 38 #include "runtime/handles.inline.hpp" |
381 void frame::interpreter_frame_set_locals(intptr_t* locs) { | 381 void frame::interpreter_frame_set_locals(intptr_t* locs) { |
382 assert(is_interpreted_frame(), "Not an interpreted frame"); | 382 assert(is_interpreted_frame(), "Not an interpreted frame"); |
383 *interpreter_frame_locals_addr() = locs; | 383 *interpreter_frame_locals_addr() = locs; |
384 } | 384 } |
385 | 385 |
386 methodOop frame::interpreter_frame_method() const { | 386 Method* frame::interpreter_frame_method() const { |
387 assert(is_interpreted_frame(), "interpreted frame expected"); | 387 assert(is_interpreted_frame(), "interpreted frame expected"); |
388 methodOop m = *interpreter_frame_method_addr(); | 388 Method* m = *interpreter_frame_method_addr(); |
389 assert(m->is_perm(), "bad methodOop in interpreter frame"); | 389 assert(m->is_metadata(), "bad Method* in interpreter frame"); |
390 assert(m->is_method(), "not a methodOop"); | 390 assert(m->is_method(), "not a Method*"); |
391 return m; | 391 return m; |
392 } | 392 } |
393 | 393 |
394 void frame::interpreter_frame_set_method(methodOop method) { | 394 void frame::interpreter_frame_set_method(Method* method) { |
395 assert(is_interpreted_frame(), "interpreted frame expected"); | 395 assert(is_interpreted_frame(), "interpreted frame expected"); |
396 *interpreter_frame_method_addr() = method; | 396 *interpreter_frame_method_addr() = method; |
397 } | 397 } |
398 | 398 |
399 void frame::interpreter_frame_set_bcx(intptr_t bcx) { | 399 void frame::interpreter_frame_set_bcx(intptr_t bcx) { |
408 if (mdx != 0) { | 408 if (mdx != 0) { |
409 if (formerly_bci) { | 409 if (formerly_bci) { |
410 if (!is_now_bci) { | 410 if (!is_now_bci) { |
411 // The bcx was just converted from bci to bcp. | 411 // The bcx was just converted from bci to bcp. |
412 // Convert the mdx in parallel. | 412 // Convert the mdx in parallel. |
413 methodDataOop mdo = interpreter_frame_method()->method_data(); | 413 MethodData* mdo = interpreter_frame_method()->method_data(); |
414 assert(mdo != NULL, ""); | 414 assert(mdo != NULL, ""); |
415 int mdi = mdx - 1; // We distinguish valid mdi from zero by adding one. | 415 int mdi = mdx - 1; // We distinguish valid mdi from zero by adding one. |
416 address mdp = mdo->di_to_dp(mdi); | 416 address mdp = mdo->di_to_dp(mdi); |
417 interpreter_frame_set_mdx((intptr_t)mdp); | 417 interpreter_frame_set_mdx((intptr_t)mdp); |
418 } | 418 } |
419 } else { | 419 } else { |
420 if (is_now_bci) { | 420 if (is_now_bci) { |
421 // The bcx was just converted from bcp to bci. | 421 // The bcx was just converted from bcp to bci. |
422 // Convert the mdx in parallel. | 422 // Convert the mdx in parallel. |
423 methodDataOop mdo = interpreter_frame_method()->method_data(); | 423 MethodData* mdo = interpreter_frame_method()->method_data(); |
424 assert(mdo != NULL, ""); | 424 assert(mdo != NULL, ""); |
425 int mdi = mdo->dp_to_di((address)mdx); | 425 int mdi = mdo->dp_to_di((address)mdx); |
426 interpreter_frame_set_mdx((intptr_t)mdi + 1); // distinguish valid from 0. | 426 interpreter_frame_set_mdx((intptr_t)mdi + 1); // distinguish valid from 0. |
427 } | 427 } |
428 } | 428 } |
710 // suggests the problem is in user lib; everything else is likely a VM bug. | 710 // suggests the problem is in user lib; everything else is likely a VM bug. |
711 | 711 |
712 void frame::print_on_error(outputStream* st, char* buf, int buflen, bool verbose) const { | 712 void frame::print_on_error(outputStream* st, char* buf, int buflen, bool verbose) const { |
713 if (_cb != NULL) { | 713 if (_cb != NULL) { |
714 if (Interpreter::contains(pc())) { | 714 if (Interpreter::contains(pc())) { |
715 methodOop m = this->interpreter_frame_method(); | 715 Method* m = this->interpreter_frame_method(); |
716 if (m != NULL) { | 716 if (m != NULL) { |
717 m->name_and_sig_as_C_string(buf, buflen); | 717 m->name_and_sig_as_C_string(buf, buflen); |
718 st->print("j %s", buf); | 718 st->print("j %s", buf); |
719 st->print("+%d", this->interpreter_frame_bci()); | 719 st->print("+%d", this->interpreter_frame_bci()); |
720 } else { | 720 } else { |
728 st->print("v ~StubRoutines::" PTR_FORMAT, pc()); | 728 st->print("v ~StubRoutines::" PTR_FORMAT, pc()); |
729 } | 729 } |
730 } else if (_cb->is_buffer_blob()) { | 730 } else if (_cb->is_buffer_blob()) { |
731 st->print("v ~BufferBlob::%s", ((BufferBlob *)_cb)->name()); | 731 st->print("v ~BufferBlob::%s", ((BufferBlob *)_cb)->name()); |
732 } else if (_cb->is_nmethod()) { | 732 } else if (_cb->is_nmethod()) { |
733 methodOop m = ((nmethod *)_cb)->method(); | 733 Method* m = ((nmethod *)_cb)->method(); |
734 if (m != NULL) { | 734 if (m != NULL) { |
735 address code = _cb->code_begin(); | 735 address code = _cb->code_begin(); |
736 m->name_and_sig_as_C_string(buf, buflen); | 736 m->name_and_sig_as_C_string(buf, buflen); |
737 st->print("J %s [" PTR_FORMAT "+%d]", buf, code, pc() - code); | 737 st->print("J %s [" PTR_FORMAT "+%d]", buf, code, pc() - code); |
738 } else { | 738 } else { |
756 | 756 |
757 | 757 |
758 /* | 758 /* |
759 The interpreter_frame_expression_stack_at method in the case of SPARC needs the | 759 The interpreter_frame_expression_stack_at method in the case of SPARC needs the |
760 max_stack value of the method in order to compute the expression stack address. | 760 max_stack value of the method in order to compute the expression stack address. |
761 It uses the methodOop in order to get the max_stack value but during GC this | 761 It uses the Method* in order to get the max_stack value but during GC this |
762 methodOop value saved on the frame is changed by reverse_and_push and hence cannot | 762 Method* value saved on the frame is changed by reverse_and_push and hence cannot |
763 be used. So we save the max_stack value in the FrameClosure object and pass it | 763 be used. So we save the max_stack value in the FrameClosure object and pass it |
764 down to the interpreter_frame_expression_stack_at method | 764 down to the interpreter_frame_expression_stack_at method |
765 */ | 765 */ |
766 class InterpreterFrameClosure : public OffsetClosure { | 766 class InterpreterFrameClosure : public OffsetClosure { |
767 private: | 767 private: |
906 assert(map != NULL, "map must be set"); | 906 assert(map != NULL, "map must be set"); |
907 Thread *thread = Thread::current(); | 907 Thread *thread = Thread::current(); |
908 methodHandle m (thread, interpreter_frame_method()); | 908 methodHandle m (thread, interpreter_frame_method()); |
909 jint bci = interpreter_frame_bci(); | 909 jint bci = interpreter_frame_bci(); |
910 | 910 |
911 assert(Universe::heap()->is_in(m()), "must be valid oop"); | 911 assert(!Universe::heap()->is_in(m()), |
912 "must be valid oop"); | |
912 assert(m->is_method(), "checking frame value"); | 913 assert(m->is_method(), "checking frame value"); |
913 assert((m->is_native() && bci == 0) || (!m->is_native() && bci >= 0 && bci < m->code_size()), "invalid bci value"); | 914 assert((m->is_native() && bci == 0) || |
915 (!m->is_native() && bci >= 0 && bci < m->code_size()), | |
916 "invalid bci value"); | |
914 | 917 |
915 // Handle the monitor elements in the activation | 918 // Handle the monitor elements in the activation |
916 for ( | 919 for ( |
917 BasicObjectLock* current = interpreter_frame_monitor_end(); | 920 BasicObjectLock* current = interpreter_frame_monitor_end(); |
918 current < interpreter_frame_monitor_begin(); | 921 current < interpreter_frame_monitor_begin(); |
923 #endif | 926 #endif |
924 current->oops_do(f); | 927 current->oops_do(f); |
925 } | 928 } |
926 | 929 |
927 // process fixed part | 930 // process fixed part |
928 f->do_oop((oop*)interpreter_frame_method_addr()); | |
929 f->do_oop((oop*)interpreter_frame_cache_addr()); | |
930 | |
931 // Hmm what about the mdp? | |
932 #ifdef CC_INTERP | |
933 // Interpreter frame in the midst of a call have a methodOop within the | |
934 // object. | |
935 interpreterState istate = get_interpreterState(); | |
936 if (istate->msg() == BytecodeInterpreter::call_method) { | |
937 f->do_oop((oop*)&istate->_result._to_call._callee); | |
938 } | |
939 | |
940 #endif /* CC_INTERP */ | |
941 | |
942 #if !defined(PPC) || defined(ZERO) | 931 #if !defined(PPC) || defined(ZERO) |
943 if (m->is_native()) { | 932 if (m->is_native()) { |
944 #ifdef CC_INTERP | 933 #ifdef CC_INTERP |
934 interpreterState istate = get_interpreterState(); | |
945 f->do_oop((oop*)&istate->_oop_temp); | 935 f->do_oop((oop*)&istate->_oop_temp); |
946 #else | 936 #else |
947 f->do_oop((oop*)( fp() + interpreter_frame_oop_temp_offset )); | 937 f->do_oop((oop*)( fp() + interpreter_frame_oop_temp_offset )); |
948 #endif /* CC_INTERP */ | 938 #endif /* CC_INTERP */ |
949 } | 939 } |
1168 cf->do_code_blob(_cb); | 1158 cf->do_code_blob(_cb); |
1169 } | 1159 } |
1170 } | 1160 } |
1171 | 1161 |
1172 | 1162 |
1163 // call f() on the interpreted Method*s in the stack. | |
1164 // Have to walk the entire code cache for the compiled frames Yuck. | |
1165 void frame::metadata_do(void f(Metadata*)) { | |
1166 if (_cb != NULL && Interpreter::contains(pc())) { | |
1167 Method* m = this->interpreter_frame_method(); | |
1168 assert(m != NULL, "huh?"); | |
1169 f(m); | |
1170 } | |
1171 } | |
1172 | |
1173 void frame::gc_prologue() { | 1173 void frame::gc_prologue() { |
1174 if (is_interpreted_frame()) { | 1174 if (is_interpreted_frame()) { |
1175 // set bcx to bci to become methodOop position independent during GC | 1175 // set bcx to bci to become Method* position independent during GC |
1176 interpreter_frame_set_bcx(interpreter_frame_bci()); | 1176 interpreter_frame_set_bcx(interpreter_frame_bci()); |
1177 } | 1177 } |
1178 } | 1178 } |
1179 | 1179 |
1180 | 1180 |
1245 | 1245 |
1246 | 1246 |
1247 void frame::zap_dead_interpreted_locals(JavaThread *thread, const RegisterMap* map) { | 1247 void frame::zap_dead_interpreted_locals(JavaThread *thread, const RegisterMap* map) { |
1248 // get current interpreter 'pc' | 1248 // get current interpreter 'pc' |
1249 assert(is_interpreted_frame(), "Not an interpreted frame"); | 1249 assert(is_interpreted_frame(), "Not an interpreted frame"); |
1250 methodOop m = interpreter_frame_method(); | 1250 Method* m = interpreter_frame_method(); |
1251 int bci = interpreter_frame_bci(); | 1251 int bci = interpreter_frame_bci(); |
1252 | 1252 |
1253 int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals(); | 1253 int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals(); |
1254 | 1254 |
1255 // process dynamic part | 1255 // process dynamic part |
1289 # endif // ENABLE_ZAP_DEAD_LOCALS | 1289 # endif // ENABLE_ZAP_DEAD_LOCALS |
1290 | 1290 |
1291 void frame::verify(const RegisterMap* map) { | 1291 void frame::verify(const RegisterMap* map) { |
1292 // for now make sure receiver type is correct | 1292 // for now make sure receiver type is correct |
1293 if (is_interpreted_frame()) { | 1293 if (is_interpreted_frame()) { |
1294 methodOop method = interpreter_frame_method(); | 1294 Method* method = interpreter_frame_method(); |
1295 guarantee(method->is_method(), "method is wrong in frame::verify"); | 1295 guarantee(method->is_method(), "method is wrong in frame::verify"); |
1296 if (!method->is_static()) { | 1296 if (!method->is_static()) { |
1297 // fetch the receiver | 1297 // fetch the receiver |
1298 oop* p = (oop*) interpreter_frame_local_at(0); | 1298 oop* p = (oop*) interpreter_frame_local_at(0); |
1299 // make sure we have the right receiver type | 1299 // make sure we have the right receiver type |
1354 // Label values common to most frames | 1354 // Label values common to most frames |
1355 values.describe(-1, unextended_sp(), err_msg("unextended_sp for #%d", frame_no)); | 1355 values.describe(-1, unextended_sp(), err_msg("unextended_sp for #%d", frame_no)); |
1356 } | 1356 } |
1357 | 1357 |
1358 if (is_interpreted_frame()) { | 1358 if (is_interpreted_frame()) { |
1359 methodOop m = interpreter_frame_method(); | 1359 Method* m = interpreter_frame_method(); |
1360 int bci = interpreter_frame_bci(); | 1360 int bci = interpreter_frame_bci(); |
1361 | 1361 |
1362 // Label the method and current bci | 1362 // Label the method and current bci |
1363 values.describe(-1, info_address, | 1363 values.describe(-1, info_address, |
1364 FormatBuffer<1024>("#%d method %s @ %d", frame_no, m->name_and_sig_as_C_string(), bci), 2); | 1364 FormatBuffer<1024>("#%d method %s @ %d", frame_no, m->name_and_sig_as_C_string(), bci), 2); |