1 /*
2 * Copyright 1999-2009 Sun Microsystems, Inc. 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 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
3680
3681 // Acquire method holder as java.lang.Class
3682 ciInstanceKlass* caller_klass = caller_jvms->method()->holder();
3683 ciInstance* caller_mirror = caller_klass->java_mirror();
3684 // Push this as a constant
3685 push(makecon(TypeInstPtr::make(caller_mirror)));
3686 #ifndef PRODUCT
3687 if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) {
3688 tty->print_cr(" Succeeded: caller = %s.%s, caller depth = %d, depth = %d", caller_klass->name()->as_utf8(), caller_jvms->method()->name()->as_utf8(), caller_depth_type->get_con(), _depth);
3689 tty->print_cr(" JVM state at this point:");
3690 for (int i = _depth; i >= 1; i--) {
3691 tty->print_cr(" %d) %s", i, jvms()->of_depth(i)->method()->name()->as_utf8());
3692 }
3693 }
3694 #endif
3695 return true;
3696 }
3697
3698 // Helper routine for above
3699 bool LibraryCallKit::is_method_invoke_or_aux_frame(JVMState* jvms) {
3700 // Is this the Method.invoke method itself?
3701 if (jvms->method()->intrinsic_id() == vmIntrinsics::_invoke)
3702 return true;
3703
3704 // Is this a helper, defined somewhere underneath MethodAccessorImpl.
3705 ciKlass* k = jvms->method()->holder();
3706 if (k->is_instance_klass()) {
3707 ciInstanceKlass* ik = k->as_instance_klass();
3708 for (; ik != NULL; ik = ik->super()) {
3709 if (ik->name() == ciSymbol::sun_reflect_MethodAccessorImpl() &&
3710 ik == env()->find_system_klass(ik->name())) {
3711 return true;
3712 }
3713 }
3714 }
3715
3716 return false;
3717 }
3718
3719 static int value_field_offset = -1; // offset of the "value" field of AtomicLongCSImpl. This is needed by
3720 // inline_native_AtomicLong_attemptUpdate() but it has no way of
3721 // computing it since there is no lookup field by name function in the
3722 // CI interface. This is computed and set by inline_native_AtomicLong_get().
3723 // Using a static variable here is safe even if we have multiple compilation
3724 // threads because the offset is constant. At worst the same offset will be
3725 // computed and stored multiple
3726
3727 bool LibraryCallKit::inline_native_AtomicLong_get() {
3728 // Restore the stack and pop off the argument
3729 _sp+=1;
3730 Node *obj = pop();
3731
3732 // get the offset of the "value" field. Since the CI interfaces
3733 // does not provide a way to look up a field by name, we scan the bytecodes
3734 // to get the field index. We expect the first 2 instructions of the method
|
1 /*
2 * Copyright 1999-2010 Sun Microsystems, Inc. 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 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
3680
3681 // Acquire method holder as java.lang.Class
3682 ciInstanceKlass* caller_klass = caller_jvms->method()->holder();
3683 ciInstance* caller_mirror = caller_klass->java_mirror();
3684 // Push this as a constant
3685 push(makecon(TypeInstPtr::make(caller_mirror)));
3686 #ifndef PRODUCT
3687 if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) {
3688 tty->print_cr(" Succeeded: caller = %s.%s, caller depth = %d, depth = %d", caller_klass->name()->as_utf8(), caller_jvms->method()->name()->as_utf8(), caller_depth_type->get_con(), _depth);
3689 tty->print_cr(" JVM state at this point:");
3690 for (int i = _depth; i >= 1; i--) {
3691 tty->print_cr(" %d) %s", i, jvms()->of_depth(i)->method()->name()->as_utf8());
3692 }
3693 }
3694 #endif
3695 return true;
3696 }
3697
3698 // Helper routine for above
3699 bool LibraryCallKit::is_method_invoke_or_aux_frame(JVMState* jvms) {
3700 ciMethod* method = jvms->method();
3701
3702 // Is this the Method.invoke method itself?
3703 if (method->intrinsic_id() == vmIntrinsics::_invoke)
3704 return true;
3705
3706 // Is this a helper, defined somewhere underneath MethodAccessorImpl.
3707 ciKlass* k = method->holder();
3708 if (k->is_instance_klass()) {
3709 ciInstanceKlass* ik = k->as_instance_klass();
3710 for (; ik != NULL; ik = ik->super()) {
3711 if (ik->name() == ciSymbol::sun_reflect_MethodAccessorImpl() &&
3712 ik == env()->find_system_klass(ik->name())) {
3713 return true;
3714 }
3715 }
3716 }
3717 else if (method->is_method_handle_adapter()) {
3718 // This is an internal adapter frame from the MethodHandleCompiler -- skip it
3719 return true;
3720 }
3721
3722 return false;
3723 }
3724
3725 static int value_field_offset = -1; // offset of the "value" field of AtomicLongCSImpl. This is needed by
3726 // inline_native_AtomicLong_attemptUpdate() but it has no way of
3727 // computing it since there is no lookup field by name function in the
3728 // CI interface. This is computed and set by inline_native_AtomicLong_get().
3729 // Using a static variable here is safe even if we have multiple compilation
3730 // threads because the offset is constant. At worst the same offset will be
3731 // computed and stored multiple
3732
3733 bool LibraryCallKit::inline_native_AtomicLong_get() {
3734 // Restore the stack and pop off the argument
3735 _sp+=1;
3736 Node *obj = pop();
3737
3738 // get the offset of the "value" field. Since the CI interfaces
3739 // does not provide a way to look up a field by name, we scan the bytecodes
3740 // to get the field index. We expect the first 2 instructions of the method
|