# HG changeset patch # User coleenp # Date 1311432140 14400 # Node ID 8107273fd204ec4d7e3cdee561b1594360e66078 # Parent 0cc8a70952c368e06de2adab1f2649a408f5e577# Parent 0b80db433fcb515cea86c57ef61d958d1631eeca Merge diff -r 0b80db433fcb -r 8107273fd204 .hgtags --- a/.hgtags Fri Jul 22 00:29:01 2011 -0700 +++ b/.hgtags Sat Jul 23 10:42:20 2011 -0400 @@ -172,3 +172,5 @@ 3aea9e9feb073f5500e031be6186666bcae89aa2 hs21-b11 9ad1548c6b63d596c411afc35147ffd5254426d9 jdk7-b142 9ad1548c6b63d596c411afc35147ffd5254426d9 hs21-b12 +c149193c768b8b7233da4c3a3fdc0756b975848e hs21-b13 +c149193c768b8b7233da4c3a3fdc0756b975848e jdk7-b143 diff -r 0b80db433fcb -r 8107273fd204 .jcheck/conf --- a/.jcheck/conf Fri Jul 22 00:29:01 2011 -0700 +++ b/.jcheck/conf Sat Jul 23 10:42:20 2011 -0400 @@ -1,1 +1,1 @@ -project=jdk7 +project=jdk8 diff -r 0b80db433fcb -r 8107273fd204 make/hotspot_version --- a/make/hotspot_version Fri Jul 22 00:29:01 2011 -0700 +++ b/make/hotspot_version Sat Jul 23 10:42:20 2011 -0400 @@ -38,8 +38,8 @@ HS_BUILD_NUMBER=01 JDK_MAJOR_VER=1 -JDK_MINOR_VER=7 +JDK_MINOR_VER=8 JDK_MICRO_VER=0 # Previous (bootdir) JDK version -JDK_PREVIOUS_VERSION=1.6.0 +JDK_PREVIOUS_VERSION=1.7.0 diff -r 0b80db433fcb -r 8107273fd204 make/jprt.properties --- a/make/jprt.properties Fri Jul 22 00:29:01 2011 -0700 +++ b/make/jprt.properties Sat Jul 23 10:42:20 2011 -0400 @@ -50,7 +50,7 @@ # sparc etc. # Define the Solaris platforms we want for the various releases - +jprt.my.solaris.sparc.jdk8=solaris_sparc_5.10 jprt.my.solaris.sparc.jdk7=solaris_sparc_5.10 jprt.my.solaris.sparc.jdk7b107=solaris_sparc_5.10 jprt.my.solaris.sparc.jdk7temp=solaris_sparc_5.10 @@ -64,6 +64,7 @@ jprt.my.solaris.sparc.ejdk6=${jprt.my.solaris.sparc.jdk6} jprt.my.solaris.sparc=${jprt.my.solaris.sparc.${jprt.tools.default.release}} +jprt.my.solaris.sparcv9.jdk8=solaris_sparcv9_5.10 jprt.my.solaris.sparcv9.jdk7=solaris_sparcv9_5.10 jprt.my.solaris.sparcv9.jdk7b107=solaris_sparcv9_5.10 jprt.my.solaris.sparcv9.jdk7temp=solaris_sparcv9_5.10 @@ -77,6 +78,7 @@ jprt.my.solaris.sparcv9.ejdk6=${jprt.my.solaris.sparcv9.jdk6} jprt.my.solaris.sparcv9=${jprt.my.solaris.sparcv9.${jprt.tools.default.release}} +jprt.my.solaris.i586.jdk8=solaris_i586_5.10 jprt.my.solaris.i586.jdk7=solaris_i586_5.10 jprt.my.solaris.i586.jdk7b107=solaris_i586_5.10 jprt.my.solaris.i586.jdk7temp=solaris_i586_5.10 @@ -90,6 +92,7 @@ jprt.my.solaris.i586.ejdk6=${jprt.my.solaris.i586.jdk6} jprt.my.solaris.i586=${jprt.my.solaris.i586.${jprt.tools.default.release}} +jprt.my.solaris.x64.jdk8=solaris_x64_5.10 jprt.my.solaris.x64.jdk7=solaris_x64_5.10 jprt.my.solaris.x64.jdk7b107=solaris_x64_5.10 jprt.my.solaris.x64.jdk7temp=solaris_x64_5.10 @@ -103,6 +106,7 @@ jprt.my.solaris.x64.ejdk6=${jprt.my.solaris.x64.jdk6} jprt.my.solaris.x64=${jprt.my.solaris.x64.${jprt.tools.default.release}} +jprt.my.linux.i586.jdk8=linux_i586_2.6 jprt.my.linux.i586.jdk7=linux_i586_2.6 jprt.my.linux.i586.jdk7b107=linux_i586_2.6 jprt.my.linux.i586.jdk7temp=linux_i586_2.6 @@ -116,6 +120,7 @@ jprt.my.linux.i586.ejdk6=linux_i586_2.6 jprt.my.linux.i586=${jprt.my.linux.i586.${jprt.tools.default.release}} +jprt.my.linux.x64.jdk8=linux_x64_2.6 jprt.my.linux.x64.jdk7=linux_x64_2.6 jprt.my.linux.x64.jdk7b107=linux_x64_2.6 jprt.my.linux.x64.jdk7temp=linux_x64_2.6 @@ -129,6 +134,7 @@ jprt.my.linux.x64.ejdk6=${jprt.my.linux.x64.jdk6} jprt.my.linux.x64=${jprt.my.linux.x64.${jprt.tools.default.release}} +jprt.my.linux.ppc.jdk8=linux_ppc_2.6 jprt.my.linux.ppc.jdk7=linux_ppc_2.6 jprt.my.linux.ppc.jdk7b107=linux_ppc_2.6 jprt.my.linux.ppc.jdk7temp=linux_ppc_2.6 @@ -136,6 +142,7 @@ jprt.my.linux.ppc.ejdk7=linux_ppc_2.6 jprt.my.linux.ppc=${jprt.my.linux.ppc.${jprt.tools.default.release}} +jprt.my.linux.ppcv2.jdk8=linux_ppcv2_2.6 jprt.my.linux.ppcv2.jdk7=linux_ppcv2_2.6 jprt.my.linux.ppcv2.jdk7b107=linux_ppcv2_2.6 jprt.my.linux.ppcv2.jdk7temp=linux_ppcv2_2.6 @@ -143,6 +150,7 @@ jprt.my.linux.ppcv2.ejdk7=linux_ppcv2_2.6 jprt.my.linux.ppcv2=${jprt.my.linux.ppcv2.${jprt.tools.default.release}} +jprt.my.linux.ppcsflt.jdk8=linux_ppcsflt_2.6 jprt.my.linux.ppcsflt.jdk7=linux_ppcsflt_2.6 jprt.my.linux.ppcsflt.jdk7b107=linux_ppcsflt_2.6 jprt.my.linux.ppcsflt.jdk7temp=linux_ppcsflt_2.6 @@ -150,6 +158,7 @@ jprt.my.linux.ppcsflt.ejdk7=linux_ppcsflt_2.6 jprt.my.linux.ppcsflt=${jprt.my.linux.ppcsflt.${jprt.tools.default.release}} +jprt.my.linux.armvfp.jdk8=linux_armvfp_2.6 jprt.my.linux.armvfp.jdk7=linux_armvfp_2.6 jprt.my.linux.armvfp.jdk7b107=linux_armvfp_2.6 jprt.my.linux.armvfp.jdk7temp=linux_armvfp_2.6 @@ -157,6 +166,7 @@ jprt.my.linux.armvfp.ejdk7=linux_armvfp_2.6 jprt.my.linux.armvfp=${jprt.my.linux.armvfp.${jprt.tools.default.release}} +jprt.my.linux.armsflt.jdk8=linux_armsflt_2.6 jprt.my.linux.armsflt.jdk7=linux_armsflt_2.6 jprt.my.linux.armsflt.jdk7b107=linux_armsflt_2.6 jprt.my.linux.armsflt.jdk7temp=linux_armsflt_2.6 @@ -164,6 +174,7 @@ jprt.my.linux.armsflt.ejdk7=linux_armsflt_2.6 jprt.my.linux.armsflt=${jprt.my.linux.armsflt.${jprt.tools.default.release}} +jprt.my.windows.i586.jdk8=windows_i586_5.1 jprt.my.windows.i586.jdk7=windows_i586_5.1 jprt.my.windows.i586.jdk7b107=windows_i586_5.0 jprt.my.windows.i586.jdk7temp=windows_i586_5.0 @@ -177,6 +188,7 @@ jprt.my.windows.i586.ejdk6=${jprt.my.windows.i586.jdk6} jprt.my.windows.i586=${jprt.my.windows.i586.${jprt.tools.default.release}} +jprt.my.windows.x64.jdk8=windows_x64_5.2 jprt.my.windows.x64.jdk7=windows_x64_5.2 jprt.my.windows.x64.jdk7b107=windows_x64_5.2 jprt.my.windows.x64.jdk7temp=windows_x64_5.2 @@ -218,6 +230,7 @@ jprt.build.targets.all=${jprt.build.targets.standard}, \ ${jprt.build.targets.embedded}, ${jprt.build.targets.open} +jprt.build.targets.jdk8=${jprt.build.targets.all} jprt.build.targets.jdk7=${jprt.build.targets.all} jprt.build.targets.jdk7temp=${jprt.build.targets.all} jprt.build.targets.jdk7b107=${jprt.build.targets.all} @@ -494,6 +507,7 @@ ${jprt.my.windows.x64.test.targets} +jprt.test.targets.jdk8=${jprt.test.targets.standard} jprt.test.targets.jdk7=${jprt.test.targets.standard} jprt.test.targets.jdk7temp=${jprt.test.targets.standard} jprt.test.targets.jdk7b105=${jprt.test.targets.standard} @@ -534,6 +548,7 @@ jprt.make.rule.test.targets.embedded = \ ${jprt.make.rule.test.targets.standard.client} +jprt.make.rule.test.targets.jdk8=${jprt.make.rule.test.targets.standard} jprt.make.rule.test.targets.jdk7=${jprt.make.rule.test.targets.standard} jprt.make.rule.test.targets.jdk7temp=${jprt.make.rule.test.targets.standard} jprt.make.rule.test.targets.jdk7b107=${jprt.make.rule.test.targets.standard} diff -r 0b80db433fcb -r 8107273fd204 src/cpu/sparc/vm/methodHandles_sparc.cpp --- a/src/cpu/sparc/vm/methodHandles_sparc.cpp Fri Jul 22 00:29:01 2011 -0700 +++ b/src/cpu/sparc/vm/methodHandles_sparc.cpp Sat Jul 23 10:42:20 2011 -0400 @@ -524,6 +524,30 @@ } #endif // ASSERT + +void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register target, Register temp) { + assert(method == G5_method, "interpreter calling convention"); + __ verify_oop(method); + __ ld_ptr(G5_method, in_bytes(methodOopDesc::from_interpreted_offset()), target); + if (JvmtiExport::can_post_interpreter_events()) { + // JVMTI events, such as single-stepping, are implemented partly by avoiding running + // compiled code in threads for which the event is enabled. Check here for + // interp_only_mode if these events CAN be enabled. + __ verify_thread(); + Label skip_compiled_code; + + const Address interp_only(G2_thread, JavaThread::interp_only_mode_offset()); + __ ld(interp_only, temp); + __ tst(temp); + __ br(Assembler::notZero, true, Assembler::pn, skip_compiled_code); + __ delayed()->ld_ptr(G5_method, in_bytes(methodOopDesc::interpreter_entry_offset()), target); + __ bind(skip_compiled_code); + } + __ jmp(target, 0); + __ delayed()->nop(); +} + + // Code generation address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler* _masm) { // I5_savedSP/O5_savedSP: sender SP (must preserve) @@ -1105,9 +1129,6 @@ guarantee(java_lang_invoke_MethodHandle::vmentry_offset_in_bytes() != 0, "must have offsets"); // Some handy addresses: - Address G5_method_fie( G5_method, in_bytes(methodOopDesc::from_interpreted_offset())); - Address G5_method_fce( G5_method, in_bytes(methodOopDesc::from_compiled_offset())); - Address G3_mh_vmtarget( G3_method_handle, java_lang_invoke_MethodHandle::vmtarget_offset_in_bytes()); Address G3_dmh_vmindex( G3_method_handle, java_lang_invoke_DirectMethodHandle::vmindex_offset_in_bytes()); @@ -1136,24 +1157,23 @@ case _raise_exception: { // Not a real MH entry, but rather shared code for raising an - // exception. Since we use the compiled entry, arguments are - // expected in compiler argument registers. + // exception. For sharing purposes the arguments are passed into registers + // and then placed in the intepreter calling convention here. assert(raise_exception_method(), "must be set"); assert(raise_exception_method()->from_compiled_entry(), "method must be linked"); - __ mov(O5_savedSP, SP); // Cut the stack back to where the caller started. - - Label L_no_method; - // FIXME: fill in _raise_exception_method with a suitable java.lang.invoke method __ set(AddressLiteral((address) &_raise_exception_method), G5_method); __ ld_ptr(Address(G5_method, 0), G5_method); const int jobject_oop_offset = 0; __ ld_ptr(Address(G5_method, jobject_oop_offset), G5_method); - __ verify_oop(G5_method); - __ jump_indirect_to(G5_method_fce, O3_scratch); // jump to compiled entry - __ delayed()->nop(); + adjust_SP_and_Gargs_down_by_slots(_masm, 3, noreg, noreg); + + __ st_ptr(O0_code, __ argument_address(constant(2), noreg, 0)); + __ st_ptr(O1_actual, __ argument_address(constant(1), noreg, 0)); + __ st_ptr(O2_required, __ argument_address(constant(0), noreg, 0)); + jump_from_method_handle(_masm, G5_method, O1_scratch, O2_scratch); } break; @@ -1161,7 +1181,6 @@ case _invokespecial_mh: { __ load_heap_oop(G3_mh_vmtarget, G5_method); // target is a methodOop - __ verify_oop(G5_method); // Same as TemplateTable::invokestatic or invokespecial, // minus the CP setup and profiling: if (ek == _invokespecial_mh) { @@ -1171,8 +1190,7 @@ __ null_check(G3_method_handle); __ verify_oop(G3_method_handle); } - __ jump_indirect_to(G5_method_fie, O1_scratch); - __ delayed()->nop(); + jump_from_method_handle(_masm, G5_method, O1_scratch, O2_scratch); } break; @@ -1204,9 +1222,7 @@ Address vtable_entry_addr(O0_klass, base + vtableEntry::method_offset_in_bytes()); __ ld_ptr(vtable_entry_addr, G5_method); - __ verify_oop(G5_method); - __ jump_indirect_to(G5_method_fie, O1_scratch); - __ delayed()->nop(); + jump_from_method_handle(_masm, G5_method, O1_scratch, O2_scratch); } break; @@ -1237,9 +1253,7 @@ O3_scratch, no_such_interface); - __ verify_oop(G5_method); - __ jump_indirect_to(G5_method_fie, O1_scratch); - __ delayed()->nop(); + jump_from_method_handle(_masm, G5_method, O1_scratch, O2_scratch); __ bind(no_such_interface); // Throw an exception. @@ -1283,9 +1297,7 @@ if (direct_to_method) { __ load_heap_oop(G3_mh_vmtarget, G5_method); // target is a methodOop - __ verify_oop(G5_method); - __ jump_indirect_to(G5_method_fie, O1_scratch); - __ delayed()->nop(); + jump_from_method_handle(_masm, G5_method, O1_scratch, O2_scratch); } else { __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); // target is a methodOop __ verify_oop(G3_method_handle); diff -r 0b80db433fcb -r 8107273fd204 src/cpu/sparc/vm/methodHandles_sparc.hpp --- a/src/cpu/sparc/vm/methodHandles_sparc.hpp Fri Jul 22 00:29:01 2011 -0700 +++ b/src/cpu/sparc/vm/methodHandles_sparc.hpp Sat Jul 23 10:42:20 2011 -0400 @@ -221,4 +221,8 @@ "reference is a MH"); } + // Similar to InterpreterMacroAssembler::jump_from_interpreted. + // Takes care of special dispatch from single stepping too. + static void jump_from_method_handle(MacroAssembler* _masm, Register method, Register temp, Register temp2); + static void trace_method_handle(MacroAssembler* _masm, const char* adaptername) PRODUCT_RETURN; diff -r 0b80db433fcb -r 8107273fd204 src/cpu/x86/vm/interp_masm_x86_32.cpp --- a/src/cpu/x86/vm/interp_masm_x86_32.cpp Fri Jul 22 00:29:01 2011 -0700 +++ b/src/cpu/x86/vm/interp_masm_x86_32.cpp Sat Jul 23 10:42:20 2011 -0400 @@ -403,9 +403,9 @@ // interp_only_mode if these events CAN be enabled. get_thread(temp); // interp_only is an int, on little endian it is sufficient to test the byte only - // Is a cmpl faster (ce + // Is a cmpl faster? cmpb(Address(temp, JavaThread::interp_only_mode_offset()), 0); - jcc(Assembler::zero, run_compiled_code); + jccb(Assembler::zero, run_compiled_code); jmp(Address(method, methodOopDesc::interpreter_entry_offset())); bind(run_compiled_code); } diff -r 0b80db433fcb -r 8107273fd204 src/cpu/x86/vm/interp_masm_x86_64.cpp --- a/src/cpu/x86/vm/interp_masm_x86_64.cpp Fri Jul 22 00:29:01 2011 -0700 +++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp Sat Jul 23 10:42:20 2011 -0400 @@ -402,7 +402,7 @@ // interp_only is an int, on little endian it is sufficient to test the byte only // Is a cmpl faster? cmpb(Address(r15_thread, JavaThread::interp_only_mode_offset()), 0); - jcc(Assembler::zero, run_compiled_code); + jccb(Assembler::zero, run_compiled_code); jmp(Address(method, methodOopDesc::interpreter_entry_offset())); bind(run_compiled_code); } diff -r 0b80db433fcb -r 8107273fd204 src/cpu/x86/vm/methodHandles_x86.cpp --- a/src/cpu/x86/vm/methodHandles_x86.cpp Fri Jul 22 00:29:01 2011 -0700 +++ b/src/cpu/x86/vm/methodHandles_x86.cpp Sat Jul 23 10:42:20 2011 -0400 @@ -546,6 +546,28 @@ } #endif //ASSERT +void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register temp) { + if (JvmtiExport::can_post_interpreter_events()) { + Label run_compiled_code; + // JVMTI events, such as single-stepping, are implemented partly by avoiding running + // compiled code in threads for which the event is enabled. Check here for + // interp_only_mode if these events CAN be enabled. +#ifdef _LP64 + Register rthread = r15_thread; +#else + Register rthread = temp; + __ get_thread(rthread); +#endif + // interp_only is an int, on little endian it is sufficient to test the byte only + // Is a cmpl faster? + __ cmpb(Address(rthread, JavaThread::interp_only_mode_offset()), 0); + __ jccb(Assembler::zero, run_compiled_code); + __ jmp(Address(method, methodOopDesc::interpreter_entry_offset())); + __ bind(run_compiled_code); + } + __ jmp(Address(method, methodOopDesc::from_interpreted_offset())); +} + // Code generation address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler* _masm) { // rbx: methodOop @@ -1120,9 +1142,6 @@ guarantee(java_lang_invoke_MethodHandle::vmentry_offset_in_bytes() != 0, "must have offsets"); // some handy addresses - Address rbx_method_fie( rbx, methodOopDesc::from_interpreted_offset() ); - Address rbx_method_fce( rbx, methodOopDesc::from_compiled_offset() ); - Address rcx_mh_vmtarget( rcx_recv, java_lang_invoke_MethodHandle::vmtarget_offset_in_bytes() ); Address rcx_dmh_vmindex( rcx_recv, java_lang_invoke_DirectMethodHandle::vmindex_offset_in_bytes() ); @@ -1163,8 +1182,8 @@ assert(raise_exception_method(), "must be set"); assert(raise_exception_method()->from_compiled_entry(), "method must be linked"); - const Register rdi_pc = rax; - __ pop(rdi_pc); // caller PC + const Register rax_pc = rax; + __ pop(rax_pc); // caller PC __ mov(rsp, saved_last_sp); // cut the stack back to where the caller started Register rbx_method = rbx_temp; @@ -1172,11 +1191,15 @@ const int jobject_oop_offset = 0; __ movptr(rbx_method, Address(rbx_method, jobject_oop_offset)); // dereference the jobject - __ verify_oop(rbx_method); + + __ movptr(rsi, rsp); + __ subptr(rsp, 3 * wordSize); + __ push(rax_pc); // restore caller PC - NOT_LP64(__ push(rarg2_required)); - __ push(rdi_pc); // restore caller PC - __ jmp(rbx_method_fce); // jump to compiled entry + __ movptr(__ argument_address(constant(2)), rarg0_code); + __ movptr(__ argument_address(constant(1)), rarg1_actual); + __ movptr(__ argument_address(constant(0)), rarg2_required); + jump_from_method_handle(_masm, rbx_method, rax); } break; @@ -1195,7 +1218,7 @@ __ null_check(rcx_recv); __ verify_oop(rcx_recv); } - __ jmp(rbx_method_fie); + jump_from_method_handle(_masm, rbx_method, rax); } break; @@ -1228,7 +1251,7 @@ __ movptr(rbx_method, vtable_entry_addr); __ verify_oop(rbx_method); - __ jmp(rbx_method_fie); + jump_from_method_handle(_masm, rbx_method, rax); } break; @@ -1263,7 +1286,7 @@ no_such_interface); __ verify_oop(rbx_method); - __ jmp(rbx_method_fie); + jump_from_method_handle(_masm, rbx_method, rax); __ hlt(); __ bind(no_such_interface); @@ -1311,7 +1334,7 @@ Register rbx_method = rbx_temp; __ load_heap_oop(rbx_method, rcx_mh_vmtarget); __ verify_oop(rbx_method); - __ jmp(rbx_method_fie); + jump_from_method_handle(_masm, rbx_method, rax); } else { __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); __ verify_oop(rcx_recv); diff -r 0b80db433fcb -r 8107273fd204 src/cpu/x86/vm/methodHandles_x86.hpp --- a/src/cpu/x86/vm/methodHandles_x86.hpp Fri Jul 22 00:29:01 2011 -0700 +++ b/src/cpu/x86/vm/methodHandles_x86.hpp Sat Jul 23 10:42:20 2011 -0400 @@ -291,6 +291,10 @@ "reference is a MH"); } + // Similar to InterpreterMacroAssembler::jump_from_interpreted. + // Takes care of special dispatch from single stepping too. + static void jump_from_method_handle(MacroAssembler* _masm, Register method, Register temp); + static void trace_method_handle(MacroAssembler* _masm, const char* adaptername) PRODUCT_RETURN; static Register saved_last_sp_register() { diff -r 0b80db433fcb -r 8107273fd204 test/compiler/6990212/Test6990212.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compiler/6990212/Test6990212.java Sat Jul 23 10:42:20 2011 -0400 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +/** + * @test + * @bug 6990212 + * @summary JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods + * + * @run main Test6990212 + */ + +import java.lang.invoke.*; + +interface intf { + public Object target(); +} + +public class Test6990212 implements intf { + public Object target() { + return null; + } + + public static void main(String[] args) throws Throwable { + // Build an interface invoke and then invoke it on something + // that doesn't implement the interface to test the + // raiseException path. + MethodHandle target = MethodHandles.lookup().findVirtual(intf.class, "target", MethodType.methodType(Object.class)); + try { + target.invoke(new Object()); + } catch (ClassCastException cce) { + // everything is ok + System.out.println("got expected ClassCastException"); + } + } +} diff -r 0b80db433fcb -r 8107273fd204 test/compiler/7052494/Test7052494.java --- a/test/compiler/7052494/Test7052494.java Fri Jul 22 00:29:01 2011 -0700 +++ b/test/compiler/7052494/Test7052494.java Sat Jul 23 10:42:20 2011 -0400 @@ -70,18 +70,24 @@ } // Empty loop rolls through MAXINT if i > 0 + + static final int limit5 = Integer.MIN_VALUE + 10000; + static int test5(int i) { int result = 0; - while (i++ != 0) { + while (i++ != limit5) { result = i*2; } return result; } // Empty loop rolls through MININT if i < 0 + + static final int limit6 = Integer.MAX_VALUE - 10000; + static int test6(int i) { int result = 0; - while (i-- != 0) { + while (i-- != limit6) { result = i*2; } return result; @@ -92,6 +98,7 @@ int[] arr = new int[8]; int[] ar3 = { 0, 0, 4, 6, 8, 10, 0, 0 }; int[] ar4 = { 0, 0, 0, -10, -8, -6, -4, 0 }; + System.out.println("test1"); for (int i = 0; i < 11000; i++) { int k = test1(1, 10); if (k != 10) { @@ -100,6 +107,7 @@ break; } } + System.out.println("test2"); for (int i = 0; i < 11000; i++) { int k = test2(-1, -10); if (k != -10) { @@ -108,6 +116,7 @@ break; } } + System.out.println("test3"); for (int i = 0; i < 11000; i++) { java.util.Arrays.fill(arr, 0); test3(1, 10, arr); @@ -124,6 +133,7 @@ break; } } + System.out.println("test4"); for (int i = 0; i < 11000; i++) { java.util.Arrays.fill(arr, 0); test4(-1, -10, arr); @@ -140,22 +150,25 @@ break; } } + System.out.println("test5"); for (int i = 0; i < 11000; i++) { - int k = test5(1); - if (k != 0) { - System.out.println("FAILED: " + k + " != 0"); + int k = test5(limit6); + if (k != limit5*2) { + System.out.println("FAILED: " + k + " != " + limit5*2); failed = true; break; } } + System.out.println("test6"); for (int i = 0; i < 11000; i++) { - int k = test6(-1); - if (k != 0) { - System.out.println("FAILED: " + k + " != 0"); + int k = test6(limit5); + if (k != limit6*2) { + System.out.println("FAILED: " + k + " != " + limit6*2); failed = true; break; } } + System.out.println("finish"); if (failed) System.exit(97); }