jvmtiImpl.cpp (1879:f95d63e2154a) jvmtiImpl.cpp (1926:09b4dd4f152b)
1/*
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.
4 *
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
7 * published by the Free Software Foundation.
8 *

--- 572 unchanged lines hidden (view full) ---

581 , _index(index)
582 , _type(T_OBJECT)
583 , _set(false)
584 , _jvf(NULL)
585 , _result(JVMTI_ERROR_NONE)
586{
587}
588
1/*
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.
4 *
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
7 * published by the Free Software Foundation.
8 *

--- 572 unchanged lines hidden (view full) ---

581 , _index(index)
582 , _type(T_OBJECT)
583 , _set(false)
584 , _jvf(NULL)
585 , _result(JVMTI_ERROR_NONE)
586{
587}
588
589
590vframe *VM_GetOrSetLocal::get_vframe() {
591 if (!_thread->has_last_Java_frame()) {
592 return NULL;
593 }
594 RegisterMap reg_map(_thread);
595 vframe *vf = _thread->last_java_vframe(&reg_map);
596 int d = 0;
597 while ((vf != NULL) && (d < _depth)) {

--- 6 unchanged lines hidden (view full) ---

604javaVFrame *VM_GetOrSetLocal::get_java_vframe() {
605 vframe* vf = get_vframe();
606 if (vf == NULL) {
607 _result = JVMTI_ERROR_NO_MORE_FRAMES;
608 return NULL;
609 }
610 javaVFrame *jvf = (javaVFrame*)vf;
611
589vframe *VM_GetOrSetLocal::get_vframe() {
590 if (!_thread->has_last_Java_frame()) {
591 return NULL;
592 }
593 RegisterMap reg_map(_thread);
594 vframe *vf = _thread->last_java_vframe(&reg_map);
595 int d = 0;
596 while ((vf != NULL) && (d < _depth)) {

--- 6 unchanged lines hidden (view full) ---

603javaVFrame *VM_GetOrSetLocal::get_java_vframe() {
604 vframe* vf = get_vframe();
605 if (vf == NULL) {
606 _result = JVMTI_ERROR_NO_MORE_FRAMES;
607 return NULL;
608 }
609 javaVFrame *jvf = (javaVFrame*)vf;
610
612 if (!vf->is_java_frame() || jvf->method()->is_native()) {
611 if (!vf->is_java_frame()) {
613 _result = JVMTI_ERROR_OPAQUE_FRAME;
614 return NULL;
615 }
616 return jvf;
617}
618
619// Check that the klass is assignable to a type with the given signature.
620// Another solution could be to use the function Klass::is_subtype_of(type).

--- 114 unchanged lines hidden (view full) ---

735static bool can_be_deoptimized(vframe* vf) {
736 return (vf->is_compiled_frame() && vf->fr().can_be_deoptimized());
737}
738
739bool VM_GetOrSetLocal::doit_prologue() {
740 _jvf = get_java_vframe();
741 NULL_CHECK(_jvf, false);
742
612 _result = JVMTI_ERROR_OPAQUE_FRAME;
613 return NULL;
614 }
615 return jvf;
616}
617
618// Check that the klass is assignable to a type with the given signature.
619// Another solution could be to use the function Klass::is_subtype_of(type).

--- 114 unchanged lines hidden (view full) ---

734static bool can_be_deoptimized(vframe* vf) {
735 return (vf->is_compiled_frame() && vf->fr().can_be_deoptimized());
736}
737
738bool VM_GetOrSetLocal::doit_prologue() {
739 _jvf = get_java_vframe();
740 NULL_CHECK(_jvf, false);
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
743 if (!check_slot_type(_jvf)) {
744 return false;
745 }
746 return true;
747}
748
749void VM_GetOrSetLocal::doit() {
750 if (_set) {

--- 25 unchanged lines hidden (view full) ---

776 _jvf = get_java_vframe();
777 ((compiledVFrame*)_jvf)->update_local(_type, _index, _value);
778 return;
779 }
780 StackValueCollection *locals = _jvf->locals();
781 HandleMark hm;
782
783 switch (_type) {
751 if (!check_slot_type(_jvf)) {
752 return false;
753 }
754 return true;
755}
756
757void VM_GetOrSetLocal::doit() {
758 if (_set) {

--- 25 unchanged lines hidden (view full) ---

784 _jvf = get_java_vframe();
785 ((compiledVFrame*)_jvf)->update_local(_type, _index, _value);
786 return;
787 }
788 StackValueCollection *locals = _jvf->locals();
789 HandleMark hm;
790
791 switch (_type) {
784 case T_INT: locals->set_int_at (_index, _value.i); break;
785 case T_LONG: locals->set_long_at (_index, _value.j); break;
786 case T_FLOAT: locals->set_float_at (_index, _value.f); break;
787 case T_DOUBLE: locals->set_double_at(_index, _value.d); break;
788 case T_OBJECT: {
789 Handle ob_h(JNIHandles::resolve_external_guard(_value.l));
790 locals->set_obj_at (_index, ob_h);
791 break;
792 case T_INT: locals->set_int_at (_index, _value.i); break;
793 case T_LONG: locals->set_long_at (_index, _value.j); break;
794 case T_FLOAT: locals->set_float_at (_index, _value.f); break;
795 case T_DOUBLE: locals->set_double_at(_index, _value.d); break;
796 case T_OBJECT: {
797 Handle ob_h(JNIHandles::resolve_external_guard(_value.l));
798 locals->set_obj_at (_index, ob_h);
799 break;
800 }
801 default: ShouldNotReachHere();
792 }
802 }
793 default: ShouldNotReachHere();
794 }
795 _jvf->set_locals(locals);
796 } else {
803 _jvf->set_locals(locals);
804 } else {
797 StackValueCollection *locals = _jvf->locals();
805 if (_jvf->method()->is_native() && _jvf->is_compiled_frame()) {
806 assert(getting_receiver(), "Can only get here when getting receiver");
807 oop receiver = _jvf->fr().get_native_receiver();
808 _value.l = JNIHandles::make_local(_calling_thread, receiver);
809 } else {
810 StackValueCollection *locals = _jvf->locals();
798
811
799 if (locals->at(_index)->type() == T_CONFLICT) {
800 memset(&_value, 0, sizeof(_value));
801 _value.l = NULL;
802 return;
803 }
812 if (locals->at(_index)->type() == T_CONFLICT) {
813 memset(&_value, 0, sizeof(_value));
814 _value.l = NULL;
815 return;
816 }
804
817
805 switch (_type) {
806 case T_INT: _value.i = locals->int_at (_index); break;
807 case T_LONG: _value.j = locals->long_at (_index); break;
808 case T_FLOAT: _value.f = locals->float_at (_index); break;
809 case T_DOUBLE: _value.d = locals->double_at(_index); break;
810 case T_OBJECT: {
811 // Wrap the oop to be returned in a local JNI handle since
812 // oops_do() no longer applies after doit() is finished.
813 oop obj = locals->obj_at(_index)();
814 _value.l = JNIHandles::make_local(_calling_thread, obj);
815 break;
818 switch (_type) {
819 case T_INT: _value.i = locals->int_at (_index); break;
820 case T_LONG: _value.j = locals->long_at (_index); break;
821 case T_FLOAT: _value.f = locals->float_at (_index); break;
822 case T_DOUBLE: _value.d = locals->double_at(_index); break;
823 case T_OBJECT: {
824 // Wrap the oop to be returned in a local JNI handle since
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 }
816 }
832 }
817 default: ShouldNotReachHere();
818 }
819 }
820}
821
822
823bool VM_GetOrSetLocal::allow_nested_vm_operations() const {
824 return true; // May need to deoptimize
825}
826
827
833 }
834}
835
836
837bool VM_GetOrSetLocal::allow_nested_vm_operations() const {
838 return true; // May need to deoptimize
839}
840
841
842VM_GetReceiver::VM_GetReceiver(
843 JavaThread* thread, JavaThread* caller_thread, jint depth)
844 : VM_GetOrSetLocal(thread, caller_thread, depth, 0) {}
845
828/////////////////////////////////////////////////////////////////////////////////////////
829
830//
831// class JvmtiSuspendControl - see comments in jvmtiImpl.hpp
832//
833
834bool JvmtiSuspendControl::suspend(JavaThread *java_thread) {
835 // external suspend should have caught suspending a thread twice

--- 61 unchanged lines hidden ---
846/////////////////////////////////////////////////////////////////////////////////////////
847
848//
849// class JvmtiSuspendControl - see comments in jvmtiImpl.hpp
850//
851
852bool JvmtiSuspendControl::suspend(JavaThread *java_thread) {
853 // external suspend should have caught suspending a thread twice

--- 61 unchanged lines hidden ---