24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "interpreter/interpreter.hpp" |
26 #include "interpreter/interpreter.hpp" |
27 #include "memory/resourceArea.hpp" |
27 #include "memory/resourceArea.hpp" |
28 #include "oops/markOop.hpp" |
28 #include "oops/markOop.hpp" |
29 #include "oops/methodOop.hpp" |
29 #include "oops/method.hpp" |
30 #include "oops/oop.inline.hpp" |
30 #include "oops/oop.inline.hpp" |
31 #include "prims/methodHandles.hpp" |
31 #include "prims/methodHandles.hpp" |
32 #include "runtime/frame.inline.hpp" |
32 #include "runtime/frame.inline.hpp" |
33 #include "runtime/handles.inline.hpp" |
33 #include "runtime/handles.inline.hpp" |
34 #include "runtime/javaCalls.hpp" |
34 #include "runtime/javaCalls.hpp" |
492 } |
492 } |
493 |
493 |
494 |
494 |
495 bool frame::interpreter_frame_equals_unpacked_fp(intptr_t* fp) { |
495 bool frame::interpreter_frame_equals_unpacked_fp(intptr_t* fp) { |
496 assert(is_interpreted_frame(), "must be interpreter frame"); |
496 assert(is_interpreted_frame(), "must be interpreter frame"); |
497 methodOop method = interpreter_frame_method(); |
497 Method* method = interpreter_frame_method(); |
498 // When unpacking an optimized frame the frame pointer is |
498 // When unpacking an optimized frame the frame pointer is |
499 // adjusted with: |
499 // adjusted with: |
500 int diff = (method->max_locals() - method->size_of_parameters()) * |
500 int diff = (method->max_locals() - method->size_of_parameters()) * |
501 Interpreter::stackElementWords; |
501 Interpreter::stackElementWords; |
502 return _fp == (fp - diff); |
502 return _fp == (fp - diff); |
529 |
529 |
530 // do some validation of frame elements |
530 // do some validation of frame elements |
531 |
531 |
532 // first the method |
532 // first the method |
533 |
533 |
534 methodOop m = *interpreter_frame_method_addr(); |
534 Method* m = *interpreter_frame_method_addr(); |
535 |
535 |
536 // validate the method we'd find in this potential sender |
536 // validate the method we'd find in this potential sender |
537 if (!Universe::heap()->is_valid_method(m)) return false; |
537 if (!Universe::heap()->is_valid_method(m)) return false; |
538 |
538 |
539 // stack frames shouldn't be much larger than max_stack elements |
539 // stack frames shouldn't be much larger than max_stack elements |
547 intptr_t bcx = interpreter_frame_bcx(); |
547 intptr_t bcx = interpreter_frame_bcx(); |
548 if (m->validate_bci_from_bcx(bcx) < 0) { |
548 if (m->validate_bci_from_bcx(bcx) < 0) { |
549 return false; |
549 return false; |
550 } |
550 } |
551 |
551 |
552 // validate constantPoolCacheOop |
552 // validate ConstantPoolCache* |
553 |
553 ConstantPoolCache* cp = *interpreter_frame_cache_addr(); |
554 constantPoolCacheOop cp = *interpreter_frame_cache_addr(); |
554 if (cp == NULL || !cp->is_metadata()) return false; |
555 |
|
556 if (cp == NULL || |
|
557 !Space::is_aligned(cp) || |
|
558 !Universe::heap()->is_permanent((void*)cp)) return false; |
|
559 |
555 |
560 // validate locals |
556 // validate locals |
561 |
557 |
562 address locals = (address) *interpreter_frame_locals_addr(); |
558 address locals = (address) *interpreter_frame_locals_addr(); |
563 |
559 |
574 // Needed for JVMTI. The result should always be in the |
570 // Needed for JVMTI. The result should always be in the |
575 // interpreterState object |
571 // interpreterState object |
576 interpreterState istate = get_interpreterState(); |
572 interpreterState istate = get_interpreterState(); |
577 #endif // CC_INTERP |
573 #endif // CC_INTERP |
578 assert(is_interpreted_frame(), "interpreted frame expected"); |
574 assert(is_interpreted_frame(), "interpreted frame expected"); |
579 methodOop method = interpreter_frame_method(); |
575 Method* method = interpreter_frame_method(); |
580 BasicType type = method->result_type(); |
576 BasicType type = method->result_type(); |
581 |
577 |
582 intptr_t* tos_addr; |
578 intptr_t* tos_addr; |
583 if (method->is_native()) { |
579 if (method->is_native()) { |
584 // Prior to calling into the runtime to report the method_exit the possible |
580 // Prior to calling into the runtime to report the method_exit the possible |