Mercurial > hg > graal-jvmci-8
comparison src/share/vm/prims/jvmtiImpl.cpp @ 2044:06f017f7daa7
Merge.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Fri, 07 Jan 2011 18:18:08 +0100 |
parents | 09b4dd4f152b |
children | 7246a374a9f2 |
comparison
equal
deleted
inserted
replaced
1942:00bc9eaf0e24 | 2044:06f017f7daa7 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 # include "incls/_precompiled.incl" | 25 #include "precompiled.hpp" |
26 # include "incls/_jvmtiImpl.cpp.incl" | 26 #include "classfile/systemDictionary.hpp" |
27 #include "interpreter/interpreter.hpp" | |
28 #include "jvmtifiles/jvmtiEnv.hpp" | |
29 #include "memory/resourceArea.hpp" | |
30 #include "oops/instanceKlass.hpp" | |
31 #include "prims/jvmtiAgentThread.hpp" | |
32 #include "prims/jvmtiEventController.inline.hpp" | |
33 #include "prims/jvmtiImpl.hpp" | |
34 #include "prims/jvmtiRedefineClasses.hpp" | |
35 #include "runtime/deoptimization.hpp" | |
36 #include "runtime/handles.hpp" | |
37 #include "runtime/handles.inline.hpp" | |
38 #include "runtime/interfaceSupport.hpp" | |
39 #include "runtime/javaCalls.hpp" | |
40 #include "runtime/signature.hpp" | |
41 #include "runtime/vframe.hpp" | |
42 #include "runtime/vframe_hp.hpp" | |
43 #include "runtime/vm_operations.hpp" | |
44 #include "utilities/exceptions.hpp" | |
45 #ifdef TARGET_OS_FAMILY_linux | |
46 # include "thread_linux.inline.hpp" | |
47 #endif | |
48 #ifdef TARGET_OS_FAMILY_solaris | |
49 # include "thread_solaris.inline.hpp" | |
50 #endif | |
51 #ifdef TARGET_OS_FAMILY_windows | |
52 # include "thread_windows.inline.hpp" | |
53 #endif | |
27 | 54 |
28 // | 55 // |
29 // class JvmtiAgentThread | 56 // class JvmtiAgentThread |
30 // | 57 // |
31 // JavaThread used to wrap a thread started by an agent | 58 // JavaThread used to wrap a thread started by an agent |
557 , _jvf(NULL) | 584 , _jvf(NULL) |
558 , _result(JVMTI_ERROR_NONE) | 585 , _result(JVMTI_ERROR_NONE) |
559 { | 586 { |
560 } | 587 } |
561 | 588 |
562 | |
563 vframe *VM_GetOrSetLocal::get_vframe() { | 589 vframe *VM_GetOrSetLocal::get_vframe() { |
564 if (!_thread->has_last_Java_frame()) { | 590 if (!_thread->has_last_Java_frame()) { |
565 return NULL; | 591 return NULL; |
566 } | 592 } |
567 RegisterMap reg_map(_thread); | 593 RegisterMap reg_map(_thread); |
580 _result = JVMTI_ERROR_NO_MORE_FRAMES; | 606 _result = JVMTI_ERROR_NO_MORE_FRAMES; |
581 return NULL; | 607 return NULL; |
582 } | 608 } |
583 javaVFrame *jvf = (javaVFrame*)vf; | 609 javaVFrame *jvf = (javaVFrame*)vf; |
584 | 610 |
585 if (!vf->is_java_frame() || jvf->method()->is_native()) { | 611 if (!vf->is_java_frame()) { |
586 _result = JVMTI_ERROR_OPAQUE_FRAME; | 612 _result = JVMTI_ERROR_OPAQUE_FRAME; |
587 return NULL; | 613 return NULL; |
588 } | 614 } |
589 return jvf; | 615 return jvf; |
590 } | 616 } |
711 | 737 |
712 bool VM_GetOrSetLocal::doit_prologue() { | 738 bool VM_GetOrSetLocal::doit_prologue() { |
713 _jvf = get_java_vframe(); | 739 _jvf = get_java_vframe(); |
714 NULL_CHECK(_jvf, false); | 740 NULL_CHECK(_jvf, false); |
715 | 741 |
742 if (_jvf->method()->is_native()) { | |
743 if (getting_receiver() && !_jvf->method()->is_static()) { | |
744 return true; | |
745 } else { | |
746 _result = JVMTI_ERROR_OPAQUE_FRAME; | |
747 return false; | |
748 } | |
749 } | |
750 | |
716 if (!check_slot_type(_jvf)) { | 751 if (!check_slot_type(_jvf)) { |
717 return false; | 752 return false; |
718 } | 753 } |
719 return true; | 754 return true; |
720 } | 755 } |
752 } | 787 } |
753 StackValueCollection *locals = _jvf->locals(); | 788 StackValueCollection *locals = _jvf->locals(); |
754 HandleMark hm; | 789 HandleMark hm; |
755 | 790 |
756 switch (_type) { | 791 switch (_type) { |
757 case T_INT: locals->set_int_at (_index, _value.i); break; | 792 case T_INT: locals->set_int_at (_index, _value.i); break; |
758 case T_LONG: locals->set_long_at (_index, _value.j); break; | 793 case T_LONG: locals->set_long_at (_index, _value.j); break; |
759 case T_FLOAT: locals->set_float_at (_index, _value.f); break; | 794 case T_FLOAT: locals->set_float_at (_index, _value.f); break; |
760 case T_DOUBLE: locals->set_double_at(_index, _value.d); break; | 795 case T_DOUBLE: locals->set_double_at(_index, _value.d); break; |
761 case T_OBJECT: { | 796 case T_OBJECT: { |
762 Handle ob_h(JNIHandles::resolve_external_guard(_value.l)); | 797 Handle ob_h(JNIHandles::resolve_external_guard(_value.l)); |
763 locals->set_obj_at (_index, ob_h); | 798 locals->set_obj_at (_index, ob_h); |
764 break; | 799 break; |
765 } | 800 } |
766 default: ShouldNotReachHere(); | 801 default: ShouldNotReachHere(); |
767 } | 802 } |
768 _jvf->set_locals(locals); | 803 _jvf->set_locals(locals); |
769 } else { | 804 } else { |
770 StackValueCollection *locals = _jvf->locals(); | 805 if (_jvf->method()->is_native() && _jvf->is_compiled_frame()) { |
771 | 806 assert(getting_receiver(), "Can only get here when getting receiver"); |
772 if (locals->at(_index)->type() == T_CONFLICT) { | 807 oop receiver = _jvf->fr().get_native_receiver(); |
773 memset(&_value, 0, sizeof(_value)); | 808 _value.l = JNIHandles::make_local(_calling_thread, receiver); |
774 _value.l = NULL; | 809 } else { |
775 return; | 810 StackValueCollection *locals = _jvf->locals(); |
776 } | 811 |
777 | 812 if (locals->at(_index)->type() == T_CONFLICT) { |
778 switch (_type) { | 813 memset(&_value, 0, sizeof(_value)); |
779 case T_INT: _value.i = locals->int_at (_index); break; | 814 _value.l = NULL; |
780 case T_LONG: _value.j = locals->long_at (_index); break; | 815 return; |
781 case T_FLOAT: _value.f = locals->float_at (_index); break; | 816 } |
782 case T_DOUBLE: _value.d = locals->double_at(_index); break; | 817 |
783 case T_OBJECT: { | 818 switch (_type) { |
784 // Wrap the oop to be returned in a local JNI handle since | 819 case T_INT: _value.i = locals->int_at (_index); break; |
785 // oops_do() no longer applies after doit() is finished. | 820 case T_LONG: _value.j = locals->long_at (_index); break; |
786 oop obj = locals->obj_at(_index)(); | 821 case T_FLOAT: _value.f = locals->float_at (_index); break; |
787 _value.l = JNIHandles::make_local(_calling_thread, obj); | 822 case T_DOUBLE: _value.d = locals->double_at(_index); break; |
788 break; | 823 case T_OBJECT: { |
789 } | 824 // Wrap the oop to be returned in a local JNI handle since |
790 default: ShouldNotReachHere(); | 825 // oops_do() no longer applies after doit() is finished. |
826 oop obj = locals->obj_at(_index)(); | |
827 _value.l = JNIHandles::make_local(_calling_thread, obj); | |
828 break; | |
829 } | |
830 default: ShouldNotReachHere(); | |
831 } | |
791 } | 832 } |
792 } | 833 } |
793 } | 834 } |
794 | 835 |
795 | 836 |
796 bool VM_GetOrSetLocal::allow_nested_vm_operations() const { | 837 bool VM_GetOrSetLocal::allow_nested_vm_operations() const { |
797 return true; // May need to deoptimize | 838 return true; // May need to deoptimize |
798 } | 839 } |
799 | 840 |
841 | |
842 VM_GetReceiver::VM_GetReceiver( | |
843 JavaThread* thread, JavaThread* caller_thread, jint depth) | |
844 : VM_GetOrSetLocal(thread, caller_thread, depth, 0) {} | |
800 | 845 |
801 ///////////////////////////////////////////////////////////////////////////////////////// | 846 ///////////////////////////////////////////////////////////////////////////////////////// |
802 | 847 |
803 // | 848 // |
804 // class JvmtiSuspendControl - see comments in jvmtiImpl.hpp | 849 // class JvmtiSuspendControl - see comments in jvmtiImpl.hpp |