From 5db23a3b076d4e7a775839cb4b32ba4945e6f8c5 Mon Sep 17 00:00:00 2001 From: Ed Nevill Date: Thu, 16 Jun 2016 06:42:08 -0400 Subject: [PATCH 001/108] 8159063: aarch64: optimise unaligned array copy long Reviewed-by: aph, adinn --- .../src/cpu/aarch64/vm/globals_aarch64.hpp | 3 + .../cpu/aarch64/vm/stubGenerator_aarch64.cpp | 204 +++++++++++++++++- .../src/cpu/aarch64/vm/vm_version_aarch64.cpp | 10 +- 3 files changed, 212 insertions(+), 5 deletions(-) diff --git a/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp index 604b8cd34fb..60ca09675a9 100644 --- a/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp @@ -118,6 +118,7 @@ define_pd_global(intx, InlineSmallCode, 1000); // Don't attempt to use Neon on builtin sim until builtin sim supports it #define UseCRC32 false #define UseSIMDForMemoryOps false +#define AvoidUnalignedAcesses false #else #define UseBuiltinSim false @@ -144,6 +145,8 @@ define_pd_global(intx, InlineSmallCode, 1000); "Use CRC32 instructions for CRC32 computation") \ product(bool, UseSIMDForMemoryOps, false, \ "Use SIMD instructions in generated memory move code") \ + product(bool, AvoidUnalignedAccesses, false, \ + "Avoid generating unaligned memory accesses") \ product(bool, UseLSE, false, \ "Use LSE instructions") \ product(bool, UseBlockZeroing, true, \ diff --git a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp index b93e9b19bdd..6ca67ac7005 100644 --- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp @@ -801,6 +801,12 @@ class StubGenerator: public StubCodeGenerator { StubCodeMark mark(this, "StubRoutines", stub_name); __ align(CodeEntryAlignment); __ bind(start); + + Label unaligned_copy_long; + if (AvoidUnalignedAccesses) { + __ tbnz(d, 3, unaligned_copy_long); + } + if (direction == copy_forwards) { __ sub(s, s, bias); __ sub(d, d, bias); @@ -901,6 +907,198 @@ class StubGenerator: public StubCodeGenerator { } __ ret(lr); + + if (AvoidUnalignedAccesses) { + Label drain, again; + // Register order for storing. Order is different for backward copy. + + __ bind(unaligned_copy_long); + + // source address is even aligned, target odd aligned + // + // when forward copying word pairs we read long pairs at offsets + // {0, 2, 4, 6} (in long words). when backwards copying we read + // long pairs at offsets {-2, -4, -6, -8}. We adjust the source + // address by -2 in the forwards case so we can compute the + // source offsets for both as {2, 4, 6, 8} * unit where unit = 1 + // or -1. + // + // when forward copying we need to store 1 word, 3 pairs and + // then 1 word at offsets {0, 1, 3, 5, 7}. Rather thna use a + // zero offset We adjust the destination by -1 which means we + // have to use offsets { 1, 2, 4, 6, 8} * unit for the stores. + // + // When backwards copyng we need to store 1 word, 3 pairs and + // then 1 word at offsets {-1, -3, -5, -7, -8} i.e. we use + // offsets {1, 3, 5, 7, 8} * unit. + + if (direction == copy_forwards) { + __ sub(s, s, 16); + __ sub(d, d, 8); + } + + // Fill 8 registers + // + // for forwards copy s was offset by -16 from the original input + // value of s so the register contents are at these offsets + // relative to the 64 bit block addressed by that original input + // and so on for each successive 64 byte block when s is updated + // + // t0 at offset 0, t1 at offset 8 + // t2 at offset 16, t3 at offset 24 + // t4 at offset 32, t5 at offset 40 + // t6 at offset 48, t7 at offset 56 + + // for backwards copy s was not offset so the register contents + // are at these offsets into the preceding 64 byte block + // relative to that original input and so on for each successive + // preceding 64 byte block when s is updated. this explains the + // slightly counter-intuitive looking pattern of register usage + // in the stp instructions for backwards copy. + // + // t0 at offset -16, t1 at offset -8 + // t2 at offset -32, t3 at offset -24 + // t4 at offset -48, t5 at offset -40 + // t6 at offset -64, t7 at offset -56 + + __ ldp(t0, t1, Address(s, 2 * unit)); + __ ldp(t2, t3, Address(s, 4 * unit)); + __ ldp(t4, t5, Address(s, 6 * unit)); + __ ldp(t6, t7, Address(__ pre(s, 8 * unit))); + + __ subs(count, count, 16); + __ br(Assembler::LO, drain); + + int prefetch = PrefetchCopyIntervalInBytes; + bool use_stride = false; + if (direction == copy_backwards) { + use_stride = prefetch > 256; + prefetch = -prefetch; + if (use_stride) __ mov(stride, prefetch); + } + + __ bind(again); + + if (PrefetchCopyIntervalInBytes > 0) + __ prfm(use_stride ? Address(s, stride) : Address(s, prefetch), PLDL1KEEP); + + if (direction == copy_forwards) { + // allowing for the offset of -8 the store instructions place + // registers into the target 64 bit block at the following + // offsets + // + // t0 at offset 0 + // t1 at offset 8, t2 at offset 16 + // t3 at offset 24, t4 at offset 32 + // t5 at offset 40, t6 at offset 48 + // t7 at offset 56 + + __ str(t0, Address(d, 1 * unit)); + __ stp(t1, t2, Address(d, 2 * unit)); + __ ldp(t0, t1, Address(s, 2 * unit)); + __ stp(t3, t4, Address(d, 4 * unit)); + __ ldp(t2, t3, Address(s, 4 * unit)); + __ stp(t5, t6, Address(d, 6 * unit)); + __ ldp(t4, t5, Address(s, 6 * unit)); + __ str(t7, Address(__ pre(d, 8 * unit))); + __ ldp(t6, t7, Address(__ pre(s, 8 * unit))); + } else { + // d was not offset when we started so the registers are + // written into the 64 bit block preceding d with the following + // offsets + // + // t1 at offset -8 + // t3 at offset -24, t0 at offset -16 + // t5 at offset -48, t2 at offset -32 + // t7 at offset -56, t4 at offset -48 + // t6 at offset -64 + // + // note that this matches the offsets previously noted for the + // loads + + __ str(t1, Address(d, 1 * unit)); + __ stp(t3, t0, Address(d, 3 * unit)); + __ ldp(t0, t1, Address(s, 2 * unit)); + __ stp(t5, t2, Address(d, 5 * unit)); + __ ldp(t2, t3, Address(s, 4 * unit)); + __ stp(t7, t4, Address(d, 7 * unit)); + __ ldp(t4, t5, Address(s, 6 * unit)); + __ str(t6, Address(__ pre(d, 8 * unit))); + __ ldp(t6, t7, Address(__ pre(s, 8 * unit))); + } + + __ subs(count, count, 8); + __ br(Assembler::HS, again); + + // Drain + // + // this uses the same pattern of offsets and register arguments + // as above + __ bind(drain); + if (direction == copy_forwards) { + __ str(t0, Address(d, 1 * unit)); + __ stp(t1, t2, Address(d, 2 * unit)); + __ stp(t3, t4, Address(d, 4 * unit)); + __ stp(t5, t6, Address(d, 6 * unit)); + __ str(t7, Address(__ pre(d, 8 * unit))); + } else { + __ str(t1, Address(d, 1 * unit)); + __ stp(t3, t0, Address(d, 3 * unit)); + __ stp(t5, t2, Address(d, 5 * unit)); + __ stp(t7, t4, Address(d, 7 * unit)); + __ str(t6, Address(__ pre(d, 8 * unit))); + } + // now we need to copy any remaining part block which may + // include a 4 word block subblock and/or a 2 word subblock. + // bits 2 and 1 in the count are the tell-tale for whetehr we + // have each such subblock + { + Label L1, L2; + __ tbz(count, exact_log2(4), L1); + // this is the same as above but copying only 4 longs hence + // with ony one intervening stp between the str instructions + // but note that the offsets and registers still follow the + // same pattern + __ ldp(t0, t1, Address(s, 2 * unit)); + __ ldp(t2, t3, Address(__ pre(s, 4 * unit))); + if (direction == copy_forwards) { + __ str(t0, Address(d, 1 * unit)); + __ stp(t1, t2, Address(d, 2 * unit)); + __ str(t3, Address(__ pre(d, 4 * unit))); + } else { + __ str(t1, Address(d, 1 * unit)); + __ stp(t3, t0, Address(d, 3 * unit)); + __ str(t2, Address(__ pre(d, 4 * unit))); + } + __ bind(L1); + + __ tbz(count, 1, L2); + // this is the same as above but copying only 2 longs hence + // there is no intervening stp between the str instructions + // but note that the offset and register patterns are still + // the same + __ ldp(t0, t1, Address(__ pre(s, 2 * unit))); + if (direction == copy_forwards) { + __ str(t0, Address(d, 1 * unit)); + __ str(t1, Address(__ pre(d, 2 * unit))); + } else { + __ str(t1, Address(d, 1 * unit)); + __ str(t0, Address(__ pre(d, 2 * unit))); + } + __ bind(L2); + + // for forwards copy we need to re-adjust the offsets we + // applied so that s and d are follow the last words written + + if (direction == copy_forwards) { + __ add(s, s, 16); + __ add(d, d, 8); + } + + } + + __ ret(lr); + } } // Small copy: less than 16 bytes. @@ -1024,11 +1222,9 @@ class StubGenerator: public StubCodeGenerator { // (96 bytes if SIMD because we do 32 byes per instruction) __ bind(copy80); if (UseSIMDForMemoryOps) { - __ ldpq(v0, v1, Address(s, 0)); - __ ldpq(v2, v3, Address(s, 32)); + __ ld4(v0, v1, v2, v3, __ T16B, Address(s, 0)); __ ldpq(v4, v5, Address(send, -32)); - __ stpq(v0, v1, Address(d, 0)); - __ stpq(v2, v3, Address(d, 32)); + __ st4(v0, v1, v2, v3, __ T16B, Address(d, 0)); __ stpq(v4, v5, Address(dend, -32)); } else { __ ldp(t0, t1, Address(s, 0)); diff --git a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp index 070fcbd219c..fa79485c79f 100644 --- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp @@ -175,7 +175,15 @@ void VM_Version::get_processor_features() { } // Enable vendor specific features - if (_cpu == CPU_CAVIUM && _variant == 0) _features |= CPU_DMB_ATOMICS; + if (_cpu == CPU_CAVIUM) { + if (_variant == 0) _features |= CPU_DMB_ATOMICS; + if (FLAG_IS_DEFAULT(AvoidUnalignedAccesses)) { + FLAG_SET_DEFAULT(AvoidUnalignedAccesses, true); + } + if (FLAG_IS_DEFAULT(UseSIMDForMemoryOps)) { + FLAG_SET_DEFAULT(UseSIMDForMemoryOps, (_variant > 0)); + } + } if (_cpu == CPU_ARM && (_model == 0xd03 || _model2 == 0xd03)) _features |= CPU_A53MAC; if (_cpu == CPU_ARM && (_model == 0xd07 || _model2 == 0xd07)) _features |= CPU_STXR_PREFETCH; // If an olde style /proc/cpuinfo (cpu_lines == 1) then if _model is an A57 (0xd07) From 87f15c2bcfc86b7f606ce3d34f49e3de00eefc5f Mon Sep 17 00:00:00 2001 From: Volker Simonis Date: Wed, 22 Jun 2016 17:05:40 +0200 Subject: [PATCH 002/108] 8159620: -XX:-UseOnStackReplacement does not work together with -XX:+TieredCompilation on ppc64 and sparc Reviewed-by: goetz, kvn, thartmann --- .../src/cpu/ppc/vm/templateTable_ppc_64.cpp | 19 ++++-- .../src/cpu/sparc/vm/templateTable_sparc.cpp | 4 +- hotspot/src/share/vm/c1/c1_LIRGenerator.cpp | 2 +- .../compiler/interpreter/DisableOSRTest.java | 62 +++++++++++++++++++ 4 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 hotspot/test/compiler/interpreter/DisableOSRTest.java diff --git a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp index 6b8f658ff09..7be3b6d6d3c 100644 --- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp +++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp @@ -1668,9 +1668,13 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) { __ lwz(Rscratch3, in_bytes(MethodData::backedge_mask_offset()), Rmdo); __ addi(Rscratch2, Rscratch2, increment); __ stw(Rscratch2, mdo_bc_offs, Rmdo); - __ and_(Rscratch3, Rscratch2, Rscratch3); - __ bne(CCR0, Lforward); - __ b(Loverflow); + if (UseOnStackReplacement) { + __ and_(Rscratch3, Rscratch2, Rscratch3); + __ bne(CCR0, Lforward); + __ b(Loverflow); + } else { + __ b(Lforward); + } } // If there's no MDO, increment counter in method. @@ -1680,9 +1684,12 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) { __ lwz(Rscratch3, in_bytes(MethodCounters::backedge_mask_offset()), R4_counters); __ addi(Rscratch2, Rscratch2, increment); __ stw(Rscratch2, mo_bc_offs, R4_counters); - __ and_(Rscratch3, Rscratch2, Rscratch3); - __ bne(CCR0, Lforward); - + if (UseOnStackReplacement) { + __ and_(Rscratch3, Rscratch2, Rscratch3); + __ bne(CCR0, Lforward); + } else { + __ b(Lforward); + } __ bind(Loverflow); // Notify point for loop, pass branch bytecode. diff --git a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp index 2976383f767..44bee0c703c 100644 --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp @@ -1636,7 +1636,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) { in_bytes(InvocationCounter::counter_offset())); Address mask(G4_scratch, in_bytes(MethodData::backedge_mask_offset())); __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, G3_scratch, O0, - Assembler::notZero, &Lforward); + (UseOnStackReplacement ? Assembler::notZero : Assembler::always), &Lforward); __ ba_short(Loverflow); } @@ -1647,7 +1647,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) { in_bytes(InvocationCounter::counter_offset())); Address mask(G3_method_counters, in_bytes(MethodCounters::backedge_mask_offset())); __ increment_mask_and_jump(backedge_counter, increment, mask, G4_scratch, O0, - Assembler::notZero, &Lforward); + (UseOnStackReplacement ? Assembler::notZero : Assembler::always), &Lforward); __ bind(Loverflow); // notify point for loop, pass branch bytecode diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp index ae49fc36878..2737550aced 100644 --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp @@ -3435,7 +3435,7 @@ void LIRGenerator::increment_event_counter_impl(CodeEmitInfo* info, __ load(counter, result); __ add(result, LIR_OprFact::intConst(InvocationCounter::count_increment), result); __ store(result, counter); - if (notify) { + if (notify && (!backedge || UseOnStackReplacement)) { LIR_Opr meth = LIR_OprFact::metadataConst(method->constant_encoding()); // The bci for info can point to cmp for if's we want the if bci CodeStub* overflow = new CounterOverflowStub(info, bci, meth); diff --git a/hotspot/test/compiler/interpreter/DisableOSRTest.java b/hotspot/test/compiler/interpreter/DisableOSRTest.java new file mode 100644 index 00000000000..9d531baab97 --- /dev/null +++ b/hotspot/test/compiler/interpreter/DisableOSRTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2016 SAP SE. 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 8159620 + * @summary testing that -XX:-UseOnStackReplacement works with both -XX:(+/-)TieredCompilation + * @modules java.base/jdk.internal.misc + * @library /testlibrary /test/lib / + * @build sun.hotspot.WhiteBox + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+PrintCompilation + * -XX:-BackgroundCompilation -XX:-TieredCompilation -XX:-UseOnStackReplacement DisableOSRTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+PrintCompilation + * -XX:-BackgroundCompilation -XX:+TieredCompilation -XX:-UseOnStackReplacement DisableOSRTest + */ + +import java.lang.reflect.Method; +import java.util.Random; +import sun.hotspot.WhiteBox; + +public class DisableOSRTest { + private static final WhiteBox WB = WhiteBox.getWhiteBox(); + private static final Random RANDOM = new Random(); + + public static int foo() { + return RANDOM.nextInt(); + } + + public static void main(String[] args) throws Exception { + Method m = DisableOSRTest.class.getMethod("main", String[].class); + + for (int i = 0; i < 100_000; i++) { + foo(); + } + + if (WB.isMethodCompiled(m, true /* isOsr */)) { + throw new RuntimeException("\"" + m + "\" shouldn't be OSR compiled if running with -XX:-UseOnStackReplacement!"); + } + } +} From 1ecfe15d17cd680cf78a389eda2aa3be828d33c9 Mon Sep 17 00:00:00 2001 From: Roland Schatz Date: Fri, 24 Jun 2016 15:45:47 +0000 Subject: [PATCH 003/108] 8160177: [JVMCI] race condition in HotSpotMemoryAccessProviderImpl.verifyReadRawObject Reviewed-by: kvn --- .../vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java index 6bdf2ee4598..be8e3a32067 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java @@ -109,13 +109,7 @@ class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider { } } - private boolean verifyReadRawObject(Object expected, Constant base, long displacement, boolean compressed) { - if (compressed == runtime.getConfig().useCompressedOops) { - Object obj = asObject(base); - if (obj != null) { - assert expected == UNSAFE.getObject(obj, displacement) : "readUnsafeOop doesn't agree with unsafe.getObject"; - } - } + private boolean verifyReadRawObject(Object expected, Constant base, long displacement) { if (base instanceof HotSpotMetaspaceConstant) { MetaspaceWrapperObject metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base); if (metaspaceObject instanceof HotSpotResolvedObjectTypeImpl) { @@ -136,11 +130,11 @@ class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider { assert !compressed; displacement += asRawPointer(baseConstant); ret = UNSAFE.getUncompressedObject(displacement); + assert verifyReadRawObject(ret, baseConstant, initialDisplacement); } else { assert runtime.getConfig().useCompressedOops == compressed; ret = UNSAFE.getObject(base, displacement); } - assert verifyReadRawObject(ret, baseConstant, initialDisplacement, compressed); return ret; } From 048c1f8ad0b0db75f6d33877b83c1e12062b186d Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Fri, 24 Jun 2016 19:06:15 +0300 Subject: [PATCH 004/108] 8160085: @library' must appear before first `@run' Move @ignore after the @library Reviewed-by: kvn --- hotspot/test/compiler/codecache/jmx/PeakUsageTest.java | 2 +- .../compilercontrol/jcmd/ClearDirectivesFileStackTest.java | 2 +- .../compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java | 2 +- hotspot/test/compiler/startup/SmallCodeCacheStartup.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java b/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java index d00aabbf728..458a29d3bff 100644 --- a/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java +++ b/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java @@ -27,8 +27,8 @@ import sun.hotspot.code.BlobType; /* * @test PeakUsageTest - * @ignore 8151345 * @library /testlibrary /test/lib + * @ignore 8151345 * @modules java.base/jdk.internal.misc * java.management * @build PeakUsageTest diff --git a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java index 75c2e8a34de..6d5f9e2aecf 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java @@ -24,10 +24,10 @@ /* * @test * @bug 8137167 - * @ignore 8140405 * @summary Tests jcmd to be able to clear directives added via options * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib ../share / + * @ignore 8140405 * @build compiler.compilercontrol.jcmd.ClearDirectivesFileStackTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox * compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.* diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java index a648caaac67..25e5f1866eb 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java @@ -24,10 +24,10 @@ /* * @test * @bug 8136421 - * @ignore 8158860 * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib * @library ../common/patches + * @ignore 8158860 * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.meta diff --git a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java index fbab26221e8..f95984660c5 100644 --- a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java +++ b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java @@ -23,12 +23,12 @@ /* * @test - * @ignore 8134286 * @bug 8023014 * @summary Test ensures that there is no crash if there is not enough ReservedCodeCacheSize * to initialize all compiler threads. The option -Xcomp gives the VM more time to * trigger the old bug. * @library /testlibrary + * @ignore 8134286 * @modules java.base/jdk.internal.misc * java.management */ From 33c94b986ee183997252327ea397e20244adbc80 Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Fri, 24 Jun 2016 11:22:08 -0700 Subject: [PATCH 005/108] 8157249: [JVMCI] remove ConstantReflectionProvider.isEmbeddable method Remove unused API Reviewed-by: kvn --- .../src/jdk/vm/ci/meta/ConstantReflectionProvider.java | 9 --------- .../test/HotSpotConstantReflectionProviderTest.java | 6 ------ 2 files changed, 15 deletions(-) diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantReflectionProvider.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantReflectionProvider.java index adba998705a..75c2e5f9088 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantReflectionProvider.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantReflectionProvider.java @@ -96,15 +96,6 @@ public interface ConstantReflectionProvider { */ ResolvedJavaType asJavaType(Constant constant); - /** - * Check if the constant is embeddable in the code. - * - * @param constant the constant to test - */ - default boolean isEmbeddable(Constant constant) { - return true; - } - /** * Gets access to the internals of {@link MethodHandle}. */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java index 7cd0502bd5a..d031ae06e8b 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java @@ -120,12 +120,6 @@ public class HotSpotConstantReflectionProviderTest { Assert.assertEquals(actual, expected, "Unexpected result:"); } - @Test(dataProvider = "isEmbeddableDataProvider", dataProviderClass = IsEmbeddableDataProvider.class) - public void testIsEmbeddable(JavaConstant constant, boolean expected) { - boolean actual = CONSTANT_REFLECTION_PROVIDER.isEmbeddable(constant); - Assert.assertEquals(actual, expected, "Unexpected result:"); - } - @Test public void testGetMemoryAccessProvider() { MemoryAccessProvider actual = CONSTANT_REFLECTION_PROVIDER.getMemoryAccessProvider(); From 4ab4c66c4124b8c22afe73628c4e231dc6c6ff2d Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Mon, 27 Jun 2016 10:10:11 +0200 Subject: [PATCH 006/108] 8159016: Over-unrolled loop is partially removed Prevent over-unrolling of loops by computing upper bound for trip count. Reviewed-by: kvn --- hotspot/src/share/vm/opto/loopTransform.cpp | 41 ++++++------- hotspot/src/share/vm/opto/loopnode.hpp | 6 +- hotspot/src/share/vm/opto/macro.cpp | 8 ++- .../compiler/loopopts/TestOverunrolling.java | 57 +++++++++++++++++++ 4 files changed, 88 insertions(+), 24 deletions(-) create mode 100644 hotspot/test/compiler/loopopts/TestOverunrolling.java diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp index 282c5c11de2..b9368b42dff 100644 --- a/hotspot/src/share/vm/opto/loopTransform.cpp +++ b/hotspot/src/share/vm/opto/loopTransform.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, 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 @@ -70,9 +70,9 @@ void IdealLoopTree::record_for_igvn() { } //------------------------------compute_exact_trip_count----------------------- -// Compute loop exact trip count if possible. Do not recalculate trip count for +// Compute loop trip count if possible. Do not recalculate trip count for // split loops (pre-main-post) which have their limits and inits behind Opaque node. -void IdealLoopTree::compute_exact_trip_count( PhaseIdealLoop *phase ) { +void IdealLoopTree::compute_trip_count(PhaseIdealLoop* phase) { if (!_head->as_Loop()->is_valid_counted_loop()) { return; } @@ -94,17 +94,21 @@ void IdealLoopTree::compute_exact_trip_count( PhaseIdealLoop *phase ) { Node* init_n = cl->init_trip(); Node* limit_n = cl->limit(); - if (init_n != NULL && init_n->is_Con() && - limit_n != NULL && limit_n->is_Con()) { + if (init_n != NULL && limit_n != NULL) { // Use longs to avoid integer overflow. - int stride_con = cl->stride_con(); - jlong init_con = cl->init_trip()->get_int(); - jlong limit_con = cl->limit()->get_int(); - int stride_m = stride_con - (stride_con > 0 ? 1 : -1); + int stride_con = cl->stride_con(); + jlong init_con = phase->_igvn.type(init_n)->is_int()->_lo; + jlong limit_con = phase->_igvn.type(limit_n)->is_int()->_hi; + int stride_m = stride_con - (stride_con > 0 ? 1 : -1); jlong trip_count = (limit_con - init_con + stride_m)/stride_con; if (trip_count > 0 && (julong)trip_count < (julong)max_juint) { - // Set exact trip count. - cl->set_exact_trip_count((uint)trip_count); + if (init_n->is_Con() && limit_n->is_Con()) { + // Set exact trip count. + cl->set_exact_trip_count((uint)trip_count); + } else if (cl->unrolled_count() == 1) { + // Set maximum trip count before unrolling. + cl->set_trip_count((uint)trip_count); + } } } } @@ -1305,7 +1309,7 @@ Node *PhaseIdealLoop::insert_post_loop(IdealLoopTree *loop, Node_List &old_new, assert(main_exit->Opcode() == Op_IfFalse, ""); int dd_main_exit = dom_depth(main_exit); - // Step A1: Clone the loop body of main. The clone becomes the vector post-loop. + // Step A1: Clone the loop body of main. The clone becomes the post-loop. // The main loop pre-header illegally has 2 control users (old & new loops). clone_loop(loop, old_new, dd_main_exit); assert(old_new[main_end->_idx]->Opcode() == Op_CountedLoopEnd, ""); @@ -2095,8 +2099,7 @@ int PhaseIdealLoop::do_range_check( IdealLoopTree *loop, Node_List &old_new ) { // the loop is in canonical form to multiversion. closed_range_checks = 0; - // Check loop body for tests of trip-counter plus loop-invariant vs - // loop-invariant. + // Check loop body for tests of trip-counter plus loop-invariant vs loop-variant. for( uint i = 0; i < loop->_body.size(); i++ ) { Node *iff = loop->_body[i]; if (iff->Opcode() == Op_If || @@ -2298,7 +2301,7 @@ void PhaseIdealLoop::has_range_checks(IdealLoopTree *loop) { // skip this loop if it is already checked if (cl->has_been_range_checked()) return; - // Now check for existance of range checks + // Now check for existence of range checks for (uint i = 0; i < loop->_body.size(); i++) { Node *iff = loop->_body[i]; int iff_opc = iff->Opcode(); @@ -2319,7 +2322,7 @@ bool PhaseIdealLoop::multi_version_post_loops(IdealLoopTree *rce_loop, IdealLoop CountedLoopNode *legacy_cl = legacy_loop->_head->as_CountedLoop(); assert(legacy_cl->is_post_loop(), ""); - // Check for existance of range checks using the unique instance to make a guard with + // Check for existence of range checks using the unique instance to make a guard with Unique_Node_List worklist; for (uint i = 0; i < legacy_loop->_body.size(); i++) { Node *iff = legacy_loop->_body[i]; @@ -2422,7 +2425,7 @@ bool PhaseIdealLoop::multi_version_post_loops(IdealLoopTree *rce_loop, IdealLoop } //-------------------------poison_rce_post_loop-------------------------------- -// Causes the rce'd post loop to be optimized away if multiverioning fails +// Causes the rce'd post loop to be optimized away if multiversioning fails void PhaseIdealLoop::poison_rce_post_loop(IdealLoopTree *rce_loop) { CountedLoopNode *rce_cl = rce_loop->_head->as_CountedLoop(); Node* ctrl = rce_cl->in(LoopNode::EntryControl); @@ -2710,8 +2713,8 @@ bool IdealLoopTree::policy_do_one_iteration_loop( PhaseIdealLoop *phase ) { //============================================================================= //------------------------------iteration_split_impl--------------------------- bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_new ) { - // Compute exact loop trip count if possible. - compute_exact_trip_count(phase); + // Compute loop trip count if possible. + compute_trip_count(phase); // Convert one iteration loop into normal code. if (policy_do_one_iteration_loop(phase)) diff --git a/hotspot/src/share/vm/opto/loopnode.hpp b/hotspot/src/share/vm/opto/loopnode.hpp index 1e215096c1e..3419b786e03 100644 --- a/hotspot/src/share/vm/opto/loopnode.hpp +++ b/hotspot/src/share/vm/opto/loopnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, 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 @@ -520,8 +520,8 @@ public: // Return TRUE if "iff" is a range check. bool is_range_check_if(IfNode *iff, PhaseIdealLoop *phase, Invariance& invar) const; - // Compute loop exact trip count if possible - void compute_exact_trip_count( PhaseIdealLoop *phase ); + // Compute loop trip count if possible + void compute_trip_count(PhaseIdealLoop* phase); // Compute loop trip count from profile data void compute_profile_trip_cnt( PhaseIdealLoop *phase ); diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp index 993f60f7234..653d20f2d96 100644 --- a/hotspot/src/share/vm/opto/macro.cpp +++ b/hotspot/src/share/vm/opto/macro.cpp @@ -1596,8 +1596,12 @@ void PhaseMacroExpand::expand_allocate_common( // All nodes that depended on the InitializeNode for control // and memory must now depend on the MemBarNode that itself // depends on the InitializeNode - _igvn.replace_node(init_ctrl, ctrl); - _igvn.replace_node(init_mem, mem); + if (init_ctrl != NULL) { + _igvn.replace_node(init_ctrl, ctrl); + } + if (init_mem != NULL) { + _igvn.replace_node(init_mem, mem); + } } } diff --git a/hotspot/test/compiler/loopopts/TestOverunrolling.java b/hotspot/test/compiler/loopopts/TestOverunrolling.java new file mode 100644 index 00000000000..28a5759b691 --- /dev/null +++ b/hotspot/test/compiler/loopopts/TestOverunrolling.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2016, 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 8159016 + * @requires vm.gc == "Parallel" | vm.gc == "null" + * @summary Tests correct dominator information after over-unrolling a loop. + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-TieredCompilation + * -XX:-UseG1GC -XX:+UseParallelGC TestOverunrolling + */ +public class TestOverunrolling { + + public static Object test(int arg) { + Object arr[] = new Object[3]; + int lim = (arg & 3); + // The pre loop is executed for one iteration, initializing p[0]. + // The main loop is unrolled twice, initializing p[1], p[2], p[3] and p[4]. + // The p[3] and p[4] stores are always out of bounds and removed. However, + // C2 is unable to remove the "over-unrolled", dead main loop. As a result, + // there is a control path from the main loop to the post loop without a + // memory path (because the last store was replaced by TOP). We crash + // because we use a memory edge from a non-dominating region. + for (int i = 0; i < lim; ++i) { + arr[i] = new Object(); + } + // Avoid EA + return arr; + } + + public static void main(String args[]) { + for (int i = 0; i < 42; ++i) { + test(i); + } + } +} + From 490625cd8b6481c0024c6fb523233ba21abc8582 Mon Sep 17 00:00:00 2001 From: Dmitrij Pochepko Date: Mon, 27 Jun 2016 17:23:15 +0300 Subject: [PATCH 007/108] 8132318: -XX:TraceJumps is broken on Sparc Reviewed-by: kvn, thartmann --- hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp | 2 +- hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp | 3 +- hotspot/src/cpu/sparc/vm/icBuffer_sparc.cpp | 2 - .../src/cpu/sparc/vm/macroAssembler_sparc.cpp | 101 +----------------- .../src/cpu/sparc/vm/macroAssembler_sparc.hpp | 4 +- hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp | 3 +- .../src/cpu/sparc/vm/sharedRuntime_sparc.cpp | 8 +- hotspot/src/cpu/sparc/vm/sparc.ad | 9 +- .../vm/templateInterpreterGenerator_sparc.cpp | 8 +- .../src/cpu/sparc/vm/vtableStubs_sparc.cpp | 2 +- .../solaris_sparc/vm/os_solaris_sparc.cpp | 4 - hotspot/src/share/vm/opto/output.cpp | 2 +- hotspot/src/share/vm/runtime/globals.hpp | 3 - 13 files changed, 12 insertions(+), 139 deletions(-) diff --git a/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp index 9345db639e4..12b847f351c 100644 --- a/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp +++ b/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp @@ -243,7 +243,7 @@ VtableStub* VtableStubs::create_itable_stub(int vtable_index) { } int VtableStub::pd_code_size_limit(bool is_vtable_stub) { - if (TraceJumps || DebugVtables || CountCompiledCalls || VerifyOops) { + if (DebugVtables || CountCompiledCalls || VerifyOops) { return 1000; } else { int decode_klass_size = MacroAssembler::instr_size_for_decode_klass_not_null(); diff --git a/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp b/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp index 3536718fafc..46024341022 100644 --- a/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp @@ -77,8 +77,7 @@ int CompiledStaticCall::to_interp_stub_size() { // This doesn't need to be accurate but it must be larger or equal to // the real size of the stub. return (NativeMovConstReg::instruction_size + // sethi/setlo; - NativeJump::instruction_size + // sethi; jmp; nop - (TraceJumps ? 20 * BytesPerInstWord : 0) ); + NativeJump::instruction_size); // sethi; jmp; nop } // Relocation entries for call stub, compiled java to interpreter. diff --git a/hotspot/src/cpu/sparc/vm/icBuffer_sparc.cpp b/hotspot/src/cpu/sparc/vm/icBuffer_sparc.cpp index 641da12ab76..d6942f6a7ca 100644 --- a/hotspot/src/cpu/sparc/vm/icBuffer_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/icBuffer_sparc.cpp @@ -33,12 +33,10 @@ int InlineCacheBuffer::ic_stub_code_size() { #ifdef _LP64 - if (TraceJumps) return 600 * wordSize; return (NativeMovConstReg::instruction_size + // sethi;add NativeJump::instruction_size + // sethi; jmp; delay slot (1*BytesPerInstWord) + 1); // flush + 1 extra byte #else - if (TraceJumps) return 300 * wordSize; return (2+2+ 1) * wordSize + 1; // set/jump_to/nop + 1 byte so that code_end can be set in CodeBuffer #endif } diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp index 5fe78adb684..e0065402b05 100644 --- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp @@ -184,72 +184,10 @@ void MacroAssembler::null_check(Register reg, int offset) { void MacroAssembler::jmp2(Register r1, Register r2, const char* file, int line ) { assert_not_delayed(); - // This can only be traceable if r1 & r2 are visible after a window save - if (TraceJumps) { -#ifndef PRODUCT - save_frame(0); - verify_thread(); - ld(G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()), O0); - add(G2_thread, in_bytes(JavaThread::jmp_ring_offset()), O1); - sll(O0, exact_log2(4*sizeof(intptr_t)), O2); - add(O2, O1, O1); - - add(r1->after_save(), r2->after_save(), O2); - set((intptr_t)file, O3); - set(line, O4); - Label L; - // get nearby pc, store jmp target - call(L, relocInfo::none); // No relocation for call to pc+0x8 - delayed()->st(O2, O1, 0); - bind(L); - - // store nearby pc - st(O7, O1, sizeof(intptr_t)); - // store file - st(O3, O1, 2*sizeof(intptr_t)); - // store line - st(O4, O1, 3*sizeof(intptr_t)); - add(O0, 1, O0); - and3(O0, JavaThread::jump_ring_buffer_size - 1, O0); - st(O0, G2_thread, in_bytes(JavaThread::jmp_ring_index_offset())); - restore(); -#endif /* PRODUCT */ - } jmpl(r1, r2, G0); } void MacroAssembler::jmp(Register r1, int offset, const char* file, int line ) { assert_not_delayed(); - // This can only be traceable if r1 is visible after a window save - if (TraceJumps) { -#ifndef PRODUCT - save_frame(0); - verify_thread(); - ld(G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()), O0); - add(G2_thread, in_bytes(JavaThread::jmp_ring_offset()), O1); - sll(O0, exact_log2(4*sizeof(intptr_t)), O2); - add(O2, O1, O1); - - add(r1->after_save(), offset, O2); - set((intptr_t)file, O3); - set(line, O4); - Label L; - // get nearby pc, store jmp target - call(L, relocInfo::none); // No relocation for call to pc+0x8 - delayed()->st(O2, O1, 0); - bind(L); - - // store nearby pc - st(O7, O1, sizeof(intptr_t)); - // store file - st(O3, O1, 2*sizeof(intptr_t)); - // store line - st(O4, O1, 3*sizeof(intptr_t)); - add(O0, 1, O0); - and3(O0, JavaThread::jump_ring_buffer_size - 1, O0); - st(O0, G2_thread, in_bytes(JavaThread::jmp_ring_index_offset())); - restore(); -#endif /* PRODUCT */ - } jmp(r1, offset); } @@ -260,44 +198,7 @@ void MacroAssembler::jumpl(const AddressLiteral& addrlit, Register temp, Registe // variable length instruction streams. patchable_sethi(addrlit, temp); Address a(temp, addrlit.low10() + offset); // Add the offset to the displacement. - if (TraceJumps) { -#ifndef PRODUCT - // Must do the add here so relocation can find the remainder of the - // value to be relocated. - add(a.base(), a.disp(), a.base(), addrlit.rspec(offset)); - save_frame(0); - verify_thread(); - ld(G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()), O0); - add(G2_thread, in_bytes(JavaThread::jmp_ring_offset()), O1); - sll(O0, exact_log2(4*sizeof(intptr_t)), O2); - add(O2, O1, O1); - - set((intptr_t)file, O3); - set(line, O4); - Label L; - - // get nearby pc, store jmp target - call(L, relocInfo::none); // No relocation for call to pc+0x8 - delayed()->st(a.base()->after_save(), O1, 0); - bind(L); - - // store nearby pc - st(O7, O1, sizeof(intptr_t)); - // store file - st(O3, O1, 2*sizeof(intptr_t)); - // store line - st(O4, O1, 3*sizeof(intptr_t)); - add(O0, 1, O0); - and3(O0, JavaThread::jump_ring_buffer_size - 1, O0); - st(O0, G2_thread, in_bytes(JavaThread::jmp_ring_index_offset())); - restore(); - jmpl(a.base(), G0, d); -#else - jmpl(a.base(), a.disp(), d); -#endif /* PRODUCT */ - } else { - jmpl(a.base(), a.disp(), d); - } + jmpl(a.base(), a.disp(), d); } void MacroAssembler::jump(const AddressLiteral& addrlit, Register temp, int offset, const char* file, int line) { diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp index d94de09c948..a401859e774 100644 --- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp @@ -703,8 +703,8 @@ class MacroAssembler : public Assembler { inline void tst( Register s ); - inline void ret( bool trace = TraceJumps ); - inline void retl( bool trace = TraceJumps ); + inline void ret( bool trace = false ); + inline void retl( bool trace = false ); // Required platform-specific helpers for Label::patch_instructions. // They _shadow_ the declarations in AbstractAssembler, which are undefined. diff --git a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp index d17550859c0..103c712cee4 100644 --- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp @@ -760,8 +760,7 @@ void NativeJump::verify() { Register rd = inv_rd(i0); #ifndef _LP64 if (!(is_op2(i0, Assembler::sethi_op2) && rd != G0 && - (is_op3(i1, Assembler::jmpl_op3, Assembler::arith_op) || - (TraceJumps && is_op3(i1, Assembler::add_op3, Assembler::arith_op))) && + (is_op3(i1, Assembler::jmpl_op3, Assembler::arith_op)) && inv_immed(i1) && (unsigned)get_simm13(i1) < (1 << 10) && rd == inv_rs1(i1))) { fatal("not a jump_to instruction"); diff --git a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp index a587b55762e..aa54e3b91f9 100644 --- a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp @@ -3368,9 +3368,7 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t // setup code generation tools // Measured 8/7/03 at 896 in 32bit debug build (no VerifyThread) // Measured 8/7/03 at 1080 in 32bit debug build (VerifyThread) - // even larger with TraceJumps - int pad = TraceJumps ? 512 : 0; - CodeBuffer buffer("handler_blob", 1600 + pad, 512); + CodeBuffer buffer("handler_blob", 1600, 512); MacroAssembler* masm = new MacroAssembler(&buffer); int frame_size_words; OopMapSet *oop_maps = new OopMapSet(); @@ -3462,9 +3460,7 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha // setup code generation tools // Measured 8/7/03 at 896 in 32bit debug build (no VerifyThread) // Measured 8/7/03 at 1080 in 32bit debug build (VerifyThread) - // even larger with TraceJumps - int pad = TraceJumps ? 512 : 0; - CodeBuffer buffer(name, 1600 + pad, 512); + CodeBuffer buffer(name, 1600, 512); MacroAssembler* masm = new MacroAssembler(&buffer); int frame_size_words; OopMapSet *oop_maps = new OopMapSet(); diff --git a/hotspot/src/cpu/sparc/vm/sparc.ad b/hotspot/src/cpu/sparc/vm/sparc.ad index 653da26ba0b..26c22f4f4bf 100644 --- a/hotspot/src/cpu/sparc/vm/sparc.ad +++ b/hotspot/src/cpu/sparc/vm/sparc.ad @@ -501,16 +501,10 @@ class HandlerImpl { static int emit_deopt_handler(CodeBuffer& cbuf); static uint size_exception_handler() { - if (TraceJumps) { - return (400); // just a guess - } return ( NativeJump::instruction_size ); // sethi;jmp;nop } static uint size_deopt_handler() { - if (TraceJumps) { - return (400); // just a guess - } return ( 4+ NativeJump::instruction_size ); // save;sethi;jmp;restore } }; @@ -2661,8 +2655,7 @@ encode %{ // Emit stub for static call. address stub = CompiledStaticCall::emit_to_interp_stub(cbuf); - // Stub does not fit into scratch buffer if TraceJumps is enabled - if (stub == NULL && !(TraceJumps && Compile::current()->in_scratch_emit_size())) { + if (stub == NULL) { ciEnv::current()->record_failure("CodeCache is full"); return; } diff --git a/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp index 7df0e9896c1..d8973ed0281 100644 --- a/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp @@ -1560,13 +1560,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { __ bind(ok); } #endif - if (TraceJumps) { - // Move target to register that is recordable - __ mov(Lscratch, G3_scratch); - __ JMP(G3_scratch, 0); - } else { - __ jmp(Lscratch, 0); - } + __ jmp(Lscratch, 0); __ delayed()->nop(); diff --git a/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp b/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp index 4e717eebe9b..9e825aaa79e 100644 --- a/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp @@ -221,7 +221,7 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) { int VtableStub::pd_code_size_limit(bool is_vtable_stub) { - if (TraceJumps || DebugVtables || CountCompiledCalls || VerifyOops) return 1000; + if (DebugVtables || CountCompiledCalls || VerifyOops) return 1000; else { const int slop = 2*BytesPerInstWord; // sethi;add (needed for long offsets) if (is_vtable_stub) { diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp index 39663ed0e74..1d40c014485 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp +++ b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp @@ -545,10 +545,6 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, // factor me: setPC os::Solaris::ucontext_set_pc(uc, stub); -#ifndef PRODUCT - if (TraceJumps) thread->record_jump(stub, NULL, __FILE__, __LINE__); -#endif /* PRODUCT */ - return true; } diff --git a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp index 39f4abd80b6..312bbf8161e 100644 --- a/hotspot/src/share/vm/opto/output.cpp +++ b/hotspot/src/share/vm/opto/output.cpp @@ -952,7 +952,7 @@ CodeBuffer* Compile::init_buffer(uint* blk_starts) { // Set the initially allocated size int code_req = initial_code_capacity; int locs_req = initial_locs_capacity; - int stub_req = TraceJumps ? initial_stub_capacity * 10 : initial_stub_capacity; + int stub_req = initial_stub_capacity; int const_req = initial_const_capacity; int pad_req = NativeCall::instruction_size; diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index e54ea9abb8b..4bbcf6e5b51 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -802,9 +802,6 @@ public: develop(bool, TracePcPatching, false, \ "Trace usage of frame::patch_pc") \ \ - develop(bool, TraceJumps, false, \ - "Trace assembly jumps in thread ring buffer") \ - \ develop(bool, TraceRelocator, false, \ "Trace the bytecode relocator") \ \ From f1d61f43405dc56203e7b299dba46ed69008306e Mon Sep 17 00:00:00 2001 From: Tatiana Pivovarova Date: Tue, 28 Jun 2016 19:58:15 +0300 Subject: [PATCH 008/108] 8143081: [ctw] Test CompileTheWorld.java needs to be updated for Jigsaw Reviewed-by: iignatyev --- .../bmi/verifycode/BmiIntrinsicBase.java | 2 + hotspot/test/testlibrary/ctw/Makefile | 36 +++--- .../hotspot/tools/ctw/ClassPathDirEntry.java | 2 +- .../hotspot/tools/ctw/ClassPathJarEntry.java | 2 +- .../tools/ctw/ClassPathJarInDirEntry.java | 2 +- .../tools/ctw/ClassPathJimageEntry.java | 68 +++++++++++ .../hotspot/tools/ctw/ClassesListInFile.java | 2 +- .../hotspot/tools/ctw/CompileTheWorld.java | 46 +++----- .../src/sun/hotspot/tools/ctw/Compiler.java | 111 +++++++----------- .../sun/hotspot/tools/ctw/PathHandler.java | 61 ++++++++-- .../ctw/src/sun/hotspot/tools/ctw/Utils.java | 11 +- 11 files changed, 213 insertions(+), 130 deletions(-) create mode 100644 hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJimageEntry.java diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java index 8ecb518c34a..34765bfbbe3 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java @@ -28,6 +28,8 @@ import jdk.test.lib.Utils; import sun.hotspot.code.NMethod; import sun.hotspot.cpuinfo.CPUInfo; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodType; import java.lang.reflect.Executable; import java.lang.reflect.Method; import java.util.concurrent.Callable; diff --git a/hotspot/test/testlibrary/ctw/Makefile b/hotspot/test/testlibrary/ctw/Makefile index a4fc46264e4..ed63271e91a 100644 --- a/hotspot/test/testlibrary/ctw/Makefile +++ b/hotspot/test/testlibrary/ctw/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2016. 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 @@ -35,12 +35,13 @@ endif SRC_DIR = src BUILD_DIR = build OUTPUT_DIR = $(BUILD_DIR)/classes -WHITEBOX_DIR = ../whitebox +TESTLIBRARY_DIR = ../../../../test/lib JAVAC = $(JDK_HOME)/bin/javac JAR = $(JDK_HOME)/bin/jar -SRC_FILES = $(shell find $(SRC_DIR) -name '*.java') +SRC_FILES = $(shell find $(SRC_DIR) $(TESTLIBRARY_DIR)/share/classes -name '*.java') +WB_SRC_FILES = $(shell find $(TESTLIBRARY_DIR)/sun/hotspot -name '*.java') MAIN_CLASS = sun.hotspot.tools.ctw.CompileTheWorld @@ -52,22 +53,29 @@ clean: cleantmp @rm -rf ctw.jar wb.jar cleantmp: - @rm -rf filelist manifest.mf + @rm -rf filelist wb_filelist manifest.mf @rm -rf $(BUILD_DIR) -ctw.jar: filelist wb.jar manifest.mf +ctw.jar: filelist wb.jar @mkdir -p $(OUTPUT_DIR) - $(JAVAC) -sourcepath $(SRC_DIR) -d $(OUTPUT_DIR) -cp wb.jar @filelist - $(JAR) cfm ctw.jar manifest.mf -C $(OUTPUT_DIR) . + $(JAVAC) -XaddExports:java.base/jdk.internal.jimage=ALL-UNNAMED \ + -XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED \ + -XaddExports:java.base/jdk.internal.reflect=ALL-UNNAMED \ + -sourcepath $(SRC_DIR) -d $(OUTPUT_DIR) -cp wb.jar @filelist + $(JAR) --create --file=$@ --main-class $(MAIN_CLASS) -C $(OUTPUT_DIR) . -wb.jar: - make -C ${WHITEBOX_DIR} wb.jar - cp ${WHITEBOX_DIR}/wb.jar ./ - make -C ${WHITEBOX_DIR} clean +wb.jar: wb_filelist + @mkdir -p $(OUTPUT_DIR) + $(JAVAC) -sourcepath $(TESTLIBRARY_DIR) \ + -d $(OUTPUT_DIR) \ + -cp $(OUTPUT_DIR) \ + @wb_filelist + $(JAR) --create --file=$@ -C $(OUTPUT_DIR) . + +wb_filelist: $(WB_SRC_FILES) + @rm -f $@ + @echo $(WB_SRC_FILES) > $@ filelist: $(SRC_FILES) @rm -f $@ @echo $(SRC_FILES) > $@ - -manifest.mf: - @echo "Main-Class: ${MAIN_CLASS}" > manifest.mf diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathDirEntry.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathDirEntry.java index b1e8fe294f4..bafe2dd1532 100644 --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathDirEntry.java +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathDirEntry.java @@ -54,7 +54,7 @@ public class ClassPathDirEntry extends PathHandler { @Override public void process() { - System.out.println("# dir: " + root); + CompileTheWorld.OUT.println("# dir: " + root); if (!Files.exists(root)) { return; } diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarEntry.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarEntry.java index a639a637159..bf72bc60764 100644 --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarEntry.java +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarEntry.java @@ -50,7 +50,7 @@ public class ClassPathJarEntry extends PathHandler { @Override public void process() { - System.out.println("# jar: " + root); + CompileTheWorld.OUT.println("# jar: " + root); if (!Files.exists(root)) { return; } diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarInDirEntry.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarInDirEntry.java index a9f7c8a964e..c9bdcb19f08 100644 --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarInDirEntry.java +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarInDirEntry.java @@ -40,7 +40,7 @@ public class ClassPathJarInDirEntry extends PathHandler { @Override public void process() { - System.out.println("# jar_in_dir: " + root); + CompileTheWorld.OUT.println("# jar_in_dir: " + root); if (!Files.exists(root)) { return; } diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJimageEntry.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJimageEntry.java new file mode 100644 index 00000000000..7043e4b4ac2 --- /dev/null +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJimageEntry.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016, 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. + */ + +package sun.hotspot.tools.ctw; + +import jdk.internal.jimage.ImageReader; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.concurrent.Executor; + +/** + * Handler for jimage-files containing classes to compile. + */ +public class ClassPathJimageEntry extends PathHandler { + public ClassPathJimageEntry(Path root, Executor executor) { + super(root, executor); + try { + URL url = root.toUri().toURL(); + setLoader(new URLClassLoader(new URL[]{url})); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + } + + @Override + public void process() { + CompileTheWorld.OUT.println("# jimage: " + root); + if (!Files.exists(root)) { + return; + } + try { + ImageReader reader = ImageReader.open(root); + Arrays.stream(reader.getEntryNames()) + .filter(name -> name.endsWith(".class")) + .filter(name -> !name.endsWith("module-info.class")) + .map(Utils::fileNameToClassName) + .forEach(this::processClass); + } catch (IOException ioe) { + ioe.printStackTrace(); + } + } +} diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassesListInFile.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassesListInFile.java index d25364ad561..7c810dd3840 100644 --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassesListInFile.java +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassesListInFile.java @@ -40,7 +40,7 @@ public class ClassesListInFile extends PathHandler { @Override public void process() { - System.out.println("# list: " + root); + CompileTheWorld.OUT.println("# list: " + root); if (!Files.exists(root)) { return; } diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java index b398ea1cbc8..f9703223cbd 100644 --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -33,14 +33,20 @@ import java.util.List; import java.util.concurrent.*; public class CompileTheWorld { + // in case when a static constructor changes System::out and System::err + // we hold these values of output streams + public static final PrintStream OUT = System.out; + public static final PrintStream ERR = System.err; /** - * Entry point. Compiles classes in {@code args}, or all classes in - * boot-classpath if args is empty + * Entry point. Compiles classes in {@code paths} * - * @param args paths to jar/zip, dir contains classes, or to .lst file - * contains list of classes to compile + * @param paths paths to jar/zip, dir contains classes, or to .lst file + * contains list of classes to compile */ - public static void main(String[] args) { + public static void main(String[] paths) { + if (paths.length == 0) { + throw new IllegalArgumentException("Expect a path to a compile target."); + } String logfile = Utils.LOG_FILE; PrintStream os = null; if (logfile != null) { @@ -62,12 +68,6 @@ public class CompileTheWorld { } catch (java.lang.NoClassDefFoundError e) { // compact1, compact2 support } - String[] paths = args; - boolean skipRtJar = false; - if (args.length == 0) { - paths = getDefaultPaths(); - skipRtJar = true; - } ExecutorService executor = createExecutor(); long start = System.currentTimeMillis(); try { @@ -75,17 +75,13 @@ public class CompileTheWorld { for (int i = 0, n = paths.length; i < n && !PathHandler.isFinished(); ++i) { path = paths[i]; - if (skipRtJar && i > 0 && isRtJar(path)) { - // rt.jar is not first, so skip it - continue; - } PathHandler.create(path, executor).process(); } } finally { await(executor); } - System.out.printf("Done (%d classes, %d methods, %d ms)%n", - Compiler.getClassCount(), + CompileTheWorld.OUT.printf("Done (%d classes, %d methods, %d ms)%n", + PathHandler.getClassCount(), Compiler.getMethodCount(), System.currentTimeMillis() - start); } finally { @@ -93,6 +89,9 @@ public class CompileTheWorld { os.close(); } } + // in case when a static constructor creates and runs a new thread + // we force it to exit + System.exit(0); } private static ExecutorService createExecutor() { @@ -111,13 +110,6 @@ public class CompileTheWorld { return result; } - private static String[] getDefaultPaths() { - String property = System.getProperty("sun.boot.class.path"); - System.out.println( - "# use 'sun.boot.class.path' as args: " + property); - return Utils.PATH_SEPARATOR.split(property); - } - private static void await(ExecutorService executor) { executor.shutdown(); while (!executor.isTerminated()) { @@ -130,10 +122,6 @@ public class CompileTheWorld { } } - private static boolean isRtJar(String path) { - return Utils.endsWithIgnoreCase(path, File.separator + "rt.jar"); - } - private static class CurrentThreadExecutor extends AbstractExecutorService { private boolean isShutdown; diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java index 96b627a3e4e..3a75e3c06f7 100644 --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java @@ -26,7 +26,6 @@ package sun.hotspot.tools.ctw; import sun.hotspot.WhiteBox; import jdk.internal.misc.SharedSecrets; import jdk.internal.reflect.ConstantPool; - import java.lang.reflect.Executable; import java.util.Objects; @@ -38,18 +37,11 @@ import java.util.concurrent.atomic.AtomicLong; * Also contains compiled methods and classes counters. */ public class Compiler { - private Compiler() { } - private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); - private static final AtomicLong CLASS_COUNT = new AtomicLong(0L); - private static final AtomicLong METHOD_COUNT = new AtomicLong(0L); - private static volatile boolean CLASSES_LIMIT_REACHED = false; - /** - * @return count of processed classes - */ - public static long getClassCount() { - return CLASS_COUNT.get(); - } + private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); + private static final AtomicLong METHOD_COUNT = new AtomicLong(0L); + + private Compiler() { } /** * @return count of processed methods @@ -58,59 +50,42 @@ public class Compiler { return METHOD_COUNT.get(); } - /** - * @return {@code true} if classes limit is reached - */ - public static boolean isLimitReached() { - return CLASSES_LIMIT_REACHED; - } - /** * Compiles all methods and constructors. * * @param aClass class to compile + * @param id an id of the class * @param executor executor used for compile task invocation * @throws NullPointerException if {@code class} or {@code executor} * is {@code null} */ - public static void compileClass(Class aClass, Executor executor) { + public static void compileClass(Class aClass, long id, Executor executor) { Objects.requireNonNull(aClass); Objects.requireNonNull(executor); - long id = CLASS_COUNT.incrementAndGet(); - if (id > Utils.COMPILE_THE_WORLD_STOP_AT) { - CLASS_COUNT.decrementAndGet(); - CLASSES_LIMIT_REACHED = true; - return; - } - - if (id >= Utils.COMPILE_THE_WORLD_START_AT) { - String name = aClass.getName(); - try { - System.out.printf("[%d]\t%s%n", id, name); - ConstantPool constantPool = SharedSecrets.getJavaLangAccess(). - getConstantPool(aClass); - if (Utils.COMPILE_THE_WORLD_PRELOAD_CLASSES) { - preloadClasses(name, id, constantPool); - } - long methodCount = 0; - for (Executable e : aClass.getDeclaredConstructors()) { - ++methodCount; - executor.execute(new CompileMethodCommand(id, name, e)); - } - for (Executable e : aClass.getDeclaredMethods()) { - ++methodCount; - executor.execute(new CompileMethodCommand(id, name, e)); - } - METHOD_COUNT.addAndGet(methodCount); - - if (Utils.DEOPTIMIZE_ALL_CLASSES_RATE > 0 - && (id % Utils.DEOPTIMIZE_ALL_CLASSES_RATE == 0)) { - WHITE_BOX.deoptimizeAll(); - } - } catch (Throwable t) { - System.out.printf("[%d]\t%s\tskipping %s%n", id, name, t); - t.printStackTrace(); + try { + ConstantPool constantPool = SharedSecrets.getJavaLangAccess(). + getConstantPool(aClass); + if (Utils.COMPILE_THE_WORLD_PRELOAD_CLASSES) { + preloadClasses(aClass.getName(), id, constantPool); } + long methodCount = 0; + for (Executable e : aClass.getDeclaredConstructors()) { + ++methodCount; + executor.execute(new CompileMethodCommand(id, e)); + } + for (Executable e : aClass.getDeclaredMethods()) { + ++methodCount; + executor.execute(new CompileMethodCommand(id, e)); + } + METHOD_COUNT.addAndGet(methodCount); + + if (Utils.DEOPTIMIZE_ALL_CLASSES_RATE > 0 + && (id % Utils.DEOPTIMIZE_ALL_CLASSES_RATE == 0)) { + WHITE_BOX.deoptimizeAll(); + } + } catch (Throwable t) { + CompileTheWorld.OUT.printf("[%d]\t%s\tskipping %s%n", id, aClass.getName(), t); + t.printStackTrace(); } } @@ -124,8 +99,8 @@ public class Compiler { } } } catch (Throwable t) { - System.out.printf("[%d]\t%s\tpreloading failed : %s%n", id, - className, t); + CompileTheWorld.OUT.printf("[%d]\t%s\tpreloading failed : %s%n", + id, className, t); } } @@ -142,13 +117,11 @@ public class Compiler { /** * @param classId id of class - * @param className name of class * @param method compiled for compilation */ - public CompileMethodCommand(long classId, String className, - Executable method) { + public CompileMethodCommand(long classId, Executable method) { this.classId = classId; - this.className = className; + this.className = method.getDeclaringClass().getName(); this.method = method; } @@ -158,10 +131,10 @@ public class Compiler { if (Utils.TIERED_COMPILATION) { for (int i = compLevel; i <= Utils.TIERED_STOP_AT_LEVEL; ++i) { WHITE_BOX.deoptimizeMethod(method); - compileMethod(method, i); + compileAtLevel(i); } } else { - compileMethod(method, compLevel); + compileAtLevel(compLevel); } } @@ -183,29 +156,29 @@ public class Compiler { } } - private void compileMethod(Executable method, int compLevel) { + private void compileAtLevel(int compLevel) { if (WHITE_BOX.isMethodCompilable(method, compLevel)) { try { WHITE_BOX.enqueueMethodForCompilation(method, compLevel); waitCompilation(); int tmp = WHITE_BOX.getMethodCompilationLevel(method); if (tmp != compLevel) { - logMethod(method, "compilation level = " + tmp + log("compilation level = " + tmp + ", but not " + compLevel); } else if (Utils.IS_VERBOSE) { - logMethod(method, "compilation level = " + tmp + ". OK"); + log("compilation level = " + tmp + ". OK"); } } catch (Throwable t) { - logMethod(method, "error on compile at " + compLevel + log("error on compile at " + compLevel + " level"); t.printStackTrace(); } } else if (Utils.IS_VERBOSE) { - logMethod(method, "not compilable at " + compLevel); + log("not compilable at " + compLevel); } } - private void logMethod(Executable method, String message) { + private void log(String message) { StringBuilder builder = new StringBuilder("["); builder.append(classId); builder.append("]\t"); @@ -226,7 +199,7 @@ public class Compiler { builder.append('\t'); builder.append(message); } - System.err.println(builder); + CompileTheWorld.ERR.println(builder); } } diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java index 04b23e75770..cfc9df26a1a 100644 --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -23,12 +23,14 @@ package sun.hotspot.tools.ctw; +import jdk.internal.misc.Unsafe; + import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.io.File; import java.util.Objects; +import java.util.concurrent.atomic.AtomicLong; import java.util.regex.Pattern; import java.util.regex.Matcher; import java.util.concurrent.Executor; @@ -38,6 +40,8 @@ import java.util.concurrent.Executor; * Concrete subclasses should implement method {@link #process()}. */ public abstract class PathHandler { + private static final AtomicLong CLASS_COUNT = new AtomicLong(0L); + private static volatile boolean CLASSES_LIMIT_REACHED = false; private static final Pattern JAR_IN_DIR_PATTERN = Pattern.compile("^(.*[/\\\\])?\\*$"); protected final Path root; @@ -81,6 +85,8 @@ public abstract class PathHandler { return new ClassPathJarEntry(p, executor); } else if (isListFile(p)) { return new ClassesListInFile(p, executor); + } else if (isJimageFile(p)) { + return new ClassPathJimageEntry(p, executor); } else { return new ClassPathDirEntry(p, executor); } @@ -96,6 +102,13 @@ public abstract class PathHandler { return false; } + private static boolean isJimageFile(Path path) { + String filename = path.getFileName().toString(); + return Files.isRegularFile(path) + && ("modules".equals(filename) + || Utils.endsWithIgnoreCase(filename, ".jimage")); + } + private static boolean isListFile(Path path) { if (Files.isRegularFile(path)) { String name = path.toString(); @@ -122,24 +135,50 @@ public abstract class PathHandler { } /** - * Processes specificed class. + * Processes specified class. * @param name fully qualified name of class to process */ protected final void processClass(String name) { - try { - Class aClass = Class.forName(name, true, loader); - Compiler.compileClass(aClass, executor); - } catch (ClassNotFoundException | LinkageError e) { - System.out.printf("Class %s loading failed : %s%n", name, - e.getMessage()); + Objects.requireNonNull(name); + if (CLASSES_LIMIT_REACHED) { + return; + } + long id = CLASS_COUNT.incrementAndGet(); + if (id > Utils.COMPILE_THE_WORLD_STOP_AT) { + CLASSES_LIMIT_REACHED = true; + return; + } + if (id >= Utils.COMPILE_THE_WORLD_START_AT) { + try { + Class aClass = loader.loadClass(name); + CompileTheWorld.OUT.printf("[%d]\t%s%n", id, name); + Compiler.compileClass(aClass, id, executor); + } catch (ClassNotFoundException e) { + CompileTheWorld.OUT.printf("Class %s loading failed : %s%n", + name, e.getMessage()); + } } } /** - * @return {@code true} if processing should be stopped + * @return count of processed classes + */ + public static long getClassCount() { + long id = CLASS_COUNT.get(); + if (id < Utils.COMPILE_THE_WORLD_START_AT) { + return 0; + } + if (id > Utils.COMPILE_THE_WORLD_STOP_AT) { + return Utils.COMPILE_THE_WORLD_STOP_AT - Utils.COMPILE_THE_WORLD_START_AT + 1; + } + return id - Utils.COMPILE_THE_WORLD_START_AT + 1; + } + + /** + * @return {@code true} if classes limit is reached and processing should be stopped */ public static boolean isFinished() { - return Compiler.isLimitReached(); + return CLASSES_LIMIT_REACHED; } } diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java index 4e98bd8582e..4159c483408 100644 --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -207,7 +207,12 @@ public class Utils { */ public static String fileNameToClassName(String filename) { assert isClassFile(filename); - return filename.substring(0, filename.length() - CLASSFILE_EXT.length()) - .replace(File.separatorChar, '.'); + // workaround for the class naming in jimage : // + final char nameSeparator = '/'; + int nameStart = filename.charAt(0) == nameSeparator + ? filename.indexOf(nameSeparator, 1) + 1 + : 0; + return filename.substring(nameStart, filename.length() - CLASSFILE_EXT.length()) + .replace(nameSeparator, '.'); } } From b4aef2060bde93d7aab5aacdb9ab9d11ff95aadd Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Tue, 28 Jun 2016 17:22:56 +0000 Subject: [PATCH 009/108] 8160121: [JVMCI] JvmciNotifyBootstrapFinishedEventTest.java failed NoClassDefFoundError: jdk/vm/ci/runtime/JVMCI Reviewed-by: kvn --- hotspot/src/share/vm/compiler/compileBroker.cpp | 11 ----------- hotspot/src/share/vm/jvmci/jvmciRuntime.cpp | 11 +++++++++++ hotspot/src/share/vm/jvmci/jvmciRuntime.hpp | 3 +++ .../src/share/vm/runtime/simpleThresholdPolicy.cpp | 11 ++++++++--- hotspot/src/share/vm/runtime/thread.cpp | 7 +++++++ .../events/JvmciNotifyBootstrapFinishedEventTest.java | 2 ++ .../jvmci/events/JvmciNotifyInstallEventTest.java | 2 ++ .../compiler/jvmci/events/JvmciShutdownEventTest.java | 2 ++ 8 files changed, 35 insertions(+), 14 deletions(-) diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp index d49c0802729..fee070e250a 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.cpp +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp @@ -551,17 +551,6 @@ void CompileBroker::compilation_init(TRAPS) { } else { c1_count = JVMCIHostThreads; } - - if (!UseInterpreter || !BackgroundCompilation) { - // Force initialization of JVMCI compiler otherwise JVMCI - // compilations will not block until JVMCI is initialized - ResourceMark rm; - TempNewSymbol getCompiler = SymbolTable::new_symbol("getCompiler", CHECK); - TempNewSymbol sig = SymbolTable::new_symbol("()Ljdk/vm/ci/runtime/JVMCICompiler;", CHECK); - Handle jvmciRuntime = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK); - JavaValue result(T_OBJECT); - JavaCalls::call_virtual(&result, jvmciRuntime, HotSpotJVMCIRuntime::klass(), getCompiler, sig, CHECK); - } } } #endif // INCLUDE_JVMCI diff --git a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp index 6bb862ecf24..970a588aabf 100644 --- a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp +++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp @@ -612,6 +612,17 @@ JRT_ENTRY(jint, JVMCIRuntime::test_deoptimize_call_int(JavaThread* thread, int v return value; JRT_END +void JVMCIRuntime::force_initialization(TRAPS) { + JVMCIRuntime::initialize_well_known_classes(CHECK); + + ResourceMark rm; + TempNewSymbol getCompiler = SymbolTable::new_symbol("getCompiler", CHECK); + TempNewSymbol sig = SymbolTable::new_symbol("()Ljdk/vm/ci/runtime/JVMCICompiler;", CHECK); + Handle jvmciRuntime = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK); + JavaValue result(T_OBJECT); + JavaCalls::call_virtual(&result, jvmciRuntime, HotSpotJVMCIRuntime::klass(), getCompiler, sig, CHECK); +} + // private static JVMCIRuntime JVMCI.initializeRuntime() JVM_ENTRY(jobject, JVM_GetJVMCIRuntime(JNIEnv *env, jclass c)) if (!EnableJVMCI) { diff --git a/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp b/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp index bf7b59e1566..cdc5957e635 100644 --- a/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp +++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp @@ -157,6 +157,9 @@ class JVMCIRuntime: public AllStatic { static void throw_klass_external_name_exception(JavaThread* thread, const char* exception, Klass* klass); static void throw_class_cast_exception(JavaThread* thread, const char* exception, Klass* caster_klass, Klass* target_klass); + // Forces initialization of the JVMCI runtime. + static void force_initialization(TRAPS); + // Test only function static int test_deoptimize_call_int(JavaThread* thread, int value); }; diff --git a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp index 4fbfd0033f9..5850dfc2251 100644 --- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp +++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp @@ -238,9 +238,14 @@ void SimpleThresholdPolicy::compile(const methodHandle& mh, int bci, CompLevel l } #if INCLUDE_JVMCI - // We can't compile with a JVMCI compiler until the module system is initialized. - if (level == CompLevel_full_optimization && UseJVMCICompiler && !Universe::is_module_initialized()) { - return; + // We can't compile with a JVMCI compiler until the module system is initialized past + // phase 3. The JVMCI API itself isn't available until phase 2 and ServiceLoader isn't + // usable until after phase 3. + if (level == CompLevel_full_optimization && EnableJVMCI && UseJVMCICompiler) { + if (SystemDictionary::java_system_loader() == NULL) { + return; + } + assert(Universe::is_module_initialized(), "must be"); } #endif diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 588c263a345..3dfc97f9bf8 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -3770,6 +3770,13 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { // Final system initialization including security manager and system class loader call_initPhase3(CHECK_JNI_ERR); +#if INCLUDE_JVMCI + if (EnableJVMCI && UseJVMCICompiler && (!UseInterpreter || !BackgroundCompilation)) { + // 8145270: Force initialization of JVMCI runtime otherwise requests for blocking + // compilations via JVMCI will not actually block until JVMCI is initialized. + JVMCIRuntime::force_initialization(CHECK_JNI_ERR); + } +#endif // cache the system class loader SystemDictionary::compute_java_system_loader(CHECK_(JNI_ERR)); diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java index 54d95182792..3486e323b52 100644 --- a/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java +++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java @@ -43,6 +43,8 @@ * @run main ClassFileInstaller * compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler * compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory + * compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult + * compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener * compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest * jdk.test.lib.Asserts * jdk.test.lib.Utils diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java index b6c47bfb342..3a2a4a799fc 100644 --- a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java +++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java @@ -44,6 +44,8 @@ * @run main ClassFileInstaller * compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler * compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory + * compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult + * compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener * compiler.jvmci.events.JvmciNotifyInstallEventTest * compiler.jvmci.common.CTVMUtilities * compiler.jvmci.common.testcases.SimpleClass diff --git a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java index 744ddc61bd5..c36896a84ec 100644 --- a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java +++ b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java @@ -40,6 +40,8 @@ * @run main ClassFileInstaller * compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler * compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory + * compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult + * compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener * compiler.jvmci.events.JvmciShutdownEventListener * @run main/othervm compiler.jvmci.events.JvmciShutdownEventTest */ From 27cd22b69a7eacec9ff8bb57b3ac37a8c6f371f9 Mon Sep 17 00:00:00 2001 From: Ed Nevill Date: Wed, 29 Jun 2016 11:24:13 +0000 Subject: [PATCH 010/108] 8160534: aarch64: fails to build after 8157834 Add missing #include Reviewed-by: aph --- hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp index f8e4c851600..094b0e55f39 100644 --- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp @@ -36,6 +36,7 @@ #include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" #include "opto/compile.hpp" +#include "opto/intrinsicnode.hpp" #include "opto/node.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/icache.hpp" From 8caad345fd0f8aa9fc4c20f8660eb157fd2e4e42 Mon Sep 17 00:00:00 2001 From: Tatiana Pivovarova Date: Wed, 29 Jun 2016 14:32:13 +0300 Subject: [PATCH 011/108] 8153515: [ctw] CompileTheWorld testlibrary should trigger compilation of and Reviewed-by: thartmann --- .../testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java | 5 +++++ .../ctw/src/sun/hotspot/tools/ctw/PathHandler.java | 2 ++ 2 files changed, 7 insertions(+) diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java index 3a75e3c06f7..e546f2e6722 100644 --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java @@ -68,6 +68,11 @@ public class Compiler { if (Utils.COMPILE_THE_WORLD_PRELOAD_CLASSES) { preloadClasses(aClass.getName(), id, constantPool); } + int startLevel = Utils.INITIAL_COMP_LEVEL; + int endLevel = Utils.TIERED_COMPILATION ? Utils.TIERED_STOP_AT_LEVEL : startLevel; + for (int i = startLevel; i <= endLevel; ++i) { + WHITE_BOX.enqueueInitializerForCompilation(aClass, i); + } long methodCount = 0; for (Executable e : aClass.getDeclaredConstructors()) { ++methodCount; diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java index cfc9df26a1a..07e71b94042 100644 --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java @@ -40,6 +40,7 @@ import java.util.concurrent.Executor; * Concrete subclasses should implement method {@link #process()}. */ public abstract class PathHandler { + private static final Unsafe UNSAFE = jdk.test.lib.Utils.getUnsafe(); private static final AtomicLong CLASS_COUNT = new AtomicLong(0L); private static volatile boolean CLASSES_LIMIT_REACHED = false; private static final Pattern JAR_IN_DIR_PATTERN @@ -151,6 +152,7 @@ public abstract class PathHandler { if (id >= Utils.COMPILE_THE_WORLD_START_AT) { try { Class aClass = loader.loadClass(name); + UNSAFE.ensureClassInitialized(aClass); CompileTheWorld.OUT.printf("[%d]\t%s%n", id, name); Compiler.compileClass(aClass, id, executor); } catch (ClassNotFoundException e) { From 320a29cbe454b7406cca011ea3ab06c75d7b13d9 Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Wed, 29 Jun 2016 18:04:04 +0300 Subject: [PATCH 012/108] 8160471: compiler/rangechecks/TestRangeCheckEliminationDisabled.java fails after JDK-8150900 Add UnlockDiagnosticVMOptions to the test Reviewed-by: kvn, thartmann --- .../rangechecks/TestRangeCheckEliminationDisabled.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java b/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java index 288af4ddca1..2712c5afc6e 100644 --- a/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java +++ b/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java @@ -26,7 +26,9 @@ * @test TestRangeCheckEliminationDisabled * @bug 8154763 * @summary Tests PostLoopMultiversioning with RangeCheckElimination disabled. - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+PostLoopMultiversioning -XX:-RangeCheckElimination TestRangeCheckEliminationDisabled + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions + * -XX:+PostLoopMultiversioning -XX:-RangeCheckElimination + * TestRangeCheckEliminationDisabled */ public class TestRangeCheckEliminationDisabled { From d99ab903b7edae9a22b6b6618c04d7f56644355d Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Thu, 30 Jun 2016 08:24:51 +0200 Subject: [PATCH 013/108] 8160425: Vectorization with signalling NaN returns wrong result Should not use doubles/floats for vector constants in the C code. Reviewed-by: kvn, vlivanov --- hotspot/src/cpu/sparc/vm/sparc.ad | 10 +-- hotspot/src/cpu/x86/vm/x86.ad | 10 +-- hotspot/src/share/vm/asm/assembler.hpp | 9 ++ hotspot/src/share/vm/opto/compile.cpp | 3 + hotspot/src/share/vm/opto/compile.hpp | 9 ++ .../compiler/vectorization/TestNaNVector.java | 84 +++++++++++++++++++ 6 files changed, 113 insertions(+), 12 deletions(-) create mode 100644 hotspot/test/compiler/vectorization/TestNaNVector.java diff --git a/hotspot/src/cpu/sparc/vm/sparc.ad b/hotspot/src/cpu/sparc/vm/sparc.ad index 26c22f4f4bf..f0a897f157e 100644 --- a/hotspot/src/cpu/sparc/vm/sparc.ad +++ b/hotspot/src/cpu/sparc/vm/sparc.ad @@ -714,7 +714,7 @@ intptr_t get_offset_from_base_2(const MachNode* n, const TypePtr* atype, int dis return offset; } -static inline jdouble replicate_immI(int con, int count, int width) { +static inline jlong replicate_immI(int con, int count, int width) { // Load a constant replicated "count" times with width "width" assert(count*width == 8 && width <= 4, "sanity"); int bit_width = width * 8; @@ -723,17 +723,15 @@ static inline jdouble replicate_immI(int con, int count, int width) { for (int i = 0; i < count - 1; i++) { val |= (val << bit_width); } - jdouble dval = *((jdouble*) &val); // coerce to double type - return dval; + return val; } -static inline jdouble replicate_immF(float con) { +static inline jlong replicate_immF(float con) { // Replicate float con 2 times and pack into vector. int val = *((int*)&con); jlong lval = val; lval = (lval << 32) | (lval & 0xFFFFFFFFl); - jdouble dval = *((jdouble*) &lval); // coerce to double type - return dval; + return lval; } // Standard Sparc opcode form2 field breakdown diff --git a/hotspot/src/cpu/x86/vm/x86.ad b/hotspot/src/cpu/x86/vm/x86.ad index 17abe70af79..b12c979996b 100644 --- a/hotspot/src/cpu/x86/vm/x86.ad +++ b/hotspot/src/cpu/x86/vm/x86.ad @@ -2131,7 +2131,7 @@ static int vec_spill_helper(CodeBuffer *cbuf, bool do_size, bool is_load, return size+offset_size; } -static inline jfloat replicate4_imm(int con, int width) { +static inline jint replicate4_imm(int con, int width) { // Load a constant of "width" (in bytes) and replicate it to fill 32bit. assert(width == 1 || width == 2, "only byte or short types here"); int bit_width = width * 8; @@ -2141,11 +2141,10 @@ static inline jfloat replicate4_imm(int con, int width) { val |= (val << bit_width); bit_width <<= 1; } - jfloat fval = *((jfloat*) &val); // coerce to float type - return fval; + return val; } -static inline jdouble replicate8_imm(int con, int width) { +static inline jlong replicate8_imm(int con, int width) { // Load a constant of "width" (in bytes) and replicate it to fill 64bit. assert(width == 1 || width == 2 || width == 4, "only byte, short or int types here"); int bit_width = width * 8; @@ -2155,8 +2154,7 @@ static inline jdouble replicate8_imm(int con, int width) { val |= (val << bit_width); bit_width <<= 1; } - jdouble dval = *((jdouble*) &val); // coerce to double type - return dval; + return val; } #ifndef PRODUCT diff --git a/hotspot/src/share/vm/asm/assembler.hpp b/hotspot/src/share/vm/asm/assembler.hpp index 2ef9d993721..ee2fcf6b947 100644 --- a/hotspot/src/share/vm/asm/assembler.hpp +++ b/hotspot/src/share/vm/asm/assembler.hpp @@ -337,6 +337,15 @@ class AbstractAssembler : public ResourceObj { // // We must remember the code section (insts or stubs) in c1 // so we can reset to the proper section in end_a_const(). + address int_constant(jint c) { + CodeSection* c1 = _code_section; + address ptr = start_a_const(sizeof(c), sizeof(c)); + if (ptr != NULL) { + emit_int32(c); + end_a_const(c1); + } + return ptr; + } address long_constant(jlong c) { CodeSection* c1 = _code_section; address ptr = start_a_const(sizeof(c), sizeof(c)); diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index 9946071c5f0..7824b118b22 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -3814,6 +3814,7 @@ bool Compile::Constant::operator==(const Constant& other) { if (can_be_reused() != other.can_be_reused()) return false; // For floating point values we compare the bit pattern. switch (type()) { + case T_INT: case T_FLOAT: return (_v._value.i == other._v._value.i); case T_LONG: case T_DOUBLE: return (_v._value.j == other._v._value.j); @@ -3828,6 +3829,7 @@ bool Compile::Constant::operator==(const Constant& other) { static int type_to_size_in_bytes(BasicType t) { switch (t) { + case T_INT: return sizeof(jint ); case T_LONG: return sizeof(jlong ); case T_FLOAT: return sizeof(jfloat ); case T_DOUBLE: return sizeof(jdouble); @@ -3896,6 +3898,7 @@ void Compile::ConstantTable::emit(CodeBuffer& cb) { Constant con = _constants.at(i); address constant_addr = NULL; switch (con.type()) { + case T_INT: constant_addr = _masm.int_constant( con.get_jint() ); break; case T_LONG: constant_addr = _masm.long_constant( con.get_jlong() ); break; case T_FLOAT: constant_addr = _masm.float_constant( con.get_jfloat() ); break; case T_DOUBLE: constant_addr = _masm.double_constant(con.get_jdouble()); break; diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp index 79575dc3e91..f2f8c4630db 100644 --- a/hotspot/src/share/vm/opto/compile.hpp +++ b/hotspot/src/share/vm/opto/compile.hpp @@ -264,6 +264,7 @@ class Compile : public Phase { BasicType type() const { return _type; } + jint get_jint() const { return _v._value.i; } jlong get_jlong() const { return _v._value.j; } jfloat get_jfloat() const { return _v._value.f; } jdouble get_jdouble() const { return _v._value.d; } @@ -320,6 +321,14 @@ class Compile : public Phase { Constant add(MachConstantNode* n, BasicType type, jvalue value); Constant add(Metadata* metadata); Constant add(MachConstantNode* n, MachOper* oper); + Constant add(MachConstantNode* n, jint i) { + jvalue value; value.i = i; + return add(n, T_INT, value); + } + Constant add(MachConstantNode* n, jlong j) { + jvalue value; value.j = j; + return add(n, T_LONG, value); + } Constant add(MachConstantNode* n, jfloat f) { jvalue value; value.f = f; return add(n, T_FLOAT, value); diff --git a/hotspot/test/compiler/vectorization/TestNaNVector.java b/hotspot/test/compiler/vectorization/TestNaNVector.java new file mode 100644 index 00000000000..302657951e1 --- /dev/null +++ b/hotspot/test/compiler/vectorization/TestNaNVector.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2016, 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 8160425 + * @summary Test vectorization with a signalling NaN. + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-OptimizeFill TestNaNVector + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-OptimizeFill -XX:MaxVectorSize=4 TestNaNVector + */ +public class TestNaNVector { + private char[] array; + private static final int LEN = 1024; + + public static void main(String args[]) { + TestNaNVector test = new TestNaNVector(); + // Check double precision NaN + for (int i = 0; i < 10_000; ++i) { + test.vectorizeNaNDP(); + } + System.out.println("Checking double precision Nan"); + test.checkResult(0xfff7); + + // Check single precision NaN + for (int i = 0; i < 10_000; ++i) { + test.vectorizeNaNSP(); + } + System.out.println("Checking single precision Nan"); + test.checkResult(0xff80); + } + + public TestNaNVector() { + array = new char[LEN]; + } + + public void vectorizeNaNDP() { + // This loop will be vectorized and the array store will be replaced by + // a 64-bit vector store to four subsequent array elements. The vector + // should look like this '0xfff7fff7fff7fff7' and is read from the constant + // table. However, in floating point arithmetic this is a signalling NaN + // which may be converted to a quiet NaN when processed by the x87 FPU. + // If the signalling bit is set, the vector ends up in the constant table + // as '0xfffffff7fff7fff7' which leads to an incorrect result. + for (int i = 0; i < LEN; ++i) { + array[i] = 0xfff7; + } + } + + public void vectorizeNaNSP() { + // Same as above but with single precision + for (int i = 0; i < LEN; ++i) { + array[i] = 0xff80; + } + } + + public void checkResult(int expected) { + for (int i = 0; i < LEN; ++i) { + if (array[i] != expected) { + throw new RuntimeException("Invalid result: array[" + i + "] = " + (int)array[i] + " != " + expected); + } + } + } +} + From 6a56a5f255af9d3f200264ae8e3c104c5910bcdc Mon Sep 17 00:00:00 2001 From: Ed Nevill Date: Tue, 24 May 2016 01:13:57 -0700 Subject: [PATCH 014/108] 8156943: aarch64: string compare does not support CompactStrings Implement LL, UL and LU encodings for StrComp Reviewed-by: aph --- hotspot/src/cpu/aarch64/vm/aarch64.ad | 59 ++++++++-- .../cpu/aarch64/vm/macroAssembler_aarch64.cpp | 102 +++++++++++++----- .../cpu/aarch64/vm/macroAssembler_aarch64.hpp | 3 +- .../vm/register_definitions_aarch64.cpp | 4 + 4 files changed, 136 insertions(+), 32 deletions(-) diff --git a/hotspot/src/cpu/aarch64/vm/aarch64.ad b/hotspot/src/cpu/aarch64/vm/aarch64.ad index 89fac8fa208..47bd7a6745a 100644 --- a/hotspot/src/cpu/aarch64/vm/aarch64.ad +++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad @@ -3330,9 +3330,6 @@ int HandlerImpl::emit_deopt_handler(CodeBuffer& cbuf) const bool Matcher::match_rule_supported(int opcode) { switch (opcode) { - case Op_StrComp: - if (CompactStrings) return false; - break; default: break; } @@ -14988,11 +14985,61 @@ instruct string_compareU(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 c format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # KILL $tmp1" %} ins_encode %{ // Count is in 8-bit bytes; non-Compact chars are 16 bits. - __ asrw($cnt1$$Register, $cnt1$$Register, 1); - __ asrw($cnt2$$Register, $cnt2$$Register, 1); __ string_compare($str1$$Register, $str2$$Register, $cnt1$$Register, $cnt2$$Register, $result$$Register, - $tmp1$$Register); + $tmp1$$Register, + fnoreg, fnoreg, StrIntrinsicNode::UU); + %} + ins_pipe(pipe_class_memory); +%} + +instruct string_compareL(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2, + iRegI_R0 result, iRegP_R10 tmp1, rFlagsReg cr) +%{ + predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LL); + match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2))); + effect(KILL tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr); + + format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # KILL $tmp1" %} + ins_encode %{ + __ string_compare($str1$$Register, $str2$$Register, + $cnt1$$Register, $cnt2$$Register, $result$$Register, + $tmp1$$Register, + fnoreg, fnoreg, StrIntrinsicNode::LL); + %} + ins_pipe(pipe_class_memory); +%} + +instruct string_compareUL(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2, + iRegI_R0 result, vRegD vtmp1, vRegD vtmp2, iRegP_R10 tmp1, rFlagsReg cr) +%{ + predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::UL); + match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2))); + effect(KILL tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, TEMP vtmp1, TEMP vtmp2, KILL cr); + + format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # KILL $tmp1" %} + ins_encode %{ + __ string_compare($str1$$Register, $str2$$Register, + $cnt1$$Register, $cnt2$$Register, $result$$Register, + $tmp1$$Register, + $vtmp1$$FloatRegister, $vtmp2$$FloatRegister, StrIntrinsicNode::UL); + %} + ins_pipe(pipe_class_memory); +%} + +instruct string_compareLU(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2, + iRegI_R0 result, vRegD vtmp1, vRegD vtmp2, iRegP_R10 tmp1, rFlagsReg cr) +%{ + predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LU); + match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2))); + effect(KILL tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, TEMP vtmp1, TEMP vtmp2, KILL cr); + + format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # KILL $tmp1" %} + ins_encode %{ + __ string_compare($str1$$Register, $str2$$Register, + $cnt1$$Register, $cnt2$$Register, $result$$Register, + $tmp1$$Register, + $vtmp1$$FloatRegister, $vtmp2$$FloatRegister, StrIntrinsicNode::LU); %} ins_pipe(pipe_class_memory); %} diff --git a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp index 094b0e55f39..430119dee39 100644 --- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp @@ -566,11 +566,6 @@ void MacroAssembler::biased_locking_exit(Register obj_reg, Register temp_reg, La br(Assembler::EQ, done); } - -// added to make this compile - -REGISTER_DEFINITION(Register, noreg); - static void pass_arg0(MacroAssembler* masm, Register arg) { if (c_rarg0 != arg ) { masm->mov(c_rarg0, arg); @@ -4501,21 +4496,49 @@ void MacroAssembler::string_indexof(Register str2, Register str1, BIND(DONE); } +typedef void (MacroAssembler::* chr_insn)(Register Rt, const Address &adr); +typedef void (MacroAssembler::* uxt_insn)(Register Rd, Register Rn); + // Compare strings. void MacroAssembler::string_compare(Register str1, Register str2, Register cnt1, Register cnt2, Register result, - Register tmp1) { + Register tmp1, + FloatRegister vtmp, FloatRegister vtmpZ, int ae) { Label LENGTH_DIFF, DONE, SHORT_LOOP, SHORT_STRING, NEXT_WORD, DIFFERENCE; + bool isLL = ae == StrIntrinsicNode::LL; + bool isLU = ae == StrIntrinsicNode::LU; + bool isUL = ae == StrIntrinsicNode::UL; + + bool str1_isL = isLL || isLU; + bool str2_isL = isLL || isUL; + + int str1_chr_shift = str1_isL ? 0 : 1; + int str2_chr_shift = str2_isL ? 0 : 1; + int str1_chr_size = str1_isL ? 1 : 2; + int str2_chr_size = str2_isL ? 1 : 2; + + chr_insn str1_load_chr = str1_isL ? (chr_insn)&MacroAssembler::ldrb : + (chr_insn)&MacroAssembler::ldrh; + chr_insn str2_load_chr = str2_isL ? (chr_insn)&MacroAssembler::ldrb : + (chr_insn)&MacroAssembler::ldrh; + uxt_insn ext_chr = isLL ? (uxt_insn)&MacroAssembler::uxtbw : + (uxt_insn)&MacroAssembler::uxthw; + BLOCK_COMMENT("string_compare {"); + // Bizzarely, the counts are passed in bytes, regardless of whether they + // are L or U strings, however the result is always in characters. + if (!str1_isL) asrw(cnt1, cnt1, 1); + if (!str2_isL) asrw(cnt2, cnt2, 1); + // Compute the minimum of the string lengths and save the difference. subsw(tmp1, cnt1, cnt2); cselw(cnt2, cnt1, cnt2, Assembler::LE); // min // A very short string - cmpw(cnt2, 4); + cmpw(cnt2, isLL ? 8:4); br(Assembler::LT, SHORT_STRING); // Check if the strings start at the same location. @@ -4524,20 +4547,37 @@ void MacroAssembler::string_compare(Register str1, Register str2, // Compare longwords { - subw(cnt2, cnt2, 4); // The last longword is a special case + subw(cnt2, cnt2, isLL ? 8:4); // The last longword is a special case // Move both string pointers to the last longword of their // strings, negate the remaining count, and convert it to bytes. - lea(str1, Address(str1, cnt2, Address::uxtw(1))); - lea(str2, Address(str2, cnt2, Address::uxtw(1))); - sub(cnt2, zr, cnt2, LSL, 1); + lea(str1, Address(str1, cnt2, Address::uxtw(str1_chr_shift))); + lea(str2, Address(str2, cnt2, Address::uxtw(str2_chr_shift))); + if (isLU || isUL) { + sub(cnt1, zr, cnt2, LSL, str1_chr_shift); + eor(vtmpZ, T16B, vtmpZ, vtmpZ); + } + sub(cnt2, zr, cnt2, LSL, str2_chr_shift); // Loop, loading longwords and comparing them into rscratch2. bind(NEXT_WORD); - ldr(result, Address(str1, cnt2)); - ldr(cnt1, Address(str2, cnt2)); - adds(cnt2, cnt2, wordSize); - eor(rscratch2, result, cnt1); + if (isLU) { + ldrs(vtmp, Address(str1, cnt1)); + zip1(vtmp, T8B, vtmp, vtmpZ); + umov(result, vtmp, D, 0); + } else { + ldr(result, Address(str1, isUL ? cnt1:cnt2)); + } + if (isUL) { + ldrs(vtmp, Address(str2, cnt2)); + zip1(vtmp, T8B, vtmp, vtmpZ); + umov(rscratch1, vtmp, D, 0); + } else { + ldr(rscratch1, Address(str2, cnt2)); + } + adds(cnt2, cnt2, isUL ? 4:8); + if (isLU || isUL) add(cnt1, cnt1, isLU ? 4:8); + eor(rscratch2, result, rscratch1); cbnz(rscratch2, DIFFERENCE); br(Assembler::LT, NEXT_WORD); @@ -4545,9 +4585,21 @@ void MacroAssembler::string_compare(Register str1, Register str2, // same longword twice, but that's still faster than another // conditional branch. - ldr(result, Address(str1)); - ldr(cnt1, Address(str2)); - eor(rscratch2, result, cnt1); + if (isLU) { + ldrs(vtmp, Address(str1)); + zip1(vtmp, T8B, vtmp, vtmpZ); + umov(result, vtmp, D, 0); + } else { + ldr(result, Address(str1)); + } + if (isUL) { + ldrs(vtmp, Address(str2)); + zip1(vtmp, T8B, vtmp, vtmpZ); + umov(rscratch1, vtmp, D, 0); + } else { + ldr(rscratch1, Address(str2)); + } + eor(rscratch2, result, rscratch1); cbz(rscratch2, LENGTH_DIFF); // Find the first different characters in the longwords and @@ -4555,12 +4607,12 @@ void MacroAssembler::string_compare(Register str1, Register str2, bind(DIFFERENCE); rev(rscratch2, rscratch2); clz(rscratch2, rscratch2); - andr(rscratch2, rscratch2, -16); + andr(rscratch2, rscratch2, isLL ? -8 : -16); lsrv(result, result, rscratch2); - uxthw(result, result); - lsrv(cnt1, cnt1, rscratch2); - uxthw(cnt1, cnt1); - subw(result, result, cnt1); + (this->*ext_chr)(result, result); + lsrv(rscratch1, rscratch1, rscratch2); + (this->*ext_chr)(rscratch1, rscratch1); + subw(result, result, rscratch1); b(DONE); } @@ -4569,8 +4621,8 @@ void MacroAssembler::string_compare(Register str1, Register str2, cbz(cnt2, LENGTH_DIFF); bind(SHORT_LOOP); - load_unsigned_short(result, Address(post(str1, 2))); - load_unsigned_short(cnt1, Address(post(str2, 2))); + (this->*str1_load_chr)(result, Address(post(str1, str1_chr_size))); + (this->*str2_load_chr)(cnt1, Address(post(str2, str2_chr_size))); subw(result, result, cnt1); cbnz(result, DONE); sub(cnt2, cnt2, 1); diff --git a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp index 2a9d0a90251..d338ea4bf7c 100644 --- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp @@ -1198,7 +1198,8 @@ public: void string_compare(Register str1, Register str2, Register cnt1, Register cnt2, Register result, - Register tmp1); + Register tmp1, + FloatRegister vtmp, FloatRegister vtmpZ, int ae); void arrays_equals(Register a1, Register a2, Register result, Register cnt1, diff --git a/hotspot/src/cpu/aarch64/vm/register_definitions_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/register_definitions_aarch64.cpp index 2c67be11d64..5411d06e12a 100644 --- a/hotspot/src/cpu/aarch64/vm/register_definitions_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/register_definitions_aarch64.cpp @@ -29,6 +29,8 @@ #include "register_aarch64.hpp" # include "interp_masm_aarch64.hpp" +REGISTER_DEFINITION(Register, noreg); + REGISTER_DEFINITION(Register, r0); REGISTER_DEFINITION(Register, r1); REGISTER_DEFINITION(Register, r2); @@ -62,6 +64,8 @@ REGISTER_DEFINITION(Register, r29); REGISTER_DEFINITION(Register, r30); REGISTER_DEFINITION(Register, sp); +REGISTER_DEFINITION(FloatRegister, fnoreg); + REGISTER_DEFINITION(FloatRegister, v0); REGISTER_DEFINITION(FloatRegister, v1); REGISTER_DEFINITION(FloatRegister, v2); From d618ceab2e1b89a8add945d46b955d340a2992c0 Mon Sep 17 00:00:00 2001 From: Jon Masamitsu Date: Wed, 8 Jun 2016 14:11:51 -0700 Subject: [PATCH 015/108] 8159073: : Error handling incomplete when creating GC threads lazily Reviewed-by: drwhite, tschatzl, sangheki --- .../gc/cms/concurrentMarkSweepGeneration.cpp | 7 +++++-- .../src/share/vm/gc/cms/parNewGeneration.cpp | 6 ++++-- .../src/share/vm/gc/g1/g1CollectedHeap.cpp | 4 ++-- .../src/share/vm/gc/g1/g1ConcurrentMark.cpp | 5 ++++- .../share/vm/gc/parallel/gcTaskManager.cpp | 2 +- .../share/vm/gc/parallel/gcTaskManager.hpp | 3 ++- .../src/share/vm/gc/parallel/psScavenge.cpp | 12 +++++++---- .../src/share/vm/gc/shared/workerManager.hpp | 21 ++++++++++++++----- hotspot/src/share/vm/gc/shared/workgroup.cpp | 4 +++- hotspot/src/share/vm/gc/shared/workgroup.hpp | 5 ++--- hotspot/src/share/vm/runtime/globals.hpp | 4 ++++ hotspot/test/gc/stress/TestGCOld.java | 3 ++- 12 files changed, 53 insertions(+), 23 deletions(-) diff --git a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp index 1df96bd5826..cbbbfbded27 100644 --- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp @@ -2888,7 +2888,10 @@ void CMSCollector::checkpointRootsInitialWork() { CMSParInitialMarkTask tsk(this, &srs, n_workers); initialize_sequential_subtasks_for_young_gen_rescan(n_workers); - if (n_workers > 1) { + // If the total workers is greater than 1, then multiple workers + // may be used at some time and the initialization has been set + // such that the single threaded path cannot be used. + if (workers->total_workers() > 1) { workers->run_task(&tsk); } else { tsk.work(0); @@ -3507,7 +3510,7 @@ bool CMSCollector::do_marking_mt() { uint num_workers = AdaptiveSizePolicy::calc_active_conc_workers(conc_workers()->total_workers(), conc_workers()->active_workers(), Threads::number_of_non_daemon_threads()); - conc_workers()->set_active_workers(num_workers); + num_workers = conc_workers()->update_active_workers(num_workers); CompactibleFreeListSpace* cms_space = _cmsGen->cmsSpace(); diff --git a/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp b/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp index adf515623bf..da6b6d623a3 100644 --- a/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp @@ -898,7 +898,7 @@ void ParNewGeneration::collect(bool full, AdaptiveSizePolicy::calc_active_workers(workers->total_workers(), workers->active_workers(), Threads::number_of_non_daemon_threads()); - workers->set_active_workers(active_workers); + active_workers = workers->update_active_workers(active_workers); _old_gen = gch->old_gen(); // If the next generation is too full to accommodate worst-case promotion @@ -952,7 +952,9 @@ void ParNewGeneration::collect(bool full, // separate thread causes wide variance in run times. We can't help this // in the multi-threaded case, but we special-case n=1 here to get // repeatable measurements of the 1-thread overhead of the parallel code. - if (active_workers > 1) { + // Might multiple workers ever be used? If yes, initialization + // has been done such that the single threaded path should not be used. + if (workers->total_workers() > 1) { workers->run_task(&tsk); } else { tsk.work(0); diff --git a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp index 9a60b5a5c56..d84e1000763 100644 --- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp @@ -1331,7 +1331,7 @@ bool G1CollectedHeap::do_full_collection(bool explicit_gc, AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(), workers()->active_workers(), Threads::number_of_non_daemon_threads()); - workers()->set_active_workers(n_workers); + workers()->update_active_workers(n_workers); ParRebuildRSTask rebuild_rs_task(this); workers()->run_task(&rebuild_rs_task); @@ -3067,7 +3067,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { uint active_workers = AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(), workers()->active_workers(), Threads::number_of_non_daemon_threads()); - workers()->set_active_workers(active_workers); + workers()->update_active_workers(active_workers); TraceCollectorStats tcs(g1mm()->incremental_collection_counters()); TraceMemoryManagerStats tms(false /* fullGC */, gc_cause()); diff --git a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp index 93ee1fbbbb7..454c5989484 100644 --- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp +++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp @@ -1031,11 +1031,14 @@ void G1ConcurrentMark::mark_from_roots() { uint active_workers = MAX2(1U, parallel_marking_threads()); assert(active_workers > 0, "Should have been set"); + // Setting active workers is not guaranteed since fewer + // worker threads may currently exist and more may not be + // available. + active_workers = _parallel_workers->update_active_workers(active_workers); // Parallel task terminator is set in "set_concurrency_and_phase()" set_concurrency_and_phase(active_workers, true /* concurrent */); G1CMConcurrentMarkingTask markingTask(this, cmThread()); - _parallel_workers->set_active_workers(active_workers); _parallel_workers->run_task(&markingTask); print_stats(); } diff --git a/hotspot/src/share/vm/gc/parallel/gcTaskManager.cpp b/hotspot/src/share/vm/gc/parallel/gcTaskManager.cpp index 4b47eef70c8..80450270b96 100644 --- a/hotspot/src/share/vm/gc/parallel/gcTaskManager.cpp +++ b/hotspot/src/share/vm/gc/parallel/gcTaskManager.cpp @@ -537,7 +537,7 @@ void GCTaskManager::task_idle_workers() { created_workers() - active_workers() - idle_workers(); if (more_inactive_workers < 0) { int reduced_active_workers = active_workers() + more_inactive_workers; - set_active_workers(reduced_active_workers); + update_active_workers(reduced_active_workers); more_inactive_workers = 0; } log_trace(gc, task)("JT: %d workers %d active %d idle %d more %d", diff --git a/hotspot/src/share/vm/gc/parallel/gcTaskManager.hpp b/hotspot/src/share/vm/gc/parallel/gcTaskManager.hpp index d05869a3730..5bc5d4c304e 100644 --- a/hotspot/src/share/vm/gc/parallel/gcTaskManager.hpp +++ b/hotspot/src/share/vm/gc/parallel/gcTaskManager.hpp @@ -457,11 +457,12 @@ protected: uint workers() const { return _workers; } - void set_active_workers(uint v) { + uint update_active_workers(uint v) { assert(v <= _workers, "Trying to set more workers active than there are"); _active_workers = MIN2(v, _workers); assert(v != 0, "Trying to set active workers to 0"); _active_workers = MAX2(1U, _active_workers); + return _active_workers; } // Sets the number of threads that will be used in a collection void set_active_gang(); diff --git a/hotspot/src/share/vm/gc/parallel/psScavenge.cpp b/hotspot/src/share/vm/gc/parallel/psScavenge.cpp index 82caad39008..a80d3ec2df2 100644 --- a/hotspot/src/share/vm/gc/parallel/psScavenge.cpp +++ b/hotspot/src/share/vm/gc/parallel/psScavenge.cpp @@ -391,11 +391,15 @@ bool PSScavenge::invoke_no_policy() { ParallelTaskTerminator terminator( active_workers, (TaskQueueSetSuper*) promotion_manager->stack_array_depth()); - if (active_workers > 1) { - for (uint j = 0; j < active_workers; j++) { - q->enqueue(new StealTask(&terminator)); + // If active_workers can exceed 1, add a StrealTask. + // PSPromotionManager::drain_stacks_depth() does not fully drain its + // stacks and expects a StealTask to complete the draining if + // ParallelGCThreads is > 1. + if (gc_task_manager()->workers() > 1) { + for (uint j = 0; j < active_workers; j++) { + q->enqueue(new StealTask(&terminator)); + } } - } gc_task_manager()->execute_and_wait(q); } diff --git a/hotspot/src/share/vm/gc/shared/workerManager.hpp b/hotspot/src/share/vm/gc/shared/workerManager.hpp index e4ac4659dcf..6758c08c741 100644 --- a/hotspot/src/share/vm/gc/shared/workerManager.hpp +++ b/hotspot/src/share/vm/gc/shared/workerManager.hpp @@ -55,18 +55,29 @@ class WorkerManager : public AllStatic { uint start = created_workers; uint end = MIN2(active_workers, total_workers); for (uint worker_id = start; worker_id < end; worker_id += 1) { - WorkerThread* new_worker = holder->install_worker(worker_id); - assert(new_worker != NULL, "Failed to allocate GangWorker"); + WorkerThread* new_worker = NULL; + if (initializing || !InjectGCWorkerCreationFailure) { + new_worker = holder->install_worker(worker_id); + } if (new_worker == NULL || !os::create_thread(new_worker, worker_type)) { - if (initializing) { - vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, - "Cannot create worker GC thread. Out of system resources."); + log_trace(gc, task)("WorkerManager::add_workers() : " + "creation failed due to failed allocation of native %s", + new_worker == NULL ? "memory" : "thread"); + if (new_worker != NULL) { + delete new_worker; } + if (initializing) { + vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create worker GC thread. Out of system resources."); + } + break; } created_workers++; os::start_thread(new_worker); } + log_trace(gc, task)("WorkerManager::add_workers() : " + "created_workers: %u", created_workers); + return created_workers; } diff --git a/hotspot/src/share/vm/gc/shared/workgroup.cpp b/hotspot/src/share/vm/gc/shared/workgroup.cpp index 42334dc71e3..84016fe466d 100644 --- a/hotspot/src/share/vm/gc/shared/workgroup.cpp +++ b/hotspot/src/share/vm/gc/shared/workgroup.cpp @@ -274,8 +274,10 @@ void WorkGang::run_task(AbstractGangTask* task, uint num_workers) { "Trying to execute task %s with %u workers which is more than the amount of total workers %u.", task->name(), num_workers, total_workers()); guarantee(num_workers > 0, "Trying to execute task %s with zero workers", task->name()); - add_workers(num_workers, false); + uint old_num_workers = _active_workers; + update_active_workers(num_workers); _dispatcher->coordinator_execute_on_workers(task, num_workers); + update_active_workers(old_num_workers); } AbstractGangWorker::AbstractGangWorker(AbstractWorkGang* gang, uint id) { diff --git a/hotspot/src/share/vm/gc/shared/workgroup.hpp b/hotspot/src/share/vm/gc/shared/workgroup.hpp index 1208d42a970..00eb705f683 100644 --- a/hotspot/src/share/vm/gc/shared/workgroup.hpp +++ b/hotspot/src/share/vm/gc/shared/workgroup.hpp @@ -156,15 +156,14 @@ class AbstractWorkGang : public CHeapObj { return _active_workers; } - void set_active_workers(uint v) { + uint update_active_workers(uint v) { assert(v <= _total_workers, "Trying to set more workers active than there are"); _active_workers = MIN2(v, _total_workers); add_workers(false /* exit_on_failure */); assert(v != 0, "Trying to set active workers to 0"); - assert(UseDynamicNumberOfGCThreads || _active_workers == _total_workers, - "Unless dynamic should use total workers"); log_info(gc, task)("GC Workers: using %d out of %d", _active_workers, _total_workers); + return _active_workers; } // Add GC workers as needed. diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 8ab47ff2123..930c51acc17 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1438,6 +1438,10 @@ public: "Dynamically choose the number of parallel threads " \ "parallel gc will use") \ \ + diagnostic(bool, InjectGCWorkerCreationFailure, false, \ + "Inject thread creation failures for " \ + "UseDynamicNumberOfGCThreads") \ + \ diagnostic(bool, ForceDynamicNumberOfGCThreads, false, \ "Force dynamic selection of the number of " \ "parallel threads parallel gc will use to aid debugging") \ diff --git a/hotspot/test/gc/stress/TestGCOld.java b/hotspot/test/gc/stress/TestGCOld.java index 23fb60a3113..3d74aa210b8 100644 --- a/hotspot/test/gc/stress/TestGCOld.java +++ b/hotspot/test/gc/stress/TestGCOld.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2015, 2016, 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 @@ -33,6 +33,7 @@ * @run main/othervm -Xmx384M -XX:+UseConcMarkSweepGC TestGCOld 50 1 20 10 10000 * @run main/othervm -Xmx384M -XX:+UseG1GC TestGCOld 50 1 20 10 10000 * @run main/othervm -Xms64m -Xmx128m -XX:+UseG1GC -XX:+UseDynamicNumberOfGCThreads -Xlog:gc,gc+task=trace TestGCOld 50 5 20 1 5000 + * @run main/othervm -Xms64m -Xmx128m -XX:+UseG1GC -XX:+UseDynamicNumberOfGCThreads -XX:+UnlockDiagnosticVMOptions -XX:+InjectGCWorkerCreationFailure -Xlog:gc,gc+task=trace TestGCOld 50 5 20 1 5000 */ import java.text.*; From 464bfe497d774647035b2a191369362501fcd85f Mon Sep 17 00:00:00 2001 From: Jesper Wilhelmsson Date: Tue, 21 Jun 2016 19:35:39 +0200 Subject: [PATCH 016/108] 8048093: Explicitly setting := vs = in the -XX:+PrintFlagsFinal output Reviewed-by: kvn, gziemski --- .../share/vm/gc/shared/collectorPolicy.cpp | 27 +-- hotspot/src/share/vm/runtime/globals.cpp | 103 +++++++--- hotspot/src/share/vm/runtime/globals.hpp | 12 +- .../share/vm/runtime/globals_extension.hpp | 7 +- .../arguments/CheckCICompilerCount.java | 8 +- .../CheckCompileThresholdScaling.java | 180 +++++++++--------- .../gc/metaspace/TestMetaspaceSizeFlags.java | 4 +- 7 files changed, 202 insertions(+), 139 deletions(-) diff --git a/hotspot/src/share/vm/gc/shared/collectorPolicy.cpp b/hotspot/src/share/vm/gc/shared/collectorPolicy.cpp index 1cb05979fac..d3e45afa352 100644 --- a/hotspot/src/share/vm/gc/shared/collectorPolicy.cpp +++ b/hotspot/src/share/vm/gc/shared/collectorPolicy.cpp @@ -927,8 +927,23 @@ public: save_flags(); + // If NewSize has been ergonomically set, the collector policy + // should use it for min but calculate the initial young size + // using NewRatio. + flag_value = 20 * M; + set_basic_flag_values(); + FLAG_SET_ERGO(size_t, NewSize, flag_value); + verify_young_min(flag_value); + + set_basic_flag_values(); + FLAG_SET_ERGO(size_t, NewSize, flag_value); + verify_scaled_young_initial(InitialHeapSize); + // If NewSize is set on the command line, it should be used // for both min and initial young size if less than min heap. + // Note that once a flag has been set with FLAG_SET_CMDLINE it + // will be treated as it have been set on the command line for + // the rest of the VM lifetime. This is an irreversible change. flag_value = 20 * M; set_basic_flag_values(); FLAG_SET_CMDLINE(size_t, NewSize, flag_value); @@ -945,18 +960,6 @@ public: FLAG_SET_CMDLINE(size_t, NewSize, flag_value); verify_young_initial(flag_value); - // If NewSize has been ergonomically set, the collector policy - // should use it for min but calculate the initial young size - // using NewRatio. - flag_value = 20 * M; - set_basic_flag_values(); - FLAG_SET_ERGO(size_t, NewSize, flag_value); - verify_young_min(flag_value); - - set_basic_flag_values(); - FLAG_SET_ERGO(size_t, NewSize, flag_value); - verify_scaled_young_initial(InitialHeapSize); - restore_flags(); } diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp index c878da34740..b0a0d798bd7 100644 --- a/hotspot/src/share/vm/runtime/globals.cpp +++ b/hotspot/src/share/vm/runtime/globals.cpp @@ -334,7 +334,8 @@ Flag::Flags Flag::get_origin() { void Flag::set_origin(Flags origin) { assert((origin & VALUE_ORIGIN_MASK) == origin, "sanity"); - _flags = Flags((_flags & ~VALUE_ORIGIN_MASK) | origin); + Flags new_origin = Flags((origin == COMMAND_LINE) ? Flags(origin | ORIG_COMMAND_LINE) : origin); + _flags = Flags((_flags & ~VALUE_ORIGIN_MASK) | new_origin); } bool Flag::is_default() { @@ -346,7 +347,11 @@ bool Flag::is_ergonomic() { } bool Flag::is_command_line() { - return (get_origin() == COMMAND_LINE); + return (_flags & ORIG_COMMAND_LINE) != 0; +} + +void Flag::set_command_line() { + _flags = Flags(_flags | ORIG_COMMAND_LINE); } bool Flag::is_product() const { @@ -464,25 +469,31 @@ void Flag::print_on(outputStream* st, bool withComments, bool printRanges) { } if (!printRanges) { - - st->print("%9s %-40s %c= ", _type, _name, (!is_default() ? ':' : ' ')); + // The print below assumes that the flag name is 40 characters or less. + // This works for most flags, but there are exceptions. Our longest flag + // name right now is UseAdaptiveGenerationSizePolicyAtMajorCollection and + // its minor collection buddy. These are 48 characters. We use a buffer of + // 10 spaces below to adjust the space between the flag value and the + // column of flag type and origin that is printed in the end of the line. + char spaces[10 + 1] = " "; + st->print("%9s %-40s = ", _type, _name); if (is_bool()) { - st->print("%-16s", get_bool() ? "true" : "false"); + st->print("%-20s", get_bool() ? "true" : "false"); } else if (is_int()) { - st->print("%-16d", get_int()); + st->print("%-20d", get_int()); } else if (is_uint()) { - st->print("%-16u", get_uint()); + st->print("%-20u", get_uint()); } else if (is_intx()) { - st->print(INTX_FORMAT_W(-16), get_intx()); + st->print(INTX_FORMAT_W(-20), get_intx()); } else if (is_uintx()) { - st->print(UINTX_FORMAT_W(-16), get_uintx()); + st->print(UINTX_FORMAT_W(-20), get_uintx()); } else if (is_uint64_t()) { - st->print(UINT64_FORMAT_W(-16), get_uint64_t()); + st->print(UINT64_FORMAT_W(-20), get_uint64_t()); } else if (is_size_t()) { - st->print(SIZE_FORMAT_W(-16), get_size_t()); + st->print(SIZE_FORMAT_W(-20), get_size_t()); } else if (is_double()) { - st->print("%-16f", get_double()); + st->print("%-20f", get_double()); } else if (is_ccstr()) { const char* cp = get_ccstr(); if (cp != NULL) { @@ -494,13 +505,14 @@ void Flag::print_on(outputStream* st, bool withComments, bool printRanges) { cp = eol+1; st->print("%5s %-35s += ", "", _name); } - st->print("%-16s", cp); + st->print("%-20s", cp); } - else st->print("%-16s", ""); + else st->print("%-20s", ""); } - - st->print("%-20s", " "); - print_kind(st); + assert(strlen(_name) < 50, "Flag name is longer than expected"); + spaces[50 - MAX2((size_t)40, strlen(_name))] = '\0'; + st->print("%s", spaces); + print_kind_and_origin(st); #ifndef PRODUCT if (withComments) { @@ -533,8 +545,8 @@ void Flag::print_on(outputStream* st, bool withComments, bool printRanges) { } CommandLineFlagRangeList::print(st, _name, func); - st->print(" %-20s", " "); - print_kind(st); + st->print(" %-16s", " "); + print_kind_and_origin(st); #ifndef PRODUCT if (withComments) { @@ -546,7 +558,7 @@ void Flag::print_on(outputStream* st, bool withComments, bool printRanges) { } } -void Flag::print_kind(outputStream* st) { +void Flag::print_kind_and_origin(outputStream* st) { struct Data { int flag; const char* name; @@ -572,23 +584,58 @@ void Flag::print_kind(outputStream* st) { }; if ((_flags & KIND_MASK) != 0) { - st->print("{"); bool is_first = true; + const size_t buffer_size = 64; + size_t buffer_used = 0; + char kind[buffer_size]; + jio_snprintf(kind, buffer_size, "{"); + buffer_used++; for (int i = 0; data[i].flag != -1; i++) { Data d = data[i]; if ((_flags & d.flag) != 0) { if (is_first) { is_first = false; } else { - st->print(" "); + assert(buffer_used + 1 < buffer_size, "Too small buffer"); + jio_snprintf(kind + buffer_used, buffer_size - buffer_used, " "); + buffer_used++; } - st->print("%s", d.name); + size_t length = strlen(d.name); + assert(buffer_used + length < buffer_size, "Too small buffer"); + jio_snprintf(kind + buffer_used, buffer_size - buffer_used, "%s", d.name); + buffer_used += length; } } - - st->print("}"); + assert(buffer_used + 2 <= buffer_size, "Too small buffer"); + jio_snprintf(kind + buffer_used, buffer_size - buffer_used, "}"); + st->print("%20s", kind); } + + int origin = _flags & VALUE_ORIGIN_MASK; + st->print(" {"); + switch(origin) { + case DEFAULT: + st->print("default"); break; + case COMMAND_LINE: + st->print("command line"); break; + case ENVIRON_VAR: + st->print("environment"); break; + case CONFIG_FILE: + st->print("config file"); break; + case MANAGEMENT: + st->print("management"); break; + case ERGONOMIC: + if (_flags & ORIG_COMMAND_LINE) { + st->print("command line, "); + } + st->print("ergonomic"); break; + case ATTACH_ON_DEMAND: + st->print("attach"); break; + case INTERNAL: + st->print("internal"); break; + } + st->print("}"); } void Flag::print_as_flag(outputStream* st) { @@ -918,6 +965,12 @@ bool CommandLineFlags::wasSetOnCmdline(const char* name, bool* value) { return true; } +void CommandLineFlagsEx::setOnCmdLine(CommandLineFlagWithType flag) { + Flag* faddr = address_of_flag(flag); + assert(faddr != NULL, "Unknown flag"); + faddr->set_command_line(); +} + template static void trace_flag_changed(const char* name, const T old_value, const T new_value, const Flag::Flags origin) { E e; diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index e54ea9abb8b..4a39173f0cf 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -229,7 +229,7 @@ typedef const char* (*RangeStrFunc)(void); struct Flag { enum Flags { - // value origin + // latest value origin DEFAULT = 0, COMMAND_LINE = 1, ENVIRON_VAR = 2, @@ -260,7 +260,10 @@ struct Flag { KIND_COMMERCIAL = 1 << 17, KIND_JVMCI = 1 << 18, - KIND_MASK = ~VALUE_ORIGIN_MASK + // set this bit if the flag was set on the command line + ORIG_COMMAND_LINE = 1 << 19, + + KIND_MASK = ~(VALUE_ORIGIN_MASK | ORIG_COMMAND_LINE) }; enum Error { @@ -272,7 +275,7 @@ struct Flag { MISSING_VALUE, // error parsing the textual form of the value WRONG_FORMAT, - // flag is not writeable + // flag is not writable NON_WRITABLE, // flag value is outside of its bounds OUT_OF_BOUNDS, @@ -367,6 +370,7 @@ struct Flag { bool is_default(); bool is_ergonomic(); bool is_command_line(); + void set_command_line(); bool is_product() const; bool is_manageable() const; @@ -396,7 +400,7 @@ struct Flag { // printRanges will print out flags type, name and range values as expected by -XX:+PrintFlagsRanges void print_on(outputStream* st, bool withComments = false, bool printRanges = false); - void print_kind(outputStream* st); + void print_kind_and_origin(outputStream* st); void print_as_flag(outputStream* st); static const char* flag_error_str(Flag::Error error); diff --git a/hotspot/src/share/vm/runtime/globals_extension.hpp b/hotspot/src/share/vm/runtime/globals_extension.hpp index 881d3eff258..f38723d827e 100644 --- a/hotspot/src/share/vm/runtime/globals_extension.hpp +++ b/hotspot/src/share/vm/runtime/globals_extension.hpp @@ -334,8 +334,9 @@ typedef enum { #define FLAG_SET_DEFAULT(name, value) ((name) = (value)) -#define FLAG_SET_CMDLINE(type, name, value) (CommandLineFlagsEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name,type), (type)(value), Flag::COMMAND_LINE)) -#define FLAG_SET_ERGO(type, name, value) (CommandLineFlagsEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name,type), (type)(value), Flag::ERGONOMIC)) +#define FLAG_SET_CMDLINE(type, name, value) (CommandLineFlagsEx::setOnCmdLine(FLAG_MEMBER_WITH_TYPE(name, type)), \ + CommandLineFlagsEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name, type), (type)(value), Flag::COMMAND_LINE)) +#define FLAG_SET_ERGO(type, name, value) (CommandLineFlagsEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name, type), (type)(value), Flag::ERGONOMIC)) #define FLAG_SET_ERGO_IF_DEFAULT(type, name, value) \ do { \ if (FLAG_IS_DEFAULT(name)) { \ @@ -361,6 +362,8 @@ class CommandLineFlagsEx : CommandLineFlags { static bool is_default(CommandLineFlag flag); static bool is_ergo(CommandLineFlag flag); static bool is_cmdline(CommandLineFlag flag); + + static void setOnCmdLine(CommandLineFlagWithType flag); }; #endif // SHARE_VM_RUNTIME_GLOBALS_EXTENSION_HPP diff --git a/hotspot/test/compiler/arguments/CheckCICompilerCount.java b/hotspot/test/compiler/arguments/CheckCICompilerCount.java index f568dbec0dd..b00e275e2d8 100644 --- a/hotspot/test/compiler/arguments/CheckCICompilerCount.java +++ b/hotspot/test/compiler/arguments/CheckCICompilerCount.java @@ -72,14 +72,14 @@ public class CheckCICompilerCount { "Improperly specified VM option 'CICompilerCount=0'" }, { - "intx CICompilerCount := 1 {product}" + "intx CICompilerCount = 1 {product} {command line}" }, { "CICompilerCount (0) must be at least 1", "Improperly specified VM option 'CICompilerCount=0'" }, { - "intx CICompilerCount := 1 {product}" + "intx CICompilerCount = 1 {product} {command line}" } }; @@ -127,14 +127,14 @@ public class CheckCICompilerCount { "Improperly specified VM option 'CICompilerCount=1'" }, { - "intx CICompilerCount := 2 {product}" + "intx CICompilerCount = 2 {product} {command line, ergonomic}" }, { "CICompilerCount (1) must be at least 2", "Improperly specified VM option 'CICompilerCount=1'" }, { - "intx CICompilerCount := 2 {product}" + "intx CICompilerCount = 2 {product} {command line, ergonomic}" } }; diff --git a/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java b/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java index 653536fad72..e92f5ae3ade 100644 --- a/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java +++ b/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java @@ -105,25 +105,25 @@ public class CheckCompileThresholdScaling { private static final String[][] NON_TIERED_EXPECTED_OUTPUTS = { { - "intx CompileThreshold := 1000 {pd product}", - "double CompileThresholdScaling = 1.000000 {product}" + "intx CompileThreshold = 1000 {pd product} {command line}", + "double CompileThresholdScaling = 1.000000 {product} {default}" }, { - "intx CompileThreshold := 1250 {pd product}", - "double CompileThresholdScaling := 1.250000 {product}" + "intx CompileThreshold = 1250 {pd product} {command line, ergonomic}", + "double CompileThresholdScaling = 1.250000 {product} {command line}" }, { - "intx CompileThreshold := 750 {pd product}", - "double CompileThresholdScaling := 0.750000 {product}" + "intx CompileThreshold = 750 {pd product} {command line, ergonomic}", + "double CompileThresholdScaling = 0.750000 {product} {command line}" }, { - "intx CompileThreshold := 1000 {pd product}", - "double CompileThresholdScaling := 0.000000 {product}", + "intx CompileThreshold = 1000 {pd product} {command line}", + "double CompileThresholdScaling = 0.000000 {product} {command line}", "interpreted mode" }, { - "intx CompileThreshold := 0 {pd product}", - "double CompileThresholdScaling := 0.750000 {product}", + "intx CompileThreshold = 0 {pd product} {command line, ergonomic}", + "double CompileThresholdScaling = 0.750000 {product} {command line}", "interpreted mode" } }; @@ -237,94 +237,94 @@ public class CheckCompileThresholdScaling { private static final String[][] TIERED_EXPECTED_OUTPUTS = { { - "intx Tier0BackedgeNotifyFreqLog := 10 {product}", - "intx Tier0InvokeNotifyFreqLog := 7 {product}", - "intx Tier23InlineeNotifyFreqLog := 20 {product}", - "intx Tier2BackedgeNotifyFreqLog := 14 {product}", - "intx Tier2InvokeNotifyFreqLog := 11 {product}", - "intx Tier3BackEdgeThreshold := 60000 {product}", - "intx Tier3BackedgeNotifyFreqLog := 13 {product}", - "intx Tier3CompileThreshold := 2000 {product}", - "intx Tier3InvocationThreshold := 200 {product}", - "intx Tier3InvokeNotifyFreqLog := 10 {product}", - "intx Tier3MinInvocationThreshold := 100 {product}", - "intx Tier4BackEdgeThreshold := 40000 {product}", - "intx Tier4CompileThreshold := 15000 {product}", - "intx Tier4InvocationThreshold := 5000 {product}", - "intx Tier4MinInvocationThreshold := 600 {product}", - "double CompileThresholdScaling = 1.000000 {product}" + "intx Tier0BackedgeNotifyFreqLog = 10 {product} {command line}", + "intx Tier0InvokeNotifyFreqLog = 7 {product} {command line}", + "intx Tier23InlineeNotifyFreqLog = 20 {product} {command line}", + "intx Tier2BackedgeNotifyFreqLog = 14 {product} {command line}", + "intx Tier2InvokeNotifyFreqLog = 11 {product} {command line}", + "intx Tier3BackEdgeThreshold = 60000 {product} {command line}", + "intx Tier3BackedgeNotifyFreqLog = 13 {product} {command line}", + "intx Tier3CompileThreshold = 2000 {product} {command line}", + "intx Tier3InvocationThreshold = 200 {product} {command line}", + "intx Tier3InvokeNotifyFreqLog = 10 {product} {command line}", + "intx Tier3MinInvocationThreshold = 100 {product} {command line}", + "intx Tier4BackEdgeThreshold = 40000 {product} {command line}", + "intx Tier4CompileThreshold = 15000 {product} {command line}", + "intx Tier4InvocationThreshold = 5000 {product} {command line}", + "intx Tier4MinInvocationThreshold = 600 {product} {command line}", + "double CompileThresholdScaling = 1.000000 {product} {default}" }, { - "intx Tier0BackedgeNotifyFreqLog := 9 {product}", - "intx Tier0InvokeNotifyFreqLog := 6 {product}", - "intx Tier23InlineeNotifyFreqLog := 19 {product}", - "intx Tier2BackedgeNotifyFreqLog := 13 {product}", - "intx Tier2InvokeNotifyFreqLog := 10 {product}", - "intx Tier3BackEdgeThreshold := 45000 {product}", - "intx Tier3BackedgeNotifyFreqLog := 12 {product}", - "intx Tier3CompileThreshold := 1500 {product}", - "intx Tier3InvocationThreshold := 150 {product}", - "intx Tier3InvokeNotifyFreqLog := 9 {product}", - "intx Tier3MinInvocationThreshold := 75 {product}", - "intx Tier4BackEdgeThreshold := 30000 {product}", - "intx Tier4CompileThreshold := 11250 {product}", - "intx Tier4InvocationThreshold := 3750 {product}", - "intx Tier4MinInvocationThreshold := 450 {product}", - "double CompileThresholdScaling := 0.750000 {product}" + "intx Tier0BackedgeNotifyFreqLog = 9 {product} {command line, ergonomic}", + "intx Tier0InvokeNotifyFreqLog = 6 {product} {command line, ergonomic}", + "intx Tier23InlineeNotifyFreqLog = 19 {product} {command line, ergonomic}", + "intx Tier2BackedgeNotifyFreqLog = 13 {product} {command line, ergonomic}", + "intx Tier2InvokeNotifyFreqLog = 10 {product} {command line, ergonomic}", + "intx Tier3BackEdgeThreshold = 45000 {product} {command line, ergonomic}", + "intx Tier3BackedgeNotifyFreqLog = 12 {product} {command line, ergonomic}", + "intx Tier3CompileThreshold = 1500 {product} {command line, ergonomic}", + "intx Tier3InvocationThreshold = 150 {product} {command line, ergonomic}", + "intx Tier3InvokeNotifyFreqLog = 9 {product} {command line, ergonomic}", + "intx Tier3MinInvocationThreshold = 75 {product} {command line, ergonomic}", + "intx Tier4BackEdgeThreshold = 30000 {product} {command line, ergonomic}", + "intx Tier4CompileThreshold = 11250 {product} {command line, ergonomic}", + "intx Tier4InvocationThreshold = 3750 {product} {command line, ergonomic}", + "intx Tier4MinInvocationThreshold = 450 {product} {command line, ergonomic}", + "double CompileThresholdScaling = 0.750000 {product} {command line}" }, { - "intx Tier0BackedgeNotifyFreqLog := 10 {product}", - "intx Tier0InvokeNotifyFreqLog := 7 {product}", - "intx Tier23InlineeNotifyFreqLog := 20 {product}", - "intx Tier2BackedgeNotifyFreqLog := 14 {product}", - "intx Tier2InvokeNotifyFreqLog := 11 {product}", - "intx Tier3BackEdgeThreshold := 75000 {product}", - "intx Tier3BackedgeNotifyFreqLog := 13 {product}", - "intx Tier3CompileThreshold := 2500 {product}", - "intx Tier3InvocationThreshold := 250 {product}", - "intx Tier3InvokeNotifyFreqLog := 10 {product}", - "intx Tier3MinInvocationThreshold := 125 {product}", - "intx Tier4BackEdgeThreshold := 50000 {product}", - "intx Tier4CompileThreshold := 18750 {product}", - "intx Tier4InvocationThreshold := 6250 {product}", - "intx Tier4MinInvocationThreshold := 750 {product}", - "double CompileThresholdScaling := 1.250000 {product}" + "intx Tier0BackedgeNotifyFreqLog = 10 {product} {command line, ergonomic}", + "intx Tier0InvokeNotifyFreqLog = 7 {product} {command line, ergonomic}", + "intx Tier23InlineeNotifyFreqLog = 20 {product} {command line, ergonomic}", + "intx Tier2BackedgeNotifyFreqLog = 14 {product} {command line, ergonomic}", + "intx Tier2InvokeNotifyFreqLog = 11 {product} {command line, ergonomic}", + "intx Tier3BackEdgeThreshold = 75000 {product} {command line, ergonomic}", + "intx Tier3BackedgeNotifyFreqLog = 13 {product} {command line, ergonomic}", + "intx Tier3CompileThreshold = 2500 {product} {command line, ergonomic}", + "intx Tier3InvocationThreshold = 250 {product} {command line, ergonomic}", + "intx Tier3InvokeNotifyFreqLog = 10 {product} {command line, ergonomic}", + "intx Tier3MinInvocationThreshold = 125 {product} {command line, ergonomic}", + "intx Tier4BackEdgeThreshold = 50000 {product} {command line, ergonomic}", + "intx Tier4CompileThreshold = 18750 {product} {command line, ergonomic}", + "intx Tier4InvocationThreshold = 6250 {product} {command line, ergonomic}", + "intx Tier4MinInvocationThreshold = 750 {product} {command line, ergonomic}", + "double CompileThresholdScaling = 1.250000 {product} {command line}" }, { - "intx Tier0BackedgeNotifyFreqLog := 11 {product}", - "intx Tier0InvokeNotifyFreqLog := 8 {product}", - "intx Tier23InlineeNotifyFreqLog := 21 {product}", - "intx Tier2BackedgeNotifyFreqLog := 15 {product}", - "intx Tier2InvokeNotifyFreqLog := 12 {product}", - "intx Tier3BackEdgeThreshold := 120000 {product}", - "intx Tier3BackedgeNotifyFreqLog := 14 {product}", - "intx Tier3CompileThreshold := 4000 {product}", - "intx Tier3InvocationThreshold := 400 {product}", - "intx Tier3InvokeNotifyFreqLog := 11 {product}", - "intx Tier3MinInvocationThreshold := 200 {product}", - "intx Tier4BackEdgeThreshold := 80000 {product}", - "intx Tier4CompileThreshold := 30000 {product}", - "intx Tier4InvocationThreshold := 10000 {product}", - "intx Tier4MinInvocationThreshold := 1200 {product}", - "double CompileThresholdScaling := 2.000000 {product}" + "intx Tier0BackedgeNotifyFreqLog = 11 {product} {command line, ergonomic}", + "intx Tier0InvokeNotifyFreqLog = 8 {product} {command line, ergonomic}", + "intx Tier23InlineeNotifyFreqLog = 21 {product} {command line, ergonomic}", + "intx Tier2BackedgeNotifyFreqLog = 15 {product} {command line, ergonomic}", + "intx Tier2InvokeNotifyFreqLog = 12 {product} {command line, ergonomic}", + "intx Tier3BackEdgeThreshold = 120000 {product} {command line, ergonomic}", + "intx Tier3BackedgeNotifyFreqLog = 14 {product} {command line, ergonomic}", + "intx Tier3CompileThreshold = 4000 {product} {command line, ergonomic}", + "intx Tier3InvocationThreshold = 400 {product} {command line, ergonomic}", + "intx Tier3InvokeNotifyFreqLog = 11 {product} {command line, ergonomic}", + "intx Tier3MinInvocationThreshold = 200 {product} {command line, ergonomic}", + "intx Tier4BackEdgeThreshold = 80000 {product} {command line, ergonomic}", + "intx Tier4CompileThreshold = 30000 {product} {command line, ergonomic}", + "intx Tier4InvocationThreshold = 10000 {product} {command line, ergonomic}", + "intx Tier4MinInvocationThreshold = 1200 {product} {command line, ergonomic}", + "double CompileThresholdScaling = 2.000000 {product} {command line}" }, { - "intx Tier0BackedgeNotifyFreqLog := 10 {product}", - "intx Tier0InvokeNotifyFreqLog := 7 {product}", - "intx Tier23InlineeNotifyFreqLog := 20 {product}", - "intx Tier2BackedgeNotifyFreqLog := 14 {product}", - "intx Tier2InvokeNotifyFreqLog := 11 {product}", - "intx Tier3BackEdgeThreshold := 60000 {product}", - "intx Tier3BackedgeNotifyFreqLog := 13 {product}", - "intx Tier3CompileThreshold := 2000 {product}", - "intx Tier3InvocationThreshold := 200 {product}", - "intx Tier3InvokeNotifyFreqLog := 10 {product}", - "intx Tier3MinInvocationThreshold := 100 {product}", - "intx Tier4BackEdgeThreshold := 40000 {product}", - "intx Tier4CompileThreshold := 15000 {product}", - "intx Tier4InvocationThreshold := 5000 {product}", - "intx Tier4MinInvocationThreshold := 600 {product}", - "double CompileThresholdScaling := 0.000000 {product}", + "intx Tier0BackedgeNotifyFreqLog = 10 {product} {command line}", + "intx Tier0InvokeNotifyFreqLog = 7 {product} {command line}", + "intx Tier23InlineeNotifyFreqLog = 20 {product} {command line}", + "intx Tier2BackedgeNotifyFreqLog = 14 {product} {command line}", + "intx Tier2InvokeNotifyFreqLog = 11 {product} {command line}", + "intx Tier3BackEdgeThreshold = 60000 {product} {command line}", + "intx Tier3BackedgeNotifyFreqLog = 13 {product} {command line}", + "intx Tier3CompileThreshold = 2000 {product} {command line}", + "intx Tier3InvocationThreshold = 200 {product} {command line}", + "intx Tier3InvokeNotifyFreqLog = 10 {product} {command line}", + "intx Tier3MinInvocationThreshold = 100 {product} {command line}", + "intx Tier4BackEdgeThreshold = 40000 {product} {command line}", + "intx Tier4CompileThreshold = 15000 {product} {command line}", + "intx Tier4InvocationThreshold = 5000 {product} {command line}", + "intx Tier4MinInvocationThreshold = 600 {product} {command line}", + "double CompileThresholdScaling = 0.000000 {product} {command line}", "interpreted mode" } }; diff --git a/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java b/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java index b56343c271f..639694c4547 100644 --- a/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java +++ b/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java @@ -74,8 +74,8 @@ public class TestMetaspaceSizeFlags { OutputAnalyzer output = run(maxMetaspaceSize, metaspaceSize); output.shouldNotMatch("Error occurred during initialization of VM\n.*"); - String stringMaxMetaspaceSize = output.firstMatch(".* MaxMetaspaceSize .* := (\\d+).*", 1); - String stringMetaspaceSize = output.firstMatch(".* MetaspaceSize .* := (\\d+).*", 1); + String stringMaxMetaspaceSize = output.firstMatch(".* MaxMetaspaceSize .* = (\\d+).*", 1); + String stringMetaspaceSize = output.firstMatch(".* MetaspaceSize .* = (\\d+).*", 1); return new MetaspaceFlags(Long.parseLong(stringMaxMetaspaceSize), Long.parseLong(stringMetaspaceSize)); From f2490e91943bd95110c723b613e8a9239759dca8 Mon Sep 17 00:00:00 2001 From: Jesper Wilhelmsson Date: Tue, 21 Jun 2016 19:37:30 +0200 Subject: [PATCH 017/108] 8024137: Flags should be set using the proper macro Reviewed-by: sangheki, drwhite, jmasa --- .../src/share/vm/gc/g1/g1YoungGenSizer.cpp | 2 +- .../share/vm/gc/shared/collectorPolicy.cpp | 21 +++++++------------ .../share/vm/gc/shared/collectorPolicy.hpp | 4 ---- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/hotspot/src/share/vm/gc/g1/g1YoungGenSizer.cpp b/hotspot/src/share/vm/gc/g1/g1YoungGenSizer.cpp index d06d712d6be..df0c7617a6e 100644 --- a/hotspot/src/share/vm/gc/g1/g1YoungGenSizer.cpp +++ b/hotspot/src/share/vm/gc/g1/g1YoungGenSizer.cpp @@ -45,7 +45,7 @@ G1YoungGenSizer::G1YoungGenSizer() : _sizer_kind(SizerDefaults), _adaptive_size( "A new max generation size of " SIZE_FORMAT "k will be used.", NewSize/K, MaxNewSize/K, NewSize/K); } - MaxNewSize = NewSize; + FLAG_SET_ERGO(size_t, MaxNewSize, NewSize); } if (FLAG_IS_CMDLINE(NewSize)) { diff --git a/hotspot/src/share/vm/gc/shared/collectorPolicy.cpp b/hotspot/src/share/vm/gc/shared/collectorPolicy.cpp index d3e45afa352..fd449241dba 100644 --- a/hotspot/src/share/vm/gc/shared/collectorPolicy.cpp +++ b/hotspot/src/share/vm/gc/shared/collectorPolicy.cpp @@ -50,7 +50,6 @@ CollectorPolicy::CollectorPolicy() : _initial_heap_byte_size(InitialHeapSize), _max_heap_byte_size(MaxHeapSize), _min_heap_byte_size(Arguments::min_heap_size()), - _max_heap_size_cmdline(false), _size_policy(NULL), _should_clear_all_soft_refs(false), _all_soft_refs_clear(false) @@ -92,7 +91,6 @@ void CollectorPolicy::initialize_flags() { if (_min_heap_byte_size != 0 && MaxHeapSize < _min_heap_byte_size) { vm_exit_during_initialization("Incompatible minimum and maximum heap sizes specified"); } - _max_heap_size_cmdline = true; } // Check heap parameter properties @@ -285,7 +283,7 @@ void GenCollectorPolicy::initialize_flags() { "heap_alignment: " SIZE_FORMAT " not aligned by gen_alignment: " SIZE_FORMAT, _heap_alignment, _gen_alignment); - // All generational heaps have a youngest gen; handle those flags here + // All generational heaps have a young gen; handle those flags here // Make sure the heap is large enough for two generations size_t smallest_new_size = young_gen_size_lower_bound(); @@ -307,7 +305,7 @@ void GenCollectorPolicy::initialize_flags() { // Make sure NewSize allows an old generation to fit even if set on the command line if (FLAG_IS_CMDLINE(NewSize) && NewSize >= _initial_heap_byte_size) { log_warning(gc, ergo)("NewSize was set larger than initial heap size, will use initial heap size."); - NewSize = bound_minus_alignment(NewSize, _initial_heap_byte_size); + FLAG_SET_ERGO(size_t, NewSize, bound_minus_alignment(NewSize, _initial_heap_byte_size)); } // Now take the actual NewSize into account. We will silently increase NewSize @@ -315,10 +313,7 @@ void GenCollectorPolicy::initialize_flags() { size_t bounded_new_size = bound_minus_alignment(NewSize, MaxHeapSize); bounded_new_size = MAX2(smallest_new_size, (size_t)align_size_down(bounded_new_size, _gen_alignment)); if (bounded_new_size != NewSize) { - // Do not use FLAG_SET_ERGO to update NewSize here, since this will override - // if NewSize was set on the command line or not. This information is needed - // later when setting the initial and minimum young generation size. - NewSize = bounded_new_size; + FLAG_SET_ERGO(size_t, NewSize, bounded_new_size); } _min_young_size = smallest_new_size; _initial_young_size = NewSize; @@ -361,11 +356,11 @@ void GenCollectorPolicy::initialize_flags() { vm_exit_during_initialization("Invalid young gen ratio specified"); } - OldSize = MAX2(OldSize, old_gen_size_lower_bound()); + if (OldSize < old_gen_size_lower_bound()) { + FLAG_SET_ERGO(size_t, OldSize, old_gen_size_lower_bound()); + } if (!is_size_aligned(OldSize, _gen_alignment)) { - // Setting OldSize directly to preserve information about the possible - // setting of OldSize on the command line. - OldSize = align_size_down(OldSize, _gen_alignment); + FLAG_SET_ERGO(size_t, OldSize, align_size_down(OldSize, _gen_alignment)); } if (FLAG_IS_CMDLINE(OldSize) && FLAG_IS_DEFAULT(MaxHeapSize)) { @@ -384,7 +379,7 @@ void GenCollectorPolicy::initialize_flags() { // Adjust NewSize and OldSize or MaxHeapSize to match each other if (NewSize + OldSize > MaxHeapSize) { - if (_max_heap_size_cmdline) { + if (FLAG_IS_CMDLINE(MaxHeapSize)) { // Somebody has set a maximum heap size with the intention that we should not // exceed it. Adjust New/OldSize as necessary. size_t calculated_size = NewSize + OldSize; diff --git a/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp b/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp index 8c9b65e4848..5e8e2354786 100644 --- a/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp +++ b/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp @@ -72,10 +72,6 @@ class CollectorPolicy : public CHeapObj { size_t _space_alignment; size_t _heap_alignment; - // Needed to keep information if MaxHeapSize was set on the command line - // when the flag value is aligned etc by ergonomics. - bool _max_heap_size_cmdline; - // The sizing of the heap is controlled by a sizing policy. AdaptiveSizePolicy* _size_policy; From 77c3e193803a1bc34ad34036017456e2f67101e2 Mon Sep 17 00:00:00 2001 From: Rahul Raghavan Date: Thu, 30 Jun 2016 05:05:52 -0700 Subject: [PATCH 018/108] 8153194: PreserveFPRegistersTest.java runs out of memory in the nightlies Fixed test by setting reference size using WhileBox.getHeapOopSize. Reviewed-by: vlivanov --- .../gcbarriers/PreserveFPRegistersTest.java | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java b/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java index cf63431a3e3..2b8d9f63962 100644 --- a/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java +++ b/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java @@ -25,15 +25,22 @@ /** * @test * @bug 8148175 - * @ignore 8153194 - * @run main/othervm/timeout=300 -Xbatch -Xmx128m PreserveFPRegistersTest + * @requires vm.gc=="G1" | vm.gc=="null" + * @library /testlibrary /test/lib + * @run main/bootclasspath/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -Xmx300m -XX:+UseG1GC PreserveFPRegistersTest */ + +import sun.hotspot.WhiteBox; + public class PreserveFPRegistersTest { public static void main(String... args) throws InterruptedException { new PreserveFPRegistersTest().go(); } + private static WhiteBox wb = WhiteBox.getWhiteBox(); + public final Object[][] storage; /** @@ -52,18 +59,32 @@ public class PreserveFPRegistersTest { public final int regionCount; PreserveFPRegistersTest() { - long regionSize = 1_000_000; //WB.g1RegionSize(); - + long regionSize = wb.g1RegionSize(); Runtime rt = Runtime.getRuntime(); long used = rt.totalMemory() - rt.freeMemory(); long totalFree = rt.maxMemory() - used; regionCount = (int) ( (totalFree / regionSize) * 0.9); - int refSize = 4; - + int refSize = wb.getHeapOopSize(); N = (int) ((regionSize / K ) / refSize) - 5; - storage = new Object[regionCount * K][]; - for (int i = 0; i < storage.length; i++) { - storage[i] = new Object[N]; + + System.out.println("%% Memory"); + System.out.println("%% used : " + used / 1024 + "M"); + System.out.println("%% available : " + totalFree / 1024 + "M"); + System.out.println("%% G1 Region Size: " + regionSize / 1024 + "M"); + System.out.println("%% region count : " + regionCount); + + System.out.println("%% Objects storage"); + System.out.println("%% N (array length) : " + N); + System.out.println("%% K (objects in regions): " + K); + System.out.println("%% Reference size : " + refSize); + + try { + storage = new Object[regionCount * K][]; + for (int i = 0; i < storage.length; i++) { + storage[i] = new Object[N]; + } + } catch(OutOfMemoryError e) { + throw new AssertionError("Test Failed with unexpected OutOfMemoryError exception"); } } From 037c3a6c3900dc76e08084e04ef961b57a106ecb Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Sat, 2 Jul 2016 00:27:19 +0000 Subject: [PATCH 019/108] 8160647: [JVMCI] need to be able to copy internal arrays from LocalVariableTable and LineNumberTable Reviewed-by: twisti, never --- .../src/jdk/vm/ci/meta/LineNumberTable.java | 32 +++++++++++++------ .../jdk/vm/ci/meta/LocalVariableTable.java | 20 ++++++++++++ 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LineNumberTable.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LineNumberTable.java index 71109dccf1b..c67cc6b867d 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LineNumberTable.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LineNumberTable.java @@ -30,32 +30,46 @@ package jdk.vm.ci.meta; public class LineNumberTable { private final int[] lineNumbers; - private final int[] bci; + private final int[] bcis; /** * - * @param lineNumbers an array or source line numbers. This array is now owned by this object + * @param lineNumbers an array of source line numbers. This array is now owned by this object * and should not be mutated by the caller. - * @param bci an array of bytecode indexes the same length at {@code lineNumbers} whose entries + * @param bcis an array of bytecode indexes the same length at {@code lineNumbers} whose entries * are sorted in ascending order. This array is now owned by this object and must not * be mutated by the caller. */ @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `lineNumbers` and `bcis`") - public LineNumberTable(int[] lineNumbers, int[] bci) { - assert bci.length == lineNumbers.length; + public LineNumberTable(int[] lineNumbers, int[] bcis) { + assert bcis.length == lineNumbers.length; this.lineNumbers = lineNumbers; - this.bci = bci; + this.bcis = bcis; } /** - * Gets a source line number for {@code atBci}. + * Gets a source line number for bytecode index {@code atBci}. */ public int getLineNumber(int atBci) { - for (int i = 0; i < this.bci.length - 1; i++) { - if (this.bci[i] <= atBci && atBci < this.bci[i + 1]) { + for (int i = 0; i < this.bcis.length - 1; i++) { + if (this.bcis[i] <= atBci && atBci < this.bcis[i + 1]) { return lineNumbers[i]; } } return lineNumbers[lineNumbers.length - 1]; } + + /** + * Gets a copy of the array of line numbers that was passed to this object's constructor. + */ + public int[] getLineNumbers() { + return lineNumbers.clone(); + } + + /** + * Gets a copy of the array of bytecode indexes that was passed to this object's constructor. + */ + public int[] getBcis() { + return bcis.clone(); + } } diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTable.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTable.java index b81ec8d3880..63f135e5aa2 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTable.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTable.java @@ -26,6 +26,8 @@ import java.util.ArrayList; import java.util.List; /** + * Describes the {@link Local}s for a Java method. + * * @see "https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.13" */ public class LocalVariableTable { @@ -33,6 +35,7 @@ public class LocalVariableTable { private final Local[] locals; /** + * Creates an object describing the {@link Local}s for a Java method. * * @param locals array of objects describing local variables. This array is now owned by this * object and must not be mutated by the caller. @@ -42,6 +45,13 @@ public class LocalVariableTable { this.locals = locals; } + /** + * Gets a description of a local variable that occupies the bytecode frame slot indexed by + * {@code slot} and is live at the bytecode index {@code bci} + * + * @return a description of the requested local variable or null if no such variable matches + * {@code slot} and {@code bci} + */ public Local getLocal(int slot, int bci) { Local result = null; for (Local local : locals) { @@ -56,6 +66,16 @@ public class LocalVariableTable { return result; } + /** + * Gets a copy of the array of {@link Local}s that was passed to this object's constructor. + */ + public Local[] getLocals() { + return locals.clone(); + } + + /** + * Gets a description of all the local variables live at the bytecode index {@code bci} + */ public Local[] getLocalsAt(int bci) { List result = new ArrayList<>(); for (Local l : locals) { From 9ab5f632b544d36cadf798846de5a10b3c738669 Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Mon, 4 Jul 2016 09:14:02 +0200 Subject: [PATCH 020/108] 8160651: StubRoutines::_dtan does not restore callee save register rbx Pop rbx before leaving stub. Reviewed-by: vlivanov, vdeshpande --- .../src/cpu/x86/vm/macroAssembler_x86_tan.cpp | 2 +- hotspot/src/share/vm/opto/library_call.cpp | 89 ------------------- 2 files changed, 1 insertion(+), 90 deletions(-) diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86_tan.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86_tan.cpp index 18fe151cd33..109799198e3 100644 --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86_tan.cpp +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86_tan.cpp @@ -1060,7 +1060,7 @@ void MacroAssembler::fast_tan(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xm bind(B1_4); addq(rsp, 16); - + pop(rbx); } #else // The 32 bit code is at most SSE2 compliant diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index cf1e506cf58..ffcddf60111 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -222,7 +222,6 @@ class LibraryCallKit : public GraphKit { Node* round_double_node(Node* n); bool runtime_math(const TypeFunc* call_type, address funcAddr, const char* funcName); bool inline_math_native(vmIntrinsics::ID id); - bool inline_trig(vmIntrinsics::ID id); bool inline_math(vmIntrinsics::ID id); template bool inline_math_overflow(Node* arg1, Node* arg2); @@ -1691,94 +1690,6 @@ bool LibraryCallKit::inline_math(vmIntrinsics::ID id) { return true; } -//------------------------------inline_trig---------------------------------- -// Inline sin/cos/tan instructions, if possible. If rounding is required, do -// argument reduction which will turn into a fast/slow diamond. -bool LibraryCallKit::inline_trig(vmIntrinsics::ID id) { - Node* arg = round_double_node(argument(0)); - Node* n = NULL; - - n = _gvn.transform(n); - - // Rounding required? Check for argument reduction! - if (Matcher::strict_fp_requires_explicit_rounding) { - static const double pi_4 = 0.7853981633974483; - static const double neg_pi_4 = -0.7853981633974483; - // pi/2 in 80-bit extended precision - // static const unsigned char pi_2_bits_x[] = {0x35,0xc2,0x68,0x21,0xa2,0xda,0x0f,0xc9,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00}; - // -pi/2 in 80-bit extended precision - // static const unsigned char neg_pi_2_bits_x[] = {0x35,0xc2,0x68,0x21,0xa2,0xda,0x0f,0xc9,0xff,0xbf,0x00,0x00,0x00,0x00,0x00,0x00}; - // Cutoff value for using this argument reduction technique - //static const double pi_2_minus_epsilon = 1.564660403643354; - //static const double neg_pi_2_plus_epsilon = -1.564660403643354; - - // Pseudocode for sin: - // if (x <= Math.PI / 4.0) { - // if (x >= -Math.PI / 4.0) return fsin(x); - // if (x >= -Math.PI / 2.0) return -fcos(x + Math.PI / 2.0); - // } else { - // if (x <= Math.PI / 2.0) return fcos(x - Math.PI / 2.0); - // } - // return StrictMath.sin(x); - - // Pseudocode for cos: - // if (x <= Math.PI / 4.0) { - // if (x >= -Math.PI / 4.0) return fcos(x); - // if (x >= -Math.PI / 2.0) return fsin(x + Math.PI / 2.0); - // } else { - // if (x <= Math.PI / 2.0) return -fsin(x - Math.PI / 2.0); - // } - // return StrictMath.cos(x); - - // Actually, sticking in an 80-bit Intel value into C2 will be tough; it - // requires a special machine instruction to load it. Instead we'll try - // the 'easy' case. If we really need the extra range +/- PI/2 we'll - // probably do the math inside the SIN encoding. - - // Make the merge point - RegionNode* r = new RegionNode(3); - Node* phi = new PhiNode(r, Type::DOUBLE); - - // Flatten arg so we need only 1 test - Node *abs = _gvn.transform(new AbsDNode(arg)); - // Node for PI/4 constant - Node *pi4 = makecon(TypeD::make(pi_4)); - // Check PI/4 : abs(arg) - Node *cmp = _gvn.transform(new CmpDNode(pi4,abs)); - // Check: If PI/4 < abs(arg) then go slow - Node *bol = _gvn.transform(new BoolNode( cmp, BoolTest::lt )); - // Branch either way - IfNode *iff = create_and_xform_if(control(),bol, PROB_STATIC_FREQUENT, COUNT_UNKNOWN); - set_control(opt_iff(r,iff)); - - // Set fast path result - phi->init_req(2, n); - - // Slow path - non-blocking leaf call - Node* call = NULL; - switch (id) { - case vmIntrinsics::_dtan: - call = make_runtime_call(RC_LEAF, OptoRuntime::Math_D_D_Type(), - CAST_FROM_FN_PTR(address, SharedRuntime::dtan), - "Tan", NULL, arg, top()); - break; - } - assert(control()->in(0) == call, ""); - Node* slow_result = _gvn.transform(new ProjNode(call, TypeFunc::Parms)); - r->init_req(1, control()); - phi->init_req(1, slow_result); - - // Post-merge - set_control(_gvn.transform(r)); - record_for_igvn(r); - n = _gvn.transform(phi); - - C->set_has_split_ifs(true); // Has chance for split-if optimization - } - set_result(n); - return true; -} - //------------------------------runtime_math----------------------------- bool LibraryCallKit::runtime_math(const TypeFunc* call_type, address funcAddr, const char* funcName) { assert(call_type == OptoRuntime::Math_DD_D_Type() || call_type == OptoRuntime::Math_D_D_Type(), From 0bfd10d69e4040a296b7f6c59675f440c98b91e2 Mon Sep 17 00:00:00 2001 From: Ningsheng Jian Date: Fri, 8 Jul 2016 17:02:10 +0100 Subject: [PATCH 021/108] 8160969: aarch64: CDS is broken after 8079507 Reviewed-by: roland --- hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp index 68827fc2378..3fd9dbef98e 100644 --- a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp @@ -2434,7 +2434,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr __ ldrsb(r0, field); __ push(ztos); // Rewrite bytecode to be faster - if (!is_static) { + if (rc == may_rewrite) { // use btos rewriting, no truncating to t/f bit is needed for getfield. patch_bytecode(Bytecodes::_fast_bgetfield, bc, r1); } @@ -2670,7 +2670,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr if (!is_static) pop_and_check_object(obj); __ andw(r0, r0, 0x1); __ strb(r0, field); - if (!is_static) { + if (rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_zputfield, bc, r1, true, byte_no); } __ b(Done); From b041084b5b7719bd74dbc9e22463c75ffa3f20da Mon Sep 17 00:00:00 2001 From: Dmitrij Pochepko Date: Fri, 8 Jul 2016 20:14:18 +0300 Subject: [PATCH 022/108] 8160276: Jittester: bytecode tests generation hangs in ClassWriter infinite loop Reviewed-by: kvn, iveresov --- .../src/jdk/test/lib/jittester/Automatic.java | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java index ee81bcf4e60..334911c3a03 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java @@ -120,16 +120,30 @@ public class Automatic { String name = "Test_" + counter; Pair irTree = generateIRTree(name); System.out.printf(" %8d |", counter); + long maxWaitTime = TimeUnit.MINUTES.toMillis(MINUTES_TO_WAIT); double generationTime = System.currentTimeMillis() - start; System.out.printf(" %8.0f |", generationTime); start = System.currentTimeMillis(); - for (TestsGenerator generator : generators) { - generator.accept(irTree.first, irTree.second); + Thread generatorThread = new Thread(() -> { + for (TestsGenerator generator : generators) { + generator.accept(irTree.first, irTree.second); + } + }); + generatorThread.start(); + try { + generatorThread.join(maxWaitTime); + } catch (InterruptedException ie) { + throw new Error("Test generation interrupted: " + ie, ie); } - double runningTime = System.currentTimeMillis() - start; - System.out.printf(" %8.0f |%n", runningTime); - if (runningTime < TimeUnit.MINUTES.toMillis(MINUTES_TO_WAIT)) { - ++counter; + if (generatorThread.isAlive()) { + // maxTime reached, so, proceed to next test generation + generatorThread.interrupt(); + } else { + double runningTime = System.currentTimeMillis() - start; + System.out.printf(" %8.0f |%n", runningTime); + if (runningTime < maxWaitTime) { + ++counter; + } } } while (counter < ProductionParams.numberOfTests.value()); } From 6b764fc51aa780f487636cac91b3c14519dcddc3 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Fri, 8 Jul 2016 21:26:02 +0300 Subject: [PATCH 023/108] 8160657: Compiler HotSpot tests should use the "run driver" directive where applicable Reviewed-by: kvn --- .../compiler/intrinsics/bmi/TestAndnI.java | 2 +- .../jsr292/NonInlinedCall/RedefineTest.java | 11 +++++--- .../compilerToVM/AllocateCompileIdTest.java | 5 ++-- .../compilerToVM/CanInlineMethodTest.java | 5 ++-- .../compilerToVM/DisassembleCodeBlobTest.java | 5 ++-- .../DoNotInlineOrCompileTest.java | 5 ++-- .../ExecuteInstalledCodeTest.java | 4 +-- .../compilerToVM/GetConstantPoolTest.java | 5 ++-- .../GetResolvedJavaMethodTest.java | 6 ++--- .../compilerToVM/GetResolvedJavaTypeTest.java | 8 +++--- .../HasCompiledCodeForOSRTest.java | 5 ++-- .../InvalidateInstalledCodeTest.java | 5 ++-- .../compilerToVM/LookupKlassInPoolTest.java | 5 ++-- .../LookupKlassRefIndexInPoolTest.java | 5 ++-- .../compilerToVM/LookupMethodInPoolTest.java | 5 ++-- .../LookupNameAndTypeRefIndexInPoolTest.java | 5 ++-- .../compilerToVM/LookupNameInPoolTest.java | 5 ++-- .../LookupSignatureInPoolTest.java | 5 ++-- .../MaterializeVirtualObjectTest.java | 5 ++-- .../jvmci/compilerToVM/ReprofileTest.java | 6 ++--- .../ResolveConstantInPoolTest.java | 5 ++-- .../compilerToVM/ResolveFieldInPoolTest.java | 5 ++-- ...solvePossiblyCachedConstantInPoolTest.java | 5 ++-- .../compilerToVM/ResolveTypeInPoolTest.java | 5 ++-- .../compilerToVM/ShouldInlineMethodTest.java | 5 ++-- ...JvmciNotifyBootstrapFinishedEventTest.java | 25 ++++++++++--------- .../events/JvmciNotifyInstallEventTest.java | 25 ++++++++++--------- .../jvmci/events/JvmciShutdownEventTest.java | 19 +++++++------- .../compiler/jvmci/meta/StableFieldTest.java | 3 ++- 29 files changed, 114 insertions(+), 90 deletions(-) diff --git a/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java b/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java index 31df8625c42..f5795a2423f 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java @@ -31,7 +31,7 @@ * @modules java.base/jdk.internal.misc * java.management * @build TestAndnI BMITestRunner Expr - * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI TestAndnI diff --git a/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java b/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java index cb77918ff7e..e771f96e24c 100644 --- a/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java +++ b/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java @@ -29,13 +29,16 @@ * java.base/jdk.internal.vm.annotation * @library /testlibrary /test/lib / ../patches * @requires vm.flavor != "minimal" + * * @build sun.hotspot.WhiteBox * @build java.base/java.lang.invoke.MethodHandleHelper * @build compiler.jsr292.NonInlinedCall.RedefineTest - * @run main compiler.jsr292.NonInlinedCall.Agent agent.jar compiler.jsr292.NonInlinedCall.RedefineTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * compiler.jsr292.NonInlinedCall.RedefineTest + * @run driver compiler.jsr292.NonInlinedCall.Agent + * agent.jar + * compiler.jsr292.NonInlinedCall.RedefineTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * compiler.jsr292.NonInlinedCall.RedefineTest * @run main/bootclasspath/othervm -javaagent:agent.jar * -XX:+IgnoreUnrecognizedVMOptions * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java b/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java index daeaaed3360..952aca3ed93 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java @@ -32,11 +32,12 @@ * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.AllocateCompileIdTest * @build sun.hotspot.WhiteBox - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java index 7a313d4a411..d78a5a1a385 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java @@ -33,11 +33,12 @@ * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.CanInlineMethodTest * @build sun.hotspot.WhiteBox - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java index aeb384da0fe..f172b3a1022 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java @@ -33,12 +33,13 @@ * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code + * * @ignore 8139700 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build sun.hotspot.WhiteBox * compiler.jvmci.compilerToVM.DisassembleCodeBlobTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java index a3ab66ac36a..e783a981e4f 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java @@ -33,11 +33,12 @@ * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.DoNotInlineOrCompileTest * @build sun.hotspot.WhiteBox - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java index 5ea1bbd8923..b931adcff13 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java @@ -33,8 +33,8 @@ import java.util.Map; * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.ExecuteInstalledCodeTest * @build sun.hotspot.WhiteBox - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java index 00be36102ad..6cca8e73afe 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java @@ -31,12 +31,13 @@ * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.meta + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build jdk.vm.ci/jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject * @build compiler.jvmci.compilerToVM.GetConstantPoolTest * @build sun.hotspot.WhiteBox - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java index 8353fc5c536..9ae630c2c5c 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java @@ -29,12 +29,12 @@ * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * jdk.vm.ci/jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject * @build compiler.jvmci.compilerToVM.GetResolvedJavaMethodTest - * @run main ClassFileInstaller - * sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java index b676d1526f5..275b78f1e19 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java @@ -27,17 +27,17 @@ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") * @library / /testlibrary /test/lib * @library ../common/patches - * @ignore 8158860 * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.meta + * + * @ignore 8158860 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * jdk.vm.ci/jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject * @build compiler.jvmci.compilerToVM.GetResolvedJavaTypeTest * @build sun.hotspot.WhiteBox - * @run main ClassFileInstaller - * sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java b/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java index 84acf8ccd7b..5a59bec7939 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java @@ -33,11 +33,12 @@ * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.HasCompiledCodeForOSRTest * @build sun.hotspot.WhiteBox - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java index 881e339a495..fa4acfd082b 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java @@ -34,12 +34,13 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * jdk.vm.ci/jdk.vm.ci.runtime + * * @ignore 8139700 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.InvalidateInstalledCodeTest * @build sun.hotspot.WhiteBox - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java index e7db5ed1572..765ec293f31 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java @@ -36,11 +36,12 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.meta + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build sun.hotspot.WhiteBox * compiler.jvmci.compilerToVM.LookupKlassInPoolTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java index 284a3e380d1..c6c38683b86 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java @@ -35,11 +35,12 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.meta + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build sun.hotspot.WhiteBox * compiler.jvmci.compilerToVM.LookupKlassRefIndexInPoolTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.LookupKlassRefIndexInPoolTest diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java index 6659178ba68..3aa3302ac2a 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java @@ -35,11 +35,12 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build sun.hotspot.WhiteBox * compiler.jvmci.compilerToVM.LookupMethodInPoolTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.LookupMethodInPoolTest diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java index 52405b0bf22..6eeb164e798 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java @@ -35,11 +35,12 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.meta + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build sun.hotspot.WhiteBox * compiler.jvmci.compilerToVM.LookupNameAndTypeRefIndexInPoolTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.LookupNameAndTypeRefIndexInPoolTest diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java index 96d05f59f17..857aa7f8dd9 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java @@ -35,11 +35,12 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.meta + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build sun.hotspot.WhiteBox * compiler.jvmci.compilerToVM.LookupNameInPoolTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.LookupNameInPoolTest diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java index 4f67c5a660e..ea8d7bfbec9 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java @@ -35,11 +35,12 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.meta + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build sun.hotspot.WhiteBox * compiler.jvmci.compilerToVM.LookupSignatureInPoolTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.LookupSignatureInPoolTest diff --git a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java index 9ffd2818e93..79f3b25791a 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java @@ -33,11 +33,12 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * jdk.vm.ci/jdk.vm.ci.meta + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest * @build sun.hotspot.WhiteBox - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xmixed -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java index 169dcf749da..19953bc5fda 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java @@ -34,13 +34,13 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * jdk.vm.ci/jdk.vm.ci.meta + * * @ignore 8157861 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build sun.hotspot.WhiteBox * @build compiler.jvmci.compilerToVM.ReprofileTest - * @run main ClassFileInstaller - * sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java index 1e86d3e62cb..61a3a4a2465 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java @@ -34,11 +34,12 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.meta + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build sun.hotspot.WhiteBox * compiler.jvmci.compilerToVM.ResolveConstantInPoolTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java index 62a1427ee8a..8514146e5b6 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java @@ -35,11 +35,12 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build sun.hotspot.WhiteBox * compiler.jvmci.compilerToVM.ResolveFieldInPoolTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.ResolveFieldInPoolTest diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java index a284b5c3d16..437ae0ad0f5 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java @@ -35,11 +35,12 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.meta + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build sun.hotspot.WhiteBox * compiler.jvmci.compilerToVM.ResolvePossiblyCachedConstantInPoolTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.ResolvePossiblyCachedConstantInPoolTest diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java index 12055f54f7e..c854f59155b 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java @@ -35,11 +35,12 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.meta + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build sun.hotspot.WhiteBox * compiler.jvmci.compilerToVM.ResolveTypeInPoolTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java index ebaf42987a6..4d7eb4ad411 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java @@ -33,11 +33,12 @@ * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.ShouldInlineMethodTest * @build sun.hotspot.WhiteBox - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java index 3486e323b52..eb387617768 100644 --- a/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java +++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java @@ -28,26 +28,27 @@ * @library / /testlibrary * @library ../common/patches * @modules java.base/jdk.internal.misc - java.base/jdk.internal.org.objectweb.asm + * java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.common.JVMCIHelpers - * compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest - * @run main jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/ - * @run main jdk.test.lib.FileInstaller ./JvmciNotifyBootstrapFinishedEventTest.config + * compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest + * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/ + * @run driver jdk.test.lib.FileInstaller ./JvmciNotifyBootstrapFinishedEventTest.config * ./META-INF/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener - * @run main ClassFileInstaller - * compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler - * compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory - * compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult - * compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener - * compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest - * jdk.test.lib.Asserts - * jdk.test.lib.Utils + * @run driver ClassFileInstaller + * compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler + * compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory + * compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult + * compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener + * compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest + * jdk.test.lib.Asserts + * jdk.test.lib.Utils * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:. * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java index 3a2a4a799fc..72fb90d027e 100644 --- a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java +++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java @@ -34,23 +34,24 @@ * jdk.vm.ci/jdk.vm.ci.code * jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime + * * @ignore 8144964 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.common.JVMCIHelpers * compiler.jvmci.events.JvmciNotifyInstallEventTest - * @run main jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/ - * @run main jdk.test.lib.FileInstaller ./JvmciNotifyInstallEventTest.config + * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/ + * @run driver jdk.test.lib.FileInstaller ./JvmciNotifyInstallEventTest.config * ./META-INF/services/jdk.vm.ci.hotspot.HotSpotVMEventListener - * @run main ClassFileInstaller - * compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler - * compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory - * compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult - * compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener - * compiler.jvmci.events.JvmciNotifyInstallEventTest - * compiler.jvmci.common.CTVMUtilities - * compiler.jvmci.common.testcases.SimpleClass - * jdk.test.lib.Asserts - * jdk.test.lib.Utils + * @run driver ClassFileInstaller + * compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler + * compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory + * compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult + * compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener + * compiler.jvmci.events.JvmciNotifyInstallEventTest + * compiler.jvmci.common.CTVMUtilities + * compiler.jvmci.common.testcases.SimpleClass + * jdk.test.lib.Asserts + * jdk.test.lib.Utils * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI diff --git a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java index c36896a84ec..d01d2784195 100644 --- a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java +++ b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java @@ -31,23 +31,22 @@ * jdk.vm.ci/jdk.vm.ci.code * jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime + * * @build compiler.jvmci.common.JVMCIHelpers * compiler.jvmci.events.JvmciShutdownEventListener * compiler.jvmci.events.JvmciShutdownEventTest - * @run main jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/ - * @run main jdk.test.lib.FileInstaller ./JvmciShutdownEventTest.config + * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/ + * @run driver jdk.test.lib.FileInstaller ./JvmciShutdownEventTest.config * ./META-INF/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener - * @run main ClassFileInstaller - * compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler - * compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory - * compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult - * compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener - * compiler.jvmci.events.JvmciShutdownEventListener + * @run driver ClassFileInstaller + * compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler + * compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory + * compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult + * compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener + * compiler.jvmci.events.JvmciShutdownEventListener * @run main/othervm compiler.jvmci.events.JvmciShutdownEventTest */ - // as soon as CODETOOLS-7901589 fixed, '@run main/othervm' at L43 should be replaced w/ '@run driver' - package compiler.jvmci.events; import jdk.test.lib.ExitCode; diff --git a/hotspot/test/compiler/jvmci/meta/StableFieldTest.java b/hotspot/test/compiler/jvmci/meta/StableFieldTest.java index c2087a57af8..ad131e244e2 100644 --- a/hotspot/test/compiler/jvmci/meta/StableFieldTest.java +++ b/hotspot/test/compiler/jvmci/meta/StableFieldTest.java @@ -31,8 +31,9 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime + * * @compile StableFieldTest.java - * @run main ClassFileInstaller compiler.jvmci.meta.StableFieldTest + * @run driver ClassFileInstaller compiler.jvmci.meta.StableFieldTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Xbootclasspath/a:. compiler.jvmci.meta.StableFieldTest */ From 48d49a9522ae08b387623d4e613f1d9d60f8a55a Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Mon, 11 Jul 2016 19:15:21 +0000 Subject: [PATCH 024/108] 8160730: [JVMCI] compiler selection should work without -Djvmci.Compiler Reviewed-by: kvn, twisti, never --- .../hotspot/HotSpotJVMCICompilerConfig.java | 21 +++++++++++++++++-- .../events/JvmciNotifyInstallEventTest.java | 13 ++++++++---- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java index 672cf0b2b39..89e2ae2c199 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java @@ -32,6 +32,11 @@ import jdk.vm.ci.services.Services; final class HotSpotJVMCICompilerConfig { + /** + * This factory allows JVMCI initialization to succeed but raises an error if the VM asks JVMCI + * to perform a compilation. This allows the reflective parts of the JVMCI API to be used + * without requiring a compiler implementation to be available. + */ private static class DummyCompilerFactory extends JVMCICompilerFactory implements JVMCICompiler { public HotSpotCompilationRequestResult compileMethod(CompilationRequest request) { @@ -67,7 +72,6 @@ final class HotSpotJVMCICompilerConfig { for (JVMCICompilerFactory f : Services.load(JVMCICompilerFactory.class)) { if (f.getCompilerName().equals(compilerName)) { Services.exportJVMCITo(f.getClass()); - f.onSelection(); factory = f; } } @@ -75,8 +79,21 @@ final class HotSpotJVMCICompilerConfig { throw new JVMCIError("JVMCI compiler '%s' not found", compilerName); } } else { - factory = new DummyCompilerFactory(); + // Auto select a single available compiler + for (JVMCICompilerFactory f : Services.load(JVMCICompilerFactory.class)) { + if (factory == null) { + factory = f; + } else { + // Multiple factories seen - cancel auto selection + factory = null; + break; + } + } + if (factory == null) { + factory = new DummyCompilerFactory(); + } } + factory.onSelection(); compilerFactory = factory; } return compilerFactory; diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java index 72fb90d027e..3677d6d2a5b 100644 --- a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java +++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java @@ -32,16 +32,16 @@ * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code + * jdk.vm.ci/jdk.vm.ci.code.site * jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime * - * @ignore 8144964 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.common.JVMCIHelpers * compiler.jvmci.events.JvmciNotifyInstallEventTest * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/ * @run driver jdk.test.lib.FileInstaller ./JvmciNotifyInstallEventTest.config - * ./META-INF/services/jdk.vm.ci.hotspot.HotSpotVMEventListener + * ./META-INF/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener * @run driver ClassFileInstaller * compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler * compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory @@ -53,6 +53,11 @@ * jdk.test.lib.Asserts * jdk.test.lib.Utils * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Xbootclasspath/a:. -Xmixed + * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI + * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false + * compiler.jvmci.events.JvmciNotifyInstallEventTest + * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false @@ -75,7 +80,7 @@ import compiler.jvmci.common.testcases.SimpleClass; import jdk.test.lib.Asserts; import java.lang.reflect.Method; import jdk.test.lib.Utils; -import jdk.vm.ci.hotspot.HotSpotVMEventListener; +import jdk.vm.ci.hotspot.services.HotSpotVMEventListener; import jdk.vm.ci.code.CompiledCode; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.code.site.DataPatch; @@ -88,7 +93,7 @@ import jdk.vm.ci.hotspot.HotSpotCompiledCode.Comment; import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -public class JvmciNotifyInstallEventTest implements HotSpotVMEventListener { +public class JvmciNotifyInstallEventTest extends HotSpotVMEventListener { private static final String METHOD_NAME = "testMethod"; private static final boolean FAIL_ON_INIT = !Boolean.getBoolean( "compiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit"); From e990410b51f3514f8ff6e33f256a42862aea78b0 Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Tue, 12 Jul 2016 08:57:00 +0200 Subject: [PATCH 025/108] 8160898: assert while replaying ciReplay file created using TieredStopAtLevel=1 Use highest available tier if no compilation level is specified in replay file. Reviewed-by: zmajo --- hotspot/src/share/vm/ci/ciReplay.cpp | 3 ++- hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/ci/ciReplay.cpp b/hotspot/src/share/vm/ci/ciReplay.cpp index 27b00023563..ec788919c32 100644 --- a/hotspot/src/share/vm/ci/ciReplay.cpp +++ b/hotspot/src/share/vm/ci/ciReplay.cpp @@ -490,7 +490,8 @@ class CompileReplay : public StackObj { int comp_level = parse_int(comp_level_label); // old version w/o comp_level if (had_error() && (error_message() == comp_level_label)) { - comp_level = CompLevel_full_optimization; + // use highest available tier + comp_level = TieredCompilation ? TieredStopAtLevel : CompLevel_highest_tier; } if (!is_valid_comp_level(comp_level)) { return; diff --git a/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh b/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh index fd0bd005fc2..85ce38b6605 100644 --- a/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh +++ b/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh @@ -29,7 +29,6 @@ ## @summary testing of ciReplay with using generated by VM replay.txt w/o comp_level ## @author igor.ignatyev@oracle.com ## @requires vm.flightRecorder != true -## @ignore 8157984 ## @run shell TestVM_no_comp_level.sh ## From ad7a77868391f9c323227e537c24f884fb538e81 Mon Sep 17 00:00:00 2001 From: Zoltan Majo Date: Tue, 12 Jul 2016 10:16:36 +0200 Subject: [PATCH 026/108] 8098573: Compiler accesses to shared archive fail if archive is remapped Change ciEnv::~ciEnv() to remove symbols in VM state. Reviewed-by: kvn, dholmes --- hotspot/src/share/vm/ci/ciEnv.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hotspot/src/share/vm/ci/ciEnv.cpp b/hotspot/src/share/vm/ci/ciEnv.cpp index 7bb8f759ffe..323b75a5016 100644 --- a/hotspot/src/share/vm/ci/ciEnv.cpp +++ b/hotspot/src/share/vm/ci/ciEnv.cpp @@ -204,11 +204,13 @@ ciEnv::ciEnv(Arena* arena) : _ciEnv_arena(mtCompiler) { } ciEnv::~ciEnv() { - CompilerThread* current_thread = CompilerThread::current(); - _factory->remove_symbols(); - // Need safepoint to clear the env on the thread. RedefineClasses might - // be reading it. - GUARDED_VM_ENTRY(current_thread->set_env(NULL);) + GUARDED_VM_ENTRY( + CompilerThread* current_thread = CompilerThread::current(); + _factory->remove_symbols(); + // Need safepoint to clear the env on the thread. RedefineClasses might + // be reading it. + current_thread->set_env(NULL); + ) } // ------------------------------------------------------------------ From a0381422ddb56f6cf8fc2fd1a7f111e11925a7d1 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Tue, 12 Jul 2016 18:24:48 +0300 Subject: [PATCH 027/108] 8132919: Put compiler tests in packages Reviewed-by: vlivanov, dpochepk --- hotspot/make/test/JtregNative.gmk | 1 - hotspot/test/TEST.groups | 34 +- .../BMICommandLineOptionTestBase.java | 5 +- .../arguments/BMISupportedCPUTest.java | 6 +- .../arguments/BMIUnsupportedCPUTest.java | 7 +- .../arguments/CheckCICompilerCount.java | 11 +- .../CheckCompileThresholdScaling.java | 11 +- ...TestUseBMI1InstructionsOnSupportedCPU.java | 16 +- ...stUseBMI1InstructionsOnUnsupportedCPU.java | 17 +- .../compiler/arguments/TestUseCompiler.java | 7 +- ...LeadingZerosInstructionOnSupportedCPU.java | 15 +- ...adingZerosInstructionOnUnsupportedCPU.java | 15 +- ...railingZerosInstructionOnSupportedCPU.java | 18 +- ...ilingZerosInstructionOnUnsupportedCPU.java | 18 +- .../arraycopy/TestArrayCloneBadAssert.java | 6 +- .../arraycopy/TestArrayCopyAsLoadsStores.java | 17 +- .../arraycopy/TestArrayCopyBadReexec.java | 5 +- .../arraycopy/TestArrayCopyMacro.java | 5 +- .../arraycopy/TestArrayCopyNoInit.java | 5 +- .../arraycopy/TestArrayCopyNoInitDeopt.java | 17 +- .../arraycopy/TestArrayCopyOfStopped.java | 5 +- .../TestArrayCopyOverflowArguments.java | 5 +- .../TestArrayCopyOverflowInBoundChecks.java | 6 +- .../TestArrayCopyStoppedAfterGuards.java | 8 +- .../arraycopy/TestArrayCopyUtils.java | 10 +- .../TestArraysCopyOfNoTypeCheck.java | 5 +- .../TestDeadArrayCopyOnMemChain.java | 5 +- .../arraycopy/TestEliminateArrayCopy.java | 9 +- .../TestEliminatedArrayCopyDeopt.java | 10 +- .../arraycopy/TestEliminatedArrayCopyPhi.java | 5 +- ...EliminatedArrayLoopPredicateCopyDeopt.java | 5 +- .../TestInstanceCloneAsLoadsStores.java | 19 +- .../arraycopy/TestInstanceCloneUtils.java | 8 +- .../arraycopy/TestLoadBypassArrayCopy.java | 7 +- .../arraycopy/TestMissingControl.java | 7 +- .../arraycopy/TestObjectArrayClone.java | 8 +- .../TestReduceBulkZeroingDisabled.java | 7 +- .../compiler/c1/6478991/NullCheckTest.java | 72 - .../compiler/c1/CanonicalizeArrayLength.java | 26 +- hotspot/test/compiler/c1/NullCheckTest.java | 77 + .../c1/{6579789 => }/Test6579789.java | 7 +- .../c1/{6756768 => }/Test6756768.java | 4 +- .../c1/{6756768 => }/Test6756768_2.java | 4 +- .../c1/{6757316 => }/Test6757316.java | 5 +- .../c1/{6758234 => }/Test6758234.java | 7 +- .../c1/{6795465 => }/Test6795465.java | 4 +- .../{6849574/Test.java => Test6849574.java} | 9 +- .../c1/{6855215 => }/Test6855215.java | 4 +- .../c1/{6932496 => }/Test6932496.java | 24 +- .../c1/{7042153 => }/Test7042153.java | 20 +- .../c1/{7090976 => }/Test7090976.java | 5 +- .../c1/{7103261 => }/Test7103261.java | 4 +- .../c1/{7123108 => }/Test7123108.java | 4 +- .../c1/{8004051 => }/Test8004051.java | 4 +- .../c1/{8011706 => }/Test8011706.java | 5 +- .../c1/{8011771 => }/Test8011771.java | 4 +- ...rayCopy6769124.java => TestArrayCopy.java} | 6 +- ...DeoptInt6769124.java => TestDeoptInt.java} | 8 +- ...oad6769124.java => TestUnalignedLoad.java} | 6 +- .../test/compiler/c2/5091921/Test6905845.java | 76 - hotspot/test/compiler/c2/6823453/Test.java | 96 -- .../test/compiler/c2/7190310/Test7190310.java | 87 - .../c2/7190310/Test7190310_unsafe.java | 143 -- .../test/compiler/c2/8002069/Test8002069.java | 98 -- .../compiler/c2/FloatingPointFoldingTest.java | 12 +- .../compiler/c2/{6663621 => }/IVTest.java | 4 + .../c2/{6772683 => }/InterruptedTest.java | 5 +- .../c2/{6894807 => }/IsInstanceTest.java | 5 +- .../c2/{8005956 => }/PolynomialRoot.java | 20 +- .../c2/{5057225 => }/Test5057225.java | 12 +- .../c2/{5091921 => }/Test5091921.java | 6 +- .../c2/{5091921 => }/Test6186134.java | 65 +- .../c2/{5091921 => }/Test6196102.java | 4 +- .../c2/{5091921 => }/Test6357214.java | 50 +- .../c2/{6443505 => }/Test6443505.java | 6 +- .../c2/{5091921 => }/Test6559156.java | 4 +- .../{6603011/Test.java => Test6603011.java} | 24 +- .../Test1.java => Test6636138_1.java} | 8 +- .../Test2.java => Test6636138_2.java} | 38 +- .../{6646019/Test.java => Test6646019.java} | 39 +- .../{6661247/Test.java => Test6661247.java} | 8 +- .../{6695810/Test.java => Test6695810.java} | 13 +- .../c2/{6700047 => }/Test6700047.java | 5 +- .../{6711100/Test.java => Test6711100.java} | 13 +- .../{6724218/Test.java => Test6724218.java} | 23 +- .../c2/{6732154 => }/Test6732154.java | 7 +- .../{6741738/Tester.java => Test6741738.java} | 39 +- .../c2/{5091921 => }/Test6753639.java | 4 +- .../c2/{6792161 => }/Test6792161.java | 7 +- .../c2/{6795362 => }/Test6795362.java | 6 +- .../c2/{6796786 => }/Test6796786.java | 4 +- .../{6799693/Test.java => Test6799693.java} | 29 +- .../c2/{6800154 => }/Test6800154.java | 12 +- .../c2/{6805724 => }/Test6805724.java | 11 +- hotspot/test/compiler/c2/Test6823453.java | 109 ++ .../{6832293/Test.java => Test6832293.java} | 67 +- .../c2/{6837011 => }/Test6837011.java | 6 +- .../{6837094/Test.java => Test6837094.java} | 52 +- .../{6843752/Test.java => Test6843752.java} | 9 +- .../c2/{5091921 => }/Test6850611.java | 4 +- .../{6851282/Test.java => Test6851282.java} | 128 +- .../c2/{6852078 => }/Test6852078.java | 11 +- .../c2/{6857159 => }/Test6857159.java | 79 +- .../c2/{6863155 => }/Test6863155.java | 6 +- .../{6866651/Test.java => Test6866651.java} | 6 +- .../{6877254/Test.java => Test6877254.java} | 6 +- .../c2/{6880034 => }/Test6880034.java | 70 +- .../c2/{6885584 => }/Test6885584.java | 4 +- .../c2/{5091921 => }/Test6897150.java | 4 +- .../{6901572/Test.java => Test6901572.java} | 5 +- hotspot/test/compiler/c2/Test6905845.java | 78 + .../{6910484/Test.java => Test6910484.java} | 6 +- .../{6910605/Test.java => Test6910605_1.java} | 11 +- .../{6910618/Test.java => Test6910605_2.java} | 62 +- .../{6912517/Test.java => Test6912517.java} | 11 +- .../c2/{6916644 => }/Test6916644.java | 6 +- .../c2/{6930043 => }/Test6930043.java | 4 +- .../c2/{5091921 => }/Test6931567.java | 4 +- .../c2/{5091921 => }/Test6935022.java | 4 +- .../c2/{6956668 => }/Test6956668.java | 3 +- .../{6958485/Test.java => Test6958485.java} | 8 +- .../c2/{5091921 => }/Test6959129.java | 4 +- .../c2/{6968348 => }/Test6968348.java | 9 +- .../{6973329/Test.java => Test6973329.java} | 56 +- .../c2/{5091921 => }/Test6985295.java | 4 +- .../c2/{5091921 => }/Test6992759.java | 4 +- .../c2/{7002666 => }/Test7002666.java | 10 +- .../c2/{7009359 => }/Test7009359.java | 7 +- .../{7017746/Test.java => Test7017746.java} | 30 +- .../c2/{5091921 => }/Test7020614.java | 4 +- .../c2/{7024475 => }/Test7024475.java | 4 +- .../{7029152/Test.java => Test7029152.java} | 30 +- .../c2/{7041100 => }/Test7041100.java | 4 +- .../c2/{7046096 => }/Test7046096.java | 48 +- .../c2/{7047069 => }/Test7047069.java | 9 +- .../c2/{7048332 => }/Test7048332.java | 43 +- .../c2/{7068051 => }/Test7068051.java | 6 +- .../c2/{7110586 => }/Test7110586.java | 4 +- .../c2/{7125879 => }/Test7125879.java | 4 +- .../c2/{7160610 => }/Test7160610.java | 4 +- .../c2/{7169782 => }/Test7169782.java | 6 +- .../c2/{7174363 => }/Test7174363.java | 9 +- .../c2/{7177917 => }/Test7177917.java | 13 +- .../c2/{7179138 => }/Test7179138_1.java | 6 +- .../c2/{7179138 => }/Test7179138_2.java | 6 +- hotspot/test/compiler/c2/Test7190310.java | 91 ++ .../test/compiler/c2/Test7190310_unsafe.java | 154 ++ .../c2/{7199742 => }/Test7199742.java | 40 +- .../c2/{8000805 => }/Test8000805.java | 46 +- hotspot/test/compiler/c2/Test8002069.java | 113 ++ .../c2/{8004741 => }/Test8004741.java | 12 +- .../c2/{8007294 => }/Test8007294.java | 6 +- .../c2/{8007722 => }/Test8007722.java | 7 +- .../{6946040 => }/TestCharShortByteSwap.java | 8 +- .../c2/TestDominatingDeadCheckCast.java | 7 +- .../{6921969 => }/TestMultiplyLongHiZero.java | 13 +- .../{6340864 => cr6340864}/TestByteVect.java | 4 +- .../TestDoubleVect.java | 4 +- .../{6340864 => cr6340864}/TestFloatVect.java | 4 +- .../{6340864 => cr6340864}/TestIntVect.java | 4 +- .../{6340864 => cr6340864}/TestLongVect.java | 4 +- .../{6340864 => cr6340864}/TestShortVect.java | 4 +- .../InlinedArrayCloneTestCase.java | 2 + .../c2/{6589834 => cr6589834}/Test_ia32.java | 25 +- .../c2/{6646020 => cr6646020}/Tester.java | 4 + .../c2/{6663848 => cr6663848}/Tester.java | 3 + .../{6663854 => cr6663854}/Test6663854.java | 3 +- .../c2/{6711117 => cr6711117}/Test.java | 7 +- .../{6712835 => cr6712835}/Test6712835.java | 5 +- .../c2/{6714694 => cr6714694}/Tester.java | 4 +- .../c2/{6865031 => cr6865031}/Test.java | 8 +- .../{5091921 => cr6890943}/Test6890943.java | 7 +- .../{5091921 => cr6890943}/input6890943.txt | 0 .../{5091921 => cr6890943}/output6890943.txt | 0 .../{5091921 => cr7005594}/Test7005594.java | 2 + .../c2/{5091921 => cr7005594}/Test7005594.sh | 5 +- .../{7192963 => cr7192963}/TestByteVect.java | 4 +- .../TestDoubleVect.java | 4 +- .../{7192963 => cr7192963}/TestFloatVect.java | 4 +- .../{7192963 => cr7192963}/TestIntVect.java | 4 +- .../{7192963 => cr7192963}/TestLongVect.java | 4 +- .../{7192963 => cr7192963}/TestShortVect.java | 4 +- .../c2/{7200264 => cr7200264}/Test7200264.sh | 4 +- .../{7200264 => cr7200264}/TestIntVect.java | 1 + .../TestIntAtomicCAS.java | 10 +- .../TestIntAtomicOrdered.java | 10 +- .../TestIntAtomicVolatile.java | 10 +- .../TestIntUnsafeCAS.java | 15 +- .../TestIntUnsafeOrdered.java | 13 +- .../TestIntUnsafeVolatile.java | 15 +- .../c2/{7070134 => stemmer}/Stemmer.java | 9 +- .../compiler/c2/{7070134 => stemmer}/words | 0 .../{native => calls}/TestDirtyInt.java | 6 +- .../test/compiler/calls/common/CallsBase.java | 5 +- .../calls/common/InvokeDynamicPatcher.java | 15 +- .../CompiledInvokeDynamic2CompiledTest.java | 7 +- ...CompiledInvokeDynamic2InterpretedTest.java | 5 +- .../CompiledInvokeDynamic2NativeTest.java | 7 +- .../CompiledInvokeInterface2CompiledTest.java | 3 +- ...mpiledInvokeInterface2InterpretedTest.java | 3 +- .../CompiledInvokeInterface2NativeTest.java | 3 +- .../CompiledInvokeSpecial2CompiledTest.java | 3 +- ...CompiledInvokeSpecial2InterpretedTest.java | 3 +- .../CompiledInvokeSpecial2NativeTest.java | 3 +- .../CompiledInvokeStatic2CompiledTest.java | 3 +- .../CompiledInvokeStatic2InterpretedTest.java | 3 +- .../CompiledInvokeStatic2NativeTest.java | 3 +- .../CompiledInvokeVirtual2CompiledTest.java | 3 +- ...CompiledInvokeVirtual2InterpretedTest.java | 3 +- .../CompiledInvokeVirtual2NativeTest.java | 3 +- ...InterpretedInvokeDynamic2CompiledTest.java | 7 +- ...erpretedInvokeDynamic2InterpretedTest.java | 7 +- .../InterpretedInvokeDynamic2NativeTest.java | 7 +- ...terpretedInvokeInterface2CompiledTest.java | 3 +- ...pretedInvokeInterface2InterpretedTest.java | 3 +- ...InterpretedInvokeInterface2NativeTest.java | 3 +- ...erpretedInvokeSpecial2InterpretedTest.java | 3 +- .../InterpretedInvokeSpecial2NativeTest.java | 3 +- .../InterpretedInvokeStatic2CompiledTest.java | 3 +- ...terpretedInvokeStatic2InterpretedTest.java | 3 +- .../InterpretedInvokeStatic2NativeTest.java | 3 +- ...InterpretedInvokeVirtual2CompiledTest.java | 3 +- ...erpretedInvokeVirtual2InterpretedTest.java | 3 +- .../InterpretedInvokeVirtual2NativeTest.java | 3 +- .../NativeInvokeSpecial2CompiledTest.java | 3 +- .../NativeInvokeSpecial2InterpretedTest.java | 3 +- .../NativeInvokeSpecial2NativeTest.java | 3 +- .../NativeInvokeStatic2CompiledTest.java | 3 +- .../NativeInvokeStatic2InterpretedTest.java | 3 +- .../NativeInvokeStatic2NativeTest.java | 3 +- .../NativeInvokeVirtual2CompiledTest.java | 3 +- .../NativeInvokeVirtual2InterpretedTest.java | 3 +- .../NativeInvokeVirtual2NativeTest.java | 3 +- .../{native => calls}/libTestDirtyInt.c | 2 +- .../TestAnonymousClassUnloading.java | 31 +- .../methodUnloading/TestMethodUnloading.java | 34 +- .../methodUnloading/WorkerClass.java | 3 + ...kReservedInitialCodeCacheSizeArgOrder.java | 37 +- .../codecache/CheckSegmentedCodeCache.java | 214 +-- .../compiler/codecache/CheckUpperLimit.java | 25 +- .../codecache/OverflowCodeCacheTest.java | 38 +- .../cli/TestSegmentedCodeCacheOption.java | 21 +- .../CodeCacheFreeSpaceRunner.java | 7 +- .../GenericCodeHeapSizeRunner.java | 7 +- .../cli/codeheapsize/JVMStartupRunner.java | 8 +- .../codeheapsize/TestCodeHeapSizeOptions.java | 24 +- .../cli/common/CodeCacheCLITestBase.java | 3 +- .../cli/common/CodeCacheCLITestCase.java | 2 +- .../cli/common/CodeCacheInfoFormatter.java | 3 +- .../cli/common/CodeCacheOptions.java | 2 +- .../printcodecache/PrintCodeCacheRunner.java | 9 +- .../TestPrintCodeCacheOption.java | 22 +- .../dtrace/SegmentedCodeCacheDtraceTest.java | 33 +- .../SegmentedCodeCacheDtraceTestWorker.java | 5 +- .../compiler/codecache/jmx/BeanTypeTest.java | 37 +- .../codecache/jmx/CodeCacheUtils.java | 7 +- .../jmx/CodeHeapBeanPresenceTest.java | 37 +- .../compiler/codecache/jmx/GetUsageTest.java | 40 +- .../codecache/jmx/InitialAndMaxUsageTest.java | 36 +- .../codecache/jmx/ManagerNamesTest.java | 37 +- .../jmx/MemoryPoolsPresenceTest.java | 39 +- .../compiler/codecache/jmx/PeakUsageTest.java | 31 +- .../codecache/jmx/PoolsIndependenceTest.java | 46 +- .../jmx/ThresholdNotificationsTest.java | 49 +- ...sageThresholdExceededSeveralTimesTest.java | 27 +- .../jmx/UsageThresholdExceededTest.java | 38 +- .../jmx/UsageThresholdIncreasedTest.java | 38 +- .../jmx/UsageThresholdNotExceededTest.java | 38 +- .../stress/CodeCacheStressRunner.java | 2 + .../compiler/codecache/stress/Helper.java | 16 +- .../stress/OverloadCompileQueueTest.java | 46 +- .../stress/RandomAllocationTest.java | 42 +- .../stress/UnexpectedDeoptimizationTest.java | 28 +- .../test/compiler/codegen/6431242/Test.java | 176 -- .../compiler/codegen/7184394/TestAESBase.java | 220 --- hotspot/test/compiler/codegen/BMI1.java | 519 +++--- .../codegen/{8144028 => }/BitTests.java | 54 +- .../codegen/C1NullCheckOfNullStore.java | 50 +- .../codegen/{7088419 => }/CRCTest.java | 11 +- .../codegen/IntRotateWithImmediate.java | 83 +- .../test/compiler/codegen/LoadWithMask.java | 30 +- .../test/compiler/codegen/LoadWithMask2.java | 52 +- .../codegen/{6378821 => }/Test6378821.java | 6 +- .../test/compiler/codegen/Test6431242.java | 179 +++ .../codegen/{6797305 => }/Test6797305.java | 6 +- .../codegen/{6814842 => }/Test6814842.java | 6 +- .../codegen/{6823354 => }/Test6823354.java | 18 +- .../{6875866/Test.java => Test6875866.java} | 27 +- .../codegen/{6879902 => }/Test6879902.java | 4 +- .../codegen/{6896617 => }/Test6896617.java | 5 +- .../codegen/{6909839 => }/Test6909839.java | 4 +- .../{6935535/Test.java => Test6935535.java} | 28 +- .../{6942326/Test.java => Test6942326.java} | 15 +- .../codegen/{7009231 => }/Test7009231.java | 7 +- .../codegen/{7100757 => }/Test7100757.java | 6 +- .../codegen/{8005033 => }/Test8005033.java | 7 +- .../codegen/{8011901 => }/Test8011901.java | 7 +- .../{7119644 => }/TestBooleanVect.java | 6 +- .../{7119644 => }/TestByteDoubleVect.java | 6 +- .../{7119644 => }/TestByteFloatVect.java | 6 +- .../{7119644 => }/TestByteIntVect.java | 6 +- .../{7119644 => }/TestByteLongVect.java | 6 +- .../{7119644 => }/TestByteShortVect.java | 6 +- .../codegen/{7119644 => }/TestByteVect.java | 6 +- .../{7119644 => }/TestCharShortVect.java | 6 +- .../codegen/{7119644 => }/TestCharVect.java | 6 +- .../TestCharVect.java => TestCharVect2.java} | 6 +- .../codegen/{7119644 => }/TestDoubleVect.java | 6 +- .../{7119644 => }/TestFloatDoubleVect.java | 6 +- .../codegen/{7119644 => }/TestFloatVect.java | 6 +- .../{7119644 => }/TestIntDoubleVect.java | 6 +- .../{7119644 => }/TestIntFloatVect.java | 6 +- .../{7119644 => }/TestIntLongVect.java | 6 +- .../codegen/{7119644 => }/TestIntVect.java | 6 +- .../{7119644 => }/TestLongDoubleVect.java | 6 +- .../{7119644 => }/TestLongFloatVect.java | 6 +- .../codegen/{7119644 => }/TestLongVect.java | 6 +- .../{7119644 => }/TestShortDoubleVect.java | 6 +- .../{7119644 => }/TestShortFloatVect.java | 6 +- .../{7119644 => }/TestShortIntVect.java | 6 +- .../{7119644 => }/TestShortLongVect.java | 6 +- .../codegen/{7119644 => }/TestShortVect.java | 6 +- .../compiler/codegen/aes/TestAESBase.java | 222 +++ .../{7184394 => aes}/TestAESDecode.java | 60 +- .../{7184394 => aes}/TestAESEncode.java | 59 +- .../codegen/{7184394 => aes}/TestAESMain.java | 159 +- .../compilercontrol/InlineMatcherTest.java | 38 +- ...stCompilerDirectivesCompatibilityBase.java | 14 +- ...ilerDirectivesCompatibilityCommandOff.java | 21 +- ...pilerDirectivesCompatibilityCommandOn.java | 22 +- ...stCompilerDirectivesCompatibilityFlag.java | 19 +- .../commandfile/CompileOnlyTest.java | 10 +- .../commandfile/ExcludeTest.java | 10 +- .../compilercontrol/commandfile/LogTest.java | 10 +- .../commandfile/PrintTest.java | 10 +- .../commands/CompileOnlyTest.java | 10 +- .../compilercontrol/commands/ExcludeTest.java | 10 +- .../compilercontrol/commands/LogTest.java | 10 +- .../compilercontrol/commands/PrintTest.java | 10 +- .../directives/CompileOnlyTest.java | 10 +- .../directives/ExcludeTest.java | 10 +- .../compilercontrol/directives/LogTest.java | 10 +- .../compilercontrol/directives/PrintTest.java | 10 +- .../jcmd/AddAndRemoveTest.java | 10 +- .../jcmd/AddCompileOnlyTest.java | 10 +- .../compilercontrol/jcmd/AddExcludeTest.java | 10 +- .../compilercontrol/jcmd/AddLogTest.java | 10 +- .../jcmd/AddPrintAssemblyTest.java | 10 +- .../jcmd/ClearDirectivesFileStackTest.java | 10 +- .../jcmd/ClearDirectivesStackTest.java | 10 +- .../jcmd/PrintDirectivesTest.java | 10 +- .../jcmd/StressAddJcmdBase.java | 2 +- .../jcmd/StressAddMultiThreadedTest.java | 7 +- .../logcompilation/LogTest.java | 10 +- .../matcher/MethodMatcherTest.java | 7 +- .../mixed/RandomCommandsTest.java | 10 +- .../mixed/RandomValidCommandsTest.java | 10 +- .../parser/DirectiveParserTest.java | 4 +- .../parser/DirectiveStressTest.java | 5 +- .../share/AbstractTestBase.java | 2 +- .../share/actions/BaseAction.java | 8 +- .../share/actions/CompileAction.java | 2 +- .../share/method/MethodGenerator.java | 2 +- .../share/pool/MethodHolder.java | 2 +- .../share/pool/PoolHelper.java | 16 +- .../share/pool/SubMethodHolder.java | 2 +- .../compilercontrol/share/pool/sub/Klass.java | 6 +- .../share/pool/sub/KlassDup.java | 4 +- .../share/pool/subpack/Klass.java | 8 +- .../share/pool/subpack/KlassDup.java | 10 +- .../share/processors/LogProcessor.java | 2 +- .../share/processors/PrintProcessor.java | 3 +- .../scenario/AbstractCommandBuilder.java | 3 +- .../share/scenario/Command.java | 1 + .../share/scenario/DirectiveBuilder.java | 6 +- .../share/scenario/JcmdStateBuilder.java | 2 +- .../share/scenario/Scenario.java | 2 +- .../TestEliminatedCastPPAtPhi.java | 7 +- .../compiler/cpuflags/AESIntrinsicsBase.java | 8 +- .../test/compiler/cpuflags/RestoreMXCSR.java | 22 +- .../TestAESIntrinsicsOnSupportedConfig.java | 9 +- .../TestAESIntrinsicsOnUnsupportedConfig.java | 13 +- .../compiler/cpuflags/TestSSE4Disabled.java | 6 +- .../predicate/AESSupportPredicate.java | 3 +- .../compiler/debug/TraceIterativeGVN.java | 6 +- .../compiler/debug/VerifyAdapterSharing.java | 24 +- .../TestMonomorphicObjectCall.java | 10 +- .../{6934604 => }/TestByteBoxing.java | 20 +- .../{6934604 => }/TestDoubleBoxing.java | 19 +- .../{6934604 => }/TestFloatBoxing.java | 19 +- .../{6934604 => }/TestIntBoxing.java | 19 +- .../{6934604 => }/TestLongBoxing.java | 19 +- .../{6934604 => }/TestShortBoxing.java | 19 +- .../eliminateAutobox/UnsignedLoads.java | 6 +- .../compiler/escapeAnalysis/6689060/Test.java | 576 ------- .../compiler/escapeAnalysis/6726999/Test.java | 1419 ---------------- .../compiler/escapeAnalysis/Test6689060.java | 579 +++++++ .../compiler/escapeAnalysis/Test6726999.java | 1421 +++++++++++++++++ .../{6775880/Test.java => Test6775880.java} | 61 +- .../{6895383/Test.java => Test6895383.java} | 12 +- .../{6896727/Test.java => Test6896727.java} | 8 +- .../compiler/escapeAnalysis/Test8020215.java | 5 +- .../TestAllocatedEscapesPtrComparison.java | 9 +- .../escapeAnalysis/TestEABadMergeMem.java | 6 +- .../TestEscapeThroughInvoke.java | 31 +- ...tUnsafePutAddressNullObjMustNotEscape.java | 11 +- .../{6716441 => cr6716441}/Tester.java | 6 +- .../{6795161 => cr6795161}/Test.java | 7 +- .../exceptions/CatchInlineExceptions.java | 8 +- hotspot/test/compiler/exceptions/SumTest.java | 5 +- .../TestRecursiveReplacedException.java | 6 +- .../test/compiler/floatingpoint/ModNaN.java | 8 +- .../test/compiler/floatingpoint/NaNTest.java | 6 +- .../floatingpoint/Test15FloatJNIArgs.java | 9 +- .../test/compiler/floatingpoint/TestPow2.java | 16 +- .../floatingpoint/libTest15FloatJNIArgs.c | 2 +- .../test/compiler/gcbarriers/G1CrashTest.java | 5 +- .../gcbarriers/PreserveFPRegistersTest.java | 5 +- .../DefaultAndConcreteMethodsCHA.java | 19 +- .../inlining/DefaultMethodsDependencies.java | 7 +- .../compiler/inlining/InlineAccessors.java | 13 +- .../inlining/InlineDefaultMethod.java | 43 +- .../inlining/InlineDefaultMethod1.java | 37 +- .../TestIntegerComparison.java | 88 +- .../compiler/interpreter/DisableOSRTest.java | 14 +- .../{6539464/Test.java => Test6539464.java} | 8 +- .../{6833129/Test.java => Test6833129.java} | 7 +- .../{7116216 => cr7116216}/LargeFrame.java | 2 + .../{7116216 => cr7116216}/StackOverflow.java | 6 +- .../intrinsics/IntrinsicAvailableTest.java | 17 +- .../intrinsics/IntrinsicDisabledTest.java | 18 +- .../intrinsics/{6982370 => }/Test6982370.java | 5 +- .../intrinsics/{8005419 => }/Test8005419.java | 4 +- .../MontgomeryMultiplyTest.java | 88 +- .../{muladd => bigInteger}/TestMulAdd.java | 11 +- .../TestMultiplyToLen.java | 11 +- .../TestMultiplyToLenReturnProfile.java | 7 +- .../TestSquareToLen.java | 11 +- .../intrinsics/bmi/BMITestRunner.java | 3 + .../test/compiler/intrinsics/bmi/Expr.java | 3 +- .../compiler/intrinsics/bmi/TestAndnI.java | 8 +- .../compiler/intrinsics/bmi/TestAndnL.java | 14 +- .../compiler/intrinsics/bmi/TestBlsiI.java | 14 +- .../compiler/intrinsics/bmi/TestBlsiL.java | 12 +- .../compiler/intrinsics/bmi/TestBlsmskI.java | 14 +- .../compiler/intrinsics/bmi/TestBlsmskL.java | 14 +- .../compiler/intrinsics/bmi/TestBlsrI.java | 14 +- .../compiler/intrinsics/bmi/TestBlsrL.java | 14 +- .../compiler/intrinsics/bmi/TestLzcntI.java | 14 +- .../compiler/intrinsics/bmi/TestLzcntL.java | 14 +- .../compiler/intrinsics/bmi/TestTzcntI.java | 14 +- .../compiler/intrinsics/bmi/TestTzcntL.java | 14 +- .../intrinsics/bmi/verifycode/AndnTestI.java | 12 +- .../intrinsics/bmi/verifycode/AndnTestL.java | 12 +- .../intrinsics/bmi/verifycode/BlsiTestI.java | 12 +- .../intrinsics/bmi/verifycode/BlsiTestL.java | 12 +- .../bmi/verifycode/BlsmskTestI.java | 11 +- .../bmi/verifycode/BlsmskTestL.java | 12 +- .../intrinsics/bmi/verifycode/BlsrTestI.java | 12 +- .../intrinsics/bmi/verifycode/BlsrTestL.java | 12 +- .../bmi/verifycode/BmiIntrinsicBase.java | 4 +- .../intrinsics/bmi/verifycode/LZcntTestI.java | 12 +- .../intrinsics/bmi/verifycode/LZcntTestL.java | 12 +- .../intrinsics/bmi/verifycode/TZcntTestI.java | 11 +- .../intrinsics/bmi/verifycode/TZcntTestL.java | 12 +- .../CastNullCheckDroppingsTest.java} | 56 +- .../TestIsPrimitive.java} | 17 +- .../mathexact/AddExactICondTest.java | 5 +- .../mathexact/AddExactIConstantTest.java | 7 +- .../mathexact/AddExactILoadTest.java | 7 +- .../mathexact/AddExactILoopDependentTest.java | 7 +- .../mathexact/AddExactINonConstantTest.java | 7 +- .../mathexact/AddExactIRepeatTest.java | 8 +- .../mathexact/AddExactLConstantTest.java | 7 +- .../mathexact/AddExactLNonConstantTest.java | 7 +- .../intrinsics/mathexact/CompareTest.java | 6 +- .../intrinsics/mathexact/DecExactITest.java | 7 +- .../intrinsics/mathexact/DecExactLTest.java | 7 +- .../intrinsics/mathexact/GVNTest.java | 5 +- .../intrinsics/mathexact/IncExactITest.java | 7 +- .../intrinsics/mathexact/IncExactLTest.java | 7 +- .../mathexact/MulExactICondTest.java | 5 +- .../mathexact/MulExactIConstantTest.java | 7 +- .../mathexact/MulExactILoadTest.java | 7 +- .../mathexact/MulExactILoopDependentTest.java | 8 +- .../mathexact/MulExactINonConstantTest.java | 7 +- .../mathexact/MulExactIRepeatTest.java | 8 +- .../mathexact/MulExactLConstantTest.java | 7 +- .../mathexact/MulExactLNonConstantTest.java | 7 +- .../mathexact/NegExactIConstantTest.java | 7 +- .../mathexact/NegExactILoadTest.java | 7 +- .../mathexact/NegExactILoopDependentTest.java | 8 +- .../mathexact/NegExactINonConstantTest.java | 7 +- .../mathexact/NegExactLConstantTest.java | 7 +- .../mathexact/NegExactLNonConstantTest.java | 7 +- .../mathexact/NestedMathExactTest.java | 5 +- .../mathexact/SplitThruPhiTest.java | 5 +- .../mathexact/SubExactICondTest.java | 7 +- .../mathexact/SubExactIConstantTest.java | 7 +- .../mathexact/SubExactILoadTest.java | 7 +- .../mathexact/SubExactILoopDependentTest.java | 7 +- .../mathexact/SubExactINonConstantTest.java | 7 +- .../mathexact/SubExactIRepeatTest.java | 8 +- .../mathexact/SubExactLConstantTest.java | 7 +- .../mathexact/SubExactLNonConstantTest.java | 7 +- .../compiler/intrinsics/mathexact/Verify.java | 3 + .../mathexact/sanity/AddExactIntTest.java | 15 +- .../mathexact/sanity/AddExactLongTest.java | 15 +- .../sanity/DecrementExactIntTest.java | 15 +- .../sanity/DecrementExactLongTest.java | 15 +- .../sanity/IncrementExactIntTest.java | 15 +- .../sanity/IncrementExactLongTest.java | 15 +- .../mathexact/sanity/IntrinsicBase.java | 7 +- .../mathexact/sanity/MathIntrinsic.java | 5 +- .../sanity/MultiplyExactIntTest.java | 15 +- .../sanity/MultiplyExactLongTest.java | 15 +- .../mathexact/sanity/NegateExactIntTest.java | 15 +- .../mathexact/sanity/NegateExactLongTest.java | 15 +- .../sanity/SubtractExactIntTest.java | 15 +- .../sanity/SubtractExactLongTest.java | 14 +- .../TestClone.java} | 36 +- .../{hashcode => object}/TestHashCode.java | 7 +- .../test/compiler/intrinsics/sha/TestSHA.java | 64 +- .../intrinsics/sha/cli/SHAOptionsBase.java | 18 +- ...UseSHA1IntrinsicsOptionOnSupportedCPU.java | 11 +- ...eSHA1IntrinsicsOptionOnUnsupportedCPU.java | 14 +- ...eSHA256IntrinsicsOptionOnSupportedCPU.java | 10 +- ...HA256IntrinsicsOptionOnUnsupportedCPU.java | 14 +- ...eSHA512IntrinsicsOptionOnSupportedCPU.java | 10 +- ...HA512IntrinsicsOptionOnUnsupportedCPU.java | 14 +- .../cli/TestUseSHAOptionOnSupportedCPU.java | 12 +- .../cli/TestUseSHAOptionOnUnsupportedCPU.java | 14 +- .../testcases/GenericTestCaseForOtherCPU.java | 3 + .../GenericTestCaseForSupportedCPU.java | 3 + ...nericTestCaseForUnsupportedAArch64CPU.java | 3 + ...GenericTestCaseForUnsupportedSparcCPU.java | 3 + .../GenericTestCaseForUnsupportedX86CPU.java | 5 +- ...sicsSpecificTestCaseForUnsupportedCPU.java | 7 +- ...UseSHASpecificTestCaseForSupportedCPU.java | 5 +- ...eSHASpecificTestCaseForUnsupportedCPU.java | 7 +- .../sha/sanity/SHASanityTestBase.java | 6 +- .../sha/sanity/TestSHA1Intrinsics.java | 14 +- .../sanity/TestSHA1MultiBlockIntrinsics.java | 15 +- .../sha/sanity/TestSHA256Intrinsics.java | 20 +- .../TestSHA256MultiBlockIntrinsics.java | 23 +- .../sha/sanity/TestSHA512Intrinsics.java | 20 +- .../TestSHA512MultiBlockIntrinsics.java | 24 +- .../intrinsics/string/TestHasNegatives.java | 4 +- .../string/TestStringConstruction.java | 10 +- .../TestStringEqualsBadLength.java | 5 +- .../string/TestStringIntrinsicMemoryFlow.java | 10 +- .../TestStringIntrinsicRangeChecks.java | 5 +- .../string/TestStringIntrinsics.java | 17 +- .../string/TestStringIntrinsics2.java | 18 +- .../unsafe/AllocateUninitializedArray.java | 15 +- .../intrinsics/unsafe/HeapByteBufferTest.java | 470 +++--- .../TestUnsafeMismatchedArrayFieldAccess.java | 10 +- ...TestUnsafeUnalignedMismatchedAccesses.java | 12 +- .../unsafe/UnsafeGetAddressTest.java | 7 +- .../intrinsics/unsafe/UnsafeTwoCASLong.java | 6 +- .../{adler32 => zip}/TestAdler32.java | 6 +- .../intrinsics/{crc32 => zip}/TestCRC32.java | 6 +- .../{crc32c => zip}/TestCRC32C.java | 6 +- .../jsr292/CallSiteDepContextTest.java | 22 +- .../jsr292/ConcurrentClassLoadingTest.java | 9 +- .../ContinuousCallSiteTargetChange.java | 22 +- .../CreatesInterfaceDotEqualsCallInfo.java | 17 +- hotspot/test/compiler/jsr292/InvokerGC.java | 14 +- .../jsr292/LongReferenceCastingTest.java | 12 +- .../test/compiler/jsr292/MHInlineTest.java | 37 +- .../compiler/jsr292/NonInlinedCall/Agent.java | 6 +- .../jsr292/NonInlinedCall/GCTest.java | 17 +- .../jsr292/NonInlinedCall/InvokeTest.java | 16 +- .../jsr292/NonInlinedCall/RedefineTest.java | 19 +- .../compiler/jsr292/NullConstantReceiver.java | 5 +- .../compiler/jsr292/PollutedTrapCounts.java | 16 +- ...fineMethodUsedByMultipleMethodHandles.java | 43 +- .../jsr292/{7082949 => }/Test7082949.java | 11 +- .../compiler/jsr292/VMAnonymousClasses.java | 7 +- .../{6990212 => cr6990212}/Test6990212.java | 8 +- .../ByteClassLoader.java | 20 +- .../methodHandleExceptions/TestAMEnotNPE.java | 57 +- .../jsr292/methodHandleExceptions/p/C.java | 2 +- .../jsr292/methodHandleExceptions/p/Dok.java | 3 +- .../jsr292/methodHandleExceptions/p/E.java | 2 +- .../jsr292/methodHandleExceptions/p/F.java | 2 +- .../methodHandleExceptions/p/Tdirect.java | 4 +- .../methodHandleExceptions/p/Treflect.java | 9 +- .../jvmci/JVM_GetJVMCIRuntimeTest.java | 2 +- .../jvmci/SecurityRestrictionsTest.java | 5 +- .../compiler/jvmci/common/CTVMUtilities.java | 24 +- .../compiler/jvmci/common/JVMCIHelpers.java | 4 +- .../jdk/vm/ci/hotspot/CompilerToVMHelper.java | 1 - .../jvmci/common/testcases/TestCase.java | 4 - .../compilerToVM/AllocateCompileIdTest.java | 15 +- .../compilerToVM/CanInlineMethodTest.java | 9 +- .../compilerToVM/CollectCountersTest.java | 2 +- .../compilerToVM/CompileCodeTestCase.java | 4 +- .../compilerToVM/ConstantPoolTestCase.java | 28 +- .../compilerToVM/ConstantPoolTestsHelper.java | 23 +- .../jvmci/compilerToVM/DebugOutputTest.java | 8 +- .../compilerToVM/DisassembleCodeBlobTest.java | 6 +- .../DoNotInlineOrCompileTest.java | 9 +- .../ExecuteInstalledCodeTest.java | 11 +- .../FindUniqueConcreteMethodTest.java | 15 +- .../jvmci/compilerToVM/GetBytecodeTest.java | 9 +- .../compilerToVM/GetClassInitializerTest.java | 9 +- .../compilerToVM/GetConstantPoolTest.java | 10 +- .../compilerToVM/GetExceptionTableTest.java | 7 +- .../compilerToVM/GetImplementorTest.java | 11 +- .../compilerToVM/GetLineNumberTableTest.java | 2 +- .../GetLocalVariableTableTest.java | 4 +- .../GetMaxCallTargetOffsetTest.java | 2 +- .../compilerToVM/GetNextStackFrameTest.java | 5 +- .../GetResolvedJavaMethodAtSlotTest.java | 5 +- .../GetResolvedJavaMethodTest.java | 6 +- .../compilerToVM/GetResolvedJavaTypeTest.java | 11 +- .../GetStackTraceElementTest.java | 10 +- .../jvmci/compilerToVM/GetSymbolTest.java | 9 +- .../GetVtableIndexForInterfaceTest.java | 17 +- .../HasCompiledCodeForOSRTest.java | 13 +- .../HasFinalizableSubclassTest.java | 9 +- .../InitializeConfigurationTest.java | 11 +- .../InvalidateInstalledCodeTest.java | 10 +- .../jvmci/compilerToVM/IsMatureTest.java | 2 +- .../JVM_RegisterJVMCINatives.java | 2 +- .../compilerToVM/LookupKlassInPoolTest.java | 10 +- .../LookupKlassRefIndexInPoolTest.java | 12 +- .../compilerToVM/LookupMethodInPoolTest.java | 11 +- .../LookupNameAndTypeRefIndexInPoolTest.java | 13 +- .../compilerToVM/LookupNameInPoolTest.java | 15 +- .../LookupSignatureInPoolTest.java | 13 +- .../jvmci/compilerToVM/LookupTypeTest.java | 9 +- .../MaterializeVirtualObjectTest.java | 13 +- ...ethodIsIgnoredBySecurityStackWalkTest.java | 9 +- .../jvmci/compilerToVM/ReprofileTest.java | 12 +- .../ResolveConstantInPoolTest.java | 13 +- .../compilerToVM/ResolveFieldInPoolTest.java | 18 +- .../jvmci/compilerToVM/ResolveMethodTest.java | 13 +- ...solvePossiblyCachedConstantInPoolTest.java | 10 +- .../compilerToVM/ResolveTypeInPoolTest.java | 10 +- .../ShouldDebugNonSafepointsTest.java | 2 +- .../compilerToVM/ShouldInlineMethodTest.java | 9 +- .../jvmci/errors/CodeInstallerTest.java | 5 +- .../errors/TestInvalidCompilationResult.java | 1 - .../jvmci/errors/TestInvalidDebugInfo.java | 1 - .../jvmci/errors/TestInvalidOopMap.java | 1 - .../events/JvmciNotifyInstallEventTest.java | 9 +- .../vm/ci/code/test/CodeInstallationTest.java | 7 +- .../jdk/vm/ci/code/test/DataPatchTest.java | 5 +- .../jdk/vm/ci/code/test/DebugInfoTest.java | 4 +- .../code/test/InterpreterFrameSizeTest.java | 5 +- .../code/test/MaxOopMapStackOffsetTest.java | 3 +- .../code/test/SimpleCodeInstallationTest.java | 3 +- .../vm/ci/code/test/SimpleDebugInfoTest.java | 5 +- .../jdk/vm/ci/code/test/TestAssembler.java | 12 +- .../code/test/VirtualObjectDebugInfoTest.java | 11 +- .../hotspot/test/AsJavaTypeDataProvider.java | 6 +- .../test/BoxPrimitiveDataProvider.java | 9 +- .../test/ConstantEqualsDataProvider.java | 11 +- .../hotspot/test/ForStringDataProvider.java | 4 +- ...HotSpotConstantReflectionProviderTest.java | 8 +- .../test/IsEmbeddableDataProvider.java | 6 +- .../test/MemoryAccessProviderData.java | 7 +- .../test/MemoryAccessProviderTest.java | 5 +- .../test/MethodHandleAccessProviderData.java | 13 +- .../test/MethodHandleAccessProviderTest.java | 19 +- .../test/ReadArrayElementDataProvider.java | 12 +- .../test/ReadArrayLengthDataProvider.java | 9 +- .../test/ReadFieldValueDataProvider.java | 13 +- .../jdk/vm/ci/hotspot/test/TestHelper.java | 7 +- .../test/UnboxPrimitiveDataProvider.java | 8 +- .../jdk/vm/ci/runtime/test/ConstantTest.java | 3 +- .../jdk/vm/ci/runtime/test/FieldUniverse.java | 4 +- .../vm/ci/runtime/test/MethodUniverse.java | 4 +- .../vm/ci/runtime/test/NameAndSignature.java | 6 +- .../vm/ci/runtime/test/RedefineClassTest.java | 12 +- ...lvedJavaTypeResolveConcreteMethodTest.java | 6 +- .../ResolvedJavaTypeResolveMethodTest.java | 6 +- .../test/TestConstantReflectionProvider.java | 17 +- .../jdk/vm/ci/runtime/test/TestJavaField.java | 13 +- .../vm/ci/runtime/test/TestJavaMethod.java | 13 +- .../jdk/vm/ci/runtime/test/TestJavaType.java | 4 +- .../runtime/test/TestMetaAccessProvider.java | 19 +- .../runtime/test/TestResolvedJavaField.java | 15 +- .../runtime/test/TestResolvedJavaMethod.java | 21 +- .../ci/runtime/test/TestResolvedJavaType.java | 46 +- .../jdk/vm/ci/runtime/test/TypeUniverse.java | 22 +- .../compiler/jvmci/meta/StableFieldTest.java | 2 - hotspot/test/compiler/linkage/CallSites.jasm | 24 +- .../test/compiler/linkage/LinkageErrors.java | 12 +- .../loopopts/7044738/Test7044738.java | 104 -- .../loopopts/7052494/Test7052494.java | 175 -- .../BadPredicateAfterPartialPeel.java | 10 +- .../loopopts/ConstFPVectorization.java | 5 +- .../compiler/loopopts/CountedLoopProblem.java | 6 +- .../{6659207/Test.java => Test6659207.java} | 6 +- .../{6855164/Test.java => Test6855164.java} | 7 +- .../{6860469/Test.java => Test6860469.java} | 68 +- .../test/compiler/loopopts/Test7044738.java | 107 ++ .../test/compiler/loopopts/Test7052494.java | 177 ++ .../loopopts/TestArraysFillDeadControl.java | 6 +- .../loopopts/TestCastIINoLoopLimitCheck.java | 5 +- .../TestDeadBackbranchArrayAccess.java | 6 +- .../test/compiler/loopopts/TestLogSum.java | 6 +- .../compiler/loopopts/TestLoopPeeling.java | 8 +- .../loopopts/TestMoveStoresOutOfLoops.java | 13 +- .../TestMoveStoresOutOfLoopsStoreNoCtrl.java | 6 +- .../compiler/loopopts/TestOverunrolling.java | 9 +- .../loopopts/TestPredicateLostDependency.java | 7 +- .../loopopts/TestSplitIfBlocksDisabled.java | 7 +- .../TestSplitIfUnswitchedLoopsEliminated.java | 5 +- .../loopopts/UseCountedLoopSafepoints.java | 12 +- .../loopopts/superword/ProdRed_Double.java | 113 +- .../loopopts/superword/ProdRed_Float.java | 113 +- .../loopopts/superword/ProdRed_Int.java | 111 +- .../loopopts/superword/ReductionPerf.java | 400 ++--- .../superword/SumRedAbsNeg_Double.java | 140 +- .../superword/SumRedAbsNeg_Float.java | 140 +- .../loopopts/superword/SumRedSqrt_Double.java | 161 +- .../loopopts/superword/SumRed_Double.java | 140 +- .../loopopts/superword/SumRed_Float.java | 140 +- .../loopopts/superword/SumRed_Int.java | 140 +- .../loopopts/superword/SumRed_Long.java | 119 +- .../loopopts/superword/TestBestAlign.java | 4 +- .../TestReductionWithLoopVariantUse.java | 6 +- .../TestVectorizationWithInvariant.java | 11 +- .../TestEliminateAllocationPhi.java | 6 +- hotspot/test/compiler/membars/DekkerTest.java | 14 +- .../compiler/membars/TestMemBarAcquire.java | 46 +- .../memoryinitialization/ZeroTLABTest.java | 12 +- .../compiler/onSpinWait/TestOnSpinWait.java | 15 +- .../TestOnSpinWaitEnableDisable.java | 8 +- .../oracle/CheckCompileCommandOption.java | 16 +- .../compiler/oracle/GetMethodOptionTest.java | 46 +- .../compiler/oracle/MethodMatcherTest.java | 43 +- .../compiler/oracle/TestCompileCommand.java | 14 +- .../osr/TestOSRWithNonEmptyStack.java | 35 +- hotspot/test/compiler/osr/TestRangeCheck.java | 3 + .../test/compiler/print/PrintInlining.java | 11 +- .../print/TestProfileReturnTypePrinting.java | 9 +- .../TestMethodHandleInvokesIntrinsic.java | 11 +- .../profiling/TestSpecTrapClassUnloading.java | 10 +- .../TestUnexpectedProfilingMismatch.java | 10 +- .../test/compiler/profiling/UnsafeAccess.java | 8 +- .../spectrapredefineclass/Agent.java | 11 +- .../spectrapredefineclass/Launcher.java | 27 +- .../spectrapredefineclass_classloaders/A.java | 2 + .../Agent.java | 18 +- .../spectrapredefineclass_classloaders/B.java | 2 + .../Launcher.java | 42 +- .../Test.java | 11 +- .../profiling/unloadingconflict/B.java | 2 + .../TestProfileConflictClassUnloading.java | 13 +- .../PowerOf2SizedArraysChecks.java | 9 +- .../rangechecks/TestBadFoldCompare.java | 6 +- .../rangechecks/TestExplicitRangeChecks.java | 27 +- .../TestRangeCheckEliminationDisabled.java | 5 +- .../TestRangeCheckExceptionHandlerLoop.jasm | 2 +- ...estRangeCheckExceptionHandlerLoopMain.java | 6 +- .../rangechecks/TestRangeCheckSmearing.java | 22 +- .../TestRangeCheckSmearingLoopOpts.java | 6 +- .../rangechecks/TestUncommonTrapMerging.java | 11 +- .../reflection/ArrayNewInstanceOfVoid.java | 4 + .../regalloc/C1ObjectSpillInLogicOp.java | 26 +- .../compiler/regalloc/TestVectorRegAlloc.java | 7 +- .../relocations/TestPrintRelocations.java | 11 +- .../cli/RTMGenericCommandLineOptionTest.java | 7 +- .../compiler/rtm/cli/RTMLockingAwareTest.java | 12 +- ...tPrintPreciseRTMLockingStatisticsBase.java | 7 +- ...kingStatisticsOptionOnSupportedConfig.java | 11 +- ...ngStatisticsOptionOnUnsupportedConfig.java | 11 +- ...tRTMAbortRatioOptionOnSupportedConfig.java | 8 +- ...TMAbortRatioOptionOnUnsupportedConfig.java | 12 +- .../rtm/cli/TestRTMAbortThresholdOption.java | 9 +- .../TestRTMLockingCalculationDelayOption.java | 9 +- .../cli/TestRTMLockingThresholdOption.java | 9 +- .../rtm/cli/TestRTMRetryCountOption.java | 9 +- .../rtm/cli/TestRTMSpinLoopCountOption.java | 9 +- ...lCountIncrRateOptionOnSupportedConfig.java | 7 +- ...ountIncrRateOptionOnUnsupportedConfig.java | 17 +- ...estUseRTMDeoptOptionOnSupportedConfig.java | 12 +- ...tUseRTMDeoptOptionOnUnsupportedConfig.java | 13 +- ...MForStackLocksOptionOnSupportedConfig.java | 13 +- ...orStackLocksOptionOnUnsupportedConfig.java | 11 +- ...tUseRTMLockingOptionOnSupportedConfig.java | 14 +- ...stUseRTMLockingOptionOnUnsupportedCPU.java | 17 +- ...estUseRTMLockingOptionOnUnsupportedVM.java | 16 +- ...tUseRTMLockingOptionWithBiasedLocking.java | 14 +- .../cli/TestUseRTMXendForLockBusyOption.java | 9 +- .../rtm/locking/TestRTMAbortRatio.java | 23 +- .../rtm/locking/TestRTMAbortThreshold.java | 22 +- .../rtm/locking/TestRTMAfterNonRTMDeopt.java | 23 +- .../locking/TestRTMDeoptOnHighAbortRatio.java | 22 +- .../locking/TestRTMDeoptOnLowAbortRatio.java | 23 +- .../TestRTMLockingCalculationDelay.java | 18 +- .../rtm/locking/TestRTMLockingThreshold.java | 23 +- .../rtm/locking/TestRTMRetryCount.java | 21 +- .../rtm/locking/TestRTMSpinLoopCount.java | 22 +- .../locking/TestRTMTotalCountIncrRate.java | 24 +- .../locking/TestUseRTMAfterLockInflation.java | 21 +- .../compiler/rtm/locking/TestUseRTMDeopt.java | 18 +- .../locking/TestUseRTMForInflatedLocks.java | 20 +- .../rtm/locking/TestUseRTMForStackLocks.java | 21 +- .../locking/TestUseRTMXendForLockBusy.java | 22 +- .../TestNoRTMLockElidingOption.java | 22 +- .../TestUseRTMLockElidingOption.java | 22 +- .../TestPrintPreciseRTMLockingStatistics.java | 24 +- .../test/compiler/runtime/6778657/Test.java | 75 - .../compiler/runtime/7196199/Test7196199.java | 189 --- .../compiler/runtime/8010927/Test8010927.java | 155 -- .../runtime/{7141637 => }/SpreadNullArg.java | 11 +- .../{6865265 => }/StackOverflowBug.java | 55 +- .../test/compiler/runtime/Test6778657.java | 83 + .../{6826736/Test.java => Test6826736.java} | 13 +- .../runtime/{6859338 => }/Test6859338.java | 6 +- .../{6863420/Test.java => Test6863420.java} | 10 +- .../{6892265/Test.java => Test6892265.java} | 56 +- .../runtime/{7088020 => }/Test7088020.java | 8 +- .../test/compiler/runtime/Test7196199.java | 198 +++ .../test/compiler/runtime/Test8010927.java | 165 ++ .../{6891750 => cr6891750}/Test6891750.java | 5 +- .../{8015436 => cr8015436}/Test8015436.java | 21 +- .../safepoints/TestRegisterRestoring.java | 63 +- .../compiler/stable/StableConfiguration.java | 2 - .../compiler/stable/TestStableBoolean.java | 1 + .../test/compiler/stable/TestStableByte.java | 1 + .../test/compiler/stable/TestStableChar.java | 3 +- .../compiler/stable/TestStableDouble.java | 3 +- .../test/compiler/stable/TestStableFloat.java | 1 + .../test/compiler/stable/TestStableInt.java | 1 + .../test/compiler/stable/TestStableLong.java | 1 + .../stable/TestStableMemoryBarrier.java | 2 - .../compiler/stable/TestStableMismatched.java | 12 +- .../compiler/stable/TestStableObject.java | 1 + .../test/compiler/stable/TestStableShort.java | 1 + .../test/compiler/stable/TestStableUByte.java | 2 +- .../compiler/stable/TestStableUShort.java | 2 +- .../startup/NumCompilerThreadsCheck.java | 9 +- .../startup/SmallCodeCacheStartup.java | 11 +- .../test/compiler/startup/StartupOutput.java | 24 +- .../startup/TieredStopAtLevel0SanityTest.java | 6 +- .../stringopts/TestOptimizeStringConcat.java | 7 +- .../TestStringObjectInitialization.java | 33 +- .../compiler/testlibrary/CompilerUtils.java | 3 +- .../testlibrary/rtm/AbortProvoker.java | 6 +- .../testlibrary/rtm/RTMLockingStatistics.java | 2 +- .../compiler/testlibrary/rtm/RTMTestBase.java | 20 +- .../testlibrary/rtm/XAbortProvoker.java | 2 +- .../rtm/predicate/SupportedCPU.java | 3 +- .../testlibrary/uncommontrap/Verifier.java | 4 +- .../test/compiler/tiered/CompLevelsTest.java | 2 + .../ConstantGettersTransitionsTest.java | 238 +-- .../compiler/tiered/LevelTransitionTest.java | 122 +- .../compiler/tiered/NonTieredLevelsTest.java | 11 +- .../compiler/tiered/TieredLevelsTest.java | 14 +- .../tiered/TransitionsTestExecutor.java | 9 +- .../types/TestMeetExactConstantArrays.java | 4 +- .../TestMeetIncompatibleInterfaceArrays.java | 70 +- .../TestMeetTopArrayExactConstantArray.java | 7 +- .../compiler/types/TestPhiElimination.java | 34 +- .../TestSpeculationFailedHigherEqual.java | 6 +- .../types/TestTypePropagationToCmpU.java | 6 +- .../test/compiler/types/TypeSpeculation.java | 7 +- .../types/correctness/CorrectnessTest.java | 59 +- .../compiler/types/correctness/OffTest.java | 23 +- .../correctness/execution/Execution.java | 8 +- .../execution/MethodHandleDelegate.java | 6 +- .../correctness/execution/TypeConflict.java | 6 +- .../correctness/execution/TypeProfile.java | 6 +- .../hierarchies/DefaultMethodInterface.java | 2 +- .../hierarchies/DefaultMethodInterface2.java | 2 +- .../types/correctness/hierarchies/Linear.java | 2 +- .../correctness/hierarchies/Linear2.java | 2 +- .../correctness/hierarchies/NullableType.java | 2 +- .../correctness/hierarchies/OneRank.java | 2 +- .../hierarchies/TypeHierarchy.java | 2 +- .../correctness/scenarios/ArrayCopy.java | 4 +- .../scenarios/ArrayReferenceStore.java | 4 +- .../correctness/scenarios/ArrayScenario.java | 4 +- .../correctness/scenarios/CheckCast.java | 4 +- .../correctness/scenarios/ClassIdentity.java | 4 +- .../scenarios/ClassInstanceOf.java | 4 +- .../scenarios/ClassIsInstance.java | 4 +- .../correctness/scenarios/ProfilingType.java | 2 +- .../scenarios/ReceiverAtInvokes.java | 4 +- .../types/correctness/scenarios/Scenario.java | 4 +- .../uncommontrap/DeoptReallocFailure.java | 41 +- .../StackOverflowGuardPagesOff.java | 8 +- .../{8009761 => }/Test8009761.java | 26 +- .../compiler/uncommontrap/TestDeoptOOM.java | 7 +- .../TestLockEliminatedAtDeopt.java | 7 +- .../TestStackBangMonitorOwned.java | 8 +- .../uncommontrap/TestStackBangRbp.java | 8 +- .../uncommontrap/TestUnstableIfTrap.java | 46 +- .../TraceDeoptimizationNoRealloc.java | 6 +- .../uncommontrap/UncommonTrapStackBang.java | 9 +- .../unsafe/GetUnsafeObjectG1PreBarrier.java | 8 +- ...dkInternalMiscUnsafeAccessTestBoolean.java | 11 +- .../JdkInternalMiscUnsafeAccessTestByte.java | 11 +- .../JdkInternalMiscUnsafeAccessTestChar.java | 11 +- ...JdkInternalMiscUnsafeAccessTestDouble.java | 11 +- .../JdkInternalMiscUnsafeAccessTestFloat.java | 11 +- .../JdkInternalMiscUnsafeAccessTestInt.java | 11 +- .../JdkInternalMiscUnsafeAccessTestLong.java | 11 +- ...JdkInternalMiscUnsafeAccessTestObject.java | 11 +- .../JdkInternalMiscUnsafeAccessTestShort.java | 11 +- .../JdkInternalMiscUnsafeUnalignedAccess.java | 9 +- .../SunMiscUnsafeAccessTestBoolean.java | 11 +- .../unsafe/SunMiscUnsafeAccessTestByte.java | 11 +- .../unsafe/SunMiscUnsafeAccessTestChar.java | 11 +- .../unsafe/SunMiscUnsafeAccessTestDouble.java | 11 +- .../unsafe/SunMiscUnsafeAccessTestFloat.java | 11 +- .../unsafe/SunMiscUnsafeAccessTestInt.java | 11 +- .../unsafe/SunMiscUnsafeAccessTestLong.java | 11 +- .../unsafe/SunMiscUnsafeAccessTestObject.java | 11 +- .../unsafe/SunMiscUnsafeAccessTestShort.java | 11 +- .../unsafe/TestUnsafeLoadControl.java | 8 +- .../unsafe/UnsafeGetConstantField.java | 34 +- .../unsafe/UnsafeGetStableArrayElement.java | 7 +- hotspot/test/compiler/unsafe/UnsafeRaw.java | 9 +- .../unsafe/X-UnsafeAccessTest.java.template | 11 +- .../compiler/vectorization/TestNaNVector.java | 9 +- .../TestVectorUnalignedOffset.java | 3 +- .../whitebox/AllocationCodeBlobTest.java | 49 +- .../whitebox/BlockingCompilation.java | 13 +- .../whitebox/ClearMethodStateTest.java | 18 +- .../whitebox/CompilerWhiteBoxTest.java | 1 + .../compiler/whitebox/DeoptimizeAllTest.java | 19 +- .../whitebox/DeoptimizeFramesTest.java | 28 +- .../whitebox/DeoptimizeMethodTest.java | 17 +- .../whitebox/DeoptimizeMultipleOSRTest.java | 25 +- .../EnqueueMethodForCompilationTest.java | 18 +- .../whitebox/ForceNMethodSweepTest.java | 27 +- .../whitebox/GetCodeHeapEntriesTest.java | 35 +- .../compiler/whitebox/GetNMethodTest.java | 24 +- .../whitebox/IsMethodCompilableTest.java | 14 +- .../whitebox/LockCompilationTest.java | 16 +- .../whitebox/MakeMethodNotCompilableTest.java | 16 +- .../whitebox/SetDontInlineMethodTest.java | 21 +- .../whitebox/SetForceInlineMethodTest.java | 21 +- .../compiler/whitebox/SimpleTestCase.java | 3 +- 942 files changed, 12622 insertions(+), 9353 deletions(-) delete mode 100644 hotspot/test/compiler/c1/6478991/NullCheckTest.java create mode 100644 hotspot/test/compiler/c1/NullCheckTest.java rename hotspot/test/compiler/c1/{6579789 => }/Test6579789.java (90%) rename hotspot/test/compiler/c1/{6756768 => }/Test6756768.java (95%) rename hotspot/test/compiler/c1/{6756768 => }/Test6756768_2.java (95%) rename hotspot/test/compiler/c1/{6757316 => }/Test6757316.java (95%) rename hotspot/test/compiler/c1/{6758234 => }/Test6758234.java (90%) rename hotspot/test/compiler/c1/{6795465 => }/Test6795465.java (96%) rename hotspot/test/compiler/c1/{6849574/Test.java => Test6849574.java} (90%) rename hotspot/test/compiler/c1/{6855215 => }/Test6855215.java (95%) rename hotspot/test/compiler/c1/{6932496 => }/Test6932496.java (97%) rename hotspot/test/compiler/c1/{7042153 => }/Test7042153.java (79%) rename hotspot/test/compiler/c1/{7090976 => }/Test7090976.java (96%) rename hotspot/test/compiler/c1/{7103261 => }/Test7103261.java (98%) rename hotspot/test/compiler/c1/{7123108 => }/Test7123108.java (96%) rename hotspot/test/compiler/c1/{8004051 => }/Test8004051.java (96%) rename hotspot/test/compiler/c1/{8011706 => }/Test8011706.java (96%) rename hotspot/test/compiler/c1/{8011771 => }/Test8011771.java (96%) rename hotspot/test/compiler/c1/{6769124/TestArrayCopy6769124.java => TestArrayCopy.java} (94%) rename hotspot/test/compiler/c1/{6769124/TestDeoptInt6769124.java => TestDeoptInt.java} (90%) rename hotspot/test/compiler/c1/{6769124/TestUnalignedLoad6769124.java => TestUnalignedLoad.java} (95%) delete mode 100644 hotspot/test/compiler/c2/5091921/Test6905845.java delete mode 100644 hotspot/test/compiler/c2/6823453/Test.java delete mode 100644 hotspot/test/compiler/c2/7190310/Test7190310.java delete mode 100644 hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java delete mode 100644 hotspot/test/compiler/c2/8002069/Test8002069.java rename hotspot/test/compiler/c2/{6663621 => }/IVTest.java (98%) rename hotspot/test/compiler/c2/{6772683 => }/InterruptedTest.java (97%) rename hotspot/test/compiler/c2/{6894807 => }/IsInstanceTest.java (96%) rename hotspot/test/compiler/c2/{8005956 => }/PolynomialRoot.java (98%) rename hotspot/test/compiler/c2/{5057225 => }/Test5057225.java (91%) rename hotspot/test/compiler/c2/{5091921 => }/Test5091921.java (97%) rename hotspot/test/compiler/c2/{5091921 => }/Test6186134.java (57%) rename hotspot/test/compiler/c2/{5091921 => }/Test6196102.java (96%) rename hotspot/test/compiler/c2/{5091921 => }/Test6357214.java (85%) rename hotspot/test/compiler/c2/{6443505 => }/Test6443505.java (95%) rename hotspot/test/compiler/c2/{5091921 => }/Test6559156.java (97%) rename hotspot/test/compiler/c2/{6603011/Test.java => Test6603011.java} (92%) rename hotspot/test/compiler/c2/{6636138/Test1.java => Test6636138_1.java} (92%) rename hotspot/test/compiler/c2/{6636138/Test2.java => Test6636138_2.java} (67%) rename hotspot/test/compiler/c2/{6646019/Test.java => Test6646019.java} (65%) rename hotspot/test/compiler/c2/{6661247/Test.java => Test6661247.java} (98%) rename hotspot/test/compiler/c2/{6695810/Test.java => Test6695810.java} (87%) rename hotspot/test/compiler/c2/{6700047 => }/Test6700047.java (96%) rename hotspot/test/compiler/c2/{6711100/Test.java => Test6711100.java} (85%) rename hotspot/test/compiler/c2/{6724218/Test.java => Test6724218.java} (85%) rename hotspot/test/compiler/c2/{6732154 => }/Test6732154.java (96%) rename hotspot/test/compiler/c2/{6741738/Tester.java => Test6741738.java} (68%) rename hotspot/test/compiler/c2/{5091921 => }/Test6753639.java (95%) rename hotspot/test/compiler/c2/{6792161 => }/Test6792161.java (89%) rename hotspot/test/compiler/c2/{6795362 => }/Test6795362.java (90%) rename hotspot/test/compiler/c2/{6796786 => }/Test6796786.java (95%) rename hotspot/test/compiler/c2/{6799693/Test.java => Test6799693.java} (69%) rename hotspot/test/compiler/c2/{6800154 => }/Test6800154.java (92%) rename hotspot/test/compiler/c2/{6805724 => }/Test6805724.java (90%) create mode 100644 hotspot/test/compiler/c2/Test6823453.java rename hotspot/test/compiler/c2/{6832293/Test.java => Test6832293.java} (74%) rename hotspot/test/compiler/c2/{6837011 => }/Test6837011.java (90%) rename hotspot/test/compiler/c2/{6837094/Test.java => Test6837094.java} (77%) rename hotspot/test/compiler/c2/{6843752/Test.java => Test6843752.java} (95%) rename hotspot/test/compiler/c2/{5091921 => }/Test6850611.java (95%) rename hotspot/test/compiler/c2/{6851282/Test.java => Test6851282.java} (57%) rename hotspot/test/compiler/c2/{6852078 => }/Test6852078.java (96%) rename hotspot/test/compiler/c2/{6857159 => }/Test6857159.java (52%) rename hotspot/test/compiler/c2/{6863155 => }/Test6863155.java (91%) rename hotspot/test/compiler/c2/{6866651/Test.java => Test6866651.java} (94%) rename hotspot/test/compiler/c2/{6877254/Test.java => Test6877254.java} (94%) rename hotspot/test/compiler/c2/{6880034 => }/Test6880034.java (85%) rename hotspot/test/compiler/c2/{6885584 => }/Test6885584.java (96%) rename hotspot/test/compiler/c2/{5091921 => }/Test6897150.java (96%) rename hotspot/test/compiler/c2/{6901572/Test.java => Test6901572.java} (95%) create mode 100644 hotspot/test/compiler/c2/Test6905845.java rename hotspot/test/compiler/c2/{6910484/Test.java => Test6910484.java} (94%) rename hotspot/test/compiler/c2/{6910605/Test.java => Test6910605_1.java} (95%) rename hotspot/test/compiler/c2/{6910618/Test.java => Test6910605_2.java} (54%) rename hotspot/test/compiler/c2/{6912517/Test.java => Test6912517.java} (93%) rename hotspot/test/compiler/c2/{6916644 => }/Test6916644.java (91%) rename hotspot/test/compiler/c2/{6930043 => }/Test6930043.java (97%) rename hotspot/test/compiler/c2/{5091921 => }/Test6931567.java (97%) rename hotspot/test/compiler/c2/{5091921 => }/Test6935022.java (97%) rename hotspot/test/compiler/c2/{6956668 => }/Test6956668.java (96%) rename hotspot/test/compiler/c2/{6958485/Test.java => Test6958485.java} (89%) rename hotspot/test/compiler/c2/{5091921 => }/Test6959129.java (97%) rename hotspot/test/compiler/c2/{6968348 => }/Test6968348.java (95%) rename hotspot/test/compiler/c2/{6973329/Test.java => Test6973329.java} (61%) rename hotspot/test/compiler/c2/{5091921 => }/Test6985295.java (95%) rename hotspot/test/compiler/c2/{5091921 => }/Test6992759.java (96%) rename hotspot/test/compiler/c2/{7002666 => }/Test7002666.java (90%) rename hotspot/test/compiler/c2/{7009359 => }/Test7009359.java (91%) rename hotspot/test/compiler/c2/{7017746/Test.java => Test7017746.java} (72%) rename hotspot/test/compiler/c2/{5091921 => }/Test7020614.java (95%) rename hotspot/test/compiler/c2/{7024475 => }/Test7024475.java (97%) rename hotspot/test/compiler/c2/{7029152/Test.java => Test7029152.java} (71%) rename hotspot/test/compiler/c2/{7041100 => }/Test7041100.java (95%) rename hotspot/test/compiler/c2/{7046096 => }/Test7046096.java (62%) rename hotspot/test/compiler/c2/{7047069 => }/Test7047069.java (98%) rename hotspot/test/compiler/c2/{7048332 => }/Test7048332.java (62%) rename hotspot/test/compiler/c2/{7068051 => }/Test7068051.java (98%) rename hotspot/test/compiler/c2/{7110586 => }/Test7110586.java (97%) rename hotspot/test/compiler/c2/{7125879 => }/Test7125879.java (95%) rename hotspot/test/compiler/c2/{7160610 => }/Test7160610.java (97%) rename hotspot/test/compiler/c2/{7169782 => }/Test7169782.java (89%) rename hotspot/test/compiler/c2/{7174363 => }/Test7174363.java (89%) rename hotspot/test/compiler/c2/{7177917 => }/Test7177917.java (94%) rename hotspot/test/compiler/c2/{7179138 => }/Test7179138_1.java (96%) rename hotspot/test/compiler/c2/{7179138 => }/Test7179138_2.java (96%) create mode 100644 hotspot/test/compiler/c2/Test7190310.java create mode 100644 hotspot/test/compiler/c2/Test7190310_unsafe.java rename hotspot/test/compiler/c2/{7199742 => }/Test7199742.java (67%) rename hotspot/test/compiler/c2/{8000805 => }/Test8000805.java (62%) create mode 100644 hotspot/test/compiler/c2/Test8002069.java rename hotspot/test/compiler/c2/{8004741 => }/Test8004741.java (94%) rename hotspot/test/compiler/c2/{8007294 => }/Test8007294.java (95%) rename hotspot/test/compiler/c2/{8007722 => }/Test8007722.java (93%) rename hotspot/test/compiler/c2/{6946040 => }/TestCharShortByteSwap.java (91%) rename hotspot/test/compiler/c2/{6921969 => }/TestMultiplyLongHiZero.java (88%) rename hotspot/test/compiler/c2/{6340864 => cr6340864}/TestByteVect.java (99%) rename hotspot/test/compiler/c2/{6340864 => cr6340864}/TestDoubleVect.java (99%) rename hotspot/test/compiler/c2/{6340864 => cr6340864}/TestFloatVect.java (99%) rename hotspot/test/compiler/c2/{6340864 => cr6340864}/TestIntVect.java (99%) rename hotspot/test/compiler/c2/{6340864 => cr6340864}/TestLongVect.java (99%) rename hotspot/test/compiler/c2/{6340864 => cr6340864}/TestShortVect.java (99%) rename hotspot/test/compiler/c2/{6589834 => cr6589834}/InlinedArrayCloneTestCase.java (99%) rename hotspot/test/compiler/c2/{6589834 => cr6589834}/Test_ia32.java (83%) rename hotspot/test/compiler/c2/{6646020 => cr6646020}/Tester.java (99%) rename hotspot/test/compiler/c2/{6663848 => cr6663848}/Tester.java (99%) rename hotspot/test/compiler/c2/{6663854 => cr6663854}/Test6663854.java (99%) rename hotspot/test/compiler/c2/{6711117 => cr6711117}/Test.java (99%) rename hotspot/test/compiler/c2/{6712835 => cr6712835}/Test6712835.java (99%) rename hotspot/test/compiler/c2/{6714694 => cr6714694}/Tester.java (99%) rename hotspot/test/compiler/c2/{6865031 => cr6865031}/Test.java (98%) rename hotspot/test/compiler/c2/{5091921 => cr6890943}/Test6890943.java (97%) rename hotspot/test/compiler/c2/{5091921 => cr6890943}/input6890943.txt (100%) rename hotspot/test/compiler/c2/{5091921 => cr6890943}/output6890943.txt (100%) rename hotspot/test/compiler/c2/{5091921 => cr7005594}/Test7005594.java (98%) rename hotspot/test/compiler/c2/{5091921 => cr7005594}/Test7005594.sh (93%) rename hotspot/test/compiler/c2/{7192963 => cr7192963}/TestByteVect.java (98%) rename hotspot/test/compiler/c2/{7192963 => cr7192963}/TestDoubleVect.java (97%) rename hotspot/test/compiler/c2/{7192963 => cr7192963}/TestFloatVect.java (97%) rename hotspot/test/compiler/c2/{7192963 => cr7192963}/TestIntVect.java (97%) rename hotspot/test/compiler/c2/{7192963 => cr7192963}/TestLongVect.java (98%) rename hotspot/test/compiler/c2/{7192963 => cr7192963}/TestShortVect.java (98%) rename hotspot/test/compiler/c2/{7200264 => cr7200264}/Test7200264.sh (96%) rename hotspot/test/compiler/c2/{7200264 => cr7200264}/TestIntVect.java (99%) rename hotspot/test/compiler/c2/{8004867 => cr8004867}/TestIntAtomicCAS.java (99%) rename hotspot/test/compiler/c2/{8004867 => cr8004867}/TestIntAtomicOrdered.java (99%) rename hotspot/test/compiler/c2/{8004867 => cr8004867}/TestIntAtomicVolatile.java (99%) rename hotspot/test/compiler/c2/{8004867 => cr8004867}/TestIntUnsafeCAS.java (99%) rename hotspot/test/compiler/c2/{8004867 => cr8004867}/TestIntUnsafeOrdered.java (99%) rename hotspot/test/compiler/c2/{8004867 => cr8004867}/TestIntUnsafeVolatile.java (99%) rename hotspot/test/compiler/c2/{7070134 => stemmer}/Stemmer.java (98%) rename hotspot/test/compiler/c2/{7070134 => stemmer}/words (100%) rename hotspot/test/compiler/{native => calls}/TestDirtyInt.java (95%) rename hotspot/test/compiler/{native => calls}/libTestDirtyInt.c (92%) delete mode 100644 hotspot/test/compiler/codegen/6431242/Test.java delete mode 100644 hotspot/test/compiler/codegen/7184394/TestAESBase.java rename hotspot/test/compiler/codegen/{8144028 => }/BitTests.java (80%) rename hotspot/test/compiler/codegen/{7088419 => }/CRCTest.java (96%) rename hotspot/test/compiler/codegen/{6378821 => }/Test6378821.java (94%) create mode 100644 hotspot/test/compiler/codegen/Test6431242.java rename hotspot/test/compiler/codegen/{6797305 => }/Test6797305.java (92%) rename hotspot/test/compiler/codegen/{6814842 => }/Test6814842.java (92%) rename hotspot/test/compiler/codegen/{6823354 => }/Test6823354.java (92%) rename hotspot/test/compiler/codegen/{6875866/Test.java => Test6875866.java} (73%) rename hotspot/test/compiler/codegen/{6879902 => }/Test6879902.java (99%) rename hotspot/test/compiler/codegen/{6896617 => }/Test6896617.java (99%) rename hotspot/test/compiler/codegen/{6909839 => }/Test6909839.java (98%) rename hotspot/test/compiler/codegen/{6935535/Test.java => Test6935535.java} (68%) rename hotspot/test/compiler/codegen/{6942326/Test.java => Test6942326.java} (95%) rename hotspot/test/compiler/codegen/{7009231 => }/Test7009231.java (97%) rename hotspot/test/compiler/codegen/{7100757 => }/Test7100757.java (97%) rename hotspot/test/compiler/codegen/{8005033 => }/Test8005033.java (91%) rename hotspot/test/compiler/codegen/{8011901 => }/Test8011901.java (95%) rename hotspot/test/compiler/codegen/{7119644 => }/TestBooleanVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestByteDoubleVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestByteFloatVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestByteIntVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestByteLongVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestByteShortVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestByteVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestCharShortVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestCharVect.java (99%) rename hotspot/test/compiler/codegen/{8001183/TestCharVect.java => TestCharVect2.java} (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestDoubleVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestFloatDoubleVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestFloatVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestIntDoubleVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestIntFloatVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestIntLongVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestIntVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestLongDoubleVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestLongFloatVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestLongVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestShortDoubleVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestShortFloatVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestShortIntVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestShortLongVect.java (99%) rename hotspot/test/compiler/codegen/{7119644 => }/TestShortVect.java (99%) create mode 100644 hotspot/test/compiler/codegen/aes/TestAESBase.java rename hotspot/test/compiler/codegen/{7184394 => aes}/TestAESDecode.java (53%) rename hotspot/test/compiler/codegen/{7184394 => aes}/TestAESEncode.java (54%) rename hotspot/test/compiler/codegen/{7184394 => aes}/TestAESMain.java (52%) rename hotspot/test/compiler/eliminateAutobox/{6934604 => }/TestByteBoxing.java (95%) rename hotspot/test/compiler/eliminateAutobox/{6934604 => }/TestDoubleBoxing.java (95%) rename hotspot/test/compiler/eliminateAutobox/{6934604 => }/TestFloatBoxing.java (95%) rename hotspot/test/compiler/eliminateAutobox/{6934604 => }/TestIntBoxing.java (95%) rename hotspot/test/compiler/eliminateAutobox/{6934604 => }/TestLongBoxing.java (95%) rename hotspot/test/compiler/eliminateAutobox/{6934604 => }/TestShortBoxing.java (95%) delete mode 100644 hotspot/test/compiler/escapeAnalysis/6689060/Test.java delete mode 100644 hotspot/test/compiler/escapeAnalysis/6726999/Test.java create mode 100644 hotspot/test/compiler/escapeAnalysis/Test6689060.java create mode 100644 hotspot/test/compiler/escapeAnalysis/Test6726999.java rename hotspot/test/compiler/escapeAnalysis/{6775880/Test.java => Test6775880.java} (59%) rename hotspot/test/compiler/escapeAnalysis/{6895383/Test.java => Test6895383.java} (87%) rename hotspot/test/compiler/escapeAnalysis/{6896727/Test.java => Test6896727.java} (93%) rename hotspot/test/compiler/escapeAnalysis/{6716441 => cr6716441}/Tester.java (99%) rename hotspot/test/compiler/escapeAnalysis/{6795161 => cr6795161}/Test.java (90%) rename hotspot/test/compiler/interpreter/{6539464/Test.java => Test6539464.java} (88%) rename hotspot/test/compiler/interpreter/{6833129/Test.java => Test6833129.java} (94%) rename hotspot/test/compiler/interpreter/{7116216 => cr7116216}/LargeFrame.java (99%) rename hotspot/test/compiler/interpreter/{7116216 => cr7116216}/StackOverflow.java (95%) rename hotspot/test/compiler/intrinsics/{6982370 => }/Test6982370.java (98%) rename hotspot/test/compiler/intrinsics/{8005419 => }/Test8005419.java (97%) rename hotspot/test/compiler/intrinsics/{montgomerymultiply => bigInteger}/MontgomeryMultiplyTest.java (90%) rename hotspot/test/compiler/intrinsics/{muladd => bigInteger}/TestMulAdd.java (91%) rename hotspot/test/compiler/intrinsics/{multiplytolen => bigInteger}/TestMultiplyToLen.java (92%) rename hotspot/test/compiler/intrinsics/{multiplytolen => bigInteger}/TestMultiplyToLenReturnProfile.java (89%) rename hotspot/test/compiler/intrinsics/{squaretolen => bigInteger}/TestSquareToLen.java (91%) rename hotspot/test/compiler/intrinsics/{classcast/NullCheckDroppingsTest.java => klass/CastNullCheckDroppingsTest.java} (80%) rename hotspot/test/compiler/intrinsics/{class/TestClassIsPrimitive.java => klass/TestIsPrimitive.java} (95%) rename hotspot/test/compiler/intrinsics/{clone/TestObjectClone.java => object/TestClone.java} (69%) rename hotspot/test/compiler/intrinsics/{hashcode => object}/TestHashCode.java (87%) rename hotspot/test/compiler/intrinsics/{stringequals => string}/TestStringEqualsBadLength.java (95%) rename hotspot/test/compiler/intrinsics/{adler32 => zip}/TestAdler32.java (98%) rename hotspot/test/compiler/intrinsics/{crc32 => zip}/TestCRC32.java (98%) rename hotspot/test/compiler/intrinsics/{crc32c => zip}/TestCRC32C.java (98%) rename hotspot/test/compiler/jsr292/{7082949 => }/Test7082949.java (89%) rename hotspot/test/compiler/jsr292/{6990212 => cr6990212}/Test6990212.java (90%) delete mode 100644 hotspot/test/compiler/loopopts/7044738/Test7044738.java delete mode 100644 hotspot/test/compiler/loopopts/7052494/Test7052494.java rename hotspot/test/compiler/loopopts/{6659207/Test.java => Test6659207.java} (94%) rename hotspot/test/compiler/loopopts/{6855164/Test.java => Test6855164.java} (94%) rename hotspot/test/compiler/loopopts/{6860469/Test.java => Test6860469.java} (57%) create mode 100644 hotspot/test/compiler/loopopts/Test7044738.java create mode 100644 hotspot/test/compiler/loopopts/Test7052494.java delete mode 100644 hotspot/test/compiler/runtime/6778657/Test.java delete mode 100644 hotspot/test/compiler/runtime/7196199/Test7196199.java delete mode 100644 hotspot/test/compiler/runtime/8010927/Test8010927.java rename hotspot/test/compiler/runtime/{7141637 => }/SpreadNullArg.java (85%) rename hotspot/test/compiler/runtime/{6865265 => }/StackOverflowBug.java (53%) create mode 100644 hotspot/test/compiler/runtime/Test6778657.java rename hotspot/test/compiler/runtime/{6826736/Test.java => Test6826736.java} (84%) rename hotspot/test/compiler/runtime/{6859338 => }/Test6859338.java (92%) rename hotspot/test/compiler/runtime/{6863420/Test.java => Test6863420.java} (95%) rename hotspot/test/compiler/runtime/{6892265/Test.java => Test6892265.java} (56%) rename hotspot/test/compiler/runtime/{7088020 => }/Test7088020.java (92%) create mode 100644 hotspot/test/compiler/runtime/Test7196199.java create mode 100644 hotspot/test/compiler/runtime/Test8010927.java rename hotspot/test/compiler/runtime/{6891750 => cr6891750}/Test6891750.java (97%) rename hotspot/test/compiler/runtime/{8015436 => cr8015436}/Test8015436.java (92%) rename hotspot/test/compiler/uncommontrap/{8009761 => }/Test8009761.java (97%) diff --git a/hotspot/make/test/JtregNative.gmk b/hotspot/make/test/JtregNative.gmk index e89506b1c53..f5553bd0a47 100644 --- a/hotspot/make/test/JtregNative.gmk +++ b/hotspot/make/test/JtregNative.gmk @@ -50,7 +50,6 @@ BUILD_HOTSPOT_JTREG_NATIVE_SRC := \ $(HOTSPOT_TOPDIR)/test/runtime/BoolReturn \ $(HOTSPOT_TOPDIR)/test/compiler/floatingpoint/ \ $(HOTSPOT_TOPDIR)/test/compiler/calls \ - $(HOTSPOT_TOPDIR)/test/compiler/native \ $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/GetNamedModule \ $(HOTSPOT_TOPDIR)/test/testlibrary/jvmti \ # diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups index b46499f7902..e1bdec26de5 100644 --- a/hotspot/test/TEST.groups +++ b/hotspot/test/TEST.groups @@ -130,8 +130,8 @@ jre = \ # Tests that require the full JRE # needs_jre = \ - compiler/c2/6852078/Test6852078.java \ - compiler/c2/7047069/Test7047069.java \ + compiler/c2/Test6852078.java \ + compiler/c2/Test7047069.java \ runtime/6294277/SourceDebugExtension.java \ runtime/ClassFile/JsrRewriting.java \ runtime/ClassFile/OomWhileParsingRepeatedJsr.java \ @@ -277,16 +277,16 @@ hotspot_fast_compiler_1 = \ compiler/arraycopy/ \ compiler/c1/ \ compiler/c2/ \ - -compiler/c2/5091921/Test6850611.java \ - -compiler/c2/5091921/Test6890943.java \ - -compiler/c2/5091921/Test6905845.java \ - -compiler/c2/6340864 \ - -compiler/c2/6589834 \ - -compiler/c2/6603011 \ - -compiler/c2/6912517 \ - -compiler/c2/6792161 \ - -compiler/c2/7070134 \ - -compiler/c2/8004867 + -compiler/c2/Test6850611.java \ + -compiler/c2/cr6890943/Test6890943.java \ + -compiler/c2/Test6905845.java \ + -compiler/c2/cr6340864 \ + -compiler/c2/cr6589834 \ + -compiler/c2/cr8004867 + -compiler/c2/stemmer \ + -compiler/c2/Test6792161.java \ + -compiler/c2/Test6603011.java \ + -compiler/c2/Test6912517.java \ hotspot_fast_compiler_2 = \ compiler/classUnloading/ \ @@ -303,7 +303,7 @@ hotspot_fast_compiler_2 = \ compiler/integerArithmetic/ \ compiler/interpreter/ \ compiler/jvmci/ \ - -compiler/codegen/7184394 \ + -compiler/codegen/aes \ -compiler/codecache/stress \ -compiler/gcbarriers/PreserveFPRegistersTest.java @@ -320,13 +320,13 @@ hotspot_fast_compiler_3 = \ compiler/types/ \ compiler/uncommontrap/ \ compiler/unsafe/ \ - -compiler/intrinsics/adler32 \ -compiler/intrinsics/bmi \ -compiler/intrinsics/mathexact \ - -compiler/intrinsics/multiplytolen \ -compiler/intrinsics/sha \ - -compiler/loopopts/7052494 \ - -compiler/runtime/6826736 + -compiler/intrinsics/bigInteger/TestMultiplyToLen.java \ + -compiler/intrinsics/zip/TestAdler32.java \ + -compiler/loopopts/Test7052494.java \ + -compiler/runtime/Test6826736.java hotspot_fast_compiler_closed = \ sanity/ExecuteInternalVMTests.java diff --git a/hotspot/test/compiler/arguments/BMICommandLineOptionTestBase.java b/hotspot/test/compiler/arguments/BMICommandLineOptionTestBase.java index ae651883ff5..089679d8da2 100644 --- a/hotspot/test/compiler/arguments/BMICommandLineOptionTestBase.java +++ b/hotspot/test/compiler/arguments/BMICommandLineOptionTestBase.java @@ -21,7 +21,10 @@ * questions. */ -import jdk.test.lib.cli.*; +package compiler.arguments; + +import jdk.test.lib.cli.CPUSpecificCommandLineOptionTest; +import jdk.test.lib.cli.CommandLineOptionTest; /** * Base class for all X86 bit manipulation related command line options. diff --git a/hotspot/test/compiler/arguments/BMISupportedCPUTest.java b/hotspot/test/compiler/arguments/BMISupportedCPUTest.java index 6e73c1a9bb9..9582e8fe69f 100644 --- a/hotspot/test/compiler/arguments/BMISupportedCPUTest.java +++ b/hotspot/test/compiler/arguments/BMISupportedCPUTest.java @@ -21,8 +21,10 @@ * questions. */ -import jdk.test.lib.*; -import jdk.test.lib.cli.*; +package compiler.arguments; + +import jdk.test.lib.ExitCode; +import jdk.test.lib.cli.CommandLineOptionTest; /** * Test on bit manipulation related command line options, diff --git a/hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java b/hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java index 0cb554ce6b4..103d2a91e7e 100644 --- a/hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java +++ b/hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java @@ -21,8 +21,11 @@ * questions. */ -import jdk.test.lib.*; -import jdk.test.lib.cli.*; +package compiler.arguments; + +import jdk.test.lib.ExitCode; +import jdk.test.lib.Platform; +import jdk.test.lib.cli.CommandLineOptionTest; /** * Test on bit manipulation related command line options, diff --git a/hotspot/test/compiler/arguments/CheckCICompilerCount.java b/hotspot/test/compiler/arguments/CheckCICompilerCount.java index f568dbec0dd..1a44038368c 100644 --- a/hotspot/test/compiler/arguments/CheckCICompilerCount.java +++ b/hotspot/test/compiler/arguments/CheckCICompilerCount.java @@ -21,19 +21,22 @@ * questions. */ -import jdk.test.lib.*; - /* * @test CheckCheckCICompilerCount * @bug 8130858 * @bug 8132525 * @summary Check that correct range of values for CICompilerCount are allowed depending on whether tiered is enabled or not - * @library /testlibrary + * @library /testlibrary / * @modules java.base/jdk.internal.misc * java.management - * @run main CheckCICompilerCount + * @run driver compiler.arguments.CheckCICompilerCount */ +package compiler.arguments; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; + public class CheckCICompilerCount { private static final String[][] NON_TIERED_ARGUMENTS = { { diff --git a/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java b/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java index 653536fad72..7c3412aff1e 100644 --- a/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java +++ b/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java @@ -21,18 +21,21 @@ * questions. */ -import jdk.test.lib.*; - /* * @test CheckCompileThresholdScaling * @bug 8059604 - * @summary "Add CompileThresholdScaling flag to control when methods are first compiled (with +/-TieredCompilation)" + * @summary Add CompileThresholdScaling flag to control when methods are first compiled (with +/-TieredCompilation) * @library /testlibrary * @modules java.base/jdk.internal.misc * java.management - * @run main CheckCompileThresholdScaling + * @run driver compiler.arguments.CheckCompileThresholdScaling */ +package compiler.arguments; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; + public class CheckCompileThresholdScaling { // The flag CompileThresholdScaling scales compilation thresholds diff --git a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java index d05a24e9586..5d7f9fc3bc3 100644 --- a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java @@ -26,19 +26,19 @@ * @bug 8031321 * @summary Verify processing of UseBMI1Instructions option on CPU with * BMI1 feature support. - * @library /testlibrary /test/lib + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseBMI1InstructionsOnSupportedCPU - * BMISupportedCPUTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @build compiler.arguments.TestUseBMI1InstructionsOnSupportedCPU + * compiler.arguments.BMISupportedCPUTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseBMI1InstructionsOnSupportedCPU + * -XX:+WhiteBoxAPI + * compiler.arguments.TestUseBMI1InstructionsOnSupportedCPU */ -import sun.hotspot.cpuinfo.CPUInfo; -import jdk.test.lib.*; +package compiler.arguments; public class TestUseBMI1InstructionsOnSupportedCPU extends BMISupportedCPUTest { diff --git a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java index 716e0690874..4fd996f584a 100644 --- a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java @@ -26,20 +26,19 @@ * @bug 8031321 * @summary Verify processing of UseBMI1Instructions option on CPU without * BMI1 feature support. - * @library /testlibrary /test/lib + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseBMI1InstructionsOnUnsupportedCPU - * BMIUnsupportedCPUTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @build compiler.arguments.TestUseBMI1InstructionsOnUnsupportedCPU + * compiler.arguments.BMIUnsupportedCPUTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseBMI1InstructionsOnUnsupportedCPU + * -XX:+WhiteBoxAPI + * compiler.arguments.TestUseBMI1InstructionsOnUnsupportedCPU */ -import sun.hotspot.cpuinfo.CPUInfo; -import jdk.test.lib.*; -import jdk.test.lib.cli.*; +package compiler.arguments; public class TestUseBMI1InstructionsOnUnsupportedCPU extends BMIUnsupportedCPUTest { diff --git a/hotspot/test/compiler/arguments/TestUseCompiler.java b/hotspot/test/compiler/arguments/TestUseCompiler.java index edf3540398c..75f229e546a 100644 --- a/hotspot/test/compiler/arguments/TestUseCompiler.java +++ b/hotspot/test/compiler/arguments/TestUseCompiler.java @@ -25,10 +25,13 @@ * @test TestUseCompiler * @bug 8086068 * @summary Tests execution with inconsistent UseCompiler flag combination. - * @run main/othervm -Xint -XX:+UseCompiler TestUseCompiler - * @run main/othervm -XX:+UseCompiler -Xint TestUseCompiler + * + * @run main/othervm -Xint -XX:+UseCompiler compiler.arguments.TestUseCompiler + * @run main/othervm -XX:+UseCompiler -Xint compiler.arguments.TestUseCompiler */ +package compiler.arguments; + public class TestUseCompiler { public static void main(String args[]) { diff --git a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java index 0ffa6ea8dd3..3ebd44d5b13 100644 --- a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java @@ -26,20 +26,19 @@ * @bug 8031321 * @summary Verify processing of UseCountLeadingZerosInstruction option * on CPU with LZCNT support. - * @library /testlibrary /test/lib + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseCountLeadingZerosInstructionOnSupportedCPU - * BMISupportedCPUTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * + * @build compiler.arguments.TestUseCountLeadingZerosInstructionOnSupportedCPU + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI - * TestUseCountLeadingZerosInstructionOnSupportedCPU + * compiler.arguments.TestUseCountLeadingZerosInstructionOnSupportedCPU */ -import sun.hotspot.cpuinfo.CPUInfo; -import jdk.test.lib.*; +package compiler.arguments; public class TestUseCountLeadingZerosInstructionOnSupportedCPU extends BMISupportedCPUTest { diff --git a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java index 12093151861..4285c27cb48 100644 --- a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java @@ -26,20 +26,19 @@ * @bug 8031321 * @summary Verify processing of UseCountLeadingZerosInstruction option * on CPU without LZCNT support. - * @library /testlibrary /test/lib + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseCountLeadingZerosInstructionOnUnsupportedCPU - * BMIUnsupportedCPUTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * + * @build compiler.arguments.TestUseCountLeadingZerosInstructionOnUnsupportedCPU + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI - * TestUseCountLeadingZerosInstructionOnUnsupportedCPU + * compiler.arguments.TestUseCountLeadingZerosInstructionOnUnsupportedCPU */ -import sun.hotspot.cpuinfo.CPUInfo; -import jdk.test.lib.*; +package compiler.arguments; public class TestUseCountLeadingZerosInstructionOnUnsupportedCPU extends BMIUnsupportedCPUTest { diff --git a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java index 397bdc93acc..3e988e6b7fe 100644 --- a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java @@ -26,21 +26,21 @@ * @bug 8031321 * @summary Verify processing of UseCountTrailingZerosInstruction option * on CPU with TZCNT (BMI1 feature) support. - * @library /testlibrary /test/lib + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseCountTrailingZerosInstructionOnSupportedCPU - * BMISupportedCPUTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * + * @build compiler.arguments.TestUseCountTrailingZerosInstructionOnSupportedCPU + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI - * TestUseCountTrailingZerosInstructionOnSupportedCPU + * compiler.arguments.TestUseCountTrailingZerosInstructionOnSupportedCPU */ -import sun.hotspot.cpuinfo.CPUInfo; -import jdk.test.lib.*; -import jdk.test.lib.cli.*; +package compiler.arguments; + +import jdk.test.lib.cli.CommandLineOptionTest; public class TestUseCountTrailingZerosInstructionOnSupportedCPU extends BMISupportedCPUTest { diff --git a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java index 73aad61f4b7..96ccd674126 100644 --- a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java @@ -26,21 +26,21 @@ * @bug 8031321 * @summary Verify processing of UseCountTrailingZerosInstruction option * on CPU without TZCNT instruction (BMI1 feature) support. - * @library /testlibrary /test/lib + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseCountTrailingZerosInstructionOnUnsupportedCPU - * BMIUnsupportedCPUTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * + * @build compiler.arguments.TestUseCountTrailingZerosInstructionOnUnsupportedCPU + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI - * TestUseCountTrailingZerosInstructionOnUnsupportedCPU + * compiler.arguments.TestUseCountTrailingZerosInstructionOnUnsupportedCPU */ -import sun.hotspot.cpuinfo.CPUInfo; -import jdk.test.lib.*; -import jdk.test.lib.cli.*; +package compiler.arguments; + +import jdk.test.lib.cli.CommandLineOptionTest; public class TestUseCountTrailingZerosInstructionOnUnsupportedCPU extends BMIUnsupportedCPUTest { diff --git a/hotspot/test/compiler/arraycopy/TestArrayCloneBadAssert.java b/hotspot/test/compiler/arraycopy/TestArrayCloneBadAssert.java index a6033337885..7203ca2058d 100644 --- a/hotspot/test/compiler/arraycopy/TestArrayCloneBadAssert.java +++ b/hotspot/test/compiler/arraycopy/TestArrayCloneBadAssert.java @@ -25,10 +25,14 @@ * @test * @bug 8073792 * @summary assert broken when array size becomes known during igvn - * @run main/othervm -Xcomp -XX:CompileOnly=TestArrayCloneBadAssert.m TestArrayCloneBadAssert * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.arraycopy.TestArrayCloneBadAssert::m + * compiler.arraycopy.TestArrayCloneBadAssert */ +package compiler.arraycopy; + public class TestArrayCloneBadAssert { static final int[] array = new int[5]; diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyAsLoadsStores.java b/hotspot/test/compiler/arraycopy/TestArrayCopyAsLoadsStores.java index 6a1b4e6aeba..4c4c38848d8 100644 --- a/hotspot/test/compiler/arraycopy/TestArrayCopyAsLoadsStores.java +++ b/hotspot/test/compiler/arraycopy/TestArrayCopyAsLoadsStores.java @@ -25,13 +25,22 @@ * @test * @bug 6912521 * @summary small array copy as loads/stores - * @compile TestArrayCopyAsLoadsStores.java TestArrayCopyUtils.java - * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestArrayCopyAsLoadsStores::m* -XX:TypeProfileLevel=200 TestArrayCopyAsLoadsStores - * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestArrayCopyAsLoadsStores::m* -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode -XX:TypeProfileLevel=200 TestArrayCopyAsLoadsStores + * @library / * + * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * -XX:CompileCommand=dontinline,compiler.arraycopy.TestArrayCopyAsLoadsStores::m* + * -XX:TypeProfileLevel=200 + * compiler.arraycopy.TestArrayCopyAsLoadsStores + * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * -XX:CompileCommand=dontinline,compiler.arraycopy.TestArrayCopyAsLoadsStores::m* + * -XX:TypeProfileLevel=200 + * -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode + * compiler.arraycopy.TestArrayCopyAsLoadsStores */ -import java.util.*; +package compiler.arraycopy; + +import java.util.Arrays; public class TestArrayCopyAsLoadsStores extends TestArrayCopyUtils { diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyBadReexec.java b/hotspot/test/compiler/arraycopy/TestArrayCopyBadReexec.java index 09b03328ed5..93eb1b20b9d 100644 --- a/hotspot/test/compiler/arraycopy/TestArrayCopyBadReexec.java +++ b/hotspot/test/compiler/arraycopy/TestArrayCopyBadReexec.java @@ -25,10 +25,13 @@ * @test * @bug 8073866 * @summary Fix for 8064703 may also cause stores between the allocation and arraycopy to be rexecuted after a deoptimization - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestArrayCopyBadReexec * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.arraycopy.TestArrayCopyBadReexec */ +package compiler.arraycopy; + public class TestArrayCopyBadReexec { static int val; diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyMacro.java b/hotspot/test/compiler/arraycopy/TestArrayCopyMacro.java index 9a451af08e5..15b2e73de9c 100644 --- a/hotspot/test/compiler/arraycopy/TestArrayCopyMacro.java +++ b/hotspot/test/compiler/arraycopy/TestArrayCopyMacro.java @@ -25,10 +25,13 @@ * @test * @bug 7173584 * @summary arraycopy as macro node - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestArrayCopyMacro * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.arraycopy.TestArrayCopyMacro */ +package compiler.arraycopy; + public class TestArrayCopyMacro { static class A { } diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java index 8d9978a61a9..828fb5ace99 100644 --- a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java +++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java @@ -25,10 +25,13 @@ * @test * @bug 8064703 * @summary Deoptimization between array allocation and arraycopy may result in non initialized array - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=020 TestArrayCopyNoInit * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=020 + * compiler.arraycopy.TestArrayCopyNoInit */ +package compiler.arraycopy; + public class TestArrayCopyNoInit { static int[] m1(int[] src) { diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java index 6451b38795e..464d87dd79b 100644 --- a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java +++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java @@ -28,19 +28,22 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestArrayCopyNoInitDeopt - * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * + * @build compiler.arraycopy.TestArrayCopyNoInitDeopt + * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * jdk.test.lib.Platform * @run main/othervm -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=020 - * TestArrayCopyNoInitDeopt + * compiler.arraycopy.TestArrayCopyNoInitDeopt */ -import sun.hotspot.WhiteBox; -import sun.hotspot.code.NMethod; -import jdk.test.lib.Platform; -import java.lang.reflect.*; +package compiler.arraycopy; + import compiler.whitebox.CompilerWhiteBoxTest; +import jdk.test.lib.Platform; +import sun.hotspot.WhiteBox; + +import java.lang.reflect.Method; public class TestArrayCopyNoInitDeopt { diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyOfStopped.java b/hotspot/test/compiler/arraycopy/TestArrayCopyOfStopped.java index 1d60235fffe..d2a9d45d5bd 100644 --- a/hotspot/test/compiler/arraycopy/TestArrayCopyOfStopped.java +++ b/hotspot/test/compiler/arraycopy/TestArrayCopyOfStopped.java @@ -25,10 +25,13 @@ * @test * @bug 8074676 * @summary after guards in Arrays.copyOf() intrinsic, control may become top - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestArrayCopyOfStopped * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.arraycopy.TestArrayCopyOfStopped */ +package compiler.arraycopy; + import java.util.Arrays; public class TestArrayCopyOfStopped { diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowArguments.java b/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowArguments.java index 1bfaa35e578..bc23717417f 100644 --- a/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowArguments.java +++ b/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowArguments.java @@ -28,10 +28,13 @@ * are properly sign extended to 64 bit (e.g., PPC64, s390x). This can fail * if slow_arraycopy_C() is commpiled by the C compiler without any imlicit * casts (as spill stores to the stack that are done with 4-byte instruction). - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestArrayCopyOverflowArguments * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.arraycopy.TestArrayCopyOverflowArguments */ +package compiler.arraycopy; + public class TestArrayCopyOverflowArguments { // Without volatile the overflowing computation was moved up and then diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowInBoundChecks.java b/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowInBoundChecks.java index 883df96a5c4..b45bbce8784 100644 --- a/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowInBoundChecks.java +++ b/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowInBoundChecks.java @@ -25,9 +25,13 @@ * @test * @bug 8134468 * @summary test that checks whether an array load falls into the range of an arraycopy is incorrect on 32bits - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestArrayCopyOverflowInBoundChecks * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.arraycopy.TestArrayCopyOverflowInBoundChecks */ + +package compiler.arraycopy; + public class TestArrayCopyOverflowInBoundChecks { static byte[] src_array = { 'a', 'b', 'c', 'd', 'e' }; diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyStoppedAfterGuards.java b/hotspot/test/compiler/arraycopy/TestArrayCopyStoppedAfterGuards.java index c75a69677ad..05f1c24c960 100644 --- a/hotspot/test/compiler/arraycopy/TestArrayCopyStoppedAfterGuards.java +++ b/hotspot/test/compiler/arraycopy/TestArrayCopyStoppedAfterGuards.java @@ -25,10 +25,16 @@ * @test * @bug 8075921 * @summary control becomes top after arraycopy guards and confuses tighly coupled allocation logic - * @run main/othervm -Xcomp -XX:CompileOnly=TestArrayCopyStoppedAfterGuards.test,System.arraycopy TestArrayCopyStoppedAfterGuards + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,java.lang.System::arraycopy + * -XX:CompileCommand=compileonly,compiler.arraycopy.TestArrayCopyStoppedAfterGuards::test + * compiler.arraycopy.TestArrayCopyStoppedAfterGuards * */ +package compiler.arraycopy; + public class TestArrayCopyStoppedAfterGuards { static void test() { diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyUtils.java b/hotspot/test/compiler/arraycopy/TestArrayCopyUtils.java index de6af41ede4..990400dae21 100644 --- a/hotspot/test/compiler/arraycopy/TestArrayCopyUtils.java +++ b/hotspot/test/compiler/arraycopy/TestArrayCopyUtils.java @@ -21,9 +21,13 @@ * questions. */ -import java.lang.annotation.*; -import java.lang.reflect.*; -import java.util.*; +package compiler.arraycopy; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.HashMap; abstract class TestArrayCopyUtils { public enum ArraySrc { diff --git a/hotspot/test/compiler/arraycopy/TestArraysCopyOfNoTypeCheck.java b/hotspot/test/compiler/arraycopy/TestArraysCopyOfNoTypeCheck.java index b24bc3b780b..f78e3e286fa 100644 --- a/hotspot/test/compiler/arraycopy/TestArraysCopyOfNoTypeCheck.java +++ b/hotspot/test/compiler/arraycopy/TestArraysCopyOfNoTypeCheck.java @@ -25,10 +25,13 @@ * @test * @bug 8055910 * @summary Arrays.copyOf doesn't perform subtype check - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestArraysCopyOfNoTypeCheck * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.arraycopy.TestArraysCopyOfNoTypeCheck */ +package compiler.arraycopy; + import java.util.Arrays; public class TestArraysCopyOfNoTypeCheck { diff --git a/hotspot/test/compiler/arraycopy/TestDeadArrayCopyOnMemChain.java b/hotspot/test/compiler/arraycopy/TestDeadArrayCopyOnMemChain.java index 1492254a054..d175182c267 100644 --- a/hotspot/test/compiler/arraycopy/TestDeadArrayCopyOnMemChain.java +++ b/hotspot/test/compiler/arraycopy/TestDeadArrayCopyOnMemChain.java @@ -25,10 +25,13 @@ * @test * @bug 8080699 * @summary eliminated arraycopy node still reachable through exception edges - * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation TestDeadArrayCopyOnMemChain * + * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation + * compiler.arraycopy.TestDeadArrayCopyOnMemChain */ +package compiler.arraycopy; + public class TestDeadArrayCopyOnMemChain { static class A { int f; diff --git a/hotspot/test/compiler/arraycopy/TestEliminateArrayCopy.java b/hotspot/test/compiler/arraycopy/TestEliminateArrayCopy.java index 624a65c42b4..3364ffa088e 100644 --- a/hotspot/test/compiler/arraycopy/TestEliminateArrayCopy.java +++ b/hotspot/test/compiler/arraycopy/TestEliminateArrayCopy.java @@ -25,11 +25,16 @@ * @test * @bug 8076188 * @summary arraycopy to non escaping destination may be eliminated - * @compile TestEliminateArrayCopy.java TestArrayCopyUtils.java - * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestEliminateArrayCopy*::m* TestEliminateArrayCopy + * @library / + * + * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * -XX:CompileCommand=dontinline,compiler.arraycopy.TestEliminateArrayCopy*::m* + * compiler.arraycopy.TestEliminateArrayCopy * */ +package compiler.arraycopy; + public class TestEliminateArrayCopy { static class CloneTests extends TestInstanceCloneUtils { diff --git a/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java b/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java index fb98c652c71..d6453564f5a 100644 --- a/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java +++ b/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java @@ -25,8 +25,12 @@ * @test * @bug 8130847 8156760 * @summary Eliminated instance/array written to by an array copy variant must be correctly initialized when reallocated at a deopt - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestEliminatedArrayCopyDeopt - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+IgnoreUnrecognizedVMOptions -XX:-ReduceInitialCardMarks TestEliminatedArrayCopyDeopt + * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.arraycopy.TestEliminatedArrayCopyDeopt + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * -XX:+IgnoreUnrecognizedVMOptions -XX:-ReduceInitialCardMarks + * compiler.arraycopy.TestEliminatedArrayCopyDeopt */ // Test that if an ArrayCopy node is eliminated because it doesn't @@ -34,6 +38,8 @@ // on a deoptimization, when the object/array is reallocated, it is // correctly initialized +package compiler.arraycopy; + public class TestEliminatedArrayCopyDeopt { static class A implements Cloneable { diff --git a/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyPhi.java b/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyPhi.java index 83edd327da5..62d55b9de28 100644 --- a/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyPhi.java +++ b/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyPhi.java @@ -25,10 +25,13 @@ * @test * @bug 8134321 * @summary Code that capture field values of eliminated allocation at a safepoint when there's an arraycopy behind a Phi is broken - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestEliminatedArrayCopyPhi * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.arraycopy.TestEliminatedArrayCopyPhi */ +package compiler.arraycopy; + public class TestEliminatedArrayCopyPhi { static int[] escaped; diff --git a/hotspot/test/compiler/arraycopy/TestEliminatedArrayLoopPredicateCopyDeopt.java b/hotspot/test/compiler/arraycopy/TestEliminatedArrayLoopPredicateCopyDeopt.java index d0ce772564d..b7e677ccbf6 100644 --- a/hotspot/test/compiler/arraycopy/TestEliminatedArrayLoopPredicateCopyDeopt.java +++ b/hotspot/test/compiler/arraycopy/TestEliminatedArrayLoopPredicateCopyDeopt.java @@ -25,10 +25,13 @@ * @test * @bug 8134974 * @summary Cannot pin eliminated arraycopy loads for deopt state in uncommon trap path if it is a loop predicate unc - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestEliminatedArrayLoopPredicateCopyDeopt * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.arraycopy.TestEliminatedArrayLoopPredicateCopyDeopt */ +package compiler.arraycopy; + public class TestEliminatedArrayLoopPredicateCopyDeopt { static boolean test(int[] array_src) { diff --git a/hotspot/test/compiler/arraycopy/TestInstanceCloneAsLoadsStores.java b/hotspot/test/compiler/arraycopy/TestInstanceCloneAsLoadsStores.java index 640c6862762..fd3b64d690f 100644 --- a/hotspot/test/compiler/arraycopy/TestInstanceCloneAsLoadsStores.java +++ b/hotspot/test/compiler/arraycopy/TestInstanceCloneAsLoadsStores.java @@ -25,12 +25,23 @@ * @test * @bug 6700100 8156760 * @summary small instance clone as loads/stores - * @compile TestInstanceCloneAsLoadsStores.java TestInstanceCloneUtils.java - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestInstanceCloneAsLoadsStores::m* TestInstanceCloneAsLoadsStores - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestInstanceCloneAsLoadsStores::m* -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode TestInstanceCloneAsLoadsStores - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestInstanceCloneAsLoadsStores::m* -XX:+IgnoreUnrecognizedVMOptions -XX:-ReduceInitialCardMarks TestInstanceCloneAsLoadsStores + * @library / + * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * -XX:CompileCommand=dontinline,compiler.arraycopy.TestInstanceCloneAsLoadsStores::m* + * compiler.arraycopy.TestInstanceCloneAsLoadsStores + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * -XX:CompileCommand=dontinline,compiler.arraycopy.TestInstanceCloneAsLoadsStores::m* + * -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode + * compiler.arraycopy.TestInstanceCloneAsLoadsStores + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * -XX:CompileCommand=dontinline,compiler.arraycopy.TestInstanceCloneAsLoadsStores::m* + * -XX:+IgnoreUnrecognizedVMOptions -XX:-ReduceInitialCardMarks + * compiler.arraycopy.TestInstanceCloneAsLoadsStores */ +package compiler.arraycopy; + public class TestInstanceCloneAsLoadsStores extends TestInstanceCloneUtils { // Should be compiled as loads/stores diff --git a/hotspot/test/compiler/arraycopy/TestInstanceCloneUtils.java b/hotspot/test/compiler/arraycopy/TestInstanceCloneUtils.java index af1e6fc7039..0e99257e15c 100644 --- a/hotspot/test/compiler/arraycopy/TestInstanceCloneUtils.java +++ b/hotspot/test/compiler/arraycopy/TestInstanceCloneUtils.java @@ -21,8 +21,12 @@ * questions. */ -import java.lang.reflect.*; -import java.util.*; +package compiler.arraycopy; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.HashMap; abstract class TestInstanceCloneUtils { static class Base implements Cloneable { diff --git a/hotspot/test/compiler/arraycopy/TestLoadBypassArrayCopy.java b/hotspot/test/compiler/arraycopy/TestLoadBypassArrayCopy.java index 697b9743b71..d4e4ca19371 100644 --- a/hotspot/test/compiler/arraycopy/TestLoadBypassArrayCopy.java +++ b/hotspot/test/compiler/arraycopy/TestLoadBypassArrayCopy.java @@ -25,10 +25,15 @@ * @test * @bug 8086046 * @summary load bypasses arraycopy that sets the value after the ArrayCopyNode is expanded - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestLoadBypassArrayCopy::test_helper -XX:-TieredCompilation TestLoadBypassArrayCopy * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * -XX:CompileCommand=dontinline,compiler.arraycopy.TestLoadBypassArrayCopy::test_helper + * -XX:-TieredCompilation + * compiler.arraycopy.TestLoadBypassArrayCopy */ +package compiler.arraycopy; + public class TestLoadBypassArrayCopy { static long i; diff --git a/hotspot/test/compiler/arraycopy/TestMissingControl.java b/hotspot/test/compiler/arraycopy/TestMissingControl.java index 503e24be3b4..f362e5382d4 100644 --- a/hotspot/test/compiler/arraycopy/TestMissingControl.java +++ b/hotspot/test/compiler/arraycopy/TestMissingControl.java @@ -25,9 +25,14 @@ * @test * @bug 8055153 * @summary missing control on LoadRange and LoadKlass when array copy macro node is expanded - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:-TieredCompilation TestMissingControl + * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:-TieredCompilation + * compiler.arraycopy.TestMissingControl * */ + +package compiler.arraycopy; + public class TestMissingControl { static int[] m1(int[] a2) { diff --git a/hotspot/test/compiler/arraycopy/TestObjectArrayClone.java b/hotspot/test/compiler/arraycopy/TestObjectArrayClone.java index 3cf5c65f39d..9be6fa0506c 100644 --- a/hotspot/test/compiler/arraycopy/TestObjectArrayClone.java +++ b/hotspot/test/compiler/arraycopy/TestObjectArrayClone.java @@ -25,8 +25,14 @@ * @test * @bug 8155643 * @summary Test Object.clone() intrinsic if ReduceInitialCardMarks is disabled. - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:CompileOnly=TestObjectArrayClone.test -XX:-ReduceInitialCardMarks TestObjectArrayClone + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-ReduceInitialCardMarks + * -XX:CompileCommand=compileonly,compiler.arraycopy.TestObjectArrayClone::test + * compiler.arraycopy.TestObjectArrayClone */ + +package compiler.arraycopy; + public class TestObjectArrayClone { public static TestObjectArrayClone[] test(TestObjectArrayClone[] arr) { diff --git a/hotspot/test/compiler/arraycopy/TestReduceBulkZeroingDisabled.java b/hotspot/test/compiler/arraycopy/TestReduceBulkZeroingDisabled.java index 2c789c0ee14..873eb1bfd3f 100644 --- a/hotspot/test/compiler/arraycopy/TestReduceBulkZeroingDisabled.java +++ b/hotspot/test/compiler/arraycopy/TestReduceBulkZeroingDisabled.java @@ -25,8 +25,13 @@ * @test * @bug 8155241 * @summary Test arraycopy elimination with ReduceBulkZeroing disabled. - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-ReduceBulkZeroing TestReduceBulkZeroingDisabled + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-ReduceBulkZeroing + * compiler.arraycopy.TestReduceBulkZeroingDisabled */ + +package compiler.arraycopy; + public class TestReduceBulkZeroingDisabled { static public void main(String[] args) { diff --git a/hotspot/test/compiler/c1/6478991/NullCheckTest.java b/hotspot/test/compiler/c1/6478991/NullCheckTest.java deleted file mode 100644 index 760e80c9c94..00000000000 --- a/hotspot/test/compiler/c1/6478991/NullCheckTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 6478991 - * @summary C1 NullCheckEliminator yields incorrect exceptions - * - * @run main/othervm -XX:CompileOnly=NullCheckTest.test,NullCheckTest.inlined -Xcomp NullCheckTest - */ - -public class NullCheckTest { - static class A { - int f; - - public final void inlined(A a) { - // This cast is intended to fail. - B b = ((B) a); - } - } - - static class B extends A { - } - - - private static void test(A a1, A a2) { - // Inlined call must do a null check on a1. - // However, the exlipcit NullCheck instruction is eliminated and - // the null check is folded into the field load below, so the - // exception in the inlined method is thrown before the null check - // and the NullPointerException is not thrown. - a1.inlined(a2); - - int x = a1.f; - } - - public static void main(String[] args) { - // load classes - new B(); - try { - test(null, new A()); - - throw new InternalError("FAILURE: no exception"); - } catch (NullPointerException ex) { - System.out.println("CORRECT: NullPointerException"); - } catch (ClassCastException ex) { - System.out.println("FAILURE: ClassCastException"); - throw ex; - } - } -} diff --git a/hotspot/test/compiler/c1/CanonicalizeArrayLength.java b/hotspot/test/compiler/c1/CanonicalizeArrayLength.java index ee2649a3b3a..64255c936ed 100644 --- a/hotspot/test/compiler/c1/CanonicalizeArrayLength.java +++ b/hotspot/test/compiler/c1/CanonicalizeArrayLength.java @@ -25,11 +25,29 @@ * @test * @bug 8150102 8150514 8150534 * @summary C1 crashes in Canonicalizer::do_ArrayLength() after fix for JDK-8150102 - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-BackgroundCompilation CanonicalizeArrayLength - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-BackgroundCompilation -XX:+PatchALot CanonicalizeArrayLength - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-BackgroundCompilation -XX:ScavengeRootsInCode=0 CanonicalizeArrayLength - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-BackgroundCompilation -XX:ScavengeRootsInCode=1 CanonicalizeArrayLength + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions + * -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-BackgroundCompilation + * compiler.c1.CanonicalizeArrayLength + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions + * -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-BackgroundCompilation + * -XX:+PatchALot + * compiler.c1.CanonicalizeArrayLength + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions + * -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-BackgroundCompilation + * -XX:ScavengeRootsInCode=0 + * compiler.c1.CanonicalizeArrayLength + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions + * -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-BackgroundCompilation -XX:ScavengeRootsInCode=1 + * compiler.c1.CanonicalizeArrayLength */ + +package compiler.c1; + public class CanonicalizeArrayLength { int[] arr = new int[42]; int[] arrNull = null; diff --git a/hotspot/test/compiler/c1/NullCheckTest.java b/hotspot/test/compiler/c1/NullCheckTest.java new file mode 100644 index 00000000000..24f72a45976 --- /dev/null +++ b/hotspot/test/compiler/c1/NullCheckTest.java @@ -0,0 +1,77 @@ +/* + * 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 6478991 + * @summary C1 NullCheckEliminator yields incorrect exceptions + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c1.NullCheckTest::test + * -XX:CompileCommand=compileonly,compiler.c1.NullCheckTest::inlined + * compiler.c1.NullCheckTest + */ + +package compiler.c1; + +public class NullCheckTest { + static class A { + int f; + + public final void inlined(A a) { + // This cast is intended to fail. + B b = ((B) a); + } + } + + static class B extends A { + } + + + private static void test(A a1, A a2) { + // Inlined call must do a null check on a1. + // However, the exlipcit NullCheck instruction is eliminated and + // the null check is folded into the field load below, so the + // exception in the inlined method is thrown before the null check + // and the NullPointerException is not thrown. + a1.inlined(a2); + + int x = a1.f; + } + + public static void main(String[] args) { + // load classes + new B(); + try { + test(null, new A()); + + throw new InternalError("FAILURE: no exception"); + } catch (NullPointerException ex) { + System.out.println("CORRECT: NullPointerException"); + } catch (ClassCastException ex) { + System.out.println("FAILURE: ClassCastException"); + throw ex; + } + } +} diff --git a/hotspot/test/compiler/c1/6579789/Test6579789.java b/hotspot/test/compiler/c1/Test6579789.java similarity index 90% rename from hotspot/test/compiler/c1/6579789/Test6579789.java rename to hotspot/test/compiler/c1/Test6579789.java index 344a08fae28..23603eaaa15 100644 --- a/hotspot/test/compiler/c1/6579789/Test6579789.java +++ b/hotspot/test/compiler/c1/Test6579789.java @@ -26,9 +26,14 @@ * @test * @bug 6579789 * @summary Internal error "c1_LinearScan.cpp:1429 Error: assert(false,"")" in debuggee with fastdebug VM - * @run main/othervm -Xcomp -XX:UseSSE=0 -XX:CompileOnly=Test6579789.bug Test6579789 + * + * @run main/othervm -Xcomp -XX:UseSSE=0 + * -XX:CompileCommand=compileonly,compiler.c1.Test6579789::bug + * compiler.c1.Test6579789 */ +package compiler.c1; + public class Test6579789 { public static void main(String[] args) { bug(4); diff --git a/hotspot/test/compiler/c1/6756768/Test6756768.java b/hotspot/test/compiler/c1/Test6756768.java similarity index 95% rename from hotspot/test/compiler/c1/6756768/Test6756768.java rename to hotspot/test/compiler/c1/Test6756768.java index 42a74744cd6..f1158efad2a 100644 --- a/hotspot/test/compiler/c1/6756768/Test6756768.java +++ b/hotspot/test/compiler/c1/Test6756768.java @@ -26,9 +26,11 @@ * @bug 6756768 * @summary C1 generates invalid code * - * @run main/othervm -Xcomp Test6756768 + * @run main/othervm -Xcomp compiler.c1.Test6756768 */ +package compiler.c1; + class Test6756768a { static boolean var_1 = true; diff --git a/hotspot/test/compiler/c1/6756768/Test6756768_2.java b/hotspot/test/compiler/c1/Test6756768_2.java similarity index 95% rename from hotspot/test/compiler/c1/6756768/Test6756768_2.java rename to hotspot/test/compiler/c1/Test6756768_2.java index b391500fbf7..16406cb1752 100644 --- a/hotspot/test/compiler/c1/6756768/Test6756768_2.java +++ b/hotspot/test/compiler/c1/Test6756768_2.java @@ -26,9 +26,11 @@ * @bug 6756768 * @summary C1 generates invalid code * - * @run main/othervm -Xcomp Test6756768_2 + * @run main/othervm -Xcomp compiler.c1.Test6756768_2 */ +package compiler.c1; + class Test6756768_2a { static int var = ++Test6756768_2.var; } diff --git a/hotspot/test/compiler/c1/6757316/Test6757316.java b/hotspot/test/compiler/c1/Test6757316.java similarity index 95% rename from hotspot/test/compiler/c1/6757316/Test6757316.java rename to hotspot/test/compiler/c1/Test6757316.java index 9585caa3e40..9566dfac9d1 100644 --- a/hotspot/test/compiler/c1/6757316/Test6757316.java +++ b/hotspot/test/compiler/c1/Test6757316.java @@ -25,9 +25,12 @@ * @test * @bug 6757316 * @summary load_constant() produces a wrong long constant, with high a low words swapped - * @run main/othervm -Xcomp Test6757316 + * + * @run main/othervm -Xcomp compiler.c1.Test6757316 */ +package compiler.c1; + public class Test6757316 { public static void main(String[] args) { long[] arr = { diff --git a/hotspot/test/compiler/c1/6758234/Test6758234.java b/hotspot/test/compiler/c1/Test6758234.java similarity index 90% rename from hotspot/test/compiler/c1/6758234/Test6758234.java rename to hotspot/test/compiler/c1/Test6758234.java index 8b880c6c2d6..d0143544069 100644 --- a/hotspot/test/compiler/c1/6758234/Test6758234.java +++ b/hotspot/test/compiler/c1/Test6758234.java @@ -25,9 +25,14 @@ * @test * @bug 6758234 * @summary if (k cond (a ? : b: c)) returns reversed answer if k is constant and b and c are longs - * @run main/othervm -Xcomp -XX:CompileOnly=Test6758234.main Test6758234 + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c1.Test6758234::main + * compiler.c1.Test6758234 */ +package compiler.c1; + public class Test6758234 { static int x = 0; static int y = 1; diff --git a/hotspot/test/compiler/c1/6795465/Test6795465.java b/hotspot/test/compiler/c1/Test6795465.java similarity index 96% rename from hotspot/test/compiler/c1/6795465/Test6795465.java rename to hotspot/test/compiler/c1/Test6795465.java index 2e9db1d356a..5f3ca9c945e 100644 --- a/hotspot/test/compiler/c1/6795465/Test6795465.java +++ b/hotspot/test/compiler/c1/Test6795465.java @@ -27,9 +27,11 @@ * @bug 6795465 * @summary Crash in assembler_sparc.cpp with client compiler on solaris-sparc * - * @run main Test6795465 + * @run main compiler.c1.Test6795465 */ +package compiler.c1; + public class Test6795465 { static long var_1 = -1; diff --git a/hotspot/test/compiler/c1/6849574/Test.java b/hotspot/test/compiler/c1/Test6849574.java similarity index 90% rename from hotspot/test/compiler/c1/6849574/Test.java rename to hotspot/test/compiler/c1/Test6849574.java index 7639d0316f2..70d1a294e89 100644 --- a/hotspot/test/compiler/c1/6849574/Test.java +++ b/hotspot/test/compiler/c1/Test6849574.java @@ -27,12 +27,15 @@ * @bug 6849574 * @summary VM crash using NonBlockingHashMap (high_scale_lib) * - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+VerifyBeforeGC Test + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+VerifyBeforeGC + * compiler.c1.Test6849574 */ -import java.util.concurrent.atomic.*; +package compiler.c1; -public class Test extends Thread { +import java.util.concurrent.atomic.AtomicReferenceArray; + +public class Test6849574 extends Thread { public static void main(String[] args) { AtomicReferenceArray a = new AtomicReferenceArray(10000); diff --git a/hotspot/test/compiler/c1/6855215/Test6855215.java b/hotspot/test/compiler/c1/Test6855215.java similarity index 95% rename from hotspot/test/compiler/c1/6855215/Test6855215.java rename to hotspot/test/compiler/c1/Test6855215.java index 914ec129d16..3ea0ad53853 100644 --- a/hotspot/test/compiler/c1/6855215/Test6855215.java +++ b/hotspot/test/compiler/c1/Test6855215.java @@ -27,9 +27,11 @@ * @bug 6855215 * @summary Calculation error (NaN) after about 1500 calculations * - * @run main/othervm -Xbatch -XX:UseSSE=0 Test6855215 + * @run main/othervm -Xbatch -XX:UseSSE=0 compiler.c1.Test6855215 */ +package compiler.c1; + public class Test6855215 { private double m; private double b; diff --git a/hotspot/test/compiler/c1/6932496/Test6932496.java b/hotspot/test/compiler/c1/Test6932496.java similarity index 97% rename from hotspot/test/compiler/c1/6932496/Test6932496.java rename to hotspot/test/compiler/c1/Test6932496.java index 3b75dd79599..2679c7ecac9 100644 --- a/hotspot/test/compiler/c1/6932496/Test6932496.java +++ b/hotspot/test/compiler/c1/Test6932496.java @@ -27,19 +27,25 @@ * @bug 6932496 * @summary incorrect deopt of jsr subroutine on 64 bit c1 * @modules java.base/jdk.internal.org.objectweb.asm - * @run main/othervm -Xcomp -XX:CompileOnly=Test.test Test6932496 + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c1.Test6932496::test + * compiler.c1.Test6932496 */ + +package compiler.c1; + +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.FieldVisitor; +import jdk.internal.org.objectweb.asm.Label; +import jdk.internal.org.objectweb.asm.MethodVisitor; +import jdk.internal.org.objectweb.asm.Opcodes; +import jdk.internal.org.objectweb.asm.Type; + +import java.io.IOException; import java.lang.reflect.Method; import java.nio.file.Files; import java.nio.file.Paths; -import java.io.IOException; - -import jdk.internal.org.objectweb.asm.ClassWriter; -import jdk.internal.org.objectweb.asm.MethodVisitor; -import jdk.internal.org.objectweb.asm.FieldVisitor; -import jdk.internal.org.objectweb.asm.Opcodes; -import jdk.internal.org.objectweb.asm.Type; -import jdk.internal.org.objectweb.asm.Label; public class Test6932496 extends ClassLoader { private static final int CLASS_FILE_VERSION = 49; diff --git a/hotspot/test/compiler/c1/7042153/Test7042153.java b/hotspot/test/compiler/c1/Test7042153.java similarity index 79% rename from hotspot/test/compiler/c1/7042153/Test7042153.java rename to hotspot/test/compiler/c1/Test7042153.java index 4319b3b2036..c743920662c 100644 --- a/hotspot/test/compiler/c1/7042153/Test7042153.java +++ b/hotspot/test/compiler/c1/Test7042153.java @@ -27,19 +27,19 @@ * @bug 7042153 * @summary Bad folding of IfOps with unloaded constant arguments in C1 * - * @run main/othervm -Xcomp Test7042153 + * @run main/othervm -Xcomp compiler.c1.Test7042153 */ -import java.lang.reflect.*; +package compiler.c1; public class Test7042153 { - static public class Bar { } - static public class Foo { } + static public class Bar { } + static public class Foo { } - static volatile boolean z; - public static void main(String [] args) { - Class cx = Bar.class; - Class cy = Foo.class; - z = (cx == cy); - } + static volatile boolean z; + public static void main(String [] args) { + Class cx = Bar.class; + Class cy = Foo.class; + z = (cx == cy); + } } diff --git a/hotspot/test/compiler/c1/7090976/Test7090976.java b/hotspot/test/compiler/c1/Test7090976.java similarity index 96% rename from hotspot/test/compiler/c1/7090976/Test7090976.java rename to hotspot/test/compiler/c1/Test7090976.java index 84ff20a5dac..8f7764196b8 100644 --- a/hotspot/test/compiler/c1/7090976/Test7090976.java +++ b/hotspot/test/compiler/c1/Test7090976.java @@ -27,9 +27,12 @@ * @bug 7090976 * @summary Eclipse/CDT causes a JVM crash while indexing C++ code * - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement Test7090976 + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.c1.Test7090976 */ +package compiler.c1; + public class Test7090976 { static interface I1 { diff --git a/hotspot/test/compiler/c1/7103261/Test7103261.java b/hotspot/test/compiler/c1/Test7103261.java similarity index 98% rename from hotspot/test/compiler/c1/7103261/Test7103261.java rename to hotspot/test/compiler/c1/Test7103261.java index afb3064ff68..a5d7eca0da0 100644 --- a/hotspot/test/compiler/c1/7103261/Test7103261.java +++ b/hotspot/test/compiler/c1/Test7103261.java @@ -27,9 +27,11 @@ * @bug 7103261 * @summary crash with jittester on sparc * - * @run main Test7103261 + * @run main compiler.c1.Test7103261 */ +package compiler.c1; + // exercise implicit null checking in the compiler for various field types public class Test7103261 { static Test7103261 null_value; diff --git a/hotspot/test/compiler/c1/7123108/Test7123108.java b/hotspot/test/compiler/c1/Test7123108.java similarity index 96% rename from hotspot/test/compiler/c1/7123108/Test7123108.java rename to hotspot/test/compiler/c1/Test7123108.java index 66d3a01db09..908f0abb45f 100644 --- a/hotspot/test/compiler/c1/7123108/Test7123108.java +++ b/hotspot/test/compiler/c1/Test7123108.java @@ -27,9 +27,11 @@ * @bug 7123108 * @summary C1 crashes with assert(if_state != NULL) failed: states do not match up * - * @run main/othervm -Xcomp Test7123108 + * @run main/othervm -Xcomp compiler.c1.Test7123108 */ +package compiler.c1; + public class Test7123108 { static class Test_Class_0 { diff --git a/hotspot/test/compiler/c1/8004051/Test8004051.java b/hotspot/test/compiler/c1/Test8004051.java similarity index 96% rename from hotspot/test/compiler/c1/8004051/Test8004051.java rename to hotspot/test/compiler/c1/Test8004051.java index 981effb2089..73667f7776b 100644 --- a/hotspot/test/compiler/c1/8004051/Test8004051.java +++ b/hotspot/test/compiler/c1/Test8004051.java @@ -28,9 +28,11 @@ * @bug 8005722 * @summary assert(_oprs_len[mode] < maxNumberOfOperands) failed: array overflow * - * @run main/othervm -Xcomp Test8004051 + * @run main/othervm -Xcomp compiler.c1.Test8004051 */ +package compiler.c1; + public class Test8004051 { public static void main(String[] argv) { Object o = new Object(); diff --git a/hotspot/test/compiler/c1/8011706/Test8011706.java b/hotspot/test/compiler/c1/Test8011706.java similarity index 96% rename from hotspot/test/compiler/c1/8011706/Test8011706.java rename to hotspot/test/compiler/c1/Test8011706.java index 4c317370ba5..7703d321fb3 100644 --- a/hotspot/test/compiler/c1/8011706/Test8011706.java +++ b/hotspot/test/compiler/c1/Test8011706.java @@ -25,10 +25,13 @@ * @test * @bug 8011706 * @summary loop invariant code motion may move load before store to the same field - * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation Test8011706 * + * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation + * compiler.c1.Test8011706 */ +package compiler.c1; + public class Test8011706 { int[] array; diff --git a/hotspot/test/compiler/c1/8011771/Test8011771.java b/hotspot/test/compiler/c1/Test8011771.java similarity index 96% rename from hotspot/test/compiler/c1/8011771/Test8011771.java rename to hotspot/test/compiler/c1/Test8011771.java index 7827150cb24..25e724f3d4c 100644 --- a/hotspot/test/compiler/c1/8011771/Test8011771.java +++ b/hotspot/test/compiler/c1/Test8011771.java @@ -25,10 +25,12 @@ * @test * @bug 8011771 * @summary Array bound check elimination's in block motion doesn't always reset its data structures from one step to the other. - * @run main/othervm -XX:-BackgroundCompilation Test8011771 * + * @run main/othervm -XX:-BackgroundCompilation compiler.c1.Test8011771 */ +package compiler.c1; + public class Test8011771 { static void m(int[] a, int[] b, int j) { diff --git a/hotspot/test/compiler/c1/6769124/TestArrayCopy6769124.java b/hotspot/test/compiler/c1/TestArrayCopy.java similarity index 94% rename from hotspot/test/compiler/c1/6769124/TestArrayCopy6769124.java rename to hotspot/test/compiler/c1/TestArrayCopy.java index 61868e7b652..01ffd0ab221 100644 --- a/hotspot/test/compiler/c1/6769124/TestArrayCopy6769124.java +++ b/hotspot/test/compiler/c1/TestArrayCopy.java @@ -26,9 +26,13 @@ * @test * @bug 6769124 * @summary arraycopy may crash the VM with c1 on 64 bit + * + * @run main compiler.c1.TestArrayCopy */ -public class TestArrayCopy6769124 { +package compiler.c1; + +public class TestArrayCopy { public static void main(String[] args) { diff --git a/hotspot/test/compiler/c1/6769124/TestDeoptInt6769124.java b/hotspot/test/compiler/c1/TestDeoptInt.java similarity index 90% rename from hotspot/test/compiler/c1/6769124/TestDeoptInt6769124.java rename to hotspot/test/compiler/c1/TestDeoptInt.java index f6ecdb62a7c..75d0d2bfc9f 100644 --- a/hotspot/test/compiler/c1/6769124/TestDeoptInt6769124.java +++ b/hotspot/test/compiler/c1/TestDeoptInt.java @@ -27,10 +27,14 @@ * @bug 6769124 * @summary int value might not be correctly decoded on deopt with c1 on 64 bit * - * @run main/othervm -Xcomp -XX:CompileOnly=TestDeoptInt6769124.m TestDeoptInt6769124 + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c1.TestDeoptInt::m + * compiler.c1.TestDeoptInt */ -public class TestDeoptInt6769124 { +package compiler.c1; + +public class TestDeoptInt { static class A { volatile int vl; diff --git a/hotspot/test/compiler/c1/6769124/TestUnalignedLoad6769124.java b/hotspot/test/compiler/c1/TestUnalignedLoad.java similarity index 95% rename from hotspot/test/compiler/c1/6769124/TestUnalignedLoad6769124.java rename to hotspot/test/compiler/c1/TestUnalignedLoad.java index 11c40cf8495..114949386a3 100644 --- a/hotspot/test/compiler/c1/6769124/TestUnalignedLoad6769124.java +++ b/hotspot/test/compiler/c1/TestUnalignedLoad.java @@ -26,9 +26,13 @@ * @test * @bug 6769124 * @summary unaligned load may fail with c1 on 64 bit + * + * @run main compiler.c1.TestUnalignedLoad */ -public class TestUnalignedLoad6769124 { +package compiler.c1; + +public class TestUnalignedLoad { static long l1v = 0x200000003L; static long l2v = 0x400000005L; diff --git a/hotspot/test/compiler/c2/5091921/Test6905845.java b/hotspot/test/compiler/c2/5091921/Test6905845.java deleted file mode 100644 index 1cb2f7451cc..00000000000 --- a/hotspot/test/compiler/c2/5091921/Test6905845.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2011, 2013, 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 6905845 - * @summary Server VM improperly optimizing away loop. - * - * @run main/timeout=480 Test6905845 - */ - -public class Test6905845 { - - public static void main(String[] args){ - for (int asdf = 0; asdf < 5; asdf++){ - //test block - { - StringBuilder strBuf1 = new StringBuilder(65); - long start = System.currentTimeMillis(); - int count = 0; - - for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79){ - strBuf1.append(i); - count++; - strBuf1.delete(0, 65); - } - - System.out.println(count); - if (count != 54366674) { - System.out.println("wrong count: " + count +", should be 54366674"); - System.exit(97); - } - } - //test block - { - StringBuilder strBuf1 = new StringBuilder(65); - long start = System.currentTimeMillis(); - int count = 0; - - for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79){ - strBuf1.append(i); - count++; - strBuf1.delete(0, 65); - } - - System.out.println(count); - if (count != 54366674) { - System.out.println("wrong count: " + count +", should be 54366674"); - System.exit(97); - } - } - } - } -} - diff --git a/hotspot/test/compiler/c2/6823453/Test.java b/hotspot/test/compiler/c2/6823453/Test.java deleted file mode 100644 index 46f3c4cc2bd..00000000000 --- a/hotspot/test/compiler/c2/6823453/Test.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2009, 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 6823453 - * @summary DeoptimizeALot causes fastdebug server jvm to fail with assert(false,"unscheduable graph") - * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:CompileOnly=Test -XX:+DeoptimizeALot Test - */ - -public class Test { - - static long vara_1 = 1L; - - static void testa() { - short var_2 = (byte) 1.0E10; - - for ( Object temp = new byte[(byte)1.0E10]; true ; - var_2 = "1".equals("0") ? ((byte) vara_1) : 1 ) {} - } - - static void testb() { - long var_1 = -1L; - - short var_2 = (byte) 1.0E10; - - for ( Object temp = new byte[(byte)1.0E10]; true ; - var_2 = "1".equals("0") ? ((byte) var_1) : 1 ) {} - } - - static void testc() { - long var_1 = -1L; - if (vara_1 > 0) var_1 = 1L; - - int var_2 = (byte)var_1 - 128; - - for ( Object temp = new byte[var_2]; true ; - var_2 = "1".equals("0") ? 2 : 1 ) {} - } - - static void testd() { - long var_1 = 0L; - - int var_2 = (byte)var_1 + 1; - for (int i=0; i<2 ; i++) var_2 = var_2 - 1; - - for ( Object temp = new byte[var_2]; true ; - var_2 = "1".equals("0") ? 2 : 1 ) {} - } - - public static void main(String[] args) throws Exception { - int nex = 0; - - try { - testa(); - } - catch (java.lang.NegativeArraySizeException ex) { nex++; } - try { - testb(); - } - catch (java.lang.NegativeArraySizeException ex) { nex++; } - try { - testc(); - } - catch (java.lang.NegativeArraySizeException ex) { nex++; } - try { - testd(); - } - catch (java.lang.NegativeArraySizeException ex) { nex++; } - - if (nex != 4) - System.exit(97); - } -} - diff --git a/hotspot/test/compiler/c2/7190310/Test7190310.java b/hotspot/test/compiler/c2/7190310/Test7190310.java deleted file mode 100644 index b45c60bf196..00000000000 --- a/hotspot/test/compiler/c2/7190310/Test7190310.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2012, 2013, 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 7190310 - * @summary Inlining WeakReference.get(), and hoisting $referent may lead to non-terminating loops - * @run main/othervm/timeout=600 -Xbatch Test7190310 - */ - -/* - * Note bug exhibits as infinite loop, timeout is helpful. - * It should normally finish pretty quickly, but on some especially slow machines - * it may not. The companion _unsafe test lacks a timeout, but that is okay. - */ - -import java.lang.ref.*; - -public class Test7190310 { - private static Object str = new Object() { - public String toString() { - return "The Object"; - } - - protected void finalize() throws Throwable { - System.out.println("The Object is being finalized"); - super.finalize(); - } - }; - private final static ReferenceQueue rq = - new ReferenceQueue(); - private final static WeakReference wr = - new WeakReference(str, rq); - - public static void main(String[] args) - throws InterruptedException { - Thread reader = new Thread() { - public void run() { - while (wr.get() != null) { - } - System.out.println("wr.get() returned null"); - } - }; - - Thread queueReader = new Thread() { - public void run() { - try { - Reference ref = rq.remove(); - System.out.println(ref); - System.out.println("queueReader returned, ref==wr is " - + (ref == wr)); - } catch (InterruptedException e) { - System.err.println("Sleep interrupted - exiting"); - } - } - }; - - reader.start(); - queueReader.start(); - - Thread.sleep(1000); - str = null; - System.gc(); - } -} - diff --git a/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java b/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java deleted file mode 100644 index de48a6e4627..00000000000 --- a/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2012, 2015, 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 7190310 - * @summary Inlining WeakReference.get(), and hoisting $referent may lead to non-terminating loops - * @modules java.base/jdk.internal.misc - * @run main/othervm -Xbatch Test7190310_unsafe - */ - -import java.lang.ref.*; -import java.lang.reflect.*; -import jdk.internal.misc.Unsafe; - -public class Test7190310_unsafe { - - static class TestObject { - public String toString() { - return "TestObject"; - } - }; - - private static TestObject str = new TestObject(); - private static final WeakReference ref = new WeakReference(str); - - private TestObject obj; - - public static void main(String[] args) throws Exception { - Class c = Test7190310_unsafe.class.getClassLoader().loadClass("jdk.internal.misc.Unsafe"); - Field f = c.getDeclaredField("theUnsafe"); - f.setAccessible(true); - Unsafe unsafe = (Unsafe)f.get(c); - - f = Reference.class.getDeclaredField("referent"); - f.setAccessible(true); - long referent_offset = unsafe.objectFieldOffset(f); - - Test7190310_unsafe t = new Test7190310_unsafe(); - TestObject o = new TestObject(); - t.obj = o; - - // Warmup (compile methods) - System.err.println("Warmup"); - Object obj = null; - for (int i = 0; i < 11000; i++) { - obj = getRef0(ref); - } - for (int i = 0; i < 11000; i++) { - obj = getRef1(unsafe, ref, referent_offset); - } - for (int i = 0; i < 11000; i++) { - obj = getRef2(unsafe, ref, referent_offset); - } - for (int i = 0; i < 11000; i++) { - obj = getRef3(unsafe, ref, referent_offset); - } - for (int i = 0; i < 11000; i++) { - obj = getRef4(unsafe, t, referent_offset); - } - - // Access verification - System.err.println("Verification"); - if (!verifyGet(referent_offset, unsafe)) { - System.exit(97); - } - - obj = getRef3(unsafe, t, referent_offset); - if (obj != o) { - System.out.println("FAILED: unsafe.getObject(Object, " + referent_offset + ") " + obj + " != " + o); - System.exit(97); - } - obj = getRef4(unsafe, t, referent_offset); - if (obj != o) { - System.out.println("FAILED: unsafe.getObject(Test7190310, " + referent_offset + ") " + obj + " != " + o); - System.exit(97); - } - } - - static boolean verifyGet(long referent_offset, Unsafe unsafe) throws Exception { - // Access verification - System.out.println("referent: " + str); - Object obj = getRef0(ref); - if (obj != str) { - System.out.println("FAILED: weakRef.get() " + obj + " != " + str); - return false; - } - obj = getRef1(unsafe, ref, referent_offset); - if (obj != str) { - System.out.println("FAILED: unsafe.getObject(weakRef, " + referent_offset + ") " + obj + " != " + str); - return false; - } - obj = getRef2(unsafe, ref, referent_offset); - if (obj != str) { - System.out.println("FAILED: unsafe.getObject(abstRef, " + referent_offset + ") " + obj + " != " + str); - return false; - } - obj = getRef3(unsafe, ref, referent_offset); - if (obj != str) { - System.out.println("FAILED: unsafe.getObject(Object, " + referent_offset + ") " + obj + " != " + str); - return false; - } - return true; - } - - static Object getRef0(WeakReference ref) throws Exception { - return ref.get(); - } - static Object getRef1(Unsafe unsafe, WeakReference ref, long referent_offset) throws Exception { - return unsafe.getObject(ref, referent_offset); - } - static Object getRef2(Unsafe unsafe, Reference ref, long referent_offset) throws Exception { - return unsafe.getObject(ref, referent_offset); - } - static Object getRef3(Unsafe unsafe, Object ref, long referent_offset) throws Exception { - return unsafe.getObject(ref, referent_offset); - } - static Object getRef4(Unsafe unsafe, Test7190310_unsafe ref, long referent_offset) throws Exception { - return unsafe.getObject(ref, referent_offset); - } -} - diff --git a/hotspot/test/compiler/c2/8002069/Test8002069.java b/hotspot/test/compiler/c2/8002069/Test8002069.java deleted file mode 100644 index 9d11c25564d..00000000000 --- a/hotspot/test/compiler/c2/8002069/Test8002069.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2012, 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 8002069 - * @summary Assert failed in C2: assert(field->edge_count() > 0) failed: sanity - * - * @run main/othervm -Xmx32m -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:CompileCommand=exclude,Test8002069.dummy Test8002069 - */ - -abstract class O { - int f; - public O() { f = 5; } - abstract void put(int i); - public int foo(int i) { - put(i); - return i; - } -}; - -class A extends O { - int[] a; - public A(int s) { - a = new int[s]; - } - public void put(int i) { - a[i%a.length] = i; - } -} - -class B extends O { - int sz; - int[] a; - public B(int s) { - sz = s; - a = new int[s]; - } - public void put(int i) { - a[i%sz] = i; - } -} - -public class Test8002069 { - public static void main(String args[]) { - int sum = 0; - for (int i=0; i<8000; i++) { - sum += test1(i); - } - for (int i=0; i<100000; i++) { - sum += test2(i); - } - System.out.println("PASSED. sum = " + sum); - } - - private O o; - - private int foo(int i) { - return o.foo(i); - } - static int test1(int i) { - Test8002069 t = new Test8002069(); - t.o = new A(5); - return t.foo(i); - } - static int test2(int i) { - Test8002069 t = new Test8002069(); - t.o = new B(5); - dummy(i); - return t.foo(i); - } - - static int dummy(int i) { - return i*2; - } -} - diff --git a/hotspot/test/compiler/c2/FloatingPointFoldingTest.java b/hotspot/test/compiler/c2/FloatingPointFoldingTest.java index cb3ce01c96b..78431c2a82c 100644 --- a/hotspot/test/compiler/c2/FloatingPointFoldingTest.java +++ b/hotspot/test/compiler/c2/FloatingPointFoldingTest.java @@ -26,9 +26,19 @@ * @test * @bug 8073670 * @summary Test that causes C2 to fold two NaNs with different values into a single NaN. - * @run main/othervm -XX:-TieredCompilation -Xcomp -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_inf -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_zero -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_nan -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_inf -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_zero -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_nan FloatingPointFoldingTest + * + * @run main/othervm -XX:-TieredCompilation -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_double_inf + * -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_double_zero + * -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_double_nan + * -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_float_inf + * -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_float_zero + * -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_float_nan + * compiler.c2.FloatingPointFoldingTest */ +package compiler.c2; + public class FloatingPointFoldingTest { // Double values. public static final long MINUS_INF_LONGBITS = 0xfff0000000000000L; diff --git a/hotspot/test/compiler/c2/6663621/IVTest.java b/hotspot/test/compiler/c2/IVTest.java similarity index 98% rename from hotspot/test/compiler/c2/6663621/IVTest.java rename to hotspot/test/compiler/c2/IVTest.java index 0ef480b119e..b6239d0da9a 100644 --- a/hotspot/test/compiler/c2/6663621/IVTest.java +++ b/hotspot/test/compiler/c2/IVTest.java @@ -26,8 +26,12 @@ * @test * @bug 6663621 * @summary JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests. + * + * @run main compiler.c2.IVTest */ +package compiler.c2; + public class IVTest { static int paddedSize; diff --git a/hotspot/test/compiler/c2/6772683/InterruptedTest.java b/hotspot/test/compiler/c2/InterruptedTest.java similarity index 97% rename from hotspot/test/compiler/c2/6772683/InterruptedTest.java rename to hotspot/test/compiler/c2/InterruptedTest.java index aa513fa02aa..b4caace938d 100644 --- a/hotspot/test/compiler/c2/6772683/InterruptedTest.java +++ b/hotspot/test/compiler/c2/InterruptedTest.java @@ -26,9 +26,12 @@ * @test * @bug 6772683 * @summary Thread.isInterrupted() fails to return true on multiprocessor PC - * @run main/othervm InterruptedTest 100 + * + * @run main/othervm compiler.c2.InterruptedTest 100 */ +package compiler.c2; + public class InterruptedTest { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/compiler/c2/6894807/IsInstanceTest.java b/hotspot/test/compiler/c2/IsInstanceTest.java similarity index 96% rename from hotspot/test/compiler/c2/6894807/IsInstanceTest.java rename to hotspot/test/compiler/c2/IsInstanceTest.java index 6350109404c..75ee459267c 100644 --- a/hotspot/test/compiler/c2/6894807/IsInstanceTest.java +++ b/hotspot/test/compiler/c2/IsInstanceTest.java @@ -25,9 +25,12 @@ * @test * @bug 6894807 * @summary No ClassCastException for HashAttributeSet constructors if run with -Xcomp - * @run main IsInstanceTest + * + * @run main compiler.c2.IsInstanceTest */ +package compiler.c2; + public class IsInstanceTest { public static void main(String[] args) { diff --git a/hotspot/test/compiler/c2/8005956/PolynomialRoot.java b/hotspot/test/compiler/c2/PolynomialRoot.java similarity index 98% rename from hotspot/test/compiler/c2/8005956/PolynomialRoot.java rename to hotspot/test/compiler/c2/PolynomialRoot.java index ae59572fb89..86836d0b93b 100644 --- a/hotspot/test/compiler/c2/8005956/PolynomialRoot.java +++ b/hotspot/test/compiler/c2/PolynomialRoot.java @@ -10,16 +10,20 @@ */ /** -* @test -* @bug 8005956 -* @summary C2: assert(!def_outside->member(r)) failed: Use of external LRG overlaps the same LRG defined in this block -* @library /testlibrary -* @modules java.base/jdk.internal.misc -* java.management -* @run main/timeout=300 PolynomialRoot -*/ + * @test + * @bug 8005956 + * @summary C2: assert(!def_outside->member(r)) failed: Use of external LRG overlaps the same LRG defined in this block + * @library /testlibrary + * @modules java.base/jdk.internal.misc + * java.management + * + * @run main/timeout=300 compiler.c2.PolynomialRoot + */ + +package compiler.c2; import jdk.test.lib.Utils; + import java.util.Arrays; import java.util.Random; diff --git a/hotspot/test/compiler/c2/5057225/Test5057225.java b/hotspot/test/compiler/c2/Test5057225.java similarity index 91% rename from hotspot/test/compiler/c2/5057225/Test5057225.java rename to hotspot/test/compiler/c2/Test5057225.java index 7cf64f90005..632f678d85f 100644 --- a/hotspot/test/compiler/c2/5057225/Test5057225.java +++ b/hotspot/test/compiler/c2/Test5057225.java @@ -27,9 +27,13 @@ * @summary Remove useless I2L conversions * @modules java.base/jdk.internal.misc * @library /testlibrary - * @run main/othervm -Xcomp -XX:CompileOnly=Test5057225.doload Test5057225 + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.Test5057225::doload + * compiler.c2.Test5057225 */ +package compiler.c2; import jdk.test.lib.Utils; public class Test5057225 { @@ -69,17 +73,17 @@ public class Test5057225 { public static void main(String[] args) throws Exception { for (int i = 0; i < BYTE_MASKS.length; i++) { System.setProperty("value", "" + BYTE_MASKS[i]); - loadAndRunClass("Test5057225$loadUB2L"); + loadAndRunClass(Test5057225.class.getName() + "$loadUB2L"); } for (int i = 0; i < SHORT_MASKS.length; i++) { System.setProperty("value", "" + SHORT_MASKS[i]); - loadAndRunClass("Test5057225$loadUS2L"); + loadAndRunClass(Test5057225.class.getName() + "$loadUS2L"); } for (int i = 0; i < INT_MASKS.length; i++) { System.setProperty("value", "" + INT_MASKS[i]); - loadAndRunClass("Test5057225$loadUI2L"); + loadAndRunClass(Test5057225.class.getName() + "$loadUI2L"); } } diff --git a/hotspot/test/compiler/c2/5091921/Test5091921.java b/hotspot/test/compiler/c2/Test5091921.java similarity index 97% rename from hotspot/test/compiler/c2/5091921/Test5091921.java rename to hotspot/test/compiler/c2/Test5091921.java index dff43e75033..07fa59d11bd 100644 --- a/hotspot/test/compiler/c2/5091921/Test5091921.java +++ b/hotspot/test/compiler/c2/Test5091921.java @@ -27,9 +27,13 @@ * @bug 5091921 * @summary Sign flip issues in loop optimizer * - * @run main/othervm -Xcomp -XX:CompileOnly=Test5091921 -XX:MaxInlineSize=1 Test5091921 + * @run main/othervm -Xcomp -XX:MaxInlineSize=1 + * -XX:CompileCommand=compileonly,compiler.c2.Test5091921::* + * compiler.c2.Test5091921 */ +package compiler.c2; + public class Test5091921 { private static int result = 0; diff --git a/hotspot/test/compiler/c2/5091921/Test6186134.java b/hotspot/test/compiler/c2/Test6186134.java similarity index 57% rename from hotspot/test/compiler/c2/5091921/Test6186134.java rename to hotspot/test/compiler/c2/Test6186134.java index d5f57d155fd..bf00dc89659 100644 --- a/hotspot/test/compiler/c2/5091921/Test6186134.java +++ b/hotspot/test/compiler/c2/Test6186134.java @@ -27,45 +27,48 @@ * @bug 6186134 * @summary Server virtual machine produces/exeutes incorrect code. * - * @run main Test6186134 100000 + * @run main compiler.c2.Test6186134 100000 */ + +package compiler.c2; + import java.util.ArrayList; public class Test6186134 { - int num = 0; + int num = 0; - public Test6186134(int n) { - num = n; - } - - public boolean more() { - return num-- > 0; - } - - public ArrayList test1() { - ArrayList res = new ArrayList(); - int maxResults = Integer.MAX_VALUE; - int n = 0; - boolean more = more(); - while ((n++ < maxResults) && more) { - res.add(new Object()); - more = more(); + public Test6186134(int n) { + num = n; } - return res; - } - public static void main(String[] pars) { - int n = Integer.parseInt(pars[0]); - for (int i=0; i 0; + } + + public ArrayList test1() { + ArrayList res = new ArrayList(); + int maxResults = Integer.MAX_VALUE; + int n = 0; + boolean more = more(); + while ((n++ < maxResults) && more) { + res.add(new Object()); + more = more(); + } + return res; + } + + public static void main(String[] pars) { + int n = Integer.parseInt(pars[0]); + for (int i = 0; i < n; i++) { + Test6186134 t = new Test6186134(10); + int size = t.test1().size(); + if (size != 10) { + System.out.println("wrong size: " + size + ", should be 10"); + System.exit(97); + } + } + System.out.println("Passed"); } - System.out.println("Passed"); - } } diff --git a/hotspot/test/compiler/c2/5091921/Test6196102.java b/hotspot/test/compiler/c2/Test6196102.java similarity index 96% rename from hotspot/test/compiler/c2/5091921/Test6196102.java rename to hotspot/test/compiler/c2/Test6196102.java index 004a68bb25a..aec261620cc 100644 --- a/hotspot/test/compiler/c2/5091921/Test6196102.java +++ b/hotspot/test/compiler/c2/Test6196102.java @@ -27,9 +27,11 @@ * @bug 6196102 * @summary Integer seems to be greater than Integer.MAX_VALUE * - * @run main Test6196102 + * @run main compiler.c2.Test6196102 */ +package compiler.c2; + public class Test6196102 { static public void main(String[] args) { int i1 = 0; diff --git a/hotspot/test/compiler/c2/5091921/Test6357214.java b/hotspot/test/compiler/c2/Test6357214.java similarity index 85% rename from hotspot/test/compiler/c2/5091921/Test6357214.java rename to hotspot/test/compiler/c2/Test6357214.java index 019364d8d0f..e9ed37c6db6 100644 --- a/hotspot/test/compiler/c2/5091921/Test6357214.java +++ b/hotspot/test/compiler/c2/Test6357214.java @@ -27,46 +27,48 @@ * @bug 6357214 * @summary Hotspot server compiler gets integer comparison wrong * - * @run main/othervm/timeout=60 -DshowAll=ffo -DeventID=444 Test6357214 + * @run main/othervm/timeout=60 -DshowAll=ffo -DeventID=444 compiler.c2.Test6357214 */ +package compiler.c2; + // The test hangs after few iterations before the fix. So it fails if timeout. -class MyResult { +public class Test6357214 { + static class MyResult { public boolean next() { - return true; + return true; } public String getString(String in) { - if (in.equals("id")) - return "idFoo"; - if (in.equals("contentKey")) - return "ckFoo"; - return "Foo"; + if (in.equals("id")) + return "idFoo"; + if (in.equals("contentKey")) + return "ckFoo"; + return "Foo"; } public int getInt(String in) { - if (in.equals("processingComplete")) - return 0; - return 1; + if (in.equals("processingComplete")) + return 0; + return 1; } public byte[] getBytes(String in) { - byte[] arr = null; - if (in.equals("content")) { - arr = new byte[65536]; - byte j = 32; - for (int i=0; i<65536; i++) { - arr[i] = j; - if (++j == 127) - j=32; - } + byte[] arr = null; + if (in.equals("content")) { + arr = new byte[65536]; + byte j = 32; + for (int i=0; i<65536; i++) { + arr[i] = j; + if (++j == 127) + j=32; } - return arr; + } + return arr; } -} + } -public class Test6357214 { - public static volatile boolean bollocks = true; + public static volatile boolean bollocks = true; public String create(String context) throws Exception { // diff --git a/hotspot/test/compiler/c2/6443505/Test6443505.java b/hotspot/test/compiler/c2/Test6443505.java similarity index 95% rename from hotspot/test/compiler/c2/6443505/Test6443505.java rename to hotspot/test/compiler/c2/Test6443505.java index 28461b5f7dc..d86cc7581d9 100644 --- a/hotspot/test/compiler/c2/6443505/Test6443505.java +++ b/hotspot/test/compiler/c2/Test6443505.java @@ -27,9 +27,13 @@ * @bug 6443505 * @summary Some cases for CmpLTMask missed; also wrong code. * - * @run main/othervm -Xcomp -XX:CompileOnly="Test6443505.compiled" Test6443505 + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.Test6443505::compiled + * compiler.c2.Test6443505 */ +package compiler.c2; + public class Test6443505 { public static void main(String[] args) throws InterruptedException { diff --git a/hotspot/test/compiler/c2/5091921/Test6559156.java b/hotspot/test/compiler/c2/Test6559156.java similarity index 97% rename from hotspot/test/compiler/c2/5091921/Test6559156.java rename to hotspot/test/compiler/c2/Test6559156.java index 76553239a3d..fafe58697ff 100644 --- a/hotspot/test/compiler/c2/5091921/Test6559156.java +++ b/hotspot/test/compiler/c2/Test6559156.java @@ -27,9 +27,11 @@ * @bug 6559156 * @summary Server compiler generates bad code for "<= Integer.MAX_VALUE" expression * - * @run main Test6559156 + * @run main compiler.c2.Test6559156 */ +package compiler.c2; + public class Test6559156 { static final int N_TESTS = 1000000; diff --git a/hotspot/test/compiler/c2/6603011/Test.java b/hotspot/test/compiler/c2/Test6603011.java similarity index 92% rename from hotspot/test/compiler/c2/6603011/Test.java rename to hotspot/test/compiler/c2/Test6603011.java index 39c041935c6..9495fe3a054 100644 --- a/hotspot/test/compiler/c2/6603011/Test.java +++ b/hotspot/test/compiler/c2/Test6603011.java @@ -27,7 +27,8 @@ * @summary long/int division by constant * @modules java.base/jdk.internal.misc * @library /testlibrary - * @run main/othervm -Xcomp -Xbatch -XX:-Inline Test + * + * @run main/othervm -Xcomp -Xbatch -XX:-Inline compiler.c2.Test6603011 */ // @@ -37,16 +38,17 @@ // dividend and divisor combinations are tested // +package compiler.c2; + import jdk.test.lib.Utils; -class s { - static int divi(int dividend, int divisor) { return dividend / divisor; } - static int modi(int dividend, int divisor) { return dividend % divisor; } - static long divl(long dividend, long divisor) { return dividend / divisor; } - static long modl(long dividend, long divisor) { return dividend % divisor; } -} - -public class Test implements Runnable { +public class Test6603011 implements Runnable { + static class s { + static int divi(int dividend, int divisor) { return dividend / divisor; } + static int modi(int dividend, int divisor) { return dividend % divisor; } + static long divl(long dividend, long divisor) { return dividend / divisor; } + static long modl(long dividend, long divisor) { return dividend % divisor; } + } // Report verbose messages on failure; turn off to suppress // too much output with gross numbers of failures. static final boolean VERBOSE = true; @@ -194,13 +196,13 @@ public class Test implements Runnable { System.setProperty("divisor", "" + divisor); ClassLoader loader = Utils.getTestClassPathURLClassLoader(apploader.getParent()); - Class c = loader.loadClass("Test"); + Class c = loader.loadClass(Test6603011.class.getName()); Runnable r = (Runnable)c.newInstance(); r.run(); } public static void main(String[] args) throws Exception { - Class cl = Class.forName("Test"); + Class cl = Test6603011.class; ClassLoader apploader = cl.getClassLoader(); diff --git a/hotspot/test/compiler/c2/6636138/Test1.java b/hotspot/test/compiler/c2/Test6636138_1.java similarity index 92% rename from hotspot/test/compiler/c2/6636138/Test1.java rename to hotspot/test/compiler/c2/Test6636138_1.java index d57582fb3fc..1ae3a45b841 100644 --- a/hotspot/test/compiler/c2/6636138/Test1.java +++ b/hotspot/test/compiler/c2/Test6636138_1.java @@ -26,10 +26,14 @@ * @bug 6636138 * @summary SuperWord::co_locate_pack(Node_List* p) generates memory graph that leads to memory order violation. * - * @run main/othervm -Xbatch -XX:CompileOnly=Test1.init Test1 + * @run main/othervm -Xbatch + * -XX:CompileCommand=compileonly,compiler.c2.Test6636138_1::init + * compiler.c2.Test6636138_1 */ -public class Test1 { +package compiler.c2; + +public class Test6636138_1 { public static void init(int src[], int [] dst, int[] ref) { // initialize the arrays diff --git a/hotspot/test/compiler/c2/6636138/Test2.java b/hotspot/test/compiler/c2/Test6636138_2.java similarity index 67% rename from hotspot/test/compiler/c2/6636138/Test2.java rename to hotspot/test/compiler/c2/Test6636138_2.java index 29e5546cf5f..bb2759a9827 100644 --- a/hotspot/test/compiler/c2/6636138/Test2.java +++ b/hotspot/test/compiler/c2/Test6636138_2.java @@ -26,10 +26,14 @@ * @bug 6636138 * @summary SuperWord::co_locate_pack(Node_List* p) generates memory graph that leads to memory order violation. * - * @run main/othervm -Xbatch -XX:CompileOnly=Test2.shift Test2 + * @run main/othervm -Xbatch + * -XX:CompileCommand=compileonly,compiler.c2.Test6636138_2::shift + * compiler.c2.Test6636138_2 */ -public class Test2 { +package compiler.c2; + +public class Test6636138_2 { public static void init(int src[]) { // Initialize the array @@ -37,22 +41,22 @@ public class Test2 { src[i] = i; } - public static void shift(int src[]) { - //left-shift the array - for (int i = src.length-1; i > 0; i--){ - int tmp = src[i]; - src[i] = src[i-1]; - src[i-1] = tmp; - } + public static void shift(int src[]) { + //left-shift the array + for (int i = src.length - 1; i > 0; i--) { + int tmp = src[i]; + src[i] = src[i - 1]; + src[i - 1] = tmp; + } } public static void verify(int src[]) { - for (int i = 0; i < src.length; i++){ - int value = (i-1 + src.length)%src.length; // correct value after shifting - if (src[i] != value) { - System.out.println("Error: src["+i+"] should be "+ value + " instead of " + src[i]); - System.exit(97); - } + for (int i = 0; i < src.length; i++) { + int value = (i - 1 + src.length) % src.length; // correct value after shifting + if (src[i] != value) { + System.out.println("Error: src[" + i + "] should be " + value + " instead of " + src[i]); + System.exit(97); + } } } @@ -64,7 +68,7 @@ public class Test2 { } public static void main(String[] args) { - for (int i=0; i< 2000; i++) + for (int i = 0; i < 2000; i++) test(); } -} +} \ No newline at end of file diff --git a/hotspot/test/compiler/c2/6646019/Test.java b/hotspot/test/compiler/c2/Test6646019.java similarity index 65% rename from hotspot/test/compiler/c2/6646019/Test.java rename to hotspot/test/compiler/c2/Test6646019.java index 102280c1bc5..2e2060ded33 100644 --- a/hotspot/test/compiler/c2/6646019/Test.java +++ b/hotspot/test/compiler/c2/Test6646019.java @@ -25,27 +25,32 @@ * @test * @bug 6646019 * @summary array subscript expressions become top() with -d64 - * @run main/othervm -Xcomp -XX:CompileOnly=Test.test Test + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.Test6646019::test + * compiler.c2.Test6646019 */ +package compiler.c2; -public class Test { - final static int i = 2076285318; - long l = 2; - short s; +public class Test6646019 { + final static int i = 2076285318; + long l = 2; + short s; - public static void main(String[] args) { - Test t = new Test(); - try { t.test(); } - catch (Throwable e) { - if (t.l != 5) { - System.out.println("Fails: " + t.l + " != 5"); - } + public static void main(String[] args) { + Test6646019 t = new Test6646019(); + try { + t.test(); + } catch (Throwable e) { + if (t.l != 5) { + System.out.println("Fails: " + t.l + " != 5"); + } + } } - } - private void test() { - l = 5; - l = (new short[(byte)-2])[(byte)(l = i)]; - } + private void test() { + l = 5; + l = (new short[(byte) -2])[(byte) (l = i)]; + } } diff --git a/hotspot/test/compiler/c2/6661247/Test.java b/hotspot/test/compiler/c2/Test6661247.java similarity index 98% rename from hotspot/test/compiler/c2/6661247/Test.java rename to hotspot/test/compiler/c2/Test6661247.java index 12f1c2cfe64..5175e385214 100644 --- a/hotspot/test/compiler/c2/6661247/Test.java +++ b/hotspot/test/compiler/c2/Test6661247.java @@ -26,16 +26,20 @@ * @test * @bug 6661247 * @summary Internal bug in 32-bit HotSpot optimizer while bit manipulations + * + * @run main compiler.c2.Test6661247 */ +package compiler.c2; + +import java.nio.LongBuffer; import java.util.Random; -import java.nio.*; // This isn't a completely reliable test for 6661247 since the results // depend on what the local schedule looks like but it does reproduce // the issue in current builds. -public class Test { +public class Test6661247 { public static void test(boolean[] src, int srcPos, LongBuffer dest, long destPos, int count) { int countStart = (destPos & 63) == 0 ? 0 : 64 - (int)(destPos & 63); diff --git a/hotspot/test/compiler/c2/6695810/Test.java b/hotspot/test/compiler/c2/Test6695810.java similarity index 87% rename from hotspot/test/compiler/c2/6695810/Test.java rename to hotspot/test/compiler/c2/Test6695810.java index 7751a5ebd37..a454d6c696e 100644 --- a/hotspot/test/compiler/c2/6695810/Test.java +++ b/hotspot/test/compiler/c2/Test6695810.java @@ -25,13 +25,16 @@ * @test * @bug 6695810 * @summary null oop passed to encode_heap_oop_not_null - * @run main/othervm -Xbatch Test + * + * @run main/othervm -Xbatch compiler.c2.Test6695810 */ -public class Test { - Test _t; +package compiler.c2; - static void test(Test t1, Test t2) { +public class Test6695810 { + Test6695810 _t; + + static void test(Test6695810 t1, Test6695810 t2) { if (t2 != null) t1._t = t2; @@ -40,7 +43,7 @@ public class Test { } public static void main(String[] args) { - Test t = new Test(); + Test6695810 t = new Test6695810(); for (int i = 0; i < 50; i++) { for (int j = 0; j < 100; j++) { test(t, t); diff --git a/hotspot/test/compiler/c2/6700047/Test6700047.java b/hotspot/test/compiler/c2/Test6700047.java similarity index 96% rename from hotspot/test/compiler/c2/6700047/Test6700047.java rename to hotspot/test/compiler/c2/Test6700047.java index 789f693d752..120a9c8583b 100644 --- a/hotspot/test/compiler/c2/6700047/Test6700047.java +++ b/hotspot/test/compiler/c2/Test6700047.java @@ -25,9 +25,12 @@ * @test * @bug 6700047 * @summary C2 failed in idom_no_update - * @run main Test6700047 + * + * @run main compiler.c2.Test6700047 */ +package compiler.c2; + public class Test6700047 { static byte[] dummy = new byte[256]; diff --git a/hotspot/test/compiler/c2/6711100/Test.java b/hotspot/test/compiler/c2/Test6711100.java similarity index 85% rename from hotspot/test/compiler/c2/6711100/Test.java rename to hotspot/test/compiler/c2/Test6711100.java index 090476cb954..dbdae3588aa 100644 --- a/hotspot/test/compiler/c2/6711100/Test.java +++ b/hotspot/test/compiler/c2/Test6711100.java @@ -25,16 +25,21 @@ * @test * @bug 6711100 * @summary 64bit fastdebug server vm crashes with assert(_base == Int,"Not an Int") - * @run main/othervm -Xcomp -XX:CompileOnly=Test. Test + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.Test6711100:: + * compiler.c2.Test6711100 */ -public class Test { +package compiler.c2; + +public class Test6711100 { static byte b; // The server compiler chokes on compiling // this method when f() is not inlined - public Test() { + public Test6711100() { b = (new byte[1])[(new byte[f()])[-1]]; } @@ -44,7 +49,7 @@ public class Test { public static void main(String[] args) { try { - Test t = new Test(); + Test6711100 t = new Test6711100(); } catch (ArrayIndexOutOfBoundsException e) { } } diff --git a/hotspot/test/compiler/c2/6724218/Test.java b/hotspot/test/compiler/c2/Test6724218.java similarity index 85% rename from hotspot/test/compiler/c2/6724218/Test.java rename to hotspot/test/compiler/c2/Test6724218.java index 5dea55fa13b..0bef15b37ff 100644 --- a/hotspot/test/compiler/c2/6724218/Test.java +++ b/hotspot/test/compiler/c2/Test6724218.java @@ -25,21 +25,26 @@ * @test * @bug 6724218 * @summary Fix raise_LCA_above_marks() early termination - * @run main/othervm -Xbatch -XX:CompileCommand=exclude,Test.update Test + * + * @run main/othervm -Xbatch + * -XX:CompileCommand=exclude,compiler.c2.Test6724218::update + * compiler.c2.Test6724218 */ -public class Test { - Test next = null; +package compiler.c2; + +public class Test6724218 { + Test6724218 next = null; Object value = null; static boolean _closed = false; static int size = 0; - static Test list = null; + static Test6724218 list = null; static int cache_size = 0; - static Test cache = null; + static Test6724218 cache = null; Object get(int i) { - Test t = list; + Test6724218 t = list; list = t.next; size -= 1; Object o = t.value; @@ -55,13 +60,13 @@ public class Test { void update() { // Exclude compilation of this one. if (size == 0) { - Test t; + Test6724218 t; if (cache_size > 0) { t = cache; cache = t.next; cache_size = -1; } else { - t = new Test(); + t = new Test6724218(); } t.value = new Object(); t.next = list; @@ -82,7 +87,7 @@ public class Test { } public static void main(String argv[]) throws Exception { - Test t = new Test(); + Test6724218 t = new Test6724218(); int lim = 500000; Object o; for (int j = 0; j < lim; j++) { diff --git a/hotspot/test/compiler/c2/6732154/Test6732154.java b/hotspot/test/compiler/c2/Test6732154.java similarity index 96% rename from hotspot/test/compiler/c2/6732154/Test6732154.java rename to hotspot/test/compiler/c2/Test6732154.java index 3618f678455..bc695fe0cea 100644 --- a/hotspot/test/compiler/c2/6732154/Test6732154.java +++ b/hotspot/test/compiler/c2/Test6732154.java @@ -27,8 +27,13 @@ * @bug 6732154 * @summary REG: Printing an Image using image/gif doc flavor crashes the VM, Solsparc * - * @run main/othervm -Xcomp -XX:CompileOnly="Test6732154::ascii85Encode" Test6732154 + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.Test6732154::ascii85Encode + * compiler.c2.Test6732154 */ + +package compiler.c2; + public class Test6732154 { // Exact copy of sun.print.PSPrinterJob.ascii85Encode([b)[b diff --git a/hotspot/test/compiler/c2/6741738/Tester.java b/hotspot/test/compiler/c2/Test6741738.java similarity index 68% rename from hotspot/test/compiler/c2/6741738/Tester.java rename to hotspot/test/compiler/c2/Test6741738.java index f9833aede97..58f4a6f7e91 100644 --- a/hotspot/test/compiler/c2/6741738/Tester.java +++ b/hotspot/test/compiler/c2/Test6741738.java @@ -25,26 +25,31 @@ * @test * @bug 6741738 * @summary TypePtr::add_offset() set incorrect offset when the add overflows - * @run main/othervm -Xcomp -XX:CompileOnly=Tester.foo Tester + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.Test6741738::foo + * compiler.c2.Test6741738 */ -public class Tester { - private String[] values; - private int count; +package compiler.c2; - String foo() { - int i = Integer.MAX_VALUE-1; - String s; - try { - s = values[i]; - } catch (Throwable e) { - s = ""; - } - return s; - } +public class Test6741738 { + private String[] values; + private int count; - public static void main(String[] args) { - Tester t = new Tester(); - String s = t.foo(); + String foo() { + int i = Integer.MAX_VALUE - 1; + String s; + try { + s = values[i]; + } catch (Throwable e) { + s = ""; } + return s; + } + + public static void main(String[] args) { + Test6741738 t = new Test6741738(); + String s = t.foo(); + } } diff --git a/hotspot/test/compiler/c2/5091921/Test6753639.java b/hotspot/test/compiler/c2/Test6753639.java similarity index 95% rename from hotspot/test/compiler/c2/5091921/Test6753639.java rename to hotspot/test/compiler/c2/Test6753639.java index 93466cf713e..6eba35afcac 100644 --- a/hotspot/test/compiler/c2/5091921/Test6753639.java +++ b/hotspot/test/compiler/c2/Test6753639.java @@ -27,9 +27,11 @@ * @bug 6753639 * @summary Strange optimisation in for loop with cyclic integer condition * - * @run main/othervm -Xbatch Test6753639 + * @run main/othervm -Xbatch compiler.c2.Test6753639 */ +package compiler.c2; + public class Test6753639 { public static void main(String[] args) throws InterruptedException { int END = Integer.MAX_VALUE; diff --git a/hotspot/test/compiler/c2/6792161/Test6792161.java b/hotspot/test/compiler/c2/Test6792161.java similarity index 89% rename from hotspot/test/compiler/c2/6792161/Test6792161.java rename to hotspot/test/compiler/c2/Test6792161.java index 309c5bbf3be..fa4aaddcdfd 100644 --- a/hotspot/test/compiler/c2/6792161/Test6792161.java +++ b/hotspot/test/compiler/c2/Test6792161.java @@ -27,10 +27,13 @@ * @bug 6792161 * @summary assert("No dead instructions after post-alloc") * - * @run main/othervm/timeout=600 -Xcomp -XX:MaxInlineSize=120 Test6792161 + * @run main/othervm/timeout=600 -Xcomp -XX:MaxInlineSize=120 compiler.c2.Test6792161 */ +package compiler.c2; + import java.lang.reflect.Constructor; + public class Test6792161 { static Constructor test(Class cls) throws Exception { Class[] args= { String.class }; @@ -42,7 +45,7 @@ public class Test6792161 { public static void main(final String[] args) throws Exception { try { for (int i = 0; i < 100000; i++) { - Constructor ctor = test(Class.forName("Test6792161")); + Constructor ctor = test(Class.forName("compiler.c2.Test6792161")); } } catch (NoSuchMethodException e) {} } diff --git a/hotspot/test/compiler/c2/6795362/Test6795362.java b/hotspot/test/compiler/c2/Test6795362.java similarity index 90% rename from hotspot/test/compiler/c2/6795362/Test6795362.java rename to hotspot/test/compiler/c2/Test6795362.java index ac474834500..a78510b4443 100644 --- a/hotspot/test/compiler/c2/6795362/Test6795362.java +++ b/hotspot/test/compiler/c2/Test6795362.java @@ -26,9 +26,13 @@ * @bug 6795362 * @summary 32bit server compiler leads to wrong results on solaris-x86 * - * @run main/othervm -Xcomp -XX:CompileOnly=Test6795362.sub Test6795362 + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.Test6795362::sub + * compiler.c2.Test6795362 */ +package compiler.c2; + public class Test6795362 { public static void main(String[] args) { diff --git a/hotspot/test/compiler/c2/6796786/Test6796786.java b/hotspot/test/compiler/c2/Test6796786.java similarity index 95% rename from hotspot/test/compiler/c2/6796786/Test6796786.java rename to hotspot/test/compiler/c2/Test6796786.java index 625b616c39e..285f0d8e41e 100644 --- a/hotspot/test/compiler/c2/6796786/Test6796786.java +++ b/hotspot/test/compiler/c2/Test6796786.java @@ -27,9 +27,11 @@ * @bug 6796786 * @summary invalid FP identity transform - (a - b) -> b - a * - * @run main/othervm -Xbatch Test6796786 + * @run main/othervm -Xbatch compiler.c2.Test6796786 */ +package compiler.c2; + public class Test6796786 { static volatile float d1; static volatile float d2; diff --git a/hotspot/test/compiler/c2/6799693/Test.java b/hotspot/test/compiler/c2/Test6799693.java similarity index 69% rename from hotspot/test/compiler/c2/6799693/Test.java rename to hotspot/test/compiler/c2/Test6799693.java index 19a9156fbbb..8e3e83a6f32 100644 --- a/hotspot/test/compiler/c2/6799693/Test.java +++ b/hotspot/test/compiler/c2/Test6799693.java @@ -26,22 +26,27 @@ * @test * @bug 6799693 * @summary Server compiler leads to data corruption when expression throws an Exception - * @run main/othervm -Xcomp -XX:CompileOnly=Test Test + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.Test6799693::* + * compiler.c2.Test6799693 */ -public class Test { - static int var_bad = 1; +package compiler.c2; - public static void main(String[] args) - { - var_bad++; +public class Test6799693 { + static int var_bad = 1; - try { - for (int i = 0; i < 10; i++) (new byte[((byte)-1 << i)])[0] = 0; - } - catch (Exception e) { System.out.println("Got " + e); } + public static void main(String[] args) { + var_bad++; - System.out.println("Test.var_bad = " + var_bad + " (expected 2)\n"); - } + try { + for (int i = 0; i < 10; i++) (new byte[((byte) -1 << i)])[0] = 0; + } catch (Exception e) { + System.out.println("Got " + e); + } + + System.out.println("Test.var_bad = " + var_bad + " (expected 2)\n"); + } } diff --git a/hotspot/test/compiler/c2/6800154/Test6800154.java b/hotspot/test/compiler/c2/Test6800154.java similarity index 92% rename from hotspot/test/compiler/c2/6800154/Test6800154.java rename to hotspot/test/compiler/c2/Test6800154.java index b43c1556156..9de9b7648d2 100644 --- a/hotspot/test/compiler/c2/6800154/Test6800154.java +++ b/hotspot/test/compiler/c2/Test6800154.java @@ -27,9 +27,15 @@ * @summary Add comments to long_by_long_mulhi() for better understandability * @modules java.base/jdk.internal.misc * @library /testlibrary - * @run main/othervm -Xcomp -XX:CompileOnly=Test6800154.divcomp Test6800154 + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.Test6800154::divcomp + * compiler.c2.Test6800154 */ + +package compiler.c2; + import jdk.test.lib.Utils; public class Test6800154 implements Runnable { @@ -78,7 +84,7 @@ public class Test6800154 implements Runnable { public static void main(String[] args) throws Exception { - Class cl = Class.forName("Test6800154"); + Class cl = Test6800154.class; ClassLoader apploader = cl.getClassLoader(); // Iterate over all divisors. @@ -86,7 +92,7 @@ public class Test6800154 implements Runnable { System.setProperty("divisor", "" + DIVISORS[i]); ClassLoader loader = Utils.getTestClassPathURLClassLoader(apploader.getParent()); - Class c = loader.loadClass("Test6800154"); + Class c = loader.loadClass(Test6800154.class.getName()); Runnable r = (Runnable) c.newInstance(); r.run(); } diff --git a/hotspot/test/compiler/c2/6805724/Test6805724.java b/hotspot/test/compiler/c2/Test6805724.java similarity index 90% rename from hotspot/test/compiler/c2/6805724/Test6805724.java rename to hotspot/test/compiler/c2/Test6805724.java index afa20d278cc..2433fce8377 100644 --- a/hotspot/test/compiler/c2/6805724/Test6805724.java +++ b/hotspot/test/compiler/c2/Test6805724.java @@ -28,9 +28,14 @@ * when divisor is any (2^k-1) constant. * @modules java.base/jdk.internal.misc * @library /testlibrary - * @run main/othervm -Xcomp -XX:CompileOnly=Test6805724.fcomp Test6805724 + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.Test6805724::fcomp + * compiler.c2.Test6805724 */ +package compiler.c2; + import jdk.test.lib.Utils; public class Test6805724 implements Runnable { @@ -66,7 +71,7 @@ public class Test6805724 implements Runnable { } public static void main(String args[]) throws Exception { - Class cl = Class.forName("Test6805724"); + Class cl = Test6805724.class; ClassLoader apploader = cl.getClassLoader(); // Iterate over all 2^k-1 divisors. @@ -75,7 +80,7 @@ public class Test6805724 implements Runnable { System.setProperty("divisor", "" + divisor); ClassLoader loader = Utils.getTestClassPathURLClassLoader(apploader.getParent()); - Class c = loader.loadClass("Test6805724"); + Class c = loader.loadClass(Test6805724.class.getName()); Runnable r = (Runnable) c.newInstance(); r.run(); } diff --git a/hotspot/test/compiler/c2/Test6823453.java b/hotspot/test/compiler/c2/Test6823453.java new file mode 100644 index 00000000000..96675ad09ba --- /dev/null +++ b/hotspot/test/compiler/c2/Test6823453.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2009, 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 6823453 + * @summary DeoptimizeALot causes fastdebug server jvm to fail with assert(false,"unscheduable graph") + * + * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot + * -XX:CompileCommand=compileonly,compiler.c2.Test6823453::* + * compiler.c2.Test6823453 + */ + +package compiler.c2; + +public class Test6823453 { + + static long vara_1 = 1L; + + static void testa() { + short var_2 = (byte) 1.0E10; + + for (Object temp = new byte[(byte) 1.0E10]; true; + var_2 = "1".equals("0") ? ((byte) vara_1) : 1) { + } + } + + static void testb() { + long var_1 = -1L; + + short var_2 = (byte) 1.0E10; + + for (Object temp = new byte[(byte) 1.0E10]; true; + var_2 = "1".equals("0") ? ((byte) var_1) : 1) { + } + } + + static void testc() { + long var_1 = -1L; + if (vara_1 > 0) var_1 = 1L; + + int var_2 = (byte) var_1 - 128; + + for (Object temp = new byte[var_2]; true; + var_2 = "1".equals("0") ? 2 : 1) { + } + } + + static void testd() { + long var_1 = 0L; + + int var_2 = (byte) var_1 + 1; + for (int i = 0; i < 2; i++) var_2 = var_2 - 1; + + for (Object temp = new byte[var_2]; true; + var_2 = "1".equals("0") ? 2 : 1) { + } + } + + public static void main(String[] args) throws Exception { + int nex = 0; + + try { + testa(); + } catch (java.lang.NegativeArraySizeException ex) { + nex++; + } + try { + testb(); + } catch (java.lang.NegativeArraySizeException ex) { + nex++; + } + try { + testc(); + } catch (java.lang.NegativeArraySizeException ex) { + nex++; + } + try { + testd(); + } catch (java.lang.NegativeArraySizeException ex) { + nex++; + } + + if (nex != 4) + System.exit(97); + } +} + diff --git a/hotspot/test/compiler/c2/6832293/Test.java b/hotspot/test/compiler/c2/Test6832293.java similarity index 74% rename from hotspot/test/compiler/c2/6832293/Test.java rename to hotspot/test/compiler/c2/Test6832293.java index 302717b3e57..d75c9ab32f1 100644 --- a/hotspot/test/compiler/c2/6832293/Test.java +++ b/hotspot/test/compiler/c2/Test6832293.java @@ -26,52 +26,57 @@ * @test * @bug 6832293 * @summary JIT compiler got wrong result in type checking with -server - * @run main/othervm -Xcomp -XX:CompileOnly=Test.run Test + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.Test6832293::run + * compiler.c2.Test6832293 */ +package compiler.c2; + import java.io.PrintStream; -interface SomeInterface { - int SEVENS = 777; -} - -interface AnotherInterface { - int THIRDS = 33; -} - -class SomeClass implements SomeInterface { - int i; - - SomeClass(int i) { - this.i = i; +public class Test6832293 { + static interface SomeInterface { + int SEVENS = 777; } -} -class ImmediateSubclass extends SomeClass implements SomeInterface { - float f; - - ImmediateSubclass(int i, float f) { - super(i); - this.f = f; + static interface AnotherInterface { + int THIRDS = 33; } -} -final class FinalSubclass extends ImmediateSubclass implements AnotherInterface { - double d; + static class SomeClass implements SomeInterface { + int i; - FinalSubclass(int i, float f, double d) { - super(i, f); - this.d = d; + SomeClass(int i) { + this.i = i; + } } -} -public class Test { + static class ImmediateSubclass extends SomeClass implements SomeInterface { + float f; + + ImmediateSubclass(int i, float f) { + super(i); + this.f = f; + } + } + + static final class FinalSubclass extends ImmediateSubclass implements AnotherInterface { + double d; + + FinalSubclass(int i, float f, double d) { + super(i, f); + this.d = d; + } + } public static void main(String args[]) throws Exception{ /* try to pre initialize */ SomeClass[] a=new SomeClass[10]; - Class.forName("ImmediateSubclass"); - Class.forName("FinalSubclass"); + String className = Test6832293.class.getName(); + Class.forName(className + "$ImmediateSubclass"); + Class.forName(className + "$FinalSubclass"); System.exit(run(args, System.out) + 95/*STATUS_TEMP*/); } diff --git a/hotspot/test/compiler/c2/6837011/Test6837011.java b/hotspot/test/compiler/c2/Test6837011.java similarity index 90% rename from hotspot/test/compiler/c2/6837011/Test6837011.java rename to hotspot/test/compiler/c2/Test6837011.java index be900604e89..0578f63baef 100644 --- a/hotspot/test/compiler/c2/6837011/Test6837011.java +++ b/hotspot/test/compiler/c2/Test6837011.java @@ -26,9 +26,13 @@ * @bug 6837011 * @summary SIGSEGV in PhaseIdealLoop in 32bit jvm * - * @run main/othervm -Xcomp -XX:CompileOnly=Test6837011.main Test6837011 + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.Test6837011::main + * compiler.c2.Test6837011 */ +package compiler.c2; + public class Test6837011 { static boolean var_3 = true; diff --git a/hotspot/test/compiler/c2/6837094/Test.java b/hotspot/test/compiler/c2/Test6837094.java similarity index 77% rename from hotspot/test/compiler/c2/6837094/Test.java rename to hotspot/test/compiler/c2/Test6837094.java index 231b476bc69..e1f904bd079 100644 --- a/hotspot/test/compiler/c2/6837094/Test.java +++ b/hotspot/test/compiler/c2/Test6837094.java @@ -27,13 +27,19 @@ * @bug 6837094 * @summary False positive for "meet not symmetric" failure * - * @run main/othervm -Xbatch -XX:CompileOnly=Test.collectIs,Test$Factory$1.getArray,Test$Factory$2.getArray Test + * @run main/othervm -Xbatch + * -XX:CompileCommand=compileonly,compiler.c2.Test6837094::collectIs + * -XX:CompileCommand=compileonly,compiler.c2.Test6837094$Factory$1::getArray + * -XX:CompileCommand=compileonly,compiler.c2.Test6837094$Factory$2::getArray + * compiler.c2.Test6837094 */ -import java.util.Set; -import java.util.HashSet; +package compiler.c2; -public class Test { +import java.util.HashSet; +import java.util.Set; + +public class Test6837094 { private interface Factory { Factory Zero = new Factory() { @@ -72,23 +78,25 @@ public class Test { collectIs(Factory.One, s); } } + + /** + * Establish necessary class hierarchy + */ + + static interface Interface { + } + + static class Parent { + } + + static class Child0 extends Parent implements Interface { + } + + static class Child1 extends Parent implements Interface { + } + + static class Child2 extends Parent implements Interface { + } + } -/** - * Establish necessary class hierarchy - */ - -interface Interface { -} - -class Parent { -} - -class Child0 extends Parent implements Interface { -} - -class Child1 extends Parent implements Interface { -} - -class Child2 extends Parent implements Interface { -} diff --git a/hotspot/test/compiler/c2/6843752/Test.java b/hotspot/test/compiler/c2/Test6843752.java similarity index 95% rename from hotspot/test/compiler/c2/6843752/Test.java rename to hotspot/test/compiler/c2/Test6843752.java index 48afcd21f8c..fbc891cbf3d 100644 --- a/hotspot/test/compiler/c2/6843752/Test.java +++ b/hotspot/test/compiler/c2/Test6843752.java @@ -25,10 +25,13 @@ * @test * @bug 6843752 * @summary missing code for an anti-dependent Phi in GCM - * @run main/othervm -Xbatch Test + * + * @run main/othervm -Xbatch compiler.c2.Test6843752 */ -public class Test { +package compiler.c2; + +public class Test6843752 { Item list; @@ -97,7 +100,7 @@ public class Test { static public void main(String[] args) { int caseCnt = 0; - Test bj = new Test(); + Test6843752 bj = new Test6843752(); try { for (; caseCnt < 500000;) { int numItems = (++caseCnt % 2); diff --git a/hotspot/test/compiler/c2/5091921/Test6850611.java b/hotspot/test/compiler/c2/Test6850611.java similarity index 95% rename from hotspot/test/compiler/c2/5091921/Test6850611.java rename to hotspot/test/compiler/c2/Test6850611.java index 87b0e6b2f76..bbfa34fbfef 100644 --- a/hotspot/test/compiler/c2/5091921/Test6850611.java +++ b/hotspot/test/compiler/c2/Test6850611.java @@ -27,9 +27,11 @@ * @bug 6850611 * @summary int / long arithmetic seems to be broken in 1.6.0_14 HotSpot Server VM (Win XP) * - * @run main/timeout=480 Test6850611 + * @run main/timeout=480 compiler.c2.Test6850611 */ +package compiler.c2; + public class Test6850611 { public static void main(String[] args) { diff --git a/hotspot/test/compiler/c2/6851282/Test.java b/hotspot/test/compiler/c2/Test6851282.java similarity index 57% rename from hotspot/test/compiler/c2/6851282/Test.java rename to hotspot/test/compiler/c2/Test6851282.java index b011ac2fb59..8031a050fd0 100644 --- a/hotspot/test/compiler/c2/6851282/Test.java +++ b/hotspot/test/compiler/c2/Test6851282.java @@ -27,13 +27,16 @@ * @bug 6851282 * @summary JIT miscompilation results in null entry in array when using CompressedOops * - * @run main/othervm/timeout=600 -Xmx256m -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops Test + * @run main/othervm/timeout=600 -Xmx256m -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops + * compiler.c2.Test6851282 */ +package compiler.c2; + import java.util.ArrayList; import java.util.List; -public class Test { +public class Test6851282 { void foo(A a, A[] as) { for (A a1 : as) { B[] filtered = a.c(a1); @@ -54,71 +57,72 @@ public class Test { bs.add(new B(j)); as.add(new A(bs.toArray(new B[0]))); } - new Test().foo(as.get(0), as.subList(1, as.size()).toArray(new A[0])); - } -} - -class A { - final B[] bs; - - public A(B[] bs) { - this.bs = bs; + new Test6851282().foo(as.get(0), as.subList(1, as.size()).toArray(new A[0])); } - final B[] c(final A a) { - return new BoxedArray(bs).filter(new Function() { - public Boolean apply(B arg) { - for (B b : a.bs) { - if (b.d == arg.d) - return true; + static class A { + final B[] bs; + + public A(B[] bs) { + this.bs = bs; + } + + final B[] c(final A a) { + return new BoxedArray(bs).filter(new Function() { + public Boolean apply(B arg) { + for (B b : a.bs) { + if (b.d == arg.d) + return true; + } + return false; } - return false; - } - }); - } -} - -class BoxedArray { - - private final T[] array; - - BoxedArray(T[] array) { - this.array = array; - } - - public T[] filter(Function function) { - boolean[] include = new boolean[array.length]; - int len = 0; - int i = 0; - while (i < array.length) { - if (function.apply(array[i])) { - include[i] = true; - len += 1; - } - i += 1; + }); } - T[] result = (T[]) java.lang.reflect.Array.newInstance(array.getClass().getComponentType(), len); - len = 0; - i = 0; - while (len < result.length) { - if (include[i]) { - result[len] = array[i]; - len += 1; - } - i += 1; + } + + static class BoxedArray { + + private final T[] array; + + BoxedArray(T[] array) { + this.array = array; + } + + public T[] filter(Function function) { + boolean[] include = new boolean[array.length]; + int len = 0; + int i = 0; + while (i < array.length) { + if (function.apply(array[i])) { + include[i] = true; + len += 1; + } + i += 1; + } + T[] result = (T[]) java.lang.reflect.Array.newInstance(array.getClass().getComponentType(), len); + len = 0; + i = 0; + while (len < result.length) { + if (include[i]) { + result[len] = array[i]; + len += 1; + } + i += 1; + } + return result; + } + } + + static interface Function { + R apply(T arg); + } + + static class B { + final int d; + + public B(int d) { + this.d = d; } - return result; - } -} - -interface Function { - R apply(T arg); -} - -class B { - final int d; - public B(int d) { - this.d = d; } } diff --git a/hotspot/test/compiler/c2/6852078/Test6852078.java b/hotspot/test/compiler/c2/Test6852078.java similarity index 96% rename from hotspot/test/compiler/c2/6852078/Test6852078.java rename to hotspot/test/compiler/c2/Test6852078.java index 274c20b931d..dbf89a0e218 100644 --- a/hotspot/test/compiler/c2/6852078/Test6852078.java +++ b/hotspot/test/compiler/c2/Test6852078.java @@ -26,17 +26,20 @@ * @test * @bug 6852078 * @summary Disable SuperWord optimization for unsafe read/write - * * @modules java.corba/com.sun.corba.se.impl.encoding * java.corba/com.sun.jndi.toolkit.corba - * @run main Test6852078 + * + * @run main compiler.c2.Test6852078 */ -import java.util.*; -import java.nio.ByteBuffer; +package compiler.c2; + import com.sun.corba.se.impl.encoding.ByteBufferWithInfo; import com.sun.jndi.toolkit.corba.CorbaUtils; +import java.nio.ByteBuffer; +import java.util.Hashtable; + public class Test6852078 { public Test6852078(String [] args) { diff --git a/hotspot/test/compiler/c2/6857159/Test6857159.java b/hotspot/test/compiler/c2/Test6857159.java similarity index 52% rename from hotspot/test/compiler/c2/6857159/Test6857159.java rename to hotspot/test/compiler/c2/Test6857159.java index f412adf5876..894fc5f1cbe 100644 --- a/hotspot/test/compiler/c2/6857159/Test6857159.java +++ b/hotspot/test/compiler/c2/Test6857159.java @@ -29,47 +29,66 @@ * @library /testlibrary * @modules java.base/jdk.internal.misc * java.management + * + * @run driver compiler.c2.Test6857159 */ -import jdk.test.lib.*; +package compiler.c2; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; public class Test6857159 { public static void main(String[] args) throws Throwable { + String className = Test.class.getName(); OutputAnalyzer analyzer = ProcessTools.executeTestJvm("-Xbatch", - "-XX:+PrintCompilation", "-XX:CompileOnly=Test$ct.run", "Test"); + "-XX:+PrintCompilation", + "-XX:CompileOnly="+ className + "$ct::run", + className); analyzer.shouldNotContain("COMPILE SKIPPED"); - analyzer.shouldContain("Test$ct0::run (16 bytes)"); + analyzer.shouldContain(className + "$ct0::run (16 bytes)"); analyzer.shouldHaveExitValue(0); } -} -class Test extends Thread { - static class ct0 extends Test { - public void message() { } - - public void run() { - message(); - ct0 ct = (ct0) Thread.currentThread(); - ct.message(); - } - } - static class ct1 extends ct0 { - public void message() { } - } - static class ct2 extends ct0 { - public void message() { } - } - - public static void main(String[] args) throws Exception { - for (int i = 0; i < 20000; i++) { - Thread t = null; - switch (i % 3) { - case 0: t = new ct0(); break; - case 1: t = new ct1(); break; - case 2: t = new ct2(); break; + static class Test extends Thread { + static class ct0 extends Test { + public void message() { + } + + public void run() { + message(); + ct0 ct = (ct0) Thread.currentThread(); + ct.message(); + } + } + + static class ct1 extends ct0 { + public void message() { + } + } + + static class ct2 extends ct0 { + public void message() { + } + } + + public static void main(String[] args) throws Exception { + for (int i = 0; i < 20000; i++) { + Thread t = null; + switch (i % 3) { + case 0: + t = new ct0(); + break; + case 1: + t = new ct1(); + break; + case 2: + t = new ct2(); + break; + } + t.start(); + t.join(); } - t.start(); - t.join(); } } } diff --git a/hotspot/test/compiler/c2/6863155/Test6863155.java b/hotspot/test/compiler/c2/Test6863155.java similarity index 91% rename from hotspot/test/compiler/c2/6863155/Test6863155.java rename to hotspot/test/compiler/c2/Test6863155.java index edef9a9779f..848bfbaadcb 100644 --- a/hotspot/test/compiler/c2/6863155/Test6863155.java +++ b/hotspot/test/compiler/c2/Test6863155.java @@ -26,9 +26,13 @@ * @bug 6863155 * @summary Server compiler generates incorrect code (x86, long, bitshift, bitmask) * - * @run main/othervm -Xcomp -XX:CompileOnly=Test6863155.test Test6863155 + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.Test6863155::test + * compiler.c2.Test6863155 */ +package compiler.c2; + public class Test6863155 { private static long test(byte b) { return b << 24 & 0xff000000L; diff --git a/hotspot/test/compiler/c2/6866651/Test.java b/hotspot/test/compiler/c2/Test6866651.java similarity index 94% rename from hotspot/test/compiler/c2/6866651/Test.java rename to hotspot/test/compiler/c2/Test6866651.java index 41b7bd5fe25..88cbf52c42b 100644 --- a/hotspot/test/compiler/c2/6866651/Test.java +++ b/hotspot/test/compiler/c2/Test6866651.java @@ -26,10 +26,12 @@ * @bug 6866651 * @summary delay dead node elimination in set_req_X to prevent killing the current node when it is in use * - * @run main Test + * @run main compiler.c2.Test6866651 */ -public class Test { +package compiler.c2; + +public class Test6866651 { static int sum() { int s = 0; diff --git a/hotspot/test/compiler/c2/6877254/Test.java b/hotspot/test/compiler/c2/Test6877254.java similarity index 94% rename from hotspot/test/compiler/c2/6877254/Test.java rename to hotspot/test/compiler/c2/Test6877254.java index d4702217c13..bc092d54729 100644 --- a/hotspot/test/compiler/c2/6877254/Test.java +++ b/hotspot/test/compiler/c2/Test6877254.java @@ -26,10 +26,12 @@ * @bug 6877254 * @summary Implement StoreCMNode::Ideal to promote its OopStore above the MergeMem * - * @run main/othervm -Xcomp Test + * @run main/othervm -Xcomp compiler.c2.Test6877254 */ -public class Test { +package compiler.c2; + +public class Test6877254 { static byte var_1; static String var_2 = ""; static byte var_3; diff --git a/hotspot/test/compiler/c2/6880034/Test6880034.java b/hotspot/test/compiler/c2/Test6880034.java similarity index 85% rename from hotspot/test/compiler/c2/6880034/Test6880034.java rename to hotspot/test/compiler/c2/Test6880034.java index 72af0958b7e..628e7b230ac 100644 --- a/hotspot/test/compiler/c2/6880034/Test6880034.java +++ b/hotspot/test/compiler/c2/Test6880034.java @@ -26,10 +26,13 @@ * @bug 6880034 * @summary SIGBUS during deoptimisation at a safepoint on 64bit-SPARC * - * @run main/othervm -Xcomp -Xbatch -XX:CompileCommand=compileonly,Test6880034,deopt_compiledframe_at_safepoint -XX:+PrintCompilation Test6880034 + * @run main/othervm -Xcomp -Xbatch + * -XX:+PrintCompilation + * -XX:CompileCommand=compileonly,compiler.c2.Test6880034::deopt_compiledframe_at_safepoint + * compiler.c2.Test6880034 */ - +package compiler.c2; // This test provokes a deoptimisation at a safepoint. // @@ -61,39 +64,38 @@ // // Author: Volker H. Simonis -class A { - public int doSomething() { - return 0; - } -} - -class B extends A { - public B() {} - // override 'A::doSomething()' - public int doSomething() { - return 1; - } -} - -class G { - public static volatile A a = new A(); - - // Change 'a' to point to a 'B' object - public static void setAtoB() { - try { - a = (A) ClassLoader. - getSystemClassLoader(). - loadClass("B"). - getConstructor(new Class[] {}). - newInstance(new Object[] {}); - } - catch (Exception e) { - System.out.println(e); - } - } -} - public class Test6880034 { + static class A { + public int doSomething() { + return 0; + } + } + + static class B extends A { + public B() {} + // override 'A::doSomething()' + public int doSomething() { + return 1; + } + } + + static class G { + public static volatile A a = new A(); + + // Change 'a' to point to a 'B' object + public static void setAtoB() { + try { + a = (A) ClassLoader. + getSystemClassLoader(). + loadClass("B"). + getConstructor(new Class[] {}). + newInstance(new Object[] {}); + } + catch (Exception e) { + System.out.println(e); + } + } + } public static volatile boolean is_in_loop = false; public static volatile boolean stop_while_loop = false; diff --git a/hotspot/test/compiler/c2/6885584/Test6885584.java b/hotspot/test/compiler/c2/Test6885584.java similarity index 96% rename from hotspot/test/compiler/c2/6885584/Test6885584.java rename to hotspot/test/compiler/c2/Test6885584.java index 1048bcd0107..e5ba96ff8d8 100644 --- a/hotspot/test/compiler/c2/6885584/Test6885584.java +++ b/hotspot/test/compiler/c2/Test6885584.java @@ -27,10 +27,10 @@ * @bug 6885584 * @summary A particular class structure causes large allocation spike for jit * - * @run main/othervm -Xbatch Test6885584 + * @run main/othervm -Xbatch compiler.c2.Test6885584 */ - +package compiler.c2; public class Test6885584 { static private int i1; diff --git a/hotspot/test/compiler/c2/5091921/Test6897150.java b/hotspot/test/compiler/c2/Test6897150.java similarity index 96% rename from hotspot/test/compiler/c2/5091921/Test6897150.java rename to hotspot/test/compiler/c2/Test6897150.java index 58a22acc8f9..9fde86d3da8 100644 --- a/hotspot/test/compiler/c2/5091921/Test6897150.java +++ b/hotspot/test/compiler/c2/Test6897150.java @@ -27,9 +27,11 @@ * @bug 6897150 * @summary Hotspot optimises away a valid loop * - * @run main Test6897150 + * @run main compiler.c2.Test6897150 */ +package compiler.c2; + // Should be compiled with javac from JDK1.3 to get bytecode which shows the problem. public class Test6897150 { public static void main(String[] args) { diff --git a/hotspot/test/compiler/c2/6901572/Test.java b/hotspot/test/compiler/c2/Test6901572.java similarity index 95% rename from hotspot/test/compiler/c2/6901572/Test.java rename to hotspot/test/compiler/c2/Test6901572.java index 695373a9621..583e5e1d3fb 100644 --- a/hotspot/test/compiler/c2/6901572/Test.java +++ b/hotspot/test/compiler/c2/Test6901572.java @@ -26,11 +26,12 @@ * @bug 6901572 * @summary JVM 1.6.16 crash on loops: assert(has_node(i),"") * - * @run main/othervm Test + * @run main/othervm compiler.c2.Test6901572 */ +package compiler.c2; -public class Test { +public class Test6901572 { public static void main(String[] args) { for (int i = 0; i < 2; i++) diff --git a/hotspot/test/compiler/c2/Test6905845.java b/hotspot/test/compiler/c2/Test6905845.java new file mode 100644 index 00000000000..18db36b38b8 --- /dev/null +++ b/hotspot/test/compiler/c2/Test6905845.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2011, 2013, 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 6905845 + * @summary Server VM improperly optimizing away loop. + * + * @run main/timeout=480 compiler.c2.Test6905845 + */ + +package compiler.c2; + +public class Test6905845 { + + public static void main(String[] args) { + for (int asdf = 0; asdf < 5; asdf++) { + //test block + { + StringBuilder strBuf1 = new StringBuilder(65); + long start = System.currentTimeMillis(); + int count = 0; + + for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79) { + strBuf1.append(i); + count++; + strBuf1.delete(0, 65); + } + + System.out.println(count); + if (count != 54366674) { + System.out.println("wrong count: " + count + ", should be 54366674"); + System.exit(97); + } + } + //test block + { + StringBuilder strBuf1 = new StringBuilder(65); + long start = System.currentTimeMillis(); + int count = 0; + + for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79) { + strBuf1.append(i); + count++; + strBuf1.delete(0, 65); + } + + System.out.println(count); + if (count != 54366674) { + System.out.println("wrong count: " + count + ", should be 54366674"); + System.exit(97); + } + } + } + } +} + diff --git a/hotspot/test/compiler/c2/6910484/Test.java b/hotspot/test/compiler/c2/Test6910484.java similarity index 94% rename from hotspot/test/compiler/c2/6910484/Test.java rename to hotspot/test/compiler/c2/Test6910484.java index 3907c98fd2a..54165235e7f 100644 --- a/hotspot/test/compiler/c2/6910484/Test.java +++ b/hotspot/test/compiler/c2/Test6910484.java @@ -26,10 +26,12 @@ * @bug 6910484 * @summary incorrect integer optimization (loosing and op-r in a given example) * - * @run main/othervm -Xbatch Test + * @run main/othervm -Xbatch compiler.c2.Test6910484 */ -public class Test { +package compiler.c2; + +public class Test6910484 { public static void main(String[] args) { long iteration = 0; diff --git a/hotspot/test/compiler/c2/6910605/Test.java b/hotspot/test/compiler/c2/Test6910605_1.java similarity index 95% rename from hotspot/test/compiler/c2/6910605/Test.java rename to hotspot/test/compiler/c2/Test6910605_1.java index ffeb91c3c1d..6ab1ff4f9c7 100644 --- a/hotspot/test/compiler/c2/6910605/Test.java +++ b/hotspot/test/compiler/c2/Test6910605_1.java @@ -26,15 +26,16 @@ * @test * @bug 6910605 * @summary C2: NullPointerException/ClassCaseException is thrown when C2 with DeoptimizeALot is used - * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot -Xbatch Test - * * original test: nsk/coverage/runtime/runtime007 + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot -Xbatch compiler.c2.Test6910605_1 */ -import java.io.*; +package compiler.c2; -public class Test { +import java.io.PrintStream; + +public class Test6910605_1 { public static int buf=0; public static void main( String argv[] ) { diff --git a/hotspot/test/compiler/c2/6910618/Test.java b/hotspot/test/compiler/c2/Test6910605_2.java similarity index 54% rename from hotspot/test/compiler/c2/6910618/Test.java rename to hotspot/test/compiler/c2/Test6910605_2.java index d50edb029fc..50dbedc250c 100644 --- a/hotspot/test/compiler/c2/6910618/Test.java +++ b/hotspot/test/compiler/c2/Test6910605_2.java @@ -27,48 +27,52 @@ * @bug 6910605 * @summary C2: NullPointerException/ClassCaseException is thrown when C2 with DeoptimizeALot is used * - * @run main/othervm -Xmx64m -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot -XX:+DoEscapeAnalysis -Xbatch -XX:InlineSmallCode=2000 Test - * + * @run main/othervm -Xmx64m -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot + * -XX:+DoEscapeAnalysis -Xbatch -XX:InlineSmallCode=2000 + * compiler.c2.Test6910605_2 */ +package compiler.c2; + /* * Added InlineSmallCode=2000 to guaranty inlining of StringBuilder::append() to allow scalar replace StringBuilder object. * * original test: gc/gctests/StringGC */ -public class Test { - private final String toAdd = "0123456789abcdef"; - private int maxLength; - private static final int numberOfThreads = 8; +public class Test6910605_2 { + private final String toAdd = "0123456789abcdef"; + private int maxLength; + private static final int numberOfThreads = 8; - private class StringAdder extends Thread { - private String s; + private class StringAdder extends Thread { + private String s; - public void test() { - s = s + toAdd; - } - public void run() { - do { - test(); - } while (s.length() < maxLength); - } + public void test() { + s = s + toAdd; } - public void test() throws InterruptedException { - maxLength = toAdd.length() * 15000/ numberOfThreads; - StringAdder[] sa = new StringAdder[numberOfThreads]; - for (int i = 0; i < numberOfThreads; i++) { - sa[i] = new StringAdder(); - sa[i].start(); - } - for (int i = 0; i < numberOfThreads; i++) { - sa[i].join(); - } + public void run() { + do { + test(); + } while (s.length() < maxLength); } + } - public static void main(String[] args) throws InterruptedException { - Test t = new Test(); - t.test(); + public void test() throws InterruptedException { + maxLength = toAdd.length() * 15000 / numberOfThreads; + StringAdder[] sa = new StringAdder[numberOfThreads]; + for (int i = 0; i < numberOfThreads; i++) { + sa[i] = new StringAdder(); + sa[i].start(); } + for (int i = 0; i < numberOfThreads; i++) { + sa[i].join(); + } + } + + public static void main(String[] args) throws InterruptedException { + Test6910605_2 t = new Test6910605_2(); + t.test(); + } } diff --git a/hotspot/test/compiler/c2/6912517/Test.java b/hotspot/test/compiler/c2/Test6912517.java similarity index 93% rename from hotspot/test/compiler/c2/6912517/Test.java rename to hotspot/test/compiler/c2/Test6912517.java index 0d999fc2168..f6826783a61 100644 --- a/hotspot/test/compiler/c2/6912517/Test.java +++ b/hotspot/test/compiler/c2/Test6912517.java @@ -26,14 +26,17 @@ * @bug 6912517 * @summary JIT bug compiles out (and stops running) code that needs to be run. Causes NPE. * - * @run main/othervm -Xbatch -XX:CompileThreshold=100 -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops Test + * @run main/othervm -Xbatch -XX:CompileThreshold=100 -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops + * compiler.c2.Test6912517 */ +package compiler.c2; + /** * Highlights a bug with the JIT compiler. * @author Matt Bruce m b r u c e __\at/__ g m a i l DOT c o m */ -public class Test implements Runnable +public class Test6912517 implements Runnable { private final Thread myThread; private Thread myInitialThread; @@ -42,7 +45,7 @@ public class Test implements Runnable /** * Sets up the running thread, and starts it. */ - public Test(int id) + public Test6912517(int id) { myThread = new Thread(this); myThread.setName("Runner: " + id); @@ -69,7 +72,7 @@ public class Test implements Runnable // let this run for a bit, so the "run" below is JITTed. for (int id = 0; id < 20; id++) { System.out.println("Starting thread: " + id); - Test bug = new Test(id); + Test6912517 bug = new Test6912517(id); bug.setShouldCheckThreads(true); Thread.sleep(2500); } diff --git a/hotspot/test/compiler/c2/6916644/Test6916644.java b/hotspot/test/compiler/c2/Test6916644.java similarity index 91% rename from hotspot/test/compiler/c2/6916644/Test6916644.java rename to hotspot/test/compiler/c2/Test6916644.java index c64f245cc05..8ad9e7bbf3b 100644 --- a/hotspot/test/compiler/c2/6916644/Test6916644.java +++ b/hotspot/test/compiler/c2/Test6916644.java @@ -27,9 +27,13 @@ * @bug 6916644 * @summary C2 compiler crash on x86 * - * @run main/othervm -Xcomp -XX:CompileOnly=Test6916644.test Test6916644 + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.Test6916644::test + * compiler.c2.Test6916644 */ +package compiler.c2; + public class Test6916644 { static int result; static int i1; diff --git a/hotspot/test/compiler/c2/6930043/Test6930043.java b/hotspot/test/compiler/c2/Test6930043.java similarity index 97% rename from hotspot/test/compiler/c2/6930043/Test6930043.java rename to hotspot/test/compiler/c2/Test6930043.java index ac30f3a6612..66cbe109bef 100644 --- a/hotspot/test/compiler/c2/6930043/Test6930043.java +++ b/hotspot/test/compiler/c2/Test6930043.java @@ -27,10 +27,10 @@ * @bug 6930043 * @summary C2: SIGSEGV in javasoft.sqe.tests.lang.arr017.arr01702.arr01702.loop_forw(II)I * - * @run main Test6930043 + * @run main compiler.c2.Test6930043 */ -import java.io.PrintStream; +package compiler.c2; public class Test6930043 { int[] a; diff --git a/hotspot/test/compiler/c2/5091921/Test6931567.java b/hotspot/test/compiler/c2/Test6931567.java similarity index 97% rename from hotspot/test/compiler/c2/5091921/Test6931567.java rename to hotspot/test/compiler/c2/Test6931567.java index 30e870142b9..7f753903798 100644 --- a/hotspot/test/compiler/c2/5091921/Test6931567.java +++ b/hotspot/test/compiler/c2/Test6931567.java @@ -27,9 +27,11 @@ * @bug 6931567 * @summary JIT Error (on class file compiled with eclipse) on JVM x64 (but not on x32!). * - * @run main Test6931567 + * @run main compiler.c2.Test6931567 */ +package compiler.c2; + // Should be compiled with javac from JDK1.3 to get bytecode which shows the problem. public class Test6931567 { diff --git a/hotspot/test/compiler/c2/5091921/Test6935022.java b/hotspot/test/compiler/c2/Test6935022.java similarity index 97% rename from hotspot/test/compiler/c2/5091921/Test6935022.java rename to hotspot/test/compiler/c2/Test6935022.java index 0dea6f98e63..da098a8fbfb 100644 --- a/hotspot/test/compiler/c2/5091921/Test6935022.java +++ b/hotspot/test/compiler/c2/Test6935022.java @@ -27,9 +27,11 @@ * @bug 6935022 * @summary Server VM incorrectly breaks out of while loop * - * @run main Test6935022 + * @run main compiler.c2.Test6935022 */ +package compiler.c2; + public class Test6935022 { public static final void main(String[] args) throws Exception { Test6935022 test = new Test6935022(); diff --git a/hotspot/test/compiler/c2/6956668/Test6956668.java b/hotspot/test/compiler/c2/Test6956668.java similarity index 96% rename from hotspot/test/compiler/c2/6956668/Test6956668.java rename to hotspot/test/compiler/c2/Test6956668.java index 1acf515c386..54b78d2a9c5 100644 --- a/hotspot/test/compiler/c2/6956668/Test6956668.java +++ b/hotspot/test/compiler/c2/Test6956668.java @@ -27,9 +27,10 @@ * @bug 6956668 * @summary misbehavior of XOR operator (^) with int * - * @run main/othervm -Xbatch Test6956668 + * @run main/othervm -Xbatch compiler.c2.Test6956668 */ +package compiler.c2; public class Test6956668 { diff --git a/hotspot/test/compiler/c2/6958485/Test.java b/hotspot/test/compiler/c2/Test6958485.java similarity index 89% rename from hotspot/test/compiler/c2/6958485/Test.java rename to hotspot/test/compiler/c2/Test6958485.java index 0bbc1ec6285..b8bc15f4bc3 100644 --- a/hotspot/test/compiler/c2/6958485/Test.java +++ b/hotspot/test/compiler/c2/Test6958485.java @@ -26,10 +26,14 @@ * @bug 6958485 * @summary fix for 6879921 was insufficient * - * @run main/othervm -Xbatch -XX:CompileOnly=Test.init Test + * @run main/othervm -Xbatch + * -XX:CompileCommand=compileonly,compiler.c2.Test6958485::init + * compiler.c2.Test6958485 */ -public class Test { +package compiler.c2; + +public class Test6958485 { public static void init(Object src[], boolean[] dst) { // initialize the arrays diff --git a/hotspot/test/compiler/c2/5091921/Test6959129.java b/hotspot/test/compiler/c2/Test6959129.java similarity index 97% rename from hotspot/test/compiler/c2/5091921/Test6959129.java rename to hotspot/test/compiler/c2/Test6959129.java index 53fd439cbf4..fb58383121e 100644 --- a/hotspot/test/compiler/c2/5091921/Test6959129.java +++ b/hotspot/test/compiler/c2/Test6959129.java @@ -27,9 +27,11 @@ * @bug 6959129 * @summary COMPARISON WITH INTEGER.MAX_INT DOES NOT WORK CORRECTLY IN THE CLIENT VM. * - * @run main/othervm -ea Test6959129 + * @run main/othervm -ea compiler.c2.Test6959129 */ +package compiler.c2; + public class Test6959129 { public static void main(String[] args) { diff --git a/hotspot/test/compiler/c2/6968348/Test6968348.java b/hotspot/test/compiler/c2/Test6968348.java similarity index 95% rename from hotspot/test/compiler/c2/6968348/Test6968348.java rename to hotspot/test/compiler/c2/Test6968348.java index 432f45fad3e..be609bfbb8f 100644 --- a/hotspot/test/compiler/c2/6968348/Test6968348.java +++ b/hotspot/test/compiler/c2/Test6968348.java @@ -26,13 +26,16 @@ * @test * @bug 6968348 * @summary Byteswapped memory access can point to wrong location after JIT - * * @modules java.base/jdk.internal.misc - * @run main Test6968348 + * + * @run main compiler.c2.Test6968348 */ +package compiler.c2; + import jdk.internal.misc.Unsafe; -import java.lang.reflect.*; + +import java.lang.reflect.Field; public class Test6968348 { static Unsafe unsafe; diff --git a/hotspot/test/compiler/c2/6973329/Test.java b/hotspot/test/compiler/c2/Test6973329.java similarity index 61% rename from hotspot/test/compiler/c2/6973329/Test.java rename to hotspot/test/compiler/c2/Test6973329.java index caecf8bbdd9..94021205d04 100644 --- a/hotspot/test/compiler/c2/6973329/Test.java +++ b/hotspot/test/compiler/c2/Test6973329.java @@ -26,38 +26,42 @@ * @bug 6973329 * @summary C2 with Zero based COOP produces code with broken anti-dependency on x86 * - * @run main/othervm -Xbatch -Xcomp -XX:CompileOnly=Test Test + * @run main/othervm -Xbatch -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.Test6973329::* + * compiler.c2.Test6973329 */ -class A { - A next; - int n; +package compiler.c2; - public int get_n() { - return n+1; - } -} -public class Test { +public class Test6973329 { + static class A { + A next; + int n; - A a; - - void test (A new_next) { - A prev_next = a.next; - a.next = new_next; - if (prev_next == null) { - a.n = a.get_n(); + public int get_n() { + return n + 1; + } } - } - public static void main(String args[]) { - Test t = new Test(); - t.a = new A(); - t.a.n = 1; - t.test(new A()); - if (t.a.n != 2) { - System.out.println("Wrong value: " + t.a.n + " expected: 2"); - System.exit(97); + A a; + + void test(A new_next) { + A prev_next = a.next; + a.next = new_next; + if (prev_next == null) { + a.n = a.get_n(); + } + } + + public static void main(String args[]) { + Test6973329 t = new Test6973329(); + t.a = new A(); + t.a.n = 1; + t.test(new A()); + if (t.a.n != 2) { + System.out.println("Wrong value: " + t.a.n + " expected: 2"); + System.exit(97); + } } - } } diff --git a/hotspot/test/compiler/c2/5091921/Test6985295.java b/hotspot/test/compiler/c2/Test6985295.java similarity index 95% rename from hotspot/test/compiler/c2/5091921/Test6985295.java rename to hotspot/test/compiler/c2/Test6985295.java index 3b3271fe88a..ab180396c57 100644 --- a/hotspot/test/compiler/c2/5091921/Test6985295.java +++ b/hotspot/test/compiler/c2/Test6985295.java @@ -27,9 +27,11 @@ * @bug 6985295 * @summary JVM fails to evaluate condition randomly * - * @run main/othervm -Xbatch Test6985295 + * @run main/othervm -Xbatch compiler.c2.Test6985295 */ +package compiler.c2; + public class Test6985295 { public static void main(String[] args) { diff --git a/hotspot/test/compiler/c2/5091921/Test6992759.java b/hotspot/test/compiler/c2/Test6992759.java similarity index 96% rename from hotspot/test/compiler/c2/5091921/Test6992759.java rename to hotspot/test/compiler/c2/Test6992759.java index 9adece6a249..8df7b264bfc 100644 --- a/hotspot/test/compiler/c2/5091921/Test6992759.java +++ b/hotspot/test/compiler/c2/Test6992759.java @@ -27,9 +27,11 @@ * @bug 6992759 * @summary Bad code generated for integer <= comparison, fails for Integer.MAX_VALUE * - * @run main/timeout=240 Test6992759 + * @run main/timeout=240 compiler.c2.Test6992759 */ +package compiler.c2; + public class Test6992759 { static final int N_TESTS = 1000000000; diff --git a/hotspot/test/compiler/c2/7002666/Test7002666.java b/hotspot/test/compiler/c2/Test7002666.java similarity index 90% rename from hotspot/test/compiler/c2/7002666/Test7002666.java rename to hotspot/test/compiler/c2/Test7002666.java index caca8d8dcfd..ebb0d971fd5 100644 --- a/hotspot/test/compiler/c2/7002666/Test7002666.java +++ b/hotspot/test/compiler/c2/Test7002666.java @@ -27,8 +27,14 @@ * @bug 7002666 * @summary eclipse CDT projects crash with compressed oops * - * @run main/othervm -Xbatch -XX:CompileOnly=Test7002666.test,java/lang/reflect/Array Test7002666 - * + * @run main/othervm -Xbatch + * -XX:CompileCommand=compileonly,compiler.c2.Test7002666::test + * -XX:CompileCommand=compileonly,java.lang.reflect.Array::* + * compiler.c2.Test7002666 + */ + +package compiler.c2; +/* * This will only reliably fail with a fastdebug build since it relies * on seeing garbage in the heap to die. It could be made more * reliable in product mode but that would require greatly increasing diff --git a/hotspot/test/compiler/c2/7009359/Test7009359.java b/hotspot/test/compiler/c2/Test7009359.java similarity index 91% rename from hotspot/test/compiler/c2/7009359/Test7009359.java rename to hotspot/test/compiler/c2/Test7009359.java index 86724931de9..48280c5e83c 100644 --- a/hotspot/test/compiler/c2/7009359/Test7009359.java +++ b/hotspot/test/compiler/c2/Test7009359.java @@ -27,10 +27,13 @@ * @bug 7009359 * @summary HS with -XX:+AggressiveOpts optimize new StringBuffer(null) so it does not throw NPE as expected * - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+OptimizeStringConcat -XX:CompileCommand=dontinline,Test7009359,stringmakerBUG Test7009359 - * + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+OptimizeStringConcat + * -XX:CompileCommand=dontinline,compiler.c2.Test7009359::stringmakerBUG + * compiler.c2.Test7009359 */ +package compiler.c2; + public class Test7009359 { public static void main (String[] args) { for(int i = 0; i < 100000; i++) { diff --git a/hotspot/test/compiler/c2/7017746/Test.java b/hotspot/test/compiler/c2/Test7017746.java similarity index 72% rename from hotspot/test/compiler/c2/7017746/Test.java rename to hotspot/test/compiler/c2/Test7017746.java index eab4b7e0f40..893eef34e04 100644 --- a/hotspot/test/compiler/c2/7017746/Test.java +++ b/hotspot/test/compiler/c2/Test7017746.java @@ -26,25 +26,27 @@ * @bug 7017746 * @summary Regression : C2 compiler crash due to SIGSEGV in PhaseCFG::schedule_early() * - * @run main/othervm -Xbatch Test + * @run main/othervm -Xbatch compiler.c2.Test7017746 */ -public class Test { +package compiler.c2; - int i; +public class Test7017746 { - static int test(Test t, int a, int b) { - int j = t.i; - int x = a - b; - if (a < b) x = x + j; - return x - j; - } + int i; - public static void main(String args[]) { - Test t = new Test(); - for (int n = 0; n < 1000000; n++) { - int i = test(t, 1, 2); + static int test(Test7017746 t, int a, int b) { + int j = t.i; + int x = a - b; + if (a < b) x = x + j; + return x - j; + } + + public static void main(String args[]) { + Test7017746 t = new Test7017746(); + for (int n = 0; n < 1000000; n++) { + int i = test(t, 1, 2); + } } - } } diff --git a/hotspot/test/compiler/c2/5091921/Test7020614.java b/hotspot/test/compiler/c2/Test7020614.java similarity index 95% rename from hotspot/test/compiler/c2/5091921/Test7020614.java rename to hotspot/test/compiler/c2/Test7020614.java index b1d80297f2b..05b2481b960 100644 --- a/hotspot/test/compiler/c2/5091921/Test7020614.java +++ b/hotspot/test/compiler/c2/Test7020614.java @@ -27,9 +27,11 @@ * @bug 7020614 * @summary "-server" mode optimizer makes code hang * - * @run main/othervm/timeout=30 -Xbatch Test7020614 + * @run main/othervm/timeout=30 -Xbatch compiler.c2.Test7020614 */ +package compiler.c2; + public class Test7020614 { private static final int ITERATIONS = 1000; diff --git a/hotspot/test/compiler/c2/7024475/Test7024475.java b/hotspot/test/compiler/c2/Test7024475.java similarity index 97% rename from hotspot/test/compiler/c2/7024475/Test7024475.java rename to hotspot/test/compiler/c2/Test7024475.java index 2f3b2e06c9f..646993f1b6f 100644 --- a/hotspot/test/compiler/c2/7024475/Test7024475.java +++ b/hotspot/test/compiler/c2/Test7024475.java @@ -27,9 +27,11 @@ * @bug 7024475 * @summary loop doesn't terminate when compiled * - * @run main Test7024475 + * @run main compiler.c2.Test7024475 */ +package compiler.c2; + public class Test7024475 { static int i; diff --git a/hotspot/test/compiler/c2/7029152/Test.java b/hotspot/test/compiler/c2/Test7029152.java similarity index 71% rename from hotspot/test/compiler/c2/7029152/Test.java rename to hotspot/test/compiler/c2/Test7029152.java index edc7fd9432b..bcd53dbb5f2 100644 --- a/hotspot/test/compiler/c2/7029152/Test.java +++ b/hotspot/test/compiler/c2/Test7029152.java @@ -26,24 +26,26 @@ * @bug 7029152 * @summary Ideal nodes for String intrinsics miss memory edge optimization * - * @run main/othervm -Xbatch Test + * @run main/othervm -Xbatch compiler.c2.Test7029152 */ -public class Test { +package compiler.c2; - static final String str = "11111xx11111xx1x"; - static int idx = 0; +public class Test7029152 { - static int IndexOfTest(String str) { - return str.indexOf("11111xx1x"); - } + static final String str = "11111xx11111xx1x"; + static int idx = 0; - public static void main(String args[]) { - final int ITERS=2000000; - - for (int i=0; i 1) - return "bad"; + String test(String str) { + for (int i = 0; i < first; i++) { + if (i > 1) + return "bad"; + } + return add(str + "456"); } - return add(str+"456"); - } - public static void main(String [] args) { - Test7046096 t = new Test7046096(); - for (int i = 0; i < 11000; i++) { - String str = t.test("123"); - if (!str.equals("123456789")) { - System.out.println("FAILED: " + str + " != \"123456789\""); - System.exit(97); - } + public static void main(String[] args) { + Test7046096 t = new Test7046096(); + for (int i = 0; i < 11000; i++) { + String str = t.test("123"); + if (!str.equals("123456789")) { + System.out.println("FAILED: " + str + " != \"123456789\""); + System.exit(97); + } + } } - } } diff --git a/hotspot/test/compiler/c2/7047069/Test7047069.java b/hotspot/test/compiler/c2/Test7047069.java similarity index 98% rename from hotspot/test/compiler/c2/7047069/Test7047069.java rename to hotspot/test/compiler/c2/Test7047069.java index fcfee8c07aa..812a5ace4b5 100644 --- a/hotspot/test/compiler/c2/7047069/Test7047069.java +++ b/hotspot/test/compiler/c2/Test7047069.java @@ -26,13 +26,14 @@ * @test * @bug 7047069 * @summary Array can dynamically change size when assigned to an object field - * * @modules java.desktop - * @run main/othervm -Xbatch Test7047069 + * + * @run main/othervm -Xbatch compiler.c2.Test7047069 */ -import java.util.*; -import java.awt.geom.*; +package compiler.c2; + +import java.awt.geom.Line2D; public class Test7047069 { static boolean verbose; diff --git a/hotspot/test/compiler/c2/7048332/Test7048332.java b/hotspot/test/compiler/c2/Test7048332.java similarity index 62% rename from hotspot/test/compiler/c2/7048332/Test7048332.java rename to hotspot/test/compiler/c2/Test7048332.java index fc6794e1968..2c850a44045 100644 --- a/hotspot/test/compiler/c2/7048332/Test7048332.java +++ b/hotspot/test/compiler/c2/Test7048332.java @@ -27,34 +27,35 @@ * @bug 7048332 * @summary Cadd_cmpLTMask doesn't handle 64-bit tmp register properly * - * @run main/othervm -Xbatch Test7048332 + * @run main/othervm -Xbatch compiler.c2.Test7048332 */ +package compiler.c2; public class Test7048332 { - static int capacity = 2; - static int first = 1; - static int last = 2; + static int capacity = 2; + static int first = 1; + static int last = 2; - static int test(int i1, int i2, int i3, int i4, int i5, int i6) { - final int result; - if (last >= first) { - result = last - first; - } else { - result = last - first + capacity; + static int test(int i1, int i2, int i3, int i4, int i5, int i6) { + final int result; + if (last >= first) { + result = last - first; + } else { + result = last - first + capacity; + } + return result; } - return result; - } - public static void main(String [] args) { - for (int i = 0; i < 11000; i++) { - last = (i & 1) << 1; // 0 or 2 - int k = test(1, 2, 3, 4, 5, 6); - if (k != 1) { - System.out.println("FAILED: " + k + " != 1"); - System.exit(97); - } + public static void main(String[] args) { + for (int i = 0; i < 11000; i++) { + last = (i & 1) << 1; // 0 or 2 + int k = test(1, 2, 3, 4, 5, 6); + if (k != 1) { + System.out.println("FAILED: " + k + " != 1"); + System.exit(97); + } + } } - } } diff --git a/hotspot/test/compiler/c2/7068051/Test7068051.java b/hotspot/test/compiler/c2/Test7068051.java similarity index 98% rename from hotspot/test/compiler/c2/7068051/Test7068051.java rename to hotspot/test/compiler/c2/Test7068051.java index 7f75fe6857d..408fd6f0b37 100644 --- a/hotspot/test/compiler/c2/7068051/Test7068051.java +++ b/hotspot/test/compiler/c2/Test7068051.java @@ -27,12 +27,14 @@ * @bug 7068051 * @summary SIGSEGV in PhaseIdealLoop::build_loop_late_post on T5440 * @library /testlibrary - * * @modules java.base/jdk.internal.misc * java.management - * @run main/othervm -showversion -Xbatch Test7068051 + * + * @run main/othervm -showversion -Xbatch compiler.c2.Test7068051 */ +package compiler.c2; + import jdk.test.lib.JDKToolLauncher; import jdk.test.lib.OutputAnalyzer; diff --git a/hotspot/test/compiler/c2/7110586/Test7110586.java b/hotspot/test/compiler/c2/Test7110586.java similarity index 97% rename from hotspot/test/compiler/c2/7110586/Test7110586.java rename to hotspot/test/compiler/c2/Test7110586.java index e40c903de8a..62d2f5d2a98 100644 --- a/hotspot/test/compiler/c2/7110586/Test7110586.java +++ b/hotspot/test/compiler/c2/Test7110586.java @@ -27,9 +27,11 @@ * @bug 7110586 * @summary C2 generates icorrect results * - * @run main/othervm -Xbatch Test7110586 + * @run main/othervm -Xbatch compiler.c2.Test7110586 */ +package compiler.c2; + public class Test7110586 { static int test1() { int i = 0; diff --git a/hotspot/test/compiler/c2/7125879/Test7125879.java b/hotspot/test/compiler/c2/Test7125879.java similarity index 95% rename from hotspot/test/compiler/c2/7125879/Test7125879.java rename to hotspot/test/compiler/c2/Test7125879.java index 729aac66939..a751c5ac7bb 100644 --- a/hotspot/test/compiler/c2/7125879/Test7125879.java +++ b/hotspot/test/compiler/c2/Test7125879.java @@ -27,9 +27,11 @@ * @bug 7125879 * @summary assert(proj != NULL) failed: must be found * - * @run main/othervm -Xcomp Test7125879 + * @run main/othervm -Xcomp compiler.c2.Test7125879 */ +package compiler.c2; + public class Test7125879 { String var_1 = "abc"; diff --git a/hotspot/test/compiler/c2/7160610/Test7160610.java b/hotspot/test/compiler/c2/Test7160610.java similarity index 97% rename from hotspot/test/compiler/c2/7160610/Test7160610.java rename to hotspot/test/compiler/c2/Test7160610.java index 62b2e6e14b9..31d71340f09 100644 --- a/hotspot/test/compiler/c2/7160610/Test7160610.java +++ b/hotspot/test/compiler/c2/Test7160610.java @@ -27,9 +27,11 @@ * @bug 7160610 * @summary Unknown Native Code compilation issue. * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-OptimizeFill Test7160610 + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-OptimizeFill compiler.c2.Test7160610 */ +package compiler.c2; + public class Test7160610 { private static final byte[] BYTE_ARRAY = new byte[7]; private static int[] anIntArray1190 = new int[32768]; diff --git a/hotspot/test/compiler/c2/7169782/Test7169782.java b/hotspot/test/compiler/c2/Test7169782.java similarity index 89% rename from hotspot/test/compiler/c2/7169782/Test7169782.java rename to hotspot/test/compiler/c2/Test7169782.java index 381c4c903fb..8fbb9c139d3 100644 --- a/hotspot/test/compiler/c2/7169782/Test7169782.java +++ b/hotspot/test/compiler/c2/Test7169782.java @@ -27,9 +27,13 @@ * @bug 7169782 * @summary C2: SIGSEGV in LShiftLNode::Ideal(PhaseGVN*, bool) * - * @run main/othervm -Xcomp -XX:CompileOnly="Test7169782::" Test7169782 + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.c2.Test7169782:: + * compiler.c2.Test7169782 */ +package compiler.c2; + public class Test7169782 { static long var_8; diff --git a/hotspot/test/compiler/c2/7174363/Test7174363.java b/hotspot/test/compiler/c2/Test7174363.java similarity index 89% rename from hotspot/test/compiler/c2/7174363/Test7174363.java rename to hotspot/test/compiler/c2/Test7174363.java index 50f784da1eb..77f2ff08c7f 100644 --- a/hotspot/test/compiler/c2/7174363/Test7174363.java +++ b/hotspot/test/compiler/c2/Test7174363.java @@ -27,10 +27,12 @@ * @bug 7174363 * @summary crash with Arrays.copyOfRange(original, from, to) when from > original.length * - * @run main/othervm -XX:-BackgroundCompilation Test7174363 + * @run main/othervm -XX:-BackgroundCompilation compiler.c2.Test7174363 */ -import java.util.*; +package compiler.c2; + +import java.util.Arrays; public class Test7174363 { @@ -43,7 +45,8 @@ public class Test7174363 { for (int i = 0; i < 20000; i++) { try { m(orig, 15, 20); - } catch(ArrayIndexOutOfBoundsException excp) {} + } catch (ArrayIndexOutOfBoundsException excp) { + } } } } diff --git a/hotspot/test/compiler/c2/7177917/Test7177917.java b/hotspot/test/compiler/c2/Test7177917.java similarity index 94% rename from hotspot/test/compiler/c2/7177917/Test7177917.java rename to hotspot/test/compiler/c2/Test7177917.java index 0713b27a6ed..6fe88a37bff 100644 --- a/hotspot/test/compiler/c2/7177917/Test7177917.java +++ b/hotspot/test/compiler/c2/Test7177917.java @@ -22,11 +22,20 @@ * */ -/* - * Micro-benchmark for Math.pow() and Math.exp() +/** + * @test + * @bug 7177917 + * @summary Micro-benchmark for Math.pow() and Math.exp() + * @modules java.base/jdk.internal.misc + * @library /testlibrary + * + * @run main compiler.c2.Test7177917 */ +package compiler.c2; + import jdk.test.lib.Utils; + import java.util.Random; public class Test7177917 { diff --git a/hotspot/test/compiler/c2/7179138/Test7179138_1.java b/hotspot/test/compiler/c2/Test7179138_1.java similarity index 96% rename from hotspot/test/compiler/c2/7179138/Test7179138_1.java rename to hotspot/test/compiler/c2/Test7179138_1.java index afa830731e3..6cdbed4e5bd 100644 --- a/hotspot/test/compiler/c2/7179138/Test7179138_1.java +++ b/hotspot/test/compiler/c2/Test7179138_1.java @@ -25,11 +25,15 @@ * @test * @bug 7179138 * @summary Incorrect result with String concatenation optimization - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation Test7179138_1 + * + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * compiler.c2.Test7179138_1 * * @author Skip Balk */ +package compiler.c2; + public class Test7179138_1 { public static void main(String[] args) throws Exception { System.out.println("Java Version: " + System.getProperty("java.vm.version")); diff --git a/hotspot/test/compiler/c2/7179138/Test7179138_2.java b/hotspot/test/compiler/c2/Test7179138_2.java similarity index 96% rename from hotspot/test/compiler/c2/7179138/Test7179138_2.java rename to hotspot/test/compiler/c2/Test7179138_2.java index 615c614fc30..4e89f6aced0 100644 --- a/hotspot/test/compiler/c2/7179138/Test7179138_2.java +++ b/hotspot/test/compiler/c2/Test7179138_2.java @@ -25,11 +25,15 @@ * @test * @bug 7179138 * @summary Incorrect result with String concatenation optimization - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation Test7179138_2 + * + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * compiler.c2.Test7179138_2 * * @author Skip Balk */ +package compiler.c2; + public class Test7179138_2 { public static void main(String[] args) throws Exception { System.out.println("Java Version: " + System.getProperty("java.vm.version")); diff --git a/hotspot/test/compiler/c2/Test7190310.java b/hotspot/test/compiler/c2/Test7190310.java new file mode 100644 index 00000000000..3e388e879ba --- /dev/null +++ b/hotspot/test/compiler/c2/Test7190310.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2012, 2013, 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 7190310 + * @summary Inlining WeakReference.get(), and hoisting $referent may lead to non-terminating loops + * + * @run main/othervm/timeout=600 -Xbatch compiler.c2.Test7190310 + */ + +/* + * Note bug exhibits as infinite loop, timeout is helpful. + * It should normally finish pretty quickly, but on some especially slow machines + * it may not. The companion _unsafe test lacks a timeout, but that is okay. + */ +package compiler.c2; + +import java.lang.ref.Reference; +import java.lang.ref.ReferenceQueue; +import java.lang.ref.WeakReference; + +public class Test7190310 { + private static Object str = new Object() { + public String toString() { + return "The Object"; + } + + protected void finalize() throws Throwable { + System.out.println("The Object is being finalized"); + super.finalize(); + } + }; + private final static ReferenceQueue rq = + new ReferenceQueue(); + private final static WeakReference wr = + new WeakReference(str, rq); + + public static void main(String[] args) + throws InterruptedException { + Thread reader = new Thread() { + public void run() { + while (wr.get() != null) { + } + System.out.println("wr.get() returned null"); + } + }; + + Thread queueReader = new Thread() { + public void run() { + try { + Reference ref = rq.remove(); + System.out.println(ref); + System.out.println("queueReader returned, ref==wr is " + + (ref == wr)); + } catch (InterruptedException e) { + System.err.println("Sleep interrupted - exiting"); + } + } + }; + + reader.start(); + queueReader.start(); + + Thread.sleep(1000); + str = null; + System.gc(); + } +} + diff --git a/hotspot/test/compiler/c2/Test7190310_unsafe.java b/hotspot/test/compiler/c2/Test7190310_unsafe.java new file mode 100644 index 00000000000..deaefb729ba --- /dev/null +++ b/hotspot/test/compiler/c2/Test7190310_unsafe.java @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2012, 2015, 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 7190310 + * @summary Inlining WeakReference.get(), and hoisting $referent may lead to non-terminating loops + * @modules java.base/jdk.internal.misc + * + * @run main/othervm -Xbatch compiler.c2.Test7190310_unsafe + */ + +package compiler.c2; + +import jdk.internal.misc.Unsafe; + +import java.lang.ref.Reference; +import java.lang.ref.WeakReference; +import java.lang.reflect.Field; + +public class Test7190310_unsafe { + + static class TestObject { + public String toString() { + return "TestObject"; + } + } + + ; + + private static TestObject str = new TestObject(); + private static final WeakReference ref = new WeakReference(str); + + private TestObject obj; + + public static void main(String[] args) throws Exception { + Class c = Test7190310_unsafe.class.getClassLoader().loadClass("jdk.internal.misc.Unsafe"); + Field f = c.getDeclaredField("theUnsafe"); + f.setAccessible(true); + Unsafe unsafe = (Unsafe) f.get(c); + + f = Reference.class.getDeclaredField("referent"); + f.setAccessible(true); + long referent_offset = unsafe.objectFieldOffset(f); + + Test7190310_unsafe t = new Test7190310_unsafe(); + TestObject o = new TestObject(); + t.obj = o; + + // Warmup (compile methods) + System.err.println("Warmup"); + Object obj = null; + for (int i = 0; i < 11000; i++) { + obj = getRef0(ref); + } + for (int i = 0; i < 11000; i++) { + obj = getRef1(unsafe, ref, referent_offset); + } + for (int i = 0; i < 11000; i++) { + obj = getRef2(unsafe, ref, referent_offset); + } + for (int i = 0; i < 11000; i++) { + obj = getRef3(unsafe, ref, referent_offset); + } + for (int i = 0; i < 11000; i++) { + obj = getRef4(unsafe, t, referent_offset); + } + + // Access verification + System.err.println("Verification"); + if (!verifyGet(referent_offset, unsafe)) { + System.exit(97); + } + + obj = getRef3(unsafe, t, referent_offset); + if (obj != o) { + System.out.println("FAILED: unsafe.getObject(Object, " + referent_offset + ") " + obj + " != " + o); + System.exit(97); + } + obj = getRef4(unsafe, t, referent_offset); + if (obj != o) { + System.out.println("FAILED: unsafe.getObject(Test7190310, " + referent_offset + ") " + obj + " != " + o); + System.exit(97); + } + } + + static boolean verifyGet(long referent_offset, Unsafe unsafe) throws Exception { + // Access verification + System.out.println("referent: " + str); + Object obj = getRef0(ref); + if (obj != str) { + System.out.println("FAILED: weakRef.get() " + obj + " != " + str); + return false; + } + obj = getRef1(unsafe, ref, referent_offset); + if (obj != str) { + System.out.println("FAILED: unsafe.getObject(weakRef, " + referent_offset + ") " + obj + " != " + str); + return false; + } + obj = getRef2(unsafe, ref, referent_offset); + if (obj != str) { + System.out.println("FAILED: unsafe.getObject(abstRef, " + referent_offset + ") " + obj + " != " + str); + return false; + } + obj = getRef3(unsafe, ref, referent_offset); + if (obj != str) { + System.out.println("FAILED: unsafe.getObject(Object, " + referent_offset + ") " + obj + " != " + str); + return false; + } + return true; + } + + static Object getRef0(WeakReference ref) throws Exception { + return ref.get(); + } + + static Object getRef1(Unsafe unsafe, WeakReference ref, long referent_offset) throws Exception { + return unsafe.getObject(ref, referent_offset); + } + + static Object getRef2(Unsafe unsafe, Reference ref, long referent_offset) throws Exception { + return unsafe.getObject(ref, referent_offset); + } + + static Object getRef3(Unsafe unsafe, Object ref, long referent_offset) throws Exception { + return unsafe.getObject(ref, referent_offset); + } + + static Object getRef4(Unsafe unsafe, Test7190310_unsafe ref, long referent_offset) throws Exception { + return unsafe.getObject(ref, referent_offset); + } +} + diff --git a/hotspot/test/compiler/c2/7199742/Test7199742.java b/hotspot/test/compiler/c2/Test7199742.java similarity index 67% rename from hotspot/test/compiler/c2/7199742/Test7199742.java rename to hotspot/test/compiler/c2/Test7199742.java index 7f29e96ccb5..a0ce4b03291 100644 --- a/hotspot/test/compiler/c2/7199742/Test7199742.java +++ b/hotspot/test/compiler/c2/Test7199742.java @@ -27,28 +27,32 @@ * @bug 7199742 * @summary A lot of C2 OSR compilations of the same method's bci * - * @run main/othervm -Xmx32m -Xbatch Test7199742 + * @run main/othervm -Xmx32m -Xbatch compiler.c2.Test7199742 */ +package compiler.c2; + public class Test7199742 { - private static final int ITERS = 10000000; - public static void main(String args[]) { - Test7199742 t = new Test7199742(); - for (int i=0; i<10; i++) { - test(t, 7); + private static final int ITERS = 10000000; + + public static void main(String args[]) { + Test7199742 t = new Test7199742(); + for (int i = 0; i < 10; i++) { + test(t, 7); + } } - } - static Test7199742 test(Test7199742 t, int m) { - int i = -(ITERS/2); - if (i == 0) return null; - Test7199742 v = null; - while(i < ITERS) { - if ((i&m) == 0) { - v = t; - } - i++; + + static Test7199742 test(Test7199742 t, int m) { + int i = -(ITERS / 2); + if (i == 0) return null; + Test7199742 v = null; + while (i < ITERS) { + if ((i & m) == 0) { + v = t; + } + i++; + } + return v; } - return v; - } } diff --git a/hotspot/test/compiler/c2/8000805/Test8000805.java b/hotspot/test/compiler/c2/Test8000805.java similarity index 62% rename from hotspot/test/compiler/c2/8000805/Test8000805.java rename to hotspot/test/compiler/c2/Test8000805.java index 0776f9254e8..8fee0890ae5 100644 --- a/hotspot/test/compiler/c2/8000805/Test8000805.java +++ b/hotspot/test/compiler/c2/Test8000805.java @@ -26,31 +26,35 @@ * @bug 8000805 * @summary JMM issue: short loads are non-atomic * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -Xcomp -XX:+PrintCompilation -XX:CompileOnly=Test8000805.loadS2LmaskFF,Test8000805.loadS2Lmask16,Test8000805.loadS2Lmask13,Test8000805.loadUS_signExt,Test8000805.loadB2L_mask8 Test8000805 + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -Xcomp + * -XX:+PrintCompilation + * -XX:CompileCommand=compileonly,compiler.c2.Test8000805::load* + * compiler.c2.Test8000805 */ +package compiler.c2; public class Test8000805 { - static long loadS2LmaskFF (short[] sa) { return sa[0] & 0xFF; } - static long loadS2LmaskFF_1 (short[] sa) { return sa[0] & 0xFF; } + static long loadS2LmaskFF (short[] sa) { return sa[0] & 0xFF; } + static long _loadS2LmaskFF (short[] sa) { return sa[0] & 0xFF; } - static long loadS2Lmask16 (short[] sa) { return sa[0] & 0xFFFE; } - static long loadS2Lmask16_1 (short[] sa) { return sa[0] & 0xFFFE; } + static long loadS2Lmask16 (short[] sa) { return sa[0] & 0xFFFE; } + static long _loadS2Lmask16 (short[] sa) { return sa[0] & 0xFFFE; } - static long loadS2Lmask13 (short[] sa) { return sa[0] & 0x0FFF; } - static long loadS2Lmask13_1 (short[] sa) { return sa[0] & 0x0FFF; } + static long loadS2Lmask13 (short[] sa) { return sa[0] & 0x0FFF; } + static long _loadS2Lmask13 (short[] sa) { return sa[0] & 0x0FFF; } - static int loadUS_signExt (char[] ca) { return (ca[0] << 16) >> 16; } - static int loadUS_signExt_1 (char[] ca) { return (ca[0] << 16) >> 16; } + static int loadUS_signExt (char[] ca) { return (ca[0] << 16) >> 16; } + static int _loadUS_signExt (char[] ca) { return (ca[0] << 16) >> 16; } - static long loadB2L_mask8 (byte[] ba) { return ba[0] & 0x55; } - static long loadB2L_mask8_1 (byte[] ba) { return ba[0] & 0x55; } + static long loadB2L_mask8 (byte[] ba) { return ba[0] & 0x55; } + static long _loadB2L_mask8 (byte[] ba) { return ba[0] & 0x55; } public static void main(String[] args) { for (int i = Byte.MIN_VALUE; i < Byte.MAX_VALUE; i++) { byte[] ba = new byte[] { (byte) i}; - { long v1 = loadB2L_mask8(ba); - long v2 = loadB2L_mask8_1(ba); + { long v1 = loadB2L_mask8(ba); + long v2 = _loadB2L_mask8(ba); if (v1 != v2) throw new InternalError(String.format("loadB2L_mask8 failed: %x != %x", v1, v2)); } } @@ -59,23 +63,23 @@ public class Test8000805 { short[] sa = new short[] { (short)i }; char[] ca = new char[] { (char)i }; - { long v1 = loadS2LmaskFF(sa); - long v2 = loadS2LmaskFF_1(sa); + { long v1 = loadS2LmaskFF(sa); + long v2 = _loadS2LmaskFF(sa); if (v1 != v2) throw new InternalError(String.format("loadS2LmaskFF failed: %x != %x", v1, v2)); } - { long v1 = loadS2Lmask16(sa); - long v2 = loadS2Lmask16_1(sa); + { long v1 = loadS2Lmask16(sa); + long v2 = _loadS2Lmask16(sa); if (v1 != v2) throw new InternalError(String.format("loadS2Lmask16 failed: %x != %x", v1, v2)); } - { long v1 = loadS2Lmask13(sa); - long v2 = loadS2Lmask13_1(sa); + { long v1 = loadS2Lmask13(sa); + long v2 = _loadS2Lmask13(sa); if (v1 != v2) throw new InternalError(String.format("loadS2Lmask13 failed: %x != %x", v1, v2)); } - { int v1 = loadUS_signExt(ca); - int v2 = loadUS_signExt_1(ca); + { int v1 = loadUS_signExt(ca); + int v2 = _loadUS_signExt(ca); if (v1 != v2) throw new InternalError(String.format("loadUS_signExt failed: %x != %x", v1, v2)); } } diff --git a/hotspot/test/compiler/c2/Test8002069.java b/hotspot/test/compiler/c2/Test8002069.java new file mode 100644 index 00000000000..5f19f5689af --- /dev/null +++ b/hotspot/test/compiler/c2/Test8002069.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2012, 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 8002069 + * @summary Assert failed in C2: assert(field->edge_count() > 0) failed: sanity + * + * @run main/othervm -Xmx32m -XX:+IgnoreUnrecognizedVMOptions -Xbatch + * -XX:CompileCommand=exclude,compiler.c2.Test8002069::dummy + * compiler.c2.Test8002069 + */ + +package compiler.c2; + +public class Test8002069 { + static abstract class O { + int f; + + public O() { + f = 5; + } + + abstract void put(int i); + + public int foo(int i) { + put(i); + return i; + } + } + + static class A extends O { + int[] a; + + public A(int s) { + a = new int[s]; + } + + public void put(int i) { + a[i % a.length] = i; + } + } + + static class B extends O { + int sz; + int[] a; + + public B(int s) { + sz = s; + a = new int[s]; + } + + public void put(int i) { + a[i % sz] = i; + } + } + + public static void main(String args[]) { + int sum = 0; + for (int i = 0; i < 8000; i++) { + sum += test1(i); + } + for (int i = 0; i < 100000; i++) { + sum += test2(i); + } + System.out.println("PASSED. sum = " + sum); + } + + private O o; + + private int foo(int i) { + return o.foo(i); + } + + static int test1(int i) { + Test8002069 t = new Test8002069(); + t.o = new A(5); + return t.foo(i); + } + + static int test2(int i) { + Test8002069 t = new Test8002069(); + t.o = new B(5); + dummy(i); + return t.foo(i); + } + + static int dummy(int i) { + return i * 2; + } +} + diff --git a/hotspot/test/compiler/c2/8004741/Test8004741.java b/hotspot/test/compiler/c2/Test8004741.java similarity index 94% rename from hotspot/test/compiler/c2/8004741/Test8004741.java rename to hotspot/test/compiler/c2/Test8004741.java index 7e64ff14d6e..f52a68e0090 100644 --- a/hotspot/test/compiler/c2/8004741/Test8004741.java +++ b/hotspot/test/compiler/c2/Test8004741.java @@ -25,11 +25,17 @@ * @test Test8004741.java * @bug 8004741 * @summary Missing compiled exception handle table entry for multidimensional array allocation - * @run main/othervm -Xmx64m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100 Test8004741 - * @run main/othervm -Xmx64m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers Test8004741 + * + * @run main/othervm -Xmx64m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions + * -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers + * -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100 + * compiler.c2.Test8004741 + * @run main/othervm -Xmx64m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions + * -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers + * compiler.c2.Test8004741 */ -import java.util.*; +package compiler.c2; public class Test8004741 extends Thread { diff --git a/hotspot/test/compiler/c2/8007294/Test8007294.java b/hotspot/test/compiler/c2/Test8007294.java similarity index 95% rename from hotspot/test/compiler/c2/8007294/Test8007294.java rename to hotspot/test/compiler/c2/Test8007294.java index a335ba7fe96..4f5295c1c85 100644 --- a/hotspot/test/compiler/c2/8007294/Test8007294.java +++ b/hotspot/test/compiler/c2/Test8007294.java @@ -26,10 +26,14 @@ * @bug 8007294 * @bug 8146999 * @summary ReduceFieldZeroing doesn't check for dependent load and can lead to incorrect execution - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline -XX:-UseOnStackReplacement -XX:-BackgroundCompilation Test8007294 * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline + * -XX:-UseOnStackReplacement -XX:-BackgroundCompilation + * compiler.c2.Test8007294 */ +package compiler.c2; + public class Test8007294 { int i1; diff --git a/hotspot/test/compiler/c2/8007722/Test8007722.java b/hotspot/test/compiler/c2/Test8007722.java similarity index 93% rename from hotspot/test/compiler/c2/8007722/Test8007722.java rename to hotspot/test/compiler/c2/Test8007722.java index 2e197a4797d..d01b91b810c 100644 --- a/hotspot/test/compiler/c2/8007722/Test8007722.java +++ b/hotspot/test/compiler/c2/Test8007722.java @@ -25,11 +25,14 @@ * @test * @bug 8007722 * @summary GetAndSetP's MachNode should capture bottom type - * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation Test8007722 * + * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation + * compiler.c2.Test8007722 */ -import java.util.concurrent.atomic.*; +package compiler.c2; + +import java.util.concurrent.atomic.AtomicReference; public class Test8007722 { diff --git a/hotspot/test/compiler/c2/6946040/TestCharShortByteSwap.java b/hotspot/test/compiler/c2/TestCharShortByteSwap.java similarity index 91% rename from hotspot/test/compiler/c2/6946040/TestCharShortByteSwap.java rename to hotspot/test/compiler/c2/TestCharShortByteSwap.java index cddbbd38491..280bbf57a58 100644 --- a/hotspot/test/compiler/c2/6946040/TestCharShortByteSwap.java +++ b/hotspot/test/compiler/c2/TestCharShortByteSwap.java @@ -26,9 +26,15 @@ * @test * @bug 6946040 * @summary Tests Character/Short.reverseBytes and their intrinsics implementation in the server compiler - * @run main/othervm -Xbatch -XX:CompileOnly=.testChar,.testShort TestCharShortByteSwap + * + * @run main/othervm -Xbatch + * -XX:CompileCommand=compileonly,compiler.c2.TestCharShortByteSwap::testChar + * -XX:CompileCommand=compileonly,compiler.c2.TestCharShortByteSwap::testShort + * compiler.c2.TestCharShortByteSwap */ +package compiler.c2; + // This test must run without any command line arguments. public class TestCharShortByteSwap { diff --git a/hotspot/test/compiler/c2/TestDominatingDeadCheckCast.java b/hotspot/test/compiler/c2/TestDominatingDeadCheckCast.java index 3c8f153a17c..9b2e724dbba 100644 --- a/hotspot/test/compiler/c2/TestDominatingDeadCheckCast.java +++ b/hotspot/test/compiler/c2/TestDominatingDeadCheckCast.java @@ -26,10 +26,15 @@ * @test * @bug 8149797 * @summary node replaced by dominating dead cast during parsing - * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:TypeProfileLevel=200 -XX:CompileCommand=dontinline,TestDominatingDeadCheckCast::not_inlined TestDominatingDeadCheckCast * + * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation + * -XX:TypeProfileLevel=200 + * -XX:CompileCommand=dontinline,compiler.c2.TestDominatingDeadCheckCast::not_inlined + * compiler.c2.TestDominatingDeadCheckCast */ +package compiler.c2; + public class TestDominatingDeadCheckCast { static class A { diff --git a/hotspot/test/compiler/c2/6921969/TestMultiplyLongHiZero.java b/hotspot/test/compiler/c2/TestMultiplyLongHiZero.java similarity index 88% rename from hotspot/test/compiler/c2/6921969/TestMultiplyLongHiZero.java rename to hotspot/test/compiler/c2/TestMultiplyLongHiZero.java index 3c295e077ff..07258892143 100644 --- a/hotspot/test/compiler/c2/6921969/TestMultiplyLongHiZero.java +++ b/hotspot/test/compiler/c2/TestMultiplyLongHiZero.java @@ -26,11 +26,20 @@ * @test * @bug 6921969 * @summary Tests shorter long multiply sequences when the high 32 bits of long operands are known to be zero on x86_32 - * @run main/othervm -Xbatch -XX:-Inline -XX:CompileOnly=.testNormal,.testLeftOptimized,.testRightOptimized,.testOptimized,.testLeftOptimized_LoadUI2L,.testRightOptimized_LoadUI2L,.testOptimized_LoadUI2L TestMultiplyLongHiZero + * @run main/othervm -Xbatch -XX:-Inline + * -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testNormal + * -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testLeftOptimized + * -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testRightOptimized + * -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testOptimized + * -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testLeftOptimized_LoadUI2L + * -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testRightOptimized_LoadUI2L + * -XX:CompileCommand=compileonly,compiler.c2.TestMultiplyLongHiZero::testOptimized_LoadUI2L + * compiler.c2.TestMultiplyLongHiZero */ -// This test must run without any command line arguments. +package compiler.c2; +// This test must run without any command line arguments. public class TestMultiplyLongHiZero { private static void check(long leftFactor, long rightFactor, long optimizedProduct, long constantProduct) { diff --git a/hotspot/test/compiler/c2/6340864/TestByteVect.java b/hotspot/test/compiler/c2/cr6340864/TestByteVect.java similarity index 99% rename from hotspot/test/compiler/c2/6340864/TestByteVect.java rename to hotspot/test/compiler/c2/cr6340864/TestByteVect.java index 5db3687e67c..b10453077a2 100644 --- a/hotspot/test/compiler/c2/6340864/TestByteVect.java +++ b/hotspot/test/compiler/c2/cr6340864/TestByteVect.java @@ -27,9 +27,11 @@ * @bug 6340864 * @summary Implement vectorization optimizations in hotspot-server * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestByteVect + * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr6340864.TestByteVect */ +package compiler.c2.cr6340864; + public class TestByteVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/c2/6340864/TestDoubleVect.java b/hotspot/test/compiler/c2/cr6340864/TestDoubleVect.java similarity index 99% rename from hotspot/test/compiler/c2/6340864/TestDoubleVect.java rename to hotspot/test/compiler/c2/cr6340864/TestDoubleVect.java index db0f460ddd3..adf143961c3 100644 --- a/hotspot/test/compiler/c2/6340864/TestDoubleVect.java +++ b/hotspot/test/compiler/c2/cr6340864/TestDoubleVect.java @@ -27,9 +27,11 @@ * @bug 6340864 * @summary Implement vectorization optimizations in hotspot-server * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestDoubleVect + * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr6340864.TestDoubleVect */ +package compiler.c2.cr6340864; + public class TestDoubleVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/c2/6340864/TestFloatVect.java b/hotspot/test/compiler/c2/cr6340864/TestFloatVect.java similarity index 99% rename from hotspot/test/compiler/c2/6340864/TestFloatVect.java rename to hotspot/test/compiler/c2/cr6340864/TestFloatVect.java index 63f517c665b..9940a3207fb 100644 --- a/hotspot/test/compiler/c2/6340864/TestFloatVect.java +++ b/hotspot/test/compiler/c2/cr6340864/TestFloatVect.java @@ -27,9 +27,11 @@ * @bug 6340864 * @summary Implement vectorization optimizations in hotspot-server * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestFloatVect + * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr6340864.TestFloatVect */ +package compiler.c2.cr6340864; + public class TestFloatVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/c2/6340864/TestIntVect.java b/hotspot/test/compiler/c2/cr6340864/TestIntVect.java similarity index 99% rename from hotspot/test/compiler/c2/6340864/TestIntVect.java rename to hotspot/test/compiler/c2/cr6340864/TestIntVect.java index 5866b34a5af..9f05bca3d7d 100644 --- a/hotspot/test/compiler/c2/6340864/TestIntVect.java +++ b/hotspot/test/compiler/c2/cr6340864/TestIntVect.java @@ -27,9 +27,11 @@ * @bug 6340864 * @summary Implement vectorization optimizations in hotspot-server * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestIntVect + * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr6340864.TestIntVect */ +package compiler.c2.cr6340864; + public class TestIntVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/c2/6340864/TestLongVect.java b/hotspot/test/compiler/c2/cr6340864/TestLongVect.java similarity index 99% rename from hotspot/test/compiler/c2/6340864/TestLongVect.java rename to hotspot/test/compiler/c2/cr6340864/TestLongVect.java index 436a8472df8..670576e2db1 100644 --- a/hotspot/test/compiler/c2/6340864/TestLongVect.java +++ b/hotspot/test/compiler/c2/cr6340864/TestLongVect.java @@ -27,9 +27,11 @@ * @bug 6340864 * @summary Implement vectorization optimizations in hotspot-server * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestLongVect + * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr6340864.TestLongVect */ +package compiler.c2.cr6340864; + public class TestLongVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/c2/6340864/TestShortVect.java b/hotspot/test/compiler/c2/cr6340864/TestShortVect.java similarity index 99% rename from hotspot/test/compiler/c2/6340864/TestShortVect.java rename to hotspot/test/compiler/c2/cr6340864/TestShortVect.java index 9f59c8f22cd..a5c0d4b85db 100644 --- a/hotspot/test/compiler/c2/6340864/TestShortVect.java +++ b/hotspot/test/compiler/c2/cr6340864/TestShortVect.java @@ -27,9 +27,11 @@ * @bug 6340864 * @summary Implement vectorization optimizations in hotspot-server * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestShortVect + * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr6340864.TestShortVect */ +package compiler.c2.cr6340864; + public class TestShortVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/c2/6589834/InlinedArrayCloneTestCase.java b/hotspot/test/compiler/c2/cr6589834/InlinedArrayCloneTestCase.java similarity index 99% rename from hotspot/test/compiler/c2/6589834/InlinedArrayCloneTestCase.java rename to hotspot/test/compiler/c2/cr6589834/InlinedArrayCloneTestCase.java index aadc1056323..9f23bdd76e4 100644 --- a/hotspot/test/compiler/c2/6589834/InlinedArrayCloneTestCase.java +++ b/hotspot/test/compiler/c2/cr6589834/InlinedArrayCloneTestCase.java @@ -21,6 +21,8 @@ * questions. */ +package compiler.c2.cr6589834; + public class InlinedArrayCloneTestCase implements Runnable { private Test_ia32 executionController; diff --git a/hotspot/test/compiler/c2/6589834/Test_ia32.java b/hotspot/test/compiler/c2/cr6589834/Test_ia32.java similarity index 83% rename from hotspot/test/compiler/c2/6589834/Test_ia32.java rename to hotspot/test/compiler/c2/cr6589834/Test_ia32.java index a9d11c62821..c6cf6510c57 100644 --- a/hotspot/test/compiler/c2/6589834/Test_ia32.java +++ b/hotspot/test/compiler/c2/cr6589834/Test_ia32.java @@ -26,27 +26,32 @@ * @bug 6589834 * @summary Safepoint placed between stack pointer increment and decrement leads * to interpreter's stack corruption after deoptimization. - * @library /testlibrary /test/lib + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor + * * @build ClassFileInstaller sun.hotspot.WhiteBox jdk.test.lib.* - * Test_ia32 InlinedArrayCloneTestCase - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * compiler.c2.cr6589834.Test_ia32 + * compiler.c2.cr6589834.InlinedArrayCloneTestCase + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:CompileOnly=InlinedArrayCloneTestCase - * -XX:CompileCommand=dontinline,InlinedArrayCloneTestCase.invokeArrayClone - * -XX:CompileCommand=inline,InlinedArrayCloneTestCase.verifyArguments - * -XX:+IgnoreUnrecognizedVMOptions -XX:+VerifyStack Test_ia32 + * -XX:+WhiteBoxAPI -XX:+IgnoreUnrecognizedVMOptions -XX:+VerifyStack + * -XX:CompileCommand=compileonly,compiler.c2.cr6589834.InlinedArrayCloneTestCase::* + * -XX:CompileCommand=dontinline,compiler.c2.cr6589834.InlinedArrayCloneTestCase::invokeArrayClone + * -XX:CompileCommand=inline,compiler.c2.cr6589834.InlinedArrayCloneTestCase::verifyArguments + * compiler.c2.cr6589834.Test_ia32 */ -import java.lang.reflect.Method; +package compiler.c2.cr6589834; import jdk.test.lib.Asserts; import sun.hotspot.WhiteBox; +import java.lang.reflect.Method; + public class Test_ia32 { private static final int NUM_THREADS = Math.min(100, 2 * Runtime.getRuntime().availableProcessors()); @@ -111,7 +116,7 @@ public class Test_ia32 { * dependency. */ try { - Class.forName("NotLoadedClass"); + Class.forName(Test_ia32.class.getPackage().getName() + ".NotLoadedClass"); } catch (ClassNotFoundException e) { throw new Error("Unable to load class that invalidates " + "CHA-dependency for method " + method.getName(), e); diff --git a/hotspot/test/compiler/c2/6646020/Tester.java b/hotspot/test/compiler/c2/cr6646020/Tester.java similarity index 99% rename from hotspot/test/compiler/c2/6646020/Tester.java rename to hotspot/test/compiler/c2/cr6646020/Tester.java index b9d5769bc81..76c6f2877a4 100644 --- a/hotspot/test/compiler/c2/6646020/Tester.java +++ b/hotspot/test/compiler/c2/cr6646020/Tester.java @@ -25,8 +25,12 @@ * @test * @bug 6646020 * @summary assert(in_bb(n),"must be in block") in -Xcomp mode + * + * @run main compiler.c2.cr6646020.Tester */ +package compiler.c2.cr6646020; + /* Complexity upper bound: 3361 ops */ class Tester_Class_0 { diff --git a/hotspot/test/compiler/c2/6663848/Tester.java b/hotspot/test/compiler/c2/cr6663848/Tester.java similarity index 99% rename from hotspot/test/compiler/c2/6663848/Tester.java rename to hotspot/test/compiler/c2/cr6663848/Tester.java index 972e6c6dd0c..5d1a9e1ed5a 100644 --- a/hotspot/test/compiler/c2/6663848/Tester.java +++ b/hotspot/test/compiler/c2/cr6663848/Tester.java @@ -25,8 +25,11 @@ * @test * @bug 6663848 * @summary assert(i < Max(),"oob") + * + * @run main compiler.c2.cr6663848.Tester */ +package compiler.c2.cr6663848; /* Complexity upper bound: 296055 ops */ final class Tester_Class_0 { diff --git a/hotspot/test/compiler/c2/6663854/Test6663854.java b/hotspot/test/compiler/c2/cr6663854/Test6663854.java similarity index 99% rename from hotspot/test/compiler/c2/6663854/Test6663854.java rename to hotspot/test/compiler/c2/cr6663854/Test6663854.java index 9cbdbed6083..26aad09eb76 100644 --- a/hotspot/test/compiler/c2/6663854/Test6663854.java +++ b/hotspot/test/compiler/c2/cr6663854/Test6663854.java @@ -27,9 +27,10 @@ * @bug 6663854 * @summary assert(n != __null,"Bad immediate dominator info.") in C2 with -Xcomp * - * @run main/othervm -Xcomp Test6663854 + * @run main/othervm -Xcomp compiler.c2.cr6663854.Test6663854 */ +package compiler.c2.cr6663854; // This is a randomly generated test that exposed a crash so don't try // to make sense of what's it's doing. The output produced is likely // to be stable but it is not being checked as part of this test. diff --git a/hotspot/test/compiler/c2/6711117/Test.java b/hotspot/test/compiler/c2/cr6711117/Test.java similarity index 99% rename from hotspot/test/compiler/c2/6711117/Test.java rename to hotspot/test/compiler/c2/cr6711117/Test.java index 0b67f053762..b5a2f6d68b1 100644 --- a/hotspot/test/compiler/c2/6711117/Test.java +++ b/hotspot/test/compiler/c2/cr6711117/Test.java @@ -26,9 +26,14 @@ * @test * @bug 6711117 * @summary Assertion in 64bit server vm (flat != TypePtr::BOTTOM,"cannot alias-analyze an untyped ptr") - * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+AggressiveOpts -XX:+UseCompressedOops Test + * + * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+AggressiveOpts + * -XX:+UseCompressedOops + * compiler.c2.cr6711117.Test */ +package compiler.c2.cr6711117; + final class Test_Class_0 { final static char var_1 = 'E'; short var_2 = 16213; diff --git a/hotspot/test/compiler/c2/6712835/Test6712835.java b/hotspot/test/compiler/c2/cr6712835/Test6712835.java similarity index 99% rename from hotspot/test/compiler/c2/6712835/Test6712835.java rename to hotspot/test/compiler/c2/cr6712835/Test6712835.java index eee860ab08d..efaeeb7c32e 100644 --- a/hotspot/test/compiler/c2/6712835/Test6712835.java +++ b/hotspot/test/compiler/c2/cr6712835/Test6712835.java @@ -25,9 +25,12 @@ * @test * @bug 6712835 * @summary Server compiler fails with assertion (loop_count < K,"infinite loop in PhaseIterGVN::transform") - * @run main/othervm -Xcomp Test6712835 + * + * @run main/othervm -Xcomp compiler.c2.cr6712835.Test6712835 */ +package compiler.c2.cr6712835; + /* Complexity upper bound: 349851 ops */ abstract class Tester_Class_0 { diff --git a/hotspot/test/compiler/c2/6714694/Tester.java b/hotspot/test/compiler/c2/cr6714694/Tester.java similarity index 99% rename from hotspot/test/compiler/c2/6714694/Tester.java rename to hotspot/test/compiler/c2/cr6714694/Tester.java index 65f2ed2831f..dd7690f25cf 100644 --- a/hotspot/test/compiler/c2/6714694/Tester.java +++ b/hotspot/test/compiler/c2/cr6714694/Tester.java @@ -25,9 +25,11 @@ * @test * @bug 6714694 * @summary assertion in 64bit server vm (store->find_edge(load) != -1,"missing precedence edge") with COOPs - * @run main/othervm -Xcomp Tester + * + * @run main/othervm -Xcomp compiler.c2.cr6714694.Tester */ +package compiler.c2.cr6714694; /* Complexity upper bound: 38602 ops */ interface Tester_Interface_0 { diff --git a/hotspot/test/compiler/c2/6865031/Test.java b/hotspot/test/compiler/c2/cr6865031/Test.java similarity index 98% rename from hotspot/test/compiler/c2/6865031/Test.java rename to hotspot/test/compiler/c2/cr6865031/Test.java index 4f9db19d1d8..71689eaca18 100644 --- a/hotspot/test/compiler/c2/6865031/Test.java +++ b/hotspot/test/compiler/c2/cr6865031/Test.java @@ -26,9 +26,15 @@ * @test * @bug 6865031 * @summary Application gives bad result (throws bad exception) with compressed oops - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:HeapBaseMinAddress=32g -XX:-LoopUnswitching -XX:CompileCommand=inline,AbstractMemoryEfficientList.equals Test hello goodbye + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops + * -XX:HeapBaseMinAddress=32g -XX:-LoopUnswitching + * -XX:CompileCommand=inline,compiler.c2.cr6865031.AbstractMemoryEfficientList::equals + * compiler.c2.cr6865031.Test hello goodbye */ +package compiler.c2.cr6865031; + import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; import java.util.ArrayList; diff --git a/hotspot/test/compiler/c2/5091921/Test6890943.java b/hotspot/test/compiler/c2/cr6890943/Test6890943.java similarity index 97% rename from hotspot/test/compiler/c2/5091921/Test6890943.java rename to hotspot/test/compiler/c2/cr6890943/Test6890943.java index 9752b1d0c2b..605e9ff5c60 100644 --- a/hotspot/test/compiler/c2/5091921/Test6890943.java +++ b/hotspot/test/compiler/c2/cr6890943/Test6890943.java @@ -27,10 +27,13 @@ * @bug 6890943 * @summary JVM mysteriously gives wrong result on 64-bit 1.6 VMs in hotspot mode. * - * @run main/othervm/timeout=240 Test6890943 + * @run main/othervm/timeout=240 compiler.c2.cr6890943.Test6890943 */ -import java.io.*; +package compiler.c2.cr6890943; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.HashMap; diff --git a/hotspot/test/compiler/c2/5091921/input6890943.txt b/hotspot/test/compiler/c2/cr6890943/input6890943.txt similarity index 100% rename from hotspot/test/compiler/c2/5091921/input6890943.txt rename to hotspot/test/compiler/c2/cr6890943/input6890943.txt diff --git a/hotspot/test/compiler/c2/5091921/output6890943.txt b/hotspot/test/compiler/c2/cr6890943/output6890943.txt similarity index 100% rename from hotspot/test/compiler/c2/5091921/output6890943.txt rename to hotspot/test/compiler/c2/cr6890943/output6890943.txt diff --git a/hotspot/test/compiler/c2/5091921/Test7005594.java b/hotspot/test/compiler/c2/cr7005594/Test7005594.java similarity index 98% rename from hotspot/test/compiler/c2/5091921/Test7005594.java rename to hotspot/test/compiler/c2/cr7005594/Test7005594.java index 32e8bae93a4..0dbe8271cb3 100644 --- a/hotspot/test/compiler/c2/5091921/Test7005594.java +++ b/hotspot/test/compiler/c2/cr7005594/Test7005594.java @@ -30,6 +30,8 @@ * @run shell Test7005594.sh */ +package compiler.c2.cr7005594; + public class Test7005594 { static int test(byte a[]){ diff --git a/hotspot/test/compiler/c2/5091921/Test7005594.sh b/hotspot/test/compiler/c2/cr7005594/Test7005594.sh similarity index 93% rename from hotspot/test/compiler/c2/5091921/Test7005594.sh rename to hotspot/test/compiler/c2/cr7005594/Test7005594.sh index 6350a08ac9b..503d0aa40b0 100644 --- a/hotspot/test/compiler/c2/5091921/Test7005594.sh +++ b/hotspot/test/compiler/c2/cr7005594/Test7005594.sh @@ -78,7 +78,10 @@ cp ${TESTSRC}/Test7005594.sh . ${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} -d . Test7005594.java -${TESTJAVA}/bin/java ${TESTOPTS} -Xmx1600m -Xms1600m -XX:+IgnoreUnrecognizedVMOptions -XX:-ZapUnusedHeapArea -Xcomp -XX:CompileOnly=Test7005594.test -XX:CompileCommand=quiet Test7005594 > test.out 2>&1 +${TESTJAVA}/bin/java ${TESTOPTS} -Xmx1600m -Xms1600m -XX:+IgnoreUnrecognizedVMOptions \ + -XX:-ZapUnusedHeapArea -Xcomp -XX:CompileCommand=quiet \ + -XX:CompileOnly=compiler.c2.cr7005594.Test7005594::test \ + compiler.c2.cr7005594.Test7005594 > test.out 2>&1 result=$? diff --git a/hotspot/test/compiler/c2/7192963/TestByteVect.java b/hotspot/test/compiler/c2/cr7192963/TestByteVect.java similarity index 98% rename from hotspot/test/compiler/c2/7192963/TestByteVect.java rename to hotspot/test/compiler/c2/cr7192963/TestByteVect.java index fd466fffe0a..208a9aa4cd5 100644 --- a/hotspot/test/compiler/c2/7192963/TestByteVect.java +++ b/hotspot/test/compiler/c2/cr7192963/TestByteVect.java @@ -27,9 +27,11 @@ * @bug 7192963 * @summary assert(_in[req-1] == this) failed: Must pass arg count to 'new' * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestByteVect + * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr7192963.TestByteVect */ +package compiler.c2.cr7192963; + public class TestByteVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/c2/7192963/TestDoubleVect.java b/hotspot/test/compiler/c2/cr7192963/TestDoubleVect.java similarity index 97% rename from hotspot/test/compiler/c2/7192963/TestDoubleVect.java rename to hotspot/test/compiler/c2/cr7192963/TestDoubleVect.java index 872eb42ecd9..f969cf79fbf 100644 --- a/hotspot/test/compiler/c2/7192963/TestDoubleVect.java +++ b/hotspot/test/compiler/c2/cr7192963/TestDoubleVect.java @@ -27,9 +27,11 @@ * @bug 7192963 * @summary assert(_in[req-1] == this) failed: Must pass arg count to 'new' * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestDoubleVect + * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr7192963.TestDoubleVect */ +package compiler.c2.cr7192963; + public class TestDoubleVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/c2/7192963/TestFloatVect.java b/hotspot/test/compiler/c2/cr7192963/TestFloatVect.java similarity index 97% rename from hotspot/test/compiler/c2/7192963/TestFloatVect.java rename to hotspot/test/compiler/c2/cr7192963/TestFloatVect.java index 399e68e7a66..d608deffde0 100644 --- a/hotspot/test/compiler/c2/7192963/TestFloatVect.java +++ b/hotspot/test/compiler/c2/cr7192963/TestFloatVect.java @@ -27,9 +27,11 @@ * @bug 7192963 * @summary assert(_in[req-1] == this) failed: Must pass arg count to 'new' * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestFloatVect + * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr7192963.TestFloatVect */ +package compiler.c2.cr7192963; + public class TestFloatVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/c2/7192963/TestIntVect.java b/hotspot/test/compiler/c2/cr7192963/TestIntVect.java similarity index 97% rename from hotspot/test/compiler/c2/7192963/TestIntVect.java rename to hotspot/test/compiler/c2/cr7192963/TestIntVect.java index b1bb1475fc1..d9f25abe74a 100644 --- a/hotspot/test/compiler/c2/7192963/TestIntVect.java +++ b/hotspot/test/compiler/c2/cr7192963/TestIntVect.java @@ -27,9 +27,11 @@ * @bug 7192963 * @summary assert(_in[req-1] == this) failed: Must pass arg count to 'new' * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestIntVect + * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr7192963.TestIntVect */ +package compiler.c2.cr7192963; + public class TestIntVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/c2/7192963/TestLongVect.java b/hotspot/test/compiler/c2/cr7192963/TestLongVect.java similarity index 98% rename from hotspot/test/compiler/c2/7192963/TestLongVect.java rename to hotspot/test/compiler/c2/cr7192963/TestLongVect.java index 7266352eac2..d0f2eba1c00 100644 --- a/hotspot/test/compiler/c2/7192963/TestLongVect.java +++ b/hotspot/test/compiler/c2/cr7192963/TestLongVect.java @@ -27,9 +27,11 @@ * @bug 7192963 * @summary assert(_in[req-1] == this) failed: Must pass arg count to 'new' * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestLongVect + * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr7192963.TestLongVect */ +package compiler.c2.cr7192963; + public class TestLongVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/c2/7192963/TestShortVect.java b/hotspot/test/compiler/c2/cr7192963/TestShortVect.java similarity index 98% rename from hotspot/test/compiler/c2/7192963/TestShortVect.java rename to hotspot/test/compiler/c2/cr7192963/TestShortVect.java index f83e5ffb5aa..ae0dcf31544 100644 --- a/hotspot/test/compiler/c2/7192963/TestShortVect.java +++ b/hotspot/test/compiler/c2/cr7192963/TestShortVect.java @@ -27,9 +27,11 @@ * @bug 7192963 * @summary assert(_in[req-1] == this) failed: Must pass arg count to 'new' * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestShortVect + * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.c2.cr7192963.TestShortVect */ +package compiler.c2.cr7192963; + public class TestShortVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/c2/7200264/Test7200264.sh b/hotspot/test/compiler/c2/cr7200264/Test7200264.sh similarity index 96% rename from hotspot/test/compiler/c2/7200264/Test7200264.sh rename to hotspot/test/compiler/c2/cr7200264/Test7200264.sh index df2d1babc01..7848bff2d70 100644 --- a/hotspot/test/compiler/c2/7200264/Test7200264.sh +++ b/hotspot/test/compiler/c2/cr7200264/Test7200264.sh @@ -56,7 +56,9 @@ cp ${TESTSRC}${FS}TestIntVect.java . ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} -d . TestIntVect.java # CICompilerCount must be at least 2 with -TieredCompilation -${TESTJAVA}${FS}bin${FS}java ${TESTOPTS} -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=2 -XX:+PrintCompilation -XX:+TraceNewVectors TestIntVect > test.out 2>&1 +${TESTJAVA}${FS}bin${FS}java ${TESTOPTS} -Xbatch -XX:-TieredCompilation \ + -XX:CICompilerCount=2 -XX:+PrintCompilation -XX:+TraceNewVectors \ + compiler.c2.cr7200264.TestIntVect > test.out 2>&1 COUNT=`grep AddVI test.out | wc -l | awk '{print $1}'` if [ $COUNT -lt 4 ] diff --git a/hotspot/test/compiler/c2/7200264/TestIntVect.java b/hotspot/test/compiler/c2/cr7200264/TestIntVect.java similarity index 99% rename from hotspot/test/compiler/c2/7200264/TestIntVect.java rename to hotspot/test/compiler/c2/cr7200264/TestIntVect.java index f85d4ff395e..1a248157520 100644 --- a/hotspot/test/compiler/c2/7200264/TestIntVect.java +++ b/hotspot/test/compiler/c2/cr7200264/TestIntVect.java @@ -30,6 +30,7 @@ * @run shell Test7200264.sh */ +package compiler.c2.cr7200264; /* * Copy of test/compiler/6340864/TestIntVect.java without performance tests. */ diff --git a/hotspot/test/compiler/c2/8004867/TestIntAtomicCAS.java b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicCAS.java similarity index 99% rename from hotspot/test/compiler/c2/8004867/TestIntAtomicCAS.java rename to hotspot/test/compiler/c2/cr8004867/TestIntAtomicCAS.java index 16d7d979761..fa2fafbb193 100644 --- a/hotspot/test/compiler/c2/8004867/TestIntAtomicCAS.java +++ b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicCAS.java @@ -27,10 +27,16 @@ * @bug 8004867 * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob" * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntAtomicCAS - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntAtomicCAS + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -XX:-OptimizeFill + * compiler.c2.cr8004867.TestIntAtomicCAS + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -XX:+OptimizeFill + * compiler.c2.cr8004867.TestIntAtomicCAS */ +package compiler.c2.cr8004867; + import java.util.concurrent.atomic.AtomicIntegerArray; public class TestIntAtomicCAS { diff --git a/hotspot/test/compiler/c2/8004867/TestIntAtomicOrdered.java b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicOrdered.java similarity index 99% rename from hotspot/test/compiler/c2/8004867/TestIntAtomicOrdered.java rename to hotspot/test/compiler/c2/cr8004867/TestIntAtomicOrdered.java index 8e81f6cde46..d7f115183e7 100644 --- a/hotspot/test/compiler/c2/8004867/TestIntAtomicOrdered.java +++ b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicOrdered.java @@ -27,10 +27,16 @@ * @bug 8004867 * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob" * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntAtomicOrdered - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntAtomicOrdered + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -XX:-OptimizeFill + * compiler.c2.cr8004867.TestIntAtomicOrdered + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -XX:+OptimizeFill + * compiler.c2.cr8004867.TestIntAtomicOrdered */ +package compiler.c2.cr8004867; + import java.util.concurrent.atomic.AtomicIntegerArray; public class TestIntAtomicOrdered { diff --git a/hotspot/test/compiler/c2/8004867/TestIntAtomicVolatile.java b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicVolatile.java similarity index 99% rename from hotspot/test/compiler/c2/8004867/TestIntAtomicVolatile.java rename to hotspot/test/compiler/c2/cr8004867/TestIntAtomicVolatile.java index ed0563de4c0..6b1a06756b9 100644 --- a/hotspot/test/compiler/c2/8004867/TestIntAtomicVolatile.java +++ b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicVolatile.java @@ -27,10 +27,16 @@ * @bug 8004867 * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob" * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntAtomicVolatile - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntAtomicVolatile + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -XX:-OptimizeFill + * compiler.c2.cr8004867.TestIntAtomicVolatile + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -XX:+OptimizeFill + * compiler.c2.cr8004867.TestIntAtomicVolatile */ +package compiler.c2.cr8004867; + import java.util.concurrent.atomic.AtomicIntegerArray; public class TestIntAtomicVolatile { diff --git a/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java similarity index 99% rename from hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java rename to hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java index a405f5608cf..4499ed5b981 100644 --- a/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java +++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java @@ -26,14 +26,21 @@ * @test * @bug 8004867 * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob" - * * @modules java.base/jdk.internal.misc - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntUnsafeCAS - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeCAS + * + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -XX:-OptimizeFill + * compiler.c2.cr8004867.TestIntUnsafeCAS + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -XX:+OptimizeFill + * compiler.c2.cr8004867.TestIntUnsafeCAS */ +package compiler.c2.cr8004867; + import jdk.internal.misc.Unsafe; -import java.lang.reflect.*; + +import java.lang.reflect.Field; public class TestIntUnsafeCAS { private static final int ARRLEN = 97; diff --git a/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java similarity index 99% rename from hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java rename to hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java index 3fec4bd9a7b..3298e1ba94d 100644 --- a/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java +++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java @@ -26,13 +26,20 @@ * @test * @bug 8004867 * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob" - * * @modules java.base/jdk.internal.misc - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntUnsafeOrdered - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeOrdered + * + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -XX:-OptimizeFill + * compiler.c2.cr8004867.TestIntUnsafeOrdered + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -XX:+OptimizeFill + * compiler.c2.cr8004867.TestIntUnsafeOrdered */ +package compiler.c2.cr8004867; + import jdk.internal.misc.Unsafe; + import java.lang.reflect.Field; public class TestIntUnsafeOrdered { diff --git a/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java similarity index 99% rename from hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java rename to hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java index 6cbab7a42c3..6bcd3983a7f 100644 --- a/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java +++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java @@ -26,14 +26,21 @@ * @test * @bug 8004867 * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob" - * * @modules java.base/jdk.internal.misc - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntUnsafeVolatile - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeVolatile + * + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -XX:-OptimizeFill + * compiler.c2.cr8004867.TestIntUnsafeVolatile + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -XX:+OptimizeFill + * compiler.c2.cr8004867.TestIntUnsafeVolatile */ +package compiler.c2.cr8004867; + import jdk.internal.misc.Unsafe; -import java.lang.reflect.*; + +import java.lang.reflect.Field; public class TestIntUnsafeVolatile { private static final int ARRLEN = 97; diff --git a/hotspot/test/compiler/c2/7070134/Stemmer.java b/hotspot/test/compiler/c2/stemmer/Stemmer.java similarity index 98% rename from hotspot/test/compiler/c2/7070134/Stemmer.java rename to hotspot/test/compiler/c2/stemmer/Stemmer.java index b8dbc053c61..0f8cb297010 100644 --- a/hotspot/test/compiler/c2/7070134/Stemmer.java +++ b/hotspot/test/compiler/c2/stemmer/Stemmer.java @@ -4,8 +4,9 @@ * @summary Hotspot crashes with sigsegv from PorterStemmer * @modules java.base/jdk.internal.misc * @library /testlibrary + * * @run driver jdk.test.lib.FileInstaller words words - * @run main/othervm -Xbatch Stemmer words + * @run main/othervm -Xbatch compiler.c2.stemmer.Stemmer words */ /* @@ -53,7 +54,11 @@ */ -import java.io.*; +package compiler.c2.stemmer; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; /** * Stemmer, implementing the Porter Stemming Algorithm diff --git a/hotspot/test/compiler/c2/7070134/words b/hotspot/test/compiler/c2/stemmer/words similarity index 100% rename from hotspot/test/compiler/c2/7070134/words rename to hotspot/test/compiler/c2/stemmer/words diff --git a/hotspot/test/compiler/native/TestDirtyInt.java b/hotspot/test/compiler/calls/TestDirtyInt.java similarity index 95% rename from hotspot/test/compiler/native/TestDirtyInt.java rename to hotspot/test/compiler/calls/TestDirtyInt.java index 607fd2d491c..ee89177f6d1 100644 --- a/hotspot/test/compiler/native/TestDirtyInt.java +++ b/hotspot/test/compiler/calls/TestDirtyInt.java @@ -22,8 +22,12 @@ */ /* @test - * @run main/native TestDirtyInt + + * @run main/native compiler.calls.TestDirtyInt */ + +package compiler.calls; + public class TestDirtyInt { static { System.loadLibrary("TestDirtyInt"); diff --git a/hotspot/test/compiler/calls/common/CallsBase.java b/hotspot/test/compiler/calls/common/CallsBase.java index f6a9ad93f23..44549a3a740 100644 --- a/hotspot/test/compiler/calls/common/CallsBase.java +++ b/hotspot/test/compiler/calls/common/CallsBase.java @@ -24,11 +24,12 @@ package compiler.calls.common; import compiler.testlibrary.CompilerUtils; -import java.lang.reflect.Method; -import java.util.Arrays; import jdk.test.lib.Asserts; import sun.hotspot.WhiteBox; +import java.lang.reflect.Method; +import java.util.Arrays; + /** * A common class for Invoke* classes */ diff --git a/hotspot/test/compiler/calls/common/InvokeDynamicPatcher.java b/hotspot/test/compiler/calls/common/InvokeDynamicPatcher.java index 644f0a21b6e..f38c949adff 100644 --- a/hotspot/test/compiler/calls/common/InvokeDynamicPatcher.java +++ b/hotspot/test/compiler/calls/common/InvokeDynamicPatcher.java @@ -23,6 +23,14 @@ package compiler.calls.common; +import jdk.internal.org.objectweb.asm.ClassReader; +import jdk.internal.org.objectweb.asm.ClassVisitor; +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.Handle; +import jdk.internal.org.objectweb.asm.Label; +import jdk.internal.org.objectweb.asm.MethodVisitor; +import jdk.internal.org.objectweb.asm.Opcodes; + import java.io.FileInputStream; import java.io.IOException; import java.lang.invoke.CallSite; @@ -33,13 +41,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; -import jdk.internal.org.objectweb.asm.ClassReader; -import jdk.internal.org.objectweb.asm.ClassVisitor; -import jdk.internal.org.objectweb.asm.ClassWriter; -import jdk.internal.org.objectweb.asm.Handle; -import jdk.internal.org.objectweb.asm.Label; -import jdk.internal.org.objectweb.asm.MethodVisitor; -import jdk.internal.org.objectweb.asm.Opcodes; /** * A class which patch InvokeDynamic class bytecode with invokydynamic diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java index 3124d3deb4a..0ba2498b8a8 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java @@ -23,11 +23,13 @@ /* * @test + * @summary check calls from compiled to compiled using InvokeDynamic * @library /test/lib /testlibrary / * @modules java.base/jdk.internal.misc - * @modules java.base/jdk.internal.org.objectweb.asm + * java.base/jdk.internal.org.objectweb.asm + * * @build compiler.calls.common.InvokeDynamic - * @build compiler.calls.common.InvokeDynamicPatcher + * compiler.calls.common.InvokeDynamicPatcher * @run main compiler.calls.common.InvokeDynamicPatcher * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -43,5 +45,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch compiler.calls.common.InvokeDynamic * -compileCaller 4 -checkCallerCompileLevel 4 -compileCallee 4 -checkCalleeCompileLevel 4 - * @summary check calls from compiled to compiled using InvokeDynamic */ diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java index 49162205a31..98a86b15360 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java @@ -23,9 +23,11 @@ /* * @test + * @summary check calls from compiled to interpreted using InvokeDynamic * @library /test/lib /testlibrary / * @modules java.base/jdk.internal.misc - * @modules java.base/jdk.internal.org.objectweb.asm + * java.base/jdk.internal.org.objectweb.asm + * * @build compiler.calls.common.InvokeDynamic * @build compiler.calls.common.InvokeDynamicPatcher * @run main compiler.calls.common.InvokeDynamicPatcher @@ -37,5 +39,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch -XX:CompileCommand=exclude,compiler.calls.common.InvokeDynamic::callee compiler.calls.common.InvokeDynamic * -compileCaller 4 -checkCallerCompileLevel 4 -checkCalleeCompileLevel 0 - * @summary check calls from compiled to interpreted using InvokeDynamic */ diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java index 37216320574..397faf23229 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java @@ -23,11 +23,13 @@ /* * @test + * @summary check calls from compiled to native using InvokeDynamic * @library /test/lib /testlibrary / * @modules java.base/jdk.internal.misc - * @modules java.base/jdk.internal.org.objectweb.asm + * java.base/jdk.internal.org.objectweb.asm + * * @build compiler.calls.common.InvokeDynamic - * @build compiler.calls.common.InvokeDynamicPatcher + * compiler.calls.common.InvokeDynamicPatcher * @run main compiler.calls.common.InvokeDynamicPatcher * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -37,5 +39,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch compiler.calls.common.InvokeDynamic * -compileCaller 4 -checkCallerCompileLevel 4 -nativeCallee - * @summary check calls from compiled to native using InvokeDynamic */ diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2CompiledTest.java index 34f86cda1af..46667c9e794 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2CompiledTest.java @@ -24,7 +24,9 @@ /* * @test * @modules java.base/jdk.internal.misc + * @summary check calls from compiled to compiled using InvokeInterface * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeInterface * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -40,5 +42,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch compiler.calls.common.InvokeInterface * -compileCaller 4 -checkCallerCompileLevel 4 -compileCallee 4 -checkCalleeCompileLevel 4 - * @summary check calls from compiled to compiled using InvokeInterface */ diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2InterpretedTest.java index fb3021022de..07fcff14d2c 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2InterpretedTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from compiled to interpreted using InvokeInterface * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeInterface * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -34,5 +36,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch -XX:CompileCommand=exclude,compiler.calls.common.InvokeInterface::callee compiler.calls.common.InvokeInterface * -compileCaller 4 -checkCallerCompileLevel 4 -checkCalleeCompileLevel 0 - * @summary check calls from compiled to interpreted using InvokeInterface */ diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2NativeTest.java index a930528651b..e3a68951d30 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2NativeTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2NativeTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from compiled to native using InvokeInterface * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeInterface * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -34,5 +36,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch compiler.calls.common.InvokeInterface * -compileCaller 4 -checkCallerCompileLevel 4 -nativeCallee - * @summary check calls from compiled to native using InvokeInterface */ diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2CompiledTest.java index 39648e75aad..07e6fc906ec 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2CompiledTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from compiled to compiled using InvokeSpecial * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -40,5 +42,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch compiler.calls.common.InvokeSpecial * -compileCaller 4 -checkCallerCompileLevel 4 -compileCallee 4 -checkCalleeCompileLevel 4 - * @summary check calls from compiled to compiled using InvokeSpecial */ diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2InterpretedTest.java index 25cac6bb36c..e08784dc1df 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2InterpretedTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from compiled to interpreted using InvokeSpecial * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -34,5 +36,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch -XX:CompileCommand=exclude,compiler.calls.common.InvokeSpecial::callee compiler.calls.common.InvokeSpecial * -compileCaller 4 -checkCallerCompileLevel 4 -checkCalleeCompileLevel 0 - * @summary check calls from compiled to interpreted using InvokeSpecial */ diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2NativeTest.java index e30115a36e8..600301b3e01 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2NativeTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2NativeTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from compiled to native using InvokeSpecial * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -34,5 +36,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch compiler.calls.common.InvokeSpecial * -compileCaller 4 -checkCallerCompileLevel 4 -nativeCallee - * @summary check calls from compiled to native using InvokeSpecial */ diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2CompiledTest.java index 8cda5e0af26..ddd88ab72df 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2CompiledTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from compiled to compiled using InvokeStatic * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -40,5 +42,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch compiler.calls.common.InvokeStatic * -compileCaller 4 -checkCallerCompileLevel 4 -compileCallee 4 -checkCalleeCompileLevel 4 - * @summary check calls from compiled to compiled using InvokeStatic */ diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2InterpretedTest.java index 1d998e09274..7ca6263ca59 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2InterpretedTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from compiled to interpreted using InvokeStatic * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -34,5 +36,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch -XX:CompileCommand=exclude,compiler.calls.common.InvokeStatic::callee compiler.calls.common.InvokeStatic * -compileCaller 4 -checkCallerCompileLevel 4 -checkCalleeCompileLevel 0 - * @summary check calls from compiled to interpreted using InvokeStatic */ diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2NativeTest.java index a0c8009b637..560c8079cd5 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2NativeTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2NativeTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from compiled to native using InvokeStatic * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -34,5 +36,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch compiler.calls.common.InvokeStatic * -compileCaller 4 -checkCallerCompileLevel 4 -nativeCallee - * @summary check calls from compiled to native using InvokeStatic */ diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2CompiledTest.java index 6ac0e2ba09f..ef408fdfc3b 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2CompiledTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from compiled to compiled using InvokeVirtual * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -40,5 +42,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch compiler.calls.common.InvokeVirtual * -compileCaller 4 -checkCallerCompileLevel 4 -compileCallee 4 -checkCalleeCompileLevel 4 - * @summary check calls from compiled to compiled using InvokeVirtual */ diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2InterpretedTest.java index 9f03a2c62f8..718aef28707 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2InterpretedTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from compiled to interpreted using InvokeVirtual * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -34,5 +36,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch -XX:CompileCommand=exclude,compiler.calls.common.InvokeVirtual::callee compiler.calls.common.InvokeVirtual * -compileCaller 4 -checkCallerCompileLevel 4 -checkCalleeCompileLevel 0 - * @summary check calls from compiled to interpreted using InvokeVirtual */ diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2NativeTest.java index 93643d6974b..e161834319e 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2NativeTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2NativeTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from compiled to native using InvokeVirtual * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -34,5 +36,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch compiler.calls.common.InvokeVirtual * -compileCaller 4 -checkCallerCompileLevel 4 -nativeCallee - * @summary check calls from compiled to native using InvokeVirtual */ diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java index 17d151253a6..f83beb4127e 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java @@ -23,11 +23,13 @@ /* * @test + * @summary check calls from interpreted to compiled using InvokeDynamic * @library /test/lib /testlibrary / * @modules java.base/jdk.internal.misc - * @modules java.base/jdk.internal.org.objectweb.asm + * java.base/jdk.internal.org.objectweb.asm + * * @build compiler.calls.common.InvokeDynamic - * @build compiler.calls.common.InvokeDynamicPatcher + * compiler.calls.common.InvokeDynamicPatcher * @run main compiler.calls.common.InvokeDynamicPatcher * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -37,5 +39,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeDynamic::caller -Xbatch compiler.calls.common.InvokeDynamic * -checkCallerCompileLevel 0 -compileCallee 4 -checkCalleeCompileLevel 4 - * @summary check calls from interpreted to compiled using InvokeDynamic */ diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java index 5988ac62599..e4ff0998b66 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java @@ -23,16 +23,17 @@ /* * @test + * @summary check calls from interpreted to interpreted using InvokeDynamic * @library /test/lib /testlibrary / * @modules java.base/jdk.internal.misc - * @modules java.base/jdk.internal.org.objectweb.asm + * java.base/jdk.internal.org.objectweb.asm + * * @build compiler.calls.common.InvokeDynamic - * @build compiler.calls.common.InvokeDynamicPatcher + * compiler.calls.common.InvokeDynamicPatcher * @run main compiler.calls.common.InvokeDynamicPatcher * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeDynamic::caller -XX:CompileCommand=exclude,compiler.calls.common.InvokeDynamic::callee compiler.calls.common.InvokeDynamic * -checkCallerCompileLevel 0 -checkCalleeCompileLevel 0 - * @summary check calls from interpreted to interpreted using InvokeDynamic */ diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java index 7f0015a4e9d..37850589fa6 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java @@ -23,16 +23,17 @@ /* * @test + * @summary check calls from interpreted to native using InvokeDynamic * @library /test/lib /testlibrary / * @modules java.base/jdk.internal.misc - * @modules java.base/jdk.internal.org.objectweb.asm + * java.base/jdk.internal.org.objectweb.asm + * * @build compiler.calls.common.InvokeDynamic - * @build compiler.calls.common.InvokeDynamicPatcher + * compiler.calls.common.InvokeDynamicPatcher * @run main compiler.calls.common.InvokeDynamicPatcher * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeDynamic::caller compiler.calls.common.InvokeDynamic * -checkCallerCompileLevel 0 -nativeCallee - * @summary check calls from interpreted to native using InvokeDynamic */ diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2CompiledTest.java index ea458db3a97..83024bb25b4 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2CompiledTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from interpreted to compiled using InvokeInterface * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeInterface * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -34,5 +36,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeInterface::caller -Xbatch compiler.calls.common.InvokeInterface * -checkCallerCompileLevel 0 -compileCallee 4 -checkCalleeCompileLevel 4 - * @summary check calls from interpreted to compiled using InvokeInterface */ diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2InterpretedTest.java index ed150e4f9f2..2a811103ba3 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2InterpretedTest.java @@ -23,13 +23,14 @@ /* * @test + * @summary check calls from interpreted to interpreted using InvokeInterface * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeInterface * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeInterface::caller -XX:CompileCommand=exclude,compiler.calls.common.InvokeInterface::callee compiler.calls.common.InvokeInterface * -checkCallerCompileLevel 0 -checkCalleeCompileLevel 0 - * @summary check calls from interpreted to interpreted using InvokeInterface */ diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2NativeTest.java index 8adc7a6c306..72c927568cc 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2NativeTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2NativeTest.java @@ -23,13 +23,14 @@ /* * @test + * @summary check calls from interpreted to native using InvokeInterface * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeInterface * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeInterface::caller compiler.calls.common.InvokeInterface * -checkCallerCompileLevel 0 -nativeCallee - * @summary check calls from interpreted to native using InvokeInterface */ diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2InterpretedTest.java index 324ad867ad3..a6a3ae46ba3 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2InterpretedTest.java @@ -23,13 +23,14 @@ /* * @test + * @summary check calls from interpreted to interpreted using InvokeSpecial * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeSpecial::caller -XX:CompileCommand=exclude,compiler.calls.common.InvokeSpecial::callee compiler.calls.common.InvokeSpecial * -checkCallerCompileLevel 0 -checkCalleeCompileLevel 0 - * @summary check calls from interpreted to interpreted using InvokeSpecial */ diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2NativeTest.java index e34cca01ab3..f52dd626082 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2NativeTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2NativeTest.java @@ -23,13 +23,14 @@ /* * @test + * @summary check calls from interpreted to native using InvokeSpecial * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeSpecial::caller compiler.calls.common.InvokeSpecial * -checkCallerCompileLevel 0 -nativeCallee - * @summary check calls from interpreted to native using InvokeSpecial */ diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2CompiledTest.java index 96501a1ed15..1db10145bce 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2CompiledTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from interpreted to compiled using InvokeStatic * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -34,5 +36,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeStatic::caller -Xbatch compiler.calls.common.InvokeStatic * -checkCallerCompileLevel 0 -compileCallee 4 -checkCalleeCompileLevel 4 - * @summary check calls from interpreted to compiled using InvokeStatic */ diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2InterpretedTest.java index 8efd93d874b..7e3925491eb 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2InterpretedTest.java @@ -23,13 +23,14 @@ /* * @test + * @summary check calls from interpreted to interpreted using InvokeStatic * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeStatic::caller -XX:CompileCommand=exclude,compiler.calls.common.InvokeStatic::callee compiler.calls.common.InvokeStatic * -checkCallerCompileLevel 0 -checkCalleeCompileLevel 0 - * @summary check calls from interpreted to interpreted using InvokeStatic */ diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2NativeTest.java index 0bcbb379842..789fe9c77f3 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2NativeTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2NativeTest.java @@ -23,13 +23,14 @@ /* * @test + * @summary check calls from interpreted to native using InvokeStatic * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeStatic::caller compiler.calls.common.InvokeStatic * -checkCallerCompileLevel 0 -nativeCallee - * @summary check calls from interpreted to native using InvokeStatic */ diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2CompiledTest.java index eefe4e6debe..41e89d3babc 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2CompiledTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from interpreted to compiled using InvokeVirtual * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -34,5 +36,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeVirtual::caller -Xbatch compiler.calls.common.InvokeVirtual * -checkCallerCompileLevel 0 -compileCallee 4 -checkCalleeCompileLevel 4 - * @summary check calls from interpreted to compiled using InvokeVirtual */ diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2InterpretedTest.java index d44e140f8e5..f299f4ae85a 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2InterpretedTest.java @@ -23,13 +23,14 @@ /* * @test + * @summary check calls from interpreted to interpreted using InvokeVirtual * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeVirtual::caller -XX:CompileCommand=exclude,compiler.calls.common.InvokeVirtual::callee compiler.calls.common.InvokeVirtual * -checkCallerCompileLevel 0 -checkCalleeCompileLevel 0 - * @summary check calls from interpreted to interpreted using InvokeVirtual */ diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2NativeTest.java index 201199341e1..5a99727c863 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2NativeTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2NativeTest.java @@ -23,13 +23,14 @@ /* * @test + * @summary check calls from interpreted to native using InvokeVirtual * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeVirtual::caller compiler.calls.common.InvokeVirtual * -checkCallerCompileLevel 0 -nativeCallee - * @summary check calls from interpreted to native using InvokeVirtual */ diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2CompiledTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2CompiledTest.java index 86a0784af56..b25f7a12053 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2CompiledTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from native to compiled using InvokeSpecial * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -34,5 +36,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch compiler.calls.common.InvokeSpecial * -nativeCaller -compileCallee 4 -checkCalleeCompileLevel 4 - * @summary check calls from native to compiled using InvokeSpecial */ diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2InterpretedTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2InterpretedTest.java index 83520cef1c7..f7c66cf77e8 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2InterpretedTest.java @@ -23,13 +23,14 @@ /* * @test + * @summary check calls from native to interpreted using InvokeSpecial * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeSpecial::callee compiler.calls.common.InvokeSpecial * -nativeCaller -checkCalleeCompileLevel 0 - * @summary check calls from native to interpreted using InvokeSpecial */ diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2NativeTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2NativeTest.java index f9b3ce5b8b4..041af4fb832 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2NativeTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2NativeTest.java @@ -23,13 +23,14 @@ /* * @test + * @summary check calls from native to native using InvokeSpecial * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.calls.common.InvokeSpecial * -nativeCaller -nativeCallee - * @summary check calls from native to native using InvokeSpecial */ diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2CompiledTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2CompiledTest.java index 71335713aaa..f7e8f52b112 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2CompiledTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from native to compiled using InvokeStatic * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -34,5 +36,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch compiler.calls.common.InvokeStatic * -nativeCaller -compileCallee 4 -checkCalleeCompileLevel 4 - * @summary check calls from native to compiled using InvokeStatic */ diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2InterpretedTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2InterpretedTest.java index 541b3645a1c..ab0e447e350 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2InterpretedTest.java @@ -23,13 +23,14 @@ /* * @test + * @summary check calls from native to interpreted using InvokeStatic * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeStatic::callee compiler.calls.common.InvokeStatic * -nativeCaller -checkCalleeCompileLevel 0 - * @summary check calls from native to interpreted using InvokeStatic */ diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2NativeTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2NativeTest.java index 34ad481e521..de0b8c158c8 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2NativeTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2NativeTest.java @@ -23,13 +23,14 @@ /* * @test + * @summary check calls from native to native using InvokeStatic * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.calls.common.InvokeStatic * -nativeCaller -nativeCallee - * @summary check calls from native to native using InvokeStatic */ diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2CompiledTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2CompiledTest.java index 4f86421b607..4361a8d5690 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2CompiledTest.java @@ -23,8 +23,10 @@ /* * @test + * @summary check calls from native to compiled using InvokeVirtual * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -34,5 +36,4 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -Xbatch compiler.calls.common.InvokeVirtual * -nativeCaller -compileCallee 4 -checkCalleeCompileLevel 4 - * @summary check calls from native to compiled using InvokeVirtual */ diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2InterpretedTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2InterpretedTest.java index c0d3b77110e..fde24657a05 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2InterpretedTest.java @@ -23,13 +23,14 @@ /* * @test + * @summary check calls from native to interpreted using InvokeVirtual * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeVirtual + * * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * -XX:CompileCommand=exclude,compiler.calls.common.InvokeVirtual::callee compiler.calls.common.InvokeVirtual * -nativeCaller -checkCalleeCompileLevel 0 - * @summary check calls from native to interpreted using InvokeVirtual */ diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2NativeTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2NativeTest.java index b83b9330e5e..a07510709f3 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2NativeTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2NativeTest.java @@ -23,13 +23,14 @@ /* * @test + * @summary check calls from native to native using InvokeVirtual * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / + * * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.calls.common.InvokeVirtual * -nativeCaller -nativeCallee - * @summary check calls from native to native using InvokeVirtual */ diff --git a/hotspot/test/compiler/native/libTestDirtyInt.c b/hotspot/test/compiler/calls/libTestDirtyInt.c similarity index 92% rename from hotspot/test/compiler/native/libTestDirtyInt.c rename to hotspot/test/compiler/calls/libTestDirtyInt.c index b688a369398..229df0f3174 100644 --- a/hotspot/test/compiler/native/libTestDirtyInt.c +++ b/hotspot/test/compiler/calls/libTestDirtyInt.c @@ -26,7 +26,7 @@ static int array = 0x42; -JNIEXPORT jint JNICALL Java_TestDirtyInt_test(JNIEnv* env, jclass jclazz, jint v) +JNIEXPORT jint JNICALL Java_compiler_calls_TestDirtyInt_test(JNIEnv* env, jclass jclazz, jint v) { int* ptr = &array + v + 4; return *ptr; diff --git a/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java b/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java index 65b3d5879e9..694b6e74bfc 100644 --- a/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java +++ b/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java @@ -21,26 +21,28 @@ * questions. */ -import sun.hotspot.WhiteBox; +/* + * @test TestAnonymousClassUnloading + * @bug 8054402 + * @summary "Tests unloading of anonymous classes." + * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc + * + * @run main/othervm/bootclasspath -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -XX:-BackgroundCompilation + * compiler.classUnloading.anonymousClass.TestAnonymousClassUnloading + */ + +package compiler.classUnloading.anonymousClass; + import jdk.internal.misc.Unsafe; +import sun.hotspot.WhiteBox; import java.io.IOException; import java.lang.reflect.Method; import java.net.URL; import java.net.URLConnection; -/* - * @test TestAnonymousClassUnloading - * @bug 8054402 - * @summary "Tests unloading of anonymous classes." - * @library /testlibrary /test/lib - * @modules java.base/jdk.internal.misc - * @compile TestAnonymousClassUnloading.java - * @run main ClassFileInstaller TestAnonymousClassUnloading - * sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-BackgroundCompilation TestAnonymousClassUnloading - */ public class TestAnonymousClassUnloading { private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); private static final Unsafe UNSAFE = Unsafe.getUnsafe(); @@ -107,7 +109,8 @@ public class TestAnonymousClassUnloading { */ static public void main(String[] args) throws Exception { // (1) Load an anonymous version of this class using the corresponding Unsafe method - URL classUrl = TestAnonymousClassUnloading.class.getResource("TestAnonymousClassUnloading.class"); + URL classUrl = TestAnonymousClassUnloading.class.getResource( + TestAnonymousClassUnloading.class.getName().replace('.', '/') + ".class"); URLConnection connection = classUrl.openConnection(); int length = connection.getContentLength(); diff --git a/hotspot/test/compiler/classUnloading/methodUnloading/TestMethodUnloading.java b/hotspot/test/compiler/classUnloading/methodUnloading/TestMethodUnloading.java index d1415465b1a..d0f022d7fbe 100644 --- a/hotspot/test/compiler/classUnloading/methodUnloading/TestMethodUnloading.java +++ b/hotspot/test/compiler/classUnloading/methodUnloading/TestMethodUnloading.java @@ -21,26 +21,34 @@ * questions. */ +/* + * @test MethodUnloadingTest + * @bug 8029443 + * @summary Tests the unloading of methods to to class unloading + * @modules java.base/jdk.internal.misc + * @library /testlibrary /test/lib / + * + * @build compiler.classUnloading.methodUnloading.TestMethodUnloading + * compiler.classUnloading.methodUnloading.WorkerClass + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -XX:-BackgroundCompilation -XX:-UseCompressedOops + * -XX:CompileCommand=compileonly,compiler.classUnloading.methodUnloading.TestMethodUnloading::doWork + * compiler.classUnloading.methodUnloading.TestMethodUnloading + */ + +package compiler.classUnloading.methodUnloading; + import sun.hotspot.WhiteBox; import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; -/* - * @test MethodUnloadingTest - * @bug 8029443 - * @summary "Tests the unloading of methods to to class unloading" - * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib - * @build TestMethodUnloading - * @build WorkerClass - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-BackgroundCompilation -XX:-UseCompressedOops -XX:CompileOnly=TestMethodUnloading::doWork TestMethodUnloading - */ public class TestMethodUnloading { - private static final String workerClassName = "WorkerClass"; + private static final String workerClassName = "compiler.classUnloading.methodUnloading.WorkerClass"; private static int work = -1; private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); diff --git a/hotspot/test/compiler/classUnloading/methodUnloading/WorkerClass.java b/hotspot/test/compiler/classUnloading/methodUnloading/WorkerClass.java index c67154f2c80..4d7c7ac0191 100644 --- a/hotspot/test/compiler/classUnloading/methodUnloading/WorkerClass.java +++ b/hotspot/test/compiler/classUnloading/methodUnloading/WorkerClass.java @@ -24,6 +24,9 @@ /** * Worker class that is dynamically loaded/unloaded by TestMethodUnloading. */ + +package compiler.classUnloading.methodUnloading; + public class WorkerClass { /** * We override hashCode here to be able to access this implementation diff --git a/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java b/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java index 0fee258c2c4..1c8d70f5adb 100644 --- a/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java +++ b/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java @@ -27,29 +27,34 @@ * @summary Test checks that the order in which ReversedCodeCacheSize and * InitialCodeCacheSize are passed to the VM is irrelevant. * @library /testlibrary - * * @modules java.base/jdk.internal.misc * java.management + * + * @run driver compiler.codecache.CheckReservedInitialCodeCacheSizeArgOrder */ -import jdk.test.lib.*; + +package compiler.codecache; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; public class CheckReservedInitialCodeCacheSizeArgOrder { - public static void main(String[] args) throws Exception { - ProcessBuilder pb1, pb2; - OutputAnalyzer out1, out2; + public static void main(String[] args) throws Exception { + ProcessBuilder pb1, pb2; + OutputAnalyzer out1, out2; - pb1 = ProcessTools.createJavaProcessBuilder("-XX:InitialCodeCacheSize=4m", "-XX:ReservedCodeCacheSize=8m", "-version"); - pb2 = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=8m", "-XX:InitialCodeCacheSize=4m", "-version"); + pb1 = ProcessTools.createJavaProcessBuilder("-XX:InitialCodeCacheSize=4m", "-XX:ReservedCodeCacheSize=8m", "-version"); + pb2 = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=8m", "-XX:InitialCodeCacheSize=4m", "-version"); - out1 = new OutputAnalyzer(pb1.start()); - out2 = new OutputAnalyzer(pb2.start()); + out1 = new OutputAnalyzer(pb1.start()); + out2 = new OutputAnalyzer(pb2.start()); - // Check that the outputs are equal - if (out1.getStdout().compareTo(out2.getStdout()) != 0) { - throw new RuntimeException("Test failed"); + // Check that the outputs are equal + if (out1.getStdout().compareTo(out2.getStdout()) != 0) { + throw new RuntimeException("Test failed"); + } + + out1.shouldHaveExitValue(0); + out2.shouldHaveExitValue(0); } - - out1.shouldHaveExitValue(0); - out2.shouldHaveExitValue(0); - } } diff --git a/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java b/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java index 45ae4b88e9a..2e09a4a580c 100644 --- a/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java +++ b/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java @@ -21,131 +21,139 @@ * questions. */ -import jdk.test.lib.*; -import sun.hotspot.WhiteBox; - /* * @test CheckSegmentedCodeCache * @bug 8015774 + * @summary Checks VM options related to the segmented code cache * @library /testlibrary /test/lib - * @summary "Checks VM options related to the segmented code cache" * @modules java.base/jdk.internal.misc * java.management - * @build CheckSegmentedCodeCache - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI CheckSegmentedCodeCache + * + * @build compiler.codecache.CheckSegmentedCodeCache + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * compiler.codecache.CheckSegmentedCodeCache */ + +package compiler.codecache; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.Platform; +import jdk.test.lib.ProcessTools; +import sun.hotspot.WhiteBox; + public class CheckSegmentedCodeCache { - private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); - // Code heap names - private static final String NON_METHOD = "CodeHeap 'non-nmethods'"; - private static final String PROFILED = "CodeHeap 'profiled nmethods'"; - private static final String NON_PROFILED = "CodeHeap 'non-profiled nmethods'"; + private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); + // Code heap names + private static final String NON_METHOD = "CodeHeap 'non-nmethods'"; + private static final String PROFILED = "CodeHeap 'profiled nmethods'"; + private static final String NON_PROFILED = "CodeHeap 'non-profiled nmethods'"; - private static void verifySegmentedCodeCache(ProcessBuilder pb, boolean enabled) throws Exception { - OutputAnalyzer out = new OutputAnalyzer(pb.start()); - out.shouldHaveExitValue(0); - if (enabled) { - try { - // Non-nmethod code heap should be always available with the segmented code cache - out.shouldContain(NON_METHOD); - } catch (RuntimeException e) { - // Check if TieredCompilation is disabled (in a client VM) - if(!out.getOutput().contains("-XX:+TieredCompilation not supported in this VM")) { - // Code cache is not segmented - throw new RuntimeException("No code cache segmentation."); + private static void verifySegmentedCodeCache(ProcessBuilder pb, boolean enabled) throws Exception { + OutputAnalyzer out = new OutputAnalyzer(pb.start()); + out.shouldHaveExitValue(0); + if (enabled) { + try { + // Non-nmethod code heap should be always available with the segmented code cache + out.shouldContain(NON_METHOD); + } catch (RuntimeException e) { + // Check if TieredCompilation is disabled (in a client VM) + if(!out.getOutput().contains("-XX:+TieredCompilation not supported in this VM")) { + // Code cache is not segmented + throw new RuntimeException("No code cache segmentation."); + } + } + } else { + out.shouldNotContain(NON_METHOD); } - } - } else { - out.shouldNotContain(NON_METHOD); } - } - private static void verifyCodeHeapNotExists(ProcessBuilder pb, String... heapNames) throws Exception { - OutputAnalyzer out = new OutputAnalyzer(pb.start()); - out.shouldHaveExitValue(0); - for (String name : heapNames) { - out.shouldNotContain(name); + private static void verifyCodeHeapNotExists(ProcessBuilder pb, String... heapNames) throws Exception { + OutputAnalyzer out = new OutputAnalyzer(pb.start()); + out.shouldHaveExitValue(0); + for (String name : heapNames) { + out.shouldNotContain(name); + } } - } - private static void failsWith(ProcessBuilder pb, String message) throws Exception { - OutputAnalyzer out = new OutputAnalyzer(pb.start()); - out.shouldContain(message); - out.shouldHaveExitValue(1); - } + private static void failsWith(ProcessBuilder pb, String message) throws Exception { + OutputAnalyzer out = new OutputAnalyzer(pb.start()); + out.shouldContain(message); + out.shouldHaveExitValue(1); + } - /** - * Check the result of segmented code cache related VM options. - */ - public static void main(String[] args) throws Exception { - ProcessBuilder pb; + /** + * Check the result of segmented code cache related VM options. + */ + public static void main(String[] args) throws Exception { + ProcessBuilder pb; - // Disabled with ReservedCodeCacheSize < 240MB - pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=239m", - "-XX:+PrintCodeCache", "-version"); - verifySegmentedCodeCache(pb, false); + // Disabled with ReservedCodeCacheSize < 240MB + pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=239m", + "-XX:+PrintCodeCache", "-version"); + verifySegmentedCodeCache(pb, false); - // Disabled without TieredCompilation - pb = ProcessTools.createJavaProcessBuilder("-XX:-TieredCompilation", - "-XX:+PrintCodeCache", "-version"); - verifySegmentedCodeCache(pb, false); + // Disabled without TieredCompilation + pb = ProcessTools.createJavaProcessBuilder("-XX:-TieredCompilation", + "-XX:+PrintCodeCache", "-version"); + verifySegmentedCodeCache(pb, false); - // Enabled with TieredCompilation and ReservedCodeCacheSize >= 240MB - pb = ProcessTools.createJavaProcessBuilder("-XX:+TieredCompilation", - "-XX:ReservedCodeCacheSize=240m", - "-XX:+PrintCodeCache", "-version"); - verifySegmentedCodeCache(pb, true); - pb = ProcessTools.createJavaProcessBuilder("-XX:+TieredCompilation", - "-XX:ReservedCodeCacheSize=400m", - "-XX:+PrintCodeCache", "-version"); - verifySegmentedCodeCache(pb, true); + // Enabled with TieredCompilation and ReservedCodeCacheSize >= 240MB + pb = ProcessTools.createJavaProcessBuilder("-XX:+TieredCompilation", + "-XX:ReservedCodeCacheSize=240m", + "-XX:+PrintCodeCache", "-version"); + verifySegmentedCodeCache(pb, true); + pb = ProcessTools.createJavaProcessBuilder("-XX:+TieredCompilation", + "-XX:ReservedCodeCacheSize=400m", + "-XX:+PrintCodeCache", "-version"); + verifySegmentedCodeCache(pb, true); - // Always enabled if SegmentedCodeCache is set - pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", - "-XX:-TieredCompilation", - "-XX:ReservedCodeCacheSize=239m", - "-XX:+PrintCodeCache", "-version"); - verifySegmentedCodeCache(pb, true); + // Always enabled if SegmentedCodeCache is set + pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", + "-XX:-TieredCompilation", + "-XX:ReservedCodeCacheSize=239m", + "-XX:+PrintCodeCache", "-version"); + verifySegmentedCodeCache(pb, true); - // The profiled and non-profiled code heaps should not be available in - // interpreter-only mode - pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", - "-Xint", - "-XX:+PrintCodeCache", "-version"); - verifyCodeHeapNotExists(pb, PROFILED, NON_PROFILED); + // The profiled and non-profiled code heaps should not be available in + // interpreter-only mode + pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", + "-Xint", + "-XX:+PrintCodeCache", "-version"); + verifyCodeHeapNotExists(pb, PROFILED, NON_PROFILED); - // If we stop compilation at CompLevel_none or CompLevel_simple we - // don't need a profiled code heap. - pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", - "-XX:TieredStopAtLevel=0", - "-XX:+PrintCodeCache", "-version"); - verifyCodeHeapNotExists(pb, PROFILED); - pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", - "-XX:TieredStopAtLevel=1", - "-XX:+PrintCodeCache", "-version"); - verifyCodeHeapNotExists(pb, PROFILED); + // If we stop compilation at CompLevel_none or CompLevel_simple we + // don't need a profiled code heap. + pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", + "-XX:TieredStopAtLevel=0", + "-XX:+PrintCodeCache", "-version"); + verifyCodeHeapNotExists(pb, PROFILED); + pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", + "-XX:TieredStopAtLevel=1", + "-XX:+PrintCodeCache", "-version"); + verifyCodeHeapNotExists(pb, PROFILED); - // Fails with too small non-nmethod code heap size - pb = ProcessTools.createJavaProcessBuilder("-XX:NonNMethodCodeHeapSize=100K"); - failsWith(pb, "Invalid NonNMethodCodeHeapSize"); + // Fails with too small non-nmethod code heap size + pb = ProcessTools.createJavaProcessBuilder("-XX:NonNMethodCodeHeapSize=100K"); + failsWith(pb, "Invalid NonNMethodCodeHeapSize"); - // Fails if code heap sizes do not add up - pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", - "-XX:ReservedCodeCacheSize=10M", - "-XX:NonNMethodCodeHeapSize=5M", - "-XX:ProfiledCodeHeapSize=5M", - "-XX:NonProfiledCodeHeapSize=5M"); - failsWith(pb, "Invalid code heap sizes"); + // Fails if code heap sizes do not add up + pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", + "-XX:ReservedCodeCacheSize=10M", + "-XX:NonNMethodCodeHeapSize=5M", + "-XX:ProfiledCodeHeapSize=5M", + "-XX:NonProfiledCodeHeapSize=5M"); + failsWith(pb, "Invalid code heap sizes"); - // Fails if not enough space for VM internal code - long minUseSpace = WHITE_BOX.getUintxVMFlag("CodeCacheMinimumUseSpace"); - // minimum size: CodeCacheMinimumUseSpace DEBUG_ONLY(* 3) - long minSize = (Platform.isDebugBuild() ? 3 : 1) * minUseSpace; - pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", - "-XX:ReservedCodeCacheSize=" + minSize, - "-XX:InitialCodeCacheSize=100K"); - failsWith(pb, "Not enough space in non-nmethod code heap to run VM"); - } + // Fails if not enough space for VM internal code + long minUseSpace = WHITE_BOX.getUintxVMFlag("CodeCacheMinimumUseSpace"); + // minimum size: CodeCacheMinimumUseSpace DEBUG_ONLY(* 3) + long minSize = (Platform.isDebugBuild() ? 3 : 1) * minUseSpace; + pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", + "-XX:ReservedCodeCacheSize=" + minSize, + "-XX:InitialCodeCacheSize=100K"); + failsWith(pb, "Not enough space in non-nmethod code heap to run VM"); + } } diff --git a/hotspot/test/compiler/codecache/CheckUpperLimit.java b/hotspot/test/compiler/codecache/CheckUpperLimit.java index 086532f0eba..d4c34ca36e5 100644 --- a/hotspot/test/compiler/codecache/CheckUpperLimit.java +++ b/hotspot/test/compiler/codecache/CheckUpperLimit.java @@ -26,20 +26,25 @@ * @bug 8015635 * @summary Test ensures that the ReservedCodeCacheSize is at most MAXINT * @library /testlibrary - * * @modules java.base/jdk.internal.misc * java.management + * + * @run driver compiler.codecache.CheckUpperLimit */ -import jdk.test.lib.*; + +package compiler.codecache; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; public class CheckUpperLimit { - public static void main(String[] args) throws Exception { - ProcessBuilder pb; - OutputAnalyzer out; + public static void main(String[] args) throws Exception { + ProcessBuilder pb; + OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=2049m", "-version"); - out = new OutputAnalyzer(pb.start()); - out.shouldContain("Invalid ReservedCodeCacheSize="); - out.shouldHaveExitValue(1); - } + pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=2049m", "-version"); + out = new OutputAnalyzer(pb.start()); + out.shouldContain("Invalid ReservedCodeCacheSize="); + out.shouldHaveExitValue(1); + } } diff --git a/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java index 31e8d2bcc30..6b45694e988 100644 --- a/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java +++ b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java @@ -22,32 +22,38 @@ * */ -import java.lang.management.MemoryPoolMXBean; -import java.util.EnumSet; -import java.util.ArrayList; - -import sun.hotspot.WhiteBox; -import sun.hotspot.code.BlobType; -import sun.hotspot.code.CodeBlob; -import jdk.test.lib.Asserts; - /* * @test OverflowCodeCacheTest * @bug 8059550 + * @summary testing of code cache segments overflow * @library /testlibrary /test/lib * @modules java.base/jdk.internal.misc - * @modules java.management - * @build OverflowCodeCacheTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * java.management + * + * @build compiler.codecache.OverflowCodeCacheTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::* - * -XX:-SegmentedCodeCache OverflowCodeCacheTest + * -XX:-SegmentedCodeCache + * compiler.codecache.OverflowCodeCacheTest * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::* - * -XX:+SegmentedCodeCache OverflowCodeCacheTest - * @summary testing of code cache segments overflow + * -XX:+SegmentedCodeCache + * compiler.codecache.OverflowCodeCacheTest */ + +package compiler.codecache; + +import jdk.test.lib.Asserts; +import sun.hotspot.WhiteBox; +import sun.hotspot.code.BlobType; +import sun.hotspot.code.CodeBlob; + +import java.lang.management.MemoryPoolMXBean; +import java.util.ArrayList; +import java.util.EnumSet; + public class OverflowCodeCacheTest { private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); diff --git a/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java b/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java index 5bb55b3724b..c5db695125b 100644 --- a/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java +++ b/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java @@ -20,24 +20,29 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -import jdk.test.lib.ExitCode; -import jdk.test.lib.Platform; -import jdk.test.lib.cli.CommandLineOptionTest; -import common.CodeCacheOptions; -import sun.hotspot.code.BlobType; /** * @test * @bug 8015774 * @summary Verify SegmentedCodeCache option's processing - * @library /testlibrary /test/lib + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build TestSegmentedCodeCacheOption jdk.test.lib.* - * @run main TestSegmentedCodeCacheOption + * + * @build jdk.test.lib.* + * @run driver compiler.codecache.cli.TestSegmentedCodeCacheOption */ + +package compiler.codecache.cli; + +import compiler.codecache.cli.common.CodeCacheOptions; +import jdk.test.lib.ExitCode; +import jdk.test.lib.Platform; +import jdk.test.lib.cli.CommandLineOptionTest; +import sun.hotspot.code.BlobType; + public class TestSegmentedCodeCacheOption { private static final String INT_MODE = "-Xint"; private static final String TIERED_COMPILATION = "TieredCompilation"; diff --git a/hotspot/test/compiler/codecache/cli/codeheapsize/CodeCacheFreeSpaceRunner.java b/hotspot/test/compiler/codecache/cli/codeheapsize/CodeCacheFreeSpaceRunner.java index c8588eb1929..ffc333c7d84 100644 --- a/hotspot/test/compiler/codecache/cli/codeheapsize/CodeCacheFreeSpaceRunner.java +++ b/hotspot/test/compiler/codecache/cli/codeheapsize/CodeCacheFreeSpaceRunner.java @@ -20,13 +20,14 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package codeheapsize; +package compiler.codecache.cli.codeheapsize; + +import compiler.codecache.cli.common.CodeCacheCLITestCase; +import compiler.codecache.cli.common.CodeCacheOptions; import jdk.test.lib.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; -import common.CodeCacheCLITestCase; -import common.CodeCacheOptions; import sun.hotspot.code.BlobType; /** diff --git a/hotspot/test/compiler/codecache/cli/codeheapsize/GenericCodeHeapSizeRunner.java b/hotspot/test/compiler/codecache/cli/codeheapsize/GenericCodeHeapSizeRunner.java index 5d26ea9f221..a8186fce029 100644 --- a/hotspot/test/compiler/codecache/cli/codeheapsize/GenericCodeHeapSizeRunner.java +++ b/hotspot/test/compiler/codecache/cli/codeheapsize/GenericCodeHeapSizeRunner.java @@ -20,11 +20,12 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package codeheapsize; +package compiler.codecache.cli.codeheapsize; + +import compiler.codecache.cli.common.CodeCacheCLITestCase; +import compiler.codecache.cli.common.CodeCacheOptions; import jdk.test.lib.cli.CommandLineOptionTest; -import common.CodeCacheCLITestCase; -import common.CodeCacheOptions; import sun.hotspot.code.BlobType; /** diff --git a/hotspot/test/compiler/codecache/cli/codeheapsize/JVMStartupRunner.java b/hotspot/test/compiler/codecache/cli/codeheapsize/JVMStartupRunner.java index 4f15fa6bcfb..8eb8d15af3e 100644 --- a/hotspot/test/compiler/codecache/cli/codeheapsize/JVMStartupRunner.java +++ b/hotspot/test/compiler/codecache/cli/codeheapsize/JVMStartupRunner.java @@ -20,14 +20,16 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package codeheapsize; -import common.CodeCacheCLITestCase; -import common.CodeCacheOptions; +package compiler.codecache.cli.codeheapsize; + +import compiler.codecache.cli.common.CodeCacheCLITestCase; +import compiler.codecache.cli.common.CodeCacheOptions; import jdk.test.lib.ExitCode; import jdk.test.lib.Utils; import jdk.test.lib.cli.CommandLineOptionTest; import sun.hotspot.code.BlobType; + import java.util.Random; /** diff --git a/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java b/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java index f664e1bda14..ce576107af8 100644 --- a/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java +++ b/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java @@ -20,26 +20,30 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package codeheapsize; -import jdk.test.lib.Platform; -import common.CodeCacheCLITestBase; -import common.CodeCacheCLITestCase; -import sun.hotspot.code.BlobType; -import java.util.EnumSet; /** * @test * @bug 8015774 * @summary Verify processing of options related to code heaps sizing. - * @library /testlibrary .. /test/lib + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build TestCodeHeapSizeOptions jdk.test.lib.* codeheapsize.* - * common.* - * @run main/timeout=240 codeheapsize.TestCodeHeapSizeOptions + * + * @build compiler.codecache.cli.codeheapsize.TestCodeHeapSizeOptions jdk.test.lib.* + * @run driver/timeout=240 compiler.codecache.cli.codeheapsize.TestCodeHeapSizeOptions */ + +package compiler.codecache.cli.codeheapsize; + +import compiler.codecache.cli.common.CodeCacheCLITestBase; +import compiler.codecache.cli.common.CodeCacheCLITestCase; +import jdk.test.lib.Platform; +import sun.hotspot.code.BlobType; + +import java.util.EnumSet; + public class TestCodeHeapSizeOptions extends CodeCacheCLITestBase { private static final CodeCacheCLITestCase JVM_STARTUP = new CodeCacheCLITestCase(new CodeCacheCLITestCase.Description( diff --git a/hotspot/test/compiler/codecache/cli/common/CodeCacheCLITestBase.java b/hotspot/test/compiler/codecache/cli/common/CodeCacheCLITestBase.java index d57e0f7045c..f1f18956f05 100644 --- a/hotspot/test/compiler/codecache/cli/common/CodeCacheCLITestBase.java +++ b/hotspot/test/compiler/codecache/cli/common/CodeCacheCLITestBase.java @@ -20,7 +20,8 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package common; + +package compiler.codecache.cli.common; /** * Base for code cache related command line options tests. diff --git a/hotspot/test/compiler/codecache/cli/common/CodeCacheCLITestCase.java b/hotspot/test/compiler/codecache/cli/common/CodeCacheCLITestCase.java index 003fdbafbc9..1c28a1feac8 100644 --- a/hotspot/test/compiler/codecache/cli/common/CodeCacheCLITestCase.java +++ b/hotspot/test/compiler/codecache/cli/common/CodeCacheCLITestCase.java @@ -20,7 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package common; +package compiler.codecache.cli.common; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; diff --git a/hotspot/test/compiler/codecache/cli/common/CodeCacheInfoFormatter.java b/hotspot/test/compiler/codecache/cli/common/CodeCacheInfoFormatter.java index 3ad16a6d733..9349272dfc7 100644 --- a/hotspot/test/compiler/codecache/cli/common/CodeCacheInfoFormatter.java +++ b/hotspot/test/compiler/codecache/cli/common/CodeCacheInfoFormatter.java @@ -20,9 +20,10 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package common; +package compiler.codecache.cli.common; import sun.hotspot.code.BlobType; + import java.util.Arrays; public class CodeCacheInfoFormatter { diff --git a/hotspot/test/compiler/codecache/cli/common/CodeCacheOptions.java b/hotspot/test/compiler/codecache/cli/common/CodeCacheOptions.java index 41025d7ce2a..d5e2f16c81f 100644 --- a/hotspot/test/compiler/codecache/cli/common/CodeCacheOptions.java +++ b/hotspot/test/compiler/codecache/cli/common/CodeCacheOptions.java @@ -20,7 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package common; +package compiler.codecache.cli.common; import jdk.test.lib.cli.CommandLineOptionTest; import sun.hotspot.code.BlobType; diff --git a/hotspot/test/compiler/codecache/cli/printcodecache/PrintCodeCacheRunner.java b/hotspot/test/compiler/codecache/cli/printcodecache/PrintCodeCacheRunner.java index 5fb3ca499be..4bd269aafb5 100644 --- a/hotspot/test/compiler/codecache/cli/printcodecache/PrintCodeCacheRunner.java +++ b/hotspot/test/compiler/codecache/cli/printcodecache/PrintCodeCacheRunner.java @@ -20,13 +20,14 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package printcodecache; +package compiler.codecache.cli.printcodecache; + +import compiler.codecache.cli.common.CodeCacheCLITestCase; +import compiler.codecache.cli.common.CodeCacheInfoFormatter; +import compiler.codecache.cli.common.CodeCacheOptions; import jdk.test.lib.ExitCode; import jdk.test.lib.cli.CommandLineOptionTest; -import common.CodeCacheCLITestCase; -import common.CodeCacheInfoFormatter; -import common.CodeCacheOptions; import sun.hotspot.code.BlobType; import java.util.EnumSet; diff --git a/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java b/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java index efbf2fe49a9..eb50d4a7e3e 100644 --- a/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java +++ b/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java @@ -20,25 +20,29 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package printcodecache; -import common.CodeCacheCLITestBase; -import common.CodeCacheCLITestCase; -import sun.hotspot.code.BlobType; -import java.util.EnumSet; /** * @test * @bug 8015774 * @summary Verify that PrintCodeCache option print correct information. - * @library /testlibrary .. /test/lib + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build TestPrintCodeCacheOption jdk.test.lib.* - * printcodecache.* common.* - * @run main/timeout=240 printcodecache.TestPrintCodeCacheOption + * + * @build jdk.test.lib.* compiler.codecache.cli.common.* + * @run main/timeout=240 compiler.codecache.cli.printcodecache.TestPrintCodeCacheOption */ + +package compiler.codecache.cli.printcodecache; + +import compiler.codecache.cli.common.CodeCacheCLITestBase; +import compiler.codecache.cli.common.CodeCacheCLITestCase; +import sun.hotspot.code.BlobType; + +import java.util.EnumSet; + public class TestPrintCodeCacheOption extends CodeCacheCLITestBase { private static final CodeCacheCLITestCase DISABLED_PRINT_CODE_CACHE = new CodeCacheCLITestCase(new CodeCacheCLITestCase.Description( diff --git a/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java b/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java index 57fc8e0f292..535adc0a4fb 100644 --- a/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java +++ b/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java @@ -21,6 +21,24 @@ * questions. */ +/* + * @test SegmentedCodeCacheDtraceTest + * @bug 8015774 + * @summary testing of dtrace for segmented code cache + * @requires os.family=="solaris" + * @modules java.base/jdk.internal.misc + * @library /testlibrary /test/lib / + * + * @build compiler.codecache.dtrace.SegmentedCodeCacheDtraceTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm/timeout=600 -Xbootclasspath/a:. + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * compiler.codecache.dtrace.SegmentedCodeCacheDtraceTest + */ + +package compiler.codecache.dtrace; + import compiler.testlibrary.CompilerUtils; import jdk.test.lib.Asserts; import jdk.test.lib.JDKToolFinder; @@ -28,6 +46,7 @@ import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.Utils; import jdk.test.lib.dtrace.DtraceResultsAnalyzer; import jdk.test.lib.dtrace.DtraceRunner; + import java.io.IOException; import java.lang.reflect.Executable; import java.nio.file.Files; @@ -44,20 +63,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; -/* - * @test SegmentedCodeCacheDtraceTest - * @bug 8015774 - * @requires os.family=="solaris" - * @modules java.base/jdk.internal.misc - * @library /testlibrary / /test/lib - * @build SegmentedCodeCacheDtraceTestWorker - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+TieredCompilation - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * SegmentedCodeCacheDtraceTest - * @summary testing of dtrace for segmented code cache - */ public class SegmentedCodeCacheDtraceTest { private static final String WORKER_CLASS_NAME diff --git a/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTestWorker.java b/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTestWorker.java index 53422df2357..058c6ea7236 100644 --- a/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTestWorker.java +++ b/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTestWorker.java @@ -21,13 +21,16 @@ * questions. */ +package compiler.codecache.dtrace; + import jdk.test.lib.Utils; +import sun.hotspot.WhiteBox; + import java.lang.reflect.Executable; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import sun.hotspot.WhiteBox; public class SegmentedCodeCacheDtraceTestWorker { diff --git a/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java b/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java index f7838e50851..d620e9ee3f2 100644 --- a/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java +++ b/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java @@ -21,24 +21,33 @@ * questions. */ -import jdk.test.lib.Asserts; -import java.lang.management.MemoryType; -import sun.hotspot.code.BlobType; - /** * @test BeanTypeTest - * @library /testlibrary /test/lib - * @modules java.base/jdk.internal.misc - * @modules java.management - * @build BeanTypeTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache BeanTypeTest - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache BeanTypeTest * @summary verify types of code cache memory pool bean + * @modules java.base/jdk.internal.misc + * java.management + * @library /testlibrary /test/lib + * + * @build compiler.codecache.jmx.BeanTypeTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -XX:+SegmentedCodeCache + * compiler.codecache.jmx.BeanTypeTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -XX:-SegmentedCodeCache + * compiler.codecache.jmx.BeanTypeTest */ + +package compiler.codecache.jmx; + +import jdk.test.lib.Asserts; +import sun.hotspot.code.BlobType; + +import java.lang.management.MemoryType; + public class BeanTypeTest { public static void main(String args[]) { diff --git a/hotspot/test/compiler/codecache/jmx/CodeCacheUtils.java b/hotspot/test/compiler/codecache/jmx/CodeCacheUtils.java index 0adab36140c..31646f96225 100644 --- a/hotspot/test/compiler/codecache/jmx/CodeCacheUtils.java +++ b/hotspot/test/compiler/codecache/jmx/CodeCacheUtils.java @@ -21,14 +21,17 @@ * questions. */ +package compiler.codecache.jmx; + import jdk.test.lib.Asserts; import jdk.test.lib.Utils; -import java.lang.management.MemoryPoolMXBean; -import javax.management.Notification; import sun.hotspot.WhiteBox; import sun.hotspot.code.BlobType; import sun.hotspot.code.CodeBlob; +import javax.management.Notification; +import java.lang.management.MemoryPoolMXBean; + public final class CodeCacheUtils { /** diff --git a/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java b/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java index 6f99c25f952..ccf6927a467 100644 --- a/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java +++ b/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java @@ -21,24 +21,33 @@ * questions. */ -import jdk.test.lib.Asserts; -import java.util.EnumSet; -import sun.hotspot.code.BlobType; - /** * @test CodeHeapBeanPresenceTest - * @library /testlibrary /test/lib - * @modules java.base/jdk.internal.misc - * @modules java.management - * @build CodeHeapBeanPresenceTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache CodeHeapBeanPresenceTest - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache CodeHeapBeanPresenceTest * @summary verify CodeHeap bean presence + * @modules java.base/jdk.internal.misc + * java.management + * @library /testlibrary /test/lib + * + * @build compiler.codecache.jmx.CodeHeapBeanPresenceTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -XX:-SegmentedCodeCache + * compiler.codecache.jmx.CodeHeapBeanPresenceTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -XX:+SegmentedCodeCache + * compiler.codecache.jmx.CodeHeapBeanPresenceTest */ + +package compiler.codecache.jmx; + +import jdk.test.lib.Asserts; +import sun.hotspot.code.BlobType; + +import java.util.EnumSet; + public class CodeHeapBeanPresenceTest { public static void main(String args[]) { diff --git a/hotspot/test/compiler/codecache/jmx/GetUsageTest.java b/hotspot/test/compiler/codecache/jmx/GetUsageTest.java index c4fdc5b8796..01f247c43ed 100644 --- a/hotspot/test/compiler/codecache/jmx/GetUsageTest.java +++ b/hotspot/test/compiler/codecache/jmx/GetUsageTest.java @@ -21,25 +21,37 @@ * questions. */ +/* + * @test GetUsageTest + * @summary testing of getUsage() for segmented code cache + * @modules java.base/jdk.internal.misc + * java.management + * @library /testlibrary /test/lib / + * + * @build compiler.codecache.jmx.GetUsageTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::* + * -XX:-UseCodeCacheFlushing -XX:-MethodFlushing + * -XX:+SegmentedCodeCache + * compiler.codecache.jmx.GetUsageTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::* + * -XX:-UseCodeCacheFlushing -XX:-MethodFlushing + * -XX:-SegmentedCodeCache + * compiler.codecache.jmx.GetUsageTest + */ + +package compiler.codecache.jmx; + import jdk.test.lib.Asserts; +import sun.hotspot.code.BlobType; + import java.lang.management.MemoryPoolMXBean; import java.util.HashMap; import java.util.Map; -import sun.hotspot.code.BlobType; -/* - * @test GetUsageTest - * @library /testlibrary /test/lib - * @modules java.base/jdk.internal.misc - * java.management - * @build GetUsageTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:CompileCommand=compileonly,null::* - * -XX:-UseCodeCacheFlushing -XX:-MethodFlushing -XX:+SegmentedCodeCache - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI GetUsageTest - * @summary testing of getUsage() for segmented code cache - */ public class GetUsageTest { private final BlobType btype; diff --git a/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java b/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java index f695234cb00..ea17ba28bdb 100644 --- a/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java +++ b/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java @@ -21,26 +21,32 @@ * questions. */ +/* + * @test InitialAndMaxUsageTest + * @summary testing of initial and max usage + * @modules java.base/jdk.internal.misc + * java.management + * @library /testlibrary /test/lib / + * + * @build compiler.codecache.jmx.InitialAndMaxUsageTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing + * -XX:-MethodFlushing -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -XX:CompileCommand=compileonly,null::* -XX:-UseLargePages + * -XX:+SegmentedCodeCache + * compiler.codecache.jmx.InitialAndMaxUsageTest + */ + +package compiler.codecache.jmx; + import jdk.test.lib.Asserts; +import sun.hotspot.code.BlobType; + import java.lang.management.MemoryPoolMXBean; import java.util.ArrayList; import java.util.List; -import sun.hotspot.code.BlobType; -/* - * @test InitialAndMaxUsageTest - * @library /testlibrary /test/lib - * @modules java.base/jdk.internal.misc - * java.management - * @build InitialAndMaxUsageTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing - * -XX:-MethodFlushing -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:+SegmentedCodeCache -XX:CompileCommand=compileonly,null::* - * -XX:-UseLargePages InitialAndMaxUsageTest - * @summary testing of initial and max usage - */ public class InitialAndMaxUsageTest { private static final double CACHE_USAGE_COEF = 0.95d; diff --git a/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java b/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java index 45107f050b9..f8e678727e1 100644 --- a/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java +++ b/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java @@ -21,24 +21,33 @@ * questions. */ -import jdk.test.lib.Asserts; -import java.lang.management.MemoryPoolMXBean; -import sun.hotspot.code.BlobType; - /** * @test ManagerNamesTest - * @library /testlibrary /test/lib - * @modules java.base/jdk.internal.misc - * @modules java.management - * @build ManagerNamesTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache ManagerNamesTest - * * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache ManagerNamesTest * @summary verify getMemoryManageNames calls in case of segmented code cache + * @modules java.base/jdk.internal.misc + * java.management + * @library /testlibrary /test/lib + * + * @build compiler.codecache.jmx.ManagerNamesTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -XX:+SegmentedCodeCache + * compiler.codecache.jmx.ManagerNamesTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -XX:-SegmentedCodeCache + * compiler.codecache.jmx.ManagerNamesTest */ + +package compiler.codecache.jmx; + +import jdk.test.lib.Asserts; +import sun.hotspot.code.BlobType; + +import java.lang.management.MemoryPoolMXBean; + public class ManagerNamesTest { private final MemoryPoolMXBean bean; diff --git a/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java b/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java index a3a0308bd9a..b0796cd3213 100644 --- a/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java +++ b/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java @@ -21,29 +21,38 @@ * questions. */ +/** + * @test MemoryPoolsPresenceTest + * @summary verify that MemoryManagerMXBean exists for every code cache segment + * @modules java.base/jdk.internal.misc + * java.management + * @library /testlibrary /test/lib + * + * @build compiler.codecache.jmx.MemoryPoolsPresenceTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -XX:+SegmentedCodeCache + * compiler.codecache.jmx.MemoryPoolsPresenceTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -XX:-SegmentedCodeCache + * compiler.codecache.jmx.MemoryPoolsPresenceTest + */ + +package compiler.codecache.jmx; + import jdk.test.lib.Asserts; +import sun.hotspot.code.BlobType; + import java.lang.management.ManagementFactory; import java.lang.management.MemoryManagerMXBean; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; -import sun.hotspot.code.BlobType; -/** - * @test MemoryPoolsPresenceTest - * @library /testlibrary /test/lib - * @modules java.base/jdk.internal.misc - * @modules java.management - * @build MemoryPoolsPresenceTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache MemoryPoolsPresenceTest - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache MemoryPoolsPresenceTest - * @summary verify that MemoryManagerMXBean exists for every code cache segment - */ public class MemoryPoolsPresenceTest { private static final String CC_MANAGER = "CodeCacheManager"; diff --git a/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java b/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java index 458a29d3bff..e75a362142e 100644 --- a/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java +++ b/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java @@ -21,28 +21,35 @@ * questions. */ -import jdk.test.lib.Asserts; -import java.lang.management.MemoryPoolMXBean; -import sun.hotspot.code.BlobType; - /* * @test PeakUsageTest - * @library /testlibrary /test/lib - * @ignore 8151345 + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build PeakUsageTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox + * + * @ignore 8151345 + * @build ompiler.codecache.jmx.PeakUsageTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache - * -XX:CompileCommand=compileonly,null::* PeakUsageTest + * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::* + * -XX:+SegmentedCodeCache + * compiler.codecache.jmx.PeakUsageTest * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache - * -XX:CompileCommand=compileonly,null::* PeakUsageTest + * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::* + * -XX:-SegmentedCodeCache + * compiler.codecache.jmx.PeakUsageTest * @summary testing of getPeakUsage() and resetPeakUsage for * segmented code cache */ + +package compiler.codecache.jmx; + +import sun.hotspot.code.BlobType; + +import java.lang.management.MemoryPoolMXBean; + + public class PeakUsageTest { private final BlobType btype; diff --git a/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java b/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java index 5b5ee81c2d0..cd61fea7ac6 100644 --- a/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java +++ b/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java @@ -21,33 +21,43 @@ * questions. */ +/* + * @test PoolsIndependenceTest + * @summary testing of getUsageThreshold() + * @modules java.base/jdk.internal.misc + * java.management + * @library /testlibrary /test/lib / + * + * @build compiler.codecache.jmx.PoolsIndependenceTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing + * -XX:+SegmentedCodeCache + * compiler.codecache.jmx.PoolsIndependenceTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing + * -XX:-SegmentedCodeCache + * compiler.codecache.jmx.PoolsIndependenceTest + */ + +package compiler.codecache.jmx; + import jdk.test.lib.Asserts; import jdk.test.lib.Utils; +import sun.hotspot.code.BlobType; + +import javax.management.ListenerNotFoundException; +import javax.management.Notification; +import javax.management.NotificationEmitter; +import javax.management.NotificationListener; import java.lang.management.ManagementFactory; import java.lang.management.MemoryNotificationInfo; import java.lang.management.MemoryPoolMXBean; import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; -import javax.management.ListenerNotFoundException; -import javax.management.Notification; -import javax.management.NotificationEmitter; -import javax.management.NotificationListener; -import sun.hotspot.code.BlobType; -/* - * @test PoolsIndependenceTest - * @modules java.base/jdk.internal.misc - * java.management - * @library /testlibrary /test/lib - * @build PoolsIndependenceTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing - * -XX:-MethodFlushing -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:+SegmentedCodeCache PoolsIndependenceTest - * @summary testing of getUsageThreshold() - */ public class PoolsIndependenceTest implements NotificationListener { private final Map counters; diff --git a/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java b/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java index 7fde9594881..86b22cd5fec 100644 --- a/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java +++ b/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java @@ -21,31 +21,40 @@ * questions. */ +/* + * @test ThresholdNotificationsTest + * @summary testing of getUsageThreshold() + * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc + * java.management + * + * @build compiler.codecache.jmx.ThresholdNotificationsTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing + * -XX:+WhiteBoxAPI -XX:-MethodFlushing -XX:CompileCommand=compileonly,null::* + * -XX:+SegmentedCodeCache + * compiler.codecache.jmx.ThresholdNotificationsTest + * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing + * -XX:+WhiteBoxAPI -XX:-MethodFlushing -XX:CompileCommand=compileonly,null::* + * -XX:-SegmentedCodeCache + * compiler.codecache.jmx.ThresholdNotificationsTest + */ + +package compiler.codecache.jmx; + import jdk.test.lib.Asserts; import jdk.test.lib.Utils; -import java.lang.management.ManagementFactory; -import java.lang.management.MemoryNotificationInfo; -import java.lang.management.MemoryPoolMXBean; +import sun.hotspot.code.BlobType; + import javax.management.ListenerNotFoundException; import javax.management.Notification; import javax.management.NotificationEmitter; import javax.management.NotificationListener; -import sun.hotspot.code.BlobType; +import java.lang.management.ManagementFactory; +import java.lang.management.MemoryNotificationInfo; +import java.lang.management.MemoryPoolMXBean; -/* - * @test ThresholdNotificationsTest - * @library /testlibrary /test/lib - * @modules java.base/jdk.internal.misc - * java.management - * @build ThresholdNotificationsTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing - * -XX:-MethodFlushing -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:+SegmentedCodeCache -XX:CompileCommand=compileonly,null::* - * ThresholdNotificationsTest - * @summary testing of getUsageThreshold() - */ public class ThresholdNotificationsTest implements NotificationListener { private final static long WAIT_TIME = 10000L; @@ -80,8 +89,8 @@ public class ThresholdNotificationsTest implements NotificationListener { } protected void runTest() { - int iterationsCount = - Integer.getInteger("jdk.test.lib.iterations", 1); + int iterationsCount + = Integer.getInteger("jdk.test.lib.iterations", 1); MemoryPoolMXBean bean = btype.getMemoryPool(); ((NotificationEmitter) ManagementFactory.getMemoryMXBean()). addNotificationListener(this, null, null); diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java index aa605074379..e90222d8c1d 100644 --- a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java +++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java @@ -23,16 +23,23 @@ /* * @test UsageThresholdExceededSeveralTimesTest - * @library /testlibrary /test/lib - * @modules java.base/jdk.internal.misc - * java.management - * @build UsageThresholdExceededTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing - * -XX:-MethodFlushing -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:+SegmentedCodeCache -XX:CompileCommand=compileonly,null::* - * -Djdk.test.lib.iterations=10 UsageThresholdExceededTest * @summary verifying that getUsageThresholdCount() returns correct value * after threshold has been hit several times + * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc + * java.management + * + * @build compiler.codecache.jmx.UsageThresholdExceededTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing + * -XX:CompileCommand=compileonly,null::* -Djdk.test.lib.iterations=10 + * -XX:+SegmentedCodeCache + * compiler.codecache.jmx.UsageThresholdExceededTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing + * -XX:CompileCommand=compileonly,null::* -Djdk.test.lib.iterations=10 + * -XX:-SegmentedCodeCache + * compiler.codecache.jmx.UsageThresholdExceededTest */ diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java index 07008753870..baa2ebe351b 100644 --- a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java +++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java @@ -21,25 +21,35 @@ * questions. */ -import jdk.test.lib.Asserts; -import java.lang.management.MemoryPoolMXBean; -import sun.hotspot.code.BlobType; - /* * @test UsageThresholdExceededTest - * @library /testlibrary /test/lib - * @modules java.base/jdk.internal.misc - * java.management - * @build UsageThresholdExceededTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache -XX:-UseCodeCacheFlushing - * -XX:-MethodFlushing -XX:CompileCommand=compileonly,null::* - * UsageThresholdExceededTest * @summary verifying that getUsageThresholdCount() returns correct value * after threshold has been hit + * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc + * java.management + * + * @build compiler.codecache.jmx.UsageThresholdExceededTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing + * -XX:CompileCommand=compileonly,null::* + * -XX:+SegmentedCodeCache + * compiler.codecache.jmx.UsageThresholdExceededTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing + * -XX:CompileCommand=compileonly,null::* + * -XX:-SegmentedCodeCache + * compiler.codecache.jmx.UsageThresholdExceededTest */ + +package compiler.codecache.jmx; + +import sun.hotspot.code.BlobType; + +import java.lang.management.MemoryPoolMXBean; + public class UsageThresholdExceededTest { protected final int iterations; diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java index 8f2e6f10269..2f628229cf1 100644 --- a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java +++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java @@ -21,25 +21,35 @@ * questions. */ -import jdk.test.lib.Asserts; -import java.lang.management.MemoryPoolMXBean; -import sun.hotspot.code.BlobType; - /* * @test UsageThresholdIncreasedTest - * @library /testlibrary /test/lib - * @modules java.base/jdk.internal.misc - * java.management - * @build UsageThresholdIncreasedTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache -XX:-UseCodeCacheFlushing - * -XX:-MethodFlushing -XX:CompileCommand=compileonly,null::* - * UsageThresholdIncreasedTest * @summary verifying that threshold hasn't been hit after allocation smaller * than threshold value and that threshold value can be changed + * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc + * java.management + * + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @build compiler.codecache.jmx.UsageThresholdIncreasedTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing + * -XX:CompileCommand=compileonly,null::* + * -XX:-SegmentedCodeCache + * compiler.codecache.jmx.UsageThresholdIncreasedTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing + * -XX:CompileCommand=compileonly,null::* + * -XX:+SegmentedCodeCache + * compiler.codecache.jmx.UsageThresholdIncreasedTest */ + +package compiler.codecache.jmx; + +import sun.hotspot.code.BlobType; + +import java.lang.management.MemoryPoolMXBean; + public class UsageThresholdIncreasedTest { private static final int ALLOCATION_STEP = 5; diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java index 1838226fae4..46bd21b8b2d 100644 --- a/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java +++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java @@ -21,25 +21,35 @@ * questions. */ -import jdk.test.lib.Asserts; -import java.lang.management.MemoryPoolMXBean; -import sun.hotspot.code.BlobType; - /* * @test UsageThresholdNotExceededTest - * @library /testlibrary /test/lib - * @modules java.base/jdk.internal.misc - * java.management - * @build UsageThresholdNotExceededTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing - * -XX:-MethodFlushing -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:+SegmentedCodeCache -XX:CompileCommand=compileonly,null::* - * UsageThresholdNotExceededTest * @summary verifying that usage threshold not exceeded while allocating less * than usage threshold + * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc + * java.management + * + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @build compiler.codecache.jmx.UsageThresholdNotExceededTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing + * -XX:CompileCommand=compileonly,null::* + * -XX:+SegmentedCodeCache + * compiler.codecache.jmx.UsageThresholdNotExceededTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing + * -XX:CompileCommand=compileonly,null::* + * -XX:-SegmentedCodeCache + * compiler.codecache.jmx.UsageThresholdNotExceededTest */ + +package compiler.codecache.jmx; + +import sun.hotspot.code.BlobType; + +import java.lang.management.MemoryPoolMXBean; + public class UsageThresholdNotExceededTest { private final BlobType btype; diff --git a/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java b/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java index 7daa0a1a88c..e3d4a9af13f 100644 --- a/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java +++ b/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java @@ -22,6 +22,8 @@ * */ +package compiler.codecache.stress; + import jdk.test.lib.TimeLimitedRunner; import jdk.test.lib.Utils; diff --git a/hotspot/test/compiler/codecache/stress/Helper.java b/hotspot/test/compiler/codecache/stress/Helper.java index 2ac95f6fb3f..6399d30d5dc 100644 --- a/hotspot/test/compiler/codecache/stress/Helper.java +++ b/hotspot/test/compiler/codecache/stress/Helper.java @@ -22,11 +22,7 @@ * */ -import java.io.BufferedInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.concurrent.Callable; -import java.util.Random; +package compiler.codecache.stress; import jdk.test.lib.Asserts; import jdk.test.lib.ByteCodeLoader; @@ -34,18 +30,24 @@ import jdk.test.lib.InfiniteLoop; import jdk.test.lib.Utils; import sun.hotspot.WhiteBox; +import java.io.BufferedInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Random; +import java.util.concurrent.Callable; + public final class Helper { public static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); public static final Random RNG = Utils.getRandomInstance(); private static final long THRESHOLD = WHITE_BOX.getIntxVMFlag("CompileThreshold"); - private static final String TEST_CASE_IMPL_CLASS_NAME = "Helper$TestCaseImpl"; + private static final String TEST_CASE_IMPL_CLASS_NAME = "compiler.codecache.stress.Helper$TestCaseImpl"; private static byte[] CLASS_DATA; static { try { CLASS_DATA = loadClassData(TEST_CASE_IMPL_CLASS_NAME); } catch (IOException e) { - throw new Error("TESTBUG: cannot load class byte code", e); + throw new Error("TESTBUG: cannot load class byte code " + TEST_CASE_IMPL_CLASS_NAME, e); } } diff --git a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java index e4b60181575..e95b27069de 100644 --- a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java +++ b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java @@ -22,28 +22,36 @@ * */ -import java.lang.reflect.Method; -import java.util.stream.IntStream; +/* + * @test OverloadCompileQueueTest + * @summary stressing code cache by overloading compile queues + * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc + * java.management + * + * @ignore 8071905 + * @build compiler.codecache.stress.OverloadCompileQueueTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method + * -XX:-SegmentedCodeCache + * compiler.codecache.stress.OverloadCompileQueueTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method + * -XX:+SegmentedCodeCache + * compiler.codecache.stress.OverloadCompileQueueTest + */ + +package compiler.codecache.stress; import jdk.test.lib.Platform; -/* - * @test OverloadCompileQueueTest - * @library /testlibrary /test/lib - * @modules java.base/jdk.internal.misc - * java.management - * @ignore 8071905 - * @build OverloadCompileQueueTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:CompileCommand=dontinline,Helper$TestCase::method - * -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache OverloadCompileQueueTest - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:CompileCommand=dontinline,Helper$TestCase::method - * -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache OverloadCompileQueueTest - * @summary stressing code cache by overloading compile queues - */ +import java.lang.reflect.Method; +import java.util.stream.IntStream; + public class OverloadCompileQueueTest implements Runnable { private static final int MAX_SLEEP = 10000; private static final String METHOD_TO_ENQUEUE = "method"; diff --git a/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java b/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java index 3000cae7466..f1b8fd26890 100644 --- a/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java +++ b/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java @@ -22,26 +22,34 @@ * */ -import java.util.ArrayList; +/* + * @test RandomAllocationTest + * @summary stressing code cache by allocating randomly sized "dummy" code blobs + * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc + * java.management + * + * @build compiler.codecache.stress.RandomAllocationTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method + * -XX:-SegmentedCodeCache + * compiler.codecache.stress.RandomAllocationTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method + * -XX:+SegmentedCodeCache + * compiler.codecache.stress.RandomAllocationTest + */ + +package compiler.codecache.stress; import sun.hotspot.code.BlobType; -/* - * @test RandomAllocationTest - * @library /testlibrary /test/lib - * @modules java.base/jdk.internal.misc - * java.management - * @build RandomAllocationTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:CompileCommand=dontinline,Helper$TestCase::method - * -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache RandomAllocationTest - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:CompileCommand=dontinline,Helper$TestCase::method - * -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache RandomAllocationTest - * @summary stressing code cache by allocating randomly sized "dummy" code blobs - */ +import java.util.ArrayList; + public class RandomAllocationTest implements Runnable { private static final long CODE_CACHE_SIZE = Helper.WHITE_BOX.getUintxVMFlag("ReservedCodeCacheSize"); diff --git a/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java b/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java index 0eb051ef671..c6e455d4986 100644 --- a/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java +++ b/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java @@ -24,22 +24,28 @@ /* * @test UnexpectedDeoptimizationTest - * @library /testlibrary /test/lib + * @summary stressing code cache by forcing unexpected deoptimizations + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build UnexpectedDeoptimizationTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * + * @build compiler.codecache.stress.UnexpectedDeoptimizationTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:CompileCommand=dontinline,Helper$TestCase::method - * -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache -XX:-DeoptimizeRandom - * UnexpectedDeoptimizationTest + * -XX:+WhiteBoxAPI -XX:-DeoptimizeRandom + * -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method + * -XX:-SegmentedCodeCache + * compiler.codecache.stress.UnexpectedDeoptimizationTest * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:CompileCommand=dontinline,Helper$TestCase::method - * -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache -XX:-DeoptimizeRandom - * UnexpectedDeoptimizationTest - * @summary stressing code cache by forcing unexpected deoptimizations + * -XX:+WhiteBoxAPI -XX:-DeoptimizeRandom + * -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method + * -XX:+SegmentedCodeCache + * compiler.codecache.stress.UnexpectedDeoptimizationTest */ + +package compiler.codecache.stress; + public class UnexpectedDeoptimizationTest implements Runnable { public static void main(String[] args) { diff --git a/hotspot/test/compiler/codegen/6431242/Test.java b/hotspot/test/compiler/codegen/6431242/Test.java deleted file mode 100644 index 603a1e5e732..00000000000 --- a/hotspot/test/compiler/codegen/6431242/Test.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2006, 2013, 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 6431242 - * @run main Test - */ - -public class Test{ - - int _len = 8; - int[] _arr_i = new int[_len]; - long[] _arr_l = new long[_len]; - - int[] _arr_i_cp = new int [_len]; - long[] _arr_l_cp = new long [_len]; - - int _k = 0x12345678; - int _j = 0; - int _ir = 0x78563412; - int _ir1 = 0x78563413; - int _ir2 = 0x79563412; - - long _m = 0x123456789abcdef0L; - long _l = 0L; - long _lr = 0xf0debc9a78563412L; - long _lr1 = 0xf0debc9a78563413L; - long _lr2 = 0xf1debc9a78563412L; - - void init() { - for (int i=0; i<_arr_i.length; i++) { - _arr_i[i] = _k; - _arr_l[i] = _m; - } - } - - public int test_int_reversed(int i) { - return Integer.reverseBytes(i); - } - - public long test_long_reversed(long i) { - return Long.reverseBytes(i); - } - - public void test_copy_ints(int[] dst, int[] src) { - for(int i=0; i>> 17); - return (y ^= (y << 5)); + public long nextLong() { + y ^= (y << 13); + y ^= (y >>> 17); + return (y ^= (y << 5)); + } } } diff --git a/hotspot/test/compiler/codegen/C1NullCheckOfNullStore.java b/hotspot/test/compiler/codegen/C1NullCheckOfNullStore.java index 0bec2c1ab42..67ddccc9392 100644 --- a/hotspot/test/compiler/codegen/C1NullCheckOfNullStore.java +++ b/hotspot/test/compiler/codegen/C1NullCheckOfNullStore.java @@ -25,33 +25,39 @@ * @test * @bug 8039043 * @summary Null check is placed in a wrong place when storing a null to an object field on x64 with compressed oops off - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CompileCommand=compileonly,C1NullCheckOfNullStore::test -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-UseCompressedOops C1NullCheckOfNullStore * + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-UseCompressedOops + * -XX:CompileCommand=compileonly,compiler.codegen.C1NullCheckOfNullStore::test + * compiler.codegen.C1NullCheckOfNullStore */ +package compiler.codegen; + public class C1NullCheckOfNullStore { - private static class Foo { - Object bar; - } - static private void test(Foo x) { - x.bar = null; - } - static public void main(String args[]) { - Foo x = new Foo(); - for (int i = 0; i < 10000; i++) { - test(x); + private static class Foo { + Object bar; } - boolean gotNPE = false; - try { - for (int i = 0; i < 10000; i++) { - test(null); - } + + static private void test(Foo x) { + x.bar = null; } - catch(NullPointerException e) { - gotNPE = true; + + static public void main(String args[]) { + Foo x = new Foo(); + for (int i = 0; i < 10000; i++) { + test(x); + } + boolean gotNPE = false; + try { + for (int i = 0; i < 10000; i++) { + test(null); + } + } catch (NullPointerException e) { + gotNPE = true; + } + if (!gotNPE) { + throw new Error("Expecting a NullPointerException"); + } } - if (!gotNPE) { - throw new Error("Expecting a NullPointerException"); - } - } } diff --git a/hotspot/test/compiler/codegen/7088419/CRCTest.java b/hotspot/test/compiler/codegen/CRCTest.java similarity index 96% rename from hotspot/test/compiler/codegen/7088419/CRCTest.java rename to hotspot/test/compiler/codegen/CRCTest.java index fa1f520cca8..950e9ad5069 100644 --- a/hotspot/test/compiler/codegen/7088419/CRCTest.java +++ b/hotspot/test/compiler/codegen/CRCTest.java @@ -22,12 +22,15 @@ */ /* - @test - @bug 7088419 - @run main CRCTest - @summary Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32 and java.util.zip.Adler32 + * @test + * @bug 7088419 + * @summary Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32 and java.util.zip.Adler32 + * + * @run main compiler.codegen.CRCTest */ +package compiler.codegen; + import java.nio.ByteBuffer; import java.util.zip.CRC32; import java.util.zip.Checksum; diff --git a/hotspot/test/compiler/codegen/IntRotateWithImmediate.java b/hotspot/test/compiler/codegen/IntRotateWithImmediate.java index 3da2aec0afa..ae8ef235127 100644 --- a/hotspot/test/compiler/codegen/IntRotateWithImmediate.java +++ b/hotspot/test/compiler/codegen/IntRotateWithImmediate.java @@ -28,51 +28,54 @@ * @bug 8154537 * @key regression * @summary Test that the rotate distance used in the rotate instruction is properly masked with 0x1f - * @run main/othervm -Xbatch -XX:-UseOnStackReplacement IntRotateWithImmediate + * + * @run main/othervm -Xbatch -XX:-UseOnStackReplacement compiler.codegen.IntRotateWithImmediate * @author volker.simonis@gmail.com */ +package compiler.codegen; + public class IntRotateWithImmediate { - // This is currently the same as Integer.rotateRight() - static int rotateRight1(int i, int distance) { - // On some architectures (i.e. x86_64 and ppc64) the following computation is - // matched in the .ad file into a single MachNode which emmits a single rotate - // machine instruction. It is important that the shift amount is masked to match - // corresponding immediate width in the native instruction. On x86_64 the rotate - // left instruction ('rol') encodes an 8-bit immediate while the corresponding - // 'rotlwi' instruction on Power only encodes a 5-bit immediate. - return ((i >>> distance) | (i << -distance)); - } - - static int rotateRight2(int i, int distance) { - return ((i >>> distance) | (i << (32-distance))); - } - - static int compute1(int x) { - return rotateRight1(x, 3); - } - - static int compute2(int x) { - return rotateRight2(x, 3); - } - - public static void main(String args[]) { - int val = 4096; - - int firstResult = compute1(val); - - for (int i = 0; i < 100000; i++) { - int newResult = compute1(val); - if (firstResult != newResult) { - throw new InternalError(firstResult + " != " + newResult); - } - newResult = compute2(val); - if (firstResult != newResult) { - throw new InternalError(firstResult + " != " + newResult); - } + // This is currently the same as Integer.rotateRight() + static int rotateRight1(int i, int distance) { + // On some architectures (i.e. x86_64 and ppc64) the following computation is + // matched in the .ad file into a single MachNode which emmits a single rotate + // machine instruction. It is important that the shift amount is masked to match + // corresponding immediate width in the native instruction. On x86_64 the rotate + // left instruction ('rol') encodes an 8-bit immediate while the corresponding + // 'rotlwi' instruction on Power only encodes a 5-bit immediate. + return ((i >>> distance) | (i << -distance)); + } + + static int rotateRight2(int i, int distance) { + return ((i >>> distance) | (i << (32 - distance))); + } + + static int compute1(int x) { + return rotateRight1(x, 3); + } + + static int compute2(int x) { + return rotateRight2(x, 3); + } + + public static void main(String args[]) { + int val = 4096; + + int firstResult = compute1(val); + + for (int i = 0; i < 100000; i++) { + int newResult = compute1(val); + if (firstResult != newResult) { + throw new InternalError(firstResult + " != " + newResult); + } + newResult = compute2(val); + if (firstResult != newResult) { + throw new InternalError(firstResult + " != " + newResult); + } + } + System.out.println("OK"); } - System.out.println("OK"); - } } diff --git a/hotspot/test/compiler/codegen/LoadWithMask.java b/hotspot/test/compiler/codegen/LoadWithMask.java index 06c4c14a4ac..bea0df8a34b 100644 --- a/hotspot/test/compiler/codegen/LoadWithMask.java +++ b/hotspot/test/compiler/codegen/LoadWithMask.java @@ -25,20 +25,26 @@ * @test * @bug 8032207 * @summary Invalid node sizing for loadUS2L_immI16 and loadI2L_immI - * @run main/othervm -Xbatch -XX:CompileCommand=compileonly,LoadWithMask.foo LoadWithMask * + * @run main/othervm -Xbatch + * -XX:CompileCommand=compileonly,compiler.codegen.LoadWithMask::foo + * compiler.codegen.LoadWithMask */ -public class LoadWithMask { - static int x[] = new int[1]; - static long foo() { - return x[0] & 0xfff0ffff; - } - public static void main(String[] args) { - x[0] = -1; - long l = 0; - for (int i = 0; i < 100000; ++i) { - l = foo(); +package compiler.codegen; + +public class LoadWithMask { + static int x[] = new int[1]; + + static long foo() { + return x[0] & 0xfff0ffff; + } + + public static void main(String[] args) { + x[0] = -1; + long l = 0; + for (int i = 0; i < 100000; ++i) { + l = foo(); + } } - } } diff --git a/hotspot/test/compiler/codegen/LoadWithMask2.java b/hotspot/test/compiler/codegen/LoadWithMask2.java index 82c942d7ad1..840e321ab2d 100644 --- a/hotspot/test/compiler/codegen/LoadWithMask2.java +++ b/hotspot/test/compiler/codegen/LoadWithMask2.java @@ -25,31 +25,39 @@ * @test * @bug 8031743 * @summary loadI2L_immI broken for negative memory values - * @run main/othervm -Xbatch -XX:CompileCommand=compileonly,*.foo* LoadWithMask2 * + * @run main/othervm -Xbatch + * -XX:CompileCommand=compileonly,compiler.codegen.LoadWithMask2::foo* + * compiler.codegen.LoadWithMask2 */ -public class LoadWithMask2 { - static int x; - static long foo1() { - return x & 0xfffffffe; - } - static long foo2() { - return x & 0xff000000; - } - static long foo3() { - return x & 0x8abcdef1; - } - public static void main(String[] args) { - x = -1; - long l = 0; - for (int i = 0; i < 100000; ++i) { - l = foo1() & foo2() & foo3(); +package compiler.codegen; + +public class LoadWithMask2 { + static int x; + + static long foo1() { + return x & 0xfffffffe; } - if (l > 0) { - System.out.println("FAILED"); - System.exit(97); + + static long foo2() { + return x & 0xff000000; + } + + static long foo3() { + return x & 0x8abcdef1; + } + + public static void main(String[] args) { + x = -1; + long l = 0; + for (int i = 0; i < 100000; ++i) { + l = foo1() & foo2() & foo3(); + } + if (l > 0) { + System.out.println("FAILED"); + System.exit(97); + } + System.out.println("PASSED"); } - System.out.println("PASSED"); - } } diff --git a/hotspot/test/compiler/codegen/6378821/Test6378821.java b/hotspot/test/compiler/codegen/Test6378821.java similarity index 94% rename from hotspot/test/compiler/codegen/6378821/Test6378821.java rename to hotspot/test/compiler/codegen/Test6378821.java index 2010d726589..e8ebe5f6923 100644 --- a/hotspot/test/compiler/codegen/6378821/Test6378821.java +++ b/hotspot/test/compiler/codegen/Test6378821.java @@ -26,9 +26,13 @@ * @bug 6378821 * @summary where available, bitCount() should use POPC on SPARC processors and AMD+10h * - * @run main/othervm -Xcomp -XX:CompileOnly=Test6378821.fcomp Test6378821 + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.codegen.Test6378821::fcomp + * compiler.codegen.Test6378821 */ +package compiler.codegen; + public class Test6378821 { static final int[] ia = new int[] { 0x12345678 }; static final long[] la = new long[] { 0x12345678abcdefL }; diff --git a/hotspot/test/compiler/codegen/Test6431242.java b/hotspot/test/compiler/codegen/Test6431242.java new file mode 100644 index 00000000000..68b92a9793c --- /dev/null +++ b/hotspot/test/compiler/codegen/Test6431242.java @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2006, 2013, 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 6431242 + * + * @run main compiler.codegen.Test6431242 + */ + +package compiler.codegen; + +public class Test6431242 { + + int _len = 8; + int[] _arr_i = new int[_len]; + long[] _arr_l = new long[_len]; + + int[] _arr_i_cp = new int[_len]; + long[] _arr_l_cp = new long[_len]; + + int _k = 0x12345678; + int _j = 0; + int _ir = 0x78563412; + int _ir1 = 0x78563413; + int _ir2 = 0x79563412; + + long _m = 0x123456789abcdef0L; + long _l = 0L; + long _lr = 0xf0debc9a78563412L; + long _lr1 = 0xf0debc9a78563413L; + long _lr2 = 0xf1debc9a78563412L; + + void init() { + for (int i = 0; i < _arr_i.length; i++) { + _arr_i[i] = _k; + _arr_l[i] = _m; + } + } + + public int test_int_reversed(int i) { + return Integer.reverseBytes(i); + } + + public long test_long_reversed(long i) { + return Long.reverseBytes(i); + } + + public void test_copy_ints(int[] dst, int[] src) { + for (int i = 0; i < src.length; i++) { + dst[i] = Integer.reverseBytes(src[i]); + } + } + + public void test_copy_ints_reversed(int[] dst, int[] src) { + for (int i = 0; i < src.length; i++) { + dst[i] = 1 + Integer.reverseBytes(src[i]); + } + } + + public void test_copy_ints_store_reversed(int[] dst, int[] src) { + for (int i = 0; i < src.length; i++) { + dst[i] = Integer.reverseBytes(1 + src[i]); + } + } + + public void test_copy_longs(long[] dst, long[] src) { + for (int i = 0; i < src.length; i++) { + dst[i] = Long.reverseBytes(src[i]); + } + } + + public void test_copy_longs_reversed(long[] dst, long[] src) { + for (int i = 0; i < src.length; i++) { + dst[i] = 1 + Long.reverseBytes(src[i]); + } + } + + public void test_copy_longs_store_reversed(long[] dst, long[] src) { + for (int i = 0; i < src.length; i++) { + dst[i] = Long.reverseBytes(1 + src[i]); + } + } + + public void test() throws Exception { + int up_limit = 90000; + + + //test single + + for (int loop = 0; loop < up_limit; loop++) { + _j = test_int_reversed(_k); + if (_j != _ir) { + throw new Exception("Interger.reverseBytes failed " + _j + " iter " + loop); + } + _l = test_long_reversed(_m); + if (_l != _lr) { + throw new Exception("Long.reverseBytes failed " + _l + " iter " + loop); + } + } + + // test scalar load/store + for (int loop = 0; loop < up_limit; loop++) { + + test_copy_ints(_arr_i_cp, _arr_i); + for (int j = 0; j < _arr_i.length; j++) { + if (_arr_i_cp[j] != _ir) { + throw new Exception("Interger.reverseBytes failed test_copy_ints iter " + loop); + } + } + + test_copy_ints_reversed(_arr_i_cp, _arr_i); + for (int j = 0; j < _arr_i.length; j++) { + if (_arr_i_cp[j] != _ir1) { + throw new Exception("Interger.reverseBytes failed test_copy_ints_reversed iter " + loop); + } + } + test_copy_ints_store_reversed(_arr_i_cp, _arr_i); + for (int j = 0; j < _arr_i.length; j++) { + if (_arr_i_cp[j] != _ir2) { + throw new Exception("Interger.reverseBytes failed test_copy_ints_store_reversed iter " + loop); + } + } + + test_copy_longs(_arr_l_cp, _arr_l); + for (int j = 0; j < _arr_i.length; j++) { + if (_arr_l_cp[j] != _lr) { + throw new Exception("Long.reverseBytes failed test_copy_longs iter " + loop); + } + } + test_copy_longs_reversed(_arr_l_cp, _arr_l); + for (int j = 0; j < _arr_i.length; j++) { + if (_arr_l_cp[j] != _lr1) { + throw new Exception("Long.reverseBytes failed test_copy_longs_reversed iter " + loop); + } + } + test_copy_longs_store_reversed(_arr_l_cp, _arr_l); + for (int j = 0; j < _arr_i.length; j++) { + if (_arr_l_cp[j] != _lr2) { + throw new Exception("Long.reverseBytes failed test_copy_longs_store_reversed iter " + loop); + } + } + + } + } + + public static void main(String args[]) { + try { + Test6431242 t = new Test6431242(); + t.init(); + t.test(); + System.out.println("Passed"); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("Failed"); + } + } +} diff --git a/hotspot/test/compiler/codegen/6797305/Test6797305.java b/hotspot/test/compiler/codegen/Test6797305.java similarity index 92% rename from hotspot/test/compiler/codegen/6797305/Test6797305.java rename to hotspot/test/compiler/codegen/Test6797305.java index 139c1657f09..7c51e03f9b2 100644 --- a/hotspot/test/compiler/codegen/6797305/Test6797305.java +++ b/hotspot/test/compiler/codegen/Test6797305.java @@ -26,9 +26,13 @@ * @bug 6797305 * @summary Add LoadUB and LoadUI opcode class * - * @run main/othervm -Xcomp -XX:CompileOnly=Test6797305.loadB,Test6797305.loadB2L,Test6797305.loadUB,Test6797305.loadUBmask,Test6797305.loadUB2L,Test6797305.loadS,Test6797305.loadS2L,Test6797305.loadUS,Test6797305.loadUSmask,Test6797305.loadUS2L,Test6797305.loadI,Test6797305.loadI2L,Test6797305.loadUI2L,Test6797305.loadL Test6797305 + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.codegen.Test6797305::load* + * compiler.codegen.Test6797305 */ +package compiler.codegen; + public class Test6797305 { static final byte[] ba = new byte[] { -1 }; static final short[] sa = new short[] { -1 }; diff --git a/hotspot/test/compiler/codegen/6814842/Test6814842.java b/hotspot/test/compiler/codegen/Test6814842.java similarity index 92% rename from hotspot/test/compiler/codegen/6814842/Test6814842.java rename to hotspot/test/compiler/codegen/Test6814842.java index a7c8b445aec..9f35df6173b 100644 --- a/hotspot/test/compiler/codegen/6814842/Test6814842.java +++ b/hotspot/test/compiler/codegen/Test6814842.java @@ -26,9 +26,13 @@ * @bug 6814842 * @summary Load shortening optimizations * - * @run main/othervm -Xcomp -XX:CompileOnly=Test6814842.loadS2B,Test6814842.loadS2Bmask255,Test6814842.loadUS2B,Test6814842.loadUS2Bmask255,Test6814842.loadI2B,Test6814842.loadI2Bmask255,Test6814842.loadI2S,Test6814842.loadI2Smask255,Test6814842.loadI2Smask65535,Test6814842.loadI2US,Test6814842.loadI2USmask255,Test6814842.loadI2USmask65535 Test6814842 + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.codegen.Test6814842::load* + * compiler.codegen.Test6814842 */ +package compiler.codegen; + public class Test6814842 { static final short[] sa = new short[] { (short) 0xF1F2 }; static final char[] ca = new char[] { (char) 0xF3F4 }; diff --git a/hotspot/test/compiler/codegen/6823354/Test6823354.java b/hotspot/test/compiler/codegen/Test6823354.java similarity index 92% rename from hotspot/test/compiler/codegen/6823354/Test6823354.java rename to hotspot/test/compiler/codegen/Test6823354.java index 1ba60e1a3b6..7ff6f2ca94d 100644 --- a/hotspot/test/compiler/codegen/6823354/Test6823354.java +++ b/hotspot/test/compiler/codegen/Test6823354.java @@ -27,9 +27,17 @@ * @summary These methods can be instrinsified by using bit scan, bit test, and population count instructions. * @modules java.base/jdk.internal.misc * @library /testlibrary - * @run main/othervm -Xcomp -XX:CompileOnly=Test6823354.lzcomp,Test6823354.tzcomp,.dolzcomp,.dotzcomp Test6823354 + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.codegen.Test6823354::lzcomp + * -XX:CompileCommand=compileonly,compiler.codegen.Test6823354::tzcomp + * -XX:CompileCommand=compileonly,compiler.codegen.*::dolzcomp + * -XX:CompileCommand=compileonly,compiler.codegen.*::dotzcomp + * compiler.codegen.Test6823354 */ +package compiler.codegen; + import jdk.test.lib.Utils; public class Test6823354 { @@ -63,7 +71,7 @@ public class Test6823354 { check(x, lzcomp(x), lzint(x)); } - String classname = "Test6823354$lzconI"; + String classname = Test6823354.class.getName() + "$lzconI"; // Test Ideal optimizations (constant values). for (int i = 0; i < ia.length; i++) { @@ -91,7 +99,7 @@ public class Test6823354 { check(x, lzcomp(x), lzint(x)); } - classname = "Test6823354$lzconL"; + classname = Test6823354.class.getName() + "$lzconL"; // Test Ideal optimizations (constant values). for (int i = 0; i < la.length; i++) { @@ -120,7 +128,7 @@ public class Test6823354 { check(x, tzcomp(x), tzint(x)); } - String classname = "Test6823354$tzconI"; + String classname = Test6823354.class.getName() + "$tzconI"; // Test Ideal optimizations (constant values). for (int i = 0; i < ia.length; i++) { @@ -148,7 +156,7 @@ public class Test6823354 { check(x, tzcomp(x), tzint(x)); } - classname = "Test6823354$tzconL"; + classname = Test6823354.class.getName() + "$tzconL"; // Test Ideal optimizations (constant values). for (int i = 0; i < la.length; i++) { diff --git a/hotspot/test/compiler/codegen/6875866/Test.java b/hotspot/test/compiler/codegen/Test6875866.java similarity index 73% rename from hotspot/test/compiler/codegen/6875866/Test.java rename to hotspot/test/compiler/codegen/Test6875866.java index 8b9da1ae98d..9c10fb27ff8 100644 --- a/hotspot/test/compiler/codegen/6875866/Test.java +++ b/hotspot/test/compiler/codegen/Test6875866.java @@ -26,21 +26,24 @@ * @bug 6875866 * @summary Intrinsic for String.indexOf() is broken on x86 with SSE4.2 * - * @run main/othervm -Xcomp Test + * @run main/othervm -Xcomp compiler.codegen.Test6875866 */ -public class Test { - static int IndexOfTest(String str) { - return str.indexOf("11111xx1x"); - } +package compiler.codegen; - public static void main(String args[]) { - String str = "11111xx11111xx1x"; - int idx = IndexOfTest(str); - System.out.println("IndexOf = " + idx); - if (idx != 7) { - System.exit(97); +public class Test6875866 { + + static int IndexOfTest(String str) { + return str.indexOf("11111xx1x"); + } + + public static void main(String args[]) { + String str = "11111xx11111xx1x"; + int idx = IndexOfTest(str); + System.out.println("IndexOf = " + idx); + if (idx != 7) { + System.exit(97); + } } - } } diff --git a/hotspot/test/compiler/codegen/6879902/Test6879902.java b/hotspot/test/compiler/codegen/Test6879902.java similarity index 99% rename from hotspot/test/compiler/codegen/6879902/Test6879902.java rename to hotspot/test/compiler/codegen/Test6879902.java index 5e3911939f3..4156d74dc47 100644 --- a/hotspot/test/compiler/codegen/6879902/Test6879902.java +++ b/hotspot/test/compiler/codegen/Test6879902.java @@ -26,9 +26,11 @@ * @bug 6879902 * @summary CTW failure jdk6_18/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp:845 * - * @run main Test6879902 + * @run main compiler.codegen.Test6879902 */ +package compiler.codegen; + import java.util.Arrays; public class Test6879902 { diff --git a/hotspot/test/compiler/codegen/6896617/Test6896617.java b/hotspot/test/compiler/codegen/Test6896617.java similarity index 99% rename from hotspot/test/compiler/codegen/6896617/Test6896617.java rename to hotspot/test/compiler/codegen/Test6896617.java index c83a22a982d..90e4854f321 100644 --- a/hotspot/test/compiler/codegen/6896617/Test6896617.java +++ b/hotspot/test/compiler/codegen/Test6896617.java @@ -29,11 +29,14 @@ * @modules java.base/jdk.internal.misc * java.base/sun.nio.cs * java.management - * @run main/othervm/timeout=1200 -Xbatch -Xmx256m Test6896617 * + * @run main/othervm/timeout=1200 -Xbatch -Xmx256m compiler.codegen.Test6896617 */ +package compiler.codegen; + import jdk.test.lib.Utils; + import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; diff --git a/hotspot/test/compiler/codegen/6909839/Test6909839.java b/hotspot/test/compiler/codegen/Test6909839.java similarity index 98% rename from hotspot/test/compiler/codegen/6909839/Test6909839.java rename to hotspot/test/compiler/codegen/Test6909839.java index 78b5ce5c58c..daea8b798d1 100644 --- a/hotspot/test/compiler/codegen/6909839/Test6909839.java +++ b/hotspot/test/compiler/codegen/Test6909839.java @@ -27,9 +27,11 @@ * @bug 6909839 * @summary missing unsigned compare cases for some cmoves in sparc.ad * - * @run main/othervm -XX:+AggressiveOpts -Xbatch Test6909839 + * @run main/othervm -XX:+AggressiveOpts -Xbatch compiler.codegen.Test6909839 */ +package compiler.codegen; + public class Test6909839 { public static void main(String[] args) { testi(); diff --git a/hotspot/test/compiler/codegen/6935535/Test.java b/hotspot/test/compiler/codegen/Test6935535.java similarity index 68% rename from hotspot/test/compiler/codegen/6935535/Test.java rename to hotspot/test/compiler/codegen/Test6935535.java index a2576c2cf53..815e972f78e 100644 --- a/hotspot/test/compiler/codegen/6935535/Test.java +++ b/hotspot/test/compiler/codegen/Test6935535.java @@ -26,23 +26,25 @@ * @bug 6935535 * @summary String.indexOf() returns incorrect result on x86 with SSE4.2 * - * @run main/othervm -Xcomp Test + * @run main/othervm -Xcomp compiler.codegen.Test6935535 */ -public class Test { +package compiler.codegen; - static int IndexOfTest(String str) { - return str.indexOf("1111111111111xx1x"); - } +public class Test6935535 { - public static void main(String args[]) { - String str = "1111111111111xx1111111111111xx1x"; - str = str.substring(0, 31); - int idx = IndexOfTest(str); - System.out.println("IndexOf(" + "1111111111111xx1x" + ") = " + idx + " in " + str); - if (idx != -1) { - System.exit(97); + static int IndexOfTest(String str) { + return str.indexOf("1111111111111xx1x"); + } + + public static void main(String args[]) { + String str = "1111111111111xx1111111111111xx1x"; + str = str.substring(0, 31); + int idx = IndexOfTest(str); + System.out.println("IndexOf(" + "1111111111111xx1x" + ") = " + idx + " in " + str); + if (idx != -1) { + System.exit(97); + } } - } } diff --git a/hotspot/test/compiler/codegen/6942326/Test.java b/hotspot/test/compiler/codegen/Test6942326.java similarity index 95% rename from hotspot/test/compiler/codegen/6942326/Test.java rename to hotspot/test/compiler/codegen/Test6942326.java index cd3d97e498b..08e754d6e63 100644 --- a/hotspot/test/compiler/codegen/6942326/Test.java +++ b/hotspot/test/compiler/codegen/Test6942326.java @@ -27,11 +27,20 @@ * @bug 6942326 * @summary x86 code in string_indexof() could read beyond reserved heap space * - * @run main/othervm/timeout=300 -Xmx32m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CompileCommand=exclude,Test,main -XX:CompileCommand=exclude,Test,test_varsub_indexof -XX:CompileCommand=exclude,Test,test_varstr_indexof -XX:CompileCommand=exclude,Test,test_missub_indexof -XX:CompileCommand=exclude,Test,test_consub_indexof -XX:CompileCommand=exclude,Test,test_conmis_indexof -XX:CompileCommand=exclude,Test,test_subcon Test - * + * @run main/othervm/timeout=300 -Xmx32m -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:CompileCommand=exclude,compiler.codegen.Test6942326::main + * -XX:CompileCommand=exclude,compiler.codegen.Test6942326::test_varsub_indexof + * -XX:CompileCommand=exclude,compiler.codegen.Test6942326::test_varstr_indexof + * -XX:CompileCommand=exclude,compiler.codegen.Test6942326::test_missub_indexof + * -XX:CompileCommand=exclude,compiler.codegen.Test6942326::test_consub_indexof + * -XX:CompileCommand=exclude,compiler.codegen.Test6942326::test_conmis_indexof + * -XX:CompileCommand=exclude,compiler.codegen.Test6942326::test_subcon + * compiler.codegen.Test6942326 */ -public class Test { +package compiler.codegen; + +public class Test6942326 { static String[] strings = new String[1024]; private static final int ITERATIONS = 100000; diff --git a/hotspot/test/compiler/codegen/7009231/Test7009231.java b/hotspot/test/compiler/codegen/Test7009231.java similarity index 97% rename from hotspot/test/compiler/codegen/7009231/Test7009231.java rename to hotspot/test/compiler/codegen/Test7009231.java index 64afc6601ef..a384d0f1190 100644 --- a/hotspot/test/compiler/codegen/7009231/Test7009231.java +++ b/hotspot/test/compiler/codegen/Test7009231.java @@ -27,13 +27,12 @@ * @bug 7009231 * @summary C1: Incorrect CAS code for longs on SPARC 32bit * - * @run main/othervm -Xbatch Test7009231 - * + * @run main/othervm -Xbatch compiler.codegen.Test7009231 */ -import java.util.Random; -import java.util.concurrent.atomic.AtomicLong; +package compiler.codegen; +import java.util.concurrent.atomic.AtomicLong; public class Test7009231 { public static void main(String[] args) throws InterruptedException { diff --git a/hotspot/test/compiler/codegen/7100757/Test7100757.java b/hotspot/test/compiler/codegen/Test7100757.java similarity index 97% rename from hotspot/test/compiler/codegen/7100757/Test7100757.java rename to hotspot/test/compiler/codegen/Test7100757.java index d4006168670..3736d85c7fb 100644 --- a/hotspot/test/compiler/codegen/7100757/Test7100757.java +++ b/hotspot/test/compiler/codegen/Test7100757.java @@ -29,10 +29,14 @@ * @library /testlibrary * @modules java.base/jdk.internal.misc * java.management - * @run main/timeout=300 Test7100757 + * + * @run main/timeout=300 compiler.codegen.Test7100757 */ +package compiler.codegen; + import jdk.test.lib.Utils; + import java.util.BitSet; import java.util.Random; diff --git a/hotspot/test/compiler/codegen/8005033/Test8005033.java b/hotspot/test/compiler/codegen/Test8005033.java similarity index 91% rename from hotspot/test/compiler/codegen/8005033/Test8005033.java rename to hotspot/test/compiler/codegen/Test8005033.java index 1918136d67e..84630ad01da 100644 --- a/hotspot/test/compiler/codegen/8005033/Test8005033.java +++ b/hotspot/test/compiler/codegen/Test8005033.java @@ -25,10 +25,15 @@ * @test * @bug 8005033 * @summary On sparcv9, C2's intrinsic for Integer.bitCount(OV) returns wrong result if OV is the result of an operation with int overflow. - * @run main/othervm -Xcomp -XX:CompileOnly=Test8005033::testBitCount Test8005033 + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileony,compiler.codegen.Test8005033::testBitCount + * compiler.codegen.Test8005033 * @author Richard Reingruber richard DOT reingruber AT sap DOT com */ +package compiler.codegen; + public class Test8005033 { public static int MINUS_ONE = -1; diff --git a/hotspot/test/compiler/codegen/8011901/Test8011901.java b/hotspot/test/compiler/codegen/Test8011901.java similarity index 95% rename from hotspot/test/compiler/codegen/8011901/Test8011901.java rename to hotspot/test/compiler/codegen/Test8011901.java index 837a92c0058..6a865c1e894 100644 --- a/hotspot/test/compiler/codegen/8011901/Test8011901.java +++ b/hotspot/test/compiler/codegen/Test8011901.java @@ -26,13 +26,16 @@ * @bug 8011901 * @summary instruct xaddL_no_res shouldn't allow 64 bit constants. * @modules java.base/jdk.internal.misc - * @run main/othervm -XX:-BackgroundCompilation Test8011901 * + * @run main/othervm -XX:-BackgroundCompilation compiler.codegen.Test8011901 */ -import java.lang.reflect.Field; +package compiler.codegen; + import jdk.internal.misc.Unsafe; +import java.lang.reflect.Field; + public class Test8011901 { private long ctl; diff --git a/hotspot/test/compiler/codegen/7119644/TestBooleanVect.java b/hotspot/test/compiler/codegen/TestBooleanVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestBooleanVect.java rename to hotspot/test/compiler/codegen/TestBooleanVect.java index d4e3ad68d5f..2b6363e71e0 100644 --- a/hotspot/test/compiler/codegen/7119644/TestBooleanVect.java +++ b/hotspot/test/compiler/codegen/TestBooleanVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestBooleanVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestBooleanVect */ +package compiler.codegen; + public class TestBooleanVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestByteDoubleVect.java b/hotspot/test/compiler/codegen/TestByteDoubleVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestByteDoubleVect.java rename to hotspot/test/compiler/codegen/TestByteDoubleVect.java index acf71bf218b..e9376c1b407 100644 --- a/hotspot/test/compiler/codegen/7119644/TestByteDoubleVect.java +++ b/hotspot/test/compiler/codegen/TestByteDoubleVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestByteDoubleVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestByteDoubleVect */ +package compiler.codegen; + public class TestByteDoubleVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestByteFloatVect.java b/hotspot/test/compiler/codegen/TestByteFloatVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestByteFloatVect.java rename to hotspot/test/compiler/codegen/TestByteFloatVect.java index 45fe34e9577..d718f48fccb 100644 --- a/hotspot/test/compiler/codegen/7119644/TestByteFloatVect.java +++ b/hotspot/test/compiler/codegen/TestByteFloatVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestByteFloatVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestByteFloatVect */ +package compiler.codegen; + public class TestByteFloatVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestByteIntVect.java b/hotspot/test/compiler/codegen/TestByteIntVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestByteIntVect.java rename to hotspot/test/compiler/codegen/TestByteIntVect.java index 8d9aa6a808b..2e2b8b469a2 100644 --- a/hotspot/test/compiler/codegen/7119644/TestByteIntVect.java +++ b/hotspot/test/compiler/codegen/TestByteIntVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestByteIntVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestByteIntVect */ +package compiler.codegen; + public class TestByteIntVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestByteLongVect.java b/hotspot/test/compiler/codegen/TestByteLongVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestByteLongVect.java rename to hotspot/test/compiler/codegen/TestByteLongVect.java index c2d439057d9..23a57e252d1 100644 --- a/hotspot/test/compiler/codegen/7119644/TestByteLongVect.java +++ b/hotspot/test/compiler/codegen/TestByteLongVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestByteLongVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestByteLongVect */ +package compiler.codegen; + public class TestByteLongVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestByteShortVect.java b/hotspot/test/compiler/codegen/TestByteShortVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestByteShortVect.java rename to hotspot/test/compiler/codegen/TestByteShortVect.java index ee1a206c1f2..0b4b4d78a59 100644 --- a/hotspot/test/compiler/codegen/7119644/TestByteShortVect.java +++ b/hotspot/test/compiler/codegen/TestByteShortVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestByteShortVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestByteShortVect */ +package compiler.codegen; + public class TestByteShortVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestByteVect.java b/hotspot/test/compiler/codegen/TestByteVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestByteVect.java rename to hotspot/test/compiler/codegen/TestByteVect.java index 6167678acf9..06bc2bb9a57 100644 --- a/hotspot/test/compiler/codegen/7119644/TestByteVect.java +++ b/hotspot/test/compiler/codegen/TestByteVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestByteVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestByteVect */ +package compiler.codegen; + public class TestByteVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestCharShortVect.java b/hotspot/test/compiler/codegen/TestCharShortVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestCharShortVect.java rename to hotspot/test/compiler/codegen/TestCharShortVect.java index 55f8e03b772..5ae572e387f 100644 --- a/hotspot/test/compiler/codegen/7119644/TestCharShortVect.java +++ b/hotspot/test/compiler/codegen/TestCharShortVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestCharShortVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestCharShortVect */ +package compiler.codegen; + public class TestCharShortVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestCharVect.java b/hotspot/test/compiler/codegen/TestCharVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestCharVect.java rename to hotspot/test/compiler/codegen/TestCharVect.java index d05ed4d1ccd..ef21a88b4a0 100644 --- a/hotspot/test/compiler/codegen/7119644/TestCharVect.java +++ b/hotspot/test/compiler/codegen/TestCharVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestCharVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestCharVect */ +package compiler.codegen; + public class TestCharVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/8001183/TestCharVect.java b/hotspot/test/compiler/codegen/TestCharVect2.java similarity index 99% rename from hotspot/test/compiler/codegen/8001183/TestCharVect.java rename to hotspot/test/compiler/codegen/TestCharVect2.java index a6ff1e2b961..748d3be0ff0 100644 --- a/hotspot/test/compiler/codegen/8001183/TestCharVect.java +++ b/hotspot/test/compiler/codegen/TestCharVect2.java @@ -27,10 +27,12 @@ * @bug 8001183 * @summary incorrect results of char vectors right shift operaiton * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestCharVect + * @run main/othervm/timeout=400 -Xbatch -Xmx64m compiler.codegen.TestCharVect2 */ -public class TestCharVect { +package compiler.codegen; + +public class TestCharVect2 { private static final int ARRLEN = 997; private static final int ITERS = 11000; private static final int ADD_INIT = Character.MAX_VALUE-500; diff --git a/hotspot/test/compiler/codegen/7119644/TestDoubleVect.java b/hotspot/test/compiler/codegen/TestDoubleVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestDoubleVect.java rename to hotspot/test/compiler/codegen/TestDoubleVect.java index 385a64d5a2f..b8772d94a70 100644 --- a/hotspot/test/compiler/codegen/7119644/TestDoubleVect.java +++ b/hotspot/test/compiler/codegen/TestDoubleVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestDoubleVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestDoubleVect */ +package compiler.codegen; + public class TestDoubleVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestFloatDoubleVect.java b/hotspot/test/compiler/codegen/TestFloatDoubleVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestFloatDoubleVect.java rename to hotspot/test/compiler/codegen/TestFloatDoubleVect.java index 827ecdb4615..d90d295af56 100644 --- a/hotspot/test/compiler/codegen/7119644/TestFloatDoubleVect.java +++ b/hotspot/test/compiler/codegen/TestFloatDoubleVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestFloatDoubleVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestFloatDoubleVect */ +package compiler.codegen; + public class TestFloatDoubleVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestFloatVect.java b/hotspot/test/compiler/codegen/TestFloatVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestFloatVect.java rename to hotspot/test/compiler/codegen/TestFloatVect.java index 825fffed64c..523761a8a97 100644 --- a/hotspot/test/compiler/codegen/7119644/TestFloatVect.java +++ b/hotspot/test/compiler/codegen/TestFloatVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestFloatVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestFloatVect */ +package compiler.codegen; + public class TestFloatVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestIntDoubleVect.java b/hotspot/test/compiler/codegen/TestIntDoubleVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestIntDoubleVect.java rename to hotspot/test/compiler/codegen/TestIntDoubleVect.java index fc6e32dce05..739353d9511 100644 --- a/hotspot/test/compiler/codegen/7119644/TestIntDoubleVect.java +++ b/hotspot/test/compiler/codegen/TestIntDoubleVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntDoubleVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestIntDoubleVect */ +package compiler.codegen; + public class TestIntDoubleVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestIntFloatVect.java b/hotspot/test/compiler/codegen/TestIntFloatVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestIntFloatVect.java rename to hotspot/test/compiler/codegen/TestIntFloatVect.java index e698c890d69..c41d8249178 100644 --- a/hotspot/test/compiler/codegen/7119644/TestIntFloatVect.java +++ b/hotspot/test/compiler/codegen/TestIntFloatVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntFloatVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestIntFloatVect */ +package compiler.codegen; + public class TestIntFloatVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestIntLongVect.java b/hotspot/test/compiler/codegen/TestIntLongVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestIntLongVect.java rename to hotspot/test/compiler/codegen/TestIntLongVect.java index def0d9b1bc2..02c4b62f259 100644 --- a/hotspot/test/compiler/codegen/7119644/TestIntLongVect.java +++ b/hotspot/test/compiler/codegen/TestIntLongVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntLongVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestIntLongVect */ +package compiler.codegen; + public class TestIntLongVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestIntVect.java b/hotspot/test/compiler/codegen/TestIntVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestIntVect.java rename to hotspot/test/compiler/codegen/TestIntVect.java index 9d3f4e53920..cb2b31b2b80 100644 --- a/hotspot/test/compiler/codegen/7119644/TestIntVect.java +++ b/hotspot/test/compiler/codegen/TestIntVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestIntVect */ +package compiler.codegen; + public class TestIntVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestLongDoubleVect.java b/hotspot/test/compiler/codegen/TestLongDoubleVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestLongDoubleVect.java rename to hotspot/test/compiler/codegen/TestLongDoubleVect.java index 344e3a980bb..c73cc98dcf9 100644 --- a/hotspot/test/compiler/codegen/7119644/TestLongDoubleVect.java +++ b/hotspot/test/compiler/codegen/TestLongDoubleVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestLongDoubleVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestLongDoubleVect */ +package compiler.codegen; + public class TestLongDoubleVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestLongFloatVect.java b/hotspot/test/compiler/codegen/TestLongFloatVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestLongFloatVect.java rename to hotspot/test/compiler/codegen/TestLongFloatVect.java index 714f6c83687..ef00e6fc5f2 100644 --- a/hotspot/test/compiler/codegen/7119644/TestLongFloatVect.java +++ b/hotspot/test/compiler/codegen/TestLongFloatVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestLongFloatVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestLongFloatVect */ +package compiler.codegen; + public class TestLongFloatVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestLongVect.java b/hotspot/test/compiler/codegen/TestLongVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestLongVect.java rename to hotspot/test/compiler/codegen/TestLongVect.java index 6f0365bb5c1..d76025a038e 100644 --- a/hotspot/test/compiler/codegen/7119644/TestLongVect.java +++ b/hotspot/test/compiler/codegen/TestLongVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestLongVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestLongVect */ +package compiler.codegen; + public class TestLongVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestShortDoubleVect.java b/hotspot/test/compiler/codegen/TestShortDoubleVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestShortDoubleVect.java rename to hotspot/test/compiler/codegen/TestShortDoubleVect.java index c21037e4c87..f36baa31ef4 100644 --- a/hotspot/test/compiler/codegen/7119644/TestShortDoubleVect.java +++ b/hotspot/test/compiler/codegen/TestShortDoubleVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestShortDoubleVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestShortDoubleVect */ +package compiler.codegen; + public class TestShortDoubleVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestShortFloatVect.java b/hotspot/test/compiler/codegen/TestShortFloatVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestShortFloatVect.java rename to hotspot/test/compiler/codegen/TestShortFloatVect.java index 05b4dddd980..7704a1b0763 100644 --- a/hotspot/test/compiler/codegen/7119644/TestShortFloatVect.java +++ b/hotspot/test/compiler/codegen/TestShortFloatVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestShortFloatVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestShortFloatVect */ +package compiler.codegen; + public class TestShortFloatVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestShortIntVect.java b/hotspot/test/compiler/codegen/TestShortIntVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestShortIntVect.java rename to hotspot/test/compiler/codegen/TestShortIntVect.java index bf180940856..d979fad9853 100644 --- a/hotspot/test/compiler/codegen/7119644/TestShortIntVect.java +++ b/hotspot/test/compiler/codegen/TestShortIntVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestShortIntVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestShortIntVect */ +package compiler.codegen; + public class TestShortIntVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestShortLongVect.java b/hotspot/test/compiler/codegen/TestShortLongVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestShortLongVect.java rename to hotspot/test/compiler/codegen/TestShortLongVect.java index d4c121f8716..b6c0c79ccc8 100644 --- a/hotspot/test/compiler/codegen/7119644/TestShortLongVect.java +++ b/hotspot/test/compiler/codegen/TestShortLongVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestShortLongVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestShortLongVect */ +package compiler.codegen; + public class TestShortLongVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/7119644/TestShortVect.java b/hotspot/test/compiler/codegen/TestShortVect.java similarity index 99% rename from hotspot/test/compiler/codegen/7119644/TestShortVect.java rename to hotspot/test/compiler/codegen/TestShortVect.java index d4583832158..04b4ecbd1d9 100644 --- a/hotspot/test/compiler/codegen/7119644/TestShortVect.java +++ b/hotspot/test/compiler/codegen/TestShortVect.java @@ -27,9 +27,13 @@ * @bug 7119644 * @summary Increase superword's vector size up to 256 bits * - * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestShortVect + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:-OptimizeFill + * compiler.codegen.TestShortVect */ +package compiler.codegen; + public class TestShortVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; diff --git a/hotspot/test/compiler/codegen/aes/TestAESBase.java b/hotspot/test/compiler/codegen/aes/TestAESBase.java new file mode 100644 index 00000000000..ca2d5c9cef9 --- /dev/null +++ b/hotspot/test/compiler/codegen/aes/TestAESBase.java @@ -0,0 +1,222 @@ +/* + * Copyright (c) 2012, 2015, 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. + * + */ + + +package compiler.codegen.aes; + +import jdk.test.lib.Utils; + +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.spec.GCMParameterSpec; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.security.AlgorithmParameters; +import java.util.Random; + +/** + * @author Tom Deneau + */ +public abstract class TestAESBase { + int msgSize = Integer.getInteger("msgSize", 646); + boolean checkOutput = Boolean.getBoolean("checkOutput"); + boolean noReinit = Boolean.getBoolean("noReinit"); + boolean testingMisalignment; + private static final int ALIGN = 8; + int encInputOffset = Integer.getInteger("encInputOffset", 0) % ALIGN; + int encOutputOffset = Integer.getInteger("encOutputOffset", 0) % ALIGN; + int decOutputOffset = Integer.getInteger("decOutputOffset", 0) % ALIGN; + int lastChunkSize = Integer.getInteger("lastChunkSize", 32); + int keySize = Integer.getInteger("keySize", 128); + int inputLength; + int encodeLength; + int decodeLength; + int decodeMsgSize; + String algorithm = System.getProperty("algorithm", "AES"); + String mode = System.getProperty("mode", "CBC"); + String paddingStr = System.getProperty("paddingStr", "PKCS5Padding"); + byte[] input; + byte[] encode; + byte[] expectedEncode; + byte[] decode; + byte[] expectedDecode; + final Random random = Utils.getRandomInstance(); + Cipher cipher; + Cipher dCipher; + AlgorithmParameters algParams = null; + SecretKey key; + GCMParameterSpec gcm_spec; + byte[] aad = {0x11, 0x22, 0x33, 0x44, 0x55}; + int tlen = 12; + byte[] iv = new byte[16]; + + static int numThreads = 0; + int threadId; + + static synchronized int getThreadId() { + int id = numThreads; + numThreads++; + return id; + } + + abstract public void run(); + + public void prepare() { + try { + System.out.println("\nalgorithm=" + algorithm + ", mode=" + mode + ", paddingStr=" + paddingStr + + ", msgSize=" + msgSize + ", keySize=" + keySize + ", noReinit=" + noReinit + + ", checkOutput=" + checkOutput + ", encInputOffset=" + encInputOffset + ", encOutputOffset=" + + encOutputOffset + ", decOutputOffset=" + decOutputOffset + ", lastChunkSize=" + lastChunkSize); + + if (encInputOffset % ALIGN != 0 || encOutputOffset % ALIGN != 0 || decOutputOffset % ALIGN != 0) + testingMisalignment = true; + + int keyLenBytes = (keySize == 0 ? 16 : keySize / 8); + byte keyBytes[] = new byte[keyLenBytes]; + if (keySize == 128) + keyBytes = new byte[]{-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7}; + else + random.nextBytes(keyBytes); + + key = new SecretKeySpec(keyBytes, algorithm); + if (threadId == 0) { + System.out.println("Algorithm: " + key.getAlgorithm() + "(" + + key.getEncoded().length * 8 + "bit)"); + } + + cipher = Cipher.getInstance(algorithm + "/" + mode + "/" + paddingStr, "SunJCE"); + dCipher = Cipher.getInstance(algorithm + "/" + mode + "/" + paddingStr, "SunJCE"); + + // CBC or CTR init + if (mode.equals("CBC") || mode.equals("CTR")) { + IvParameterSpec initVector = new IvParameterSpec(iv); + cipher.init(Cipher.ENCRYPT_MODE, key, initVector); + algParams = cipher.getParameters(); + dCipher.init(Cipher.DECRYPT_MODE, key, initVector); + + // GCM init + } else if (mode.equals("GCM")) { + gcm_init(true); + gcm_init(false); + + // ECB init + } else { + cipher.init(Cipher.ENCRYPT_MODE, key, algParams); + dCipher.init(Cipher.DECRYPT_MODE, key, algParams); + } + + if (threadId == 0) { + childShowCipher(); + } + + inputLength = msgSize + encInputOffset; + if (testingMisalignment) { + encodeLength = cipher.getOutputSize(msgSize - lastChunkSize) + encOutputOffset; + encodeLength += cipher.getOutputSize(lastChunkSize); + decodeLength = dCipher.getOutputSize(encodeLength - lastChunkSize) + decOutputOffset; + decodeLength += dCipher.getOutputSize(lastChunkSize); + } else { + encodeLength = cipher.getOutputSize(msgSize) + encOutputOffset; + decodeLength = dCipher.getOutputSize(encodeLength) + decOutputOffset; + } + + input = new byte[inputLength]; + for (int i = encInputOffset, j = 0; i < inputLength; i++, j++) { + input[i] = (byte) (j & 0xff); + } + + // do one encode and decode in preparation + encode = new byte[encodeLength]; + decode = new byte[decodeLength]; + if (testingMisalignment) { + decodeMsgSize = cipher.update(input, encInputOffset, (msgSize - lastChunkSize), encode, encOutputOffset); + decodeMsgSize += cipher.doFinal(input, (encInputOffset + msgSize - lastChunkSize), lastChunkSize, encode, (encOutputOffset + decodeMsgSize)); + + int tempSize = dCipher.update(encode, encOutputOffset, (decodeMsgSize - lastChunkSize), decode, decOutputOffset); + dCipher.doFinal(encode, (encOutputOffset + decodeMsgSize - lastChunkSize), lastChunkSize, decode, (decOutputOffset + tempSize)); + } else { + decodeMsgSize = cipher.doFinal(input, encInputOffset, msgSize, encode, encOutputOffset); + dCipher.doFinal(encode, encOutputOffset, decodeMsgSize, decode, decOutputOffset); + } + if (checkOutput) { + expectedEncode = (byte[]) encode.clone(); + expectedDecode = (byte[]) decode.clone(); + showArray(key.getEncoded(), "key: "); + showArray(input, "input: "); + showArray(encode, "encode: "); + showArray(decode, "decode: "); + } + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + } + + void showArray(byte b[], String name) { + System.out.format("%s [%d]: ", name, b.length); + for (int i = 0; i < Math.min(b.length, 32); i++) { + System.out.format("%02x ", b[i] & 0xff); + } + System.out.println(); + } + + void compareArrays(byte b[], byte exp[]) { + if (b.length != exp.length) { + System.out.format("different lengths for actual and expected output arrays\n"); + showArray(b, "test: "); + showArray(exp, "exp : "); + System.exit(1); + } + for (int i = 0; i < exp.length; i++) { + if (b[i] != exp[i]) { + System.out.format("output error at index %d: got %02x, expected %02x\n", i, b[i] & 0xff, exp[i] & 0xff); + showArray(b, "test: "); + showArray(exp, "exp : "); + System.exit(1); + } + } + } + + void showCipher(Cipher c, String kind) { + System.out.println(kind + " cipher provider: " + cipher.getProvider()); + System.out.println(kind + " cipher algorithm: " + cipher.getAlgorithm()); + } + + abstract void childShowCipher(); + + void gcm_init(boolean encrypt) throws Exception { + gcm_spec = new GCMParameterSpec(tlen * 8, iv); + if (encrypt) { + // Get a new instance everytime because of reuse IV restrictions + cipher = Cipher.getInstance(algorithm + "/" + mode + "/" + paddingStr, "SunJCE"); + cipher.init(Cipher.ENCRYPT_MODE, key, gcm_spec); + cipher.updateAAD(aad); + } else { + dCipher.init(Cipher.DECRYPT_MODE, key, gcm_spec); + dCipher.updateAAD(aad); + + + } + } +} diff --git a/hotspot/test/compiler/codegen/7184394/TestAESDecode.java b/hotspot/test/compiler/codegen/aes/TestAESDecode.java similarity index 53% rename from hotspot/test/compiler/codegen/7184394/TestAESDecode.java rename to hotspot/test/compiler/codegen/aes/TestAESDecode.java index e90ef767e7e..b485520dfb9 100644 --- a/hotspot/test/compiler/codegen/7184394/TestAESDecode.java +++ b/hotspot/test/compiler/codegen/aes/TestAESDecode.java @@ -22,41 +22,39 @@ * */ -/** - * @author Tom Deneau - */ +package compiler.codegen.aes; import javax.crypto.Cipher; +/** + * @author Tom Deneau + */ public class TestAESDecode extends TestAESBase { - @Override - public void run() { - try { - if (mode.equals("GCM")) { - gcm_init(false); - } else if (!noReinit) { - dCipher.init(Cipher.DECRYPT_MODE, key, algParams); - } - decode = new byte[decodeLength]; - if (testingMisalignment) { - int tempSize = dCipher.update(encode, encOutputOffset, (decodeMsgSize - lastChunkSize), decode, decOutputOffset); - dCipher.doFinal(encode, (encOutputOffset + decodeMsgSize - lastChunkSize), lastChunkSize, decode, (decOutputOffset + tempSize)); - } else { - dCipher.doFinal(encode, encOutputOffset, decodeMsgSize, decode, decOutputOffset); - } - if (checkOutput) { - compareArrays(decode, expectedDecode); - } + @Override + public void run() { + try { + if (mode.equals("GCM")) { + gcm_init(false); + } else if (!noReinit) { + dCipher.init(Cipher.DECRYPT_MODE, key, algParams); + } + decode = new byte[decodeLength]; + if (testingMisalignment) { + int tempSize = dCipher.update(encode, encOutputOffset, (decodeMsgSize - lastChunkSize), decode, decOutputOffset); + dCipher.doFinal(encode, (encOutputOffset + decodeMsgSize - lastChunkSize), lastChunkSize, decode, (decOutputOffset + tempSize)); + } else { + dCipher.doFinal(encode, encOutputOffset, decodeMsgSize, decode, decOutputOffset); + } + if (checkOutput) { + compareArrays(decode, expectedDecode); + } + } catch (Exception e) { + throw new Error(e.getMessage(), e); + } } - catch (Exception e) { - e.printStackTrace(); - System.exit(1); + + @Override + void childShowCipher() { + showCipher(dCipher, "Decryption"); } - } - - @Override - void childShowCipher() { - showCipher(dCipher, "Decryption"); - } - } diff --git a/hotspot/test/compiler/codegen/7184394/TestAESEncode.java b/hotspot/test/compiler/codegen/aes/TestAESEncode.java similarity index 54% rename from hotspot/test/compiler/codegen/7184394/TestAESEncode.java rename to hotspot/test/compiler/codegen/aes/TestAESEncode.java index cbfb81795c1..c31da699f72 100644 --- a/hotspot/test/compiler/codegen/7184394/TestAESEncode.java +++ b/hotspot/test/compiler/codegen/aes/TestAESEncode.java @@ -22,41 +22,40 @@ * */ -/** - * @author Tom Deneau - */ +package compiler.codegen.aes; import javax.crypto.Cipher; +/** + * @author Tom Deneau + */ public class TestAESEncode extends TestAESBase { - @Override - public void run() { - try { - if (mode.equals("GCM")) { - gcm_init(true); - } else if (!noReinit) { - cipher.init(Cipher.ENCRYPT_MODE, key, algParams); - } - encode = new byte[encodeLength]; - if (testingMisalignment) { - int tempSize = cipher.update(input, encInputOffset, (msgSize - lastChunkSize), encode, encOutputOffset); - cipher.doFinal(input, (encInputOffset + msgSize - lastChunkSize), lastChunkSize, encode, (encOutputOffset + tempSize)); - } else { - cipher.doFinal(input, encInputOffset, msgSize, encode, encOutputOffset); - } - if (checkOutput) { - compareArrays(encode, expectedEncode); - } + @Override + public void run() { + try { + if (mode.equals("GCM")) { + gcm_init(true); + } else if (!noReinit) { + cipher.init(Cipher.ENCRYPT_MODE, key, algParams); + } + encode = new byte[encodeLength]; + if (testingMisalignment) { + int tempSize = cipher.update(input, encInputOffset, (msgSize - lastChunkSize), encode, encOutputOffset); + cipher.doFinal(input, (encInputOffset + msgSize - lastChunkSize), lastChunkSize, encode, (encOutputOffset + tempSize)); + } else { + cipher.doFinal(input, encInputOffset, msgSize, encode, encOutputOffset); + } + if (checkOutput) { + compareArrays(encode, expectedEncode); + } + } catch (Exception e) { + throw new Error(e.getMessage(), e); + } } - catch (Exception e) { - e.printStackTrace(); - System.exit(1); - } - } - @Override - void childShowCipher() { - showCipher(cipher, "Encryption"); - } + @Override + void childShowCipher() { + showCipher(cipher, "Encryption"); + } } diff --git a/hotspot/test/compiler/codegen/7184394/TestAESMain.java b/hotspot/test/compiler/codegen/aes/TestAESMain.java similarity index 52% rename from hotspot/test/compiler/codegen/7184394/TestAESMain.java rename to hotspot/test/compiler/codegen/aes/TestAESMain.java index 23a04c236eb..679cd880e53 100644 --- a/hotspot/test/compiler/codegen/7184394/TestAESMain.java +++ b/hotspot/test/compiler/codegen/aes/TestAESMain.java @@ -26,75 +26,108 @@ * @test * @bug 7184394 * @summary add intrinsics to use AES instructions - * @library /testlibrary - * + * @library /testlibrary / * @modules java.base/jdk.internal.misc * java.management - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencOutputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DdecOutputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencOutputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DdecOutputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencOutputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DdecOutputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencOutputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DdecOutputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 -DencOutputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 TestAESMain - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 TestAESMain + * + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencOutputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DdecOutputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 + * compiler.codegen.aes.TestAESMain + * + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencOutputOffset= + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DdecOutputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 + * compiler.codegen.aes.TestAESMain + * + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencOutputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DdecOutputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 + * compiler.codegen.aes.TestAESMain + * + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencOutputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DdecOutputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 -DencOutputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 + * compiler.codegen.aes.TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 + * compiler.codegen.aes.TestAESMain * * @author Tom Deneau */ -public class TestAESMain { - public static void main(String[] args) { - int iters = (args.length > 0 ? Integer.valueOf(args[0]) : 1000000); - int warmupIters = (args.length > 1 ? Integer.valueOf(args[1]) : 20000); - System.out.println(iters + " iterations"); - TestAESEncode etest = new TestAESEncode(); - etest.prepare(); - // warm-up - System.out.println("Starting encryption warm-up"); - for (int i=0; i 0 ? Integer.valueOf(args[0]) : 1000000); + int warmupIters = (args.length > 1 ? Integer.valueOf(args[1]) : 20000); + System.out.println(iters + " iterations"); + TestAESEncode etest = new TestAESEncode(); + etest.prepare(); + // warm-up + System.out.println("Starting encryption warm-up"); + for (int i = 0; i < warmupIters; i++) { + etest.run(); + } + System.out.println("Finished encryption warm-up"); + long start = System.nanoTime(); + for (int i = 0; i < iters; i++) { + etest.run(); + } + long end = System.nanoTime(); + System.out.println("TestAESEncode runtime was " + (double) ((end - start) / 1000000.0) + " ms"); + + TestAESDecode dtest = new TestAESDecode(); + dtest.prepare(); + // warm-up + System.out.println("Starting decryption warm-up"); + for (int i = 0; i < warmupIters; i++) { + dtest.run(); + } + System.out.println("Finished decryption warm-up"); + start = System.nanoTime(); + for (int i = 0; i < iters; i++) { + dtest.run(); + } + end = System.nanoTime(); + System.out.println("TestAESDecode runtime was " + (double) ((end - start) / 1000000.0) + " ms"); } - System.out.println("Finished decryption warm-up"); - start = System.nanoTime(); - for (int i=0; i(); List holders = new ArrayList<>(); - holders.add(new pool.sub.Klass()); - holders.add(new pool.sub.KlassDup()); - holders.add(new pool.subpack.Klass()); - holders.add(new pool.subpack.KlassDup()); - holders.add(new pool.sub.Klass.Internal()); - holders.add(new pool.subpack.KlassDup.Internal()); + holders.add(new compiler.compilercontrol.share.pool.sub.Klass()); + holders.add(new compiler.compilercontrol.share.pool.sub.KlassDup()); + holders.add(new compiler.compilercontrol.share.pool.subpack.Klass()); + holders.add(new compiler.compilercontrol.share.pool.subpack.KlassDup()); + holders.add(new compiler.compilercontrol.share.pool.sub.Klass.Internal()); + holders.add(new compiler.compilercontrol.share.pool.subpack.KlassDup.Internal()); for (MethodHolder holder : holders) { METHODS.addAll(holder.getAllMethods()); } diff --git a/hotspot/test/compiler/compilercontrol/share/pool/SubMethodHolder.java b/hotspot/test/compiler/compilercontrol/share/pool/SubMethodHolder.java index 7ccc7393fbb..e9f23fcc546 100644 --- a/hotspot/test/compiler/compilercontrol/share/pool/SubMethodHolder.java +++ b/hotspot/test/compiler/compilercontrol/share/pool/SubMethodHolder.java @@ -1,4 +1,4 @@ -package pool; +package compiler.compilercontrol.share.pool; import jdk.test.lib.Pair; diff --git a/hotspot/test/compiler/compilercontrol/share/pool/sub/Klass.java b/hotspot/test/compiler/compilercontrol/share/pool/sub/Klass.java index f1a3b3ecb53..3f39c47e138 100644 --- a/hotspot/test/compiler/compilercontrol/share/pool/sub/Klass.java +++ b/hotspot/test/compiler/compilercontrol/share/pool/sub/Klass.java @@ -21,10 +21,10 @@ * questions. */ -package pool.sub; +package compiler.compilercontrol.share.pool.sub; -import pool.MethodHolder; -import pool.SubMethodHolder; +import compiler.compilercontrol.share.pool.MethodHolder; +import compiler.compilercontrol.share.pool.SubMethodHolder; /** * Simple class with methods to test signatures diff --git a/hotspot/test/compiler/compilercontrol/share/pool/sub/KlassDup.java b/hotspot/test/compiler/compilercontrol/share/pool/sub/KlassDup.java index 6ddcdba7bee..942c79bcae4 100644 --- a/hotspot/test/compiler/compilercontrol/share/pool/sub/KlassDup.java +++ b/hotspot/test/compiler/compilercontrol/share/pool/sub/KlassDup.java @@ -21,9 +21,9 @@ * questions. */ -package pool.sub; +package compiler.compilercontrol.share.pool.sub; -import pool.MethodHolder; +import compiler.compilercontrol.share.pool.MethodHolder; /** * Simple class with methods to test signatures diff --git a/hotspot/test/compiler/compilercontrol/share/pool/subpack/Klass.java b/hotspot/test/compiler/compilercontrol/share/pool/subpack/Klass.java index 59506e9d0b3..48220a504ee 100644 --- a/hotspot/test/compiler/compilercontrol/share/pool/subpack/Klass.java +++ b/hotspot/test/compiler/compilercontrol/share/pool/subpack/Klass.java @@ -21,15 +21,15 @@ * questions. */ -package pool.subpack; +package compiler.compilercontrol.share.pool.subpack; -import pool.MethodHolder; +import compiler.compilercontrol.share.pool.MethodHolder; /** * Simple class with methods to test signatures - * This is a clone of the pool.sub.Klass, but without inner class + * This is a clone of the c.c.s.pool.sub.Klass, but without inner class * This class has different package name to test prefix patterns like *Klass. - * *Klass patern should match both pool.sub.Klass and pool.subpack.Klass + * *Klass patern should match both c.c.s.pool.sub.Klass and c.c.s.pool.subpack.Klass */ public class Klass extends MethodHolder { public void method(int a, String[] ss, Integer i, byte[] bb, double[][] dd) { } diff --git a/hotspot/test/compiler/compilercontrol/share/pool/subpack/KlassDup.java b/hotspot/test/compiler/compilercontrol/share/pool/subpack/KlassDup.java index f5e930ba96a..a90273aee26 100644 --- a/hotspot/test/compiler/compilercontrol/share/pool/subpack/KlassDup.java +++ b/hotspot/test/compiler/compilercontrol/share/pool/subpack/KlassDup.java @@ -21,14 +21,14 @@ * questions. */ -package pool.subpack; +package compiler.compilercontrol.share.pool.subpack; -import pool.MethodHolder; -import pool.SubMethodHolder; +import compiler.compilercontrol.share.pool.MethodHolder; +import compiler.compilercontrol.share.pool.SubMethodHolder; /** - * This is a clone of the pool.sub.Klass used to test pattern matching - * Full class name contains both suffix (Dup) and prefix (pool.subpack) + * This is a clone of the c.c.s.pool.sub.Klass used to test pattern matching + * Full class name contains both suffix (Dup) and prefix (c.c.s.pool.subpack) */ public class KlassDup extends MethodHolder { public void method(int a, String[] ss, Integer i, byte[] bb, double[][] dd) { } diff --git a/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java b/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java index d921d1d2304..0cfc7d6b5ce 100644 --- a/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java +++ b/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java @@ -25,10 +25,10 @@ package compiler.compilercontrol.share.processors; import compiler.compilercontrol.share.method.MethodDescriptor; import compiler.compilercontrol.share.method.MethodGenerator; +import compiler.compilercontrol.share.pool.PoolHelper; import compiler.compilercontrol.share.scenario.State; import jdk.test.lib.Asserts; import jdk.test.lib.OutputAnalyzer; -import pool.PoolHelper; import java.io.File; import java.io.FileNotFoundException; diff --git a/hotspot/test/compiler/compilercontrol/share/processors/PrintProcessor.java b/hotspot/test/compiler/compilercontrol/share/processors/PrintProcessor.java index dab43495931..9fa00c10500 100644 --- a/hotspot/test/compiler/compilercontrol/share/processors/PrintProcessor.java +++ b/hotspot/test/compiler/compilercontrol/share/processors/PrintProcessor.java @@ -26,10 +26,9 @@ package compiler.compilercontrol.share.processors; import com.sun.management.HotSpotDiagnosticMXBean; import compiler.compilercontrol.share.method.MethodDescriptor; import compiler.compilercontrol.share.method.MethodGenerator; +import compiler.compilercontrol.share.pool.PoolHelper; import compiler.compilercontrol.share.scenario.State; import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.Pair; -import pool.PoolHelper; import java.lang.management.ManagementFactory; import java.lang.reflect.Executable; diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/AbstractCommandBuilder.java b/hotspot/test/compiler/compilercontrol/share/scenario/AbstractCommandBuilder.java index eafbefb31f1..21731287943 100644 --- a/hotspot/test/compiler/compilercontrol/share/scenario/AbstractCommandBuilder.java +++ b/hotspot/test/compiler/compilercontrol/share/scenario/AbstractCommandBuilder.java @@ -24,8 +24,8 @@ package compiler.compilercontrol.share.scenario; import compiler.compilercontrol.share.method.MethodDescriptor; +import compiler.compilercontrol.share.pool.PoolHelper; import jdk.test.lib.Pair; -import pool.PoolHelper; import java.lang.reflect.Executable; import java.util.ArrayList; @@ -33,7 +33,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.concurrent.Callable; /** diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/Command.java b/hotspot/test/compiler/compilercontrol/share/scenario/Command.java index c4b2193512c..49fdf74f406 100644 --- a/hotspot/test/compiler/compilercontrol/share/scenario/Command.java +++ b/hotspot/test/compiler/compilercontrol/share/scenario/Command.java @@ -24,6 +24,7 @@ package compiler.compilercontrol.share.scenario; import compiler.compilercontrol.share.processors.LogProcessor; + import java.util.Arrays; /** diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/DirectiveBuilder.java b/hotspot/test/compiler/compilercontrol/share/scenario/DirectiveBuilder.java index af6c86dc3f2..124c265a342 100644 --- a/hotspot/test/compiler/compilercontrol/share/scenario/DirectiveBuilder.java +++ b/hotspot/test/compiler/compilercontrol/share/scenario/DirectiveBuilder.java @@ -26,15 +26,15 @@ package compiler.compilercontrol.share.scenario; import compiler.compilercontrol.share.JSONFile; import compiler.compilercontrol.share.method.MethodDescriptor; import compiler.compilercontrol.share.method.MethodGenerator; +import compiler.compilercontrol.share.pool.PoolHelper; import jdk.test.lib.Pair; -import pool.PoolHelper; import java.lang.reflect.Executable; -import java.util.List; -import java.util.Map; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import java.util.concurrent.Callable; import java.util.stream.Collectors; diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/JcmdStateBuilder.java b/hotspot/test/compiler/compilercontrol/share/scenario/JcmdStateBuilder.java index b799174d61b..bf12f9911bf 100644 --- a/hotspot/test/compiler/compilercontrol/share/scenario/JcmdStateBuilder.java +++ b/hotspot/test/compiler/compilercontrol/share/scenario/JcmdStateBuilder.java @@ -25,7 +25,7 @@ package compiler.compilercontrol.share.scenario; import compiler.compilercontrol.share.method.MethodDescriptor; import compiler.compilercontrol.share.method.MethodGenerator; -import pool.PoolHelper; +import compiler.compilercontrol.share.pool.PoolHelper; import jdk.test.lib.Pair; import java.lang.reflect.Executable; diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java b/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java index a0fefabac60..8a1723f44c0 100644 --- a/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java +++ b/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java @@ -24,6 +24,7 @@ package compiler.compilercontrol.share.scenario; import compiler.compilercontrol.share.method.MethodDescriptor; +import compiler.compilercontrol.share.pool.PoolHelper; import compiler.compilercontrol.share.processors.CommandProcessor; import compiler.compilercontrol.share.processors.LogProcessor; import compiler.compilercontrol.share.processors.PrintDirectivesProcessor; @@ -31,7 +32,6 @@ import compiler.compilercontrol.share.processors.PrintProcessor; import jdk.test.lib.Asserts; import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.Pair; -import pool.PoolHelper; import java.lang.reflect.Executable; import java.util.ArrayList; diff --git a/hotspot/test/compiler/controldependency/TestEliminatedCastPPAtPhi.java b/hotspot/test/compiler/controldependency/TestEliminatedCastPPAtPhi.java index 9c3daafbb9b..86dab6fada3 100644 --- a/hotspot/test/compiler/controldependency/TestEliminatedCastPPAtPhi.java +++ b/hotspot/test/compiler/controldependency/TestEliminatedCastPPAtPhi.java @@ -27,10 +27,15 @@ * @bug 8139771 * @summary Eliminating CastPP nodes at Phis when they all come from a unique input may cause crash * @requires vm.gc=="Serial" | vm.gc=="Parallel" - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+IgnoreUnrecognizedVMOptions -XX:+StressGCM TestEliminatedCastPPAtPhi + * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * -XX:+IgnoreUnrecognizedVMOptions -XX:+StressGCM + * compiler.controldependency.TestEliminatedCastPPAtPhi * */ +package compiler.controldependency; + public class TestEliminatedCastPPAtPhi { static TestEliminatedCastPPAtPhi saved; diff --git a/hotspot/test/compiler/cpuflags/AESIntrinsicsBase.java b/hotspot/test/compiler/cpuflags/AESIntrinsicsBase.java index 7be9e436ad9..0aa9dc3bb35 100644 --- a/hotspot/test/compiler/cpuflags/AESIntrinsicsBase.java +++ b/hotspot/test/compiler/cpuflags/AESIntrinsicsBase.java @@ -21,8 +21,12 @@ * questions. * */ + +package compiler.cpuflags; + +import compiler.codegen.aes.TestAESMain; +import compiler.cpuflags.predicate.AESSupportPredicate; import jdk.test.lib.cli.CommandLineOptionTest; -import predicate.AESSupportPredicate; import java.util.Arrays; import java.util.function.BooleanSupplier; @@ -45,7 +49,7 @@ public abstract class AESIntrinsicsBase extends CommandLineOptionTest { public static final String[] TEST_AES_CMD = {"-XX:+IgnoreUnrecognizedVMOptions", "-XX:+PrintFlagsFinal", "-Xbatch", "-DcheckOutput=true", "-Dmode=CBC", - "TestAESMain"}; + TestAESMain.class.getName()}; protected AESIntrinsicsBase(BooleanSupplier predicate) { super(predicate); diff --git a/hotspot/test/compiler/cpuflags/RestoreMXCSR.java b/hotspot/test/compiler/cpuflags/RestoreMXCSR.java index 9b753745c41..b0df3892de0 100644 --- a/hotspot/test/compiler/cpuflags/RestoreMXCSR.java +++ b/hotspot/test/compiler/cpuflags/RestoreMXCSR.java @@ -28,16 +28,22 @@ * @library /testlibrary * @modules java.base/jdk.internal.misc * java.management + * + * @run driver compiler.cpuflags.RestoreMXCSR */ -import jdk.test.lib.*; + +package compiler.cpuflags; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; public class RestoreMXCSR { - public static void main(String[] args) throws Exception { - ProcessBuilder pb; - OutputAnalyzer out; + public static void main(String[] args) throws Exception { + ProcessBuilder pb; + OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder("-XX:+RestoreMXCSROnJNICalls", "-version"); - out = new OutputAnalyzer(pb.start()); - out.shouldHaveExitValue(0); - } + pb = ProcessTools.createJavaProcessBuilder("-XX:+RestoreMXCSROnJNICalls", "-version"); + out = new OutputAnalyzer(pb.start()); + out.shouldHaveExitValue(0); + } } diff --git a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java index 75c411de149..c5c4db0febd 100644 --- a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java +++ b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java @@ -24,18 +24,21 @@ /* * @test - * @library /testlibrary /test/lib /compiler/codegen/7184394 / + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management * @ignore 8146128 - * @build TestAESIntrinsicsOnSupportedConfig TestAESMain + * @build compiler.cpuflags.TestAESIntrinsicsOnSupportedConfig + * compiler.codegen.aes.TestAESMain * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch - * TestAESIntrinsicsOnSupportedConfig + * compiler.cpuflags.TestAESIntrinsicsOnSupportedConfig */ +package compiler.cpuflags; + import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.Platform; import jdk.test.lib.ProcessTools; diff --git a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java index 9bc466229ad..caef413636e 100644 --- a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java +++ b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java @@ -24,19 +24,24 @@ /* * @test - * @library /testlibrary /test/lib /compiler/codegen/7184394 / + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestAESIntrinsicsOnUnsupportedConfig TestAESMain + * + * @build compiler.cpuflags.TestAESIntrinsicsOnUnsupportedConfig + * compiler.codegen.aes.TestAESMain * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -Xbatch TestAESIntrinsicsOnUnsupportedConfig + * -XX:+WhiteBoxAPI -Xbatch + * compiler.cpuflags.TestAESIntrinsicsOnUnsupportedConfig */ -import jdk.test.lib.cli.predicate.NotPredicate; +package compiler.cpuflags; + import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.ProcessTools; +import jdk.test.lib.cli.predicate.NotPredicate; public class TestAESIntrinsicsOnUnsupportedConfig extends AESIntrinsicsBase { diff --git a/hotspot/test/compiler/cpuflags/TestSSE4Disabled.java b/hotspot/test/compiler/cpuflags/TestSSE4Disabled.java index 2700b9170d7..b1af81299b5 100644 --- a/hotspot/test/compiler/cpuflags/TestSSE4Disabled.java +++ b/hotspot/test/compiler/cpuflags/TestSSE4Disabled.java @@ -27,8 +27,12 @@ * @bug 8158214 * @requires (vm.simpleArch == "x64") * @summary Test correct execution without SSE 4. - * @run main/othervm -Xcomp -XX:UseSSE=3 TestSSE4Disabled + * + * @run main/othervm -Xcomp -XX:UseSSE=3 compiler.cpuflags.TestSSE4Disabled */ + +package compiler.cpuflags; + public class TestSSE4Disabled { public static void main(String args[]) { System.out.println("Passed"); diff --git a/hotspot/test/compiler/cpuflags/predicate/AESSupportPredicate.java b/hotspot/test/compiler/cpuflags/predicate/AESSupportPredicate.java index 7b4f78b8d13..3ec85e654f2 100644 --- a/hotspot/test/compiler/cpuflags/predicate/AESSupportPredicate.java +++ b/hotspot/test/compiler/cpuflags/predicate/AESSupportPredicate.java @@ -21,9 +21,10 @@ * questions. * */ -package predicate; +package compiler.cpuflags.predicate; import sun.hotspot.cpuinfo.CPUInfo; + import java.util.function.BooleanSupplier; public class AESSupportPredicate implements BooleanSupplier { diff --git a/hotspot/test/compiler/debug/TraceIterativeGVN.java b/hotspot/test/compiler/debug/TraceIterativeGVN.java index 7d98dd660b9..1656b1bbdb2 100644 --- a/hotspot/test/compiler/debug/TraceIterativeGVN.java +++ b/hotspot/test/compiler/debug/TraceIterativeGVN.java @@ -25,10 +25,14 @@ /* * @test + * * @run main/othervm -Xbatch -XX:-TieredCompilation * -XX:+IgnoreUnrecognizedVMOptions -XX:+TraceIterativeGVN - * TraceIterativeGVN + * compiler.debug.TraceIterativeGVN */ + +package compiler.debug; + public class TraceIterativeGVN { public static void main(String[] args) { for (int i = 0; i < 100_000; i++) { diff --git a/hotspot/test/compiler/debug/VerifyAdapterSharing.java b/hotspot/test/compiler/debug/VerifyAdapterSharing.java index 418eed7b688..263f263e9b8 100644 --- a/hotspot/test/compiler/debug/VerifyAdapterSharing.java +++ b/hotspot/test/compiler/debug/VerifyAdapterSharing.java @@ -28,17 +28,23 @@ * @library /testlibrary * @modules java.base/jdk.internal.misc * java.management + * + * @run driver compiler.debug.VerifyAdapterSharing */ -import jdk.test.lib.*; + +package compiler.debug; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; public class VerifyAdapterSharing { - public static void main(String[] args) throws Exception { - ProcessBuilder pb; - OutputAnalyzer out; + public static void main(String[] args) throws Exception { + ProcessBuilder pb; + OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder("-Xcomp", "-XX:+IgnoreUnrecognizedVMOptions", - "-XX:+VerifyAdapterSharing", "-version"); - out = new OutputAnalyzer(pb.start()); - out.shouldHaveExitValue(0); - } + pb = ProcessTools.createJavaProcessBuilder("-Xcomp", "-XX:+IgnoreUnrecognizedVMOptions", + "-XX:+VerifyAdapterSharing", "-version"); + out = new OutputAnalyzer(pb.start()); + out.shouldHaveExitValue(0); + } } diff --git a/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java index 365ca7bbfb2..0016c92828c 100644 --- a/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java +++ b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java @@ -25,11 +25,17 @@ * @test * @bug 8050079 * @summary Compiles a monomorphic call to finalizeObject() on a modified java.lang.Object to test C1 CHA. + * * @build java.base/java.lang.Object * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-VerifyDependencies - * -XX:TieredStopAtLevel=1 -XX:CompileOnly=TestMonomorphicObjectCall::callFinalize - * -XX:CompileOnly=java.lang.Object::finalizeObject TestMonomorphicObjectCall + * -XX:TieredStopAtLevel=1 + * -XX:CompileCommand=compileonly,compiler.dependencies.MonomorphicObjectCall.TestMonomorphicObjectCall::callFinalize + * -XX:CompileCommand=compileonly,java.lang.Object::finalizeObject + * compiler.dependencies.MonomorphicObjectCall.TestMonomorphicObjectCall */ + +package compiler.dependencies.MonomorphicObjectCall; + public class TestMonomorphicObjectCall { private static void callFinalize(Object object) throws Throwable { diff --git a/hotspot/test/compiler/eliminateAutobox/6934604/TestByteBoxing.java b/hotspot/test/compiler/eliminateAutobox/TestByteBoxing.java similarity index 95% rename from hotspot/test/compiler/eliminateAutobox/6934604/TestByteBoxing.java rename to hotspot/test/compiler/eliminateAutobox/TestByteBoxing.java index ee5511a9818..1b96d7fa746 100644 --- a/hotspot/test/compiler/eliminateAutobox/6934604/TestByteBoxing.java +++ b/hotspot/test/compiler/eliminateAutobox/TestByteBoxing.java @@ -24,15 +24,23 @@ /* * @test * @bug 6934604 - * @summary enable parts of EliminateAutoBox by default - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox TestByteBoxing - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox - * -XX:CompileCommand=exclude,TestByteBoxing.dummy -XX:CompileCommand=exclude,TestByteBoxing.foo -XX:CompileCommand=exclude,TestByteBoxing.foob TestByteBoxing - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox - * -XX:CompileCommand=exclude,TestByteBoxing.dummy -XX:CompileCommand=exclude,TestByteBoxing.foo -XX:CompileCommand=exclude,TestByteBoxing.foob TestByteBoxing * + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox + * compiler.eliminateAutobox.TestByteBoxing + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestByteBoxing::dummy + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestByteBoxing::foo + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestByteBoxing::foob + * compiler.eliminateAutobox.TestByteBoxing + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestByteBoxing::dummy + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestByteBoxing::foo + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestByteBoxing::foob + * compiler.eliminateAutobox.TestByteBoxing */ +package compiler.eliminateAutobox; + public class TestByteBoxing { static final Byte ibc = new Byte((byte)1); diff --git a/hotspot/test/compiler/eliminateAutobox/6934604/TestDoubleBoxing.java b/hotspot/test/compiler/eliminateAutobox/TestDoubleBoxing.java similarity index 95% rename from hotspot/test/compiler/eliminateAutobox/6934604/TestDoubleBoxing.java rename to hotspot/test/compiler/eliminateAutobox/TestDoubleBoxing.java index 7b76ac95655..63e027a99ca 100644 --- a/hotspot/test/compiler/eliminateAutobox/6934604/TestDoubleBoxing.java +++ b/hotspot/test/compiler/eliminateAutobox/TestDoubleBoxing.java @@ -25,14 +25,23 @@ * @test * @bug 6934604 * @summary enable parts of EliminateAutoBox by default - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox TestDoubleBoxing - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox - * -XX:CompileCommand=exclude,TestDoubleBoxing.dummy -XX:CompileCommand=exclude,TestDoubleBoxing.foo -XX:CompileCommand=exclude,TestDoubleBoxing.foob TestDoubleBoxing - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox - * -XX:CompileCommand=exclude,TestDoubleBoxing.dummy -XX:CompileCommand=exclude,TestDoubleBoxing.foo -XX:CompileCommand=exclude,TestDoubleBoxing.foob TestDoubleBoxing * + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox + * compiler.eliminateAutobox.TestDoubleBoxing + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestDoubleBoxing::dummy + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestDoubleBoxing::foo + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestDoubleBoxing::foob + * compiler.eliminateAutobox.TestDoubleBoxing + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestDoubleBoxing::dummy + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestDoubleBoxing::foo + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestDoubleBoxing::foob + * compiler.eliminateAutobox.TestDoubleBoxing */ +package compiler.eliminateAutobox; + public class TestDoubleBoxing { static final Double ibc = new Double(1.); diff --git a/hotspot/test/compiler/eliminateAutobox/6934604/TestFloatBoxing.java b/hotspot/test/compiler/eliminateAutobox/TestFloatBoxing.java similarity index 95% rename from hotspot/test/compiler/eliminateAutobox/6934604/TestFloatBoxing.java rename to hotspot/test/compiler/eliminateAutobox/TestFloatBoxing.java index 45716730109..756e9909743 100644 --- a/hotspot/test/compiler/eliminateAutobox/6934604/TestFloatBoxing.java +++ b/hotspot/test/compiler/eliminateAutobox/TestFloatBoxing.java @@ -25,14 +25,23 @@ * @test * @bug 6934604 * @summary enable parts of EliminateAutoBox by default - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox TestFloatBoxing - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox - * -XX:CompileCommand=exclude,TestFloatBoxing.dummy -XX:CompileCommand=exclude,TestFloatBoxing.foo -XX:CompileCommand=exclude,TestFloatBoxing.foob TestFloatBoxing - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox - * -XX:CompileCommand=exclude,TestFloatBoxing.dummy -XX:CompileCommand=exclude,TestFloatBoxing.foo -XX:CompileCommand=exclude,TestFloatBoxing.foob TestFloatBoxing * + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox + * compiler.eliminateAutobox.TestFloatBoxing + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::dummy + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::foo + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::foob + * compiler.eliminateAutobox.TestFloatBoxing + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::dummy + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::foo + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestFloatBoxing::foob + * compiler.eliminateAutobox.TestFloatBoxing */ +package compiler.eliminateAutobox; + public class TestFloatBoxing { static final Float ibc = new Float(1.f); diff --git a/hotspot/test/compiler/eliminateAutobox/6934604/TestIntBoxing.java b/hotspot/test/compiler/eliminateAutobox/TestIntBoxing.java similarity index 95% rename from hotspot/test/compiler/eliminateAutobox/6934604/TestIntBoxing.java rename to hotspot/test/compiler/eliminateAutobox/TestIntBoxing.java index d1ad10b070c..8c2eec17270 100644 --- a/hotspot/test/compiler/eliminateAutobox/6934604/TestIntBoxing.java +++ b/hotspot/test/compiler/eliminateAutobox/TestIntBoxing.java @@ -25,14 +25,23 @@ * @test * @bug 6934604 * @summary enable parts of EliminateAutoBox by default - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox TestIntBoxing - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox - * -XX:CompileCommand=exclude,TestIntBoxing.dummy -XX:CompileCommand=exclude,TestIntBoxing.foo -XX:CompileCommand=exclude,TestIntBoxing.foob TestIntBoxing - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox - * -XX:CompileCommand=exclude,TestIntBoxing.dummy -XX:CompileCommand=exclude,TestIntBoxing.foo -XX:CompileCommand=exclude,TestIntBoxing.foob TestIntBoxing * + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox + * compiler.eliminateAutobox.TestIntBoxing + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestIntBoxing::dummy + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestIntBoxing::foo + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestIntBoxing::foob + * compiler.eliminateAutobox.TestIntBoxing + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestIntBoxing::dummy + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestIntBoxing::foo + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestIntBoxing::foob + * compiler.eliminateAutobox.TestIntBoxing */ +package compiler.eliminateAutobox; + public class TestIntBoxing { static final Integer ibc = new Integer(1); diff --git a/hotspot/test/compiler/eliminateAutobox/6934604/TestLongBoxing.java b/hotspot/test/compiler/eliminateAutobox/TestLongBoxing.java similarity index 95% rename from hotspot/test/compiler/eliminateAutobox/6934604/TestLongBoxing.java rename to hotspot/test/compiler/eliminateAutobox/TestLongBoxing.java index b92a01c962b..a3548313f47 100644 --- a/hotspot/test/compiler/eliminateAutobox/6934604/TestLongBoxing.java +++ b/hotspot/test/compiler/eliminateAutobox/TestLongBoxing.java @@ -25,14 +25,23 @@ * @test * @bug 6934604 * @summary enable parts of EliminateAutoBox by default - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox TestLongBoxing - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox - * -XX:CompileCommand=exclude,TestLongBoxing.dummy -XX:CompileCommand=exclude,TestLongBoxing.foo -XX:CompileCommand=exclude,TestLongBoxing.foob TestLongBoxing - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox - * -XX:CompileCommand=exclude,TestLongBoxing.dummy -XX:CompileCommand=exclude,TestLongBoxing.foo -XX:CompileCommand=exclude,TestLongBoxing.foob TestLongBoxing * + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox + * compiler.eliminateAutobox.TestLongBoxing + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestLongBoxing::dummy + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestLongBoxing::foo + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestLongBoxing::foob + * compiler.eliminateAutobox.TestLongBoxing + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestLongBoxing::dummy + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestLongBoxing::foo + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestLongBoxing::foob + * compiler.eliminateAutobox.TestLongBoxing */ +package compiler.eliminateAutobox; + public class TestLongBoxing { static final Long ibc = new Long(1); diff --git a/hotspot/test/compiler/eliminateAutobox/6934604/TestShortBoxing.java b/hotspot/test/compiler/eliminateAutobox/TestShortBoxing.java similarity index 95% rename from hotspot/test/compiler/eliminateAutobox/6934604/TestShortBoxing.java rename to hotspot/test/compiler/eliminateAutobox/TestShortBoxing.java index 0f065af3c63..3db1846d0af 100644 --- a/hotspot/test/compiler/eliminateAutobox/6934604/TestShortBoxing.java +++ b/hotspot/test/compiler/eliminateAutobox/TestShortBoxing.java @@ -25,14 +25,23 @@ * @test * @bug 6934604 * @summary enable parts of EliminateAutoBox by default - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox TestShortBoxing - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox - * -XX:CompileCommand=exclude,TestShortBoxing.dummy -XX:CompileCommand=exclude,TestShortBoxing.foo -XX:CompileCommand=exclude,TestShortBoxing.foob TestShortBoxing - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox - * -XX:CompileCommand=exclude,TestShortBoxing.dummy -XX:CompileCommand=exclude,TestShortBoxing.foo -XX:CompileCommand=exclude,TestShortBoxing.foob TestShortBoxing * + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox + * compiler.eliminateAutobox.TestShortBoxing + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestShortBoxing::dummy + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestShortBoxing::foo + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestShortBoxing::foob + * compiler.eliminateAutobox.TestShortBoxing + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-EliminateAutoBox + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestShortBoxing::dummy + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestShortBoxing::foo + * -XX:CompileCommand=exclude,compiler.eliminateAutobox.TestShortBoxing::foob + * compiler.eliminateAutobox.TestShortBoxing */ +package compiler.eliminateAutobox; + public class TestShortBoxing { static final Short ibc = new Short((short)1); diff --git a/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java b/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java index 440a4b665e0..e5dbe6a2532 100644 --- a/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java +++ b/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java @@ -27,10 +27,14 @@ * @test * @modules java.base/jdk.internal.misc * @library /testlibrary + * * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox * -XX:CompileOnly=::valueOf,::byteValue,::shortValue,::testUnsignedByte,::testUnsignedShort - * UnsignedLoads + * compiler.eliminateAutobox.UnsignedLoads */ + +package compiler.eliminateAutobox; + import static jdk.test.lib.Asserts.assertEQ; public class UnsignedLoads { diff --git a/hotspot/test/compiler/escapeAnalysis/6689060/Test.java b/hotspot/test/compiler/escapeAnalysis/6689060/Test.java deleted file mode 100644 index 46dbc7ecf8f..00000000000 --- a/hotspot/test/compiler/escapeAnalysis/6689060/Test.java +++ /dev/null @@ -1,576 +0,0 @@ -/* - * Copyright (c) 2008, 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 6689060 - * @summary Escape Analysis does not work with Compressed Oops - * @run main/othervm -Xbatch -XX:CompileCommand=exclude,Test.dummy -XX:+AggressiveOpts Test - */ - -import java.lang.reflect.Array; - -class Point { - int x; - int y; - Point next; - int ax[]; - int ay[]; - Point pax[]; - Point pay[]; - public Point getNext() { - return next; - } -} - -public class Test { - - void dummy() { - // Empty method to verify correctness of DebugInfo. - // Use -XX:CompileCommand=exclude,Test.dummy - } - - int ival(int i) { - return i*2; - } - - int test80(int y, int l, int i) { - Point p = new Point(); - p.ax = new int[2]; - p.ay = new int[2]; - int x = 3; - p.ax[0] = x; - p.ay[1] = 3 * x + y; - dummy(); - return p.ax[0] * p.ay[1]; - } - - int test81(int y, int l, int i) { - Point p = new Point(); - p.ax = new int[2]; - p.ay = new int[2]; - int x = 3; - p.ax[0] = x; - p.ay[1] = 3 * x + y; - dummy(); - return p.ax[0] * p.ay[1]; - } - - - int test44(int y) { - Point p1 = new Point(); - p1.x = ival(3); - dummy(); - p1.y = 3 * p1.x + y; - return p1.y; - } - - int test43(int y) { - Point p1 = new Point(); - if ( (y & 1) == 1 ) { - p1.x = ival(3); - } else { - p1.x = ival(5); - } - dummy(); - p1.y = 3 * p1.x + y; - return p1.y; - } - - int test42(int y) { - Point p1 = new Point(); - p1.x = 3; - for (int i = 0; i < y; i++) { - if ( (i & 1) == 1 ) { - p1.x += 4; - } - } - p1.y = 3 * y + p1.x; - return p1.y; - } - - int test40(int y) { - Point p1 = new Point(); - if ( (y & 1) == 1 ) { - p1.x = 3; - } else { - p1.x = 5; - } - p1.y = 3 * p1.x + y; - return p1.y; - } - - int test41(int y) { - Point p1 = new Point(); - if ( (y & 1) == 1 ) { - p1.x += 4; - } else { - p1.x += 5; - } - p1.y = 3 * p1.x + y; - return p1.y; - } - - Point test00(int y) { - int x = 3; - Point p = new Point(); - p.x = x; - p.y = 3 * x + y; - return p; - } - - Point test01(int y) { - int x = 3; - Point p = new Point(); - p.x = x; - p.y = 3 * x + y; - dummy(); - return p; - } - - Point test02(int y) { - int x = 3; - Point p1 = null; - for (int i = 0; i < y; i++) { - Point p2 = new Point(); - p2.x = x; - p2.y = 3 * y + x; - p2.next = p1; - p1 = p2; - } - return p1; - } - - Point test03(int y) { - int x = 3; - Point p1 = null; - for (int i = 0; i < y; i++) { - Point p2 = new Point(); - p2.x = x; - p2.y = 3 * y + x; - p2.next = p1; - p1 = p2; - } - dummy(); - return p1; - } - - Point test04(int y) { - int x = 3; - Point p1 = null; - for (int i = 0; i < y; i++) { - Point p2 = new Point(); - p2.x = x; - p2.y = 3 * y + x; - p2.next = p1; - dummy(); - p1 = p2; - } - return p1; - } - - int test05(int y) { - int x = 3; - Point p1 = new Point(); - for (int i = 0; i < y; i++) { - Point p2 = new Point(); - p2.x = x; - p2.y = 3 * y + x; - p1.next = p2; - p1 = p2; - } - return p1.y; - } - - int test0(int y) { - int x = 3; - Point p = new Point(); - p.x = x; - p.y = 3 * x + y; - dummy(); - return p.x * p.y; - } - - int test1(int y) { - Point p = new Point(); - if ( (y & 1) == 1 ) { - p = new Point(); // Kill previous - } - int x = 3; - p.x = x; - p.y = 3 * x + y; - dummy(); - return p.x * p.y; - } - - int test2(int y) { - Point p1 = new Point(); - Point p2 = new Point(); - p1.x = 3; - p2.x = 4; - p1.y = 3 * p2.x + y; - p2.y = 3 * p1.x + y; - dummy(); - return p1.y * p2.y; - } - - int test3(int y, Point p1) { - Point p2 = new Point(); - p1.x = 3; - p2.x = 4; - p1.y = 3 * p2.x + y; - p2.y = 3 * p1.x + y; - dummy(); - return p1.y * p2.y; - } - - int test4(int y) { - Point p1 = new Point(); - Point p2 = new Point(); - if ( (y & 1) == 1 ) { - p1.x = 3; - p2.x = 4; - } else { - p1.x = 5; - p2.x = 6; - } - p1.y = 3 * p2.x + y; - p2.y = 3 * p1.x + y; - dummy(); - return p1.y * p2.y; - } - - int test5(int y, Point p1) { - Point p2 = new Point(); - if ( (y & 1) == 1 ) { - p1.x = 3; - p2.x = 4; - } else { - p1.x = 5; - p2.x = 6; - } - p1.y = 3 * p2.x + y; - p2.y = 3 * p1.x + y; - dummy(); - return p1.y * p2.y; - } - - int test6(int y) { - Point p1 = new Point(); - Point p2 = new Point(); - p1.next = p2; - if ( (y & 1) == 1 ) { - p1.x = 3; - p1.getNext().x = 4; - } else { - p1.x = 5; - p1.getNext().x = 6; - } - p1.y = 3 * p2.x + y; - p2.y = 3 * p1.x + y; - dummy(); - return p1.y * p2.y; - } - - int test7(int y, Point p1) { - Point p2 = new Point(); - p1.next = p2; - if ( (y & 1) == 1 ) { - p1.x = 3; - p1.getNext().x = 4; - } else { - p1.x = 5; - p1.getNext().x = 6; - } - p1.y = 3 * p2.x + y; - p2.y = 3 * p1.x + y; - dummy(); - return p1.y * p2.y; - } - - int test8(int y, int l, int i) { - Point p = new Point(); - p.ax = new int[l]; - p.ay = new int[l]; - int x = 3; - p.ax[i] = x; - p.ay[i] = 3 * x + y; - dummy(); - return p.ax[i] * p.ay[i]; - } - - int test9(int y, int l, int i) { - Point p = new Point(); - p.pax = new Point[l]; - p.pay = new Point[l]; - p.pax[i] = new Point(); - p.pay[i] = new Point(); - p.pax[i].x = 3; - p.pay[i].x = 4; - p.pax[i].y = 3 * p.pay[i].x + y; - p.pay[i].y = 3 * p.pax[i].x + y; - dummy(); - return p.pax[i].y * p.pay[i].y; - } - - int test10(int y, int l, int i, Class cls) { - Point p = new Point(); - try { - p.pax = (Point[])Array.newInstance(cls, l); - p.pax[i] = (Point)cls.newInstance(); - } - catch(java.lang.InstantiationException ex) { - return 0; - } - catch(java.lang.IllegalAccessException ex) { - return 0; - } - p.pax[i].x = 3; - p.pax[i].y = 3 * p.pax[i].x + y; - dummy(); - return p.pax[i].x * p.pax[i].y; - } - - int test11(int y) { - Point p1 = new Point(); - Point p2 = new Point(); - p1.next = p2; - if ( (y & 1) == 1 ) { - p1.x = 3; - p1.next.x = 4; - } else { - p1.x = 5; - p1.next.x = 6; - } - p1.y = 3 * p1.next.x + y; - p1.next.y = 3 * p1.x + y; - dummy(); - return p1.y * p1.next.y; - } - - int test12(int y) { - Point p1 = new Point(); - p1.next = p1; - if ( (y & 1) == 1 ) { - p1.x = 3; - p1.next.x = 4; - } else { - p1.x = 5; - p1.next.x = 6; - } - p1.y = 3 * p1.next.x + y; - p1.next.y = 3 * p1.x + y; - dummy(); - return p1.y * p1.next.y; - } - - - public static void main(String args[]) { - Test tsr = new Test(); - Point p = new Point(); - Point ptmp = p; - Class cls = Point.class; - int y = 0; - for (int i=0; i<10000; i++) { - ptmp.next = tsr.test00(1); - ptmp.next = tsr.test01(1); - ptmp.next = tsr.test02(1); - ptmp.next = tsr.test03(1); - ptmp.next = tsr.test04(1); - - y = tsr.test05(1); - - y = tsr.test80(y, 1, 0); - y = tsr.test81(y, 1, 0); - - y = tsr.test44(y); - y = tsr.test43(y); - y = tsr.test42(y); - y = tsr.test40(y); - y = tsr.test41(y); - - y = tsr.test0(y); - y = tsr.test1(y); - y = tsr.test2(y); - y = tsr.test3(y, p); - y = tsr.test4(y); - y = tsr.test5(y, p); - y = tsr.test6(y); - y = tsr.test7(y, p); - y = tsr.test8(y, 1, 0); - y = tsr.test9(y, 1, 0); - y = tsr.test10(y, 1, 0, cls); - y = tsr.test11(y); - y = tsr.test12(y); - } - for (int i=0; i<10000; i++) { - ptmp.next = tsr.test00(1); - ptmp.next = tsr.test01(1); - ptmp.next = tsr.test02(1); - ptmp.next = tsr.test03(1); - ptmp.next = tsr.test04(1); - - y = tsr.test05(1); - - y = tsr.test80(y, 1, 0); - y = tsr.test81(y, 1, 0); - - y = tsr.test44(y); - y = tsr.test43(y); - y = tsr.test42(y); - y = tsr.test40(y); - y = tsr.test41(y); - - y = tsr.test0(y); - y = tsr.test1(y); - y = tsr.test2(y); - y = tsr.test3(y, p); - y = tsr.test4(y); - y = tsr.test5(y, p); - y = tsr.test6(y); - y = tsr.test7(y, p); - y = tsr.test8(y, 1, 0); - y = tsr.test9(y, 1, 0); - y = tsr.test10(y, 1, 0, cls); - y = tsr.test11(y); - y = tsr.test12(y); - } - for (int i=0; i<10000; i++) { - ptmp.next = tsr.test00(1); - ptmp.next = tsr.test01(1); - ptmp.next = tsr.test02(1); - ptmp.next = tsr.test03(1); - ptmp.next = tsr.test04(1); - - y = tsr.test05(1); - - y = tsr.test80(y, 1, 0); - y = tsr.test81(y, 1, 0); - - y = tsr.test44(y); - y = tsr.test43(y); - y = tsr.test42(y); - y = tsr.test40(y); - y = tsr.test41(y); - - y = tsr.test0(y); - y = tsr.test1(y); - y = tsr.test2(y); - y = tsr.test3(y, p); - y = tsr.test4(y); - y = tsr.test5(y, p); - y = tsr.test6(y); - y = tsr.test7(y, p); - y = tsr.test8(y, 1, 0); - y = tsr.test9(y, 1, 0); - y = tsr.test10(y, 1, 0, cls); - y = tsr.test11(y); - y = tsr.test12(y); - } - - int z = 0; - y = tsr.test80(0, 1, 0); - z += y; - System.out.println("After 'test80' y=" + y); - y = tsr.test81(0, 1, 0); - z += y; - System.out.println("After 'test81' y=" + y); - - y = tsr.test44(0); - z += y; - System.out.println("After 'test44' y=" + y); - y = tsr.test43(0); - z += y; - System.out.println("After 'test43' y=" + y); - y = tsr.test42(0); - z += y; - System.out.println("After 'test42' y=" + y); - y = tsr.test40(0); - z += y; - System.out.println("After 'test40' y=" + y); - y = tsr.test41(0); - z += y; - System.out.println("After 'test41' y=" + y); - - ptmp.next = tsr.test00(1); - z += y; - System.out.println("After 'test00' p.y=" + ptmp.next.y); - ptmp.next = tsr.test01(1); - z += y; - System.out.println("After 'test01' p.y=" + ptmp.next.y); - ptmp.next = tsr.test02(1); - z += y; - System.out.println("After 'test02' p.y=" + ptmp.next.y); - ptmp.next = tsr.test03(1); - z += y; - System.out.println("After 'test03' p.y=" + ptmp.next.y); - ptmp.next = tsr.test04(1); - z += y; - System.out.println("After 'test04' p.y=" + ptmp.next.y); - - y = tsr.test05(1); - z += y; - System.out.println("After 'test05' y=" + y); - - y = tsr.test0(0); - z += y; - System.out.println("After 'test0' y=" + y); - y = tsr.test1(0); - z += y; - System.out.println("After 'test1' y=" + y); - y = tsr.test2(0); - z += y; - System.out.println("After 'test2' y=" + y); - y = tsr.test3(0, new Point()); - z += y; - System.out.println("After 'test3' y=" + y); - y = tsr.test4(0); - z += y; - System.out.println("After 'test4' y=" + y); - y = tsr.test5(0, new Point()); - z += y; - System.out.println("After 'test5' y=" + y); - y = tsr.test6(0); - z += y; - System.out.println("After 'test6' y=" + y); - y = tsr.test7(0, new Point()); - z += y; - System.out.println("After 'test7' y=" + y); - y = tsr.test8(0, 1, 0); - z += y; - System.out.println("After 'test8' y=" + y); - y = tsr.test9(0, 1, 0); - z += y; - System.out.println("After 'test9' y=" + y); - y = tsr.test10(0, 1, 0, cls); - z += y; - System.out.println("After 'test10' y=" + y); - y = tsr.test11(0); - z += y; - System.out.println("After 'test11' y=" + y); - y = tsr.test12(0); - z += y; - System.out.println("After 'test12' y=" + y); - System.out.println("Sum of y =" + z); - } -} diff --git a/hotspot/test/compiler/escapeAnalysis/6726999/Test.java b/hotspot/test/compiler/escapeAnalysis/6726999/Test.java deleted file mode 100644 index db2ba6d9677..00000000000 --- a/hotspot/test/compiler/escapeAnalysis/6726999/Test.java +++ /dev/null @@ -1,1419 +0,0 @@ -/* - * Copyright (c) 2008, 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 6726999 - * @summary nsk/stress/jck12a/jck12a010 assert(n != NULL,"Bad immediate dominator info."); - * @run main/othervm -Xbatch -XX:CompileCommand=exclude,Test.dummy -XX:+AggressiveOpts Test - */ - -import java.lang.reflect.Array; - -class Point { - int x; - int y; -} - -public class Test { - - void dummy() { - // Empty method to verify correctness of DebugInfo. - // Use -XX:CompileCommand=exclude,Test.dummy - } - - int test0_0_0(int y) { - int x = 3; - Point p = new Point(); - dummy(); - p.x = x; - p.y = 3 * x + y; - return p.x * p.y; - } - - int test0_0_1(int y) { - int x = 3; - Point p = null; - dummy(); - p = new Point(); - dummy(); - p.x = x; - p.y = 3 * x + y; - return p.x * p.y; - } - - int test0_0_2(int y) { - int x = 3; - Point p = new Point(); - dummy(); - p = new Point(); - dummy(); - p.x = x; - p.y = 3 * x + y; - return p.x * p.y; - } - - int test0_0_3(int y) { - int x = 3; - Point p[] = new Point[1]; - p[0] = new Point(); - dummy(); - p[0].x = x; - p[0].y = 3 * x + y; - return p[0].x * p[0].y; - } - - int test0_0_4(int y) { - int x = 3; - Point p[] = new Point[1]; - dummy(); - p[0] = new Point(); - dummy(); - p[0].x = x; - p[0].y = 3 * x + y; - return p[0].x * p[0].y; - } - - int test0_0_5(int y) { - int x = 3; - Point p[] = new Point[1]; - dummy(); - p[0] = null; - dummy(); - p[0] = new Point(); - dummy(); - p[0].x = x; - p[0].y = 3 * x + y; - return p[0].x * p[0].y; - } - - int test0_0_6(int y) { - int x = 3; - Point p[] = new Point[1]; - p[0] = new Point(); - dummy(); - p[0] = new Point(); - dummy(); - p[0].x = x; - p[0].y = 3 * x + y; - return p[0].x * p[0].y; - } - - int test0_1_3(int y) { - int x = 3; - Point p1 = new Point(); - dummy(); - Point p[] = new Point[1]; - p[0] = p1; - dummy(); - p[0].x = x; - p[0].y = 3 * x + y; - return p[0].x * p[0].y; - } - - int test0_1_4(int y) { - int x = 3; - Point p1 = new Point(); - dummy(); - Point p[] = new Point[1]; - dummy(); - p[0] = p1; - dummy(); - p[0].x = x; - p[0].y = 3 * x + y; - return p[0].x * p[0].y; - } - - int test0_1_5(int y) { - int x = 3; - Point p1 = new Point(); - dummy(); - Point p[] = new Point[1]; - dummy(); - p[0] = null; - dummy(); - p[0] = p1; - dummy(); - p[0].x = x; - p[0].y = 3 * x + y; - return p[0].x * p[0].y; - } - - int test0_1_6(int y) { - int x = 3; - Point p1 = new Point(); - dummy(); - Point p2 = new Point(); - dummy(); - Point p[] = new Point[1]; - p[0] = p1; - dummy(); - p[0] = p2; - dummy(); - p[0].x = x; - p[0].y = 3 * x + y; - return p[0].x * p[0].y; - } - - int test1_0_0(int y) { - Point p = new Point(); - if ( (y & 1) == 1 ) { - p = new Point(); - } - int x = 3; - p.x = x; - p.y = 3 * x + y; - dummy(); - return p.x * p.y; - } - - int test1_0_1(int y) { - Point p = null; - if ( (y & 1) == 1 ) { - p = new Point(); - } - int x = 3; - if ( p == null ) - return (3 * x + y) * x; - p.x = x; - p.y = 3 * x + y; - dummy(); - return p.x * p.y; - } - - int test1_0_2(int y) { - Point p[] = new Point[1]; - if ( (y & 1) == 1 ) { - p[0] = new Point(); - } - int x = 3; - if ( p[0] == null ) - return (3 * x + y) * x; - p[0].x = x; - p[0].y = 3 * x + y; - dummy(); - return p[0].x * p[0].y; - } - - int test1_0_3(int y) { - Point p[] = new Point[1]; - p[0] = null; - if ( (y & 1) == 1 ) { - p[0] = new Point(); - } - int x = 3; - if ( p[0] == null ) - return (3 * x + y) * x; - p[0].x = x; - p[0].y = 3 * x + y; - dummy(); - return p[0].x * p[0].y; - } - - int test1_0_4(int y) { - Point p[] = new Point[1]; - p[0] = new Point(); - if ( (y & 1) == 1 ) { - p[0] = new Point(); - } - int x = 3; - if ( p[0] == null ) - return (3 * x + y) * x; - p[0].x = x; - p[0].y = 3 * x + y; - dummy(); - return p[0].x * p[0].y; - } - - int test1_0_5(int y) { - Point p[] = new Point[1]; - if ( (y & 1) == 1 ) { - p[0] = new Point(); - } else { - p[0] = null; - } - int x = 3; - if ( p[0] == null ) - return (3 * x + y) * x; - p[0].x = x; - p[0].y = 3 * x + y; - dummy(); - return p[0].x * p[0].y; - } - - int test1_0_6(int y) { - Point p[] = new Point[1]; - if ( (y & 1) == 1 ) { - p[0] = new Point(); - } else { - p[0] = new Point(); - } - int x = 3; - if ( p[0] == null ) - return (3 * x + y) * x; - p[0].x = x; - p[0].y = 3 * x + y; - dummy(); - return p[0].x * p[0].y; - } - - int test1_1_0(int y) { - Point p = new Point(); - if ( (y & 1) == 1 ) { - dummy(); - p = new Point(); - dummy(); - } - int x = 3; - p.x = x; - p.y = 3 * x + y; - dummy(); - return p.x * p.y; - } - - int test1_1_1(int y) { - Point p = null; - if ( (y & 1) == 1 ) { - dummy(); - p = new Point(); - dummy(); - } - int x = 3; - if ( p == null ) - return (3 * x + y) * x; - p.x = x; - p.y = 3 * x + y; - dummy(); - return p.x * p.y; - } - - int test1_1_2(int y) { - Point p[] = new Point[1]; - if ( (y & 1) == 1 ) { - dummy(); - p[0] = new Point(); - dummy(); - } - int x = 3; - if ( p[0] == null ) - return (3 * x + y) * x; - p[0].x = x; - p[0].y = 3 * x + y; - dummy(); - return p[0].x * p[0].y; - } - - int test1_1_3(int y) { - Point p[] = new Point[1]; - dummy(); - p[0] = null; - if ( (y & 1) == 1 ) { - dummy(); - p[0] = new Point(); - dummy(); - } - int x = 3; - if ( p[0] == null ) - return (3 * x + y) * x; - p[0].x = x; - p[0].y = 3 * x + y; - dummy(); - return p[0].x * p[0].y; - } - - int test1_1_4(int y) { - Point p[] = new Point[1]; - dummy(); - p[0] = new Point(); - if ( (y & 1) == 1 ) { - dummy(); - p[0] = new Point(); - dummy(); - } - int x = 3; - if ( p[0] == null ) - return (3 * x + y) * x; - p[0].x = x; - p[0].y = 3 * x + y; - dummy(); - return p[0].x * p[0].y; - } - - int test1_1_5(int y) { - Point p[] = new Point[1]; - if ( (y & 1) == 1 ) { - dummy(); - p[0] = new Point(); - dummy(); - } else { - dummy(); - p[0] = null; - dummy(); - } - int x = 3; - if ( p[0] == null ) - return (3 * x + y) * x; - p[0].x = x; - p[0].y = 3 * x + y; - dummy(); - return p[0].x * p[0].y; - } - - int test1_1_6(int y) { - Point p[] = new Point[1]; - if ( (y & 1) == 1 ) { - dummy(); - p[0] = new Point(); - dummy(); - } else { - dummy(); - p[0] = new Point(); - dummy(); - } - int x = 3; - if ( p[0] == null ) - return (3 * x + y) * x; - p[0].x = x; - p[0].y = 3 * x + y; - dummy(); - return p[0].x * p[0].y; - } - - int test1_2_0(int y) { - Point p1 = new Point(); - dummy(); - Point p = new Point(); - if ( (y & 1) == 1 ) { - dummy(); - p = p1; - dummy(); - } - int x = 3; - p.x = x; - p.y = 3 * x + y; - dummy(); - return p.x * p.y; - } - - int test1_2_1(int y) { - Point p1 = new Point(); - dummy(); - Point p = null; - if ( (y & 1) == 1 ) { - dummy(); - p = p1; - dummy(); - } - int x = 3; - if ( p == null ) - return (3 * x + y) * x; - p.x = x; - p.y = 3 * x + y; - dummy(); - return p.x * p.y; - } - - int test1_2_2(int y) { - Point p1 = new Point(); - dummy(); - Point p[] = new Point[1]; - if ( (y & 1) == 1 ) { - dummy(); - p[0] = p1; - dummy(); - } - int x = 3; - if ( p[0] == null ) - return (3 * x + y) * x; - p[0].x = x; - p[0].y = 3 * x + y; - dummy(); - return p[0].x * p[0].y; - } - - int test1_2_3(int y) { - Point p1 = new Point(); - dummy(); - Point p[] = new Point[1]; - dummy(); - p[0] = null; - if ( (y & 1) == 1 ) { - dummy(); - p[0] = p1; - dummy(); - } - int x = 3; - if ( p[0] == null ) - return (3 * x + y) * x; - p[0].x = x; - p[0].y = 3 * x + y; - dummy(); - return p[0].x * p[0].y; - } - - int test1_2_4(int y) { - Point p1 = new Point(); - dummy(); - Point p2 = new Point(); - dummy(); - Point p[] = new Point[1]; - dummy(); - p[0] = p1; - if ( (y & 1) == 1 ) { - dummy(); - p[0] = p2; - dummy(); - } - int x = 3; - if ( p[0] == null ) - return (3 * x + y) * x; - p[0].x = x; - p[0].y = 3 * x + y; - dummy(); - return p[0].x * p[0].y; - } - - int test1_2_5(int y) { - Point p1 = new Point(); - dummy(); - Point p[] = new Point[1]; - if ( (y & 1) == 1 ) { - dummy(); - p[0] = p1; - dummy(); - } else { - dummy(); - p[0] = null; - dummy(); - } - int x = 3; - if ( p[0] == null ) - return (3 * x + y) * x; - p[0].x = x; - p[0].y = 3 * x + y; - dummy(); - return p[0].x * p[0].y; - } - - int test1_2_6(int y) { - Point p1 = new Point(); - dummy(); - Point p2 = new Point(); - dummy(); - Point p[] = new Point[1]; - if ( (y & 1) == 1 ) { - dummy(); - p[0] = p1; - dummy(); - } else { - dummy(); - p[0] = p2; - dummy(); - } - int x = 3; - if ( p[0] == null ) - return (3 * x + y) * x; - p[0].x = x; - p[0].y = 3 * x + y; - dummy(); - return p[0].x * p[0].y; - } - - int test2_0_0(int y) { - Point p = new Point(); - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - p = new Point(); - } - int x = 3; - p.x = x; - p.y = 3 * x + y; - dummy(); - return p.x * p.y; - } - - int test2_0_1(int y) { - Point p = null; - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - p = new Point(); - } - int x = 3; - if ( p == null ) - return (3 * x + y) * x; - p.x = x; - p.y = 3 * x + y; - dummy(); - return p.x * p.y; - } - - int test2_0_2(int y) { - Point p[] = new Point[3]; - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - p[i] = new Point(); - } - int x = 3; - int j = (y & 1); - if ( p[j] == null ) - return (3 * x + y) * x; - p[j].x = x; - p[j].y = 3 * x + y; - dummy(); - return p[j].x * p[0].y; - } - - int test2_0_3(int y) { - Point p[] = new Point[3]; - int j = (y & 1); - p[j] = null; - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - p[i] = new Point(); - } - int x = 3; - if ( p[j] == null ) - return (3 * x + y) * x; - p[j].x = x; - p[j].y = 3 * x + y; - dummy(); - return p[j].x * p[0].y; - } - - int test2_0_4(int y) { - Point p[] = new Point[3]; - int j = (y & 1); - p[j] = new Point(); - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - p[i] = new Point(); - } - int x = 3; - if ( p[j] == null ) - return (3 * x + y) * x; - p[j].x = x; - p[j].y = 3 * x + y; - dummy(); - return p[j].x * p[0].y; - } - - int test2_0_5(int y) { - Point p[] = new Point[3]; - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - p[i] = new Point(); - } - for (int i = 0; i < lim; i++) { - p[i] = null; - } - int x = 3; - int j = (y & 1); - if ( p[j] == null ) - return (3 * x + y) * x; - p[j].x = x; - p[j].y = 3 * x + y; - dummy(); - return p[j].x * p[0].y; - } - - int test2_0_6(int y) { - Point p[] = new Point[3]; - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - p[i] = new Point(); - } - for (int i = 0; i < lim; i++) { - p[i] = new Point(); - } - int x = 3; - int j = (y & 1); - if ( p[j] == null ) - return (3 * x + y) * x; - p[j].x = x; - p[j].y = 3 * x + y; - dummy(); - return p[j].x * p[0].y; - } - - int test2_1_0(int y) { - Point p = new Point(); - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - dummy(); - p = new Point(); - dummy(); - } - int x = 3; - p.x = x; - p.y = 3 * x + y; - dummy(); - return p.x * p.y; - } - - int test2_1_1(int y) { - Point p = null; - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - dummy(); - p = new Point(); - dummy(); - } - int x = 3; - if ( p == null ) - return (3 * x + y) * x; - p.x = x; - p.y = 3 * x + y; - dummy(); - return p.x * p.y; - } - - int test2_1_2(int y) { - Point p[] = new Point[3]; - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - dummy(); - p[i] = new Point(); - dummy(); - } - int x = 3; - int j = (y & 1); - if ( p[j] == null ) - return (3 * x + y) * x; - p[j].x = x; - p[j].y = 3 * x + y; - dummy(); - return p[j].x * p[0].y; - } - - int test2_1_3(int y) { - Point p[] = new Point[3]; - dummy(); - int j = (y & 1); - p[j] = null; - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - dummy(); - p[i] = new Point(); - dummy(); - } - int x = 3; - if ( p[j] == null ) - return (3 * x + y) * x; - p[j].x = x; - p[j].y = 3 * x + y; - dummy(); - return p[j].x * p[0].y; - } - - int test2_1_4(int y) { - Point p[] = new Point[3]; - dummy(); - int j = (y & 1); - p[j] = new Point(); - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - dummy(); - p[i] = new Point(); - dummy(); - } - int x = 3; - if ( p[j] == null ) - return (3 * x + y) * x; - p[j].x = x; - p[j].y = 3 * x + y; - dummy(); - return p[j].x * p[0].y; - } - - int test2_1_5(int y) { - Point p[] = new Point[3]; - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - dummy(); - p[i] = new Point(); - dummy(); - } - for (int i = 0; i < lim; i++) { - dummy(); - p[i] = null; - dummy(); - } - int x = 3; - int j = (y & 1); - if ( p[j] == null ) - return (3 * x + y) * x; - p[j].x = x; - p[j].y = 3 * x + y; - dummy(); - return p[j].x * p[0].y; - } - - int test2_1_6(int y) { - Point p[] = new Point[3]; - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - dummy(); - p[i] = new Point(); - dummy(); - } - for (int i = 0; i < lim; i++) { - dummy(); - p[i] = new Point(); - dummy(); - } - int x = 3; - int j = (y & 1); - if ( p[j] == null ) - return (3 * x + y) * x; - p[j].x = x; - p[j].y = 3 * x + y; - dummy(); - return p[j].x * p[0].y; - } - - int test2_2_0(int y) { - Point p1 = new Point(); - dummy(); - Point p = new Point(); - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - dummy(); - p = p1; - dummy(); - } - int x = 3; - p.x = x; - p.y = 3 * x + y; - dummy(); - return p.x * p.y; - } - - int test2_2_1(int y) { - Point p1 = new Point(); - dummy(); - Point p = null; - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - dummy(); - p = p1; - dummy(); - } - int x = 3; - if ( p == null ) - return (3 * x + y) * x; - p.x = x; - p.y = 3 * x + y; - dummy(); - return p.x * p.y; - } - - int test2_2_2(int y) { - Point p1 = new Point(); - dummy(); - Point p[] = new Point[3]; - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - dummy(); - p[i] = p1; - dummy(); - } - int x = 3; - int j = (y & 1); - if ( p[j] == null ) - return (3 * x + y) * x; - p[j].x = x; - p[j].y = 3 * x + y; - dummy(); - return p[j].x * p[0].y; - } - - int test2_2_3(int y) { - Point p1 = new Point(); - dummy(); - Point p[] = new Point[3]; - dummy(); - int j = (y & 1); - p[j] = null; - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - dummy(); - p[i] = p1; - dummy(); - } - int x = 3; - if ( p[j] == null ) - return (3 * x + y) * x; - p[j].x = x; - p[j].y = 3 * x + y; - dummy(); - return p[j].x * p[0].y; - } - - int test2_2_4(int y) { - Point p1 = new Point(); - dummy(); - Point p2 = new Point(); - dummy(); - Point p[] = new Point[3]; - dummy(); - int j = (y & 1); - p[j] = p1; - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - dummy(); - p[i] = p2; - dummy(); - } - int x = 3; - if ( p[j] == null ) - return (3 * x + y) * x; - p[j].x = x; - p[j].y = 3 * x + y; - dummy(); - return p[j].x * p[0].y; - } - - int test2_2_5(int y) { - Point p1 = new Point(); - dummy(); - Point p[] = new Point[3]; - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - dummy(); - p[i] = p1; - dummy(); - } - for (int i = 0; i < lim; i++) { - dummy(); - p[i] = null; - dummy(); - } - int x = 3; - int j = (y & 1); - if ( p[j] == null ) - return (3 * x + y) * x; - p[j].x = x; - p[j].y = 3 * x + y; - dummy(); - return p[j].x * p[0].y; - } - - int test2_2_6(int y) { - Point p1 = new Point(); - dummy(); - Point p2 = new Point(); - dummy(); - Point p[] = new Point[3]; - int lim = (y & 3); - for (int i = 0; i < lim; i++) { - dummy(); - p[i] = p1; - dummy(); - } - for (int i = 0; i < lim; i++) { - dummy(); - p[i] = p2; - dummy(); - } - int x = 3; - int j = (y & 1); - if ( p[j] == null ) - return (3 * x + y) * x; - p[j].x = x; - p[j].y = 3 * x + y; - dummy(); - return p[j].x * p[0].y; - } - - public static void main(String args[]) { - Test tsr = new Test(); - Point p = new Point(); - Point ptmp = p; - Class cls = Point.class; - int y = 0; - for (int i=0; i<10000; i++) { - y = tsr.test0_0_0(y); - y = tsr.test0_0_0(y); - y = tsr.test0_0_1(y); - y = tsr.test0_0_1(y); - y = tsr.test0_0_2(y); - y = tsr.test0_0_2(y); - y = tsr.test0_0_3(y); - y = tsr.test0_0_3(y); - y = tsr.test0_0_4(y); - y = tsr.test0_0_4(y); - y = tsr.test0_0_5(y); - y = tsr.test0_0_5(y); - y = tsr.test0_0_6(y); - y = tsr.test0_0_6(y); - - y = tsr.test0_1_3(y); - y = tsr.test0_1_3(y); - y = tsr.test0_1_4(y); - y = tsr.test0_1_4(y); - y = tsr.test0_1_5(y); - y = tsr.test0_1_5(y); - y = tsr.test0_1_6(y); - y = tsr.test0_1_6(y); - - y = tsr.test1_0_0(y&~1); - y = tsr.test1_0_1(y&~1); - y = tsr.test1_0_2(y&~1); - y = tsr.test1_0_3(y&~1); - y = tsr.test1_0_4(y&~1); - y = tsr.test1_0_5(y&~1); - y = tsr.test1_0_6(y&~1); - y = tsr.test1_0_0((y&~1)+1); - y = tsr.test1_0_1((y&~1)+1); - y = tsr.test1_0_2((y&~1)+1); - y = tsr.test1_0_3((y&~1)+1); - y = tsr.test1_0_4((y&~1)+1); - y = tsr.test1_0_5((y&~1)+1); - y = tsr.test1_0_6((y&~1)+1); - - y = tsr.test1_1_0(y&~1); - y = tsr.test1_1_1(y&~1); - y = tsr.test1_1_2(y&~1); - y = tsr.test1_1_3(y&~1); - y = tsr.test1_1_4(y&~1); - y = tsr.test1_1_5(y&~1); - y = tsr.test1_1_6(y&~1); - y = tsr.test1_1_0((y&~1)+1); - y = tsr.test1_1_1((y&~1)+1); - y = tsr.test1_1_2((y&~1)+1); - y = tsr.test1_1_3((y&~1)+1); - y = tsr.test1_1_4((y&~1)+1); - y = tsr.test1_1_5((y&~1)+1); - y = tsr.test1_1_6((y&~1)+1); - - y = tsr.test1_2_0(y&~1); - y = tsr.test1_2_1(y&~1); - y = tsr.test1_2_2(y&~1); - y = tsr.test1_2_3(y&~1); - y = tsr.test1_2_4(y&~1); - y = tsr.test1_2_5(y&~1); - y = tsr.test1_2_6(y&~1); - y = tsr.test1_2_0((y&~1)+1); - y = tsr.test1_2_1((y&~1)+1); - y = tsr.test1_2_2((y&~1)+1); - y = tsr.test1_2_3((y&~1)+1); - y = tsr.test1_2_4((y&~1)+1); - y = tsr.test1_2_5((y&~1)+1); - y = tsr.test1_2_6((y&~1)+1); - - y = tsr.test2_0_0(y&~3); - y = tsr.test2_0_1(y&~3); - y = tsr.test2_0_2(y&~3); - y = tsr.test2_0_3(y&~3); - y = tsr.test2_0_4(y&~3); - y = tsr.test2_0_5(y&~3); - y = tsr.test2_0_6(y&~3); - y = tsr.test2_0_0((y&~3)+3); - y = tsr.test2_0_1((y&~3)+3); - y = tsr.test2_0_2((y&~3)+3); - y = tsr.test2_0_3((y&~3)+3); - y = tsr.test2_0_4((y&~3)+3); - y = tsr.test2_0_5((y&~3)+3); - y = tsr.test2_0_6((y&~3)+3); - - y = tsr.test2_1_0(y&~3); - y = tsr.test2_1_1(y&~3); - y = tsr.test2_1_2(y&~3); - y = tsr.test2_1_3(y&~3); - y = tsr.test2_1_4(y&~3); - y = tsr.test2_1_5(y&~3); - y = tsr.test2_1_6(y&~3); - y = tsr.test2_1_0((y&~3)+3); - y = tsr.test2_1_1((y&~3)+3); - y = tsr.test2_1_2((y&~3)+3); - y = tsr.test2_1_3((y&~3)+3); - y = tsr.test2_1_4((y&~3)+3); - y = tsr.test2_1_5((y&~3)+3); - y = tsr.test2_1_6((y&~3)+3); - - y = tsr.test2_2_0(y&~3); - y = tsr.test2_2_1(y&~3); - y = tsr.test2_2_2(y&~3); - y = tsr.test2_2_3(y&~3); - y = tsr.test2_2_4(y&~3); - y = tsr.test2_2_5(y&~3); - y = tsr.test2_2_6(y&~3); - y = tsr.test2_2_0((y&~3)+3); - y = tsr.test2_2_1((y&~3)+3); - y = tsr.test2_2_2((y&~3)+3); - y = tsr.test2_2_3((y&~3)+3); - y = tsr.test2_2_4((y&~3)+3); - y = tsr.test2_2_5((y&~3)+3); - y = tsr.test2_2_6((y&~3)+3); - - } - for (int i=0; i<10000; i++) { - y = tsr.test0_0_0(y); - y = tsr.test0_0_0(y); - y = tsr.test0_0_1(y); - y = tsr.test0_0_1(y); - y = tsr.test0_0_2(y); - y = tsr.test0_0_2(y); - y = tsr.test0_0_3(y); - y = tsr.test0_0_3(y); - y = tsr.test0_0_4(y); - y = tsr.test0_0_4(y); - y = tsr.test0_0_5(y); - y = tsr.test0_0_5(y); - y = tsr.test0_0_6(y); - y = tsr.test0_0_6(y); - - y = tsr.test0_1_3(y); - y = tsr.test0_1_3(y); - y = tsr.test0_1_4(y); - y = tsr.test0_1_4(y); - y = tsr.test0_1_5(y); - y = tsr.test0_1_5(y); - y = tsr.test0_1_6(y); - y = tsr.test0_1_6(y); - - y = tsr.test1_0_0(y&~1); - y = tsr.test1_0_1(y&~1); - y = tsr.test1_0_2(y&~1); - y = tsr.test1_0_3(y&~1); - y = tsr.test1_0_4(y&~1); - y = tsr.test1_0_5(y&~1); - y = tsr.test1_0_6(y&~1); - y = tsr.test1_0_0((y&~1)+1); - y = tsr.test1_0_1((y&~1)+1); - y = tsr.test1_0_2((y&~1)+1); - y = tsr.test1_0_3((y&~1)+1); - y = tsr.test1_0_4((y&~1)+1); - y = tsr.test1_0_5((y&~1)+1); - y = tsr.test1_0_6((y&~1)+1); - - y = tsr.test1_1_0(y&~1); - y = tsr.test1_1_1(y&~1); - y = tsr.test1_1_2(y&~1); - y = tsr.test1_1_3(y&~1); - y = tsr.test1_1_4(y&~1); - y = tsr.test1_1_5(y&~1); - y = tsr.test1_1_6(y&~1); - y = tsr.test1_1_0((y&~1)+1); - y = tsr.test1_1_1((y&~1)+1); - y = tsr.test1_1_2((y&~1)+1); - y = tsr.test1_1_3((y&~1)+1); - y = tsr.test1_1_4((y&~1)+1); - y = tsr.test1_1_5((y&~1)+1); - y = tsr.test1_1_6((y&~1)+1); - - y = tsr.test1_2_0(y&~1); - y = tsr.test1_2_1(y&~1); - y = tsr.test1_2_2(y&~1); - y = tsr.test1_2_3(y&~1); - y = tsr.test1_2_4(y&~1); - y = tsr.test1_2_5(y&~1); - y = tsr.test1_2_6(y&~1); - y = tsr.test1_2_0((y&~1)+1); - y = tsr.test1_2_1((y&~1)+1); - y = tsr.test1_2_2((y&~1)+1); - y = tsr.test1_2_3((y&~1)+1); - y = tsr.test1_2_4((y&~1)+1); - y = tsr.test1_2_5((y&~1)+1); - y = tsr.test1_2_6((y&~1)+1); - - y = tsr.test2_0_0(y&~3); - y = tsr.test2_0_1(y&~3); - y = tsr.test2_0_2(y&~3); - y = tsr.test2_0_3(y&~3); - y = tsr.test2_0_4(y&~3); - y = tsr.test2_0_5(y&~3); - y = tsr.test2_0_6(y&~3); - y = tsr.test2_0_0((y&~3)+3); - y = tsr.test2_0_1((y&~3)+3); - y = tsr.test2_0_2((y&~3)+3); - y = tsr.test2_0_3((y&~3)+3); - y = tsr.test2_0_4((y&~3)+3); - y = tsr.test2_0_5((y&~3)+3); - y = tsr.test2_0_6((y&~3)+3); - - y = tsr.test2_1_0(y&~3); - y = tsr.test2_1_1(y&~3); - y = tsr.test2_1_2(y&~3); - y = tsr.test2_1_3(y&~3); - y = tsr.test2_1_4(y&~3); - y = tsr.test2_1_5(y&~3); - y = tsr.test2_1_6(y&~3); - y = tsr.test2_1_0((y&~3)+3); - y = tsr.test2_1_1((y&~3)+3); - y = tsr.test2_1_2((y&~3)+3); - y = tsr.test2_1_3((y&~3)+3); - y = tsr.test2_1_4((y&~3)+3); - y = tsr.test2_1_5((y&~3)+3); - y = tsr.test2_1_6((y&~3)+3); - - y = tsr.test2_2_0(y&~3); - y = tsr.test2_2_1(y&~3); - y = tsr.test2_2_2(y&~3); - y = tsr.test2_2_3(y&~3); - y = tsr.test2_2_4(y&~3); - y = tsr.test2_2_5(y&~3); - y = tsr.test2_2_6(y&~3); - y = tsr.test2_2_0((y&~3)+3); - y = tsr.test2_2_1((y&~3)+3); - y = tsr.test2_2_2((y&~3)+3); - y = tsr.test2_2_3((y&~3)+3); - y = tsr.test2_2_4((y&~3)+3); - y = tsr.test2_2_5((y&~3)+3); - y = tsr.test2_2_6((y&~3)+3); - - } - for (int i=0; i<10000; i++) { - y = tsr.test0_0_0(y); - y = tsr.test0_0_0(y); - y = tsr.test0_0_1(y); - y = tsr.test0_0_1(y); - y = tsr.test0_0_2(y); - y = tsr.test0_0_2(y); - y = tsr.test0_0_3(y); - y = tsr.test0_0_3(y); - y = tsr.test0_0_4(y); - y = tsr.test0_0_4(y); - y = tsr.test0_0_5(y); - y = tsr.test0_0_5(y); - y = tsr.test0_0_6(y); - y = tsr.test0_0_6(y); - - y = tsr.test0_1_3(y); - y = tsr.test0_1_3(y); - y = tsr.test0_1_4(y); - y = tsr.test0_1_4(y); - y = tsr.test0_1_5(y); - y = tsr.test0_1_5(y); - y = tsr.test0_1_6(y); - y = tsr.test0_1_6(y); - - y = tsr.test1_0_0(y&~1); - y = tsr.test1_0_1(y&~1); - y = tsr.test1_0_2(y&~1); - y = tsr.test1_0_3(y&~1); - y = tsr.test1_0_4(y&~1); - y = tsr.test1_0_5(y&~1); - y = tsr.test1_0_6(y&~1); - y = tsr.test1_0_0((y&~1)+1); - y = tsr.test1_0_1((y&~1)+1); - y = tsr.test1_0_2((y&~1)+1); - y = tsr.test1_0_3((y&~1)+1); - y = tsr.test1_0_4((y&~1)+1); - y = tsr.test1_0_5((y&~1)+1); - y = tsr.test1_0_6((y&~1)+1); - - y = tsr.test1_1_0(y&~1); - y = tsr.test1_1_1(y&~1); - y = tsr.test1_1_2(y&~1); - y = tsr.test1_1_3(y&~1); - y = tsr.test1_1_4(y&~1); - y = tsr.test1_1_5(y&~1); - y = tsr.test1_1_6(y&~1); - y = tsr.test1_1_0((y&~1)+1); - y = tsr.test1_1_1((y&~1)+1); - y = tsr.test1_1_2((y&~1)+1); - y = tsr.test1_1_3((y&~1)+1); - y = tsr.test1_1_4((y&~1)+1); - y = tsr.test1_1_5((y&~1)+1); - y = tsr.test1_1_6((y&~1)+1); - - y = tsr.test1_2_0(y&~1); - y = tsr.test1_2_1(y&~1); - y = tsr.test1_2_2(y&~1); - y = tsr.test1_2_3(y&~1); - y = tsr.test1_2_4(y&~1); - y = tsr.test1_2_5(y&~1); - y = tsr.test1_2_6(y&~1); - y = tsr.test1_2_0((y&~1)+1); - y = tsr.test1_2_1((y&~1)+1); - y = tsr.test1_2_2((y&~1)+1); - y = tsr.test1_2_3((y&~1)+1); - y = tsr.test1_2_4((y&~1)+1); - y = tsr.test1_2_5((y&~1)+1); - y = tsr.test1_2_6((y&~1)+1); - - y = tsr.test2_0_0(y&~3); - y = tsr.test2_0_1(y&~3); - y = tsr.test2_0_2(y&~3); - y = tsr.test2_0_3(y&~3); - y = tsr.test2_0_4(y&~3); - y = tsr.test2_0_5(y&~3); - y = tsr.test2_0_6(y&~3); - y = tsr.test2_0_0((y&~3)+3); - y = tsr.test2_0_1((y&~3)+3); - y = tsr.test2_0_2((y&~3)+3); - y = tsr.test2_0_3((y&~3)+3); - y = tsr.test2_0_4((y&~3)+3); - y = tsr.test2_0_5((y&~3)+3); - y = tsr.test2_0_6((y&~3)+3); - - y = tsr.test2_1_0(y&~3); - y = tsr.test2_1_1(y&~3); - y = tsr.test2_1_2(y&~3); - y = tsr.test2_1_3(y&~3); - y = tsr.test2_1_4(y&~3); - y = tsr.test2_1_5(y&~3); - y = tsr.test2_1_6(y&~3); - y = tsr.test2_1_0((y&~3)+3); - y = tsr.test2_1_1((y&~3)+3); - y = tsr.test2_1_2((y&~3)+3); - y = tsr.test2_1_3((y&~3)+3); - y = tsr.test2_1_4((y&~3)+3); - y = tsr.test2_1_5((y&~3)+3); - y = tsr.test2_1_6((y&~3)+3); - - y = tsr.test2_2_0(y&~3); - y = tsr.test2_2_1(y&~3); - y = tsr.test2_2_2(y&~3); - y = tsr.test2_2_3(y&~3); - y = tsr.test2_2_4(y&~3); - y = tsr.test2_2_5(y&~3); - y = tsr.test2_2_6(y&~3); - y = tsr.test2_2_0((y&~3)+3); - y = tsr.test2_2_1((y&~3)+3); - y = tsr.test2_2_2((y&~3)+3); - y = tsr.test2_2_3((y&~3)+3); - y = tsr.test2_2_4((y&~3)+3); - y = tsr.test2_2_5((y&~3)+3); - y = tsr.test2_2_6((y&~3)+3); - - } - - int z = 0; - y = tsr.test0_0_0(0); - System.out.println("After 'test0_0_0' y=" + y); - y = tsr.test0_0_1(0); - System.out.println("After 'test0_0_1' y=" + y); - y = tsr.test0_0_2(0); - System.out.println("After 'test0_0_2' y=" + y); - y = tsr.test0_0_3(0); - System.out.println("After 'test0_0_3' y=" + y); - y = tsr.test0_0_4(0); - System.out.println("After 'test0_0_4' y=" + y); - y = tsr.test0_0_5(0); - System.out.println("After 'test0_0_5' y=" + y); - y = tsr.test0_0_6(0); - System.out.println("After 'test0_0_6' y=" + y); - y = tsr.test0_1_3(0); - System.out.println("After 'test0_1_3' y=" + y); - y = tsr.test0_1_4(0); - System.out.println("After 'test0_1_4' y=" + y); - y = tsr.test0_1_5(0); - System.out.println("After 'test0_1_5' y=" + y); - y = tsr.test0_1_6(0); - System.out.println("After 'test0_1_6' y=" + y); - - y = tsr.test1_0_0(0); - System.out.println("After 'test1_0_0' y=" + y); - y = tsr.test1_0_1(0); - System.out.println("After 'test1_0_1' y=" + y); - y = tsr.test1_0_2(0); - System.out.println("After 'test1_0_2' y=" + y); - y = tsr.test1_0_3(0); - System.out.println("After 'test1_0_3' y=" + y); - y = tsr.test1_0_4(0); - System.out.println("After 'test1_0_4' y=" + y); - y = tsr.test1_0_5(0); - System.out.println("After 'test1_0_5' y=" + y); - y = tsr.test1_0_6(0); - System.out.println("After 'test1_0_6' y=" + y); - - y = tsr.test1_1_0(0); - System.out.println("After 'test1_1_0' y=" + y); - y = tsr.test1_1_1(0); - System.out.println("After 'test1_1_1' y=" + y); - y = tsr.test1_1_2(0); - System.out.println("After 'test1_1_2' y=" + y); - y = tsr.test1_1_3(0); - System.out.println("After 'test1_1_3' y=" + y); - y = tsr.test1_1_4(0); - System.out.println("After 'test1_1_4' y=" + y); - y = tsr.test1_1_5(0); - System.out.println("After 'test1_1_5' y=" + y); - y = tsr.test1_1_6(0); - System.out.println("After 'test1_1_6' y=" + y); - - y = tsr.test1_2_0(0); - System.out.println("After 'test1_2_0' y=" + y); - y = tsr.test1_2_1(0); - System.out.println("After 'test1_2_1' y=" + y); - y = tsr.test1_2_2(0); - System.out.println("After 'test1_2_2' y=" + y); - y = tsr.test1_2_3(0); - System.out.println("After 'test1_2_3' y=" + y); - y = tsr.test1_2_4(0); - System.out.println("After 'test1_2_4' y=" + y); - y = tsr.test1_2_5(0); - System.out.println("After 'test1_2_5' y=" + y); - y = tsr.test1_2_6(0); - System.out.println("After 'test1_2_6' y=" + y); - - y = tsr.test2_0_0(0); - System.out.println("After 'test2_0_0' y=" + y); - y = tsr.test2_0_1(0); - System.out.println("After 'test2_0_1' y=" + y); - y = tsr.test2_0_2(0); - System.out.println("After 'test2_0_2' y=" + y); - y = tsr.test2_0_3(0); - System.out.println("After 'test2_0_3' y=" + y); - y = tsr.test2_0_4(0); - System.out.println("After 'test2_0_4' y=" + y); - y = tsr.test2_0_5(0); - System.out.println("After 'test2_0_5' y=" + y); - y = tsr.test2_0_6(0); - System.out.println("After 'test2_0_6' y=" + y); - - y = tsr.test2_1_0(0); - System.out.println("After 'test2_1_0' y=" + y); - y = tsr.test2_1_1(0); - System.out.println("After 'test2_1_1' y=" + y); - y = tsr.test2_1_2(0); - System.out.println("After 'test2_1_2' y=" + y); - y = tsr.test2_1_3(0); - System.out.println("After 'test2_1_3' y=" + y); - y = tsr.test2_1_4(0); - System.out.println("After 'test2_1_4' y=" + y); - y = tsr.test2_1_5(0); - System.out.println("After 'test2_1_5' y=" + y); - y = tsr.test2_1_6(0); - System.out.println("After 'test2_1_6' y=" + y); - - y = tsr.test2_2_0(0); - System.out.println("After 'test2_2_0' y=" + y); - y = tsr.test2_2_1(0); - System.out.println("After 'test2_2_1' y=" + y); - y = tsr.test2_2_2(0); - System.out.println("After 'test2_2_2' y=" + y); - y = tsr.test2_2_3(0); - System.out.println("After 'test2_2_3' y=" + y); - y = tsr.test2_2_4(0); - System.out.println("After 'test2_2_4' y=" + y); - y = tsr.test2_2_5(0); - System.out.println("After 'test2_2_5' y=" + y); - y = tsr.test2_2_6(0); - System.out.println("After 'test2_2_6' y=" + y); - - } -} diff --git a/hotspot/test/compiler/escapeAnalysis/Test6689060.java b/hotspot/test/compiler/escapeAnalysis/Test6689060.java new file mode 100644 index 00000000000..98d48470e74 --- /dev/null +++ b/hotspot/test/compiler/escapeAnalysis/Test6689060.java @@ -0,0 +1,579 @@ +/* + * Copyright (c) 2008, 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 6689060 + * @summary Escape Analysis does not work with Compressed Oops + * + * @run main/othervm -Xbatch -XX:+AggressiveOpts + * -XX:CompileCommand=exclude,compiler.escapeAnalysis.Test6689060::dummy + * compiler.escapeAnalysis.Test6689060 + */ + +package compiler.escapeAnalysis; + +import java.lang.reflect.Array; + +public class Test6689060 { + static class Point { + int x; + int y; + Point next; + int ax[]; + int ay[]; + Point pax[]; + Point pay[]; + + public Point getNext() { + return next; + } + } + + void dummy() { + // Empty method to verify correctness of DebugInfo. + // Use -XX:CompileCommand=exclude,Test.dummy + } + + int ival(int i) { + return i * 2; + } + + int test80(int y, int l, int i) { + Point p = new Point(); + p.ax = new int[2]; + p.ay = new int[2]; + int x = 3; + p.ax[0] = x; + p.ay[1] = 3 * x + y; + dummy(); + return p.ax[0] * p.ay[1]; + } + + int test81(int y, int l, int i) { + Point p = new Point(); + p.ax = new int[2]; + p.ay = new int[2]; + int x = 3; + p.ax[0] = x; + p.ay[1] = 3 * x + y; + dummy(); + return p.ax[0] * p.ay[1]; + } + + + int test44(int y) { + Point p1 = new Point(); + p1.x = ival(3); + dummy(); + p1.y = 3 * p1.x + y; + return p1.y; + } + + int test43(int y) { + Point p1 = new Point(); + if ((y & 1) == 1) { + p1.x = ival(3); + } else { + p1.x = ival(5); + } + dummy(); + p1.y = 3 * p1.x + y; + return p1.y; + } + + int test42(int y) { + Point p1 = new Point(); + p1.x = 3; + for (int i = 0; i < y; i++) { + if ((i & 1) == 1) { + p1.x += 4; + } + } + p1.y = 3 * y + p1.x; + return p1.y; + } + + int test40(int y) { + Point p1 = new Point(); + if ((y & 1) == 1) { + p1.x = 3; + } else { + p1.x = 5; + } + p1.y = 3 * p1.x + y; + return p1.y; + } + + int test41(int y) { + Point p1 = new Point(); + if ((y & 1) == 1) { + p1.x += 4; + } else { + p1.x += 5; + } + p1.y = 3 * p1.x + y; + return p1.y; + } + + Point test00(int y) { + int x = 3; + Point p = new Point(); + p.x = x; + p.y = 3 * x + y; + return p; + } + + Point test01(int y) { + int x = 3; + Point p = new Point(); + p.x = x; + p.y = 3 * x + y; + dummy(); + return p; + } + + Point test02(int y) { + int x = 3; + Point p1 = null; + for (int i = 0; i < y; i++) { + Point p2 = new Point(); + p2.x = x; + p2.y = 3 * y + x; + p2.next = p1; + p1 = p2; + } + return p1; + } + + Point test03(int y) { + int x = 3; + Point p1 = null; + for (int i = 0; i < y; i++) { + Point p2 = new Point(); + p2.x = x; + p2.y = 3 * y + x; + p2.next = p1; + p1 = p2; + } + dummy(); + return p1; + } + + Point test04(int y) { + int x = 3; + Point p1 = null; + for (int i = 0; i < y; i++) { + Point p2 = new Point(); + p2.x = x; + p2.y = 3 * y + x; + p2.next = p1; + dummy(); + p1 = p2; + } + return p1; + } + + int test05(int y) { + int x = 3; + Point p1 = new Point(); + for (int i = 0; i < y; i++) { + Point p2 = new Point(); + p2.x = x; + p2.y = 3 * y + x; + p1.next = p2; + p1 = p2; + } + return p1.y; + } + + int test0(int y) { + int x = 3; + Point p = new Point(); + p.x = x; + p.y = 3 * x + y; + dummy(); + return p.x * p.y; + } + + int test1(int y) { + Point p = new Point(); + if ((y & 1) == 1) { + p = new Point(); // Kill previous + } + int x = 3; + p.x = x; + p.y = 3 * x + y; + dummy(); + return p.x * p.y; + } + + int test2(int y) { + Point p1 = new Point(); + Point p2 = new Point(); + p1.x = 3; + p2.x = 4; + p1.y = 3 * p2.x + y; + p2.y = 3 * p1.x + y; + dummy(); + return p1.y * p2.y; + } + + int test3(int y, Point p1) { + Point p2 = new Point(); + p1.x = 3; + p2.x = 4; + p1.y = 3 * p2.x + y; + p2.y = 3 * p1.x + y; + dummy(); + return p1.y * p2.y; + } + + int test4(int y) { + Point p1 = new Point(); + Point p2 = new Point(); + if ((y & 1) == 1) { + p1.x = 3; + p2.x = 4; + } else { + p1.x = 5; + p2.x = 6; + } + p1.y = 3 * p2.x + y; + p2.y = 3 * p1.x + y; + dummy(); + return p1.y * p2.y; + } + + int test5(int y, Point p1) { + Point p2 = new Point(); + if ((y & 1) == 1) { + p1.x = 3; + p2.x = 4; + } else { + p1.x = 5; + p2.x = 6; + } + p1.y = 3 * p2.x + y; + p2.y = 3 * p1.x + y; + dummy(); + return p1.y * p2.y; + } + + int test6(int y) { + Point p1 = new Point(); + Point p2 = new Point(); + p1.next = p2; + if ((y & 1) == 1) { + p1.x = 3; + p1.getNext().x = 4; + } else { + p1.x = 5; + p1.getNext().x = 6; + } + p1.y = 3 * p2.x + y; + p2.y = 3 * p1.x + y; + dummy(); + return p1.y * p2.y; + } + + int test7(int y, Point p1) { + Point p2 = new Point(); + p1.next = p2; + if ((y & 1) == 1) { + p1.x = 3; + p1.getNext().x = 4; + } else { + p1.x = 5; + p1.getNext().x = 6; + } + p1.y = 3 * p2.x + y; + p2.y = 3 * p1.x + y; + dummy(); + return p1.y * p2.y; + } + + int test8(int y, int l, int i) { + Point p = new Point(); + p.ax = new int[l]; + p.ay = new int[l]; + int x = 3; + p.ax[i] = x; + p.ay[i] = 3 * x + y; + dummy(); + return p.ax[i] * p.ay[i]; + } + + int test9(int y, int l, int i) { + Point p = new Point(); + p.pax = new Point[l]; + p.pay = new Point[l]; + p.pax[i] = new Point(); + p.pay[i] = new Point(); + p.pax[i].x = 3; + p.pay[i].x = 4; + p.pax[i].y = 3 * p.pay[i].x + y; + p.pay[i].y = 3 * p.pax[i].x + y; + dummy(); + return p.pax[i].y * p.pay[i].y; + } + + int test10(int y, int l, int i, Class cls) { + Point p = new Point(); + try { + p.pax = (Point[]) Array.newInstance(cls, l); + p.pax[i] = (Point) cls.newInstance(); + } catch (java.lang.InstantiationException ex) { + return 0; + } catch (java.lang.IllegalAccessException ex) { + return 0; + } + p.pax[i].x = 3; + p.pax[i].y = 3 * p.pax[i].x + y; + dummy(); + return p.pax[i].x * p.pax[i].y; + } + + int test11(int y) { + Point p1 = new Point(); + Point p2 = new Point(); + p1.next = p2; + if ((y & 1) == 1) { + p1.x = 3; + p1.next.x = 4; + } else { + p1.x = 5; + p1.next.x = 6; + } + p1.y = 3 * p1.next.x + y; + p1.next.y = 3 * p1.x + y; + dummy(); + return p1.y * p1.next.y; + } + + int test12(int y) { + Point p1 = new Point(); + p1.next = p1; + if ((y & 1) == 1) { + p1.x = 3; + p1.next.x = 4; + } else { + p1.x = 5; + p1.next.x = 6; + } + p1.y = 3 * p1.next.x + y; + p1.next.y = 3 * p1.x + y; + dummy(); + return p1.y * p1.next.y; + } + + + public static void main(String args[]) { + Test6689060 tsr = new Test6689060(); + Point p = new Point(); + Point ptmp = p; + Class cls = Point.class; + int y = 0; + for (int i = 0; i < 10000; i++) { + ptmp.next = tsr.test00(1); + ptmp.next = tsr.test01(1); + ptmp.next = tsr.test02(1); + ptmp.next = tsr.test03(1); + ptmp.next = tsr.test04(1); + + y = tsr.test05(1); + + y = tsr.test80(y, 1, 0); + y = tsr.test81(y, 1, 0); + + y = tsr.test44(y); + y = tsr.test43(y); + y = tsr.test42(y); + y = tsr.test40(y); + y = tsr.test41(y); + + y = tsr.test0(y); + y = tsr.test1(y); + y = tsr.test2(y); + y = tsr.test3(y, p); + y = tsr.test4(y); + y = tsr.test5(y, p); + y = tsr.test6(y); + y = tsr.test7(y, p); + y = tsr.test8(y, 1, 0); + y = tsr.test9(y, 1, 0); + y = tsr.test10(y, 1, 0, cls); + y = tsr.test11(y); + y = tsr.test12(y); + } + for (int i = 0; i < 10000; i++) { + ptmp.next = tsr.test00(1); + ptmp.next = tsr.test01(1); + ptmp.next = tsr.test02(1); + ptmp.next = tsr.test03(1); + ptmp.next = tsr.test04(1); + + y = tsr.test05(1); + + y = tsr.test80(y, 1, 0); + y = tsr.test81(y, 1, 0); + + y = tsr.test44(y); + y = tsr.test43(y); + y = tsr.test42(y); + y = tsr.test40(y); + y = tsr.test41(y); + + y = tsr.test0(y); + y = tsr.test1(y); + y = tsr.test2(y); + y = tsr.test3(y, p); + y = tsr.test4(y); + y = tsr.test5(y, p); + y = tsr.test6(y); + y = tsr.test7(y, p); + y = tsr.test8(y, 1, 0); + y = tsr.test9(y, 1, 0); + y = tsr.test10(y, 1, 0, cls); + y = tsr.test11(y); + y = tsr.test12(y); + } + for (int i = 0; i < 10000; i++) { + ptmp.next = tsr.test00(1); + ptmp.next = tsr.test01(1); + ptmp.next = tsr.test02(1); + ptmp.next = tsr.test03(1); + ptmp.next = tsr.test04(1); + + y = tsr.test05(1); + + y = tsr.test80(y, 1, 0); + y = tsr.test81(y, 1, 0); + + y = tsr.test44(y); + y = tsr.test43(y); + y = tsr.test42(y); + y = tsr.test40(y); + y = tsr.test41(y); + + y = tsr.test0(y); + y = tsr.test1(y); + y = tsr.test2(y); + y = tsr.test3(y, p); + y = tsr.test4(y); + y = tsr.test5(y, p); + y = tsr.test6(y); + y = tsr.test7(y, p); + y = tsr.test8(y, 1, 0); + y = tsr.test9(y, 1, 0); + y = tsr.test10(y, 1, 0, cls); + y = tsr.test11(y); + y = tsr.test12(y); + } + + int z = 0; + y = tsr.test80(0, 1, 0); + z += y; + System.out.println("After 'test80' y=" + y); + y = tsr.test81(0, 1, 0); + z += y; + System.out.println("After 'test81' y=" + y); + + y = tsr.test44(0); + z += y; + System.out.println("After 'test44' y=" + y); + y = tsr.test43(0); + z += y; + System.out.println("After 'test43' y=" + y); + y = tsr.test42(0); + z += y; + System.out.println("After 'test42' y=" + y); + y = tsr.test40(0); + z += y; + System.out.println("After 'test40' y=" + y); + y = tsr.test41(0); + z += y; + System.out.println("After 'test41' y=" + y); + + ptmp.next = tsr.test00(1); + z += y; + System.out.println("After 'test00' p.y=" + ptmp.next.y); + ptmp.next = tsr.test01(1); + z += y; + System.out.println("After 'test01' p.y=" + ptmp.next.y); + ptmp.next = tsr.test02(1); + z += y; + System.out.println("After 'test02' p.y=" + ptmp.next.y); + ptmp.next = tsr.test03(1); + z += y; + System.out.println("After 'test03' p.y=" + ptmp.next.y); + ptmp.next = tsr.test04(1); + z += y; + System.out.println("After 'test04' p.y=" + ptmp.next.y); + + y = tsr.test05(1); + z += y; + System.out.println("After 'test05' y=" + y); + + y = tsr.test0(0); + z += y; + System.out.println("After 'test0' y=" + y); + y = tsr.test1(0); + z += y; + System.out.println("After 'test1' y=" + y); + y = tsr.test2(0); + z += y; + System.out.println("After 'test2' y=" + y); + y = tsr.test3(0, new Point()); + z += y; + System.out.println("After 'test3' y=" + y); + y = tsr.test4(0); + z += y; + System.out.println("After 'test4' y=" + y); + y = tsr.test5(0, new Point()); + z += y; + System.out.println("After 'test5' y=" + y); + y = tsr.test6(0); + z += y; + System.out.println("After 'test6' y=" + y); + y = tsr.test7(0, new Point()); + z += y; + System.out.println("After 'test7' y=" + y); + y = tsr.test8(0, 1, 0); + z += y; + System.out.println("After 'test8' y=" + y); + y = tsr.test9(0, 1, 0); + z += y; + System.out.println("After 'test9' y=" + y); + y = tsr.test10(0, 1, 0, cls); + z += y; + System.out.println("After 'test10' y=" + y); + y = tsr.test11(0); + z += y; + System.out.println("After 'test11' y=" + y); + y = tsr.test12(0); + z += y; + System.out.println("After 'test12' y=" + y); + System.out.println("Sum of y =" + z); + } +} diff --git a/hotspot/test/compiler/escapeAnalysis/Test6726999.java b/hotspot/test/compiler/escapeAnalysis/Test6726999.java new file mode 100644 index 00000000000..becc1d87d64 --- /dev/null +++ b/hotspot/test/compiler/escapeAnalysis/Test6726999.java @@ -0,0 +1,1421 @@ +/* + * Copyright (c) 2008, 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 6726999 + * @summary nsk/stress/jck12a/jck12a010 assert(n != NULL,"Bad immediate dominator info."); + * + * @run main/othervm -Xbatch -XX:+AggressiveOpts + * -XX:CompileCommand=exclude,compiler.escapeAnalysis.Test6726999::dummy + * compiler.escapeAnalysis.Test6726999 + */ + +package compiler.escapeAnalysis; + +public class Test6726999 { + static class Point { + int x; + int y; + } + + void dummy() { + // Empty method to verify correctness of DebugInfo. + // Use -XX:CompileCommand=exclude,Test.dummy + } + + int test0_0_0(int y) { + int x = 3; + Point p = new Point(); + dummy(); + p.x = x; + p.y = 3 * x + y; + return p.x * p.y; + } + + int test0_0_1(int y) { + int x = 3; + Point p = null; + dummy(); + p = new Point(); + dummy(); + p.x = x; + p.y = 3 * x + y; + return p.x * p.y; + } + + int test0_0_2(int y) { + int x = 3; + Point p = new Point(); + dummy(); + p = new Point(); + dummy(); + p.x = x; + p.y = 3 * x + y; + return p.x * p.y; + } + + int test0_0_3(int y) { + int x = 3; + Point p[] = new Point[1]; + p[0] = new Point(); + dummy(); + p[0].x = x; + p[0].y = 3 * x + y; + return p[0].x * p[0].y; + } + + int test0_0_4(int y) { + int x = 3; + Point p[] = new Point[1]; + dummy(); + p[0] = new Point(); + dummy(); + p[0].x = x; + p[0].y = 3 * x + y; + return p[0].x * p[0].y; + } + + int test0_0_5(int y) { + int x = 3; + Point p[] = new Point[1]; + dummy(); + p[0] = null; + dummy(); + p[0] = new Point(); + dummy(); + p[0].x = x; + p[0].y = 3 * x + y; + return p[0].x * p[0].y; + } + + int test0_0_6(int y) { + int x = 3; + Point p[] = new Point[1]; + p[0] = new Point(); + dummy(); + p[0] = new Point(); + dummy(); + p[0].x = x; + p[0].y = 3 * x + y; + return p[0].x * p[0].y; + } + + int test0_1_3(int y) { + int x = 3; + Point p1 = new Point(); + dummy(); + Point p[] = new Point[1]; + p[0] = p1; + dummy(); + p[0].x = x; + p[0].y = 3 * x + y; + return p[0].x * p[0].y; + } + + int test0_1_4(int y) { + int x = 3; + Point p1 = new Point(); + dummy(); + Point p[] = new Point[1]; + dummy(); + p[0] = p1; + dummy(); + p[0].x = x; + p[0].y = 3 * x + y; + return p[0].x * p[0].y; + } + + int test0_1_5(int y) { + int x = 3; + Point p1 = new Point(); + dummy(); + Point p[] = new Point[1]; + dummy(); + p[0] = null; + dummy(); + p[0] = p1; + dummy(); + p[0].x = x; + p[0].y = 3 * x + y; + return p[0].x * p[0].y; + } + + int test0_1_6(int y) { + int x = 3; + Point p1 = new Point(); + dummy(); + Point p2 = new Point(); + dummy(); + Point p[] = new Point[1]; + p[0] = p1; + dummy(); + p[0] = p2; + dummy(); + p[0].x = x; + p[0].y = 3 * x + y; + return p[0].x * p[0].y; + } + + int test1_0_0(int y) { + Point p = new Point(); + if ((y & 1) == 1) { + p = new Point(); + } + int x = 3; + p.x = x; + p.y = 3 * x + y; + dummy(); + return p.x * p.y; + } + + int test1_0_1(int y) { + Point p = null; + if ((y & 1) == 1) { + p = new Point(); + } + int x = 3; + if (p == null) + return (3 * x + y) * x; + p.x = x; + p.y = 3 * x + y; + dummy(); + return p.x * p.y; + } + + int test1_0_2(int y) { + Point p[] = new Point[1]; + if ((y & 1) == 1) { + p[0] = new Point(); + } + int x = 3; + if (p[0] == null) + return (3 * x + y) * x; + p[0].x = x; + p[0].y = 3 * x + y; + dummy(); + return p[0].x * p[0].y; + } + + int test1_0_3(int y) { + Point p[] = new Point[1]; + p[0] = null; + if ((y & 1) == 1) { + p[0] = new Point(); + } + int x = 3; + if (p[0] == null) + return (3 * x + y) * x; + p[0].x = x; + p[0].y = 3 * x + y; + dummy(); + return p[0].x * p[0].y; + } + + int test1_0_4(int y) { + Point p[] = new Point[1]; + p[0] = new Point(); + if ((y & 1) == 1) { + p[0] = new Point(); + } + int x = 3; + if (p[0] == null) + return (3 * x + y) * x; + p[0].x = x; + p[0].y = 3 * x + y; + dummy(); + return p[0].x * p[0].y; + } + + int test1_0_5(int y) { + Point p[] = new Point[1]; + if ((y & 1) == 1) { + p[0] = new Point(); + } else { + p[0] = null; + } + int x = 3; + if (p[0] == null) + return (3 * x + y) * x; + p[0].x = x; + p[0].y = 3 * x + y; + dummy(); + return p[0].x * p[0].y; + } + + int test1_0_6(int y) { + Point p[] = new Point[1]; + if ((y & 1) == 1) { + p[0] = new Point(); + } else { + p[0] = new Point(); + } + int x = 3; + if (p[0] == null) + return (3 * x + y) * x; + p[0].x = x; + p[0].y = 3 * x + y; + dummy(); + return p[0].x * p[0].y; + } + + int test1_1_0(int y) { + Point p = new Point(); + if ((y & 1) == 1) { + dummy(); + p = new Point(); + dummy(); + } + int x = 3; + p.x = x; + p.y = 3 * x + y; + dummy(); + return p.x * p.y; + } + + int test1_1_1(int y) { + Point p = null; + if ((y & 1) == 1) { + dummy(); + p = new Point(); + dummy(); + } + int x = 3; + if (p == null) + return (3 * x + y) * x; + p.x = x; + p.y = 3 * x + y; + dummy(); + return p.x * p.y; + } + + int test1_1_2(int y) { + Point p[] = new Point[1]; + if ((y & 1) == 1) { + dummy(); + p[0] = new Point(); + dummy(); + } + int x = 3; + if (p[0] == null) + return (3 * x + y) * x; + p[0].x = x; + p[0].y = 3 * x + y; + dummy(); + return p[0].x * p[0].y; + } + + int test1_1_3(int y) { + Point p[] = new Point[1]; + dummy(); + p[0] = null; + if ((y & 1) == 1) { + dummy(); + p[0] = new Point(); + dummy(); + } + int x = 3; + if (p[0] == null) + return (3 * x + y) * x; + p[0].x = x; + p[0].y = 3 * x + y; + dummy(); + return p[0].x * p[0].y; + } + + int test1_1_4(int y) { + Point p[] = new Point[1]; + dummy(); + p[0] = new Point(); + if ((y & 1) == 1) { + dummy(); + p[0] = new Point(); + dummy(); + } + int x = 3; + if (p[0] == null) + return (3 * x + y) * x; + p[0].x = x; + p[0].y = 3 * x + y; + dummy(); + return p[0].x * p[0].y; + } + + int test1_1_5(int y) { + Point p[] = new Point[1]; + if ((y & 1) == 1) { + dummy(); + p[0] = new Point(); + dummy(); + } else { + dummy(); + p[0] = null; + dummy(); + } + int x = 3; + if (p[0] == null) + return (3 * x + y) * x; + p[0].x = x; + p[0].y = 3 * x + y; + dummy(); + return p[0].x * p[0].y; + } + + int test1_1_6(int y) { + Point p[] = new Point[1]; + if ((y & 1) == 1) { + dummy(); + p[0] = new Point(); + dummy(); + } else { + dummy(); + p[0] = new Point(); + dummy(); + } + int x = 3; + if (p[0] == null) + return (3 * x + y) * x; + p[0].x = x; + p[0].y = 3 * x + y; + dummy(); + return p[0].x * p[0].y; + } + + int test1_2_0(int y) { + Point p1 = new Point(); + dummy(); + Point p = new Point(); + if ((y & 1) == 1) { + dummy(); + p = p1; + dummy(); + } + int x = 3; + p.x = x; + p.y = 3 * x + y; + dummy(); + return p.x * p.y; + } + + int test1_2_1(int y) { + Point p1 = new Point(); + dummy(); + Point p = null; + if ((y & 1) == 1) { + dummy(); + p = p1; + dummy(); + } + int x = 3; + if (p == null) + return (3 * x + y) * x; + p.x = x; + p.y = 3 * x + y; + dummy(); + return p.x * p.y; + } + + int test1_2_2(int y) { + Point p1 = new Point(); + dummy(); + Point p[] = new Point[1]; + if ((y & 1) == 1) { + dummy(); + p[0] = p1; + dummy(); + } + int x = 3; + if (p[0] == null) + return (3 * x + y) * x; + p[0].x = x; + p[0].y = 3 * x + y; + dummy(); + return p[0].x * p[0].y; + } + + int test1_2_3(int y) { + Point p1 = new Point(); + dummy(); + Point p[] = new Point[1]; + dummy(); + p[0] = null; + if ((y & 1) == 1) { + dummy(); + p[0] = p1; + dummy(); + } + int x = 3; + if (p[0] == null) + return (3 * x + y) * x; + p[0].x = x; + p[0].y = 3 * x + y; + dummy(); + return p[0].x * p[0].y; + } + + int test1_2_4(int y) { + Point p1 = new Point(); + dummy(); + Point p2 = new Point(); + dummy(); + Point p[] = new Point[1]; + dummy(); + p[0] = p1; + if ((y & 1) == 1) { + dummy(); + p[0] = p2; + dummy(); + } + int x = 3; + if (p[0] == null) + return (3 * x + y) * x; + p[0].x = x; + p[0].y = 3 * x + y; + dummy(); + return p[0].x * p[0].y; + } + + int test1_2_5(int y) { + Point p1 = new Point(); + dummy(); + Point p[] = new Point[1]; + if ((y & 1) == 1) { + dummy(); + p[0] = p1; + dummy(); + } else { + dummy(); + p[0] = null; + dummy(); + } + int x = 3; + if (p[0] == null) + return (3 * x + y) * x; + p[0].x = x; + p[0].y = 3 * x + y; + dummy(); + return p[0].x * p[0].y; + } + + int test1_2_6(int y) { + Point p1 = new Point(); + dummy(); + Point p2 = new Point(); + dummy(); + Point p[] = new Point[1]; + if ((y & 1) == 1) { + dummy(); + p[0] = p1; + dummy(); + } else { + dummy(); + p[0] = p2; + dummy(); + } + int x = 3; + if (p[0] == null) + return (3 * x + y) * x; + p[0].x = x; + p[0].y = 3 * x + y; + dummy(); + return p[0].x * p[0].y; + } + + int test2_0_0(int y) { + Point p = new Point(); + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + p = new Point(); + } + int x = 3; + p.x = x; + p.y = 3 * x + y; + dummy(); + return p.x * p.y; + } + + int test2_0_1(int y) { + Point p = null; + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + p = new Point(); + } + int x = 3; + if (p == null) + return (3 * x + y) * x; + p.x = x; + p.y = 3 * x + y; + dummy(); + return p.x * p.y; + } + + int test2_0_2(int y) { + Point p[] = new Point[3]; + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + p[i] = new Point(); + } + int x = 3; + int j = (y & 1); + if (p[j] == null) + return (3 * x + y) * x; + p[j].x = x; + p[j].y = 3 * x + y; + dummy(); + return p[j].x * p[0].y; + } + + int test2_0_3(int y) { + Point p[] = new Point[3]; + int j = (y & 1); + p[j] = null; + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + p[i] = new Point(); + } + int x = 3; + if (p[j] == null) + return (3 * x + y) * x; + p[j].x = x; + p[j].y = 3 * x + y; + dummy(); + return p[j].x * p[0].y; + } + + int test2_0_4(int y) { + Point p[] = new Point[3]; + int j = (y & 1); + p[j] = new Point(); + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + p[i] = new Point(); + } + int x = 3; + if (p[j] == null) + return (3 * x + y) * x; + p[j].x = x; + p[j].y = 3 * x + y; + dummy(); + return p[j].x * p[0].y; + } + + int test2_0_5(int y) { + Point p[] = new Point[3]; + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + p[i] = new Point(); + } + for (int i = 0; i < lim; i++) { + p[i] = null; + } + int x = 3; + int j = (y & 1); + if (p[j] == null) + return (3 * x + y) * x; + p[j].x = x; + p[j].y = 3 * x + y; + dummy(); + return p[j].x * p[0].y; + } + + int test2_0_6(int y) { + Point p[] = new Point[3]; + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + p[i] = new Point(); + } + for (int i = 0; i < lim; i++) { + p[i] = new Point(); + } + int x = 3; + int j = (y & 1); + if (p[j] == null) + return (3 * x + y) * x; + p[j].x = x; + p[j].y = 3 * x + y; + dummy(); + return p[j].x * p[0].y; + } + + int test2_1_0(int y) { + Point p = new Point(); + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + dummy(); + p = new Point(); + dummy(); + } + int x = 3; + p.x = x; + p.y = 3 * x + y; + dummy(); + return p.x * p.y; + } + + int test2_1_1(int y) { + Point p = null; + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + dummy(); + p = new Point(); + dummy(); + } + int x = 3; + if (p == null) + return (3 * x + y) * x; + p.x = x; + p.y = 3 * x + y; + dummy(); + return p.x * p.y; + } + + int test2_1_2(int y) { + Point p[] = new Point[3]; + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + dummy(); + p[i] = new Point(); + dummy(); + } + int x = 3; + int j = (y & 1); + if (p[j] == null) + return (3 * x + y) * x; + p[j].x = x; + p[j].y = 3 * x + y; + dummy(); + return p[j].x * p[0].y; + } + + int test2_1_3(int y) { + Point p[] = new Point[3]; + dummy(); + int j = (y & 1); + p[j] = null; + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + dummy(); + p[i] = new Point(); + dummy(); + } + int x = 3; + if (p[j] == null) + return (3 * x + y) * x; + p[j].x = x; + p[j].y = 3 * x + y; + dummy(); + return p[j].x * p[0].y; + } + + int test2_1_4(int y) { + Point p[] = new Point[3]; + dummy(); + int j = (y & 1); + p[j] = new Point(); + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + dummy(); + p[i] = new Point(); + dummy(); + } + int x = 3; + if (p[j] == null) + return (3 * x + y) * x; + p[j].x = x; + p[j].y = 3 * x + y; + dummy(); + return p[j].x * p[0].y; + } + + int test2_1_5(int y) { + Point p[] = new Point[3]; + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + dummy(); + p[i] = new Point(); + dummy(); + } + for (int i = 0; i < lim; i++) { + dummy(); + p[i] = null; + dummy(); + } + int x = 3; + int j = (y & 1); + if (p[j] == null) + return (3 * x + y) * x; + p[j].x = x; + p[j].y = 3 * x + y; + dummy(); + return p[j].x * p[0].y; + } + + int test2_1_6(int y) { + Point p[] = new Point[3]; + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + dummy(); + p[i] = new Point(); + dummy(); + } + for (int i = 0; i < lim; i++) { + dummy(); + p[i] = new Point(); + dummy(); + } + int x = 3; + int j = (y & 1); + if (p[j] == null) + return (3 * x + y) * x; + p[j].x = x; + p[j].y = 3 * x + y; + dummy(); + return p[j].x * p[0].y; + } + + int test2_2_0(int y) { + Point p1 = new Point(); + dummy(); + Point p = new Point(); + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + dummy(); + p = p1; + dummy(); + } + int x = 3; + p.x = x; + p.y = 3 * x + y; + dummy(); + return p.x * p.y; + } + + int test2_2_1(int y) { + Point p1 = new Point(); + dummy(); + Point p = null; + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + dummy(); + p = p1; + dummy(); + } + int x = 3; + if (p == null) + return (3 * x + y) * x; + p.x = x; + p.y = 3 * x + y; + dummy(); + return p.x * p.y; + } + + int test2_2_2(int y) { + Point p1 = new Point(); + dummy(); + Point p[] = new Point[3]; + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + dummy(); + p[i] = p1; + dummy(); + } + int x = 3; + int j = (y & 1); + if (p[j] == null) + return (3 * x + y) * x; + p[j].x = x; + p[j].y = 3 * x + y; + dummy(); + return p[j].x * p[0].y; + } + + int test2_2_3(int y) { + Point p1 = new Point(); + dummy(); + Point p[] = new Point[3]; + dummy(); + int j = (y & 1); + p[j] = null; + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + dummy(); + p[i] = p1; + dummy(); + } + int x = 3; + if (p[j] == null) + return (3 * x + y) * x; + p[j].x = x; + p[j].y = 3 * x + y; + dummy(); + return p[j].x * p[0].y; + } + + int test2_2_4(int y) { + Point p1 = new Point(); + dummy(); + Point p2 = new Point(); + dummy(); + Point p[] = new Point[3]; + dummy(); + int j = (y & 1); + p[j] = p1; + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + dummy(); + p[i] = p2; + dummy(); + } + int x = 3; + if (p[j] == null) + return (3 * x + y) * x; + p[j].x = x; + p[j].y = 3 * x + y; + dummy(); + return p[j].x * p[0].y; + } + + int test2_2_5(int y) { + Point p1 = new Point(); + dummy(); + Point p[] = new Point[3]; + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + dummy(); + p[i] = p1; + dummy(); + } + for (int i = 0; i < lim; i++) { + dummy(); + p[i] = null; + dummy(); + } + int x = 3; + int j = (y & 1); + if (p[j] == null) + return (3 * x + y) * x; + p[j].x = x; + p[j].y = 3 * x + y; + dummy(); + return p[j].x * p[0].y; + } + + int test2_2_6(int y) { + Point p1 = new Point(); + dummy(); + Point p2 = new Point(); + dummy(); + Point p[] = new Point[3]; + int lim = (y & 3); + for (int i = 0; i < lim; i++) { + dummy(); + p[i] = p1; + dummy(); + } + for (int i = 0; i < lim; i++) { + dummy(); + p[i] = p2; + dummy(); + } + int x = 3; + int j = (y & 1); + if (p[j] == null) + return (3 * x + y) * x; + p[j].x = x; + p[j].y = 3 * x + y; + dummy(); + return p[j].x * p[0].y; + } + + public static void main(String args[]) { + Test6726999 tsr = new Test6726999(); + Point p = new Point(); + Point ptmp = p; + Class cls = Point.class; + int y = 0; + for (int i = 0; i < 10000; i++) { + y = tsr.test0_0_0(y); + y = tsr.test0_0_0(y); + y = tsr.test0_0_1(y); + y = tsr.test0_0_1(y); + y = tsr.test0_0_2(y); + y = tsr.test0_0_2(y); + y = tsr.test0_0_3(y); + y = tsr.test0_0_3(y); + y = tsr.test0_0_4(y); + y = tsr.test0_0_4(y); + y = tsr.test0_0_5(y); + y = tsr.test0_0_5(y); + y = tsr.test0_0_6(y); + y = tsr.test0_0_6(y); + + y = tsr.test0_1_3(y); + y = tsr.test0_1_3(y); + y = tsr.test0_1_4(y); + y = tsr.test0_1_4(y); + y = tsr.test0_1_5(y); + y = tsr.test0_1_5(y); + y = tsr.test0_1_6(y); + y = tsr.test0_1_6(y); + + y = tsr.test1_0_0(y & ~1); + y = tsr.test1_0_1(y & ~1); + y = tsr.test1_0_2(y & ~1); + y = tsr.test1_0_3(y & ~1); + y = tsr.test1_0_4(y & ~1); + y = tsr.test1_0_5(y & ~1); + y = tsr.test1_0_6(y & ~1); + y = tsr.test1_0_0((y & ~1) + 1); + y = tsr.test1_0_1((y & ~1) + 1); + y = tsr.test1_0_2((y & ~1) + 1); + y = tsr.test1_0_3((y & ~1) + 1); + y = tsr.test1_0_4((y & ~1) + 1); + y = tsr.test1_0_5((y & ~1) + 1); + y = tsr.test1_0_6((y & ~1) + 1); + + y = tsr.test1_1_0(y & ~1); + y = tsr.test1_1_1(y & ~1); + y = tsr.test1_1_2(y & ~1); + y = tsr.test1_1_3(y & ~1); + y = tsr.test1_1_4(y & ~1); + y = tsr.test1_1_5(y & ~1); + y = tsr.test1_1_6(y & ~1); + y = tsr.test1_1_0((y & ~1) + 1); + y = tsr.test1_1_1((y & ~1) + 1); + y = tsr.test1_1_2((y & ~1) + 1); + y = tsr.test1_1_3((y & ~1) + 1); + y = tsr.test1_1_4((y & ~1) + 1); + y = tsr.test1_1_5((y & ~1) + 1); + y = tsr.test1_1_6((y & ~1) + 1); + + y = tsr.test1_2_0(y & ~1); + y = tsr.test1_2_1(y & ~1); + y = tsr.test1_2_2(y & ~1); + y = tsr.test1_2_3(y & ~1); + y = tsr.test1_2_4(y & ~1); + y = tsr.test1_2_5(y & ~1); + y = tsr.test1_2_6(y & ~1); + y = tsr.test1_2_0((y & ~1) + 1); + y = tsr.test1_2_1((y & ~1) + 1); + y = tsr.test1_2_2((y & ~1) + 1); + y = tsr.test1_2_3((y & ~1) + 1); + y = tsr.test1_2_4((y & ~1) + 1); + y = tsr.test1_2_5((y & ~1) + 1); + y = tsr.test1_2_6((y & ~1) + 1); + + y = tsr.test2_0_0(y & ~3); + y = tsr.test2_0_1(y & ~3); + y = tsr.test2_0_2(y & ~3); + y = tsr.test2_0_3(y & ~3); + y = tsr.test2_0_4(y & ~3); + y = tsr.test2_0_5(y & ~3); + y = tsr.test2_0_6(y & ~3); + y = tsr.test2_0_0((y & ~3) + 3); + y = tsr.test2_0_1((y & ~3) + 3); + y = tsr.test2_0_2((y & ~3) + 3); + y = tsr.test2_0_3((y & ~3) + 3); + y = tsr.test2_0_4((y & ~3) + 3); + y = tsr.test2_0_5((y & ~3) + 3); + y = tsr.test2_0_6((y & ~3) + 3); + + y = tsr.test2_1_0(y & ~3); + y = tsr.test2_1_1(y & ~3); + y = tsr.test2_1_2(y & ~3); + y = tsr.test2_1_3(y & ~3); + y = tsr.test2_1_4(y & ~3); + y = tsr.test2_1_5(y & ~3); + y = tsr.test2_1_6(y & ~3); + y = tsr.test2_1_0((y & ~3) + 3); + y = tsr.test2_1_1((y & ~3) + 3); + y = tsr.test2_1_2((y & ~3) + 3); + y = tsr.test2_1_3((y & ~3) + 3); + y = tsr.test2_1_4((y & ~3) + 3); + y = tsr.test2_1_5((y & ~3) + 3); + y = tsr.test2_1_6((y & ~3) + 3); + + y = tsr.test2_2_0(y & ~3); + y = tsr.test2_2_1(y & ~3); + y = tsr.test2_2_2(y & ~3); + y = tsr.test2_2_3(y & ~3); + y = tsr.test2_2_4(y & ~3); + y = tsr.test2_2_5(y & ~3); + y = tsr.test2_2_6(y & ~3); + y = tsr.test2_2_0((y & ~3) + 3); + y = tsr.test2_2_1((y & ~3) + 3); + y = tsr.test2_2_2((y & ~3) + 3); + y = tsr.test2_2_3((y & ~3) + 3); + y = tsr.test2_2_4((y & ~3) + 3); + y = tsr.test2_2_5((y & ~3) + 3); + y = tsr.test2_2_6((y & ~3) + 3); + + } + for (int i = 0; i < 10000; i++) { + y = tsr.test0_0_0(y); + y = tsr.test0_0_0(y); + y = tsr.test0_0_1(y); + y = tsr.test0_0_1(y); + y = tsr.test0_0_2(y); + y = tsr.test0_0_2(y); + y = tsr.test0_0_3(y); + y = tsr.test0_0_3(y); + y = tsr.test0_0_4(y); + y = tsr.test0_0_4(y); + y = tsr.test0_0_5(y); + y = tsr.test0_0_5(y); + y = tsr.test0_0_6(y); + y = tsr.test0_0_6(y); + + y = tsr.test0_1_3(y); + y = tsr.test0_1_3(y); + y = tsr.test0_1_4(y); + y = tsr.test0_1_4(y); + y = tsr.test0_1_5(y); + y = tsr.test0_1_5(y); + y = tsr.test0_1_6(y); + y = tsr.test0_1_6(y); + + y = tsr.test1_0_0(y & ~1); + y = tsr.test1_0_1(y & ~1); + y = tsr.test1_0_2(y & ~1); + y = tsr.test1_0_3(y & ~1); + y = tsr.test1_0_4(y & ~1); + y = tsr.test1_0_5(y & ~1); + y = tsr.test1_0_6(y & ~1); + y = tsr.test1_0_0((y & ~1) + 1); + y = tsr.test1_0_1((y & ~1) + 1); + y = tsr.test1_0_2((y & ~1) + 1); + y = tsr.test1_0_3((y & ~1) + 1); + y = tsr.test1_0_4((y & ~1) + 1); + y = tsr.test1_0_5((y & ~1) + 1); + y = tsr.test1_0_6((y & ~1) + 1); + + y = tsr.test1_1_0(y & ~1); + y = tsr.test1_1_1(y & ~1); + y = tsr.test1_1_2(y & ~1); + y = tsr.test1_1_3(y & ~1); + y = tsr.test1_1_4(y & ~1); + y = tsr.test1_1_5(y & ~1); + y = tsr.test1_1_6(y & ~1); + y = tsr.test1_1_0((y & ~1) + 1); + y = tsr.test1_1_1((y & ~1) + 1); + y = tsr.test1_1_2((y & ~1) + 1); + y = tsr.test1_1_3((y & ~1) + 1); + y = tsr.test1_1_4((y & ~1) + 1); + y = tsr.test1_1_5((y & ~1) + 1); + y = tsr.test1_1_6((y & ~1) + 1); + + y = tsr.test1_2_0(y & ~1); + y = tsr.test1_2_1(y & ~1); + y = tsr.test1_2_2(y & ~1); + y = tsr.test1_2_3(y & ~1); + y = tsr.test1_2_4(y & ~1); + y = tsr.test1_2_5(y & ~1); + y = tsr.test1_2_6(y & ~1); + y = tsr.test1_2_0((y & ~1) + 1); + y = tsr.test1_2_1((y & ~1) + 1); + y = tsr.test1_2_2((y & ~1) + 1); + y = tsr.test1_2_3((y & ~1) + 1); + y = tsr.test1_2_4((y & ~1) + 1); + y = tsr.test1_2_5((y & ~1) + 1); + y = tsr.test1_2_6((y & ~1) + 1); + + y = tsr.test2_0_0(y & ~3); + y = tsr.test2_0_1(y & ~3); + y = tsr.test2_0_2(y & ~3); + y = tsr.test2_0_3(y & ~3); + y = tsr.test2_0_4(y & ~3); + y = tsr.test2_0_5(y & ~3); + y = tsr.test2_0_6(y & ~3); + y = tsr.test2_0_0((y & ~3) + 3); + y = tsr.test2_0_1((y & ~3) + 3); + y = tsr.test2_0_2((y & ~3) + 3); + y = tsr.test2_0_3((y & ~3) + 3); + y = tsr.test2_0_4((y & ~3) + 3); + y = tsr.test2_0_5((y & ~3) + 3); + y = tsr.test2_0_6((y & ~3) + 3); + + y = tsr.test2_1_0(y & ~3); + y = tsr.test2_1_1(y & ~3); + y = tsr.test2_1_2(y & ~3); + y = tsr.test2_1_3(y & ~3); + y = tsr.test2_1_4(y & ~3); + y = tsr.test2_1_5(y & ~3); + y = tsr.test2_1_6(y & ~3); + y = tsr.test2_1_0((y & ~3) + 3); + y = tsr.test2_1_1((y & ~3) + 3); + y = tsr.test2_1_2((y & ~3) + 3); + y = tsr.test2_1_3((y & ~3) + 3); + y = tsr.test2_1_4((y & ~3) + 3); + y = tsr.test2_1_5((y & ~3) + 3); + y = tsr.test2_1_6((y & ~3) + 3); + + y = tsr.test2_2_0(y & ~3); + y = tsr.test2_2_1(y & ~3); + y = tsr.test2_2_2(y & ~3); + y = tsr.test2_2_3(y & ~3); + y = tsr.test2_2_4(y & ~3); + y = tsr.test2_2_5(y & ~3); + y = tsr.test2_2_6(y & ~3); + y = tsr.test2_2_0((y & ~3) + 3); + y = tsr.test2_2_1((y & ~3) + 3); + y = tsr.test2_2_2((y & ~3) + 3); + y = tsr.test2_2_3((y & ~3) + 3); + y = tsr.test2_2_4((y & ~3) + 3); + y = tsr.test2_2_5((y & ~3) + 3); + y = tsr.test2_2_6((y & ~3) + 3); + + } + for (int i = 0; i < 10000; i++) { + y = tsr.test0_0_0(y); + y = tsr.test0_0_0(y); + y = tsr.test0_0_1(y); + y = tsr.test0_0_1(y); + y = tsr.test0_0_2(y); + y = tsr.test0_0_2(y); + y = tsr.test0_0_3(y); + y = tsr.test0_0_3(y); + y = tsr.test0_0_4(y); + y = tsr.test0_0_4(y); + y = tsr.test0_0_5(y); + y = tsr.test0_0_5(y); + y = tsr.test0_0_6(y); + y = tsr.test0_0_6(y); + + y = tsr.test0_1_3(y); + y = tsr.test0_1_3(y); + y = tsr.test0_1_4(y); + y = tsr.test0_1_4(y); + y = tsr.test0_1_5(y); + y = tsr.test0_1_5(y); + y = tsr.test0_1_6(y); + y = tsr.test0_1_6(y); + + y = tsr.test1_0_0(y & ~1); + y = tsr.test1_0_1(y & ~1); + y = tsr.test1_0_2(y & ~1); + y = tsr.test1_0_3(y & ~1); + y = tsr.test1_0_4(y & ~1); + y = tsr.test1_0_5(y & ~1); + y = tsr.test1_0_6(y & ~1); + y = tsr.test1_0_0((y & ~1) + 1); + y = tsr.test1_0_1((y & ~1) + 1); + y = tsr.test1_0_2((y & ~1) + 1); + y = tsr.test1_0_3((y & ~1) + 1); + y = tsr.test1_0_4((y & ~1) + 1); + y = tsr.test1_0_5((y & ~1) + 1); + y = tsr.test1_0_6((y & ~1) + 1); + + y = tsr.test1_1_0(y & ~1); + y = tsr.test1_1_1(y & ~1); + y = tsr.test1_1_2(y & ~1); + y = tsr.test1_1_3(y & ~1); + y = tsr.test1_1_4(y & ~1); + y = tsr.test1_1_5(y & ~1); + y = tsr.test1_1_6(y & ~1); + y = tsr.test1_1_0((y & ~1) + 1); + y = tsr.test1_1_1((y & ~1) + 1); + y = tsr.test1_1_2((y & ~1) + 1); + y = tsr.test1_1_3((y & ~1) + 1); + y = tsr.test1_1_4((y & ~1) + 1); + y = tsr.test1_1_5((y & ~1) + 1); + y = tsr.test1_1_6((y & ~1) + 1); + + y = tsr.test1_2_0(y & ~1); + y = tsr.test1_2_1(y & ~1); + y = tsr.test1_2_2(y & ~1); + y = tsr.test1_2_3(y & ~1); + y = tsr.test1_2_4(y & ~1); + y = tsr.test1_2_5(y & ~1); + y = tsr.test1_2_6(y & ~1); + y = tsr.test1_2_0((y & ~1) + 1); + y = tsr.test1_2_1((y & ~1) + 1); + y = tsr.test1_2_2((y & ~1) + 1); + y = tsr.test1_2_3((y & ~1) + 1); + y = tsr.test1_2_4((y & ~1) + 1); + y = tsr.test1_2_5((y & ~1) + 1); + y = tsr.test1_2_6((y & ~1) + 1); + + y = tsr.test2_0_0(y & ~3); + y = tsr.test2_0_1(y & ~3); + y = tsr.test2_0_2(y & ~3); + y = tsr.test2_0_3(y & ~3); + y = tsr.test2_0_4(y & ~3); + y = tsr.test2_0_5(y & ~3); + y = tsr.test2_0_6(y & ~3); + y = tsr.test2_0_0((y & ~3) + 3); + y = tsr.test2_0_1((y & ~3) + 3); + y = tsr.test2_0_2((y & ~3) + 3); + y = tsr.test2_0_3((y & ~3) + 3); + y = tsr.test2_0_4((y & ~3) + 3); + y = tsr.test2_0_5((y & ~3) + 3); + y = tsr.test2_0_6((y & ~3) + 3); + + y = tsr.test2_1_0(y & ~3); + y = tsr.test2_1_1(y & ~3); + y = tsr.test2_1_2(y & ~3); + y = tsr.test2_1_3(y & ~3); + y = tsr.test2_1_4(y & ~3); + y = tsr.test2_1_5(y & ~3); + y = tsr.test2_1_6(y & ~3); + y = tsr.test2_1_0((y & ~3) + 3); + y = tsr.test2_1_1((y & ~3) + 3); + y = tsr.test2_1_2((y & ~3) + 3); + y = tsr.test2_1_3((y & ~3) + 3); + y = tsr.test2_1_4((y & ~3) + 3); + y = tsr.test2_1_5((y & ~3) + 3); + y = tsr.test2_1_6((y & ~3) + 3); + + y = tsr.test2_2_0(y & ~3); + y = tsr.test2_2_1(y & ~3); + y = tsr.test2_2_2(y & ~3); + y = tsr.test2_2_3(y & ~3); + y = tsr.test2_2_4(y & ~3); + y = tsr.test2_2_5(y & ~3); + y = tsr.test2_2_6(y & ~3); + y = tsr.test2_2_0((y & ~3) + 3); + y = tsr.test2_2_1((y & ~3) + 3); + y = tsr.test2_2_2((y & ~3) + 3); + y = tsr.test2_2_3((y & ~3) + 3); + y = tsr.test2_2_4((y & ~3) + 3); + y = tsr.test2_2_5((y & ~3) + 3); + y = tsr.test2_2_6((y & ~3) + 3); + + } + + int z = 0; + y = tsr.test0_0_0(0); + System.out.println("After 'test0_0_0' y=" + y); + y = tsr.test0_0_1(0); + System.out.println("After 'test0_0_1' y=" + y); + y = tsr.test0_0_2(0); + System.out.println("After 'test0_0_2' y=" + y); + y = tsr.test0_0_3(0); + System.out.println("After 'test0_0_3' y=" + y); + y = tsr.test0_0_4(0); + System.out.println("After 'test0_0_4' y=" + y); + y = tsr.test0_0_5(0); + System.out.println("After 'test0_0_5' y=" + y); + y = tsr.test0_0_6(0); + System.out.println("After 'test0_0_6' y=" + y); + y = tsr.test0_1_3(0); + System.out.println("After 'test0_1_3' y=" + y); + y = tsr.test0_1_4(0); + System.out.println("After 'test0_1_4' y=" + y); + y = tsr.test0_1_5(0); + System.out.println("After 'test0_1_5' y=" + y); + y = tsr.test0_1_6(0); + System.out.println("After 'test0_1_6' y=" + y); + + y = tsr.test1_0_0(0); + System.out.println("After 'test1_0_0' y=" + y); + y = tsr.test1_0_1(0); + System.out.println("After 'test1_0_1' y=" + y); + y = tsr.test1_0_2(0); + System.out.println("After 'test1_0_2' y=" + y); + y = tsr.test1_0_3(0); + System.out.println("After 'test1_0_3' y=" + y); + y = tsr.test1_0_4(0); + System.out.println("After 'test1_0_4' y=" + y); + y = tsr.test1_0_5(0); + System.out.println("After 'test1_0_5' y=" + y); + y = tsr.test1_0_6(0); + System.out.println("After 'test1_0_6' y=" + y); + + y = tsr.test1_1_0(0); + System.out.println("After 'test1_1_0' y=" + y); + y = tsr.test1_1_1(0); + System.out.println("After 'test1_1_1' y=" + y); + y = tsr.test1_1_2(0); + System.out.println("After 'test1_1_2' y=" + y); + y = tsr.test1_1_3(0); + System.out.println("After 'test1_1_3' y=" + y); + y = tsr.test1_1_4(0); + System.out.println("After 'test1_1_4' y=" + y); + y = tsr.test1_1_5(0); + System.out.println("After 'test1_1_5' y=" + y); + y = tsr.test1_1_6(0); + System.out.println("After 'test1_1_6' y=" + y); + + y = tsr.test1_2_0(0); + System.out.println("After 'test1_2_0' y=" + y); + y = tsr.test1_2_1(0); + System.out.println("After 'test1_2_1' y=" + y); + y = tsr.test1_2_2(0); + System.out.println("After 'test1_2_2' y=" + y); + y = tsr.test1_2_3(0); + System.out.println("After 'test1_2_3' y=" + y); + y = tsr.test1_2_4(0); + System.out.println("After 'test1_2_4' y=" + y); + y = tsr.test1_2_5(0); + System.out.println("After 'test1_2_5' y=" + y); + y = tsr.test1_2_6(0); + System.out.println("After 'test1_2_6' y=" + y); + + y = tsr.test2_0_0(0); + System.out.println("After 'test2_0_0' y=" + y); + y = tsr.test2_0_1(0); + System.out.println("After 'test2_0_1' y=" + y); + y = tsr.test2_0_2(0); + System.out.println("After 'test2_0_2' y=" + y); + y = tsr.test2_0_3(0); + System.out.println("After 'test2_0_3' y=" + y); + y = tsr.test2_0_4(0); + System.out.println("After 'test2_0_4' y=" + y); + y = tsr.test2_0_5(0); + System.out.println("After 'test2_0_5' y=" + y); + y = tsr.test2_0_6(0); + System.out.println("After 'test2_0_6' y=" + y); + + y = tsr.test2_1_0(0); + System.out.println("After 'test2_1_0' y=" + y); + y = tsr.test2_1_1(0); + System.out.println("After 'test2_1_1' y=" + y); + y = tsr.test2_1_2(0); + System.out.println("After 'test2_1_2' y=" + y); + y = tsr.test2_1_3(0); + System.out.println("After 'test2_1_3' y=" + y); + y = tsr.test2_1_4(0); + System.out.println("After 'test2_1_4' y=" + y); + y = tsr.test2_1_5(0); + System.out.println("After 'test2_1_5' y=" + y); + y = tsr.test2_1_6(0); + System.out.println("After 'test2_1_6' y=" + y); + + y = tsr.test2_2_0(0); + System.out.println("After 'test2_2_0' y=" + y); + y = tsr.test2_2_1(0); + System.out.println("After 'test2_2_1' y=" + y); + y = tsr.test2_2_2(0); + System.out.println("After 'test2_2_2' y=" + y); + y = tsr.test2_2_3(0); + System.out.println("After 'test2_2_3' y=" + y); + y = tsr.test2_2_4(0); + System.out.println("After 'test2_2_4' y=" + y); + y = tsr.test2_2_5(0); + System.out.println("After 'test2_2_5' y=" + y); + y = tsr.test2_2_6(0); + System.out.println("After 'test2_2_6' y=" + y); + + } +} diff --git a/hotspot/test/compiler/escapeAnalysis/6775880/Test.java b/hotspot/test/compiler/escapeAnalysis/Test6775880.java similarity index 59% rename from hotspot/test/compiler/escapeAnalysis/6775880/Test.java rename to hotspot/test/compiler/escapeAnalysis/Test6775880.java index f5a51fe4597..31e0afa06a8 100644 --- a/hotspot/test/compiler/escapeAnalysis/6775880/Test.java +++ b/hotspot/test/compiler/escapeAnalysis/Test6775880.java @@ -26,41 +26,46 @@ * @test * @bug 6775880 * @summary EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now") - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:+DoEscapeAnalysis -XX:+DeoptimizeALot -XX:CompileCommand=exclude,java.lang.AbstractStringBuilder::append Test + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:+DoEscapeAnalysis -XX:+DeoptimizeALot + * -XX:CompileCommand=exclude,java.lang.AbstractStringBuilder::append + * compiler.escapeAnalysis.Test6775880 */ -public class Test { +package compiler.escapeAnalysis; - int cnt; - int b[]; - String s; +public class Test6775880 { - String test() { - String res=""; - for (int i=0; i < cnt; i++) { - if (i != 0) { - res = res +"."; - } - res = res + b[i]; + int cnt; + int b[]; + String s; + + String test() { + String res = ""; + for (int i = 0; i < cnt; i++) { + if (i != 0) { + res = res + "."; + } + res = res + b[i]; + } + return res; } - return res; - } - public static void main(String[] args) { - Test t = new Test(); - t.cnt = 3; - t.b = new int[3]; - t.b[0] = 0; - t.b[1] = 1; - t.b[2] = 2; - int j=0; - t.s = ""; - for (int i=0; i<10001; i++) { - t.s = "c"; - t.s = t.test(); + public static void main(String[] args) { + Test6775880 t = new Test6775880(); + t.cnt = 3; + t.b = new int[3]; + t.b[0] = 0; + t.b[1] = 1; + t.b[2] = 2; + int j = 0; + t.s = ""; + for (int i = 0; i < 10001; i++) { + t.s = "c"; + t.s = t.test(); + } + System.out.println("After s=" + t.s); } - System.out.println("After s=" + t.s); - } } diff --git a/hotspot/test/compiler/escapeAnalysis/6895383/Test.java b/hotspot/test/compiler/escapeAnalysis/Test6895383.java similarity index 87% rename from hotspot/test/compiler/escapeAnalysis/6895383/Test.java rename to hotspot/test/compiler/escapeAnalysis/Test6895383.java index a1a20e93250..24462a69883 100644 --- a/hotspot/test/compiler/escapeAnalysis/6895383/Test.java +++ b/hotspot/test/compiler/escapeAnalysis/Test6895383.java @@ -27,15 +27,17 @@ * @bug 6895383 * @summary JCK test throws NPE for method compiled with Escape Analysis * - * @run main/othervm -Xcomp Test + * @run main/othervm -Xcomp compiler.escapeAnalysis.Test6895383 */ -import java.util.*; -import java.util.concurrent.*; +package compiler.escapeAnalysis; -public class Test { +import java.util.LinkedList; +import java.util.concurrent.CopyOnWriteArrayList; + +public class Test6895383 { public static void main(String argv[]) { - Test test = new Test(); + Test6895383 test = new Test6895383(); test.testRemove1_IndexOutOfBounds(); test.testAddAll1_IndexOutOfBoundsException(); } diff --git a/hotspot/test/compiler/escapeAnalysis/6896727/Test.java b/hotspot/test/compiler/escapeAnalysis/Test6896727.java similarity index 93% rename from hotspot/test/compiler/escapeAnalysis/6896727/Test.java rename to hotspot/test/compiler/escapeAnalysis/Test6896727.java index c2eb93b05e2..042ab2abe52 100644 --- a/hotspot/test/compiler/escapeAnalysis/6896727/Test.java +++ b/hotspot/test/compiler/escapeAnalysis/Test6896727.java @@ -26,10 +26,14 @@ * @test * @bug 6896727 * @summary nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys w/o COOPs - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:+DoEscapeAnalysis Test + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:+DoEscapeAnalysis + * compiler.escapeAnalysis.Test6896727 */ -public class Test { +package compiler.escapeAnalysis; + +public class Test6896727 { final static String testString = "abracadabra"; public static void main(String args[]) { diff --git a/hotspot/test/compiler/escapeAnalysis/Test8020215.java b/hotspot/test/compiler/escapeAnalysis/Test8020215.java index 11e97868f94..3c60922bea4 100644 --- a/hotspot/test/compiler/escapeAnalysis/Test8020215.java +++ b/hotspot/test/compiler/escapeAnalysis/Test8020215.java @@ -25,9 +25,12 @@ * @test * @bug 8020215 * @summary Different execution plan when using JIT vs interpreter - * @run main Test8020215 + * + * @run main compiler.escapeAnalysis.Test8020215 */ +package compiler.escapeAnalysis; + import java.util.ArrayList; import java.util.List; diff --git a/hotspot/test/compiler/escapeAnalysis/TestAllocatedEscapesPtrComparison.java b/hotspot/test/compiler/escapeAnalysis/TestAllocatedEscapesPtrComparison.java index 04dea1e3934..0d2fd47ba60 100644 --- a/hotspot/test/compiler/escapeAnalysis/TestAllocatedEscapesPtrComparison.java +++ b/hotspot/test/compiler/escapeAnalysis/TestAllocatedEscapesPtrComparison.java @@ -24,11 +24,16 @@ /* * @test * @bug 8043354 - * @summary bcEscapeAnalyzer allocated_escapes not conservative enough - * @run main/othervm -XX:CompileOnly=.visitAndPop TestAllocatedEscapesPtrComparison + * @summary bcEscapeAnalyzer allocated_escapes not conservative enough + * + * @run main/othervm + * -XX:CompileCommand=compileonly,compiler.escapeAnalysis.TestAllocatedEscapesPtrComparison::visitAndPop + * compiler.escapeAnalysis.TestAllocatedEscapesPtrComparison * @author Chuck Rasbold rasbold@google.com */ +package compiler.escapeAnalysis; + /* * Test always passes with -XX:-OptmimizePtrCompare */ diff --git a/hotspot/test/compiler/escapeAnalysis/TestEABadMergeMem.java b/hotspot/test/compiler/escapeAnalysis/TestEABadMergeMem.java index 236cbe742b8..e578ff947d3 100644 --- a/hotspot/test/compiler/escapeAnalysis/TestEABadMergeMem.java +++ b/hotspot/test/compiler/escapeAnalysis/TestEABadMergeMem.java @@ -25,10 +25,14 @@ * @test * @bug 8134031 * @summary Bad rewiring of memory edges when we split unique types during EA - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestEABadMergeMem::m_notinlined TestEABadMergeMem * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * -XX:CompileCommand=dontinline,compiler.escapeAnalysis.TestEABadMergeMem::m_notinlined + * compiler.escapeAnalysis.TestEABadMergeMem */ +package compiler.escapeAnalysis; + public class TestEABadMergeMem { static class Box { diff --git a/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java b/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java index 7eac5e00660..4b465cfb8a4 100644 --- a/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java +++ b/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java @@ -25,8 +25,14 @@ * @test * @bug 8073956 * @summary Tests C2 EA with allocated object escaping through a call. - * @run main/othervm -XX:CompileCommand=dontinline,TestEscapeThroughInvoke::create TestEscapeThroughInvoke + * + * @run main/othervm + * -XX:CompileCommand=dontinline,compiler.escapeAnalysis.TestEscapeThroughInvoke::create + * compiler.escapeAnalysis.TestEscapeThroughInvoke */ + +package compiler.escapeAnalysis; + public class TestEscapeThroughInvoke { private A a; @@ -55,20 +61,21 @@ public class TestEscapeThroughInvoke { result.saveInto(a, dummy); // result escapes into 'a' here return result; } -} -class A { - private A saved; + static class A { + private A saved; - public A(Integer dummy) { } + public A(Integer dummy) { + } - public void saveInto(A other, Integer dummy) { - other.saved = this; - } + public void saveInto(A other, Integer dummy) { + other.saved = this; + } - public void check(A other) { - if (this.saved != other) { - throw new RuntimeException("TEST FAILED: Objects not equal."); + public void check(A other) { + if (this.saved != other) { + throw new RuntimeException("TEST FAILED: Objects not equal."); + } } } -} +} \ No newline at end of file diff --git a/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java b/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java index 73ca08fa6cd..27015125fc5 100644 --- a/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java +++ b/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java @@ -26,13 +26,20 @@ * @bug 8038048 * @summary assert(null_obj->escape_state() == PointsToNode::NoEscape,etc) * @modules java.base/jdk.internal.misc - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+DoEscapeAnalysis -XX:-TieredCompilation -Xbatch TestUnsafePutAddressNullObjMustNotEscape + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+DoEscapeAnalysis + * -XX:-TieredCompilation -Xbatch + * compiler.escapeAnalysis.TestUnsafePutAddressNullObjMustNotEscape + * * @author Richard Reingruber richard DOT reingruber AT sap DOT com */ -import java.lang.reflect.Field; +package compiler.escapeAnalysis; + import jdk.internal.misc.Unsafe; +import java.lang.reflect.Field; + public class TestUnsafePutAddressNullObjMustNotEscape { public static Unsafe usafe; diff --git a/hotspot/test/compiler/escapeAnalysis/6716441/Tester.java b/hotspot/test/compiler/escapeAnalysis/cr6716441/Tester.java similarity index 99% rename from hotspot/test/compiler/escapeAnalysis/6716441/Tester.java rename to hotspot/test/compiler/escapeAnalysis/cr6716441/Tester.java index 9e2660763e0..15f4a06671c 100644 --- a/hotspot/test/compiler/escapeAnalysis/6716441/Tester.java +++ b/hotspot/test/compiler/escapeAnalysis/cr6716441/Tester.java @@ -25,11 +25,15 @@ * @test * @bug 6716441 * @summary error in meet with +DoEscapeAnalysis - * @run main/othervm -Xcomp -XX:+AggressiveOpts Tester + * + * @run main/othervm -Xcomp -XX:+AggressiveOpts + * compiler.escapeAnalysis.cr6716441.Tester */ /* Complexity upper bound: 70070 ops */ +package compiler.escapeAnalysis.cr6716441; + class Tester_Class_0 { Object var_1; diff --git a/hotspot/test/compiler/escapeAnalysis/6795161/Test.java b/hotspot/test/compiler/escapeAnalysis/cr6795161/Test.java similarity index 90% rename from hotspot/test/compiler/escapeAnalysis/6795161/Test.java rename to hotspot/test/compiler/escapeAnalysis/cr6795161/Test.java index 598e54ac294..8c5bbd44828 100644 --- a/hotspot/test/compiler/escapeAnalysis/6795161/Test.java +++ b/hotspot/test/compiler/escapeAnalysis/cr6795161/Test.java @@ -26,9 +26,14 @@ * @test * @bug 6795161 * @summary Escape analysis leads to data corruption - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:CompileOnly=Test -XX:+DoEscapeAnalysis Test + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:+DoEscapeAnalysis + * -XX:CompileCommand=compileonly,compiler.escapeAnalysis.cr6795161.Test::* + * compiler.escapeAnalysis.cr6795161.Test */ +package compiler.escapeAnalysis.cr6795161; + class Test_Class_1 { static String var_1; diff --git a/hotspot/test/compiler/exceptions/CatchInlineExceptions.java b/hotspot/test/compiler/exceptions/CatchInlineExceptions.java index 64e986f55c0..80bad9245a8 100644 --- a/hotspot/test/compiler/exceptions/CatchInlineExceptions.java +++ b/hotspot/test/compiler/exceptions/CatchInlineExceptions.java @@ -25,13 +25,15 @@ * @test * @bug 8059299 * @summary assert(adr_type != NULL) failed: expecting TypeKlassPtr - * @run main/othervm -Xbatch CatchInlineExceptions + * + * @run main/othervm -Xbatch compiler.exceptions.CatchInlineExceptions */ -class Exception1 extends Exception {}; -class Exception2 extends Exception {}; +package compiler.exceptions; public class CatchInlineExceptions { + static class Exception1 extends Exception {}; + static class Exception2 extends Exception {}; private static int counter0; private static int counter1; private static int counter2; diff --git a/hotspot/test/compiler/exceptions/SumTest.java b/hotspot/test/compiler/exceptions/SumTest.java index d4555aa55aa..dce72a8c681 100644 --- a/hotspot/test/compiler/exceptions/SumTest.java +++ b/hotspot/test/compiler/exceptions/SumTest.java @@ -25,9 +25,12 @@ * @test * @bug 8066900 * @summary FP registers are not properly restored by C1 when handling exceptions - * @run main/othervm -Xbatch SumTest * + * @run main/othervm -Xbatch compiler.exceptions.SumTest */ + +package compiler.exceptions; + public class SumTest { private static class Sum { diff --git a/hotspot/test/compiler/exceptions/TestRecursiveReplacedException.java b/hotspot/test/compiler/exceptions/TestRecursiveReplacedException.java index 950ed18c928..84e766a0c49 100644 --- a/hotspot/test/compiler/exceptions/TestRecursiveReplacedException.java +++ b/hotspot/test/compiler/exceptions/TestRecursiveReplacedException.java @@ -25,10 +25,14 @@ * @test * @bug 8054224 * @summary Recursive method compiled by C1 is unable to catch StackOverflowError - * @run main/othervm -Xcomp -XX:CompileOnly=Test.run -XX:+TieredCompilation -XX:TieredStopAtLevel=2 -Xss512K TestRecursiveReplacedException * + * @run main/othervm -Xcomp -XX:+TieredCompilation -XX:TieredStopAtLevel=2 -Xss512K + * -XX:CompileCommand=compileonly,compiler.exceptions.TestRecursiveReplacedException::run + * compiler.exceptions.TestRecursiveReplacedException */ +package compiler.exceptions; + public class TestRecursiveReplacedException { public static void main(String args[]) { diff --git a/hotspot/test/compiler/floatingpoint/ModNaN.java b/hotspot/test/compiler/floatingpoint/ModNaN.java index ed38714cefa..a1bdcdcdd61 100644 --- a/hotspot/test/compiler/floatingpoint/ModNaN.java +++ b/hotspot/test/compiler/floatingpoint/ModNaN.java @@ -24,10 +24,14 @@ /** * @test * @bug 8015396 - * @ignore 8145543 * @summary double a%b returns NaN for some (a,b) (|a| < inf, |b|>0) (on Core i7 980X) - * @run main ModNaN + * + * @ignore 8145543 + * @run main compiler.floatingpoint.ModNaN */ + +package compiler.floatingpoint; + public class ModNaN { /* This bug was seen in the field for a particular version of the VM, * but never reproduced internally, and the reason was never known, diff --git a/hotspot/test/compiler/floatingpoint/NaNTest.java b/hotspot/test/compiler/floatingpoint/NaNTest.java index 04549b432a9..058c4fb62e1 100644 --- a/hotspot/test/compiler/floatingpoint/NaNTest.java +++ b/hotspot/test/compiler/floatingpoint/NaNTest.java @@ -24,8 +24,12 @@ * @test * @bug 8076373 * @summary Verify if signaling NaNs are preserved. - * @run main NaNTest + * + * @run main compiler.floatingpoint.NaNTest */ + +package compiler.floatingpoint; + public class NaNTest { static void testFloat() { int originalValue = 0x7f800001; diff --git a/hotspot/test/compiler/floatingpoint/Test15FloatJNIArgs.java b/hotspot/test/compiler/floatingpoint/Test15FloatJNIArgs.java index 9cb924318f5..7b4b51a4c5e 100644 --- a/hotspot/test/compiler/floatingpoint/Test15FloatJNIArgs.java +++ b/hotspot/test/compiler/floatingpoint/Test15FloatJNIArgs.java @@ -25,11 +25,14 @@ * @bug 8139258 * @summary Regression test for 8139258 which failed to properly pass float args * to a jni function on ppc64le. - * @run main/othervm/native -Xint Test15FloatJNIArgs - * @run main/othervm/native -XX:+TieredCompilation -Xcomp Test15FloatJNIArgs - * @run main/othervm/native -XX:-TieredCompilation -Xcomp Test15FloatJNIArgs + * + * @run main/othervm/native -Xint compiler.floatingpoint.Test15FloatJNIArgs + * @run main/othervm/native -XX:+TieredCompilation -Xcomp compiler.floatingpoint.Test15FloatJNIArgs + * @run main/othervm/native -XX:-TieredCompilation -Xcomp compiler.floatingpoint.Test15FloatJNIArgs */ +package compiler.floatingpoint; + public class Test15FloatJNIArgs { static { try { diff --git a/hotspot/test/compiler/floatingpoint/TestPow2.java b/hotspot/test/compiler/floatingpoint/TestPow2.java index 01b094ef533..28e4f4c34e9 100644 --- a/hotspot/test/compiler/floatingpoint/TestPow2.java +++ b/hotspot/test/compiler/floatingpoint/TestPow2.java @@ -27,18 +27,22 @@ * @summary X^2 special case for C2 yields different result than interpreter * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc - * @modules java.management - * @build TestPow2 + * java.management + * + * @build compiler.floatingpoint.TestPow2 * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestPow2 - * + * -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.floatingpoint.TestPow2 */ -import java.lang.reflect.*; -import sun.hotspot.WhiteBox; +package compiler.floatingpoint; + import compiler.whitebox.CompilerWhiteBoxTest; +import sun.hotspot.WhiteBox; + +import java.lang.reflect.Method; public class TestPow2 { diff --git a/hotspot/test/compiler/floatingpoint/libTest15FloatJNIArgs.c b/hotspot/test/compiler/floatingpoint/libTest15FloatJNIArgs.c index e31627955ca..c18c53c750e 100644 --- a/hotspot/test/compiler/floatingpoint/libTest15FloatJNIArgs.c +++ b/hotspot/test/compiler/floatingpoint/libTest15FloatJNIArgs.c @@ -27,7 +27,7 @@ extern "C" { #endif -JNIEXPORT jfloat JNICALL Java_Test15FloatJNIArgs_add15floats +JNIEXPORT jfloat JNICALL Java_compiler_floatingpoint_Test15FloatJNIArgs_add15floats (JNIEnv *env, jclass cls, jfloat f1, jfloat f2, jfloat f3, jfloat f4, jfloat f5, jfloat f6, jfloat f7, jfloat f8, diff --git a/hotspot/test/compiler/gcbarriers/G1CrashTest.java b/hotspot/test/compiler/gcbarriers/G1CrashTest.java index e8c6f015132..e98e3cfb3b4 100644 --- a/hotspot/test/compiler/gcbarriers/G1CrashTest.java +++ b/hotspot/test/compiler/gcbarriers/G1CrashTest.java @@ -27,11 +27,14 @@ * @bug 8023472 * @summary C2 optimization breaks with G1 * - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -Dcount=100000 G1CrashTest + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -Dcount=100000 compiler.gcbarriers.G1CrashTest * * @author pbiswal@palantir.com */ +package compiler.gcbarriers; + public class G1CrashTest { static Object[] set = new Object[11]; diff --git a/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java b/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java index 2b8d9f63962..483f99d7df5 100644 --- a/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java +++ b/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java @@ -28,9 +28,12 @@ * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /test/lib * @run main/bootclasspath/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -Xmx300m -XX:+UseG1GC PreserveFPRegistersTest + * -XX:+WhiteBoxAPI -Xmx300m -XX:+UseG1GC + * compiler.gcbarriers.PreserveFPRegistersTest */ +package compiler.gcbarriers; + import sun.hotspot.WhiteBox; public class PreserveFPRegistersTest { diff --git a/hotspot/test/compiler/inlining/DefaultAndConcreteMethodsCHA.java b/hotspot/test/compiler/inlining/DefaultAndConcreteMethodsCHA.java index 821ac79067f..ba888abbcc4 100644 --- a/hotspot/test/compiler/inlining/DefaultAndConcreteMethodsCHA.java +++ b/hotspot/test/compiler/inlining/DefaultAndConcreteMethodsCHA.java @@ -26,18 +26,21 @@ * @bug 8031695 * @summary CHA ignores default methods during analysis leading to incorrect code generation * - * @run main/othervm -Xbatch DefaultAndConcreteMethodsCHA + * @run main/othervm -Xbatch compiler.inlining.DefaultAndConcreteMethodsCHA */ -interface I { - default int m() { return 0; } -} -class A implements I {} - -class C extends A { } -class D extends A { public int m() { return 1; } } +package compiler.inlining; public class DefaultAndConcreteMethodsCHA { + interface I { + default int m() { return 0; } + } + + static class A implements I {} + + static class C extends A { } + static class D extends A { public int m() { return 1; } } + public static int test(A obj) { return obj.m(); } diff --git a/hotspot/test/compiler/inlining/DefaultMethodsDependencies.java b/hotspot/test/compiler/inlining/DefaultMethodsDependencies.java index 5bdc60fdabd..0402034c3a4 100644 --- a/hotspot/test/compiler/inlining/DefaultMethodsDependencies.java +++ b/hotspot/test/compiler/inlining/DefaultMethodsDependencies.java @@ -25,10 +25,15 @@ * @test * @bug 8069263 * @summary Deoptimization between array allocation and arraycopy may result in non initialized array - * @run main/othervm -XX:-BackgroundCompilation -XX:CompileOnly=DefaultMethodsDependencies::test -XX:CompileOnly=DefaultMethodsDependencies$I2::m1 DefaultMethodsDependencies * + * @run main/othervm -XX:-BackgroundCompilation + * -XX:CompileCommand=compileonly,compiler.inlining.DefaultMethodsDependencies::test + * -XX:CompileCommand=compileonly,compiler.inlining.DefaultMethodsDependencies$I2::m1 + * compiler.inlining.DefaultMethodsDependencies */ +package compiler.inlining; + public class DefaultMethodsDependencies { interface I1 { diff --git a/hotspot/test/compiler/inlining/InlineAccessors.java b/hotspot/test/compiler/inlining/InlineAccessors.java index 387a513f148..10d9f8eea9e 100644 --- a/hotspot/test/compiler/inlining/InlineAccessors.java +++ b/hotspot/test/compiler/inlining/InlineAccessors.java @@ -27,11 +27,14 @@ * @summary Method::is_accessor should cover getters and setters for all types * @modules java.base/jdk.internal.misc * @library /testlibrary - * @run main/othervm InlineAccessors + * + * @run driver compiler.inlining.InlineAccessors */ -import java.lang.invoke.*; -import jdk.test.lib.*; -import static jdk.test.lib.Asserts.*; + +package compiler.inlining; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; public class InlineAccessors { public static void main(String[] args) throws Exception { @@ -42,7 +45,7 @@ public class InlineAccessors { "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", "-server", "-XX:-TieredCompilation", "-Xbatch", "-Xcomp", "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining", - "InlineAccessors$Launcher"); + Launcher.class.getName()); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); diff --git a/hotspot/test/compiler/inlining/InlineDefaultMethod.java b/hotspot/test/compiler/inlining/InlineDefaultMethod.java index 609eaf217d5..7a6899a1bd9 100644 --- a/hotspot/test/compiler/inlining/InlineDefaultMethod.java +++ b/hotspot/test/compiler/inlining/InlineDefaultMethod.java @@ -25,29 +25,32 @@ * @test * @bug 8026735 * @summary CHA in C1 should make correct decisions about default methods - * @run main/othervm -Xcomp -XX:CompileOnly=InlineDefaultMethod::test -XX:TieredStopAtLevel=1 InlineDefaultMethod + * + * @run main/othervm -Xcomp -XX:TieredStopAtLevel=1 + * -XX:CompileCommand=compileonly,compiler.inlining.InlineDefaultMethod::test + * compiler.inlining.InlineDefaultMethod */ - -interface InterfaceWithDefaultMethod0 { - default public int defaultMethod() { - return 1; - } -} - -interface InterfaceWithDefaultMethod1 extends InterfaceWithDefaultMethod0 { } - -abstract class Subtype implements InterfaceWithDefaultMethod1 { } - -class Decoy extends Subtype { - public int defaultMethod() { - return 2; - } -} - -class Instance extends Subtype { } - +package compiler.inlining; public class InlineDefaultMethod { + interface InterfaceWithDefaultMethod0 { + default public int defaultMethod() { + return 1; + } + } + + interface InterfaceWithDefaultMethod1 extends InterfaceWithDefaultMethod0 { } + + static abstract class Subtype implements InterfaceWithDefaultMethod1 { } + + static class Decoy extends Subtype { + public int defaultMethod() { + return 2; + } + } + + static class Instance extends Subtype { } + public static int test(InterfaceWithDefaultMethod1 x) { return x.defaultMethod(); } diff --git a/hotspot/test/compiler/inlining/InlineDefaultMethod1.java b/hotspot/test/compiler/inlining/InlineDefaultMethod1.java index d0cadb8fe4e..7a97e824c87 100644 --- a/hotspot/test/compiler/inlining/InlineDefaultMethod1.java +++ b/hotspot/test/compiler/inlining/InlineDefaultMethod1.java @@ -25,25 +25,32 @@ * @test * @bug 8036100 * @summary Default method returns true for a while, and then returns false - * @run main/othervm -Xcomp -XX:CompileOnly=InlineDefaultMethod1::test - * -XX:CompileOnly=I1::m -XX:CompileOnly=I2::m - * InlineDefaultMethod1 + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.inlining.InlineDefaultMethod1::test + * -XX:CompileCommand=compileonly,compiler.inlining.InlineDefaultMethod1$I1::m + * -XX:CompileCommand=compileonly,compiler.inlining.InlineDefaultMethod1$I2::m + * compiler.inlining.InlineDefaultMethod1 */ -interface I1 { - default public int m() { return 0; } -} -interface I2 extends I1 { - default public int m() { return 1; } -} - -abstract class A implements I1 { -} - -class B extends A implements I2 { -} +package compiler.inlining; public class InlineDefaultMethod1 { + interface I1 { + default public int m() { return 0; } + } + + interface I2 extends I1 { + default public int m() { return 1; } + } + + static abstract class A implements I1 { + } + + static class B extends A implements I2 { + } + + public static void test(A obj) { int id = obj.m(); if (id != 1) { diff --git a/hotspot/test/compiler/integerArithmetic/TestIntegerComparison.java b/hotspot/test/compiler/integerArithmetic/TestIntegerComparison.java index b38da49d1b8..8e1699735c1 100644 --- a/hotspot/test/compiler/integerArithmetic/TestIntegerComparison.java +++ b/hotspot/test/compiler/integerArithmetic/TestIntegerComparison.java @@ -24,34 +24,42 @@ /* * @test TestIntegerComparison * @bug 8043284 8042786 - * @summary "Tests optimizations of signed and unsigned integer comparison." - * @run main/othervm -Xcomp -XX:CompileOnly=TestIntegerComparison::testSigned,TestIntegerComparison::testUnsigned TestIntegerComparison + * @summary Tests optimizations of signed and unsigned integer comparison. + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.integerArithmetic.TestIntegerComparison::testSigned + * -XX:CompileCommand=compileonly,compiler.integerArithmetic.TestIntegerComparison::testUnsigned + * compiler.integerArithmetic.TestIntegerComparison */ -public class TestIntegerComparison { - /** - * Tests optimization of signed integer comparison (see BoolNode::Ideal). - * The body of the if statement is unreachable and should not be compiled. - * @param c Character (value in the integer range [0, 65535]) - */ - public static void testSigned(char c) { - // The following addition may overflow. The result is in one - // of the two ranges [IntMax] and [IntMin, IntMin + CharMax - 1]. - int result = c + Integer.MAX_VALUE; - // CmpINode has to consider both result ranges instead of only - // the general [IntMin, IntMax] range to be able to prove that - // result is always unequal to CharMax. - if (result == Character.MAX_VALUE) { - // Unreachable - throw new RuntimeException("Should not reach here!"); - } - } +package compiler.integerArithmetic; - /** - * Tests optimization of unsigned integer comparison (see CmpUNode::Value). - * The body of the if statement is unreachable and should not be compiled. - * @param c Character (value in the integer range [0, 65535]) - */ - public static void testUnsigned(char c) { +public class TestIntegerComparison { + /** + * Tests optimization of signed integer comparison (see BoolNode::Ideal). + * The body of the if statement is unreachable and should not be compiled. + * + * @param c Character (value in the integer range [0, 65535]) + */ + public static void testSigned(char c) { + // The following addition may overflow. The result is in one + // of the two ranges [IntMax] and [IntMin, IntMin + CharMax - 1]. + int result = c + Integer.MAX_VALUE; + // CmpINode has to consider both result ranges instead of only + // the general [IntMin, IntMax] range to be able to prove that + // result is always unequal to CharMax. + if (result == Character.MAX_VALUE) { + // Unreachable + throw new RuntimeException("Should not reach here!"); + } + } + + /** + * Tests optimization of unsigned integer comparison (see CmpUNode::Value). + * The body of the if statement is unreachable and should not be compiled. + * + * @param c Character (value in the integer range [0, 65535]) + */ + public static void testUnsigned(char c) { /* * The following if statement consisting of two CmpIs is replaced * by a CmpU during optimization (see 'IfNode::fold_compares'). @@ -72,21 +80,21 @@ public class TestIntegerComparison { * that due to the overflow the signed comparison result < 98 is * always false. */ - int result = c - (Character.MAX_VALUE - Integer.MIN_VALUE) + 2; - if (1 < result && result < 100) { - // Unreachable - throw new RuntimeException("Should not reach here!"); + int result = c - (Character.MAX_VALUE - Integer.MIN_VALUE) + 2; + if (1 < result && result < 100) { + // Unreachable + throw new RuntimeException("Should not reach here!"); + } } - } - /** - * Tests optimizations of signed and unsigned integer comparison. - */ - public static void main(String[] args) { - // We use characters to get a limited integer range for free - for (int i = Character.MIN_VALUE; i <= Character.MAX_VALUE; ++i) { - testSigned((char) i); - testUnsigned((char) i); + /** + * Tests optimizations of signed and unsigned integer comparison. + */ + public static void main(String[] args) { + // We use characters to get a limited integer range for free + for (int i = Character.MIN_VALUE; i <= Character.MAX_VALUE; ++i) { + testSigned((char) i); + testUnsigned((char) i); + } } - } } diff --git a/hotspot/test/compiler/interpreter/DisableOSRTest.java b/hotspot/test/compiler/interpreter/DisableOSRTest.java index 9d531baab97..8bdd1ce368b 100644 --- a/hotspot/test/compiler/interpreter/DisableOSRTest.java +++ b/hotspot/test/compiler/interpreter/DisableOSRTest.java @@ -27,18 +27,24 @@ * @summary testing that -XX:-UseOnStackReplacement works with both -XX:(+/-)TieredCompilation * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib / + * * @build sun.hotspot.WhiteBox - * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+PrintCompilation - * -XX:-BackgroundCompilation -XX:-TieredCompilation -XX:-UseOnStackReplacement DisableOSRTest + * -XX:-BackgroundCompilation -XX:-TieredCompilation -XX:-UseOnStackReplacement + * compiler.interpreter.DisableOSRTest * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+PrintCompilation - * -XX:-BackgroundCompilation -XX:+TieredCompilation -XX:-UseOnStackReplacement DisableOSRTest + * -XX:-BackgroundCompilation -XX:+TieredCompilation -XX:-UseOnStackReplacement + * compiler.interpreter.DisableOSRTest */ +package compiler.interpreter; + +import sun.hotspot.WhiteBox; + import java.lang.reflect.Method; import java.util.Random; -import sun.hotspot.WhiteBox; public class DisableOSRTest { private static final WhiteBox WB = WhiteBox.getWhiteBox(); diff --git a/hotspot/test/compiler/interpreter/6539464/Test.java b/hotspot/test/compiler/interpreter/Test6539464.java similarity index 88% rename from hotspot/test/compiler/interpreter/6539464/Test.java rename to hotspot/test/compiler/interpreter/Test6539464.java index 6a33dfd9e65..baf0e0600f2 100644 --- a/hotspot/test/compiler/interpreter/6539464/Test.java +++ b/hotspot/test/compiler/interpreter/Test6539464.java @@ -26,10 +26,14 @@ * @bug 6539464 * @summary Math.log() produces inconsistent results between successive runs. * - * @run main/othervm -Xcomp -XX:CompileOnly=Test.main Test + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.interpreter.Test6539464::main + * compiler.interpreter.Test6539464 */ -public class Test { +package compiler.interpreter; + +public class Test6539464 { static double log_value = 17197; static double log_result = Math.log(log_value); diff --git a/hotspot/test/compiler/interpreter/6833129/Test.java b/hotspot/test/compiler/interpreter/Test6833129.java similarity index 94% rename from hotspot/test/compiler/interpreter/6833129/Test.java rename to hotspot/test/compiler/interpreter/Test6833129.java index 0283d7b1deb..e887c2df794 100644 --- a/hotspot/test/compiler/interpreter/6833129/Test.java +++ b/hotspot/test/compiler/interpreter/Test6833129.java @@ -25,10 +25,13 @@ * @test * @bug 6833129 * @summary Object.clone() and Arrays.copyOf ignore coping with -XX:+DeoptimizeALot - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot Test + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot + * compiler.interpreter.Test6833129 */ -public class Test{ +package compiler.interpreter; + +public class Test6833129 { public static void init(int src[]) { for (int i =0; ijvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place * @modules java.base/jdk.internal.misc * @library /testlibrary - * @run main/othervm -XX:-TieredCompilation -Xbatch -XX:CompileOnly=TestObjectClone::f TestObjectClone + * + * @run main/othervm -XX:-TieredCompilation -Xbatch + * -XX:CompileCommand=compileonly,compiler.intrinsics.object.TestClone::f + * compiler.intrinsics.object.TestClone */ + +package compiler.intrinsics.object; + import jdk.test.lib.Asserts; -public class TestObjectClone implements Cloneable { - static class A extends TestObjectClone {} - static class B extends TestObjectClone { +public class TestClone implements Cloneable { + static class A extends TestClone {} + static class B extends TestClone { public B clone() { - return (B)TestObjectClone.b; + return (B)TestClone.b; } } - static class C extends TestObjectClone { + static class C extends TestClone { public C clone() { - return (C)TestObjectClone.c; + return (C)TestClone.c; } } - static class D extends TestObjectClone { + static class D extends TestClone { public D clone() { - return (D)TestObjectClone.d; + return (D)TestClone.d; } } - static TestObjectClone a = new A(), b = new B(), c = new C(), d = new D(); + static TestClone a = new A(), b = new B(), c = new C(), d = new D(); - public static Object f(TestObjectClone o) throws CloneNotSupportedException { + public static Object f(TestClone o) throws CloneNotSupportedException { // Polymorphic call site: >90% Object::clone / <10% other methods return o.clone(); } public static void main(String[] args) throws Exception { - TestObjectClone[] params1 = {a, a, a, a, a, a, a, a, a, a, a, - a, a, a, a, a, a, a, a, a, a, a, - a, a, a, a, a, a, a, a, a, a, a, - b, c, d}; + TestClone[] params1 = {a, a, a, a, a, a, a, a, a, a, a, + a, a, a, a, a, a, a, a, a, a, a, + a, a, a, a, a, a, a, a, a, a, a, + b, c, d}; for (int i = 0; i < 15000; i++) { f(params1[i % params1.length]); diff --git a/hotspot/test/compiler/intrinsics/hashcode/TestHashCode.java b/hotspot/test/compiler/intrinsics/object/TestHashCode.java similarity index 87% rename from hotspot/test/compiler/intrinsics/hashcode/TestHashCode.java rename to hotspot/test/compiler/intrinsics/object/TestHashCode.java index f7d5450b351..f011ccd795a 100644 --- a/hotspot/test/compiler/intrinsics/hashcode/TestHashCode.java +++ b/hotspot/test/compiler/intrinsics/object/TestHashCode.java @@ -25,10 +25,15 @@ * @test * @bug 8011646 * @summary SEGV in compiled code with loop predication - * @run main/othervm -XX:-TieredCompilation -XX:CompileOnly=TestHashCode.m1,Object.hashCode TestHashCode * + * @run main/othervm -XX:-TieredCompilation + * -XX:CompileCommand=compileonly,java.lang.Object::hashCode + * -XX:CompileCommand=compileonly,compiler.intrinsics.object.TestHashCode::m1 + * compiler.intrinsics.object.TestHashCode */ +package compiler.intrinsics.object; + public class TestHashCode { static class A { int i; diff --git a/hotspot/test/compiler/intrinsics/sha/TestSHA.java b/hotspot/test/compiler/intrinsics/sha/TestSHA.java index 08af909ee34..155218dee9d 100644 --- a/hotspot/test/compiler/intrinsics/sha/TestSHA.java +++ b/hotspot/test/compiler/intrinsics/sha/TestSHA.java @@ -27,26 +27,58 @@ * @bug 8035968 * @summary C2 support for SHA on SPARC * - * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-1 TestSHA - * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-224 TestSHA - * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-256 TestSHA - * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-384 TestSHA - * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-512 TestSHA + * @run main/othervm/timeout=600 -Xbatch + * -Dalgorithm=SHA-1 + * compiler.intrinsics.sha.TestSHA + * @run main/othervm/timeout=600 -Xbatch + * -Dalgorithm=SHA-224 + * compiler.intrinsics.sha.TestSHA + * @run main/othervm/timeout=600 -Xbatch + * -Dalgorithm=SHA-256 + * compiler.intrinsics.sha.TestSHA + * @run main/othervm/timeout=600 -Xbatch + * -Dalgorithm=SHA-384 + * compiler.intrinsics.sha.TestSHA + * @run main/othervm/timeout=600 -Xbatch + * -Dalgorithm=SHA-512 + * compiler.intrinsics.sha.TestSHA * - * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-1 -Doffset=1 TestSHA - * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-224 -Doffset=1 TestSHA - * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-256 -Doffset=1 TestSHA - * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-384 -Doffset=1 TestSHA - * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-512 -Doffset=1 TestSHA + * @run main/othervm/timeout=600 -Xbatch + * -Dalgorithm=SHA-1 -Doffset=1 + * compiler.intrinsics.sha.TestSHA + * @run main/othervm/timeout=600 -Xbatch + * -Dalgorithm=SHA-224 -Doffset=1 + * compiler.intrinsics.sha.TestSHA + * @run main/othervm/timeout=600 -Xbatch + * -Dalgorithm=SHA-256 -Doffset=1 + * compiler.intrinsics.sha.TestSHA + * @run main/othervm/timeout=600 -Xbatch + * -Dalgorithm=SHA-384 -Doffset=1 + * compiler.intrinsics.sha.TestSHA + * @run main/othervm/timeout=600 -Xbatch + * -Dalgorithm=SHA-512 -Doffset=1 + * compiler.intrinsics.sha.TestSHA * - * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-1 -Dalgorithm2=SHA-256 TestSHA - * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-1 -Dalgorithm2=SHA-512 TestSHA - * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-256 -Dalgorithm2=SHA-512 TestSHA + * @run main/othervm/timeout=600 -Xbatch + * -Dalgorithm=SHA-1 -Dalgorithm2=SHA-256 + * compiler.intrinsics.sha.TestSHA + * @run main/othervm/timeout=600 -Xbatch + * -Dalgorithm=SHA-1 -Dalgorithm2=SHA-512 + * compiler.intrinsics.sha.TestSHA + * @run main/othervm/timeout=600 -Xbatch + * -Dalgorithm=SHA-256 -Dalgorithm2=SHA-512 + * compiler.intrinsics.sha.TestSHA * - * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=SHA-1 -Dalgorithm2=MD5 TestSHA - * @run main/othervm/timeout=600 -Xbatch -Dalgorithm=MD5 -Dalgorithm2=SHA-1 TestSHA + * @run main/othervm/timeout=600 -Xbatch + * -Dalgorithm=SHA-1 -Dalgorithm2=MD5 + * compiler.intrinsics.sha.TestSHA + * @run main/othervm/timeout=600 -Xbatch + * -Dalgorithm=MD5 -Dalgorithm2=SHA-1 + * compiler.intrinsics.sha.TestSHA */ +package compiler.intrinsics.sha; + import java.security.MessageDigest; import java.util.Arrays; @@ -70,7 +102,7 @@ public class TestSHA { } } - static void testSHA(String provider, String algorithm, int msgSize, + public static void testSHA(String provider, String algorithm, int msgSize, int offset, int iters, int warmupIters) throws Exception { System.out.println("provider = " + provider); System.out.println("algorithm = " + algorithm); diff --git a/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java b/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java index cb0856cc778..7dd21546d46 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java @@ -21,9 +21,11 @@ * questions. */ +package compiler.intrinsics.sha.cli; + +import compiler.testlibrary.sha.predicate.IntrinsicPredicates; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; -import compiler.testlibrary.sha.predicate.IntrinsicPredicates; import java.util.function.BooleanSupplier; @@ -34,17 +36,17 @@ import java.util.function.BooleanSupplier; * from several test cases shared among different tests. */ public class SHAOptionsBase extends CommandLineOptionTest { - protected static final String USE_SHA_OPTION = "UseSHA"; - protected static final String USE_SHA1_INTRINSICS_OPTION + public static final String USE_SHA_OPTION = "UseSHA"; + public static final String USE_SHA1_INTRINSICS_OPTION = "UseSHA1Intrinsics"; - protected static final String USE_SHA256_INTRINSICS_OPTION + public static final String USE_SHA256_INTRINSICS_OPTION = "UseSHA256Intrinsics"; - protected static final String USE_SHA512_INTRINSICS_OPTION + public static final String USE_SHA512_INTRINSICS_OPTION = "UseSHA512Intrinsics"; // Intrinsics flags are of diagnostic type // and must be preceded by UnlockDiagnosticVMOptions. - protected static final String UNLOCK_DIAGNOSTIC_VM_OPTIONS + public static final String UNLOCK_DIAGNOSTIC_VM_OPTIONS = "-XX:+UnlockDiagnosticVMOptions"; // Note that strings below will be passed to @@ -71,7 +73,7 @@ public class SHAOptionsBase extends CommandLineOptionTest { * @return A warning message that will be printed out to VM output if CPU * instructions required by the option are not supported. */ - protected static String getWarningForUnsupportedCPU(String optionName) { + public static String getWarningForUnsupportedCPU(String optionName) { if (Platform.isSparc() || Platform.isAArch64() || Platform.isX64() || Platform.isX86()) { switch (optionName) { @@ -101,7 +103,7 @@ public class SHAOptionsBase extends CommandLineOptionTest { * @return The predicate on availability of CPU instructions required by the * option. */ - protected static BooleanSupplier getPredicateForOption(String optionName) { + public static BooleanSupplier getPredicateForOption(String optionName) { switch (optionName) { case SHAOptionsBase.USE_SHA_OPTION: return IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE; diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java index 7fc3642e618..44fd2f3ab4f 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java @@ -28,12 +28,19 @@ * @library /testlibrary /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseSHA1IntrinsicsOptionOnSupportedCPU + * + * @build compiler.intrinsics.sha.cli.TestUseSHA1IntrinsicsOptionOnSupportedCPU * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseSHA1IntrinsicsOptionOnSupportedCPU + * -XX:+WhiteBoxAPI + * compiler.intrinsics.sha.cli.TestUseSHA1IntrinsicsOptionOnSupportedCPU */ + +package compiler.intrinsics.sha.cli; + +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForSupportedCPU; + public class TestUseSHA1IntrinsicsOptionOnSupportedCPU { public static void main(String args[]) throws Throwable { new SHAOptionsBase(new GenericTestCaseForSupportedCPU( diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java index 34b66806c37..a4d7f2a1694 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java @@ -28,13 +28,23 @@ * @library /testlibrary /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseSHA1IntrinsicsOptionOnUnsupportedCPU + * + * @build compiler.intrinsics.sha.cli.TestUseSHA1IntrinsicsOptionOnUnsupportedCPU * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI - * TestUseSHA1IntrinsicsOptionOnUnsupportedCPU + * compiler.intrinsics.sha.cli.TestUseSHA1IntrinsicsOptionOnUnsupportedCPU */ + +package compiler.intrinsics.sha.cli; + +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForOtherCPU; +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedAArch64CPU; +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedSparcCPU; +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedX86CPU; +import compiler.intrinsics.sha.cli.testcases.UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU; + public class TestUseSHA1IntrinsicsOptionOnUnsupportedCPU { public static void main(String args[]) throws Throwable { new SHAOptionsBase( diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java index 47106008cc1..33e19ec322f 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java @@ -28,13 +28,19 @@ * @library /testlibrary /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseSHA256IntrinsicsOptionOnSupportedCPU + * + * @build compiler.intrinsics.sha.cli.TestUseSHA256IntrinsicsOptionOnSupportedCPU * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI - * TestUseSHA256IntrinsicsOptionOnSupportedCPU + * compiler.intrinsics.sha.cli.TestUseSHA256IntrinsicsOptionOnSupportedCPU */ + +package compiler.intrinsics.sha.cli; + +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForSupportedCPU; + public class TestUseSHA256IntrinsicsOptionOnSupportedCPU { public static void main(String args[]) throws Throwable { new SHAOptionsBase(new GenericTestCaseForSupportedCPU( diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java index a23dd213bf2..c9f5ec5507a 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java @@ -28,13 +28,23 @@ * @library /testlibrary /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseSHA256IntrinsicsOptionOnUnsupportedCPU + * + * @build compiler.intrinsics.sha.cli.TestUseSHA256IntrinsicsOptionOnUnsupportedCPU * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI - * TestUseSHA256IntrinsicsOptionOnUnsupportedCPU + * compiler.intrinsics.sha.cli.TestUseSHA256IntrinsicsOptionOnUnsupportedCPU */ + +package compiler.intrinsics.sha.cli; + +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForOtherCPU; +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedAArch64CPU; +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedSparcCPU; +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedX86CPU; +import compiler.intrinsics.sha.cli.testcases.UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU; + public class TestUseSHA256IntrinsicsOptionOnUnsupportedCPU { public static void main(String args[]) throws Throwable { new SHAOptionsBase( diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java index fb7c06558e0..b5f2ac242a3 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java @@ -28,13 +28,19 @@ * @library /testlibrary /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseSHA512IntrinsicsOptionOnSupportedCPU + * + * @build compiler.intrinsics.sha.cli.TestUseSHA512IntrinsicsOptionOnSupportedCPU * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI - * TestUseSHA512IntrinsicsOptionOnSupportedCPU + * compiler.intrinsics.sha.cli.TestUseSHA512IntrinsicsOptionOnSupportedCPU */ + +package compiler.intrinsics.sha.cli; + +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForSupportedCPU; + public class TestUseSHA512IntrinsicsOptionOnSupportedCPU { public static void main(String args[]) throws Throwable { new SHAOptionsBase(new GenericTestCaseForSupportedCPU( diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java index d57c63ea01a..26c989e256e 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java @@ -28,13 +28,23 @@ * @library /testlibrary /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseSHA512IntrinsicsOptionOnUnsupportedCPU + * + * @build compiler.intrinsics.sha.cli.TestUseSHA512IntrinsicsOptionOnUnsupportedCPU * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI - * TestUseSHA512IntrinsicsOptionOnUnsupportedCPU + * compiler.intrinsics.sha.cli.TestUseSHA512IntrinsicsOptionOnUnsupportedCPU */ + +package compiler.intrinsics.sha.cli; + +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForOtherCPU; +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedAArch64CPU; +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedSparcCPU; +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedX86CPU; +import compiler.intrinsics.sha.cli.testcases.UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU; + public class TestUseSHA512IntrinsicsOptionOnUnsupportedCPU { public static void main(String args[]) throws Throwable { new SHAOptionsBase( diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java index 5903dfbee89..7938712eca9 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java @@ -28,12 +28,20 @@ * @library /testlibrary /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseSHAOptionOnSupportedCPU + * + * @build compiler.intrinsics.sha.cli.TestUseSHAOptionOnSupportedCPU * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseSHAOptionOnSupportedCPU + * -XX:+WhiteBoxAPI + * compiler.intrinsics.sha.cli.TestUseSHAOptionOnSupportedCPU */ + +package compiler.intrinsics.sha.cli; + +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForSupportedCPU; +import compiler.intrinsics.sha.cli.testcases.UseSHASpecificTestCaseForSupportedCPU; + public class TestUseSHAOptionOnSupportedCPU { public static void main(String args[]) throws Throwable { new SHAOptionsBase( diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java index 3fed6d20d0d..4a5a34c7ed0 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java @@ -28,12 +28,22 @@ * @library /testlibrary /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseSHAOptionOnUnsupportedCPU + * @build compiler.intrinsics.sha.cli.TestUseSHAOptionOnUnsupportedCPU * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseSHAOptionOnUnsupportedCPU + * -XX:+WhiteBoxAPI + * compiler.intrinsics.sha.cli.TestUseSHAOptionOnUnsupportedCPU */ + +package compiler.intrinsics.sha.cli; + +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForOtherCPU; +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedAArch64CPU; +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedSparcCPU; +import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedX86CPU; +import compiler.intrinsics.sha.cli.testcases.UseSHASpecificTestCaseForUnsupportedCPU; + public class TestUseSHAOptionOnUnsupportedCPU { public static void main(String args[]) throws Throwable { new SHAOptionsBase( diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java index 09dc581e7fb..24487f8a424 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java @@ -21,6 +21,9 @@ * questions. */ +package compiler.intrinsics.sha.cli.testcases; + +import compiler.intrinsics.sha.cli.SHAOptionsBase; import jdk.test.lib.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java index 553cfafa128..de67a394777 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java @@ -21,6 +21,9 @@ * questions. */ +package compiler.intrinsics.sha.cli.testcases; + +import compiler.intrinsics.sha.cli.SHAOptionsBase; import jdk.test.lib.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java index 8fabc79bfaa..64e60e84a95 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java @@ -21,6 +21,9 @@ * questions. */ +package compiler.intrinsics.sha.cli.testcases; + +import compiler.intrinsics.sha.cli.SHAOptionsBase; import jdk.test.lib.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java index 1254b8a0649..469816055c6 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java @@ -21,6 +21,9 @@ * questions. */ +package compiler.intrinsics.sha.cli.testcases; + +import compiler.intrinsics.sha.cli.SHAOptionsBase; import jdk.test.lib.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java index 599be2c8061..2b90bed816c 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java @@ -21,12 +21,15 @@ * questions. */ +package compiler.intrinsics.sha.cli.testcases; + +import compiler.intrinsics.sha.cli.SHAOptionsBase; import jdk.test.lib.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; -import jdk.test.lib.cli.predicate.OrPredicate; import jdk.test.lib.cli.predicate.NotPredicate; +import jdk.test.lib.cli.predicate.OrPredicate; /** * Generic test case for SHA-related options targeted to X86 CPUs that don't diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java index a4dfe43742f..3618147de2e 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java @@ -21,13 +21,16 @@ * questions. */ +package compiler.intrinsics.sha.cli.testcases; + +import compiler.intrinsics.sha.cli.SHAOptionsBase; +import compiler.testlibrary.sha.predicate.IntrinsicPredicates; import jdk.test.lib.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; -import jdk.test.lib.cli.predicate.OrPredicate; import jdk.test.lib.cli.predicate.NotPredicate; -import compiler.testlibrary.sha.predicate.IntrinsicPredicates; +import jdk.test.lib.cli.predicate.OrPredicate; /** * Test case specific to UseSHA*Intrinsics options targeted to SPARC and AArch64 diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java index f4ed3bb6db1..0a13cdb8c5e 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java @@ -21,13 +21,16 @@ * questions. */ +package compiler.intrinsics.sha.cli.testcases; + +import compiler.intrinsics.sha.cli.SHAOptionsBase; +import compiler.testlibrary.sha.predicate.IntrinsicPredicates; import jdk.test.lib.Asserts; import jdk.test.lib.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; import jdk.test.lib.cli.predicate.OrPredicate; -import compiler.testlibrary.sha.predicate.IntrinsicPredicates; /** * UseSHA specific test case targeted to SPARC and AArch64 CPUs which diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java index bc3068deb6a..55e0f5b3ae8 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java @@ -21,14 +21,17 @@ * questions. */ +package compiler.intrinsics.sha.cli.testcases; + +import compiler.intrinsics.sha.cli.SHAOptionsBase; +import compiler.testlibrary.sha.predicate.IntrinsicPredicates; import jdk.test.lib.Asserts; import jdk.test.lib.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; -import jdk.test.lib.cli.predicate.OrPredicate; import jdk.test.lib.cli.predicate.NotPredicate; -import compiler.testlibrary.sha.predicate.IntrinsicPredicates; +import jdk.test.lib.cli.predicate.OrPredicate; /** * UseSHA specific test case targeted to SPARC and AArch64 CPUs which don't diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/SHASanityTestBase.java b/hotspot/test/compiler/intrinsics/sha/sanity/SHASanityTestBase.java index d60671c22fc..c476d27b143 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/SHASanityTestBase.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/SHASanityTestBase.java @@ -21,6 +21,10 @@ * questions. */ +package compiler.intrinsics.sha.sanity; + +import compiler.intrinsics.sha.TestSHA; +import compiler.testlibrary.intrinsics.Verifier; import sun.hotspot.WhiteBox; import java.io.FileOutputStream; @@ -29,8 +33,6 @@ import java.util.Objects; import java.util.Properties; import java.util.function.BooleanSupplier; -import compiler.testlibrary.intrinsics.Verifier; - /** * Base class for sanity tests on SHA intrinsics support. */ diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java index 98ae9c3ab0b..71fd922ccf1 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java @@ -25,10 +25,12 @@ * @test * @bug 8035968 * @summary Verify that SHA-1 intrinsic is actually used. - * @library /testlibrary /test/lib / ../ + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA1Intrinsics + * + * @build compiler.testlibrary.intrinsics.Verifier + * compiler.intrinsics.sha.sanity.TestSHA1Intrinsics * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -38,7 +40,8 @@ * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA * -XX:+UseSHA1Intrinsics - * -Dalgorithm=SHA-1 TestSHA1Intrinsics + * -Dalgorithm=SHA-1 + * compiler.intrinsics.sha.sanity.TestSHA1Intrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 @@ -46,11 +49,14 @@ * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA * -XX:-UseSHA1Intrinsics - * -Dalgorithm=SHA-1 TestSHA1Intrinsics + * -Dalgorithm=SHA-1 + * compiler.intrinsics.sha.sanity.TestSHA1Intrinsics * @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE * compiler.testlibrary.intrinsics.Verifier positive.log negative.log */ +package compiler.intrinsics.sha.sanity; + import compiler.testlibrary.sha.predicate.IntrinsicPredicates; public class TestSHA1Intrinsics { diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java index 48693030a9f..ffc81850f2a 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java @@ -25,10 +25,12 @@ * @test * @bug 8035968 * @summary Verify that SHA-1 multi block intrinsic is actually used. - * @library /testlibrary /test/lib / ../ + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA1MultiBlockIntrinsics + * + * @build compiler.testlibrary.intrinsics.Verifier + * compiler.intrinsics.sha.sanity.TestSHA1MultiBlockIntrinsics * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -39,7 +41,8 @@ * -XX:CompileOnly=sun/security/provider/SHA * -XX:+UseSHA1Intrinsics -XX:-UseSHA256Intrinsics * -XX:-UseSHA512Intrinsics - * -Dalgorithm=SHA-1 TestSHA1MultiBlockIntrinsics + * -Dalgorithm=SHA-1 + * compiler.intrinsics.sha.sanity.TestSHA1MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 @@ -47,19 +50,21 @@ * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA * -XX:+UseSHA1Intrinsics -Dalgorithm=SHA-1 - * TestSHA1MultiBlockIntrinsics + * compiler.intrinsics.sha.sanity.TestSHA1MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=negative.log * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA -XX:-UseSHA - * -Dalgorithm=SHA-1 TestSHA1MultiBlockIntrinsics + * -Dalgorithm=SHA-1 + * compiler.intrinsics.sha.sanity.TestSHA1MultiBlockIntrinsics * @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE * compiler.testlibrary.intrinsics.Verifier positive.log positive_def.log * negative.log */ +package compiler.intrinsics.sha.sanity; import compiler.testlibrary.sha.predicate.IntrinsicPredicates; public class TestSHA1MultiBlockIntrinsics { diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java index 51373332c95..c0d7c8015ff 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java @@ -25,10 +25,12 @@ * @test * @bug 8035968 * @summary Verify that SHA-256 intrinsic is actually used. - * @library /testlibrary /test/lib / ../ + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA256Intrinsics + * + * @build compiler.testlibrary.intrinsics.Verifier + * compiler.intrinsics.sha.sanity.TestSHA256Intrinsics * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -38,7 +40,8 @@ * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA * -XX:+UseSHA256Intrinsics - * -Dalgorithm=SHA-224 TestSHA256Intrinsics + * -Dalgorithm=SHA-224 + * compiler.intrinsics.sha.sanity.TestSHA256Intrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 @@ -46,7 +49,8 @@ * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA * -XX:-UseSHA256Intrinsics - * -Dalgorithm=SHA-224 TestSHA256Intrinsics + * -Dalgorithm=SHA-224 + * compiler.intrinsics.sha.sanity.TestSHA256Intrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 @@ -54,7 +58,8 @@ * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA * -XX:+UseSHA256Intrinsics - * -Dalgorithm=SHA-256 TestSHA256Intrinsics + * -Dalgorithm=SHA-256 + * compiler.intrinsics.sha.sanity.TestSHA256Intrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 @@ -62,12 +67,15 @@ * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA * -XX:-UseSHA256Intrinsics - * -Dalgorithm=SHA-256 TestSHA256Intrinsics + * -Dalgorithm=SHA-256 + * compiler.intrinsics.sha.sanity.TestSHA256Intrinsics * @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE * compiler.testlibrary.intrinsics.Verifier positive_224.log positive_256.log * negative_224.log negative_256.log */ +package compiler.intrinsics.sha.sanity; + import compiler.testlibrary.sha.predicate.IntrinsicPredicates; public class TestSHA256Intrinsics { diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java index 214f666cf8f..2c5a67f2000 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java @@ -25,10 +25,12 @@ * @test * @bug 8035968 * @summary Verify that SHA-256 multi block intrinsic is actually used. - * @library /testlibrary /test/lib / ../ + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA256MultiBlockIntrinsics + * + * @build compiler.testlibrary.intrinsics.Verifier + * compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -39,7 +41,8 @@ * -XX:CompileOnly=sun/security/provider/SHA * -XX:+UseSHA256Intrinsics -XX:-UseSHA1Intrinsics * -XX:-UseSHA512Intrinsics - * -Dalgorithm=SHA-224 TestSHA256MultiBlockIntrinsics + * -Dalgorithm=SHA-224 + * compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 @@ -47,14 +50,15 @@ * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA * -XX:+UseSHA256Intrinsics -Dalgorithm=SHA-224 - * TestSHA256MultiBlockIntrinsics + * compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=negative_224.log * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA -XX:-UseSHA - * -Dalgorithm=SHA-224 TestSHA256MultiBlockIntrinsics + * -Dalgorithm=SHA-224 + * compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 @@ -63,7 +67,8 @@ * -XX:CompileOnly=sun/security/provider/SHA * -XX:+UseSHA256Intrinsics -XX:-UseSHA1Intrinsics * -XX:-UseSHA512Intrinsics - * -Dalgorithm=SHA-256 TestSHA256MultiBlockIntrinsics + * -Dalgorithm=SHA-256 + * compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 @@ -71,20 +76,22 @@ * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA * -XX:+UseSHA256Intrinsics -Dalgorithm=SHA-256 - * TestSHA256MultiBlockIntrinsics + * compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=negative_256.log * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA -XX:-UseSHA - * -Dalgorithm=SHA-256 TestSHA256MultiBlockIntrinsics + * -Dalgorithm=SHA-256 + * compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics * @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE * compiler.testlibrary.intrinsics.Verifier positive_224.log positive_256.log * positive_224_def.log positive_256_def.log negative_224.log * negative_256.log */ +package compiler.intrinsics.sha.sanity; import compiler.testlibrary.sha.predicate.IntrinsicPredicates; public class TestSHA256MultiBlockIntrinsics { diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java index 5ac5fc5f8b7..2b4fac3bb0f 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java @@ -25,10 +25,12 @@ * @test * @bug 8035968 * @summary Verify that SHA-512 intrinsic is actually used. - * @library /testlibrary /test/lib / ../ + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA512Intrinsics + * + * @build compiler.testlibrary.intrinsics.Verifier + * compiler.intrinsics.sha.sanity.TestSHA512Intrinsics * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -38,7 +40,8 @@ * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA * -XX:+UseSHA512Intrinsics - * -Dalgorithm=SHA-384 TestSHA512Intrinsics + * -Dalgorithm=SHA-384 + * compiler.intrinsics.sha.sanity.TestSHA512Intrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 @@ -46,7 +49,8 @@ * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA * -XX:-UseSHA512Intrinsics - * -Dalgorithm=SHA-384 TestSHA512Intrinsics + * -Dalgorithm=SHA-384 + * compiler.intrinsics.sha.sanity.TestSHA512Intrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 @@ -54,7 +58,8 @@ * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA * -XX:+UseSHA512Intrinsics - * -Dalgorithm=SHA-512 TestSHA512Intrinsics + * -Dalgorithm=SHA-512 + * compiler.intrinsics.sha.sanity.TestSHA512Intrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 @@ -62,12 +67,15 @@ * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA * -XX:-UseSHA512Intrinsics - * -Dalgorithm=SHA-512 TestSHA512Intrinsics + * -Dalgorithm=SHA-512 + * compiler.intrinsics.sha.sanity.TestSHA512Intrinsics * @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE * compiler.testlibrary.intrinsics.Verifier positive_384.log positive_512.log * negative_384.log negative_512.log */ +package compiler.intrinsics.sha.sanity; + import compiler.testlibrary.sha.predicate.IntrinsicPredicates; public class TestSHA512Intrinsics { diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java index 722648360ef..1b5f9a644b9 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java @@ -25,10 +25,12 @@ * @test * @bug 8035968 * @summary Verify that SHA-512 multi block intrinsic is actually used. - * @library /testlibrary /test/lib / ../ + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA512MultiBlockIntrinsics + * + * @build compiler.testlibrary.intrinsics.Verifier + * compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -39,7 +41,8 @@ * -XX:CompileOnly=sun/security/provider/SHA * -XX:+UseSHA512Intrinsics -XX:-UseSHA1Intrinsics * -XX:-UseSHA256Intrinsics - * -Dalgorithm=SHA-384 TestSHA512MultiBlockIntrinsics + * -Dalgorithm=SHA-384 + * compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 @@ -47,14 +50,15 @@ * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA * -XX:+UseSHA512Intrinsics -Dalgorithm=SHA-384 - * TestSHA512MultiBlockIntrinsics + * compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=negative_384.log * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA -XX:-UseSHA - * -Dalgorithm=SHA-384 TestSHA1Intrinsics + * -Dalgorithm=SHA-384 + * compiler.intrinsics.sha.sanity.TestSHA1Intrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 @@ -63,7 +67,8 @@ * -XX:CompileOnly=sun/security/provider/SHA * -XX:+UseSHA512Intrinsics -XX:-UseSHA1Intrinsics * -XX:-UseSHA256Intrinsics - * -Dalgorithm=SHA-512 TestSHA512MultiBlockIntrinsics + * -Dalgorithm=SHA-512 + * compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 @@ -71,20 +76,23 @@ * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA * -XX:+UseSHA512Intrinsics -Dalgorithm=SHA-512 - * TestSHA512MultiBlockIntrinsics + * compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500 * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=negative_512.log * -XX:CompileOnly=sun/security/provider/DigestBase * -XX:CompileOnly=sun/security/provider/SHA -XX:-UseSHA - * -Dalgorithm=SHA-512 TestSHA512MultiBlockIntrinsics + * -Dalgorithm=SHA-512 + * compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics * @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE * compiler.testlibrary.intrinsics.Verifier positive_384.log positive_512.log * positive_384_def.log positive_512_def.log negative_384.log * negative_512.log */ +package compiler.intrinsics.sha.sanity; + import compiler.testlibrary.sha.predicate.IntrinsicPredicates; public class TestSHA512MultiBlockIntrinsics { diff --git a/hotspot/test/compiler/intrinsics/string/TestHasNegatives.java b/hotspot/test/compiler/intrinsics/string/TestHasNegatives.java index 587eb0c34ec..df75e4d8a0d 100644 --- a/hotspot/test/compiler/intrinsics/string/TestHasNegatives.java +++ b/hotspot/test/compiler/intrinsics/string/TestHasNegatives.java @@ -28,13 +28,13 @@ * @bug 8054307 * @summary Validates StringCoding.hasNegatives intrinsic with a small range of tests. * @library /compiler/patches + * * @build java.base/java.lang.Helper * @build compiler.intrinsics.string.TestHasNegatives * @run main compiler.intrinsics.string.TestHasNegatives */ -package compiler.intrinsics.string; -import java.lang.Helper; +package compiler.intrinsics.string; /* * @summary Validates StringCoding.hasNegatives intrinsic with a small diff --git a/hotspot/test/compiler/intrinsics/string/TestStringConstruction.java b/hotspot/test/compiler/intrinsics/string/TestStringConstruction.java index 20c010dfb7a..bdd02054bcc 100644 --- a/hotspot/test/compiler/intrinsics/string/TestStringConstruction.java +++ b/hotspot/test/compiler/intrinsics/string/TestStringConstruction.java @@ -25,8 +25,16 @@ * @test * @bug 8142303 * @summary Tests handling of invalid array indices in C2 intrinsic if explicit range check in Java code is not inlined. - * @run main/othervm -XX:CompileCommand=inline,java.lang.String::* -XX:CompileCommand=inline,java.lang.StringUTF16::* -XX:CompileCommand=exclude,java.lang.String::checkBoundsOffCount TestStringConstruction + * + * @run main/othervm + * -XX:CompileCommand=inline,java.lang.String::* + * -XX:CompileCommand=inline,java.lang.StringUTF16::* + * -XX:CompileCommand=exclude,java.lang.String::checkBoundsOffCount + * compiler.intrinsics.string.TestStringConstruction */ + +package compiler.intrinsics.string; + public class TestStringConstruction { public static void main(String[] args) { diff --git a/hotspot/test/compiler/intrinsics/stringequals/TestStringEqualsBadLength.java b/hotspot/test/compiler/intrinsics/string/TestStringEqualsBadLength.java similarity index 95% rename from hotspot/test/compiler/intrinsics/stringequals/TestStringEqualsBadLength.java rename to hotspot/test/compiler/intrinsics/string/TestStringEqualsBadLength.java index 0de5175d286..08f998621d2 100644 --- a/hotspot/test/compiler/intrinsics/stringequals/TestStringEqualsBadLength.java +++ b/hotspot/test/compiler/intrinsics/string/TestStringEqualsBadLength.java @@ -25,10 +25,13 @@ * @test * @bug 8027445 * @summary String.equals() may be called with a length whose upper bits are not cleared - * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation TestStringEqualsBadLength * + * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation + * compiler.intrinsics.string.TestStringEqualsBadLength */ +package compiler.intrinsics.string; + import java.util.Arrays; public class TestStringEqualsBadLength { diff --git a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicMemoryFlow.java b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicMemoryFlow.java index f3cb5168901..6918b52d441 100644 --- a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicMemoryFlow.java +++ b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicMemoryFlow.java @@ -21,16 +21,20 @@ * questions. */ -import jdk.test.lib.Asserts; - /* * @test * @bug 8144212 * @summary Check for correct memory flow with the String compress/inflate intrinsics. * @modules java.base/jdk.internal.misc * @library /testlibrary - * @run main TestStringIntrinsicMemoryFlow + * + * @run main compiler.intrinsics.string.TestStringIntrinsicMemoryFlow */ + +package compiler.intrinsics.string; + +import jdk.test.lib.Asserts; + public class TestStringIntrinsicMemoryFlow { public static void main(String[] args) { diff --git a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java index 7c93f1405b6..c5ed25ca29a 100644 --- a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java +++ b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java @@ -27,7 +27,7 @@ * @test * @bug 8155608 * @summary Verifies that string intrinsics throw array out of bounds exceptions. - * @library /compiler/patches /testlibrary /test/lib / + * @library /compiler/patches /testlibrary /test/lib * @build java.base/java.lang.Helper * @build compiler.intrinsics.string.TestStringIntrinsicRangeChecks * @run main/othervm -Xbatch -XX:CompileThreshold=100 -XX:-TieredCompilation compiler.intrinsics.string.TestStringIntrinsicRangeChecks @@ -35,7 +35,8 @@ package compiler.intrinsics.string; import java.lang.Helper; -import java.lang.reflect.*; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; public class TestStringIntrinsicRangeChecks { // Prepare test arrays diff --git a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics.java b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics.java index 9fe60b51d8d..36cf6827b9b 100644 --- a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics.java +++ b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics.java @@ -21,16 +21,23 @@ * questions. */ -import java.lang.annotation.*; -import java.lang.reflect.*; -import java.util.Arrays; - /* * @test * @bug 8054307 * @summary Tests correctness of string related intrinsics and C2 optimizations. - * @run main/timeout=240 TestStringIntrinsics + * + * @run main/timeout=240 compiler.intrinsics.string.TestStringIntrinsics */ + +package compiler.intrinsics.string; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.reflect.Method; +import java.util.Arrays; + public class TestStringIntrinsics { public enum Operation { diff --git a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java index ca8ca1ceebd..ef3ffe14ce5 100644 --- a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java +++ b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java @@ -28,8 +28,9 @@ * @summary PPC64: fix string intrinsics after CompactStrings change * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib + * * @build sun.hotspot.WhiteBox - * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * * @run main/othervm @@ -39,20 +40,23 @@ * -XX:+WhiteBoxAPI * -XX:MaxInlineSize=70 * -XX:MinInliningThreshold=0 - * TestStringIntrinsics2 + * compiler.intrinsics.string.TestStringIntrinsics2 */ +package compiler.intrinsics.string; + +import sun.hotspot.WhiteBox; + import java.lang.annotation.ElementType; -import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import java.lang.reflect.Method; import java.util.Arrays; import java.util.function.Consumer; -import java.util.function.Function; -import static jdk.test.lib.Asserts.*; -import sun.hotspot.WhiteBox; +import static jdk.test.lib.Asserts.assertEquals; +import static jdk.test.lib.Asserts.assertFalse; +import static jdk.test.lib.Asserts.assertTrue; public class TestStringIntrinsics2 { // ------------------------------------------------------------------------ diff --git a/hotspot/test/compiler/intrinsics/unsafe/AllocateUninitializedArray.java b/hotspot/test/compiler/intrinsics/unsafe/AllocateUninitializedArray.java index 404ccc6c60d..98fd5a31941 100644 --- a/hotspot/test/compiler/intrinsics/unsafe/AllocateUninitializedArray.java +++ b/hotspot/test/compiler/intrinsics/unsafe/AllocateUninitializedArray.java @@ -27,12 +27,19 @@ * @bug 8150465 * @summary Unsafe methods to produce uninitialized arrays * @modules java.base/jdk.internal.misc - * @run main/othervm -ea -Diters=200 -Xint AllocateUninitializedArray - * @run main/othervm -ea -Diters=30000 -XX:TieredStopAtLevel=1 AllocateUninitializedArray - * @run main/othervm -ea -Diters=30000 -XX:TieredStopAtLevel=4 AllocateUninitializedArray + * + * @run main/othervm -ea -Diters=200 -Xint + * compiler.intrinsics.unsafe.AllocateUninitializedArray + * @run main/othervm -ea -Diters=30000 -XX:TieredStopAtLevel=1 + * compiler.intrinsics.unsafe.AllocateUninitializedArray + * @run main/othervm -ea -Diters=30000 -XX:TieredStopAtLevel=4 + * compiler.intrinsics.unsafe.AllocateUninitializedArray */ -import java.lang.reflect.Field; + +package compiler.intrinsics.unsafe; + import java.lang.reflect.Array; +import java.lang.reflect.Field; import java.util.concurrent.Callable; public class AllocateUninitializedArray { diff --git a/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java b/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java index 7c46ab1d555..7539aa46b26 100644 --- a/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java +++ b/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java @@ -1,249 +1,255 @@ -// -// Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. -// Copyright (c) 2015, Red Hat Inc. 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. -// -// - -import java.nio.BufferOverflowException; -import java.nio.BufferUnderflowException; -import java.nio.ByteBuffer; -import static java.nio.ByteOrder.BIG_ENDIAN; -import static java.nio.ByteOrder.LITTLE_ENDIAN; -import java.nio.ByteOrder; -import java.util.Arrays; -import java.util.Random; -import jdk.test.lib.Utils; +/* + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Red Hat Inc. 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 8026049 + * @summary Verify that byte buffers are correctly accessed. * @modules java.base/jdk.internal.misc * @library /testlibrary - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses -Djdk.test.lib.random.seed=0 HeapByteBufferTest - * @run main/othervm -Djdk.test.lib.random.seed=0 HeapByteBufferTest - * @summary Verify that byte buffers are correctly accessed. + * + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses -Djdk.test.lib.random.seed=0 + * compiler.intrinsics.unsafe.HeapByteBufferTest + * @run main/othervm -Djdk.test.lib.random.seed=0 + * compiler.intrinsics.unsafe.HeapByteBufferTest */ +package compiler.intrinsics.unsafe; + +import jdk.test.lib.Utils; + +import java.nio.BufferOverflowException; +import java.nio.BufferUnderflowException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.Arrays; +import java.util.Random; + +import static java.nio.ByteOrder.BIG_ENDIAN; +import static java.nio.ByteOrder.LITTLE_ENDIAN; + // A wrapper for a ByteBuffer which maintains a backing array and a // position. Whenever this wrapper is written the backing array and // the wrapped byte buffer are updated together, and whenever it is // read we check that the ByteBuffer and the backing array are identical. -class MyByteBuffer { - final ByteBuffer buf; - final byte[] bytes; - int pos; - ByteOrder byteOrder = BIG_ENDIAN; - - MyByteBuffer(ByteBuffer buf, byte[] bytes) { - this.buf = buf; - this.bytes = Arrays.copyOf(bytes, bytes.length); - pos = 0; - } - - public final MyByteBuffer order(ByteOrder bo) { - byteOrder = bo; - buf.order(bo); - return this; - } - - static MyByteBuffer wrap(byte[] bytes) { - return new MyByteBuffer(ByteBuffer.wrap(bytes), bytes); - } - - int capacity() { return bytes.length; } - int position() { - if (buf.position() != pos) - throw new RuntimeException(); - return buf.position(); - } - - byte[] array() { return buf.array(); } - byte[] backingArray() { return bytes; } - - private static byte long7(long x) { return (byte)(x >> 56); } - private static byte long6(long x) { return (byte)(x >> 48); } - private static byte long5(long x) { return (byte)(x >> 40); } - private static byte long4(long x) { return (byte)(x >> 32); } - private static byte long3(long x) { return (byte)(x >> 24); } - private static byte long2(long x) { return (byte)(x >> 16); } - private static byte long1(long x) { return (byte)(x >> 8); } - private static byte long0(long x) { return (byte)(x ); } - - private static byte int3(int x) { return (byte)(x >> 24); } - private static byte int2(int x) { return (byte)(x >> 16); } - private static byte int1(int x) { return (byte)(x >> 8); } - private static byte int0(int x) { return (byte)(x ); } - - private static byte short1(short x) { return (byte)(x >> 8); } - private static byte short0(short x) { return (byte)(x ); } - - byte _get(long i) { return bytes[(int)i]; } - void _put(long i, byte x) { bytes[(int)i] = x; } - - private void putLongX(long a, long x) { - if (byteOrder == BIG_ENDIAN) { - x = Long.reverseBytes(x); - } - _put(a + 7, long7(x)); - _put(a + 6, long6(x)); - _put(a + 5, long5(x)); - _put(a + 4, long4(x)); - _put(a + 3, long3(x)); - _put(a + 2, long2(x)); - _put(a + 1, long1(x)); - _put(a , long0(x)); - } - - private void putIntX(long a, int x) { - if (byteOrder == BIG_ENDIAN) { - x = Integer.reverseBytes(x); - } - _put(a + 3, int3(x)); - _put(a + 2, int2(x)); - _put(a + 1, int1(x)); - _put(a , int0(x)); - } - - private void putShortX(int bi, short x) { - if (byteOrder == BIG_ENDIAN) { - x = Short.reverseBytes(x); - } - _put(bi , short0(x)); - _put(bi + 1, short1(x)); - } - - static private int makeInt(byte b3, byte b2, byte b1, byte b0) { - return (((b3 ) << 24) | - ((b2 & 0xff) << 16) | - ((b1 & 0xff) << 8) | - ((b0 & 0xff) )); - } - int getIntX(long a) { - int x = makeInt(_get(a + 3), - _get(a + 2), - _get(a + 1), - _get(a)); - if (byteOrder == BIG_ENDIAN) { - x = Integer.reverseBytes(x); - } - return x; - } - - static private long makeLong(byte b7, byte b6, byte b5, byte b4, - byte b3, byte b2, byte b1, byte b0) - { - return ((((long)b7 ) << 56) | - (((long)b6 & 0xff) << 48) | - (((long)b5 & 0xff) << 40) | - (((long)b4 & 0xff) << 32) | - (((long)b3 & 0xff) << 24) | - (((long)b2 & 0xff) << 16) | - (((long)b1 & 0xff) << 8) | - (((long)b0 & 0xff) )); - } - - long getLongX(long a) { - long x = makeLong(_get(a + 7), - _get(a + 6), - _get(a + 5), - _get(a + 4), - _get(a + 3), - _get(a + 2), - _get(a + 1), - _get(a)); - if (byteOrder == BIG_ENDIAN) { - x = Long.reverseBytes(x); - } - return x; - } - - static private short makeShort(byte b1, byte b0) { - return (short)((b1 << 8) | (b0 & 0xff)); - } - - short getShortX(long a) { - short x = makeShort(_get(a + 1), - _get(a )); - if (byteOrder == BIG_ENDIAN) { - x = Short.reverseBytes(x); - } - return x; - } - - double getDoubleX(long a) { - long x = getLongX(a); - return Double.longBitsToDouble(x); - } - - double getFloatX(long a) { - int x = getIntX(a); - return Float.intBitsToFloat(x); - } - - void ck(long x, long y) { - if (x != y) { - throw new RuntimeException(" x = " + Long.toHexString(x) + ", y = " + Long.toHexString(y)); - } - } - - void ck(double x, double y) { - if (x == x && y == y && x != y) { - ck(x, y); - } - } - - long getLong(int i) { ck(buf.getLong(i), getLongX(i)); return buf.getLong(i); } - int getInt(int i) { ck(buf.getInt(i), getIntX(i)); return buf.getInt(i); } - short getShort(int i) { ck(buf.getShort(i), getShortX(i)); return buf.getShort(i); } - char getChar(int i) { ck(buf.getChar(i), (char)getShortX(i)); return buf.getChar(i); } - double getDouble(int i) { ck(buf.getDouble(i), getDoubleX(i)); return buf.getDouble(i); } - float getFloat(int i) { ck(buf.getFloat(i), getFloatX(i)); return buf.getFloat(i); } - - void putLong(int i, long x) { buf.putLong(i, x); putLongX(i, x); } - void putInt(int i, int x) { buf.putInt(i, x); putIntX(i, x); } - void putShort(int i, short x) { buf.putShort(i, x); putShortX(i, x); } - void putChar(int i, char x) { buf.putChar(i, x); putShortX(i, (short)x); } - void putDouble(int i, double x) { buf.putDouble(i, x); putLongX(i, Double.doubleToRawLongBits(x)); } - void putFloat(int i, float x) { buf.putFloat(i, x); putIntX(i, Float.floatToRawIntBits(x)); } - - long getLong() { ck(buf.getLong(buf.position()), getLongX(pos)); long x = buf.getLong(); pos += 8; return x; } - int getInt() { ck(buf.getInt(buf.position()), getIntX(pos)); int x = buf.getInt(); pos += 4; return x; } - short getShort() { ck(buf.getShort(buf.position()), getShortX(pos)); short x = buf.getShort(); pos += 2; return x; } - char getChar() { ck(buf.getChar(buf.position()), (char)getShortX(pos)); char x = buf.getChar(); pos += 2; return x; } - double getDouble() { ck(buf.getDouble(buf.position()), getDoubleX(pos)); double x = buf.getDouble(); pos += 8; return x; } - float getFloat() { ck(buf.getFloat(buf.position()), getFloatX(pos)); float x = buf.getFloat(); pos += 4; return x; } - - void putLong(long x) { putLongX(pos, x); pos += 8; buf.putLong(x); } - void putInt(int x) { putIntX(pos, x); pos += 4; buf.putInt(x); } - void putShort(short x) { putShortX(pos, x); pos += 2; buf.putShort(x); } - void putChar(char x) { putShortX(pos, (short)x); pos += 2; buf.putChar(x); } - void putDouble(double x) { putLongX(pos, Double.doubleToRawLongBits(x)); pos += 8; buf.putDouble(x); } - void putFloat(float x) { putIntX(pos, Float.floatToRawIntBits(x)); pos += 4; buf.putFloat(x); } - - void rewind() { pos = 0; buf.rewind(); } -} - public class HeapByteBufferTest implements Runnable { + static class MyByteBuffer { + final ByteBuffer buf; + final byte[] bytes; + int pos; + ByteOrder byteOrder = BIG_ENDIAN; + + MyByteBuffer(ByteBuffer buf, byte[] bytes) { + this.buf = buf; + this.bytes = Arrays.copyOf(bytes, bytes.length); + pos = 0; + } + + public final MyByteBuffer order(ByteOrder bo) { + byteOrder = bo; + buf.order(bo); + return this; + } + + static MyByteBuffer wrap(byte[] bytes) { + return new MyByteBuffer(ByteBuffer.wrap(bytes), bytes); + } + + int capacity() { return bytes.length; } + int position() { + if (buf.position() != pos) + throw new RuntimeException(); + return buf.position(); + } + + byte[] array() { return buf.array(); } + byte[] backingArray() { return bytes; } + + private static byte long7(long x) { return (byte)(x >> 56); } + private static byte long6(long x) { return (byte)(x >> 48); } + private static byte long5(long x) { return (byte)(x >> 40); } + private static byte long4(long x) { return (byte)(x >> 32); } + private static byte long3(long x) { return (byte)(x >> 24); } + private static byte long2(long x) { return (byte)(x >> 16); } + private static byte long1(long x) { return (byte)(x >> 8); } + private static byte long0(long x) { return (byte)(x ); } + + private static byte int3(int x) { return (byte)(x >> 24); } + private static byte int2(int x) { return (byte)(x >> 16); } + private static byte int1(int x) { return (byte)(x >> 8); } + private static byte int0(int x) { return (byte)(x ); } + + private static byte short1(short x) { return (byte)(x >> 8); } + private static byte short0(short x) { return (byte)(x ); } + + byte _get(long i) { return bytes[(int)i]; } + void _put(long i, byte x) { bytes[(int)i] = x; } + + private void putLongX(long a, long x) { + if (byteOrder == BIG_ENDIAN) { + x = Long.reverseBytes(x); + } + _put(a + 7, long7(x)); + _put(a + 6, long6(x)); + _put(a + 5, long5(x)); + _put(a + 4, long4(x)); + _put(a + 3, long3(x)); + _put(a + 2, long2(x)); + _put(a + 1, long1(x)); + _put(a , long0(x)); + } + + private void putIntX(long a, int x) { + if (byteOrder == BIG_ENDIAN) { + x = Integer.reverseBytes(x); + } + _put(a + 3, int3(x)); + _put(a + 2, int2(x)); + _put(a + 1, int1(x)); + _put(a , int0(x)); + } + + private void putShortX(int bi, short x) { + if (byteOrder == BIG_ENDIAN) { + x = Short.reverseBytes(x); + } + _put(bi , short0(x)); + _put(bi + 1, short1(x)); + } + + static private int makeInt(byte b3, byte b2, byte b1, byte b0) { + return (((b3 ) << 24) | + ((b2 & 0xff) << 16) | + ((b1 & 0xff) << 8) | + ((b0 & 0xff) )); + } + int getIntX(long a) { + int x = makeInt(_get(a + 3), + _get(a + 2), + _get(a + 1), + _get(a)); + if (byteOrder == BIG_ENDIAN) { + x = Integer.reverseBytes(x); + } + return x; + } + + static private long makeLong(byte b7, byte b6, byte b5, byte b4, + byte b3, byte b2, byte b1, byte b0) + { + return ((((long)b7 ) << 56) | + (((long)b6 & 0xff) << 48) | + (((long)b5 & 0xff) << 40) | + (((long)b4 & 0xff) << 32) | + (((long)b3 & 0xff) << 24) | + (((long)b2 & 0xff) << 16) | + (((long)b1 & 0xff) << 8) | + (((long)b0 & 0xff) )); + } + + long getLongX(long a) { + long x = makeLong(_get(a + 7), + _get(a + 6), + _get(a + 5), + _get(a + 4), + _get(a + 3), + _get(a + 2), + _get(a + 1), + _get(a)); + if (byteOrder == BIG_ENDIAN) { + x = Long.reverseBytes(x); + } + return x; + } + + static private short makeShort(byte b1, byte b0) { + return (short)((b1 << 8) | (b0 & 0xff)); + } + + short getShortX(long a) { + short x = makeShort(_get(a + 1), + _get(a )); + if (byteOrder == BIG_ENDIAN) { + x = Short.reverseBytes(x); + } + return x; + } + + double getDoubleX(long a) { + long x = getLongX(a); + return Double.longBitsToDouble(x); + } + + double getFloatX(long a) { + int x = getIntX(a); + return Float.intBitsToFloat(x); + } + + void ck(long x, long y) { + if (x != y) { + throw new RuntimeException(" x = " + Long.toHexString(x) + ", y = " + Long.toHexString(y)); + } + } + + void ck(double x, double y) { + if (x == x && y == y && x != y) { + ck(x, y); + } + } + + long getLong(int i) { ck(buf.getLong(i), getLongX(i)); return buf.getLong(i); } + int getInt(int i) { ck(buf.getInt(i), getIntX(i)); return buf.getInt(i); } + short getShort(int i) { ck(buf.getShort(i), getShortX(i)); return buf.getShort(i); } + char getChar(int i) { ck(buf.getChar(i), (char)getShortX(i)); return buf.getChar(i); } + double getDouble(int i) { ck(buf.getDouble(i), getDoubleX(i)); return buf.getDouble(i); } + float getFloat(int i) { ck(buf.getFloat(i), getFloatX(i)); return buf.getFloat(i); } + + void putLong(int i, long x) { buf.putLong(i, x); putLongX(i, x); } + void putInt(int i, int x) { buf.putInt(i, x); putIntX(i, x); } + void putShort(int i, short x) { buf.putShort(i, x); putShortX(i, x); } + void putChar(int i, char x) { buf.putChar(i, x); putShortX(i, (short)x); } + void putDouble(int i, double x) { buf.putDouble(i, x); putLongX(i, Double.doubleToRawLongBits(x)); } + void putFloat(int i, float x) { buf.putFloat(i, x); putIntX(i, Float.floatToRawIntBits(x)); } + + long getLong() { ck(buf.getLong(buf.position()), getLongX(pos)); long x = buf.getLong(); pos += 8; return x; } + int getInt() { ck(buf.getInt(buf.position()), getIntX(pos)); int x = buf.getInt(); pos += 4; return x; } + short getShort() { ck(buf.getShort(buf.position()), getShortX(pos)); short x = buf.getShort(); pos += 2; return x; } + char getChar() { ck(buf.getChar(buf.position()), (char)getShortX(pos)); char x = buf.getChar(); pos += 2; return x; } + double getDouble() { ck(buf.getDouble(buf.position()), getDoubleX(pos)); double x = buf.getDouble(); pos += 8; return x; } + float getFloat() { ck(buf.getFloat(buf.position()), getFloatX(pos)); float x = buf.getFloat(); pos += 4; return x; } + + void putLong(long x) { putLongX(pos, x); pos += 8; buf.putLong(x); } + void putInt(int x) { putIntX(pos, x); pos += 4; buf.putInt(x); } + void putShort(short x) { putShortX(pos, x); pos += 2; buf.putShort(x); } + void putChar(char x) { putShortX(pos, (short)x); pos += 2; buf.putChar(x); } + void putDouble(double x) { putLongX(pos, Double.doubleToRawLongBits(x)); pos += 8; buf.putDouble(x); } + void putFloat(float x) { putIntX(pos, Float.floatToRawIntBits(x)); pos += 4; buf.putFloat(x); } + + void rewind() { pos = 0; buf.rewind(); } + } Random random = Utils.getRandomInstance(); MyByteBuffer data = MyByteBuffer.wrap(new byte[1024]); diff --git a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java index 78ef24a9338..7830744feb5 100644 --- a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java +++ b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java @@ -25,16 +25,18 @@ /** * @test * @bug 8142386 + * @summary Unsafe access to an array is wrongly marked as mismatched * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib - * @summary Unsafe access to an array is wrongly marked as mismatched - * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:-TieredCompilation TestUnsafeMismatchedArrayFieldAccess * + * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:-TieredCompilation + * compiler.intrinsics.unsafe.TestUnsafeMismatchedArrayFieldAccess */ -import java.lang.reflect.*; -import jdk.test.lib.Utils; +package compiler.intrinsics.unsafe; + import jdk.internal.misc.Unsafe; +import jdk.test.lib.Utils; public class TestUnsafeMismatchedArrayFieldAccess { diff --git a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java index d1ca58c35bb..7fbd7189383 100644 --- a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java +++ b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java @@ -27,14 +27,20 @@ * @bug 8136473 * @summary Mismatched stores on same slice possible with Unsafe.Put*Unaligned methods * @modules java.base/jdk.internal.misc - * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation TestUnsafeUnalignedMismatchedAccesses - * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses TestUnsafeUnalignedMismatchedAccesses * + * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation + * compiler.intrinsics.unsafe.TestUnsafeUnalignedMismatchedAccesses + * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation + * -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses + * compiler.intrinsics.unsafe.TestUnsafeUnalignedMismatchedAccesses */ -import java.lang.reflect.*; +package compiler.intrinsics.unsafe; + import jdk.internal.misc.Unsafe; +import java.lang.reflect.Field; + public class TestUnsafeUnalignedMismatchedAccesses { private static final Unsafe UNSAFE; diff --git a/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java b/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java index 75997811d5d..faa5a0bde69 100644 --- a/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java +++ b/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java @@ -26,12 +26,15 @@ * @bug 6653795 * @summary C2 intrinsic for Unsafe.getAddress performs pointer sign extension on 32-bit systems * @modules java.base/jdk.internal.misc - * @run main UnsafeGetAddressTest * + * @run main compiler.intrinsics.unsafe.UnsafeGetAddressTest */ +package compiler.intrinsics.unsafe; + import jdk.internal.misc.Unsafe; -import java.lang.reflect.*; + +import java.lang.reflect.Field; public class UnsafeGetAddressTest { private static Unsafe unsafe; diff --git a/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java b/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java index 224d22ca42c..458e4053492 100644 --- a/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java +++ b/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java @@ -27,9 +27,13 @@ * @bug 8143930 * @summary C1 LinearScan asserts when compiling two back-to-back CompareAndSwapLongs * @modules java.base/jdk.internal.misc - * @run testng/othervm -Diters=200000 -XX:TieredStopAtLevel=1 UnsafeTwoCASLong + * + * @run testng/othervm -Diters=200000 -XX:TieredStopAtLevel=1 + * compiler.intrinsics.unsafe.UnsafeTwoCASLong */ +package compiler.intrinsics.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/intrinsics/adler32/TestAdler32.java b/hotspot/test/compiler/intrinsics/zip/TestAdler32.java similarity index 98% rename from hotspot/test/compiler/intrinsics/adler32/TestAdler32.java rename to hotspot/test/compiler/intrinsics/zip/TestAdler32.java index 7607cb2ec9e..6688e963a5c 100644 --- a/hotspot/test/compiler/intrinsics/adler32/TestAdler32.java +++ b/hotspot/test/compiler/intrinsics/zip/TestAdler32.java @@ -26,12 +26,14 @@ * @bug 8132081 * @summary C2 support for Adler32 on SPARC * - * @run main/othervm/timeout=600 -Xbatch TestAdler32 -m + * @run main/othervm/timeout=600 -Xbatch compiler.intrinsics.zip.TestAdler32 -m */ +package compiler.intrinsics.zip; + import java.nio.ByteBuffer; -import java.util.zip.Checksum; import java.util.zip.Adler32; +import java.util.zip.Checksum; public class TestAdler32 { public static void main(String[] args) { diff --git a/hotspot/test/compiler/intrinsics/crc32/TestCRC32.java b/hotspot/test/compiler/intrinsics/zip/TestCRC32.java similarity index 98% rename from hotspot/test/compiler/intrinsics/crc32/TestCRC32.java rename to hotspot/test/compiler/intrinsics/zip/TestCRC32.java index f7ecc241508..626f506e48c 100644 --- a/hotspot/test/compiler/intrinsics/crc32/TestCRC32.java +++ b/hotspot/test/compiler/intrinsics/zip/TestCRC32.java @@ -26,12 +26,14 @@ * @bug 8143012 * @summary CRC32 Intrinsics support on SPARC * - * @run main/othervm/timeout=720 -Xbatch TestCRC32 -m + * @run main/othervm/timeout=720 -Xbatch compiler.intrinsics.zip.TestCRC32 -m */ +package compiler.intrinsics.zip; + import java.nio.ByteBuffer; -import java.util.zip.Checksum; import java.util.zip.CRC32; +import java.util.zip.Checksum; public class TestCRC32 { public static void main(String[] args) { diff --git a/hotspot/test/compiler/intrinsics/crc32c/TestCRC32C.java b/hotspot/test/compiler/intrinsics/zip/TestCRC32C.java similarity index 98% rename from hotspot/test/compiler/intrinsics/crc32c/TestCRC32C.java rename to hotspot/test/compiler/intrinsics/zip/TestCRC32C.java index 676f541937c..2f280aa1254 100644 --- a/hotspot/test/compiler/intrinsics/crc32c/TestCRC32C.java +++ b/hotspot/test/compiler/intrinsics/zip/TestCRC32C.java @@ -26,12 +26,14 @@ * @bug 8073583 * @summary C2 support for CRC32C on SPARC * - * @run main/othervm/timeout=600 -Xbatch TestCRC32C -m + * @run main/othervm/timeout=600 -Xbatch compiler.intrinsics.zip.TestCRC32C -m */ +package compiler.intrinsics.zip; + import java.nio.ByteBuffer; -import java.util.zip.Checksum; import java.util.zip.CRC32C; +import java.util.zip.Checksum; public class TestCRC32C { public static void main(String[] args) { diff --git a/hotspot/test/compiler/jsr292/CallSiteDepContextTest.java b/hotspot/test/compiler/jsr292/CallSiteDepContextTest.java index 152b28dd2f1..80650b97136 100644 --- a/hotspot/test/compiler/jsr292/CallSiteDepContextTest.java +++ b/hotspot/test/compiler/jsr292/CallSiteDepContextTest.java @@ -25,16 +25,23 @@ * @test * @bug 8057967 * @modules java.base/jdk.internal.misc - * @modules java.base/jdk.internal.org.objectweb.asm - * @library patches + * java.base/jdk.internal.org.objectweb.asm + * @library patches / + * * @build java.base/java.lang.invoke.MethodHandleHelper * @run main/bootclasspath/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -Xlog:class+unload * -XX:+PrintCompilation -XX:+TraceDependencies -XX:+TraceReferenceGC - * -verbose:gc compiler.jsr292.CallSiteDepContextTest + * -verbose:gc + * compiler.jsr292.CallSiteDepContextTest */ package compiler.jsr292; +import jdk.internal.misc.Unsafe; +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.Handle; +import jdk.internal.org.objectweb.asm.MethodVisitor; + import java.lang.invoke.CallSite; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandleHelper; @@ -46,10 +53,11 @@ import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.lang.reflect.Field; -import jdk.internal.org.objectweb.asm.*; -import jdk.internal.misc.Unsafe; - -import static jdk.internal.org.objectweb.asm.Opcodes.*; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER; +import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC; +import static jdk.internal.org.objectweb.asm.Opcodes.IRETURN; public class CallSiteDepContextTest { static final Unsafe UNSAFE = Unsafe.getUnsafe(); diff --git a/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java b/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java index cf591ff7218..c1f92ef097c 100644 --- a/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java +++ b/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java @@ -25,12 +25,17 @@ * @test * @bug 8022595 * @summary JSR292: deadlock during class loading of MethodHandles, MethodHandleImpl & MethodHandleNatives - * @library /testlibrary + * @library /testlibrary / * @modules java.base/jdk.internal.misc * java.management - * @run main/othervm ConcurrentClassLoadingTest + * + * @run main/othervm compiler.jsr292.ConcurrentClassLoadingTest */ + +package compiler.jsr292; + import jdk.test.lib.Utils; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java b/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java index 3b009e9c0d0..f932b627186 100644 --- a/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java +++ b/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java @@ -24,11 +24,21 @@ /** * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary - * @run main ContinuousCallSiteTargetChange + * @library /testlibrary / + * + * @run driver compiler.jsr292.ContinuousCallSiteTargetChange */ -import java.lang.invoke.*; -import jdk.test.lib.*; + +package compiler.jsr292; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; + +import java.lang.invoke.CallSite; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.lang.invoke.MutableCallSite; public class ContinuousCallSiteTargetChange { static void testServer() throws Exception { @@ -37,7 +47,7 @@ public class ContinuousCallSiteTargetChange { "-server", "-XX:-TieredCompilation", "-Xbatch", "-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10", "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining", - "ContinuousCallSiteTargetChange$Test", "100"); + Test.class.getName(), "100"); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); @@ -53,7 +63,7 @@ public class ContinuousCallSiteTargetChange { "-client", "-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1", "-Xbatch", "-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10", "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining", - "ContinuousCallSiteTargetChange$Test", "100"); + Test.class.getName(), "100"); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); diff --git a/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java b/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java index 85810645833..aa7102bcef3 100644 --- a/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java +++ b/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java @@ -27,14 +27,17 @@ * @bug 8026124 * @summary Javascript file provoked assertion failure in linkResolver.cpp * @modules jdk.scripting.nashorn/jdk.nashorn.tools - * @run main/othervm CreatesInterfaceDotEqualsCallInfo + * + * @run main/othervm compiler.jsr292.CreatesInterfaceDotEqualsCallInfo */ +package compiler.jsr292; + public class CreatesInterfaceDotEqualsCallInfo { - public static void main(String[] args) throws java.io.IOException { - String[] jsargs = { System.getProperty("test.src", ".") + - "/createsInterfaceDotEqualsCallInfo.js" }; - jdk.nashorn.tools.Shell.main(System.in, System.out, System.err, jsargs); - System.out.println("PASS, did not crash running Javascript"); - } + public static void main(String[] args) throws java.io.IOException { + String[] jsargs = {System.getProperty("test.src", ".") + + "/createsInterfaceDotEqualsCallInfo.js"}; + jdk.nashorn.tools.Shell.main(System.in, System.out, System.err, jsargs); + System.out.println("PASS, did not crash running Javascript"); + } } diff --git a/hotspot/test/compiler/jsr292/InvokerGC.java b/hotspot/test/compiler/jsr292/InvokerGC.java index bcd63dd4857..b1b1cd831d5 100644 --- a/hotspot/test/compiler/jsr292/InvokerGC.java +++ b/hotspot/test/compiler/jsr292/InvokerGC.java @@ -25,16 +25,22 @@ * @test * @bug 8067247 * @modules java.base/jdk.internal.misc - * @library /test/lib / + * @library /test/lib + * * @run main/bootclasspath/othervm -Xcomp -Xbatch - * -XX:CompileCommand=compileonly,InvokerGC::test * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * InvokerGC + * -XX:CompileCommand=compileonly,compiler.jsr292.InvokerGC::test + * compiler.jsr292.InvokerGC */ -import java.lang.invoke.*; +package compiler.jsr292; + import sun.hotspot.WhiteBox; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; + public class InvokerGC { static final WhiteBox WB = WhiteBox.getWhiteBox(); diff --git a/hotspot/test/compiler/jsr292/LongReferenceCastingTest.java b/hotspot/test/compiler/jsr292/LongReferenceCastingTest.java index 218b096d2b7..95123938d95 100644 --- a/hotspot/test/compiler/jsr292/LongReferenceCastingTest.java +++ b/hotspot/test/compiler/jsr292/LongReferenceCastingTest.java @@ -22,14 +22,20 @@ * */ -import java.lang.invoke.*; - /** * @test * @bug 8148752 * @summary Test correct casting of MH arguments during inlining. - * @run main LongReferenceCastingTest + * + * @run main compiler.jsr292.LongReferenceCastingTest */ + +package compiler.jsr292; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; + public class LongReferenceCastingTest { static final String MY_STRING = "myString"; static final MethodHandle MH; diff --git a/hotspot/test/compiler/jsr292/MHInlineTest.java b/hotspot/test/compiler/jsr292/MHInlineTest.java index 915c8f1362d..c13146fa34d 100644 --- a/hotspot/test/compiler/jsr292/MHInlineTest.java +++ b/hotspot/test/compiler/jsr292/MHInlineTest.java @@ -26,12 +26,21 @@ * @bug 8062280 * @summary C2: inlining failure due to access checks being too strict * @modules java.base/jdk.internal.misc - * @library /testlibrary - * @run main/othervm MHInlineTest + * @library /testlibrary / + * + * @run main/othervm compiler.jsr292.MHInlineTest */ -import java.lang.invoke.*; -import jdk.test.lib.*; -import static jdk.test.lib.Asserts.*; + +package compiler.jsr292; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; + +import static jdk.test.lib.Asserts.assertEquals; public class MHInlineTest { public static void main(String[] args) throws Exception { @@ -39,8 +48,8 @@ public class MHInlineTest { "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", "-server", "-XX:-TieredCompilation", "-Xbatch", "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining", - "-XX:CompileCommand=dontinline,MHInlineTest::test*", - "MHInlineTest$Launcher"); + "-XX:CompileCommand=dontinline,compiler.jsr292.MHInlineTest::test*", + Launcher.class.getName()); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); @@ -48,13 +57,13 @@ public class MHInlineTest { // The test is applicable only to C2 (present in Server VM). if (analyzer.getStderr().contains("Server VM")) { - analyzer.shouldContain("MHInlineTest$B::public_x (3 bytes) inline (hot)"); - analyzer.shouldContain("MHInlineTest$B::protected_x (3 bytes) inline (hot)"); - analyzer.shouldContain("MHInlineTest$B::package_x (3 bytes) inline (hot)"); - analyzer.shouldContain("MHInlineTest$A::package_final_x (3 bytes) inline (hot)"); - analyzer.shouldContain("MHInlineTest$B::private_x (3 bytes) inline (hot)"); - analyzer.shouldContain("MHInlineTest$B::private_static_x (3 bytes) inline (hot)"); - analyzer.shouldContain("MHInlineTest$A::package_static_x (3 bytes) inline (hot)"); + analyzer.shouldContain("compiler.jsr292.MHInlineTest$B::public_x (3 bytes) inline (hot)"); + analyzer.shouldContain("compiler.jsr292.MHInlineTest$B::protected_x (3 bytes) inline (hot)"); + analyzer.shouldContain("compiler.jsr292.MHInlineTest$B::package_x (3 bytes) inline (hot)"); + analyzer.shouldContain("compiler.jsr292.MHInlineTest$A::package_final_x (3 bytes) inline (hot)"); + analyzer.shouldContain("compiler.jsr292.MHInlineTest$B::private_x (3 bytes) inline (hot)"); + analyzer.shouldContain("compiler.jsr292.MHInlineTest$B::private_static_x (3 bytes) inline (hot)"); + analyzer.shouldContain("compiler.jsr292.MHInlineTest$A::package_static_x (3 bytes) inline (hot)"); } } diff --git a/hotspot/test/compiler/jsr292/NonInlinedCall/Agent.java b/hotspot/test/compiler/jsr292/NonInlinedCall/Agent.java index e9f2f46a8f4..93540ea0eab 100644 --- a/hotspot/test/compiler/jsr292/NonInlinedCall/Agent.java +++ b/hotspot/test/compiler/jsr292/NonInlinedCall/Agent.java @@ -23,13 +23,13 @@ package compiler.jsr292.NonInlinedCall; +import jdk.test.lib.JDKToolLauncher; +import jdk.test.lib.OutputAnalyzer; + import java.io.File; import java.io.PrintStream; import java.util.Arrays; -import jdk.test.lib.JDKToolLauncher; -import jdk.test.lib.OutputAnalyzer; - public class Agent { public static void main(String[] args) throws Exception { String jarName = args[0]; diff --git a/hotspot/test/compiler/jsr292/NonInlinedCall/GCTest.java b/hotspot/test/compiler/jsr292/NonInlinedCall/GCTest.java index 3a93fe7d96e..02b06fa78d4 100644 --- a/hotspot/test/compiler/jsr292/NonInlinedCall/GCTest.java +++ b/hotspot/test/compiler/jsr292/NonInlinedCall/GCTest.java @@ -26,7 +26,8 @@ * @bug 8072008 * @library /testlibrary /test/lib ../patches * @modules java.base/jdk.internal.misc - * @modules java.base/jdk.internal.vm.annotation + * java.base/jdk.internal.vm.annotation + * * @build java.base/java.lang.invoke.MethodHandleHelper * @build sun.hotspot.WhiteBox * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions @@ -38,22 +39,20 @@ package compiler.jsr292.NonInlinedCall; +import jdk.internal.vm.annotation.DontInline; +import jdk.internal.vm.annotation.Stable; +import sun.hotspot.WhiteBox; + +import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandleHelper; import java.lang.invoke.MethodHandleHelper.NonInlinedReinvoker; import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodHandle; - import java.lang.invoke.MethodType; import java.lang.ref.PhantomReference; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; -import jdk.internal.vm.annotation.DontInline; -import jdk.internal.vm.annotation.Stable; - -import sun.hotspot.WhiteBox; - -import static jdk.test.lib.Asserts.*; +import static jdk.test.lib.Asserts.assertEquals; public class GCTest { static final MethodHandles.Lookup LOOKUP = MethodHandleHelper.IMPL_LOOKUP; diff --git a/hotspot/test/compiler/jsr292/NonInlinedCall/InvokeTest.java b/hotspot/test/compiler/jsr292/NonInlinedCall/InvokeTest.java index d413d382eef..15ca369a2bb 100644 --- a/hotspot/test/compiler/jsr292/NonInlinedCall/InvokeTest.java +++ b/hotspot/test/compiler/jsr292/NonInlinedCall/InvokeTest.java @@ -26,10 +26,11 @@ * @bug 8072008 * @library /testlibrary /test/lib / ../patches * @modules java.base/jdk.internal.misc - * @modules java.base/jdk.internal.vm.annotation + * java.base/jdk.internal.vm.annotation + * * @build java.base/java.lang.invoke.MethodHandleHelper - * @build sun.hotspot.WhiteBox - * @build compiler.jsr292.NonInlinedCall.InvokeTest + * sun.hotspot.WhiteBox + * compiler.jsr292.NonInlinedCall.InvokeTest * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1 @@ -38,17 +39,16 @@ package compiler.jsr292.NonInlinedCall; +import jdk.internal.vm.annotation.DontInline; +import sun.hotspot.WhiteBox; + import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandleHelper; import java.lang.invoke.MethodHandleHelper.NonInlinedReinvoker; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; -import jdk.internal.vm.annotation.DontInline; - -import sun.hotspot.WhiteBox; - -import static jdk.test.lib.Asserts.*; +import static jdk.test.lib.Asserts.assertEquals; public class InvokeTest { static MethodHandles.Lookup LOOKUP = MethodHandleHelper.IMPL_LOOKUP; diff --git a/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java b/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java index e771f96e24c..dbd9f927478 100644 --- a/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java +++ b/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java @@ -31,8 +31,8 @@ * @requires vm.flavor != "minimal" * * @build sun.hotspot.WhiteBox - * @build java.base/java.lang.invoke.MethodHandleHelper - * @build compiler.jsr292.NonInlinedCall.RedefineTest + * java.base/java.lang.invoke.MethodHandleHelper + * compiler.jsr292.NonInlinedCall.RedefineTest * @run driver compiler.jsr292.NonInlinedCall.Agent * agent.jar * compiler.jsr292.NonInlinedCall.RedefineTest @@ -48,20 +48,23 @@ package compiler.jsr292.NonInlinedCall; +import jdk.internal.misc.Unsafe; +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.MethodVisitor; +import jdk.internal.vm.annotation.DontInline; import sun.hotspot.WhiteBox; import java.lang.instrument.ClassDefinition; import java.lang.instrument.Instrumentation; import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandleHelper; +import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; -import jdk.internal.misc.Unsafe; -import jdk.internal.vm.annotation.DontInline; -import jdk.internal.org.objectweb.asm.*; - -import static jdk.internal.org.objectweb.asm.Opcodes.*; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER; +import static jdk.internal.org.objectweb.asm.Opcodes.IRETURN; public class RedefineTest { static final MethodHandles.Lookup LOOKUP = MethodHandleHelper.IMPL_LOOKUP; diff --git a/hotspot/test/compiler/jsr292/NullConstantReceiver.java b/hotspot/test/compiler/jsr292/NullConstantReceiver.java index 067c620f29f..42c2b879dd2 100644 --- a/hotspot/test/compiler/jsr292/NullConstantReceiver.java +++ b/hotspot/test/compiler/jsr292/NullConstantReceiver.java @@ -24,9 +24,12 @@ /** * @test * @bug 8059556 - * @run main/othervm -Xbatch NullConstantReceiver + * + * @run main/othervm -Xbatch compiler.jsr292.NullConstantReceiver */ +package compiler.jsr292; + import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; diff --git a/hotspot/test/compiler/jsr292/PollutedTrapCounts.java b/hotspot/test/compiler/jsr292/PollutedTrapCounts.java index b368b2f7c77..9090513567b 100644 --- a/hotspot/test/compiler/jsr292/PollutedTrapCounts.java +++ b/hotspot/test/compiler/jsr292/PollutedTrapCounts.java @@ -26,10 +26,18 @@ * @bug 8074551 * @modules java.base/jdk.internal.misc * @library /testlibrary - * @run main PollutedTrapCounts + * + * @run driver compiler.jsr292.PollutedTrapCounts */ -import java.lang.invoke.*; -import jdk.test.lib.*; + +package compiler.jsr292; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; public class PollutedTrapCounts { public static void main(String[] args) throws Exception { @@ -38,7 +46,7 @@ public class PollutedTrapCounts { "-XX:-TieredCompilation", "-Xbatch", "-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10", "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining", - "PollutedTrapCounts$Test"); + Test.class.getName()); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); diff --git a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java index cf20e8f472b..a8d142e9b69 100644 --- a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java +++ b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java @@ -25,27 +25,42 @@ * @test * @bug 8042235 * @summary redefining method used by multiple MethodHandles crashes VM + * @library / * @modules java.base/jdk.internal.org.objectweb.asm * java.compiler * java.instrument * java.management - * @compile -XDignore.symbol.file RedefineMethodUsedByMultipleMethodHandles.java - * @run main/othervm RedefineMethodUsedByMultipleMethodHandles + * + * @run main/othervm compiler.jsr292.RedefineMethodUsedByMultipleMethodHandles */ -import java.io.*; -import java.lang.instrument.*; -import java.lang.invoke.*; +package compiler.jsr292; + +import jdk.internal.org.objectweb.asm.ClassReader; +import jdk.internal.org.objectweb.asm.ClassVisitor; +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.MethodVisitor; +import jdk.internal.org.objectweb.asm.Opcodes; + +import javax.tools.ToolProvider; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.lang.instrument.ClassFileTransformer; +import java.lang.instrument.IllegalClassFormatException; +import java.lang.instrument.Instrumentation; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles.Lookup; -import java.lang.management.*; -import java.lang.reflect.*; -import java.nio.file.*; -import java.security.*; -import java.util.jar.*; - -import javax.tools.*; - -import jdk.internal.org.objectweb.asm.*; +import java.lang.management.ManagementFactory; +import java.lang.reflect.Method; +import java.nio.file.Files; +import java.nio.file.Path; +import java.security.ProtectionDomain; +import java.util.jar.Attributes; +import java.util.jar.JarEntry; +import java.util.jar.JarOutputStream; +import java.util.jar.Manifest; public class RedefineMethodUsedByMultipleMethodHandles { diff --git a/hotspot/test/compiler/jsr292/7082949/Test7082949.java b/hotspot/test/compiler/jsr292/Test7082949.java similarity index 89% rename from hotspot/test/compiler/jsr292/7082949/Test7082949.java rename to hotspot/test/compiler/jsr292/Test7082949.java index 41b79114f62..b699ba51e60 100644 --- a/hotspot/test/compiler/jsr292/7082949/Test7082949.java +++ b/hotspot/test/compiler/jsr292/Test7082949.java @@ -27,12 +27,15 @@ * @bug 7082949 * @summary JSR 292: missing ResourceMark in methodOopDesc::make_invoke_method * - * @run main Test7082949 + * @run main compiler.jsr292.Test7082949 */ -import java.lang.invoke.*; -import static java.lang.invoke.MethodHandles.*; -import static java.lang.invoke.MethodType.*; +package compiler.jsr292; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; + +import static java.lang.invoke.MethodType.methodType; public class Test7082949 implements Runnable { public static void main(String... args) throws Throwable { diff --git a/hotspot/test/compiler/jsr292/VMAnonymousClasses.java b/hotspot/test/compiler/jsr292/VMAnonymousClasses.java index abb9b5dc591..c79deeb79d1 100644 --- a/hotspot/test/compiler/jsr292/VMAnonymousClasses.java +++ b/hotspot/test/compiler/jsr292/VMAnonymousClasses.java @@ -26,13 +26,16 @@ * @bug 8058828 * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.misc - * @run main/bootclasspath/othervm -Xbatch VMAnonymousClasses + * + * @run main/bootclasspath/othervm -Xbatch compiler.jsr292.VMAnonymousClasses */ +package compiler.jsr292; + +import jdk.internal.misc.Unsafe; import jdk.internal.org.objectweb.asm.ClassWriter; import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.internal.org.objectweb.asm.Opcodes; -import jdk.internal.misc.Unsafe; import java.lang.invoke.ConstantCallSite; import java.lang.invoke.MethodHandle; diff --git a/hotspot/test/compiler/jsr292/6990212/Test6990212.java b/hotspot/test/compiler/jsr292/cr6990212/Test6990212.java similarity index 90% rename from hotspot/test/compiler/jsr292/6990212/Test6990212.java rename to hotspot/test/compiler/jsr292/cr6990212/Test6990212.java index bdb28c5ee9d..e9cd8c8d793 100644 --- a/hotspot/test/compiler/jsr292/6990212/Test6990212.java +++ b/hotspot/test/compiler/jsr292/cr6990212/Test6990212.java @@ -27,10 +27,14 @@ * @bug 6990212 * @summary JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods * - * @run main Test6990212 + * @run main compiler.jsr292.cr6990212.Test6990212 */ -import java.lang.invoke.*; +package compiler.jsr292.cr6990212; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; interface intf { public Object target(); diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/ByteClassLoader.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/ByteClassLoader.java index 3903f6f160c..c9b572b5bc0 100644 --- a/hotspot/test/compiler/jsr292/methodHandleExceptions/ByteClassLoader.java +++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/ByteClassLoader.java @@ -1,12 +1,3 @@ -import java.io.BufferedOutputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.jar.JarEntry; -import java.util.jar.JarOutputStream; - /* * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,6 +22,17 @@ import java.util.jar.JarOutputStream; * */ +package compiler.jsr292.methodHandleExceptions; + +import java.io.BufferedOutputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.jar.JarEntry; +import java.util.jar.JarOutputStream; + /** * A ByteClassLoader is used to define classes from collections of bytes, as * well as loading classes in the usual way. It includes options to write the diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java index 93fe9bddeb5..a00e6abf11a 100644 --- a/hotspot/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java +++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java @@ -21,28 +21,47 @@ * questions. * */ -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; + +/** + * @test + * @bug 8025260 8016839 + * @summary Ensure that AbstractMethodError and IllegalAccessError are thrown appropriately, not NullPointerException + * @modules java.base/jdk.internal.org.objectweb.asm + * @library / . + * + * @build p.* + * @run main/othervm compiler.jsr292.methodHandleExceptions.TestAMEnotNPE + * @run main/othervm -Xint compiler.jsr292.methodHandleExceptions.TestAMEnotNPE + * @run main/othervm -Xcomp compiler.jsr292.methodHandleExceptions.TestAMEnotNPE + */ + +package compiler.jsr292.methodHandleExceptions; + +import p.Dok; import jdk.internal.org.objectweb.asm.ClassWriter; import jdk.internal.org.objectweb.asm.Handle; import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.internal.org.objectweb.asm.Opcodes; -import p.Dok; -/** - * @test @bug 8025260 8016839 - * @summary Ensure that AbstractMethodError and IllegalAccessError are thrown appropriately, not NullPointerException - * - * @modules java.base/jdk.internal.org.objectweb.asm - * @compile -XDignore.symbol.file TestAMEnotNPE.java ByteClassLoader.java p/C.java p/Dok.java p/E.java p/F.java p/I.java p/Tdirect.java p/Treflect.java - * - * @run main/othervm TestAMEnotNPE - * @run main/othervm -Xint TestAMEnotNPE - * @run main/othervm -Xcomp TestAMEnotNPE - */ -public class TestAMEnotNPE implements Opcodes { +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; + +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PRIVATE; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER; +import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD; +import static jdk.internal.org.objectweb.asm.Opcodes.ILOAD; +import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESPECIAL; +import static jdk.internal.org.objectweb.asm.Opcodes.INVOKEVIRTUAL; +import static jdk.internal.org.objectweb.asm.Opcodes.IRETURN; +import static jdk.internal.org.objectweb.asm.Opcodes.LLOAD; +import static jdk.internal.org.objectweb.asm.Opcodes.RETURN; +import static jdk.internal.org.objectweb.asm.Opcodes.V1_8; + +public class TestAMEnotNPE { static boolean writeJarFiles = false; static boolean readJarFiles = false; @@ -115,7 +134,7 @@ public class TestAMEnotNPE implements Opcodes { System.out.flush(); Thread.sleep(250); // This de-interleaves output and error in Netbeans, sigh. for (Throwable th : lt) - System.err.println(th); + System.err.println(th); throw new Error("Test failed, there were " + lt.size() + " failures listed above"); } else { System.out.println("ALL PASS, HOORAY!"); @@ -191,7 +210,7 @@ public class TestAMEnotNPE implements Opcodes { * @throws Exception */ public static byte[] bytesForSomeDsubSomethingSomeAccess - (String d_name, String sub_what, int method_acc) + (String d_name, String sub_what, int method_acc) throws Exception { ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/C.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/C.java index ab0e1aa1d8d..6eddea445d0 100644 --- a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/C.java +++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/C.java @@ -30,6 +30,6 @@ package p; * an abstract method error if called. * */ -public abstract class C implements p.I { +public abstract class C implements I { public abstract int m(); } diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Dok.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Dok.java index f9fa4c2d14a..9d007012678 100644 --- a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Dok.java +++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Dok.java @@ -21,11 +21,12 @@ * questions. * */ + package p; /** * Test class -- implements I, extends E, both define m, so all should be well. */ -public class Dok extends p.E { +public class Dok extends E { } diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/E.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/E.java index 6b1f8f982e1..2211b6b0013 100644 --- a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/E.java +++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/E.java @@ -31,7 +31,7 @@ package p; * of course is NOT usually the case in this test). * */ -public abstract class E implements p.I { +public abstract class E implements I { public int m() { return 2; } diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/F.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/F.java index 86b6c65fd47..bd8dd1a0939 100644 --- a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/F.java +++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/F.java @@ -34,7 +34,7 @@ package p; * m. * */ -public abstract class F implements p.I { +public abstract class F implements I { final public int m() { return 2; } diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Tdirect.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Tdirect.java index 088e1fab22d..2a45dee5784 100644 --- a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Tdirect.java +++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Tdirect.java @@ -28,7 +28,7 @@ package p; * Invokes I.m directly using invokeInterface bytecodes. */ public class Tdirect { - public static int test(p.I i) { + public static int test(I i) { int accum = 0; for (int j = 0; j < 100000; j++) { accum += i.m(); @@ -36,7 +36,7 @@ public class Tdirect { return accum; } - public static int test(p.I ii, byte b, char c, short s, int i, long l, + public static int test(I ii, byte b, char c, short s, int i, long l, Object o1, Object o2, Object o3, Object o4, Object o5, Object o6) { int accum = 0; for (int j = 0; j < 100000; j++) { diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Treflect.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Treflect.java index a4f754aebd1..9468a2d6f39 100644 --- a/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Treflect.java +++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/p/Treflect.java @@ -21,6 +21,7 @@ * questions. * */ + package p; import java.lang.reflect.InvocationTargetException; @@ -31,9 +32,9 @@ import java.lang.reflect.Method; */ public class Treflect { - public static int test(p.I ii) throws Throwable { + public static int test(I ii) throws Throwable { int accum = 0; - Method m = p.I.class.getMethod("m"); + Method m = I.class.getMethod("m"); try { for (int j = 0; j < 100000; j++) { Object o = m.invoke(ii); @@ -45,10 +46,10 @@ public class Treflect { return accum; } - public static int test(p.I ii, byte b, char c, short s, int i, long l, + public static int test(I ii, byte b, char c, short s, int i, long l, Object o1, Object o2, Object o3, Object o4, Object o5, Object o6) throws Throwable { - Method m = p.I.class.getMethod("m", Byte.TYPE, Character.TYPE, + Method m = I.class.getMethod("m", Byte.TYPE, Character.TYPE, Short.TYPE, Integer.TYPE, Long.TYPE, Object.class, Object.class, Object.class, Object.class, Object.class, Object.class); diff --git a/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java b/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java index 57eed059a8d..28036f361a9 100644 --- a/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java +++ b/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java @@ -52,8 +52,8 @@ package compiler.jvmci; -import jdk.vm.ci.runtime.JVMCI; import jdk.test.lib.Asserts; +import jdk.vm.ci.runtime.JVMCI; public class JVM_GetJVMCIRuntimeTest implements Runnable { private static final boolean IS_POSITIVE = Boolean.getBoolean( diff --git a/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java b/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java index 22263a7f837..529f7acc6c1 100644 --- a/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java +++ b/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java @@ -56,14 +56,11 @@ package compiler.jvmci; import jdk.test.lib.Utils; -import java.lang.InternalError; -import java.lang.reflect.Constructor; + import java.security.AccessControlException; import java.security.Permission; import java.util.PropertyPermission; import java.util.function.Consumer; -import java.util.logging.Level; -import java.util.logging.Logger; public class SecurityRestrictionsTest { diff --git a/hotspot/test/compiler/jvmci/common/CTVMUtilities.java b/hotspot/test/compiler/jvmci/common/CTVMUtilities.java index 6c3301631a5..03335f6f59a 100644 --- a/hotspot/test/compiler/jvmci/common/CTVMUtilities.java +++ b/hotspot/test/compiler/jvmci/common/CTVMUtilities.java @@ -23,18 +23,6 @@ package compiler.jvmci.common; -import java.io.IOException; -import java.lang.reflect.Module; -import java.lang.reflect.Field; -import java.lang.reflect.Executable; -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.lang.reflect.Parameter; -import java.util.HashMap; -import java.util.Map; -import java.util.TreeMap; - import jdk.internal.org.objectweb.asm.ClassReader; import jdk.internal.org.objectweb.asm.ClassVisitor; import jdk.internal.org.objectweb.asm.ClassWriter; @@ -47,6 +35,18 @@ import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.lang.reflect.Executable; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.lang.reflect.Module; +import java.lang.reflect.Parameter; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + public class CTVMUtilities { /* * A method to return HotSpotResolvedJavaMethod object using class object diff --git a/hotspot/test/compiler/jvmci/common/JVMCIHelpers.java b/hotspot/test/compiler/jvmci/common/JVMCIHelpers.java index 7d9abd409dd..47164ca53af 100644 --- a/hotspot/test/compiler/jvmci/common/JVMCIHelpers.java +++ b/hotspot/test/compiler/jvmci/common/JVMCIHelpers.java @@ -23,14 +23,12 @@ package compiler.jvmci.common; -import jdk.vm.ci.code.Architecture; import jdk.vm.ci.code.CompilationRequest; import jdk.vm.ci.code.CompilationRequestResult; import jdk.vm.ci.hotspot.services.HotSpotVMEventListener; -import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.runtime.JVMCICompiler; -import jdk.vm.ci.runtime.services.JVMCICompilerFactory; import jdk.vm.ci.runtime.JVMCIRuntime; +import jdk.vm.ci.runtime.services.JVMCICompilerFactory; /* * A stub classes to be able to use jvmci diff --git a/hotspot/test/compiler/jvmci/common/patches/jdk.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java b/hotspot/test/compiler/jvmci/common/patches/jdk.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java index e35c516880d..f2b40928602 100644 --- a/hotspot/test/compiler/jvmci/common/patches/jdk.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java +++ b/hotspot/test/compiler/jvmci/common/patches/jdk.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java @@ -28,7 +28,6 @@ import jdk.vm.ci.code.InvalidInstalledCodeException; import jdk.vm.ci.code.TargetDescription; import jdk.vm.ci.meta.ConstantPool; import jdk.vm.ci.meta.ResolvedJavaMethod; -import jdk.vm.ci.meta.SpeculationLog; /** * A simple "proxy" class to get test access to CompilerToVM package-private methods diff --git a/hotspot/test/compiler/jvmci/common/testcases/TestCase.java b/hotspot/test/compiler/jvmci/common/testcases/TestCase.java index d08fe31317b..af11b039e66 100644 --- a/hotspot/test/compiler/jvmci/common/testcases/TestCase.java +++ b/hotspot/test/compiler/jvmci/common/testcases/TestCase.java @@ -25,13 +25,9 @@ package compiler.jvmci.common.testcases; import java.lang.reflect.Executable; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; -import java.util.List; -import java.util.ArrayList; import java.util.Set; /** diff --git a/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java b/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java index 952aca3ed93..e9608ee4817 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java @@ -48,22 +48,21 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; +import jdk.test.lib.Asserts; +import jdk.test.lib.Pair; +import jdk.test.lib.Utils; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; +import sun.hotspot.code.NMethod; import java.lang.reflect.Executable; import java.lang.reflect.Method; import java.util.ArrayList; -import java.util.List; import java.util.HashSet; +import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -import jdk.test.lib.Asserts; -import jdk.test.lib.Pair; -import jdk.test.lib.Utils; -import sun.hotspot.code.NMethod; - public class AllocateCompileIdTest { private static final int SOME_REPEAT_VALUE = 5; diff --git a/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java index d78a5a1a385..dea8cb2d7f4 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java @@ -48,14 +48,15 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; +import jdk.test.lib.Asserts; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; +import sun.hotspot.WhiteBox; + import java.lang.reflect.Executable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -import jdk.test.lib.Asserts; -import sun.hotspot.WhiteBox; public class CanInlineMethodTest { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java b/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java index 8bd98dc05cb..46beea77080 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java @@ -45,8 +45,8 @@ package compiler.jvmci.compilerToVM; -import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.test.lib.Asserts; +import jdk.vm.ci.hotspot.CompilerToVMHelper; public class CollectCountersTest { private static final int EXPECTED = Integer.getInteger( diff --git a/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java b/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java index fa6483cf449..697aee29904 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java @@ -26,13 +26,14 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; import compiler.testlibrary.CompilerUtils; +import jdk.test.lib.Pair; import jdk.test.lib.Utils; import jdk.vm.ci.code.InstalledCode; import sun.hotspot.WhiteBox; import sun.hotspot.code.NMethod; -import java.lang.reflect.Executable; import java.lang.reflect.Constructor; +import java.lang.reflect.Executable; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; @@ -42,7 +43,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import jdk.test.lib.Pair; /** * A test case for tests which require compiled code. diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java b/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java index d3f85000c4c..224ff9df523 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java @@ -24,15 +24,31 @@ package compiler.jvmci.compilerToVM; -import java.util.HashMap; -import java.util.Map; +import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; +import jdk.internal.reflect.ConstantPool; +import jdk.internal.reflect.ConstantPool.Tag; import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; import jdk.vm.ci.meta.ResolvedJavaMethod; import sun.hotspot.WhiteBox; -import jdk.internal.reflect.ConstantPool; -import jdk.internal.reflect.ConstantPool.Tag; -import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; -import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*; + +import java.util.HashMap; +import java.util.Map; + +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_CLASS; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_DOUBLE; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FLOAT; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTEGER; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVALID; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVOKEDYNAMIC; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_LONG; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODHANDLE; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODTYPE; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_NAMEANDTYPE; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_STRING; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_UTF8; /** * Common class for jdk.vm.ci.hotspot.CompilerToVM constant pool tests diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java b/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java index fc33560b893..f6158327296 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java @@ -27,19 +27,28 @@ import compiler.jvmci.common.testcases.MultipleAbstractImplementer; import compiler.jvmci.common.testcases.MultipleImplementer2; import compiler.jvmci.common.testcases.MultipleImplementersInterface; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes; -import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry; -import java.util.HashMap; -import java.util.Map; +import jdk.internal.misc.SharedSecrets; +import jdk.internal.org.objectweb.asm.Opcodes; +import jdk.internal.reflect.ConstantPool; +import jdk.internal.reflect.ConstantPool.Tag; import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; import jdk.vm.ci.runtime.JVMCI; -import jdk.internal.misc.SharedSecrets; -import jdk.internal.org.objectweb.asm.Opcodes; import sun.hotspot.WhiteBox; -import jdk.internal.reflect.ConstantPool; -import jdk.internal.reflect.ConstantPool.Tag; + +import java.util.HashMap; +import java.util.Map; + +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_CLASS; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVOKEDYNAMIC; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODHANDLE; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODTYPE; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_STRING; /** * Class contains hard-coded constant pool tables for dummy classes used for diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java index 477c9128c4e..b2477b73639 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java @@ -38,11 +38,11 @@ package compiler.jvmci.compilerToVM; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.test.lib.ProcessTools; -import java.util.Arrays; import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.Utils; +import jdk.test.lib.ProcessTools; +import jdk.vm.ci.hotspot.CompilerToVMHelper; + +import java.util.Arrays; public class DebugOutputTest { public static void main(String[] args) { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java index f172b3a1022..8bb3820593d 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java @@ -48,13 +48,13 @@ package compiler.jvmci.compilerToVM; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.vm.ci.code.InstalledCode; import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; +import jdk.vm.ci.code.InstalledCode; +import jdk.vm.ci.hotspot.CompilerToVMHelper; import sun.hotspot.code.NMethod; import java.util.List; -import jdk.test.lib.Utils; public class DisassembleCodeBlobTest { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java index e783a981e4f..2390557a8ad 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java @@ -48,14 +48,15 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; +import jdk.test.lib.Asserts; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; +import sun.hotspot.WhiteBox; + import java.lang.reflect.Executable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -import jdk.test.lib.Asserts; -import sun.hotspot.WhiteBox; public class DoNotInlineOrCompileTest { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java index b931adcff13..c6a36fc969a 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java @@ -1,22 +1,17 @@ package compiler.jvmci.compilerToVM; +import jdk.test.lib.Asserts; +import jdk.test.lib.Pair; +import jdk.test.lib.Utils; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.code.InvalidInstalledCodeException; import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.test.lib.Asserts; -import jdk.test.lib.Utils; -import jdk.test.lib.Pair; import sun.hotspot.code.NMethod; import java.lang.reflect.Constructor; -import java.lang.reflect.Executable; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; /* * @test diff --git a/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java index 7b237098709..3c818d9f2d5 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java @@ -40,19 +40,20 @@ package compiler.jvmci.compilerToVM; +import compiler.jvmci.common.CTVMUtilities; import compiler.jvmci.common.testcases.MultipleImplementer1; import compiler.jvmci.common.testcases.SingleImplementer; -import compiler.jvmci.common.testcases.SingleSubclass; -import compiler.jvmci.common.CTVMUtilities; import compiler.jvmci.common.testcases.SingleImplementerInterface; -import java.lang.reflect.Method; -import java.util.HashSet; -import java.util.Set; +import compiler.jvmci.common.testcases.SingleSubclass; +import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; -import jdk.test.lib.Asserts; -import jdk.test.lib.Utils; + +import java.lang.reflect.Method; +import java.util.HashSet; +import java.util.Set; public class FindUniqueConcreteMethodTest { public static void main(String args[]) { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java index a72d0c408a6..6bd182bc293 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java @@ -43,12 +43,13 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; import compiler.jvmci.common.testcases.TestCase; -import java.lang.reflect.Executable; -import java.lang.reflect.Modifier; -import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.internal.org.objectweb.asm.Opcodes; import jdk.test.lib.Asserts; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; + +import java.lang.reflect.Executable; +import java.lang.reflect.Modifier; public class GetBytecodeTest { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java index 2eec0dacf1f..c20b668f17a 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java @@ -43,13 +43,14 @@ import compiler.jvmci.common.testcases.DoNotExtendClass; import compiler.jvmci.common.testcases.MultipleImplementersInterfaceExtender; import compiler.jvmci.common.testcases.SingleImplementer; import compiler.jvmci.common.testcases.SingleImplementerInterface; -import java.util.HashSet; -import java.util.Set; +import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; -import jdk.test.lib.Asserts; -import jdk.test.lib.Utils; + +import java.util.HashSet; +import java.util.Set; public class GetClassInitializerTest { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java index 6cca8e73afe..ceb35fe6378 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java @@ -45,15 +45,15 @@ */ package compiler.jvmci.compilerToVM; -import java.lang.reflect.Field; -import jdk.vm.ci.meta.ConstantPool; +import jdk.internal.misc.Unsafe; +import jdk.test.lib.Utils; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject; -import jdk.test.lib.Utils; +import jdk.vm.ci.meta.ConstantPool; import sun.hotspot.WhiteBox; -import jdk.internal.misc.Unsafe; + +import java.lang.reflect.Field; /** * Tests for jdk.vm.ci.hotspot.CompilerToVM::getConstantPool method diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java index 2d7d5115ac2..3e5ada1383a 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java @@ -42,14 +42,15 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; +import jdk.test.lib.Asserts; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; + import java.io.IOException; import java.lang.reflect.Executable; import java.net.Socket; import java.util.HashMap; import java.util.Map; -import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.test.lib.Asserts; public class GetExceptionTableTest { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java index e907eb82d9d..dd0841d5995 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java @@ -39,8 +39,8 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.testcases.AbstractClass; import compiler.jvmci.common.testcases.AbstractClassExtender; -import compiler.jvmci.common.testcases.DoNotImplementInterface; import compiler.jvmci.common.testcases.DoNotExtendClass; +import compiler.jvmci.common.testcases.DoNotImplementInterface; import compiler.jvmci.common.testcases.MultipleImplementer1; import compiler.jvmci.common.testcases.MultipleImplementer2; import compiler.jvmci.common.testcases.MultipleImplementersInterface; @@ -48,13 +48,14 @@ import compiler.jvmci.common.testcases.SingleImplementer; import compiler.jvmci.common.testcases.SingleImplementerInterface; import compiler.jvmci.common.testcases.SingleSubclass; import compiler.jvmci.common.testcases.SingleSubclassedClass; +import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; + import java.util.HashSet; import java.util.Set; import java.util.stream.Stream; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; -import jdk.test.lib.Asserts; -import jdk.test.lib.Utils; public class GetImplementorTest { public static void main(String args[]) { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java index c121881154b..ac99a5c21f4 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java @@ -44,9 +44,9 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; import compiler.jvmci.common.testcases.TestCase; +import jdk.test.lib.Asserts; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -import jdk.test.lib.Asserts; import java.lang.reflect.Executable; import java.util.Arrays; diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java index 4fb64f71398..7d3b0971679 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java @@ -47,9 +47,9 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; -import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.test.lib.Asserts; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; import java.lang.reflect.Executable; import java.util.HashMap; diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java index 44574b0455c..fcdf29e3073 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java @@ -37,8 +37,8 @@ package compiler.jvmci.compilerToVM; -import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.test.lib.Asserts; +import jdk.vm.ci.hotspot.CompilerToVMHelper; public class GetMaxCallTargetOffsetTest { public static void main(String args[]) { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java index 7809e94c656..b0c0d50a202 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java @@ -42,11 +42,12 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; -import java.lang.reflect.Method; +import jdk.test.lib.Asserts; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotStackFrameReference; import jdk.vm.ci.meta.ResolvedJavaMethod; -import jdk.test.lib.Asserts; + +import java.lang.reflect.Method; public class GetNextStackFrameTest { private static final int RECURSION_AMOUNT = 3; diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java index 7fc31dea426..c8633398381 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java @@ -42,9 +42,10 @@ package compiler.jvmci.compilerToVM; -import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.test.lib.Asserts; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; + import java.util.HashMap; import java.util.Map; diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java index 9ae630c2c5c..a893c714eac 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java @@ -43,13 +43,13 @@ package compiler.jvmci.compilerToVM; +import jdk.internal.misc.Unsafe; +import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject; -import jdk.test.lib.Asserts; -import jdk.test.lib.Utils; import sun.hotspot.WhiteBox; -import jdk.internal.misc.Unsafe; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java index 275b78f1e19..2ed3686d321 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java @@ -52,16 +52,17 @@ package compiler.jvmci.compilerToVM; -import java.lang.reflect.Field; -import jdk.vm.ci.meta.ConstantPool; +import jdk.internal.misc.Unsafe; +import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject; -import jdk.test.lib.Asserts; -import jdk.test.lib.Utils; +import jdk.vm.ci.meta.ConstantPool; import sun.hotspot.WhiteBox; -import jdk.internal.misc.Unsafe; + +import java.lang.reflect.Field; public class GetResolvedJavaTypeTest { private static enum TestCase { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java index da0feed2ae7..ec4458a657c 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java @@ -42,17 +42,17 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; +import compiler.jvmci.common.testcases.TestCase; +import jdk.test.lib.Asserts; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; + import java.lang.reflect.Executable; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.HashMap; import java.util.Map; -import compiler.jvmci.common.testcases.TestCase; -import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.test.lib.Asserts; - public class GetStackTraceElementTest { public static void main(String[] args) { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java index 69a45d10185..78922fa4ecf 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java @@ -41,9 +41,13 @@ package compiler.jvmci.compilerToVM; -import jdk.vm.ci.hotspot.CompilerToVMHelper; import compiler.jvmci.common.CTVMUtilities; import compiler.jvmci.common.testcases.SingleImplementer; +import jdk.test.lib.Utils; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; +import jdk.vm.ci.meta.ConstantPool; + import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Method; @@ -52,9 +56,6 @@ import java.util.List; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; -import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -import jdk.vm.ci.meta.ConstantPool; -import jdk.test.lib.Utils; public class GetSymbolTest { private static final int CONSTANT_POOL_UTF8_TAG = 1; // see jvms, section 4.4 diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java index 163f6bdd095..a8a83d1e8aa 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java @@ -40,7 +40,10 @@ package compiler.jvmci.compilerToVM; +import compiler.jvmci.common.CTVMUtilities; import compiler.jvmci.common.testcases.AbstractClass; +import compiler.jvmci.common.testcases.AnotherSingleImplementer; +import compiler.jvmci.common.testcases.AnotherSingleImplementerInterface; import compiler.jvmci.common.testcases.DoNotExtendClass; import compiler.jvmci.common.testcases.MultipleAbstractImplementer; import compiler.jvmci.common.testcases.MultipleImplementersInterface; @@ -49,18 +52,16 @@ import compiler.jvmci.common.testcases.SingleImplementer; import compiler.jvmci.common.testcases.SingleImplementerInterface; import compiler.jvmci.common.testcases.SingleSubclass; import compiler.jvmci.common.testcases.SingleSubclassedClass; -import compiler.jvmci.common.CTVMUtilities; -import compiler.jvmci.common.testcases.AnotherSingleImplementer; -import compiler.jvmci.common.testcases.AnotherSingleImplementerInterface; +import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; +import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; + import java.lang.reflect.Method; import java.util.HashSet; import java.util.Set; import java.util.stream.Stream; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; -import jdk.test.lib.Asserts; -import jdk.test.lib.Utils; public class GetVtableIndexForInterfaceTest { private static final int INVALID_VTABLE_INDEX = -4; // see method.hpp: VtableIndexFlag diff --git a/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java b/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java index 5a59bec7939..734964722bd 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java @@ -49,18 +49,17 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; +import compiler.testlibrary.CompilerUtils; +import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; +import sun.hotspot.code.NMethod; import java.lang.reflect.Executable; import java.util.ArrayList; import java.util.List; -import compiler.testlibrary.CompilerUtils; -import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.test.lib.Asserts; -import jdk.test.lib.Utils; -import sun.hotspot.code.NMethod; - public class HasCompiledCodeForOSRTest { public static void main(String[] args) { List testCases = createTestCases(); diff --git a/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java b/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java index 2f4e9214fac..dfb0d78b88a 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java @@ -43,13 +43,14 @@ import compiler.jvmci.common.testcases.DoNotImplementInterface; import compiler.jvmci.common.testcases.MultipleImplementer1; import compiler.jvmci.common.testcases.MultipleImplementersInterface; import compiler.jvmci.common.testcases.SingleImplementerInterface; +import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; + import java.util.HashSet; import java.util.Set; import java.util.stream.Stream; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; -import jdk.test.lib.Asserts; -import jdk.test.lib.Utils; public class HasFinalizableSubclassTest { public static void main(String args[]) { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java b/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java index 3a4597d44f7..c4626d26264 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java @@ -37,19 +37,10 @@ package compiler.jvmci.compilerToVM; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.function.Consumer; -import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.test.lib.Asserts; import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; import jdk.vm.ci.hotspot.HotSpotVMConfigAccess; import jdk.vm.ci.hotspot.HotSpotVMConfigStore; -import jdk.test.lib.Asserts; -import jdk.test.lib.Utils; -import jdk.internal.misc.Unsafe; public class InitializeConfigurationTest { public static void main(String args[]) { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java index fa4acfd082b..23ff0b9685a 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java @@ -50,18 +50,18 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; -import jdk.vm.ci.code.InstalledCode; -import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.test.lib.Asserts; import jdk.test.lib.Utils; -import sun.hotspot.code.NMethod; - -import java.util.List; import jdk.vm.ci.code.CodeCacheProvider; import jdk.vm.ci.code.CompilationResult; +import jdk.vm.ci.code.InstalledCode; +import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotCompilationRequest; import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; +import sun.hotspot.code.NMethod; + +import java.util.List; public class InvalidateInstalledCodeTest { private static final CodeCacheProvider CACHE_PROVIDER diff --git a/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java b/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java index a05ee0271ac..e1206cf4cd0 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java @@ -44,8 +44,8 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.testcases.SimpleClass; import compiler.whitebox.CompilerWhiteBoxTest; -import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.test.lib.Asserts; +import jdk.vm.ci.hotspot.CompilerToVMHelper; import sun.hotspot.WhiteBox; import java.lang.reflect.Executable; diff --git a/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java b/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java index 61405cb9f46..ef32f138dd9 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java @@ -43,8 +43,8 @@ package compiler.jvmci.compilerToVM; -import jdk.vm.ci.runtime.JVMCI; import jdk.test.lib.Asserts; +import jdk.vm.ci.runtime.JVMCI; import java.lang.reflect.Method; diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java index 765ec293f31..f036f0e2770 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java @@ -50,17 +50,19 @@ package compiler.jvmci.compilerToVM; -import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes; -import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator; -import java.util.HashMap; -import java.util.Map; +import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; import jdk.vm.ci.meta.ConstantPool; +import java.util.HashMap; +import java.util.Map; + +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_CLASS; + /** * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.lookupKlassInPool} method */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java index c6c38683b86..6e1729689b9 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java @@ -48,17 +48,21 @@ package compiler.jvmci.compilerToVM; -import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes; -import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator; -import java.util.HashMap; -import java.util.Map; +import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import jdk.test.lib.Asserts; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.meta.ConstantPool; +import java.util.HashMap; +import java.util.Map; + +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF; + /** * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.lookupKlassRefIndexInPool} method */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java index 3aa3302ac2a..4b4c498de05 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java @@ -48,18 +48,21 @@ package compiler.jvmci.compilerToVM; -import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes; -import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator; -import java.util.HashMap; -import java.util.Map; +import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import jdk.test.lib.Asserts; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; import jdk.vm.ci.meta.ConstantPool; +import java.util.HashMap; +import java.util.Map; + +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF; + /** * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.lookupMethodInPool} method */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java index 6eeb164e798..88cc6944444 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java @@ -48,17 +48,22 @@ package compiler.jvmci.compilerToVM; -import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes; -import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator; -import java.util.HashMap; -import java.util.Map; +import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import jdk.test.lib.Asserts; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.meta.ConstantPool; +import java.util.HashMap; +import java.util.Map; + +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVOKEDYNAMIC; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF; + /** * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.lookupNameAndTypeRefIndexInPool} method */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java index 857aa7f8dd9..a43a45347d4 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java @@ -48,16 +48,21 @@ package compiler.jvmci.compilerToVM; -import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes; -import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator; -import java.util.HashMap; -import java.util.Map; +import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; +import jdk.test.lib.Asserts; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.meta.ConstantPool; -import jdk.test.lib.Asserts; + +import java.util.HashMap; +import java.util.Map; + +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVOKEDYNAMIC; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF; /** * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.lookupNameInPool} method diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java index ea8d7bfbec9..d5afc82d7a6 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java @@ -48,17 +48,22 @@ package compiler.jvmci.compilerToVM; -import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes; -import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator; -import java.util.HashMap; -import java.util.Map; +import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import jdk.test.lib.Asserts; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.meta.ConstantPool; +import java.util.HashMap; +import java.util.Map; + +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVOKEDYNAMIC; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF; + /** * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.lookupSignatureInPool} method */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java index 22fa694e8cf..437b5616f2a 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java @@ -40,12 +40,13 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.testcases.DoNotExtendClass; import compiler.jvmci.common.testcases.MultiSubclassedClass; import compiler.jvmci.common.testcases.SingleSubclass; -import java.util.HashSet; -import java.util.Set; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; import jdk.test.lib.Asserts; import jdk.test.lib.Utils; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; + +import java.util.HashSet; +import java.util.Set; public class LookupTypeTest { public static void main(String args[]) { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java index 79f3b25791a..066bc1661b7 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java @@ -59,18 +59,17 @@ package compiler.jvmci.compilerToVM; -import java.lang.reflect.Method; -import jdk.vm.ci.hotspot.HotSpotStackFrameReference; -import jdk.vm.ci.meta.ResolvedJavaMethod; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.test.lib.Asserts; - import compiler.jvmci.common.CTVMUtilities; import compiler.testlibrary.CompilerUtils; import compiler.whitebox.CompilerWhiteBoxTest; - +import jdk.test.lib.Asserts; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotStackFrameReference; +import jdk.vm.ci.meta.ResolvedJavaMethod; import sun.hotspot.WhiteBox; +import java.lang.reflect.Method; + public class MaterializeVirtualObjectTest { private static final WhiteBox WB; private static final Method METHOD; diff --git a/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java b/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java index cf244d19cc9..e732faa5bdb 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java @@ -43,13 +43,14 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; -import java.lang.reflect.Method; +import jdk.test.lib.Asserts; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; + import java.lang.reflect.Executable; +import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; -import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.test.lib.Asserts; public class MethodIsIgnoredBySecurityStackWalkTest { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java index 19953bc5fda..e52ef816cf5 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java @@ -51,16 +51,16 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; +import compiler.whitebox.CompilerWhiteBoxTest; +import jdk.test.lib.Asserts; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; +import jdk.vm.ci.meta.ProfilingInfo; + import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; -import compiler.whitebox.CompilerWhiteBoxTest; -import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.vm.ci.meta.ProfilingInfo; -import jdk.test.lib.Asserts; - public class ReprofileTest { public static void main(String[] args) { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java index 61a3a4a2465..ba23d6a432d 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java @@ -48,17 +48,20 @@ package compiler.jvmci.compilerToVM; -import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes; -import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator; +import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; +import jdk.test.lib.Asserts; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.meta.ConstantPool; + import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; import java.util.HashMap; import java.util.Map; -import jdk.test.lib.Asserts; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.vm.ci.meta.ConstantPool; + +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODHANDLE; +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODTYPE; /** * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.resolveConstantInPool} method diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java index 8514146e5b6..6d6035438aa 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java @@ -48,21 +48,23 @@ package compiler.jvmci.compilerToVM; -import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes; -import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator; -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; +import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; +import jdk.internal.misc.Unsafe; import jdk.internal.org.objectweb.asm.Opcodes; +import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; import jdk.vm.ci.meta.ConstantPool; -import jdk.test.lib.Asserts; -import jdk.test.lib.Utils; -import jdk.internal.misc.Unsafe; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; + +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF; /** * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.resolveFieldInPool} method diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java index 4ac3c87323a..389f5583c01 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java @@ -40,6 +40,7 @@ package compiler.jvmci.compilerToVM; +import compiler.jvmci.common.CTVMUtilities; import compiler.jvmci.common.testcases.AbstractClass; import compiler.jvmci.common.testcases.AbstractClassExtender; import compiler.jvmci.common.testcases.MultipleImplementer1; @@ -49,15 +50,15 @@ import compiler.jvmci.common.testcases.SingleImplementer; import compiler.jvmci.common.testcases.SingleImplementerInterface; import compiler.jvmci.common.testcases.SingleSubclass; import compiler.jvmci.common.testcases.SingleSubclassedClass; -import compiler.jvmci.common.CTVMUtilities; -import java.util.HashSet; -import java.util.Set; +import jdk.internal.misc.Unsafe; +import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; -import jdk.test.lib.Asserts; -import jdk.test.lib.Utils; -import jdk.internal.misc.Unsafe; + +import java.util.HashSet; +import java.util.Set; public class ResolveMethodTest { private static final Unsafe UNSAFE = Utils.getUnsafe(); diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java index 437ae0ad0f5..49a3cbd1986 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java @@ -48,17 +48,19 @@ package compiler.jvmci.compilerToVM; -import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes; -import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator; -import java.util.HashMap; -import java.util.Map; +import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import jdk.test.lib.Asserts; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.meta.ConstantPool; +import java.util.HashMap; +import java.util.Map; + +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_STRING; + /** * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.resolvePossiblyCachedConstantInPool} method */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java index c854f59155b..26fc8f86b85 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java @@ -49,17 +49,19 @@ package compiler.jvmci.compilerToVM; -import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes; -import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry; import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator; -import java.util.HashMap; -import java.util.Map; +import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; import jdk.vm.ci.meta.ConstantPool; +import java.util.HashMap; +import java.util.Map; + +import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_CLASS; + /** * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.resolveTypeInPool} method */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java index 1ec2722aa3d..cbca06a757b 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java @@ -45,8 +45,8 @@ package compiler.jvmci.compilerToVM; -import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.test.lib.Asserts; +import jdk.vm.ci.hotspot.CompilerToVMHelper; public class ShouldDebugNonSafepointsTest { private static final boolean EXPECTED = Boolean.getBoolean("compiler" diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java index 4d7eb4ad411..c86ff4d7faa 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java @@ -48,14 +48,15 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; +import jdk.test.lib.Asserts; +import jdk.vm.ci.hotspot.CompilerToVMHelper; +import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; +import sun.hotspot.WhiteBox; + import java.lang.reflect.Executable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import jdk.vm.ci.hotspot.CompilerToVMHelper; -import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; -import jdk.test.lib.Asserts; -import sun.hotspot.WhiteBox; public class ShouldInlineMethodTest { diff --git a/hotspot/test/compiler/jvmci/errors/CodeInstallerTest.java b/hotspot/test/compiler/jvmci/errors/CodeInstallerTest.java index fd361bc9db6..7e7dfcd5569 100644 --- a/hotspot/test/compiler/jvmci/errors/CodeInstallerTest.java +++ b/hotspot/test/compiler/jvmci/errors/CodeInstallerTest.java @@ -23,8 +23,6 @@ package compiler.jvmci.errors; -import java.lang.reflect.Method; - import jdk.vm.ci.code.Architecture; import jdk.vm.ci.code.CodeCacheProvider; import jdk.vm.ci.code.Register; @@ -41,9 +39,10 @@ import jdk.vm.ci.meta.PlatformKind; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.runtime.JVMCI; import jdk.vm.ci.runtime.JVMCIBackend; - import org.junit.Assert; +import java.lang.reflect.Method; + public class CodeInstallerTest { protected final Architecture arch; diff --git a/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java b/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java index bc2eae33f00..1f696dfa341 100644 --- a/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java +++ b/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java @@ -51,7 +51,6 @@ import jdk.vm.ci.hotspot.HotSpotCompiledCode.Comment; import jdk.vm.ci.hotspot.HotSpotConstant; import jdk.vm.ci.meta.Assumptions.Assumption; import jdk.vm.ci.meta.VMConstant; - import org.junit.Test; /** diff --git a/hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java b/hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java index 7beb74f263e..e4a4d46f204 100644 --- a/hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java +++ b/hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java @@ -58,7 +58,6 @@ import jdk.vm.ci.meta.PlatformKind; import jdk.vm.ci.meta.ResolvedJavaType; import jdk.vm.ci.meta.Value; import jdk.vm.ci.meta.ValueKind; - import org.junit.Test; /** diff --git a/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java b/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java index fdb056ed666..ad1a1d55f70 100644 --- a/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java +++ b/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java @@ -52,7 +52,6 @@ import jdk.vm.ci.hotspot.HotSpotReferenceMap; import jdk.vm.ci.meta.Assumptions.Assumption; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.PlatformKind; - import org.junit.Test; /** diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java index 3677d6d2a5b..a40a2bb17ee 100644 --- a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java +++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java @@ -78,20 +78,21 @@ package compiler.jvmci.events; import compiler.jvmci.common.CTVMUtilities; import compiler.jvmci.common.testcases.SimpleClass; import jdk.test.lib.Asserts; -import java.lang.reflect.Method; import jdk.test.lib.Utils; -import jdk.vm.ci.hotspot.services.HotSpotVMEventListener; import jdk.vm.ci.code.CompiledCode; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.code.site.DataPatch; import jdk.vm.ci.code.site.Site; -import jdk.vm.ci.meta.Assumptions.Assumption; -import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; import jdk.vm.ci.hotspot.HotSpotCompiledCode; import jdk.vm.ci.hotspot.HotSpotCompiledCode.Comment; import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; +import jdk.vm.ci.hotspot.services.HotSpotVMEventListener; +import jdk.vm.ci.meta.Assumptions.Assumption; +import jdk.vm.ci.meta.ResolvedJavaMethod; + +import java.lang.reflect.Method; public class JvmciNotifyInstallEventTest extends HotSpotVMEventListener { private static final String METHOD_NAME = "testMethod"; diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java index 9ae9d83a2d6..62d0e99155b 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java @@ -22,10 +22,6 @@ */ package jdk.vm.ci.code.test; -import java.lang.reflect.Method; - -import org.junit.Assert; - import jdk.vm.ci.amd64.AMD64; import jdk.vm.ci.code.Architecture; import jdk.vm.ci.code.CodeCacheProvider; @@ -41,6 +37,9 @@ import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.runtime.JVMCI; import jdk.vm.ci.runtime.JVMCIBackend; import jdk.vm.ci.sparc.SPARC; +import org.junit.Assert; + +import java.lang.reflect.Method; /** * Base class for code installation tests. diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java index bedb1bb2c41..c2e3edf502f 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java @@ -38,13 +38,12 @@ package jdk.vm.ci.code.test; -import org.junit.Assume; -import org.junit.Test; - import jdk.vm.ci.code.Register; import jdk.vm.ci.code.site.DataSectionReference; import jdk.vm.ci.hotspot.HotSpotConstant; import jdk.vm.ci.meta.ResolvedJavaType; +import org.junit.Assume; +import org.junit.Test; /** * Test code installation with data patches. diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DebugInfoTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DebugInfoTest.java index 584249c21b7..424c6bee2b8 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DebugInfoTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DebugInfoTest.java @@ -22,8 +22,6 @@ */ package jdk.vm.ci.code.test; -import java.lang.reflect.Method; - import jdk.vm.ci.code.BytecodeFrame; import jdk.vm.ci.code.DebugInfo; import jdk.vm.ci.code.Location; @@ -33,6 +31,8 @@ import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.JavaValue; import jdk.vm.ci.meta.ResolvedJavaMethod; +import java.lang.reflect.Method; + /** * Test code installation with debug information. */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java index 2425cbc0d43..db19e221487 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java @@ -38,14 +38,13 @@ package jdk.vm.ci.code.test; -import org.junit.Assert; -import org.junit.Test; - import jdk.vm.ci.code.BytecodeFrame; import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.JavaValue; import jdk.vm.ci.meta.ResolvedJavaMethod; +import org.junit.Assert; +import org.junit.Test; public class InterpreterFrameSizeTest extends CodeInstallationTest { diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java index b9e56256b96..9caed4279dd 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java @@ -39,13 +39,12 @@ package jdk.vm.ci.code.test; -import org.junit.Test; - import jdk.vm.ci.code.Location; import jdk.vm.ci.code.Register; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; +import org.junit.Test; public class MaxOopMapStackOffsetTest extends DebugInfoTest { diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java index 57496edb203..1f69fc86e2f 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java @@ -38,9 +38,8 @@ package jdk.vm.ci.code.test; -import org.junit.Test; - import jdk.vm.ci.code.Register; +import org.junit.Test; /** * Test simple code installation. diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java index f44c4801c8b..85c7b453add 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java @@ -38,15 +38,14 @@ package jdk.vm.ci.code.test; -import org.junit.Assume; -import org.junit.Test; - import jdk.vm.ci.code.Register; import jdk.vm.ci.hotspot.HotSpotConstant; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.ResolvedJavaType; import jdk.vm.ci.meta.Value; +import org.junit.Assume; +import org.junit.Test; public class SimpleDebugInfoTest extends DebugInfoTest { diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java index 44b1d4bcf2a..f657be71687 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java @@ -23,11 +23,6 @@ package jdk.vm.ci.code.test; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.util.ArrayList; -import java.util.Arrays; - import jdk.vm.ci.code.CodeCacheProvider; import jdk.vm.ci.code.DebugInfo; import jdk.vm.ci.code.Register; @@ -51,8 +46,13 @@ import jdk.vm.ci.meta.InvokeTarget; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.PlatformKind; import jdk.vm.ci.meta.ResolvedJavaMethod; -import jdk.vm.ci.meta.ValueKind; import jdk.vm.ci.meta.VMConstant; +import jdk.vm.ci.meta.ValueKind; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.ArrayList; +import java.util.Arrays; /** * Simple assembler used by the code installation tests. diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java index d08f6129070..bee4f8d3b81 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java @@ -38,12 +38,6 @@ package jdk.vm.ci.code.test; -import java.util.ArrayList; -import java.util.Objects; - -import org.junit.Assert; -import org.junit.Test; - import jdk.vm.ci.code.Register; import jdk.vm.ci.code.VirtualObject; import jdk.vm.ci.hotspot.HotSpotConstant; @@ -52,6 +46,11 @@ import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.JavaValue; import jdk.vm.ci.meta.ResolvedJavaField; import jdk.vm.ci.meta.ResolvedJavaType; +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Objects; public class VirtualObjectDebugInfoTest extends DebugInfoTest { diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/AsJavaTypeDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/AsJavaTypeDataProvider.java index 2278a1821a8..88dd983c63e 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/AsJavaTypeDataProvider.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/AsJavaTypeDataProvider.java @@ -23,12 +23,12 @@ package jdk.vm.ci.hotspot.test; -import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER; -import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE; - import jdk.vm.ci.meta.JavaConstant; import org.testng.annotations.DataProvider; +import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER; +import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE; + public class AsJavaTypeDataProvider { @DataProvider(name = "asJavaTypeDataProvider") diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/BoxPrimitiveDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/BoxPrimitiveDataProvider.java index cb57b457c6d..af0ce73c33c 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/BoxPrimitiveDataProvider.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/BoxPrimitiveDataProvider.java @@ -23,13 +23,14 @@ package jdk.vm.ci.hotspot.test; -import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER; -import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE; - -import java.util.LinkedList; import jdk.vm.ci.meta.JavaConstant; import org.testng.annotations.DataProvider; +import java.util.LinkedList; + +import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER; +import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE; + public class BoxPrimitiveDataProvider { @DataProvider(name = "boxPrimitiveDataProvider") diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ConstantEqualsDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ConstantEqualsDataProvider.java index dff8c48c0d4..494f86f562a 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ConstantEqualsDataProvider.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ConstantEqualsDataProvider.java @@ -23,15 +23,16 @@ package jdk.vm.ci.hotspot.test; -import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER; -import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE; +import jdk.vm.ci.meta.Constant; +import jdk.vm.ci.meta.JavaConstant; +import org.testng.annotations.DataProvider; import java.util.HashMap; import java.util.LinkedList; import java.util.Objects; -import jdk.vm.ci.meta.Constant; -import jdk.vm.ci.meta.JavaConstant; -import org.testng.annotations.DataProvider; + +import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER; +import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE; public class ConstantEqualsDataProvider { @DataProvider(name = "constantEqualsDataProvider") diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ForStringDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ForStringDataProvider.java index 8db71853d98..9aa6651b5a9 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ForStringDataProvider.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ForStringDataProvider.java @@ -23,10 +23,10 @@ package jdk.vm.ci.hotspot.test; -import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE; - import org.testng.annotations.DataProvider; +import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE; + public class ForStringDataProvider { @DataProvider(name = "forStringDataProvider") public static Object[][] forStringDataProvider() { diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java index 0ff2809c7b5..5c9c7c68ce1 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java @@ -39,12 +39,8 @@ package jdk.vm.ci.hotspot.test; -import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER; - -import java.lang.reflect.Method; -import jdk.vm.ci.hotspot.HotSpotResolvedJavaField; -import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.Constant; +import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.MemoryAccessProvider; import jdk.vm.ci.meta.MethodHandleAccessProvider; import jdk.vm.ci.meta.ResolvedJavaField; @@ -52,6 +48,8 @@ import jdk.vm.ci.meta.ResolvedJavaType; import org.testng.Assert; import org.testng.annotations.Test; +import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER; + public class HotSpotConstantReflectionProviderTest { @Test(dataProvider = "forObjectDataProvider", dataProviderClass = ForObjectDataProvider.class) diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/IsEmbeddableDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/IsEmbeddableDataProvider.java index 62c64a4bf9a..004f32c7588 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/IsEmbeddableDataProvider.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/IsEmbeddableDataProvider.java @@ -23,12 +23,12 @@ package jdk.vm.ci.hotspot.test; -import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER; -import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE; - import jdk.vm.ci.meta.JavaConstant; import org.testng.annotations.DataProvider; +import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER; +import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE; + public class IsEmbeddableDataProvider { @DataProvider(name = "isEmbeddableDataProvider") public static Object[][] isEmbeddableDataProvider() { diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java index a880dc452bb..549cc7b76ae 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java @@ -23,10 +23,6 @@ package jdk.vm.ci.hotspot.test; -import java.lang.reflect.Field; - -import org.testng.annotations.DataProvider; - import jdk.internal.misc.Unsafe; import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider; import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider; @@ -36,6 +32,9 @@ import jdk.vm.ci.meta.Constant; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.runtime.JVMCI; +import org.testng.annotations.DataProvider; + +import java.lang.reflect.Field; public class MemoryAccessProviderData { private static final Unsafe UNSAFE = getUnsafe(); diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java index 466e4e32156..03e7f68c273 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java @@ -38,12 +38,11 @@ package jdk.vm.ci.hotspot.test; import jdk.vm.ci.meta.Constant; -import org.testng.annotations.Test; -import org.testng.Assert; -import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.MemoryAccessProvider; import jdk.vm.ci.runtime.JVMCI; +import org.testng.Assert; +import org.testng.annotations.Test; public class MemoryAccessProviderTest { private static final MemoryAccessProvider PROVIDER = JVMCI.getRuntime().getHostJVMCIBackend().getConstantReflection().getMemoryAccessProvider(); diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderData.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderData.java index 7cc482292aa..49f19a48e14 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderData.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderData.java @@ -23,6 +23,13 @@ package jdk.vm.ci.hotspot.test; +import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider; +import jdk.vm.ci.meta.JavaConstant; +import jdk.vm.ci.meta.MetaAccessProvider; +import jdk.vm.ci.meta.MethodHandleAccessProvider; +import jdk.vm.ci.runtime.JVMCI; +import org.testng.annotations.DataProvider; + import java.io.File; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; @@ -31,12 +38,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.nio.file.Paths; -import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider; -import jdk.vm.ci.meta.JavaConstant; -import jdk.vm.ci.meta.MetaAccessProvider; -import jdk.vm.ci.meta.MethodHandleAccessProvider; -import jdk.vm.ci.runtime.JVMCI; -import org.testng.annotations.DataProvider; public class MethodHandleAccessProviderData implements TestInterface { private static final MetaAccessProvider META_ACCESS = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess(); diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java index 110615dc48d..b4b88bbd2a2 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java @@ -36,18 +36,19 @@ package jdk.vm.ci.hotspot.test; +import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider; +import jdk.vm.ci.meta.JavaConstant; +import jdk.vm.ci.meta.MetaAccessProvider; +import jdk.vm.ci.meta.MethodHandleAccessProvider; +import jdk.vm.ci.meta.MethodHandleAccessProvider.IntrinsicMethod; +import jdk.vm.ci.meta.ResolvedJavaMethod; +import jdk.vm.ci.runtime.JVMCI; +import org.testng.Assert; +import org.testng.annotations.Test; + import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.reflect.Method; -import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider; -import jdk.vm.ci.meta.MethodHandleAccessProvider; -import jdk.vm.ci.meta.ResolvedJavaMethod; -import jdk.vm.ci.runtime.JVMCI; -import jdk.vm.ci.meta.JavaConstant; -import jdk.vm.ci.meta.MetaAccessProvider; -import jdk.vm.ci.meta.MethodHandleAccessProvider.IntrinsicMethod; -import org.testng.annotations.Test; -import org.testng.Assert; public class MethodHandleAccessProviderTest { private static final HotSpotConstantReflectionProvider CONSTANT_REFLECTION = (HotSpotConstantReflectionProvider) JVMCI.getRuntime().getHostJVMCIBackend().getConstantReflection(); diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayElementDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayElementDataProvider.java index fbaea6edeea..e10f7113269 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayElementDataProvider.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayElementDataProvider.java @@ -23,18 +23,18 @@ package jdk.vm.ci.hotspot.test; +import jdk.vm.ci.meta.JavaConstant; +import org.testng.annotations.DataProvider; + +import java.util.LinkedList; +import java.util.stream.Stream; + import static jdk.vm.ci.hotspot.test.TestHelper.ARRAYS_MAP; import static jdk.vm.ci.hotspot.test.TestHelper.ARRAY_ARRAYS_MAP; import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER; import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE; import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_FIELDS_MAP; -import java.util.LinkedList; -import java.util.stream.Stream; - -import jdk.vm.ci.meta.JavaConstant; -import org.testng.annotations.DataProvider; - public class ReadArrayElementDataProvider { @DataProvider(name = "readArrayElementDataProvider") diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayLengthDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayLengthDataProvider.java index ad877ac799c..110c2a2ba5a 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayLengthDataProvider.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayLengthDataProvider.java @@ -23,13 +23,14 @@ package jdk.vm.ci.hotspot.test; -import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER; -import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE; +import jdk.vm.ci.meta.JavaConstant; +import org.testng.annotations.DataProvider; import java.util.LinkedList; import java.util.List; -import jdk.vm.ci.meta.JavaConstant; -import org.testng.annotations.DataProvider; + +import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER; +import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE; public class ReadArrayLengthDataProvider { diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadFieldValueDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadFieldValueDataProvider.java index a46f25ccf5f..f3758b28717 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadFieldValueDataProvider.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadFieldValueDataProvider.java @@ -23,22 +23,23 @@ package jdk.vm.ci.hotspot.test; +import jdk.vm.ci.meta.JavaConstant; +import org.testng.annotations.DataProvider; + +import java.util.LinkedList; + import static jdk.vm.ci.hotspot.test.TestHelper.ARRAYS_MAP; import static jdk.vm.ci.hotspot.test.TestHelper.ARRAY_ARRAYS_MAP; import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER; import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_CONSTANT; import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE; +import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_FIELDS_MAP; +import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_STABLE_FIELDS_MAP; import static jdk.vm.ci.hotspot.test.TestHelper.STABLE_ARRAYS_MAP; import static jdk.vm.ci.hotspot.test.TestHelper.STABLE_ARRAY_ARRAYS_MAP; -import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_STABLE_FIELDS_MAP; -import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_FIELDS_MAP; import static jdk.vm.ci.hotspot.test.TestHelper.STATIC_FIELDS_MAP; import static jdk.vm.ci.hotspot.test.TestHelper.STATIC_STABLE_FIELDS_MAP; -import java.util.LinkedList; -import jdk.vm.ci.meta.JavaConstant; -import org.testng.annotations.DataProvider; - public class ReadFieldValueDataProvider { @DataProvider(name = "readFieldValueDataProvider") diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHelper.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHelper.java index 96f05dacae4..53ed106e46e 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHelper.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHelper.java @@ -23,15 +23,16 @@ package jdk.vm.ci.hotspot.test; -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.ResolvedJavaField; import jdk.vm.ci.runtime.JVMCI; +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; + public class TestHelper { public static final DummyClass DUMMY_CLASS_INSTANCE = new DummyClass(); diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/UnboxPrimitiveDataProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/UnboxPrimitiveDataProvider.java index ed8ad67d26e..de40dbfa003 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/UnboxPrimitiveDataProvider.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/UnboxPrimitiveDataProvider.java @@ -23,13 +23,13 @@ package jdk.vm.ci.hotspot.test; -import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER; -import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE; +import jdk.vm.ci.meta.JavaConstant; +import org.testng.annotations.DataProvider; import java.util.LinkedList; -import jdk.vm.ci.meta.JavaConstant; -import org.testng.annotations.DataProvider; +import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER; +import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE; public class UnboxPrimitiveDataProvider { diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java index 7857845edf3..f345bad4277 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java @@ -33,11 +33,10 @@ */ package jdk.vm.ci.runtime.test; +import jdk.vm.ci.meta.JavaConstant; import org.junit.Assert; import org.junit.Test; -import jdk.vm.ci.meta.JavaConstant; - public class ConstantTest extends FieldUniverse { @Test diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/FieldUniverse.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/FieldUniverse.java index e8d325024a0..dcc380d158f 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/FieldUniverse.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/FieldUniverse.java @@ -22,12 +22,12 @@ */ package jdk.vm.ci.runtime.test; +import jdk.vm.ci.meta.ResolvedJavaField; + import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; -import jdk.vm.ci.meta.ResolvedJavaField; - /** * Context for field related tests. */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/MethodUniverse.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/MethodUniverse.java index 35368ebeca4..92366580a91 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/MethodUniverse.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/MethodUniverse.java @@ -22,13 +22,13 @@ */ package jdk.vm.ci.runtime.test; +import jdk.vm.ci.meta.ResolvedJavaMethod; + import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; -import jdk.vm.ci.meta.ResolvedJavaMethod; - /** * Context for method related tests. */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/NameAndSignature.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/NameAndSignature.java index 055ded60645..3bd14c7e206 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/NameAndSignature.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/NameAndSignature.java @@ -22,15 +22,15 @@ */ package jdk.vm.ci.runtime.test; -import java.lang.reflect.Method; -import java.util.Arrays; - import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; import jdk.vm.ci.meta.Signature; import jdk.vm.ci.runtime.JVMCI; +import java.lang.reflect.Method; +import java.util.Arrays; + class NameAndSignature { public static final MetaAccessProvider metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess(); diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java index 0cc7a30667c..a93f934ebc5 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java @@ -34,8 +34,11 @@ package jdk.vm.ci.runtime.test; -import static org.junit.Assume.assumeTrue; +import jdk.vm.ci.meta.ResolvedJavaMethod; +import org.junit.Assert; +import org.junit.Test; +import javax.tools.ToolProvider; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -53,12 +56,7 @@ import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; import java.util.jar.Manifest; -import javax.tools.ToolProvider; - -import jdk.vm.ci.meta.ResolvedJavaMethod; - -import org.junit.Assert; -import org.junit.Test; +import static org.junit.Assume.assumeTrue; /** * Tests that {@link ResolvedJavaMethod}s are safe in the context of class redefinition being used diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java index 213b7c2fc15..21cdc8563d9 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java @@ -31,15 +31,15 @@ package jdk.vm.ci.runtime.test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; import jdk.vm.ci.runtime.JVMCI; - import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + public class ResolvedJavaTypeResolveConcreteMethodTest { public final MetaAccessProvider metaAccess; diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java index 0d65a36ca33..a32395c1762 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java @@ -31,15 +31,15 @@ package jdk.vm.ci.runtime.test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; import jdk.vm.ci.runtime.JVMCI; - import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + public class ResolvedJavaTypeResolveMethodTest { public final MetaAccessProvider metaAccess; diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java index ab6325eda0a..ab66c985554 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java @@ -34,21 +34,20 @@ package jdk.vm.ci.runtime.test; +import jdk.vm.ci.meta.ConstantReflectionProvider; +import jdk.vm.ci.meta.JavaConstant; +import jdk.vm.ci.meta.JavaKind; +import org.junit.Test; + +import java.lang.reflect.Array; +import java.util.List; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import java.lang.reflect.Array; -import java.util.List; - -import jdk.vm.ci.meta.ConstantReflectionProvider; -import jdk.vm.ci.meta.JavaConstant; -import jdk.vm.ci.meta.JavaKind; - -import org.junit.Test; - /** * Tests for {@link ConstantReflectionProvider}. It assumes an implementation of the interface that * actually returns non-null results for access operations that are possible, i.e., the tests will diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java index 8359fb0676d..15e4959e043 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java @@ -34,20 +34,19 @@ package jdk.vm.ci.runtime.test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.lang.reflect.Field; -import java.util.Map; - import jdk.vm.ci.meta.JavaField; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.JavaType; import jdk.vm.ci.meta.ResolvedJavaField; import jdk.vm.ci.meta.ResolvedJavaType; - import org.junit.Test; +import java.lang.reflect.Field; +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + /** * Tests for {@link JavaField}. */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java index b143206e6ad..a7a2e748cf2 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java @@ -34,17 +34,16 @@ package jdk.vm.ci.runtime.test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import jdk.vm.ci.meta.JavaMethod; +import jdk.vm.ci.meta.ResolvedJavaMethod; +import jdk.vm.ci.meta.ResolvedJavaType; +import org.junit.Test; import java.lang.reflect.Method; import java.util.Map; -import jdk.vm.ci.meta.JavaMethod; -import jdk.vm.ci.meta.ResolvedJavaMethod; -import jdk.vm.ci.meta.ResolvedJavaType; - -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * Tests for {@link JavaMethod}. diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java index ffcd3b43e8a..4b38875b9fd 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java @@ -34,12 +34,12 @@ package jdk.vm.ci.runtime.test; -import static org.junit.Assert.assertEquals; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.JavaType; - import org.junit.Test; +import static org.junit.Assert.assertEquals; + /** * Tests for {@link JavaType}. */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java index 16ca94e2d3e..cae386efa47 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java @@ -34,17 +34,8 @@ package jdk.vm.ci.runtime.test; -import static jdk.vm.ci.meta.MetaUtil.toInternalName; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; import jdk.vm.ci.meta.DeoptimizationAction; import jdk.vm.ci.meta.DeoptimizationReason; - import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.MetaAccessProvider; @@ -52,9 +43,17 @@ import jdk.vm.ci.meta.ResolvedJavaField; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; import jdk.vm.ci.meta.Signature; - import org.junit.Test; +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import static jdk.vm.ci.meta.MetaUtil.toInternalName; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + /** * Tests for {@link MetaAccessProvider}. */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java index 2c3a677a90d..50857482f1d 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java @@ -34,10 +34,9 @@ package jdk.vm.ci.runtime.test; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import jdk.vm.ci.meta.ResolvedJavaField; +import jdk.vm.ci.meta.ResolvedJavaMethod; +import org.junit.Test; import java.lang.annotation.Annotation; import java.lang.reflect.Field; @@ -47,10 +46,10 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import jdk.vm.ci.meta.ResolvedJavaField; -import jdk.vm.ci.meta.ResolvedJavaMethod; - -import org.junit.Test; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * Tests for {@link ResolvedJavaField}. diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java index 0a58b4b39fe..4f1fecb856d 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java @@ -34,10 +34,12 @@ package jdk.vm.ci.runtime.test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import jdk.vm.ci.meta.ConstantPool; +import jdk.vm.ci.meta.ExceptionHandler; +import jdk.vm.ci.meta.ResolvedJavaMethod; +import jdk.vm.ci.meta.ResolvedJavaType; +import org.junit.Assert; +import org.junit.Test; import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; @@ -56,13 +58,10 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import jdk.vm.ci.meta.ConstantPool; -import jdk.vm.ci.meta.ExceptionHandler; -import jdk.vm.ci.meta.ResolvedJavaMethod; -import jdk.vm.ci.meta.ResolvedJavaType; - -import org.junit.Assert; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; /** * Tests for {@link ResolvedJavaMethod}. diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java index b30686dfe71..a3b2b8768f5 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java @@ -36,18 +36,16 @@ package jdk.vm.ci.runtime.test; -import static java.lang.reflect.Modifier.isAbstract; -import static java.lang.reflect.Modifier.isFinal; -import static java.lang.reflect.Modifier.isPrivate; -import static java.lang.reflect.Modifier.isProtected; -import static java.lang.reflect.Modifier.isPublic; -import static java.lang.reflect.Modifier.isStatic; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import jdk.internal.reflect.ConstantPool; +import jdk.vm.ci.common.JVMCIError; +import jdk.vm.ci.meta.Assumptions.AssumptionResult; +import jdk.vm.ci.meta.JavaConstant; +import jdk.vm.ci.meta.JavaKind; +import jdk.vm.ci.meta.ModifiersProvider; +import jdk.vm.ci.meta.ResolvedJavaField; +import jdk.vm.ci.meta.ResolvedJavaMethod; +import jdk.vm.ci.meta.ResolvedJavaType; +import org.junit.Test; import java.lang.annotation.Annotation; import java.lang.reflect.Field; @@ -60,18 +58,18 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import jdk.vm.ci.common.JVMCIError; -import jdk.vm.ci.meta.Assumptions.AssumptionResult; -import jdk.vm.ci.meta.JavaConstant; -import jdk.vm.ci.meta.JavaKind; -import jdk.vm.ci.meta.ModifiersProvider; -import jdk.vm.ci.meta.ResolvedJavaField; -import jdk.vm.ci.meta.ResolvedJavaMethod; -import jdk.vm.ci.meta.ResolvedJavaType; - -import org.junit.Test; - -import jdk.internal.reflect.ConstantPool; +import static java.lang.reflect.Modifier.isAbstract; +import static java.lang.reflect.Modifier.isFinal; +import static java.lang.reflect.Modifier.isPrivate; +import static java.lang.reflect.Modifier.isProtected; +import static java.lang.reflect.Modifier.isPublic; +import static java.lang.reflect.Modifier.isStatic; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; /** * Tests for {@link ResolvedJavaType}. diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java index 2aae14cb6b9..87a16d20ce8 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java @@ -22,8 +22,14 @@ */ package jdk.vm.ci.runtime.test; -import static java.lang.reflect.Modifier.isFinal; -import static java.lang.reflect.Modifier.isStatic; +import jdk.internal.misc.Unsafe; +import jdk.vm.ci.meta.ConstantReflectionProvider; +import jdk.vm.ci.meta.JavaConstant; +import jdk.vm.ci.meta.MetaAccessProvider; +import jdk.vm.ci.meta.ResolvedJavaField; +import jdk.vm.ci.meta.ResolvedJavaType; +import jdk.vm.ci.runtime.JVMCI; +import org.junit.Test; import java.io.Serializable; import java.lang.reflect.Array; @@ -47,16 +53,8 @@ import java.util.Set; import java.util.TreeMap; import java.util.stream.Collectors; -import jdk.vm.ci.meta.ConstantReflectionProvider; -import jdk.vm.ci.meta.JavaConstant; -import jdk.vm.ci.meta.MetaAccessProvider; -import jdk.vm.ci.meta.ResolvedJavaField; -import jdk.vm.ci.meta.ResolvedJavaType; -import jdk.vm.ci.runtime.JVMCI; - -import org.junit.Test; - -import jdk.internal.misc.Unsafe; +import static java.lang.reflect.Modifier.isFinal; +import static java.lang.reflect.Modifier.isStatic; /** * Context for type related tests. diff --git a/hotspot/test/compiler/jvmci/meta/StableFieldTest.java b/hotspot/test/compiler/jvmci/meta/StableFieldTest.java index ad131e244e2..d06278e3923 100644 --- a/hotspot/test/compiler/jvmci/meta/StableFieldTest.java +++ b/hotspot/test/compiler/jvmci/meta/StableFieldTest.java @@ -39,11 +39,9 @@ package compiler.jvmci.meta; -import java.lang.reflect.Field; import jdk.internal.vm.annotation.Stable; import jdk.vm.ci.hotspot.HotSpotResolvedJavaField; import jdk.vm.ci.meta.MetaAccessProvider; -import jdk.vm.ci.meta.ResolvedJavaField; import jdk.vm.ci.runtime.JVMCI; public class StableFieldTest { diff --git a/hotspot/test/compiler/linkage/CallSites.jasm b/hotspot/test/compiler/linkage/CallSites.jasm index 813a9df40c7..8bd63d1427d 100644 --- a/hotspot/test/compiler/linkage/CallSites.jasm +++ b/hotspot/test/compiler/linkage/CallSites.jasm @@ -21,34 +21,34 @@ * questions. * */ -super class I +super class compiler/linkage/I version 52:0 { } -super class CallSites +super class compiler/linkage/CallSites version 52:0 { // Non-existent methods. // I.m1()V vs I.m1(I)V - public static Method testI1:"(LI;)V" + public static Method testI1:"(Lcompiler/linkage/I;)V" stack 1 locals 1 { aload_0; - invokeinterface InterfaceMethod I."m1":"()V", 1; // throws NSME + invokeinterface InterfaceMethod compiler/linkage/I."m1":"()V", 1; // throws NSME return; } // X.m1()V vs X.m1(I)V - public static Method testX1:"(LX;)V" + public static Method testX1:"(Lcompiler/linkage/X;)V" stack 1 locals 1 { aload_0; - invokevirtual Method X."m1":"()V"; // throws NSME + invokevirtual Method compiler/linkage/X."m1":"()V"; // throws NSME return; } @@ -58,7 +58,7 @@ version 52:0 stack 1 locals 0 { iconst_0; - invokestatic InterfaceMethod I."m1":"(I)V"; // throws ICCE + invokestatic InterfaceMethod compiler/linkage/I."m1":"(I)V"; // throws ICCE return; } @@ -66,25 +66,25 @@ version 52:0 stack 1 locals 0 { iconst_0; - invokestatic Method X."m1":"(I)V"; // throws ICCE + invokestatic Method compiler/linkage/X."m1":"(I)V"; // throws ICCE return; } // Virtual invocation of static methods. - public static Method testI3:"(LI;)V" + public static Method testI3:"(Lcompiler/linkage/I;)V" stack 1 locals 1 { aload_0; - invokeinterface InterfaceMethod I."s1":"()V", 1; // throws ICCE + invokeinterface InterfaceMethod compiler/linkage/I."s1":"()V", 1; // throws ICCE return; } - public static Method testX3:"(LX;)V" + public static Method testX3:"(Lcompiler/linkage/X;)V" stack 1 locals 1 { aload_0; - invokevirtual Method X."s1":"()V"; // throws ICCE + invokevirtual Method compiler/linkage/X."s1":"()V"; // throws ICCE return; } diff --git a/hotspot/test/compiler/linkage/LinkageErrors.java b/hotspot/test/compiler/linkage/LinkageErrors.java index 0a1b2a8b954..0334604e542 100644 --- a/hotspot/test/compiler/linkage/LinkageErrors.java +++ b/hotspot/test/compiler/linkage/LinkageErrors.java @@ -25,10 +25,16 @@ * @test * @bug 8132879 * @compile CallSites.jasm - * @run main/othervm -Xverify:all -Xbatch -XX:CompileCommand=dontinline,Test::test* LinkageErrors + * @run main/othervm -Xverify:all -Xbatch + * -XX:CompileCommand=dontinline,compiler.linkage.LinkageErrors::test* + * compiler.linkage.LinkageErrors */ -import java.lang.invoke.*; +package compiler.linkage; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; interface I { void m1(int i); @@ -62,7 +68,7 @@ public class LinkageErrors { } public static void main(String args[]) throws Throwable { - Class test = Class.forName("CallSites"); + Class test = Class.forName("compiler.linkage.CallSites"); // Non-existent method lookups. MethodHandle testI1 = L.findStatic(test, "testI1", MethodType.methodType(void.class, I.class)); diff --git a/hotspot/test/compiler/loopopts/7044738/Test7044738.java b/hotspot/test/compiler/loopopts/7044738/Test7044738.java deleted file mode 100644 index 6b2a8d10172..00000000000 --- a/hotspot/test/compiler/loopopts/7044738/Test7044738.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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 7044738 - * @summary Loop unroll optimization causes incorrect result - * - * @run main/othervm -Xbatch Test7044738 - */ - -public class Test7044738 { - - private static final int INITSIZE = 10000; - public int d[] = { 1, 2, 3, 4 }; - public int i, size; - - private static int iter = 5; - - boolean done() { return (--iter > 0); } - - public static void main(String args[]) { - Test7044738 t = new Test7044738(); - t.test(); - } - - int test() { - - while (done()) { - size = INITSIZE; - - for (i = 0; i < size; i++) { - d[0] = d[1]; // 2 - d[1] = d[2]; // 3 - d[2] = d[3]; // 4 - d[3] = d[0]; // 2 - - d[0] = d[1]; // 3 - d[1] = d[2]; // 4 - d[2] = d[3]; // 2 - d[3] = d[0]; // 3 - - d[0] = d[1]; // 4 - d[1] = d[2]; // 2 - d[2] = d[3]; // 3 - d[3] = d[0]; // 4 - - d[0] = d[1]; // 2 - d[1] = d[2]; // 3 - d[2] = d[3]; // 4 - d[3] = d[0]; // 2 - - d[0] = d[1]; // 3 - d[1] = d[2]; // 4 - d[2] = d[3]; // 2 - d[3] = d[0]; // 3 - - d[0] = d[1]; // 4 - d[1] = d[2]; // 2 - d[2] = d[3]; // 3 - d[3] = d[0]; // 4 - - d[0] = d[1]; // 2 - d[1] = d[2]; // 3 - d[2] = d[3]; // 4 - d[3] = d[0]; // 2 - - d[0] = d[1]; // 3 - d[1] = d[2]; // 4 - d[2] = d[3]; // 2 - d[3] = d[0]; // 3 - } - - // try to defeat dead code elimination - if (d[0] == d[1]) { - System.out.println("test failed: iter=" + iter + " i=" + i + " d[] = { " + d[0] + ", " + d[1] + ", " + d[2] + ", " + d[3] + " } "); - System.exit(97); - } - } - return d[3]; - } - -} diff --git a/hotspot/test/compiler/loopopts/7052494/Test7052494.java b/hotspot/test/compiler/loopopts/7052494/Test7052494.java deleted file mode 100644 index 62aa12fc427..00000000000 --- a/hotspot/test/compiler/loopopts/7052494/Test7052494.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2011, 2014, 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 7052494 - * @summary Eclipse test fails on JDK 7 b142 - * - * @run main/othervm -Xbatch Test7052494 - */ - - -public class Test7052494 { - - static int test1(int i, int limit) { - int result = 0; - while (i++ != 0) { - if (result >= limit) - break; - result = i*2; - } - return result; - } - - static int test2(int i, int limit) { - int result = 0; - while (i-- != 0) { - if (result <= limit) - break; - result = i*2; - } - return result; - } - - static void test3(int i, int limit, int arr[]) { - while (i++ != 0) { - if (arr[i-1] >= limit) - break; - arr[i] = i*2; - } - } - - static void test4(int i, int limit, int arr[]) { - while (i-- != 0) { - if (arr[arr.length + i + 1] <= limit) - break; - arr[arr.length + i] = i*2; - } - } - - // 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++ != 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-- != limit6) { - result = i*2; - } - return result; - } - - public static void main(String [] args) { - boolean failed = false; - 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) { - System.out.println("FAILED: " + k + " != 10"); - failed = true; - break; - } - } - System.out.println("test2"); - for (int i = 0; i < 11000; i++) { - int k = test2(-1, -10); - if (k != -10) { - System.out.println("FAILED: " + k + " != -10"); - failed = true; - break; - } - } - System.out.println("test3"); - for (int i = 0; i < 11000; i++) { - java.util.Arrays.fill(arr, 0); - test3(1, 10, arr); - if (!java.util.Arrays.equals(arr,ar3)) { - System.out.println("FAILED: arr = { " + arr[0] + ", " - + arr[1] + ", " - + arr[2] + ", " - + arr[3] + ", " - + arr[4] + ", " - + arr[5] + ", " - + arr[6] + ", " - + arr[7] + " }"); - failed = true; - break; - } - } - System.out.println("test4"); - for (int i = 0; i < 11000; i++) { - java.util.Arrays.fill(arr, 0); - test4(-1, -10, arr); - if (!java.util.Arrays.equals(arr,ar4)) { - System.out.println("FAILED: arr = { " + arr[0] + ", " - + arr[1] + ", " - + arr[2] + ", " - + arr[3] + ", " - + arr[4] + ", " - + arr[5] + ", " - + arr[6] + ", " - + arr[7] + " }"); - failed = true; - break; - } - } - System.out.println("test5"); - for (int i = 0; i < 11000; i++) { - 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(limit5); - if (k != limit6*2) { - System.out.println("FAILED: " + k + " != " + limit6*2); - failed = true; - break; - } - } - System.out.println("finish"); - if (failed) - System.exit(97); - } -} diff --git a/hotspot/test/compiler/loopopts/BadPredicateAfterPartialPeel.java b/hotspot/test/compiler/loopopts/BadPredicateAfterPartialPeel.java index 186f1cc1a7d..36c13ec398a 100644 --- a/hotspot/test/compiler/loopopts/BadPredicateAfterPartialPeel.java +++ b/hotspot/test/compiler/loopopts/BadPredicateAfterPartialPeel.java @@ -26,10 +26,16 @@ * @test * @bug 8146792 * @summary Predicate moved after partial peel may lead to broken graph - * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileOnly=BadPredicateAfterPartialPeel::m -XX:CompileCommand=dontinline,BadPredicateAfterPartialPeel::not_inlined* -XX:CompileCommand=quiet BadPredicateAfterPartialPeel - * + * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation + * -XX:-UseOnStackReplacement + * -XX:CompileCommand=compileonly,compiler.loopopts.BadPredicateAfterPartialPeel::m + * -XX:CompileCommand=dontinline,compiler.loopopts.BadPredicateAfterPartialPeel::not_inlined* + * -XX:CompileCommand=quiet + * compiler.loopopts.BadPredicateAfterPartialPeel */ +package compiler.loopopts; + public class BadPredicateAfterPartialPeel { static void not_inlined1() {} diff --git a/hotspot/test/compiler/loopopts/ConstFPVectorization.java b/hotspot/test/compiler/loopopts/ConstFPVectorization.java index 50cb0e614ec..dfb10c74601 100644 --- a/hotspot/test/compiler/loopopts/ConstFPVectorization.java +++ b/hotspot/test/compiler/loopopts/ConstFPVectorization.java @@ -26,11 +26,12 @@ * @test * @bug 8074869 * @summary C2 code generator can replace -0.0f with +0.0f on Linux - * @run main ConstFPVectorization 8 + * @run main compiler.loopopts.ConstFPVectorization 8 * @author volker.simonis@gmail.com - * */ +package compiler.loopopts; + public class ConstFPVectorization { static float[] f = new float[16]; diff --git a/hotspot/test/compiler/loopopts/CountedLoopProblem.java b/hotspot/test/compiler/loopopts/CountedLoopProblem.java index 23cc0bb39e6..be23ae85c7b 100644 --- a/hotspot/test/compiler/loopopts/CountedLoopProblem.java +++ b/hotspot/test/compiler/loopopts/CountedLoopProblem.java @@ -26,11 +26,13 @@ * @test * @bug 8072753 * @summary Inner loop induction variable increment occurs before compare which causes integer overflow - * @run main/othervm CountedLoopProblem + * @run main/othervm compiler.loopopts.CountedLoopProblem * */ -import java.util.*; +package compiler.loopopts; + +import java.util.Random; public class CountedLoopProblem { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/compiler/loopopts/6659207/Test.java b/hotspot/test/compiler/loopopts/Test6659207.java similarity index 94% rename from hotspot/test/compiler/loopopts/6659207/Test.java rename to hotspot/test/compiler/loopopts/Test6659207.java index a35b1c7416b..1ad8576864a 100644 --- a/hotspot/test/compiler/loopopts/6659207/Test.java +++ b/hotspot/test/compiler/loopopts/Test6659207.java @@ -26,9 +26,13 @@ * @test * @bug 6659207 * @summary access violation in CompilerThread0 + * + * @run main compiler.loopopts.Test6659207 */ -public class Test { +package compiler.loopopts; + +public class Test6659207 { static int[] array = new int[12]; static int index(int i) { diff --git a/hotspot/test/compiler/loopopts/6855164/Test.java b/hotspot/test/compiler/loopopts/Test6855164.java similarity index 94% rename from hotspot/test/compiler/loopopts/6855164/Test.java rename to hotspot/test/compiler/loopopts/Test6855164.java index 3743d87f218..7d4b54cba54 100644 --- a/hotspot/test/compiler/loopopts/6855164/Test.java +++ b/hotspot/test/compiler/loopopts/Test6855164.java @@ -25,10 +25,13 @@ * @test * @bug 6855164 * @summary SIGSEGV during compilation of method involving loop over CharSequence - * @run main/othervm -Xbatch Test + * + * @run main/othervm -Xbatch compiler.loopopts.Test6855164 */ -public class Test{ +package compiler.loopopts; + +public class Test6855164 { public static void main(String[] args) throws Exception { StringBuffer builder = new StringBuffer(); diff --git a/hotspot/test/compiler/loopopts/6860469/Test.java b/hotspot/test/compiler/loopopts/Test6860469.java similarity index 57% rename from hotspot/test/compiler/loopopts/6860469/Test.java rename to hotspot/test/compiler/loopopts/Test6860469.java index 2a736d37e35..a3b6a2ded67 100644 --- a/hotspot/test/compiler/loopopts/6860469/Test.java +++ b/hotspot/test/compiler/loopopts/Test6860469.java @@ -27,45 +27,49 @@ * @bug 6860469 * @summary remix_address_expressions reshapes address expression with bad control * - * @run main/othervm -Xcomp -XX:CompileOnly=Test.C Test + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.loopopts.Test6860469::C + * compiler.loopopts.Test6860469 */ -public class Test { +package compiler.loopopts; - private static final int H = 16; - private static final int F = 9; +public class Test6860469 { - static int[] fl = new int[1 << F]; + private static final int H = 16; + private static final int F = 9; - static int C(int ll, int f) { - int max = -1; - int min = H + 1; + static int[] fl = new int[1 << F]; - if (ll != 0) { - if (ll < min) { - min = ll; - } - if (ll > max) { - max = ll; - } + static int C(int ll, int f) { + int max = -1; + int min = H + 1; + + if (ll != 0) { + if (ll < min) { + min = ll; + } + if (ll > max) { + max = ll; + } + } + + if (f > max) { + f = max; + } + if (min > f) { + min = f; + } + + for (int mc = 1 >> max - f; mc <= 0; mc++) { + int i = mc << (32 - f); + fl[i] = max; + } + + return min; } - if (f > max) { - f = max; + public static void main(String argv[]) { + C(0, 10); } - if (min > f) { - min = f; - } - - for (int mc = 1 >> max - f; mc <= 0; mc++) { - int i = mc << (32 - f); - fl[i] = max; - } - - return min; - } - - public static void main(String argv[]) { - C(0, 10); - } } diff --git a/hotspot/test/compiler/loopopts/Test7044738.java b/hotspot/test/compiler/loopopts/Test7044738.java new file mode 100644 index 00000000000..b7e64d33ce6 --- /dev/null +++ b/hotspot/test/compiler/loopopts/Test7044738.java @@ -0,0 +1,107 @@ +/* + * 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 7044738 + * @summary Loop unroll optimization causes incorrect result + * + * @run main/othervm -Xbatch compiler.loopopts.Test7044738 + */ + +package compiler.loopopts; + +public class Test7044738 { + + private static final int INITSIZE = 10000; + public int d[] = {1, 2, 3, 4}; + public int i, size; + + private static int iter = 5; + + boolean done() { + return (--iter > 0); + } + + public static void main(String args[]) { + Test7044738 t = new Test7044738(); + t.test(); + } + + int test() { + + while (done()) { + size = INITSIZE; + + for (i = 0; i < size; i++) { + d[0] = d[1]; // 2 + d[1] = d[2]; // 3 + d[2] = d[3]; // 4 + d[3] = d[0]; // 2 + + d[0] = d[1]; // 3 + d[1] = d[2]; // 4 + d[2] = d[3]; // 2 + d[3] = d[0]; // 3 + + d[0] = d[1]; // 4 + d[1] = d[2]; // 2 + d[2] = d[3]; // 3 + d[3] = d[0]; // 4 + + d[0] = d[1]; // 2 + d[1] = d[2]; // 3 + d[2] = d[3]; // 4 + d[3] = d[0]; // 2 + + d[0] = d[1]; // 3 + d[1] = d[2]; // 4 + d[2] = d[3]; // 2 + d[3] = d[0]; // 3 + + d[0] = d[1]; // 4 + d[1] = d[2]; // 2 + d[2] = d[3]; // 3 + d[3] = d[0]; // 4 + + d[0] = d[1]; // 2 + d[1] = d[2]; // 3 + d[2] = d[3]; // 4 + d[3] = d[0]; // 2 + + d[0] = d[1]; // 3 + d[1] = d[2]; // 4 + d[2] = d[3]; // 2 + d[3] = d[0]; // 3 + } + + // try to defeat dead code elimination + if (d[0] == d[1]) { + System.out.println("test failed: iter=" + iter + " i=" + i + " d[] = { " + d[0] + ", " + d[1] + ", " + d[2] + ", " + d[3] + " } "); + System.exit(97); + } + } + return d[3]; + } +} diff --git a/hotspot/test/compiler/loopopts/Test7052494.java b/hotspot/test/compiler/loopopts/Test7052494.java new file mode 100644 index 00000000000..1729a16002b --- /dev/null +++ b/hotspot/test/compiler/loopopts/Test7052494.java @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2011, 2014, 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 7052494 + * @summary Eclipse test fails on JDK 7 b142 + * + * @run main/othervm -Xbatch compiler.loopopts.Test7052494 + */ + +package compiler.loopopts; + +public class Test7052494 { + + static int test1(int i, int limit) { + int result = 0; + while (i++ != 0) { + if (result >= limit) + break; + result = i * 2; + } + return result; + } + + static int test2(int i, int limit) { + int result = 0; + while (i-- != 0) { + if (result <= limit) + break; + result = i * 2; + } + return result; + } + + static void test3(int i, int limit, int arr[]) { + while (i++ != 0) { + if (arr[i - 1] >= limit) + break; + arr[i] = i * 2; + } + } + + static void test4(int i, int limit, int arr[]) { + while (i-- != 0) { + if (arr[arr.length + i + 1] <= limit) + break; + arr[arr.length + i] = i * 2; + } + } + + // 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++ != 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-- != limit6) { + result = i * 2; + } + return result; + } + + public static void main(String[] args) { + boolean failed = false; + 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) { + System.out.println("FAILED: " + k + " != 10"); + failed = true; + break; + } + } + System.out.println("test2"); + for (int i = 0; i < 11000; i++) { + int k = test2(-1, -10); + if (k != -10) { + System.out.println("FAILED: " + k + " != -10"); + failed = true; + break; + } + } + System.out.println("test3"); + for (int i = 0; i < 11000; i++) { + java.util.Arrays.fill(arr, 0); + test3(1, 10, arr); + if (!java.util.Arrays.equals(arr, ar3)) { + System.out.println("FAILED: arr = { " + arr[0] + ", " + + arr[1] + ", " + + arr[2] + ", " + + arr[3] + ", " + + arr[4] + ", " + + arr[5] + ", " + + arr[6] + ", " + + arr[7] + " }"); + failed = true; + break; + } + } + System.out.println("test4"); + for (int i = 0; i < 11000; i++) { + java.util.Arrays.fill(arr, 0); + test4(-1, -10, arr); + if (!java.util.Arrays.equals(arr, ar4)) { + System.out.println("FAILED: arr = { " + arr[0] + ", " + + arr[1] + ", " + + arr[2] + ", " + + arr[3] + ", " + + arr[4] + ", " + + arr[5] + ", " + + arr[6] + ", " + + arr[7] + " }"); + failed = true; + break; + } + } + System.out.println("test5"); + for (int i = 0; i < 11000; i++) { + 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(limit5); + if (k != limit6 * 2) { + System.out.println("FAILED: " + k + " != " + limit6 * 2); + failed = true; + break; + } + } + System.out.println("finish"); + if (failed) { + System.exit(97); + } + } +} diff --git a/hotspot/test/compiler/loopopts/TestArraysFillDeadControl.java b/hotspot/test/compiler/loopopts/TestArraysFillDeadControl.java index 540ba42b83e..1f9ce25dec7 100644 --- a/hotspot/test/compiler/loopopts/TestArraysFillDeadControl.java +++ b/hotspot/test/compiler/loopopts/TestArraysFillDeadControl.java @@ -26,10 +26,14 @@ * @test * @bug 8147645 * @summary Array.fill intrinsification code doesn't mark replaced control as dead - * @run main/othervm -XX:-TieredCompilation -XX:CompileCommand=dontinline,TestArraysFillDeadControl::dont_inline TestArraysFillDeadControl * + * @run main/othervm -XX:-TieredCompilation + * -XX:CompileCommand=dontinline,compiler.loopopts.TestArraysFillDeadControl::dont_inline + * compiler.loopopts.TestArraysFillDeadControl */ +package compiler.loopopts; + import java.util.Arrays; public class TestArraysFillDeadControl { diff --git a/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java b/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java index 9dc2e1422ac..bb0c35af95e 100644 --- a/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java +++ b/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java @@ -26,10 +26,13 @@ * @test * @bug 8073184 * @summary CastII that guards counted loops confuses range check elimination with LoopLimitCheck off - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:CompileOnly=TestCastIINoLoopLimitCheck.m -Xcomp TestCastIINoLoopLimitCheck * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp + * -XX:CompileCommand=compileonly,compiler.loopopts.TestCastIINoLoopLimitCheck::m + * compiler.loopopts.TestCastIINoLoopLimitCheck */ +package compiler.loopopts; /* * The test was originally run with * diff --git a/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java b/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java index f2782383f71..e3deae85e1a 100644 --- a/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java +++ b/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java @@ -26,10 +26,14 @@ * @test * @bug 8054478 * @summary dead backbranch in main loop results in erroneous array access - * @run main/othervm -XX:CompileOnly=TestDeadBackbranchArrayAccess -Xcomp TestDeadBackbranchArrayAccess * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.loopopts.TestDeadBackbranchArrayAccess::* + * compiler.loopopts.TestDeadBackbranchArrayAccess */ +package compiler.loopopts; + public class TestDeadBackbranchArrayAccess { static char[] pattern0 = {0}; static char[] pattern1 = {1}; diff --git a/hotspot/test/compiler/loopopts/TestLogSum.java b/hotspot/test/compiler/loopopts/TestLogSum.java index a32963dfa02..cbd13fdd7b7 100644 --- a/hotspot/test/compiler/loopopts/TestLogSum.java +++ b/hotspot/test/compiler/loopopts/TestLogSum.java @@ -25,14 +25,18 @@ * @test * @bug 8046516 * @summary Segmentation fault in JVM (easily reproducible) - * @run main/othervm -XX:-TieredCompilation -Xbatch TestLogSum + * + * @run main/othervm -XX:-TieredCompilation -Xbatch compiler.loopopts.TestLogSum * @author jackkamm@gmail.com */ +package compiler.loopopts; + import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; + public class TestLogSum { public static void main(String[] args) { double sum; diff --git a/hotspot/test/compiler/loopopts/TestLoopPeeling.java b/hotspot/test/compiler/loopopts/TestLoopPeeling.java index d2d2e3d7848..3627ff5726c 100644 --- a/hotspot/test/compiler/loopopts/TestLoopPeeling.java +++ b/hotspot/test/compiler/loopopts/TestLoopPeeling.java @@ -25,8 +25,14 @@ * @test * @bug 8078262 * @summary Tests correct dominator information after loop peeling. - * @run main/othervm -Xcomp -XX:CompileCommand=compileonly,TestLoopPeeling::test* TestLoopPeeling + * + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.loopopts.TestLoopPeeling::test* + * compiler.loopopts.TestLoopPeeling */ + +package compiler.loopopts; + public class TestLoopPeeling { public int[] array = new int[100]; diff --git a/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java b/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java index af99d6b16dc..ea70d700da9 100644 --- a/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java +++ b/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java @@ -26,13 +26,18 @@ * @test * @bug 8080289 * @summary Move stores out of loops if possible - * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestMoveStoresOutOfLoops::test* TestMoveStoresOutOfLoops * + * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation + * -XX:CompileCommand=dontinline,compiler.loopopts.TestMoveStoresOutOfLoops::test* + * compiler.loopopts.TestMoveStoresOutOfLoops */ -import java.lang.reflect.*; -import java.util.*; -import java.util.function.*; +package compiler.loopopts; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.HashMap; +import java.util.function.Function; public class TestMoveStoresOutOfLoops { diff --git a/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoopsStoreNoCtrl.java b/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoopsStoreNoCtrl.java index ec9dcd5d8da..8419ae156e0 100644 --- a/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoopsStoreNoCtrl.java +++ b/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoopsStoreNoCtrl.java @@ -25,10 +25,14 @@ * @test * @bug 8134288 * @summary Store nodes may not have a control if used to update profiling - * @run main/othervm -XX:-ProfileInterpreter -XX:-TieredCompilation -XX:-BackgroundCompilation TestMoveStoresOutOfLoopsStoreNoCtrl * + * @run main/othervm -XX:-ProfileInterpreter -XX:-TieredCompilation + * -XX:-BackgroundCompilation + * compiler.loopopts.TestMoveStoresOutOfLoopsStoreNoCtrl */ +package compiler.loopopts; + public class TestMoveStoresOutOfLoopsStoreNoCtrl { static void test(boolean flag) { diff --git a/hotspot/test/compiler/loopopts/TestOverunrolling.java b/hotspot/test/compiler/loopopts/TestOverunrolling.java index 28a5759b691..0223048cab8 100644 --- a/hotspot/test/compiler/loopopts/TestOverunrolling.java +++ b/hotspot/test/compiler/loopopts/TestOverunrolling.java @@ -24,11 +24,16 @@ /* * @test * @bug 8159016 - * @requires vm.gc == "Parallel" | vm.gc == "null" * @summary Tests correct dominator information after over-unrolling a loop. + * @requires vm.gc == "Parallel" | vm.gc == "null" + * * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-TieredCompilation - * -XX:-UseG1GC -XX:+UseParallelGC TestOverunrolling + * -XX:-UseG1GC -XX:+UseParallelGC + * compiler.loopopts.TestOverunrolling */ + +package compiler.loopopts; + public class TestOverunrolling { public static Object test(int arg) { diff --git a/hotspot/test/compiler/loopopts/TestPredicateLostDependency.java b/hotspot/test/compiler/loopopts/TestPredicateLostDependency.java index a9986c24155..a1ee8d26231 100644 --- a/hotspot/test/compiler/loopopts/TestPredicateLostDependency.java +++ b/hotspot/test/compiler/loopopts/TestPredicateLostDependency.java @@ -26,10 +26,15 @@ * @test * @bug 8069191 * @summary predicate moved out of loops and CastPP removal causes dependency to be lost - * @run main/othervm -Xcomp -XX:CompileOnly=TestPredicateLostDependency.m1 -XX:+IgnoreUnrecognizedVMOptions -XX:+StressGCM TestPredicateLostDependency + * + * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+StressGCM + * -XX:CompileCommand=compileonly,compiler.loopopts.TestPredicateLostDependency::m1 + * compiler.loopopts.TestPredicateLostDependency * */ +package compiler.loopopts; + public class TestPredicateLostDependency { static class A { int i; diff --git a/hotspot/test/compiler/loopopts/TestSplitIfBlocksDisabled.java b/hotspot/test/compiler/loopopts/TestSplitIfBlocksDisabled.java index 63745f7f348..38979a36625 100644 --- a/hotspot/test/compiler/loopopts/TestSplitIfBlocksDisabled.java +++ b/hotspot/test/compiler/loopopts/TestSplitIfBlocksDisabled.java @@ -26,8 +26,13 @@ * @test TestSplitIfBlocksDisabled * @bug 8086057 * @summary Verifies that loop optimizations work if SplitIfBlocks is disabled. - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-SplitIfBlocks TestSplitIfBlocksDisabled + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-SplitIfBlocks + * compiler.loopopts.TestSplitIfBlocksDisabled */ + +package compiler.loopopts; + public class TestSplitIfBlocksDisabled { public static void main(String[] args) { diff --git a/hotspot/test/compiler/loopopts/TestSplitIfUnswitchedLoopsEliminated.java b/hotspot/test/compiler/loopopts/TestSplitIfUnswitchedLoopsEliminated.java index 78cda884119..b2789435fc8 100644 --- a/hotspot/test/compiler/loopopts/TestSplitIfUnswitchedLoopsEliminated.java +++ b/hotspot/test/compiler/loopopts/TestSplitIfUnswitchedLoopsEliminated.java @@ -26,10 +26,13 @@ * @test * @bug 8078426 * @summary split if finds predicates on several incoming paths when unswitched's loops are optimized out - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:-UseCompressedOops TestSplitIfUnswitchedLoopsEliminated * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement + * -XX:-BackgroundCompilation -XX:-UseCompressedOops + * compiler.loopopts.TestSplitIfUnswitchedLoopsEliminated */ +package compiler.loopopts; public class TestSplitIfUnswitchedLoopsEliminated { diff --git a/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java b/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java index 67cd3c91b06..77a9445642a 100644 --- a/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java +++ b/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java @@ -28,14 +28,16 @@ * @summary Test that C2 flag UseCountedLoopSafepoints ensures a safepoint is kept in a CountedLoop * @library /testlibrary * @modules java.base/jdk.internal.misc - * @modules java.base * @ignore 8146096 - * @run main UseCountedLoopSafepoints + * @run driver compiler.loopopts.UseCountedLoopSafepoints */ -import java.util.concurrent.atomic.AtomicLong; -import jdk.test.lib.ProcessTools; +package compiler.loopopts; + import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; + +import java.util.concurrent.atomic.AtomicLong; public class UseCountedLoopSafepoints { private static final AtomicLong _num = new AtomicLong(0); @@ -59,7 +61,7 @@ public class UseCountedLoopSafepoints { "-XX:+SafepointTimeout", "-XX:SafepointTimeoutDelay=2000", "-XX:+UseCountedLoopSafepoints", - "UseCountedLoopSafepoints", + UseCountedLoopSafepoints.class.getName(), "2000000000" ); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/hotspot/test/compiler/loopopts/superword/ProdRed_Double.java b/hotspot/test/compiler/loopopts/superword/ProdRed_Double.java index 37e9fca45d6..d225ecc3d48 100644 --- a/hotspot/test/compiler/loopopts/superword/ProdRed_Double.java +++ b/hotspot/test/compiler/loopopts/superword/ProdRed_Double.java @@ -28,56 +28,85 @@ * @summary Add C2 x86 Superword support for scalar product reduction optimizations : float test * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 ProdRed_Double - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 ProdRed_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.ProdRed_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.ProdRed_Double * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 ProdRed_Double - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 ProdRed_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.ProdRed_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.ProdRed_Double * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 ProdRed_Double - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 ProdRed_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.ProdRed_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.ProdRed_Double * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 ProdRed_Double - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 ProdRed_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.ProdRed_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.ProdRed_Double */ -public class ProdRed_Double -{ - public static void main(String[] args) throws Exception { - double[] a = new double[256*1024]; - double[] b = new double[256*1024]; - prodReductionInit(a,b); - double valid = 2000; - double total = 0; - for(int j = 0; j < 2000; j++) { - total = j + 1; - total = prodReductionImplement(a,b, total); - } - if(total == valid) { - System.out.println("Success"); - } else { - System.out.println("Invalid sum of elements variable in total: " + total); - System.out.println("Expected value = " + valid); - throw new Exception("Failed"); - } - } +package compiler.loopopts.superword; - public static void prodReductionInit(double[] a, double[] b) - { - for(int i = 0; i < a.length; i++) - { - a[i] = i + 2; - b[i] = i + 1; +public class ProdRed_Double { + public static void main(String[] args) throws Exception { + double[] a = new double[256 * 1024]; + double[] b = new double[256 * 1024]; + prodReductionInit(a, b); + double valid = 2000; + double total = 0; + for (int j = 0; j < 2000; j++) { + total = j + 1; + total = prodReductionImplement(a, b, total); + } + if (total == valid) { + System.out.println("Success"); + } else { + System.out.println("Invalid sum of elements variable in total: " + total); + System.out.println("Expected value = " + valid); + throw new Exception("Failed"); + } } - } - public static double prodReductionImplement(double[] a, double[] b, double total) - { - for(int i = 0; i < a.length; i++) - { - total *= a[i] - b[i]; + public static void prodReductionInit(double[] a, double[] b) { + for (int i = 0; i < a.length; i++) { + a[i] = i + 2; + b[i] = i + 1; + } + } + + public static double prodReductionImplement(double[] a, double[] b, double total) { + for (int i = 0; i < a.length; i++) { + total *= a[i] - b[i]; + } + return total; } - return total; - } } diff --git a/hotspot/test/compiler/loopopts/superword/ProdRed_Float.java b/hotspot/test/compiler/loopopts/superword/ProdRed_Float.java index b31cf10ea9c..d6702ec1d77 100644 --- a/hotspot/test/compiler/loopopts/superword/ProdRed_Float.java +++ b/hotspot/test/compiler/loopopts/superword/ProdRed_Float.java @@ -28,56 +28,85 @@ * @summary Add C2 x86 Superword support for scalar product reduction optimizations : float test * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 ProdRed_Float - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 ProdRed_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.ProdRed_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.ProdRed_Float * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 ProdRed_Float - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 ProdRed_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.ProdRed_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.ProdRed_Float * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 ProdRed_Float - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 ProdRed_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.ProdRed_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.ProdRed_Float * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 ProdRed_Float - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 ProdRed_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.ProdRed_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.ProdRed_Float */ -public class ProdRed_Float -{ - public static void main(String[] args) throws Exception { - float[] a = new float[256*1024]; - float[] b = new float[256*1024]; - prodReductionInit(a,b); - float valid = 2000; - float total = 0; - for(int j = 0; j < 2000; j++) { - total = j + 1; - total = prodReductionImplement(a,b, total); - } - if(total == valid) { - System.out.println("Success"); - } else { - System.out.println("Invalid sum of elements variable in total: " + total); - System.out.println("Expected value = " + valid); - throw new Exception("Failed"); - } - } +package compiler.loopopts.superword; - public static void prodReductionInit(float[] a, float[] b) - { - for(int i = 0; i < a.length; i++) - { - a[i] = i + 2; - b[i] = i + 1; +public class ProdRed_Float { + public static void main(String[] args) throws Exception { + float[] a = new float[256 * 1024]; + float[] b = new float[256 * 1024]; + prodReductionInit(a, b); + float valid = 2000; + float total = 0; + for (int j = 0; j < 2000; j++) { + total = j + 1; + total = prodReductionImplement(a, b, total); + } + if (total == valid) { + System.out.println("Success"); + } else { + System.out.println("Invalid sum of elements variable in total: " + total); + System.out.println("Expected value = " + valid); + throw new Exception("Failed"); + } } - } - public static float prodReductionImplement(float[] a, float[] b, float total) - { - for(int i = 0; i < a.length; i++) - { - total *= a[i] - b[i]; + public static void prodReductionInit(float[] a, float[] b) { + for (int i = 0; i < a.length; i++) { + a[i] = i + 2; + b[i] = i + 1; + } + } + + public static float prodReductionImplement(float[] a, float[] b, float total) { + for (int i = 0; i < a.length; i++) { + total *= a[i] - b[i]; + } + return total; } - return total; - } } diff --git a/hotspot/test/compiler/loopopts/superword/ProdRed_Int.java b/hotspot/test/compiler/loopopts/superword/ProdRed_Int.java index a1e8356714d..423cdfa5752 100644 --- a/hotspot/test/compiler/loopopts/superword/ProdRed_Int.java +++ b/hotspot/test/compiler/loopopts/superword/ProdRed_Int.java @@ -28,55 +28,84 @@ * @summary Add C2 x86 Superword support for scalar product reduction optimizations : int test * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 ProdRed_Int - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 ProdRed_Int + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.ProdRed_Int + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.ProdRed_Int * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 ProdRed_Int - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 ProdRed_Int + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.ProdRed_Int + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.ProdRed_Int * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 ProdRed_Int - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 ProdRed_Int + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.ProdRed_Int + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.ProdRed_Int * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 ProdRed_Int - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 ProdRed_Int + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.ProdRed_Int + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.ProdRed_Int */ -public class ProdRed_Int -{ - public static void main(String[] args) throws Exception { - int[] a = new int[256*1024]; - int[] b = new int[256*1024]; - prodReductionInit(a,b); - int valid = 419430401; - int total = 1; - for(int j = 0; j < 2000; j++) { - total = prodReductionImplement(a,b,total); - } - if(total == valid) { - System.out.println("Success"); - } else { - System.out.println("Invalid sum of elements variable in total: " + total); - System.out.println("Expected value = " + valid); - throw new Exception("Failed"); - } - } +package compiler.loopopts.superword; - public static void prodReductionInit(int[] a, int[] b) - { - for(int i = 0; i < a.length; i++) - { - a[i] = i + 2; - b[i] = i + 1; +public class ProdRed_Int { + public static void main(String[] args) throws Exception { + int[] a = new int[256 * 1024]; + int[] b = new int[256 * 1024]; + prodReductionInit(a, b); + int valid = 419430401; + int total = 1; + for (int j = 0; j < 2000; j++) { + total = prodReductionImplement(a, b, total); + } + if (total == valid) { + System.out.println("Success"); + } else { + System.out.println("Invalid sum of elements variable in total: " + total); + System.out.println("Expected value = " + valid); + throw new Exception("Failed"); + } } - } - public static int prodReductionImplement(int[] a, int[] b, int total) - { - for(int i = 0; i < a.length; i++) - { - total *= a[i] + b[i]; + public static void prodReductionInit(int[] a, int[] b) { + for (int i = 0; i < a.length; i++) { + a[i] = i + 2; + b[i] = i + 1; + } + } + + public static int prodReductionImplement(int[] a, int[] b, int total) { + for (int i = 0; i < a.length; i++) { + total *= a[i] + b[i]; + } + return total; } - return total; - } } diff --git a/hotspot/test/compiler/loopopts/superword/ReductionPerf.java b/hotspot/test/compiler/loopopts/superword/ReductionPerf.java index a91f70f83fd..0496b9a1e0a 100644 --- a/hotspot/test/compiler/loopopts/superword/ReductionPerf.java +++ b/hotspot/test/compiler/loopopts/superword/ReductionPerf.java @@ -28,226 +28,236 @@ * @summary Add C2 x86 Superword support for scalar product reduction optimizations : int test * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:CompileThresholdScaling=0.1 -XX:CompileCommand=exclude,ReductionPerf::main ReductionPerf - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:CompileThresholdScaling=0.1 -XX:CompileCommand=exclude,ReductionPerf::main ReductionPerf + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions + * -XX:LoopUnrollLimit=250 -XX:CompileThresholdScaling=0.1 + * -XX:CompileCommand=exclude,compiler.loopopts.superword.ReductionPerf::main + * -XX:+SuperWordReductions + * compiler.loopopts.superword.ReductionPerf + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions + * -XX:LoopUnrollLimit=250 -XX:CompileThresholdScaling=0.1 + * -XX:CompileCommand=exclude,compiler.loopopts.superword.ReductionPerf::main + * -XX:-SuperWordReductions + * compiler.loopopts.superword.ReductionPerf */ +package compiler.loopopts.superword; + public class ReductionPerf { - public static void main(String[] args) throws Exception { - int[] a1 = new int[8*1024]; - int[] a2 = new int[8*1024]; - int[] a3 = new int[8*1024]; - long[] b1 = new long[8*1024]; - long[] b2 = new long[8*1024]; - long[] b3 = new long[8*1024]; - float[] c1 = new float[8*1024]; - float[] c2 = new float[8*1024]; - float[] c3 = new float[8*1024]; - double[] d1 = new double[8*1024]; - double[] d2 = new double[8*1024]; - double[] d3 = new double[8*1024]; + public static void main(String[] args) throws Exception { + int[] a1 = new int[8 * 1024]; + int[] a2 = new int[8 * 1024]; + int[] a3 = new int[8 * 1024]; + long[] b1 = new long[8 * 1024]; + long[] b2 = new long[8 * 1024]; + long[] b3 = new long[8 * 1024]; + float[] c1 = new float[8 * 1024]; + float[] c2 = new float[8 * 1024]; + float[] c3 = new float[8 * 1024]; + double[] d1 = new double[8 * 1024]; + double[] d2 = new double[8 * 1024]; + double[] d3 = new double[8 * 1024]; - ReductionInit(a1,a2,a3,b1,b2,b3,c1,c2,c3,d1,d2,d3); + ReductionInit(a1, a2, a3, b1, b2, b3, c1, c2, c3, d1, d2, d3); - int sumIv = sumInt(a1,a2,a3); - long sumLv = sumLong(b1,b2,b3); - float sumFv = sumFloat(c1,c2,c3); - double sumDv = sumDouble(d1,d2,d3); - int mulIv = prodInt(a1,a2,a3); - long mulLv = prodLong(b1,b2,b3); - float mulFv = prodFloat(c1,c2,c3); - double mulDv = prodDouble(d1,d2,d3); + int sumIv = sumInt(a1, a2, a3); + long sumLv = sumLong(b1, b2, b3); + float sumFv = sumFloat(c1, c2, c3); + double sumDv = sumDouble(d1, d2, d3); + int mulIv = prodInt(a1, a2, a3); + long mulLv = prodLong(b1, b2, b3); + float mulFv = prodFloat(c1, c2, c3); + double mulDv = prodDouble(d1, d2, d3); - int sumI = 0; - long sumL = 0; - float sumF = 0.f; - double sumD = 0.; - int mulI = 0; - long mulL = 0; - float mulF = 0.f; - double mulD = 0.; + int sumI = 0; + long sumL = 0; + float sumF = 0.f; + double sumD = 0.; + int mulI = 0; + long mulL = 0; + float mulF = 0.f; + double mulD = 0.; - System.out.println("Warmup ..."); - long start = System.currentTimeMillis(); + System.out.println("Warmup ..."); + long start = System.currentTimeMillis(); + + for (int j = 0; j < 2000; j++) { + sumI = sumInt(a1, a2, a3); + sumL = sumLong(b1, b2, b3); + sumF = sumFloat(c1, c2, c3); + sumD = sumDouble(d1, d2, d3); + mulI = prodInt(a1, a2, a3); + mulL = prodLong(b1, b2, b3); + mulF = prodFloat(c1, c2, c3); + mulD = prodDouble(d1, d2, d3); + } + + long stop = System.currentTimeMillis(); + System.out.println(" Warmup is done in " + (stop - start) + " msec"); + + if (sumIv != sumI) { + System.out.println("sum int: " + sumIv + " != " + sumI); + } + if (sumLv != sumL) { + System.out.println("sum long: " + sumLv + " != " + sumL); + } + if (sumFv != sumF) { + System.out.println("sum float: " + sumFv + " != " + sumF); + } + if (sumDv != sumD) { + System.out.println("sum double: " + sumDv + " != " + sumD); + } + if (mulIv != mulI) { + System.out.println("prod int: " + mulIv + " != " + mulI); + } + if (mulLv != mulL) { + System.out.println("prod long: " + mulLv + " != " + mulL); + } + if (mulFv != mulF) { + System.out.println("prod float: " + mulFv + " != " + mulF); + } + if (mulDv != mulD) { + System.out.println("prod double: " + mulDv + " != " + mulD); + } + + start = System.currentTimeMillis(); + for (int j = 0; j < 5000; j++) { + sumI = sumInt(a1, a2, a3); + } + stop = System.currentTimeMillis(); + System.out.println("sum int: " + (stop - start)); + + start = System.currentTimeMillis(); + for (int j = 0; j < 5000; j++) { + sumL = sumLong(b1, b2, b3); + } + stop = System.currentTimeMillis(); + System.out.println("sum long: " + (stop - start)); + + start = System.currentTimeMillis(); + for (int j = 0; j < 5000; j++) { + sumF = sumFloat(c1, c2, c3); + } + stop = System.currentTimeMillis(); + System.out.println("sum float: " + (stop - start)); + + start = System.currentTimeMillis(); + for (int j = 0; j < 5000; j++) { + sumD = sumDouble(d1, d2, d3); + } + stop = System.currentTimeMillis(); + System.out.println("sum double: " + (stop - start)); + + start = System.currentTimeMillis(); + for (int j = 0; j < 5000; j++) { + mulI = prodInt(a1, a2, a3); + } + stop = System.currentTimeMillis(); + System.out.println("prod int: " + (stop - start)); + + start = System.currentTimeMillis(); + for (int j = 0; j < 5000; j++) { + mulL = prodLong(b1, b2, b3); + } + stop = System.currentTimeMillis(); + System.out.println("prod long: " + (stop - start)); + + start = System.currentTimeMillis(); + for (int j = 0; j < 5000; j++) { + mulF = prodFloat(c1, c2, c3); + } + stop = System.currentTimeMillis(); + System.out.println("prod float: " + (stop - start)); + + start = System.currentTimeMillis(); + for (int j = 0; j < 5000; j++) { + mulD = prodDouble(d1, d2, d3); + } + stop = System.currentTimeMillis(); + System.out.println("prod double: " + (stop - start)); - for(int j = 0; j < 2000; j++) { - sumI = sumInt(a1,a2,a3); - sumL = sumLong(b1,b2,b3); - sumF = sumFloat(c1,c2,c3); - sumD = sumDouble(d1,d2,d3); - mulI = prodInt(a1,a2,a3); - mulL = prodLong(b1,b2,b3); - mulF = prodFloat(c1,c2,c3); - mulD = prodDouble(d1,d2,d3); } - long stop = System.currentTimeMillis(); - System.out.println(" Warmup is done in " + (stop - start) + " msec"); - - if (sumIv != sumI) { - System.out.println("sum int: " + sumIv + " != " + sumI); - } - if (sumLv != sumL) { - System.out.println("sum long: " + sumLv + " != " + sumL); - } - if (sumFv != sumF) { - System.out.println("sum float: " + sumFv + " != " + sumF); - } - if (sumDv != sumD) { - System.out.println("sum double: " + sumDv + " != " + sumD); - } - if (mulIv != mulI) { - System.out.println("prod int: " + mulIv + " != " + mulI); - } - if (mulLv != mulL) { - System.out.println("prod long: " + mulLv + " != " + mulL); - } - if (mulFv != mulF) { - System.out.println("prod float: " + mulFv + " != " + mulF); - } - if (mulDv != mulD) { - System.out.println("prod double: " + mulDv + " != " + mulD); + public static void ReductionInit(int[] a1, int[] a2, int[] a3, + long[] b1, long[] b2, long[] b3, + float[] c1, float[] c2, float[] c3, + double[] d1, double[] d2, double[] d3) { + for(int i = 0; i < a1.length; i++) { + a1[i] = (i + 0); + a2[i] = (i + 1); + a3[i] = (i + 2); + b1[i] = (long) (i + 0); + b2[i] = (long) (i + 1); + b3[i] = (long) (i + 2); + c1[i] = (float) (i + 0); + c2[i] = (float) (i + 1); + c3[i] = (float) (i + 2); + d1[i] = (double) (i + 0); + d2[i] = (double) (i + 1); + d3[i] = (double) (i + 2); + } } - start = System.currentTimeMillis(); - for (int j = 0; j < 5000; j++) { - sumI = sumInt(a1, a2 ,a3); + public static int sumInt(int[] a1, int[] a2, int[] a3) { + int total = 0; + for (int i = 0; i < a1.length; i++) { + total += (a1[i] * a2[i]) + (a1[i] * a3[i]) + (a2[i] * a3[i]); + } + return total; } - stop = System.currentTimeMillis(); - System.out.println("sum int: " + (stop - start)); - start = System.currentTimeMillis(); - for (int j = 0; j < 5000; j++) { - sumL = sumLong(b1, b2, b3); + public static long sumLong(long[] b1, long[] b2, long[] b3) { + long total = 0; + for (int i = 0; i < b1.length; i++) { + total += (b1[i] * b2[i]) + (b1[i] * b3[i]) + (b2[i] * b3[i]); + } + return total; } - stop = System.currentTimeMillis(); - System.out.println("sum long: " + (stop - start)); - start = System.currentTimeMillis(); - for (int j = 0; j < 5000; j++) { - sumF = sumFloat(c1, c2, c3); + public static float sumFloat(float[] c1, float[] c2, float[] c3) { + float total = 0; + for (int i = 0; i < c1.length; i++) { + total += (c1[i] * c2[i]) + (c1[i] * c3[i]) + (c2[i] * c3[i]); + } + return total; } - stop = System.currentTimeMillis(); - System.out.println("sum float: " + (stop - start)); - start = System.currentTimeMillis(); - for (int j = 0; j < 5000; j++) { - sumD = sumDouble(d1, d2, d3); + public static double sumDouble(double[] d1, double[] d2, double[] d3) { + double total = 0; + for (int i = 0; i < d1.length; i++) { + total += (d1[i] * d2[i]) + (d1[i] * d3[i]) + (d2[i] * d3[i]); + } + return total; } - stop = System.currentTimeMillis(); - System.out.println("sum double: " + (stop - start)); - start = System.currentTimeMillis(); - for (int j = 0; j < 5000; j++) { - mulI = prodInt(a1, a2, a3); + public static int prodInt(int[] a1, int[] a2, int[] a3) { + int total = 1; + for (int i = 0; i < a1.length; i++) { + total *= (a1[i] * a2[i]) + (a1[i] * a3[i]) + (a2[i] * a3[i]); + } + return total; } - stop = System.currentTimeMillis(); - System.out.println("prod int: " + (stop - start)); - start = System.currentTimeMillis(); - for (int j = 0; j < 5000; j++) { - mulL = prodLong(b1, b2 ,b3); + public static long prodLong(long[] b1, long[] b2, long[] b3) { + long total = 1; + for (int i = 0; i < b1.length; i++) { + total *= (b1[i] * b2[i]) + (b1[i] * b3[i]) + (b2[i] * b3[i]); + } + return total; } - stop = System.currentTimeMillis(); - System.out.println("prod long: " + (stop - start)); - start = System.currentTimeMillis(); - for (int j = 0; j < 5000; j++) { - mulF = prodFloat(c1, c2, c3); + public static float prodFloat(float[] c1, float[] c2, float[] c3) { + float total = 1; + for (int i = 0; i < c1.length; i++) { + total *= (c1[i] * c2[i]) + (c1[i] * c3[i]) + (c2[i] * c3[i]); + } + return total; } - stop = System.currentTimeMillis(); - System.out.println("prod float: " + (stop - start)); - start = System.currentTimeMillis(); - for (int j = 0; j < 5000; j++) { - mulD = prodDouble(d1, d2, d3); + public static double prodDouble(double[] d1, double[] d2, double[] d3) { + double total = 1; + for (int i = 0; i < d1.length; i++) { + total *= (d1[i] * d2[i]) + (d1[i] * d3[i]) + (d2[i] * d3[i]); + } + return total; } - stop = System.currentTimeMillis(); - System.out.println("prod double: " + (stop - start)); - - } - - public static void ReductionInit(int[] a1, int[] a2, int[] a3, - long[] b1, long[] b2, long[] b3, - float[] c1, float[] c2, float[] c3, - double[] d1, double[] d2, double[] d3 ) { - for(int i = 0; i < a1.length; i++) { - a1[i] = (i + 0); - a2[i] = (i + 1); - a3[i] = (i + 2); - b1[i] = (long) (i + 0); - b2[i] = (long) (i + 1); - b3[i] = (long) (i + 2); - c1[i] = (float) (i + 0); - c2[i] = (float) (i + 1); - c3[i] = (float) (i + 2); - d1[i] = (double) (i + 0); - d2[i] = (double) (i + 1); - d3[i] = (double) (i + 2); - } - } - - public static int sumInt(int[] a1, int[] a2, int[] a3) { - int total = 0; - for(int i = 0; i < a1.length; i++) { - total += (a1[i] * a2[i]) + (a1[i] * a3[i]) + (a2[i] * a3[i]); - } - return total; - } - - public static long sumLong(long[] b1, long[] b2, long[] b3) { - long total = 0; - for(int i = 0; i < b1.length; i++) { - total += (b1[i] * b2[i]) + (b1[i] * b3[i]) + (b2[i] * b3[i]); - } - return total; - } - - public static float sumFloat(float[] c1, float[] c2, float[] c3) { - float total = 0; - for(int i = 0; i < c1.length; i++) { - total += (c1[i] * c2[i]) + (c1[i] * c3[i]) + (c2[i] * c3[i]); - } - return total; - } - - public static double sumDouble(double[] d1, double[] d2, double[] d3) { - double total = 0; - for(int i = 0; i < d1.length; i++) { - total += (d1[i] * d2[i]) + (d1[i] * d3[i]) + (d2[i] * d3[i]); - } - return total; - } - - public static int prodInt(int[] a1, int[] a2, int[] a3) { - int total = 1; - for(int i = 0; i < a1.length; i++) { - total *= (a1[i] * a2[i]) + (a1[i] * a3[i]) + (a2[i] * a3[i]); - } - return total; - } - - public static long prodLong(long[] b1, long[] b2, long[] b3) { - long total = 1; - for(int i = 0; i < b1.length; i++) { - total *= (b1[i] * b2[i]) + (b1[i] * b3[i]) + (b2[i] * b3[i]); - } - return total; - } - - public static float prodFloat(float[] c1, float[] c2, float[] c3) { - float total = 1; - for(int i = 0; i < c1.length; i++) { - total *= (c1[i] * c2[i]) + (c1[i] * c3[i]) + (c2[i] * c3[i]); - } - return total; - } - - public static double prodDouble(double[] d1, double[] d2, double[] d3) { - double total = 1; - for(int i = 0; i < d1.length; i++) { - total *= (d1[i] * d2[i]) + (d1[i] * d3[i]) + (d2[i] * d3[i]); - } - return total; - } } diff --git a/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Double.java b/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Double.java index 98e8f0f1fce..807be10aab6 100644 --- a/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Double.java +++ b/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Double.java @@ -28,72 +28,100 @@ * @summary Add C2 AArch64 Superword support for scalar sum reduction optimizations : double abs & neg test * @requires os.arch=="aarch64" * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Double - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.SumRedAbsNeg_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.SumRedAbsNeg_Double * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Double - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.SumRedAbsNeg_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.SumRedAbsNeg_Double * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Double - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.SumRedAbsNeg_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.SumRedAbsNeg_Double * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Double - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.SumRedAbsNeg_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.SumRedAbsNeg_Double */ -public class SumRedAbsNeg_Double -{ - public static void main(String[] args) throws Exception { - double[] a = new double[256*1024]; - double[] b = new double[256*1024]; - double[] c = new double[256*1024]; - double[] d = new double[256*1024]; - sumReductionInit(a,b,c); - double total = 0; - double valid = 3.6028590866691944E19; +package compiler.loopopts.superword; - for(int j = 0; j < 2000; j++) { - total = sumReductionImplement(a,b,c,d,total); +public class SumRedAbsNeg_Double { + public static void main(String[] args) throws Exception { + double[] a = new double[256 * 1024]; + double[] b = new double[256 * 1024]; + double[] c = new double[256 * 1024]; + double[] d = new double[256 * 1024]; + sumReductionInit(a, b, c); + double total = 0; + double valid = 3.6028590866691944E19; + + for (int j = 0; j < 2000; j++) { + total = sumReductionImplement(a, b, c, d, total); + } + + if (total == valid) { + System.out.println("Success"); + } else { + System.out.println("Invalid sum of elements variable in total: " + total); + System.out.println("Expected value = " + valid); + throw new Exception("Failed"); + } } - if(total == valid) { - System.out.println("Success"); - } else { - System.out.println("Invalid sum of elements variable in total: " + total); - System.out.println("Expected value = " + valid); - throw new Exception("Failed"); + public static void sumReductionInit( + double[] a, + double[] b, + double[] c) { + for (int j = 0; j < 1; j++) { + for (int i = 0; i < a.length; i++) { + a[i] = i * 1 + j; + b[i] = i * 1 - j; + c[i] = i + j; + } + } } - } - public static void sumReductionInit( - double[] a, - double[] b, - double[] c) - { - for(int j = 0; j < 1; j++) - { - for(int i = 0; i < a.length; i++) - { - a[i] = i * 1 + j; - b[i] = i * 1 - j; - c[i] = i + j; - } + public static double sumReductionImplement( + double[] a, + double[] b, + double[] c, + double[] d, + double total) { + for (int i = 0; i < a.length; i++) { + d[i] = Math.abs(-a[i] * -b[i]) + Math.abs(-a[i] * -c[i]) + Math.abs(-b[i] * -c[i]); + total += d[i]; + } + return total; } - } - - public static double sumReductionImplement( - double[] a, - double[] b, - double[] c, - double[] d, - double total) - { - for(int i = 0; i < a.length; i++) - { - d[i] = Math.abs(-a[i] * -b[i]) + Math.abs(-a[i] * -c[i]) + Math.abs(-b[i] * -c[i]); - total += d[i]; - } - return total; - } } diff --git a/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Float.java b/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Float.java index bbf749461fd..d108e105bb7 100644 --- a/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Float.java +++ b/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Float.java @@ -28,72 +28,100 @@ * @summary Add C2 AArch64 Superword support for scalar sum reduction optimizations : float abs & neg test * @requires os.arch=="aarch64" * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Float - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.SumRedAbsNeg_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.SumRedAbsNeg_Double * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Float - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.SumRedAbsNeg_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.SumRedAbsNeg_Double * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Float - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.SumRedAbsNeg_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.SumRedAbsNeg_Double * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Float - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRedAbsNeg_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.SumRedAbsNeg_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.SumRedAbsNeg_Double */ -public class SumRedAbsNeg_Float -{ - public static void main(String[] args) throws Exception { - float[] a = new float[256*1024]; - float[] b = new float[256*1024]; - float[] c = new float[256*1024]; - float[] d = new float[256*1024]; - sumReductionInit(a,b,c); - float total = 0; - float valid = (float)4.611686E18; +package compiler.loopopts.superword; - for(int j = 0; j < 2000; j++) { - total = sumReductionImplement(a,b,c,d,total); +public class SumRedAbsNeg_Float { + public static void main(String[] args) throws Exception { + float[] a = new float[256 * 1024]; + float[] b = new float[256 * 1024]; + float[] c = new float[256 * 1024]; + float[] d = new float[256 * 1024]; + sumReductionInit(a, b, c); + float total = 0; + float valid = (float) 4.611686E18; + + for (int j = 0; j < 2000; j++) { + total = sumReductionImplement(a, b, c, d, total); + } + + if (total == valid) { + System.out.println("Success"); + } else { + System.out.println("Invalid sum of elements variable in total: " + total); + System.out.println("Expected value = " + valid); + throw new Exception("Failed"); + } } - if(total == valid) { - System.out.println("Success"); - } else { - System.out.println("Invalid sum of elements variable in total: " + total); - System.out.println("Expected value = " + valid); - throw new Exception("Failed"); + public static void sumReductionInit( + float[] a, + float[] b, + float[] c) { + for (int j = 0; j < 1; j++) { + for (int i = 0; i < a.length; i++) { + a[i] = i * 1 + j; + b[i] = i * 1 - j; + c[i] = i + j; + } + } } - } - public static void sumReductionInit( - float[] a, - float[] b, - float[] c) - { - for(int j = 0; j < 1; j++) - { - for(int i = 0; i < a.length; i++) - { - a[i] = i * 1 + j; - b[i] = i * 1 - j; - c[i] = i + j; - } + public static float sumReductionImplement( + float[] a, + float[] b, + float[] c, + float[] d, + float total) { + for (int i = 0; i < a.length; i++) { + d[i] = Math.abs(-a[i] * -b[i]) + Math.abs(-a[i] * -c[i]) + Math.abs(-b[i] * -c[i]); + total += d[i]; + } + return total; } - } - - public static float sumReductionImplement( - float[] a, - float[] b, - float[] c, - float[] d, - float total) - { - for(int i = 0; i < a.length; i++) - { - d[i] = Math.abs(-a[i] * -b[i]) + Math.abs(-a[i] * -c[i]) + Math.abs(-b[i] * -c[i]); - total += d[i]; - } - return total; - } } diff --git a/hotspot/test/compiler/loopopts/superword/SumRedSqrt_Double.java b/hotspot/test/compiler/loopopts/superword/SumRedSqrt_Double.java index ac9edd5dcc8..b13efa83ccd 100644 --- a/hotspot/test/compiler/loopopts/superword/SumRedSqrt_Double.java +++ b/hotspot/test/compiler/loopopts/superword/SumRedSqrt_Double.java @@ -23,75 +23,104 @@ */ /** -* @test -* @bug 8135028 -* @summary Add C2 x86 Superword support for scalar sum reduction optimizations : double sqrt test -* @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" -* -* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double -* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double -* -* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double -* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double -* -* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double -* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double -* -* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double -* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double -*/ + * @test + * @bug 8135028 + * @summary Add C2 x86 Superword support for scalar sum reduction optimizations : double sqrt test + * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.SumRedSqrt_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.SumRedSqrt_Double + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.SumRedSqrt_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.SumRedSqrt_Double + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.SumRedSqrt_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.SumRedSqrt_Double + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.SumRedSqrt_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.SumRedSqrt_Double + */ -public class SumRedSqrt_Double -{ - public static void main(String[] args) throws Exception { - double[] a = new double[256*1024]; - double[] b = new double[256*1024]; - double[] c = new double[256*1024]; - double[] d = new double[256*1024]; - sumReductionInit(a,b,c); - double total = 0; - double valid = 2.06157643776E14; - for(int j = 0; j < 2000; j++) { - total = sumReductionImplement(a,b,c,d,total); - } - if(total == valid) { - System.out.println("Success"); - } else { - System.out.println("Invalid sum of elements variable in total: " + total); - System.out.println("Expected value = " + valid); - throw new Exception("Failed"); - } - } - public static void sumReductionInit( - double[] a, - double[] b, - double[] c) - { - for(int j = 0; j < 1; j++) - { - for(int i = 0; i < a.length; i++) - { - a[i] = i * 1 + j; - b[i] = i * 1 - j; - c[i] = i + j; - } - } - } +package compiler.loopopts.superword; - public static double sumReductionImplement( - double[] a, - double[] b, - double[] c, - double[] d, - double total) - { - for(int i = 0; i < a.length; i++) - { - d[i]= Math.sqrt(a[i] * b[i]) + Math.sqrt(a[i] * c[i]) + Math.sqrt(b[i] * c[i]); - total += d[i]; +public class SumRedSqrt_Double { + public static void main(String[] args) throws Exception { + double[] a = new double[256 * 1024]; + double[] b = new double[256 * 1024]; + double[] c = new double[256 * 1024]; + double[] d = new double[256 * 1024]; + sumReductionInit(a, b, c); + double total = 0; + double valid = 2.06157643776E14; + for (int j = 0; j < 2000; j++) { + total = sumReductionImplement(a, b, c, d, total); + } + if (total == valid) { + System.out.println("Success"); + } else { + System.out.println("Invalid sum of elements variable in total: " + total); + System.out.println("Expected value = " + valid); + throw new Exception("Failed"); + } + } + + public static void sumReductionInit( + double[] a, + double[] b, + double[] c) { + for (int j = 0; j < 1; j++) { + for (int i = 0; i < a.length; i++) { + a[i] = i * 1 + j; + b[i] = i * 1 - j; + c[i] = i + j; + } + } + } + + public static double sumReductionImplement( + double[] a, + double[] b, + double[] c, + double[] d, + double total) { + for (int i = 0; i < a.length; i++) { + d[i] = Math.sqrt(a[i] * b[i]) + Math.sqrt(a[i] * c[i]) + Math.sqrt(b[i] * c[i]); + total += d[i]; + } + return total; } - return total; - } } diff --git a/hotspot/test/compiler/loopopts/superword/SumRed_Double.java b/hotspot/test/compiler/loopopts/superword/SumRed_Double.java index b33ef59b897..f9e6f9e0fd8 100644 --- a/hotspot/test/compiler/loopopts/superword/SumRed_Double.java +++ b/hotspot/test/compiler/loopopts/superword/SumRed_Double.java @@ -28,70 +28,98 @@ * @summary Add C2 x86 Superword support for scalar sum reduction optimizations : double test * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRed_Double - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRed_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.SumRed_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.SumRed_Double * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRed_Double - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRed_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.SumRed_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.SumRed_Double * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRed_Double - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRed_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.SumRed_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.SumRed_Double * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRed_Double - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRed_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.SumRed_Double + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.SumRed_Double */ -public class SumRed_Double -{ - public static void main(String[] args) throws Exception { - double[] a = new double[256*1024]; - double[] b = new double[256*1024]; - double[] c = new double[256*1024]; - double[] d = new double[256*1024]; - sumReductionInit(a,b,c); - double total = 0; - double valid = 3.6028590866691944E19; - for(int j = 0; j < 2000; j++) { - total = sumReductionImplement(a,b,c,d,total); - } - if(total == valid) { - System.out.println("Success"); - } else { - System.out.println("Invalid sum of elements variable in total: " + total); - System.out.println("Expected value = " + valid); - throw new Exception("Failed"); - } - } +package compiler.loopopts.superword; - public static void sumReductionInit( - double[] a, - double[] b, - double[] c) - { - for(int j = 0; j < 1; j++) - { - for(int i = 0; i < a.length; i++) - { - a[i] = i * 1 + j; - b[i] = i * 1 - j; - c[i] = i + j; - } +public class SumRed_Double { + public static void main(String[] args) throws Exception { + double[] a = new double[256 * 1024]; + double[] b = new double[256 * 1024]; + double[] c = new double[256 * 1024]; + double[] d = new double[256 * 1024]; + sumReductionInit(a, b, c); + double total = 0; + double valid = 3.6028590866691944E19; + for (int j = 0; j < 2000; j++) { + total = sumReductionImplement(a, b, c, d, total); + } + if (total == valid) { + System.out.println("Success"); + } else { + System.out.println("Invalid sum of elements variable in total: " + total); + System.out.println("Expected value = " + valid); + throw new Exception("Failed"); + } } - } - public static double sumReductionImplement( - double[] a, - double[] b, - double[] c, - double[] d, - double total) - { - for(int i = 0; i < a.length; i++) - { - d[i]= (a[i] * b[i]) + (a[i] * c[i]) + (b[i] * c[i]); - total += d[i]; + public static void sumReductionInit( + double[] a, + double[] b, + double[] c) { + for (int j = 0; j < 1; j++) { + for (int i = 0; i < a.length; i++) { + a[i] = i * 1 + j; + b[i] = i * 1 - j; + c[i] = i + j; + } + } + } + + public static double sumReductionImplement( + double[] a, + double[] b, + double[] c, + double[] d, + double total) { + for (int i = 0; i < a.length; i++) { + d[i] = (a[i] * b[i]) + (a[i] * c[i]) + (b[i] * c[i]); + total += d[i]; + } + return total; } - return total; - } } diff --git a/hotspot/test/compiler/loopopts/superword/SumRed_Float.java b/hotspot/test/compiler/loopopts/superword/SumRed_Float.java index 2f02f3657b5..22afdbaf85f 100644 --- a/hotspot/test/compiler/loopopts/superword/SumRed_Float.java +++ b/hotspot/test/compiler/loopopts/superword/SumRed_Float.java @@ -28,70 +28,98 @@ * @summary Add C2 x86 Superword support for scalar sum reduction optimizations : float test * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRed_Float - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRed_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.SumRed_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.SumRed_Float * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRed_Float - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRed_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.SumRed_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.SumRed_Float * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRed_Float - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRed_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.SumRed_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.SumRed_Float * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRed_Float - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRed_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.SumRed_Float + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.SumRed_Float */ -public class SumRed_Float -{ - public static void main(String[] args) throws Exception { - float[] a = new float[256*1024]; - float[] b = new float[256*1024]; - float[] c = new float[256*1024]; - float[] d = new float[256*1024]; - sumReductionInit(a,b,c); - float total = 0; - float valid = (float)4.611686E18; - for(int j = 0; j < 2000; j++) { - total = sumReductionImplement(a,b,c,d,total); - } - if(total == valid) { - System.out.println("Success"); - } else { - System.out.println("Invalid sum of elements variable in total: " + total); - System.out.println("Expected value = " + valid); - throw new Exception("Failed"); - } - } +package compiler.loopopts.superword; - public static void sumReductionInit( - float[] a, - float[] b, - float[] c) - { - for(int j = 0; j < 1; j++) - { - for(int i = 0; i < a.length; i++) - { - a[i] = i * 1 + j; - b[i] = i * 1 - j; - c[i] = i + j; - } +public class SumRed_Float { + public static void main(String[] args) throws Exception { + float[] a = new float[256 * 1024]; + float[] b = new float[256 * 1024]; + float[] c = new float[256 * 1024]; + float[] d = new float[256 * 1024]; + sumReductionInit(a, b, c); + float total = 0; + float valid = (float) 4.611686E18; + for (int j = 0; j < 2000; j++) { + total = sumReductionImplement(a, b, c, d, total); + } + if (total == valid) { + System.out.println("Success"); + } else { + System.out.println("Invalid sum of elements variable in total: " + total); + System.out.println("Expected value = " + valid); + throw new Exception("Failed"); + } } - } - public static float sumReductionImplement( - float[] a, - float[] b, - float[] c, - float[] d, - float total) - { - for(int i = 0; i < a.length; i++) - { - d[i]= (a[i] * b[i]) + (a[i] * c[i]) + (b[i] * c[i]); - total += d[i]; + public static void sumReductionInit( + float[] a, + float[] b, + float[] c) { + for (int j = 0; j < 1; j++) { + for (int i = 0; i < a.length; i++) { + a[i] = i * 1 + j; + b[i] = i * 1 - j; + c[i] = i + j; + } + } + } + + public static float sumReductionImplement( + float[] a, + float[] b, + float[] c, + float[] d, + float total) { + for (int i = 0; i < a.length; i++) { + d[i] = (a[i] * b[i]) + (a[i] * c[i]) + (b[i] * c[i]); + total += d[i]; + } + return total; } - return total; - } } diff --git a/hotspot/test/compiler/loopopts/superword/SumRed_Int.java b/hotspot/test/compiler/loopopts/superword/SumRed_Int.java index c6c4b0b183b..a5676653d4d 100644 --- a/hotspot/test/compiler/loopopts/superword/SumRed_Int.java +++ b/hotspot/test/compiler/loopopts/superword/SumRed_Int.java @@ -28,70 +28,98 @@ * @summary Add C2 x86 Superword support for scalar sum reduction optimizations : int test * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRed_Int - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRed_Int + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.SumRed_Int + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=2 + * compiler.loopopts.superword.SumRed_Int * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRed_Int - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRed_Int + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.SumRed_Int + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.SumRed_Int * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRed_Int - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRed_Int + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.SumRed_Int + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.SumRed_Int * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRed_Int - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRed_Int + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.SumRed_Int + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=16 + * compiler.loopopts.superword.SumRed_Int */ -public class SumRed_Int -{ - public static void main(String[] args) throws Exception { - int[] a = new int[256*1024]; - int[] b = new int[256*1024]; - int[] c = new int[256*1024]; - int[] d = new int[256*1024]; - sumReductionInit(a,b,c); - int total = 0; - int valid = 262144000; - for(int j = 0; j < 2000; j++) { - total = sumReductionImplement(a,b,c,d,total); - } - if(total == valid) { - System.out.println("Success"); - } else { - System.out.println("Invalid sum of elements variable in total: " + total); - System.out.println("Expected value = " + valid); - throw new Exception("Failed"); - } - } +package compiler.loopopts.superword; - public static void sumReductionInit( - int[] a, - int[] b, - int[] c) - { - for(int j = 0; j < 1; j++) - { - for(int i = 0; i < a.length; i++) - { - a[i] = i * 1 + j; - b[i] = i * 1 - j; - c[i] = i + j; - } +public class SumRed_Int { + public static void main(String[] args) throws Exception { + int[] a = new int[256 * 1024]; + int[] b = new int[256 * 1024]; + int[] c = new int[256 * 1024]; + int[] d = new int[256 * 1024]; + sumReductionInit(a, b, c); + int total = 0; + int valid = 262144000; + for (int j = 0; j < 2000; j++) { + total = sumReductionImplement(a, b, c, d, total); + } + if (total == valid) { + System.out.println("Success"); + } else { + System.out.println("Invalid sum of elements variable in total: " + total); + System.out.println("Expected value = " + valid); + throw new Exception("Failed"); + } } - } - public static int sumReductionImplement( - int[] a, - int[] b, - int[] c, - int[] d, - int total) - { - for(int i = 0; i < a.length; i++) - { - d[i]= (a[i] * b[i]) + (a[i] * c[i]) + (b[i] * c[i]); - total += d[i]; + public static void sumReductionInit( + int[] a, + int[] b, + int[] c) { + for (int j = 0; j < 1; j++) { + for (int i = 0; i < a.length; i++) { + a[i] = i * 1 + j; + b[i] = i * 1 - j; + c[i] = i + j; + } + } + } + + public static int sumReductionImplement( + int[] a, + int[] b, + int[] c, + int[] d, + int total) { + for (int i = 0; i < a.length; i++) { + d[i] = (a[i] * b[i]) + (a[i] * c[i]) + (b[i] * c[i]); + total += d[i]; + } + return total; } - return total; - } } diff --git a/hotspot/test/compiler/loopopts/superword/SumRed_Long.java b/hotspot/test/compiler/loopopts/superword/SumRed_Long.java index 503a11d5a74..b841d7fa3cc 100644 --- a/hotspot/test/compiler/loopopts/superword/SumRed_Long.java +++ b/hotspot/test/compiler/loopopts/superword/SumRed_Long.java @@ -28,66 +28,77 @@ * @summary Add C2 x86 Superword support for scalar sum reduction optimizations : long test * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRed_Long - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRed_Long - * - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRed_Long - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRed_Long + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.SumRed_Long + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=4 + * compiler.loopopts.superword.SumRed_Long * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:+SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.SumRed_Long + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 + * -XX:CompileThresholdScaling=0.1 + * -XX:-SuperWordReductions + * -XX:LoopMaxUnroll=8 + * compiler.loopopts.superword.SumRed_Long */ -public class SumRed_Long -{ - public static void main(String[] args) throws Exception { - long[] a = new long[256*1024]; - long[] b = new long[256*1024]; - long[] c = new long[256*1024]; - long[] d = new long[256*1024]; - sumReductionInit(a,b,c); - long total = 0; - long valid = 262144000; - for(int j = 0; j < 2000; j++) { - total = sumReductionImplement(a,b,c,d,total); - } - total = (int)total; - if(total == valid) { - System.out.println("Success"); - } else { - System.out.println("Invalid sum of elements variable in total: " + total); - System.out.println("Expected value = " + valid); - throw new Exception("Failed"); - } - } +package compiler.loopopts.superword; - public static void sumReductionInit( - long[] a, - long[] b, - long[] c) - { - for(int j = 0; j < 1; j++) - { - for(int i = 0; i < a.length; i++) - { - a[i] = i * 1 + j; - b[i] = i * 1 - j; - c[i] = i + j; - } +public class SumRed_Long { + public static void main(String[] args) throws Exception { + long[] a = new long[256 * 1024]; + long[] b = new long[256 * 1024]; + long[] c = new long[256 * 1024]; + long[] d = new long[256 * 1024]; + sumReductionInit(a, b, c); + long total = 0; + long valid = 262144000; + for (int j = 0; j < 2000; j++) { + total = sumReductionImplement(a, b, c, d, total); + } + total = (int) total; + if (total == valid) { + System.out.println("Success"); + } else { + System.out.println("Invalid sum of elements variable in total: " + total); + System.out.println("Expected value = " + valid); + throw new Exception("Failed"); + } } - } - public static long sumReductionImplement( - long[] a, - long[] b, - long[] c, - long[] d, - long total) - { - for(int i = 0; i < a.length; i++) - { - d[i]= (a[i] * b[i]) + (a[i] * c[i]) + (b[i] * c[i]); - total += d[i]; + public static void sumReductionInit( + long[] a, + long[] b, + long[] c) { + for (int j = 0; j < 1; j++) { + for (int i = 0; i < a.length; i++) { + a[i] = i * 1 + j; + b[i] = i * 1 - j; + c[i] = i + j; + } + } + } + + public static long sumReductionImplement( + long[] a, + long[] b, + long[] c, + long[] d, + long total) { + for (int i = 0; i < a.length; i++) { + d[i] = (a[i] * b[i]) + (a[i] * c[i]) + (b[i] * c[i]); + total += d[i]; + } + return total; } - return total; - } } diff --git a/hotspot/test/compiler/loopopts/superword/TestBestAlign.java b/hotspot/test/compiler/loopopts/superword/TestBestAlign.java index 9609859701d..87fa90c1fdf 100644 --- a/hotspot/test/compiler/loopopts/superword/TestBestAlign.java +++ b/hotspot/test/compiler/loopopts/superword/TestBestAlign.java @@ -25,10 +25,12 @@ * @test * @bug 8141624 * @summary Limit calculation of pre loop during super word optimization is wrong - * @run main/othervm TestBestAlign + * @run main/othervm compiler.loopopts.superword.TestBestAlign * @author gunter.haug@sap.com */ +package compiler.loopopts.superword; + public class TestBestAlign { static final int initVal = -1; diff --git a/hotspot/test/compiler/loopopts/superword/TestReductionWithLoopVariantUse.java b/hotspot/test/compiler/loopopts/superword/TestReductionWithLoopVariantUse.java index b8e1d72806c..df471d5bc7a 100644 --- a/hotspot/test/compiler/loopopts/superword/TestReductionWithLoopVariantUse.java +++ b/hotspot/test/compiler/loopopts/superword/TestReductionWithLoopVariantUse.java @@ -25,10 +25,12 @@ * @test * @bug 8080976 * @summary Loop variant use in reduction should prevent vectorization - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestReductionWithLoopVariantUse - * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.loopopts.superword.TestReductionWithLoopVariantUse */ +package compiler.loopopts.superword; + public class TestReductionWithLoopVariantUse { static int m(int[] array) { int c = 0; diff --git a/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java b/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java index 41e7769b815..8ef4cde5806 100644 --- a/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java +++ b/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java @@ -22,17 +22,20 @@ * */ -import jdk.test.lib.*; -import jdk.internal.misc.Unsafe; - /** * @test * @bug 8078497 * @summary Tests correct alignment of vectors with loop invariant offset. * @modules java.base/jdk.internal.misc * @library /testlibrary - * @run main TestVectorizationWithInvariant + * @run main compiler.loopopts.superword.TestVectorizationWithInvariant */ + +package compiler.loopopts.superword; + +import jdk.internal.misc.Unsafe; +import jdk.test.lib.Utils; + public class TestVectorizationWithInvariant { private static Unsafe unsafe; diff --git a/hotspot/test/compiler/macronodes/TestEliminateAllocationPhi.java b/hotspot/test/compiler/macronodes/TestEliminateAllocationPhi.java index e9a5154e7c7..b57dcde4296 100644 --- a/hotspot/test/compiler/macronodes/TestEliminateAllocationPhi.java +++ b/hotspot/test/compiler/macronodes/TestEliminateAllocationPhi.java @@ -25,10 +25,12 @@ * @test * @bug 8046698 * @summary PhiNode inserted between AllocateNode and Initialization node confuses allocation elimination - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestEliminateAllocationPhi - * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.macronodes.TestEliminateAllocationPhi */ +package compiler.macronodes; + public class TestEliminateAllocationPhi { // This will return I when called from m(0 and once optimized will diff --git a/hotspot/test/compiler/membars/DekkerTest.java b/hotspot/test/compiler/membars/DekkerTest.java index 83eb923c6f2..506d3afbc22 100644 --- a/hotspot/test/compiler/membars/DekkerTest.java +++ b/hotspot/test/compiler/membars/DekkerTest.java @@ -25,14 +25,22 @@ * @test * @bug 8007898 * @summary Incorrect optimization of Memory Barriers in Matcher::post_store_load_barrier(). - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM DekkerTest - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM DekkerTest - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM DekkerTest + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM + * compiler.membars.DekkerTest + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM + * compiler.membars.DekkerTest + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM + * compiler.membars.DekkerTest * @author Martin Doerr martin DOT doerr AT sap DOT com * * Run 3 times since the failure is intermittent. */ +package compiler.membars; + public class DekkerTest { /* diff --git a/hotspot/test/compiler/membars/TestMemBarAcquire.java b/hotspot/test/compiler/membars/TestMemBarAcquire.java index e255cc1ebe7..d8de1b4080c 100644 --- a/hotspot/test/compiler/membars/TestMemBarAcquire.java +++ b/hotspot/test/compiler/membars/TestMemBarAcquire.java @@ -24,30 +24,34 @@ /* * @test TestMemBarAcquire * @bug 8048879 - * @summary "Tests optimization of MemBarAcquireNodes" - * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation TestMemBarAcquire + * @summary Tests optimization of MemBarAcquireNodes + * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation + * compiler.membars.TestMemBarAcquire */ + +package compiler.membars; + public class TestMemBarAcquire { - private volatile static Object defaultObj = new Object(); - private Object obj; + private volatile static Object defaultObj = new Object(); + private Object obj; - public TestMemBarAcquire(Object param) { - // Volatile load. MemBarAcquireNode is added after the - // load to prevent following loads from floating up past. - // StoreNode is added to store result of load in 'obj'. - this.obj = defaultObj; - // Overrides 'obj' and therefore makes previous StoreNode - // and the corresponding LoadNode useless. However, the - // LoadNode is still connected to the MemBarAcquireNode - // that should now release the reference. - this.obj = param; - } - - public static void main(String[] args) throws Exception { - // Make sure TestMemBarAcquire:: is compiled - for (int i = 0; i < 100000; ++i) { - TestMemBarAcquire p = new TestMemBarAcquire(new Object()); + public TestMemBarAcquire(Object param) { + // Volatile load. MemBarAcquireNode is added after the + // load to prevent following loads from floating up past. + // StoreNode is added to store result of load in 'obj'. + this.obj = defaultObj; + // Overrides 'obj' and therefore makes previous StoreNode + // and the corresponding LoadNode useless. However, the + // LoadNode is still connected to the MemBarAcquireNode + // that should now release the reference. + this.obj = param; + } + + public static void main(String[] args) throws Exception { + // Make sure TestMemBarAcquire:: is compiled + for (int i = 0; i < 100000; ++i) { + TestMemBarAcquire p = new TestMemBarAcquire(new Object()); + } } - } } diff --git a/hotspot/test/compiler/memoryinitialization/ZeroTLABTest.java b/hotspot/test/compiler/memoryinitialization/ZeroTLABTest.java index 9be412a6db2..09057c20d24 100644 --- a/hotspot/test/compiler/memoryinitialization/ZeroTLABTest.java +++ b/hotspot/test/compiler/memoryinitialization/ZeroTLABTest.java @@ -25,11 +25,15 @@ /* * @test * @bug 8086053 - * @run main/othervm -Xcomp -XX:+UseTLAB -XX:+ZeroTLAB ZeroTLABTest - * @run main/othervm -Xcomp -XX:+UseTLAB -XX:-ZeroTLAB ZeroTLABTest - * @run main/othervm -Xcomp -XX:-UseTLAB -XX:+ZeroTLAB ZeroTLABTest - * @run main/othervm -Xcomp -XX:-UseTLAB -XX:-ZeroTLAB ZeroTLABTest + * + * @run main/othervm -Xcomp -XX:+UseTLAB -XX:+ZeroTLAB compiler.memoryinitialization.ZeroTLABTest + * @run main/othervm -Xcomp -XX:+UseTLAB -XX:-ZeroTLAB compiler.memoryinitialization.ZeroTLABTest + * @run main/othervm -Xcomp -XX:-UseTLAB -XX:+ZeroTLAB compiler.memoryinitialization.ZeroTLABTest + * @run main/othervm -Xcomp -XX:-UseTLAB -XX:-ZeroTLAB compiler.memoryinitialization.ZeroTLABTest */ + +package compiler.memoryinitialization; + public class ZeroTLABTest { public static void main(String args[]) { System.out.println("Test PASSED"); diff --git a/hotspot/test/compiler/onSpinWait/TestOnSpinWait.java b/hotspot/test/compiler/onSpinWait/TestOnSpinWait.java index 6a3fa0d449b..97c3ab63dcf 100644 --- a/hotspot/test/compiler/onSpinWait/TestOnSpinWait.java +++ b/hotspot/test/compiler/onSpinWait/TestOnSpinWait.java @@ -26,15 +26,16 @@ * @test TestOnSpinWait * @summary (x86 only) checks that java.lang.Thread.onSpinWait is intrinsified * @bug 8147844 - * @modules java.base/jdk.internal.misc * @library /testlibrary + * @modules java.base/jdk.internal.misc * @requires os.arch=="x86" | os.arch=="amd64" | os.arch=="x86_64" - * @run main TestOnSpinWait + * @run driver compiler.onSpinWait.TestOnSpinWait */ -import java.lang.invoke.*; -import jdk.test.lib.*; -import static jdk.test.lib.Asserts.*; +package compiler.onSpinWait; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; public class TestOnSpinWait { @@ -45,7 +46,7 @@ public class TestOnSpinWait { "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", "-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1", "-Xbatch", "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", - "-XX:+PrintInlining", "TestOnSpinWait$Launcher"); + "-XX:+PrintInlining", Launcher.class.getName()); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); @@ -59,7 +60,7 @@ public class TestOnSpinWait { "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", "-XX:-TieredCompilation", "-Xbatch", "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", - "-XX:+PrintInlining", "TestOnSpinWait$Launcher"); + "-XX:+PrintInlining", Launcher.class.getName()); analyzer = new OutputAnalyzer(pb.start()); diff --git a/hotspot/test/compiler/onSpinWait/TestOnSpinWaitEnableDisable.java b/hotspot/test/compiler/onSpinWait/TestOnSpinWaitEnableDisable.java index 97a7dd7be14..dd0c9c8d087 100644 --- a/hotspot/test/compiler/onSpinWait/TestOnSpinWaitEnableDisable.java +++ b/hotspot/test/compiler/onSpinWait/TestOnSpinWaitEnableDisable.java @@ -26,10 +26,14 @@ * @test TestOnSpinWaitEnableDisable * @summary Test to ensure basic functioning of java.lang.Thread.onSpinWait * @bug 8157683 - * @run main TestOnSpinWaitEnableDisable - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_onSpinWait TestOnSpinWaitEnableDisable + * + * @run main compiler.onSpinWait.TestOnSpinWaitEnableDisable + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_onSpinWait + * compiler.onSpinWait.TestOnSpinWaitEnableDisable */ +package compiler.onSpinWait; + public class TestOnSpinWaitEnableDisable { public static void main(String[] args) { for (int i = 0; i < 50_000; i++) { diff --git a/hotspot/test/compiler/oracle/CheckCompileCommandOption.java b/hotspot/test/compiler/oracle/CheckCompileCommandOption.java index 6489df5cba4..10e71b43b11 100644 --- a/hotspot/test/compiler/oracle/CheckCompileCommandOption.java +++ b/hotspot/test/compiler/oracle/CheckCompileCommandOption.java @@ -21,21 +21,23 @@ * questions. */ -import java.io.PrintWriter; -import java.io.File; - -import jdk.test.lib.*; - /* * @test CheckCompileCommandOption + * @summary Checks parsing of -XX:CompileCommand=option * @bug 8055286 8056964 8059847 8069035 - * @summary "Checks parsing of -XX:CompileCommand=option" * @library /testlibrary * @modules java.base/jdk.internal.misc * java.management - * @run main CheckCompileCommandOption + * @run driver compiler.oracle.CheckCompileCommandOption */ +package compiler.oracle; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; + +import java.io.File; + public class CheckCompileCommandOption { // Currently, two types of trailing options can be used with diff --git a/hotspot/test/compiler/oracle/GetMethodOptionTest.java b/hotspot/test/compiler/oracle/GetMethodOptionTest.java index ed295f417b7..2da784c41c7 100644 --- a/hotspot/test/compiler/oracle/GetMethodOptionTest.java +++ b/hotspot/test/compiler/oracle/GetMethodOptionTest.java @@ -21,32 +21,34 @@ * questions. */ -import java.lang.reflect.Executable; -import java.util.function.BiFunction; +/* + * @test + * @bug 8074980 + * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc + * @build sun.hotspot.WhiteBox jdk.test.lib.Asserts compiler.oracle.GetMethodOptionTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,ccstrlist,MyListOption,_foo,_bar + * -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,ccstr,MyStrOption,_foo + * -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,bool,MyBoolOption,false + * -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,intx,MyIntxOption,-1 + * -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,uintx,MyUintxOption,1 + * -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,MyFlag + * -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,double,MyDoubleOption1,1.123 + * -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,double,MyDoubleOption2,1.123 + * -XX:CompileCommand=option,compiler.oracle.GetMethodOptionTest::test,bool,MyBoolOptionX,false,intx,MyIntxOptionX,-1,uintx,MyUintxOptionX,1,MyFlagX,double,MyDoubleOptionX,1.123 + * compiler.oracle.GetMethodOptionTest + */ + +package compiler.oracle; import jdk.test.lib.Asserts; import sun.hotspot.WhiteBox; -/* - * @test - * @bug 8074980 - * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib - * @build sun.hotspot.WhiteBox jdk.test.lib.Asserts GetMethodOptionTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:CompileCommand=option,GetMethodOptionTest::test,ccstrlist,MyListOption,_foo,_bar - * -XX:CompileCommand=option,GetMethodOptionTest::test,ccstr,MyStrOption,_foo - * -XX:CompileCommand=option,GetMethodOptionTest::test,bool,MyBoolOption,false - * -XX:CompileCommand=option,GetMethodOptionTest::test,intx,MyIntxOption,-1 - * -XX:CompileCommand=option,GetMethodOptionTest::test,uintx,MyUintxOption,1 - * -XX:CompileCommand=option,GetMethodOptionTest::test,MyFlag - * -XX:CompileCommand=option,GetMethodOptionTest::test,double,MyDoubleOption1,1.123 - * -XX:CompileCommand=option,GetMethodOptionTest.test,double,MyDoubleOption2,1.123 - * -XX:CompileCommand=option,GetMethodOptionTest::test,bool,MyBoolOptionX,false,intx,MyIntxOptionX,-1,uintx,MyUintxOptionX,1,MyFlagX,double,MyDoubleOptionX,1.123 - * GetMethodOptionTest - */ +import java.lang.reflect.Executable; +import java.util.function.BiFunction; public class GetMethodOptionTest { private static final WhiteBox WB = WhiteBox.getWhiteBox(); diff --git a/hotspot/test/compiler/oracle/MethodMatcherTest.java b/hotspot/test/compiler/oracle/MethodMatcherTest.java index 1f158276055..3e7f1a09471 100644 --- a/hotspot/test/compiler/oracle/MethodMatcherTest.java +++ b/hotspot/test/compiler/oracle/MethodMatcherTest.java @@ -23,21 +23,24 @@ /* * @test MethodMatcherTest - * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib - * @build sun.hotspot.WhiteBox - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI MethodMatcherTest * @summary Testing of compiler/MethodMatcher * @bug 8135068 + * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * compiler.oracle.MethodMatcherTest */ +package compiler.oracle; + +import sun.hotspot.WhiteBox; + import java.lang.reflect.Method; import java.util.ArrayList; -import sun.hotspot.WhiteBox; - public class MethodMatcherTest { /** Instance of WhiteBox */ @@ -83,14 +86,14 @@ public class MethodMatcherTest { testCases.add(helper, "_pool,sub,Klass*,met@%hod,(0)V", PARSING_FAILURE); testCases.add(helper, "*.*", MATCH); - testCases.add(helper, "MethodMatcherTest.*", MATCH); - testCases.add(helper, "MethodMatcherTest.helper", MATCH); - testCases.add(helper, "MethodMatcherTest.helper()", MATCH); - testCases.add(helper, "MethodMatcherTest.helper()V", MATCH); - testCases.add(helper, "MethodMatcherTest.helper()V;", NO_MATCH); - testCases.add(helper, "MethodMatcherTest.helper()I", NO_MATCH); - testCases.add(helper, "MethodMatcherTest.helperX", NO_MATCH); - testCases.add(helper, "MethodMatcherTestX.helper;", NO_MATCH); + testCases.add(helper, "compiler/oracle/MethodMatcherTest.*", MATCH); + testCases.add(helper, "compiler/oracle/MethodMatcherTest.helper", MATCH); + testCases.add(helper, "compiler/oracle/MethodMatcherTest.helper()", MATCH); + testCases.add(helper, "compiler/oracle/MethodMatcherTest.helper()V", MATCH); + testCases.add(helper, "compiler/oracle/MethodMatcherTest.helper()V;", NO_MATCH); + testCases.add(helper, "compiler/oracle/MethodMatcherTest.helper()I", NO_MATCH); + testCases.add(helper, "compiler/oracle/MethodMatcherTest.helperX", NO_MATCH); + testCases.add(helper, "compiler/oracle/MethodMatcherTest.helper;", NO_MATCH); testCases.add(helper, "abc.*", NO_MATCH); testCases.add(helper, "*.abc", NO_MATCH); @@ -100,13 +103,13 @@ public class MethodMatcherTest { testCases.add(getDate, "java/util/Date.*", MATCH); testCases.add(inner, "*.*", MATCH); - testCases.add(inner, "MethodMatcherTest$TestCases.innerHelper", MATCH); - testCases.add(inner, "MethodMatcherTest*.innerHelper", MATCH); - testCases.add(inner, "MethodMatcherTest$*.innerHelper", MATCH); + testCases.add(inner, "compiler/oracle/MethodMatcherTest$TestCases.innerHelper", MATCH); + testCases.add(inner, "compiler/oracle/MethodMatcherTest*.innerHelper", MATCH); + testCases.add(inner, "compiler/oracle/MethodMatcherTest$*.innerHelper", MATCH); testCases.add(inner, "*$TestCases.innerHelper", MATCH); testCases.add(inner, "*TestCases.innerHelper", MATCH); testCases.add(inner, "TestCases.innerHelper", NO_MATCH); - testCases.add(inner, "MethodMatcherTest.innerHelper", NO_MATCH); + testCases.add(inner, "compiler/oracle/MethodMatcherTest.innerHelper", NO_MATCH); testCases.add(toString, "*.*", MATCH); testCases.add(toString, "java/lang/String.toString", MATCH); diff --git a/hotspot/test/compiler/oracle/TestCompileCommand.java b/hotspot/test/compiler/oracle/TestCompileCommand.java index 6ec02ac6e81..d8ba4aa2987 100644 --- a/hotspot/test/compiler/oracle/TestCompileCommand.java +++ b/hotspot/test/compiler/oracle/TestCompileCommand.java @@ -21,21 +21,21 @@ * questions. */ -import java.io.PrintWriter; -import java.io.File; - -import jdk.test.lib.*; - /* * @test TestCompileCommand * @bug 8069389 - * @summary "Regression tests of -XX:CompileCommand" + * @summary Regression tests of -XX:CompileCommand * @library /testlibrary * @modules java.base/jdk.internal.misc * java.management - * @run main TestCompileCommand + * @run driver compiler.oracle.TestCompileCommand */ +package compiler.oracle; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; + public class TestCompileCommand { private static final String[][] ARGUMENTS = { diff --git a/hotspot/test/compiler/osr/TestOSRWithNonEmptyStack.java b/hotspot/test/compiler/osr/TestOSRWithNonEmptyStack.java index 516d4855f19..3cbcbb02d1b 100644 --- a/hotspot/test/compiler/osr/TestOSRWithNonEmptyStack.java +++ b/hotspot/test/compiler/osr/TestOSRWithNonEmptyStack.java @@ -21,22 +21,37 @@ * questions. */ -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; - -import jdk.internal.org.objectweb.asm.ClassWriter; -import jdk.internal.org.objectweb.asm.Label; -import jdk.internal.org.objectweb.asm.MethodVisitor; -import static jdk.internal.org.objectweb.asm.Opcodes.*; - /** * @test * @bug 8051344 * @summary Force OSR compilation with non-empty stack at the OSR entry point. * @modules java.base/jdk.internal.org.objectweb.asm - * @compile -XDignore.symbol.file TestOSRWithNonEmptyStack.java - * @run main/othervm -XX:CompileOnly=TestCase.test TestOSRWithNonEmptyStack + * @run main/othervm -XX:CompileCommand=compileonly,TestCase::test + * compiler.osr.TestOSRWithNonEmptyStack */ + +package compiler.osr; + +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.Label; +import jdk.internal.org.objectweb.asm.MethodVisitor; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; + +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD; +import static jdk.internal.org.objectweb.asm.Opcodes.DUP; +import static jdk.internal.org.objectweb.asm.Opcodes.IADD; +import static jdk.internal.org.objectweb.asm.Opcodes.ICONST_0; +import static jdk.internal.org.objectweb.asm.Opcodes.ICONST_1; +import static jdk.internal.org.objectweb.asm.Opcodes.IF_ICMPLT; +import static jdk.internal.org.objectweb.asm.Opcodes.ILOAD; +import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESPECIAL; +import static jdk.internal.org.objectweb.asm.Opcodes.ISTORE; +import static jdk.internal.org.objectweb.asm.Opcodes.POP; +import static jdk.internal.org.objectweb.asm.Opcodes.RETURN; + public class TestOSRWithNonEmptyStack extends ClassLoader { private static final int CLASS_FILE_VERSION = 52; private static final String CLASS_NAME = "TestCase"; diff --git a/hotspot/test/compiler/osr/TestRangeCheck.java b/hotspot/test/compiler/osr/TestRangeCheck.java index 6079cb9ba4f..829a07d3cf2 100644 --- a/hotspot/test/compiler/osr/TestRangeCheck.java +++ b/hotspot/test/compiler/osr/TestRangeCheck.java @@ -25,8 +25,11 @@ * @test TestRangeCheck * @bug 8054883 * @summary Tests that range check is not skipped + * @run main compiler.osr.TestRangeCheck */ +package compiler.osr; + public class TestRangeCheck { public static void main(String args[]) { try { diff --git a/hotspot/test/compiler/print/PrintInlining.java b/hotspot/test/compiler/print/PrintInlining.java index 6aa90333561..deb1ae0aae0 100644 --- a/hotspot/test/compiler/print/PrintInlining.java +++ b/hotspot/test/compiler/print/PrintInlining.java @@ -25,12 +25,15 @@ * @test * @bug 8022585 * @summary VM crashes when ran with -XX:+PrintInlining - * @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining PrintInlining + * @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining + * compiler.print.PrintInlining * */ +package compiler.print; + public class PrintInlining { - public static void main(String[] args) { - System.out.println("Passed"); - } + public static void main(String[] args) { + System.out.println("Passed"); + } } diff --git a/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java b/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java index ca57139c3a2..a09d9d35268 100644 --- a/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java +++ b/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java @@ -24,14 +24,17 @@ /** * @test * @bug 8073154 - * @build TestProfileReturnTypePrinting + * @build compiler.print.TestProfileReturnTypePrinting * @run main/othervm -XX:TypeProfileLevel=020 - * -XX:CompileOnly=TestProfileReturnTypePrinting.testMethod + * -XX:CompileCommand=compileonly,compiler.print.TestProfileReturnTypePrinting::testMethod * -XX:+IgnoreUnrecognizedVMOptions -XX:+PrintLIR - * TestProfileReturnTypePrinting + * compiler.print.TestProfileReturnTypePrinting * @summary Verify that c1's LIR that contains ProfileType node could be dumped * without a crash disregard to an exact class knowledge. */ + +package compiler.print; + public class TestProfileReturnTypePrinting { private static final int ITERATIONS = 1_000_000; diff --git a/hotspot/test/compiler/profiling/TestMethodHandleInvokesIntrinsic.java b/hotspot/test/compiler/profiling/TestMethodHandleInvokesIntrinsic.java index d882cc396a1..9ca1c13f03a 100644 --- a/hotspot/test/compiler/profiling/TestMethodHandleInvokesIntrinsic.java +++ b/hotspot/test/compiler/profiling/TestMethodHandleInvokesIntrinsic.java @@ -25,11 +25,18 @@ * @test * @bug 8041458 * @summary profiling of arguments in C1 at MethodHandle invoke of intrinsic tries to profile popped argument. - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TieredStopAtLevel=3 TestMethodHandleInvokesIntrinsic + * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * -XX:TieredStopAtLevel=3 + * compiler.profiling.TestMethodHandleInvokesIntrinsic * */ -import java.lang.invoke.*; +package compiler.profiling; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; public class TestMethodHandleInvokesIntrinsic { diff --git a/hotspot/test/compiler/profiling/TestSpecTrapClassUnloading.java b/hotspot/test/compiler/profiling/TestSpecTrapClassUnloading.java index ae700981216..acb891fbda8 100644 --- a/hotspot/test/compiler/profiling/TestSpecTrapClassUnloading.java +++ b/hotspot/test/compiler/profiling/TestSpecTrapClassUnloading.java @@ -25,10 +25,18 @@ * @test * @bug 8031752 * @summary speculative traps need to be cleaned up at GC - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:+UseTypeSpeculation -XX:TypeProfileLevel=222 -XX:CompileCommand=exclude,java.lang.reflect.Method::invoke -XX:CompileCommand=exclude,sun.reflect.DelegatingMethodAccessorImpl::invoke -Xmx512M TestSpecTrapClassUnloading * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation + * -XX:-UseOnStackReplacement -XX:-BackgroundCompilation + * -XX:+UseTypeSpeculation -XX:TypeProfileLevel=222 + * -XX:CompileCommand=exclude,java.lang.reflect.Method::invoke + * -XX:CompileCommand=exclude,sun.reflect.DelegatingMethodAccessorImpl::invoke + * -Xmx512M + * compiler.profiling.TestSpecTrapClassUnloading */ +package compiler.profiling; + import java.lang.reflect.Method; public class TestSpecTrapClassUnloading { diff --git a/hotspot/test/compiler/profiling/TestUnexpectedProfilingMismatch.java b/hotspot/test/compiler/profiling/TestUnexpectedProfilingMismatch.java index b118027b5aa..c0df67a1709 100644 --- a/hotspot/test/compiler/profiling/TestUnexpectedProfilingMismatch.java +++ b/hotspot/test/compiler/profiling/TestUnexpectedProfilingMismatch.java @@ -25,11 +25,17 @@ * @test * @bug 8027631 * @summary profiling of arguments at calls cannot rely on signature of callee for types - * @run main/othervm -XX:-BackgroundCompilation -XX:TieredStopAtLevel=3 -XX:TypeProfileLevel=111 -XX:Tier3InvocationThreshold=200 -XX:Tier0InvokeNotifyFreqLog=7 TestUnexpectedProfilingMismatch * + * @run main/othervm -XX:-BackgroundCompilation -XX:TieredStopAtLevel=3 -XX:TypeProfileLevel=111 + * -XX:Tier3InvocationThreshold=200 -XX:Tier0InvokeNotifyFreqLog=7 + * compiler.profiling.TestUnexpectedProfilingMismatch */ -import java.lang.invoke.*; +package compiler.profiling; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; public class TestUnexpectedProfilingMismatch { diff --git a/hotspot/test/compiler/profiling/UnsafeAccess.java b/hotspot/test/compiler/profiling/UnsafeAccess.java index 28abc34b19a..5118101454b 100644 --- a/hotspot/test/compiler/profiling/UnsafeAccess.java +++ b/hotspot/test/compiler/profiling/UnsafeAccess.java @@ -24,10 +24,14 @@ * @test * @bug 8134918 * @modules java.base/jdk.internal.misc + * * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation -Xbatch - * -XX:CompileCommand=dontinline,UnsafeAccess::test* - * UnsafeAccess + * -XX:CompileCommand=dontinline,compiler.profiling.UnsafeAccess::test* + * compiler.profiling.UnsafeAccess */ + +package compiler.profiling; + import jdk.internal.misc.Unsafe; public class UnsafeAccess { diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass/Agent.java b/hotspot/test/compiler/profiling/spectrapredefineclass/Agent.java index d6dd5717635..f0a30c6b6a5 100644 --- a/hotspot/test/compiler/profiling/spectrapredefineclass/Agent.java +++ b/hotspot/test/compiler/profiling/spectrapredefineclass/Agent.java @@ -21,12 +21,15 @@ * questions. */ -import java.security.*; -import java.lang.instrument.*; -import java.lang.reflect.*; -import java.lang.management.ManagementFactory; +package compiler.profiling.spectrapredefineclass; + import com.sun.tools.attach.VirtualMachine; +import java.lang.instrument.ClassFileTransformer; +import java.lang.instrument.Instrumentation; +import java.lang.management.ManagementFactory; +import java.security.ProtectionDomain; + class A { void m() { } diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java b/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java index 312734eafe5..95593898201 100644 --- a/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java +++ b/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java @@ -20,8 +20,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -import java.io.PrintWriter; -import jdk.test.lib.*; /* * @test @@ -30,21 +28,34 @@ import jdk.test.lib.*; * @modules java.base/jdk.internal.misc * java.instrument * java.management - * @build Agent - * @run main ClassFileInstaller Agent - * @run main Launcher - * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 -XX:ReservedCodeCacheSize=3M Agent + * @build compiler.profiling.spectrapredefineclass_classloaders.Agent + * @run driver ClassFileInstaller compiler.profiling.spectrapredefineclass.Agent + * @run driver compiler.profiling.spectrapredefineclass.Launcher + * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation + * -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 + * -XX:ReservedCodeCacheSize=3M + * compiler.profiling.spectrapredefineclass.Agent */ + +package compiler.profiling.spectrapredefineclass; + +import jdk.test.lib.JDKToolFinder; + +import java.io.File; +import java.io.PrintWriter; + public class Launcher { public static void main(String[] args) throws Exception { PrintWriter pw = new PrintWriter("MANIFEST.MF"); - pw.println("Agent-Class: Agent"); + pw.println("Agent-Class: " + Launcher.class.getPackage().getName() +".Agent"); pw.println("Can-Retransform-Classes: true"); pw.close(); ProcessBuilder pb = new ProcessBuilder(); - pb.command(new String[] { JDKToolFinder.getJDKTool("jar"), "cmf", "MANIFEST.MF", System.getProperty("test.classes",".") + "/agent.jar", "Agent.class"}); + pb.command(new String[] { JDKToolFinder.getJDKTool("jar"), "cmf", "MANIFEST.MF", + System.getProperty("test.classes",".") + "/agent.jar", + "compiler/profiling/spectrapredefineclass/Agent.class".replace('/', File.separatorChar)}); pb.start().waitFor(); } } diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/A.java b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/A.java index cae091e8531..07b36223c86 100644 --- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/A.java +++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/A.java @@ -1,3 +1,5 @@ +package compiler.profiling.spectrapredefineclass_classloaders; + public class A { void m() { } diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Agent.java b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Agent.java index d03f7de7378..35f8523de42 100644 --- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Agent.java +++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Agent.java @@ -21,16 +21,19 @@ * questions. */ -import java.security.*; -import java.lang.instrument.*; -import java.lang.reflect.*; -import java.lang.management.ManagementFactory; +package compiler.profiling.spectrapredefineclass_classloaders; + import com.sun.tools.attach.VirtualMachine; -import java.lang.reflect.*; + +import java.lang.instrument.ClassFileTransformer; +import java.lang.instrument.Instrumentation; +import java.lang.management.ManagementFactory; +import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.nio.file.Paths; +import java.security.ProtectionDomain; public class Agent implements ClassFileTransformer { public static ClassLoader newClassLoader() { @@ -49,11 +52,12 @@ public class Agent implements ClassFileTransformer { // loader2 must be first on the list so loader 1 must be used first ClassLoader loader1 = newClassLoader(); - Class dummy = loader1.loadClass("Test"); + String packageName = Agent.class.getPackage().getName(); + Class dummy = loader1.loadClass(packageName + ".Test"); ClassLoader loader2 = newClassLoader(); - Test_class = loader2.loadClass("Test"); + Test_class = loader2.loadClass(packageName + ".Test"); Method m3 = Test_class.getMethod("m3", ClassLoader.class); // Add speculative trap in m2() (loaded by loader1) that // references m4() (loaded by loader2). diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/B.java b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/B.java index 1b71f43d973..55a2851c5ea 100644 --- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/B.java +++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/B.java @@ -1,3 +1,5 @@ +package compiler.profiling.spectrapredefineclass_classloaders; + public class B extends A { void m() { } diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java index 66f155d845e..328c5bc468e 100644 --- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java +++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java @@ -20,8 +20,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -import java.io.PrintWriter; -import jdk.test.lib.*; /* * @test @@ -30,21 +28,37 @@ import jdk.test.lib.*; * @modules java.base/jdk.internal.misc * java.instrument * java.management - * @build Agent Test A B - * @run main ClassFileInstaller Agent - * @run main Launcher - * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 -XX:ReservedCodeCacheSize=3M Agent + * @build compiler.profiling.spectrapredefineclass_classloaders.Agent + * compiler.profiling.spectrapredefineclass_classloaders.Test + * compiler.profiling.spectrapredefineclass_classloaders.A + * compiler.profiling.spectrapredefineclass_classloaders.B + * @run driver ClassFileInstaller compiler.profiling.spectrapredefineclass_classloaders.Agent + * @run driver compiler.profiling.spectrapredefineclass_classloaders.Launcher + * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation + * -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 + * -XX:ReservedCodeCacheSize=3M + * compiler.profiling.spectrapredefineclass_classloaders.Agent */ +package compiler.profiling.spectrapredefineclass_classloaders; + +import jdk.test.lib.JDKToolFinder; + +import java.io.File; +import java.io.PrintWriter; + public class Launcher { - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws Exception { - PrintWriter pw = new PrintWriter("MANIFEST.MF"); - pw.println("Agent-Class: Agent"); - pw.println("Can-Retransform-Classes: true"); - pw.close(); + PrintWriter pw = new PrintWriter("MANIFEST.MF"); - ProcessBuilder pb = new ProcessBuilder(); - pb.command(new String[] { JDKToolFinder.getJDKTool("jar"), "cmf", "MANIFEST.MF", System.getProperty("test.classes",".") + "/agent.jar", "Agent.class"}); - pb.start().waitFor(); + pw.println("Agent-Class: " + Launcher.class.getPackage().getName() + ".Agent"); + pw.println("Can-Retransform-Classes: true"); + pw.close(); + + ProcessBuilder pb = new ProcessBuilder(); + pb.command(new String[]{JDKToolFinder.getJDKTool("jar"), "cmf", "MANIFEST.MF", + System.getProperty("test.classes", ".") + "/agent.jar", + "compiler/profiling/spectrapredefineclass/Agent.class".replace('/', File.separatorChar)}); + pb.start().waitFor(); } } diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Test.java b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Test.java index 189d39abb12..662fe00dd1e 100644 --- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Test.java +++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Test.java @@ -1,4 +1,6 @@ -import java.lang.reflect.*; +package compiler.profiling.spectrapredefineclass_classloaders; + +import java.lang.reflect.Method; public class Test { @@ -19,11 +21,12 @@ public class Test { } public void m3(ClassLoader loader) throws Exception { - Class Test_class = loader.loadClass("Test"); + String packageName = Test.class.getPackage().getName(); + Class Test_class = loader.loadClass(packageName + ".Test"); Object test = Test_class.newInstance(); - Class A_class = loader.loadClass("A"); + Class A_class = loader.loadClass(packageName + ".A"); Object a = A_class.newInstance(); - Class B_class = loader.loadClass("B"); + Class B_class = loader.loadClass(packageName + ".B"); Object b = B_class.newInstance(); Method m1 = Test_class.getMethod("m1", A_class, Boolean.class); diff --git a/hotspot/test/compiler/profiling/unloadingconflict/B.java b/hotspot/test/compiler/profiling/unloadingconflict/B.java index c37eb867648..7464d513e4a 100644 --- a/hotspot/test/compiler/profiling/unloadingconflict/B.java +++ b/hotspot/test/compiler/profiling/unloadingconflict/B.java @@ -21,5 +21,7 @@ * questions. */ +package compiler.profiling.unloadingconflict; + public class B { } diff --git a/hotspot/test/compiler/profiling/unloadingconflict/TestProfileConflictClassUnloading.java b/hotspot/test/compiler/profiling/unloadingconflict/TestProfileConflictClassUnloading.java index c074e18a2a8..d68f5c012d0 100644 --- a/hotspot/test/compiler/profiling/unloadingconflict/TestProfileConflictClassUnloading.java +++ b/hotspot/test/compiler/profiling/unloadingconflict/TestProfileConflictClassUnloading.java @@ -24,12 +24,17 @@ /* * @test * @bug 8027572 - * @summary class unloading resets profile, method compiled after the profile is first set and before class loading sets unknown bit with not recorded class - * @build B - * @run main/othervm -XX:TypeProfileLevel=222 -XX:-BackgroundCompilation TestProfileConflictClassUnloading + * @summary class unloading resets profile, method compiled after the profile is + * first set and before class loading sets unknown bit with not recorded class + * @library / + * @build compiler.profiling.unloadingconflict.B + * @run main/othervm -XX:TypeProfileLevel=222 -XX:-BackgroundCompilation + * compiler.profiling.unloadingconflict.TestProfileConflictClassUnloading * */ +package compiler.profiling.unloadingconflict; + import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; @@ -66,7 +71,7 @@ public class TestProfileConflictClassUnloading { public static void main(String[] args) throws Exception { ClassLoader loader = newClassLoader(); - Object o = loader.loadClass("B").newInstance(); + Object o = loader.loadClass("compiler.profiling.unloadingconflict.B").newInstance(); // collect conflicting profiles for (int i = 0; i < 5000; i++) { m2(o); diff --git a/hotspot/test/compiler/rangechecks/PowerOf2SizedArraysChecks.java b/hotspot/test/compiler/rangechecks/PowerOf2SizedArraysChecks.java index dad068d0ad3..531a0755aca 100644 --- a/hotspot/test/compiler/rangechecks/PowerOf2SizedArraysChecks.java +++ b/hotspot/test/compiler/rangechecks/PowerOf2SizedArraysChecks.java @@ -26,11 +26,16 @@ * @test * @bug 8003585 * @summary strength reduce or eliminate range checks for power-of-two sized arrays - * @run main/othervm -XX:CompileCommand=compileonly,PowerOf2SizedArraysChecks::test* -XX:-BackgroundCompilation PowerOf2SizedArraysChecks * + * @run main/othervm -XX:CompileCommand=compileonly,compiler.rangechecks.PowerOf2SizedArraysChecks::test* + * -XX:-BackgroundCompilation + * compiler.rangechecks.PowerOf2SizedArraysChecks */ -import java.util.function.*; +package compiler.rangechecks; + +import java.util.function.BiFunction; +import java.util.function.Function; public class PowerOf2SizedArraysChecks { diff --git a/hotspot/test/compiler/rangechecks/TestBadFoldCompare.java b/hotspot/test/compiler/rangechecks/TestBadFoldCompare.java index 74e53a0e826..4f15bf96690 100644 --- a/hotspot/test/compiler/rangechecks/TestBadFoldCompare.java +++ b/hotspot/test/compiler/rangechecks/TestBadFoldCompare.java @@ -26,9 +26,13 @@ * @bug 8085832 * @bug 8135069 * @summary x <= 0 || x > 0 wrongly folded as (x-1) >u -1 and x < 0 || x > -1 wrongly folded as x >u -1 - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestBadFoldCompare + * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.rangechecks.TestBadFoldCompare */ +package compiler.rangechecks; + public class TestBadFoldCompare { static boolean test1_taken; diff --git a/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java b/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java index a023d5a4e74..d712535fb03 100644 --- a/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java +++ b/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java @@ -25,24 +25,31 @@ * @test * @bug 8073480 * @summary explicit range checks should be recognized by C2 - * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib / - * @build TestExplicitRangeChecks + * @modules java.base/jdk.internal.misc + * @build compiler.rangechecks.TestExplicitRangeChecks * @run driver ClassFileInstaller sun.hotspot.WhiteBox * jdk.test.lib.Platform * @run main/othervm -ea -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=compileonly,TestExplicitRangeChecks.test* TestExplicitRangeChecks + * -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * -XX:CompileCommand=compileonly,compiler.rangechecks.TestExplicitRangeChecks::test* + * compiler.rangechecks.TestExplicitRangeChecks * */ -import java.lang.annotation.*; -import java.lang.reflect.*; -import java.util.*; -import sun.hotspot.WhiteBox; -import sun.hotspot.code.NMethod; -import jdk.test.lib.Platform; -import jdk.internal.misc.Unsafe; +package compiler.rangechecks; + import compiler.whitebox.CompilerWhiteBoxTest; +import jdk.internal.misc.Unsafe; +import jdk.test.lib.Platform; +import sun.hotspot.WhiteBox; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.HashMap; public class TestExplicitRangeChecks { private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java b/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java index 2712c5afc6e..d5b3be7027f 100644 --- a/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java +++ b/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java @@ -28,8 +28,11 @@ * @summary Tests PostLoopMultiversioning with RangeCheckElimination disabled. * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions * -XX:+PostLoopMultiversioning -XX:-RangeCheckElimination - * TestRangeCheckEliminationDisabled + * compiler.rangechecks.TestRangeCheckEliminationDisabled */ + +package compiler.rangechecks; + public class TestRangeCheckEliminationDisabled { public static void main(String[] args) { diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoop.jasm b/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoop.jasm index 2befe6db091..30eed33a333 100644 --- a/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoop.jasm +++ b/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoop.jasm @@ -22,7 +22,7 @@ * */ -super public class TestRangeCheckExceptionHandlerLoop +super public class compiler/rangechecks/TestRangeCheckExceptionHandlerLoop version 51:0 { diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java b/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java index 3eac3231571..fe2636da902 100644 --- a/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java +++ b/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java @@ -26,10 +26,14 @@ * @test * @bug 8134883 * @summary C1's range check elimination breaks with a non-natural loop that an exception handler as one entry + * * @compile TestRangeCheckExceptionHandlerLoop.jasm - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestRangeCheckExceptionHandlerLoopMain + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.rangechecks.TestRangeCheckExceptionHandlerLoopMain */ +package compiler.rangechecks; + public class TestRangeCheckExceptionHandlerLoopMain { public static void main(String[] args) throws Exception { Exception exception = new Exception(); diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java index 0ed34a46c7b..446c87e6c40 100644 --- a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java +++ b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java @@ -29,21 +29,27 @@ * @modules java.base/jdk.internal.misc * java.management * @ignore 8157984 - * @build TestRangeCheckSmearing + * @build compiler.rangechecks.TestRangeCheckSmearing * @run driver ClassFileInstaller sun.hotspot.WhiteBox * jdk.test.lib.Platform * @run main/othervm -ea -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestRangeCheckSmearing + * -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.rangechecks.TestRangeCheckSmearing * */ -import java.lang.annotation.*; -import java.lang.reflect.*; -import java.util.*; -import sun.hotspot.WhiteBox; -import sun.hotspot.code.NMethod; -import jdk.test.lib.Platform; +package compiler.rangechecks; + import compiler.whitebox.CompilerWhiteBoxTest; +import jdk.test.lib.Platform; +import sun.hotspot.WhiteBox; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.Arrays; +import java.util.HashMap; public class TestRangeCheckSmearing { private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearingLoopOpts.java b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearingLoopOpts.java index 699754a8e8c..63f4f89bdc8 100644 --- a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearingLoopOpts.java +++ b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearingLoopOpts.java @@ -25,9 +25,13 @@ * @test * @bug 8048170 * @summary Following range check smearing, range check cannot be replaced by dominating identical test. - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestRangeCheckSmearingLoopOpts * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.rangechecks.TestRangeCheckSmearingLoopOpts */ + +package compiler.rangechecks; + public class TestRangeCheckSmearingLoopOpts { static int dummy; diff --git a/hotspot/test/compiler/rangechecks/TestUncommonTrapMerging.java b/hotspot/test/compiler/rangechecks/TestUncommonTrapMerging.java index bbdda630811..b6ae41e97d0 100644 --- a/hotspot/test/compiler/rangechecks/TestUncommonTrapMerging.java +++ b/hotspot/test/compiler/rangechecks/TestUncommonTrapMerging.java @@ -25,9 +25,16 @@ * @test * @bug 8140574 * @summary Verify proper re-execution of checks after merging of uncommon traps - * @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileCommand=compileonly,TestUncommonTrapMerging::test* TestUncommonTrapMerging Test1 - * @run main/othervm -XX:CompileCommand=compileonly,TestUncommonTrapMerging::test* TestUncommonTrapMerging Test2 + * + * @run main/othervm -Xcomp -XX:-TieredCompilation + * -XX:CompileCommand=compileonly,compiler.rangechecks.TestUncommonTrapMerging::test* + * compiler.rangechecks.TestUncommonTrapMerging Test1 + * @run main/othervm -XX:CompileCommand=compileonly,compiler.rangechecks.TestUncommonTrapMerging::test* + * compiler.rangechecks.TestUncommonTrapMerging Test2 */ + +package compiler.rangechecks; + public class TestUncommonTrapMerging { public static void main(String[] args) throws Throwable { diff --git a/hotspot/test/compiler/reflection/ArrayNewInstanceOfVoid.java b/hotspot/test/compiler/reflection/ArrayNewInstanceOfVoid.java index 6f8a2735cc9..928749e8c21 100644 --- a/hotspot/test/compiler/reflection/ArrayNewInstanceOfVoid.java +++ b/hotspot/test/compiler/reflection/ArrayNewInstanceOfVoid.java @@ -25,8 +25,12 @@ * @test * @bug 8029366 * @summary ShouldNotReachHere error when creating an array with component type of void + * + * @run main compiler.reflection.ArrayNewInstanceOfVoid */ +package compiler.reflection; + public class ArrayNewInstanceOfVoid { public static void main(String[] args) { for (int i = 0; i < 100_000; i++) { diff --git a/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java b/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java index cf7b65b6dc9..82316a8a163 100644 --- a/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java +++ b/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java @@ -24,24 +24,28 @@ /* * @test * @bug 8027751 - * @requires vm.gc.G1 * @summary C1 crashes generating G1 post-barrier in Unsafe.getAndSetObject() intrinsic because of the new value spill - * @run main/othervm -XX:+UseG1GC C1ObjectSpillInLogicOp + * @requires vm.gc.G1 * + * @run main/othervm -XX:+UseG1GC compiler.regalloc.C1ObjectSpillInLogicOp + */ + +package compiler.regalloc; + +import java.util.concurrent.atomic.AtomicReferenceArray; + +/* * G1 barriers use logical operators (xor) on T_OBJECT mixed with T_LONG or T_INT. * The current implementation of logical operations on x86 in C1 doesn't allow for long operands to be on stack. * There is a special code in the register allocator that forces long arguments in registers on x86. However T_OBJECT * can be spilled just fine, and in that case the xor emission will fail. */ - -import java.util.concurrent.atomic.*; - public class C1ObjectSpillInLogicOp { - public static void main(String[] args) { - AtomicReferenceArray x = new AtomicReferenceArray(128); - Integer y = new Integer(0); - for (int i = 0; i < 50000; i++) { - x.getAndSet(i % x.length(), y); + public static void main(String[] args) { + AtomicReferenceArray x = new AtomicReferenceArray(128); + Integer y = new Integer(0); + for (int i = 0; i < 50000; i++) { + x.getAndSet(i % x.length(), y); + } } - } } diff --git a/hotspot/test/compiler/regalloc/TestVectorRegAlloc.java b/hotspot/test/compiler/regalloc/TestVectorRegAlloc.java index 0e95544df10..c737e39ef3c 100644 --- a/hotspot/test/compiler/regalloc/TestVectorRegAlloc.java +++ b/hotspot/test/compiler/regalloc/TestVectorRegAlloc.java @@ -25,11 +25,14 @@ /** * @test * @bug 8131969 - * @summary assert in register allocation code when vector Phi for a loop is processed because code assumes all inputs already processed - * @run main/othervm -Xbatch TestVectorRegAlloc + * @summary assert in register allocation code when vector Phi for a loop is + * processed because code assumes all inputs already processed * + * @run main/othervm -Xbatch compiler.regalloc.TestVectorRegAlloc */ +package compiler.regalloc; + public class TestVectorRegAlloc { static int test_helper_i; diff --git a/hotspot/test/compiler/relocations/TestPrintRelocations.java b/hotspot/test/compiler/relocations/TestPrintRelocations.java index 2cfb038b83e..88ed1092733 100644 --- a/hotspot/test/compiler/relocations/TestPrintRelocations.java +++ b/hotspot/test/compiler/relocations/TestPrintRelocations.java @@ -25,14 +25,19 @@ * @test * @bug 8044538 * @summary assert hit while printing relocations for jump table entries - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:+PrintRelocations TestPrintRelocations + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:+PrintRelocations + * compiler.relocations.TestPrintRelocations */ - /** * The test compiles all methods (-Xcomp) and prints their relocation * entries (-XX:+PrintRelocations) to make sure the printing works. */ + +package compiler.relocations; + public class TestPrintRelocations { - static public void main(String[] args) { } + static public void main(String[] args) { + } } diff --git a/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java b/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java index cc2ad98facd..e90ba2448a5 100644 --- a/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java +++ b/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java @@ -22,8 +22,11 @@ * */ -import jdk.test.lib.*; -import jdk.test.lib.cli.*; +package compiler.rtm.cli; + +import jdk.test.lib.ExitCode; +import jdk.test.lib.Platform; +import jdk.test.lib.cli.CommandLineOptionTest; import java.util.function.BooleanSupplier; diff --git a/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java b/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java index 654040a1f4f..aad6397e8fc 100644 --- a/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java +++ b/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java @@ -22,14 +22,16 @@ * */ -import java.util.List; -import java.util.LinkedList; +package compiler.rtm.cli; -import jdk.test.lib.ExitCode; -import jdk.test.lib.cli.*; -import jdk.test.lib.cli.predicate.AndPredicate; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.ExitCode; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.LinkedList; +import java.util.List; /** * Base for all RTM-related CLI tests on options whose processing depends diff --git a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java index 769b0e2df65..e8c9d17d8f6 100644 --- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java +++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java @@ -22,8 +22,11 @@ * */ -import jdk.test.lib.*; -import jdk.test.lib.cli.*; +package compiler.rtm.cli; + +import jdk.test.lib.ExitCode; +import jdk.test.lib.Platform; +import jdk.test.lib.cli.CommandLineOptionTest; import java.util.function.BooleanSupplier; diff --git a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java index e8e9fdb870a..e48cfecdb9d 100644 --- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java @@ -30,18 +30,21 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig + * + * @build compiler.rtm.cli.TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI - * TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig + * compiler.rtm.cli.TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig */ -import jdk.test.lib.cli.*; -import jdk.test.lib.cli.predicate.AndPredicate; +package compiler.rtm.cli; + import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; public class TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig extends TestPrintPreciseRTMLockingStatisticsBase { diff --git a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java index ec2b4311568..aeec5262805 100644 --- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java @@ -30,18 +30,21 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig + * + * @build compiler.rtm.cli.TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI - * TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig + * compiler.rtm.cli.TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig */ -import jdk.test.lib.cli.predicate.AndPredicate; -import jdk.test.lib.cli.predicate.NotPredicate; +package compiler.rtm.cli; + import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.cli.predicate.AndPredicate; +import jdk.test.lib.cli.predicate.NotPredicate; public class TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig extends TestPrintPreciseRTMLockingStatisticsBase { diff --git a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java index b1a761df8af..2d16a62c387 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java @@ -30,13 +30,17 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMAbortRatioOptionOnSupportedConfig + * + * @build compiler.rtm.cli.TestRTMAbortRatioOptionOnSupportedConfig * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestRTMAbortRatioOptionOnSupportedConfig + * -XX:+WhiteBoxAPI + * compiler.rtm.cli.TestRTMAbortRatioOptionOnSupportedConfig */ +package compiler.rtm.cli; + public class TestRTMAbortRatioOptionOnSupportedConfig extends RTMLockingAwareTest { private static final String DEFAULT_VALUE = "50"; diff --git a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java index 0104b8f3f83..5921ae7e657 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java @@ -30,17 +30,21 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMAbortRatioOptionOnUnsupportedConfig + * + * @build compiler.rtm.cli.TestRTMAbortRatioOptionOnUnsupportedConfig * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestRTMAbortRatioOptionOnUnsupportedConfig + * -XX:+WhiteBoxAPI + * compiler.rtm.cli.TestRTMAbortRatioOptionOnUnsupportedConfig */ -import jdk.test.lib.cli.predicate.AndPredicate; -import jdk.test.lib.cli.predicate.NotPredicate; +package compiler.rtm.cli; + import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.cli.predicate.AndPredicate; +import jdk.test.lib.cli.predicate.NotPredicate; public class TestRTMAbortRatioOptionOnUnsupportedConfig extends RTMGenericCommandLineOptionTest { diff --git a/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java b/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java index 3edec234295..7444280bf4a 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java @@ -26,13 +26,16 @@ * @test * @bug 8031320 * @summary Verify processing of RTMAbortThreshold option. - * @library /testlibrary + * @library /testlibrary / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMAbortThresholdOption - * @run main/othervm TestRTMAbortThresholdOption + * + * @build compiler.rtm.cli.TestRTMAbortThresholdOption + * @run main/othervm compiler.rtm.cli.TestRTMAbortThresholdOption */ +package compiler.rtm.cli; + public class TestRTMAbortThresholdOption extends RTMGenericCommandLineOptionTest { private static final String DEFAULT_VALUE = "1000"; diff --git a/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java b/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java index 9a70f7c15c9..35213b46ec6 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java @@ -26,13 +26,16 @@ * @test * @bug 8031320 * @summary Verify processing of RTMLockingCalculationDelay option. - * @library /testlibrary + * @library /testlibrary / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMLockingCalculationDelayOption - * @run main/othervm TestRTMLockingCalculationDelayOption + * + * @build compiler.rtm.cli.TestRTMLockingCalculationDelayOption + * @run main/othervm compiler.rtm.cli.TestRTMLockingCalculationDelayOption */ +package compiler.rtm.cli; + public class TestRTMLockingCalculationDelayOption extends RTMGenericCommandLineOptionTest { private static final String DEFAULT_VALUE = "0"; diff --git a/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java b/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java index f9c202a37ac..91a5bff7ee0 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java @@ -26,13 +26,16 @@ * @test * @bug 8031320 * @summary Verify processing of RTMLockingThreshold option. - * @library /testlibrary + * @library /testlibrary / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMLockingThresholdOption - * @run main/othervm TestRTMLockingThresholdOption + * + * @build compiler.rtm.cli.TestRTMLockingThresholdOption + * @run main/othervm compiler.rtm.cli.TestRTMLockingThresholdOption */ +package compiler.rtm.cli; + public class TestRTMLockingThresholdOption extends RTMGenericCommandLineOptionTest { private static final String DEFAULT_VALUE = "10000"; diff --git a/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java b/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java index baaf4a7e058..d77c0013a78 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java @@ -26,13 +26,16 @@ * @test * @bug 8031320 * @summary Verify processing of RTMRetryCount option. - * @library /testlibrary + * @library /testlibrary / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMRetryCountOption - * @run main/othervm TestRTMRetryCountOption + * + * @build compiler.rtm.cli.TestRTMRetryCountOption + * @run main/othervm compiler.rtm.cli.TestRTMRetryCountOption */ +package compiler.rtm.cli; + public class TestRTMRetryCountOption extends RTMGenericCommandLineOptionTest { private static final String DEFAULT_VALUE = "5"; diff --git a/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java b/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java index 23d0f054872..dc9ebf759ff 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java @@ -26,13 +26,16 @@ * @test * @bug 8031320 * @summary Verify processing of RTMSpinLoopCount option. - * @library /testlibrary + * @library /testlibrary / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMSpinLoopCountOption - * @run main/othervm TestRTMSpinLoopCountOption + * + * @build compiler.rtm.cli.TestRTMSpinLoopCountOption + * @run main/othervm compiler.rtm.cli.TestRTMSpinLoopCountOption */ +package compiler.rtm.cli; + public class TestRTMSpinLoopCountOption extends RTMGenericCommandLineOptionTest { private static final String DEFAULT_VALUE = "100"; diff --git a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java index 1e9300428a9..b21aac408a2 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java @@ -30,14 +30,17 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMTotalCountIncrRateOptionOnSupportedConfig + * + * @build compiler.rtm.cli.TestRTMTotalCountIncrRateOptionOnSupportedConfig * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI - * TestRTMTotalCountIncrRateOptionOnSupportedConfig + * compiler.rtm.cli.TestRTMTotalCountIncrRateOptionOnSupportedConfig */ +package compiler.rtm.cli; + public class TestRTMTotalCountIncrRateOptionOnSupportedConfig extends RTMLockingAwareTest { private static final String DEFAULT_VALUE = "64"; diff --git a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java index c855876cca8..886d0c339c2 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java @@ -22,11 +22,6 @@ * */ -import jdk.test.lib.cli.predicate.AndPredicate; -import jdk.test.lib.cli.predicate.NotPredicate; -import compiler.testlibrary.rtm.predicate.SupportedCPU; -import compiler.testlibrary.rtm.predicate.SupportedVM; - /** * @test * @bug 8031320 @@ -35,14 +30,22 @@ import compiler.testlibrary.rtm.predicate.SupportedVM; * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMTotalCountIncrRateOptionOnUnsupportedConfig + * + * @build compiler.rtm.cli.TestRTMTotalCountIncrRateOptionOnUnsupportedConfig * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI - * TestRTMTotalCountIncrRateOptionOnUnsupportedConfig + * compiler.rtm.cli.TestRTMTotalCountIncrRateOptionOnUnsupportedConfig */ +package compiler.rtm.cli; + +import compiler.testlibrary.rtm.predicate.SupportedCPU; +import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.cli.predicate.AndPredicate; +import jdk.test.lib.cli.predicate.NotPredicate; + public class TestRTMTotalCountIncrRateOptionOnUnsupportedConfig extends RTMGenericCommandLineOptionTest { private static final String DEFAULT_VALUE = "64"; diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java index 5ac9c26dd9b..001a826ab88 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java @@ -30,18 +30,22 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseRTMDeoptOptionOnSupportedConfig + * + * @build compiler.rtm.cli.TestUseRTMDeoptOptionOnSupportedConfig * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseRTMDeoptOptionOnSupportedConfig + * -XX:+WhiteBoxAPI + * compiler.rtm.cli.TestUseRTMDeoptOptionOnSupportedConfig */ +package compiler.rtm.cli; + +import compiler.testlibrary.rtm.predicate.SupportedCPU; +import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.test.lib.ExitCode; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.predicate.SupportedCPU; -import compiler.testlibrary.rtm.predicate.SupportedVM; public class TestUseRTMDeoptOptionOnSupportedConfig extends CommandLineOptionTest { diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java index fd6ef44d53e..385a7c70d3a 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java @@ -30,19 +30,22 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseRTMDeoptOptionOnUnsupportedConfig + * + * @build compiler.rtm.cli.TestUseRTMDeoptOptionOnUnsupportedConfig * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseRTMDeoptOptionOnUnsupportedConfig + * -XX:+WhiteBoxAPI + * compiler.rtm.cli.TestUseRTMDeoptOptionOnUnsupportedConfig */ -import jdk.test.lib.cli.CommandLineOptionTest; +package compiler.rtm.cli; -import jdk.test.lib.cli.predicate.AndPredicate; -import jdk.test.lib.cli.predicate.NotPredicate; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; +import jdk.test.lib.cli.predicate.NotPredicate; public class TestUseRTMDeoptOptionOnUnsupportedConfig extends RTMGenericCommandLineOptionTest { diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java index 49c9ebd5638..532e68dd5b4 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java @@ -30,19 +30,22 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseRTMForStackLocksOptionOnSupportedConfig + * + * @build compiler.rtm.cli.TestUseRTMForStackLocksOptionOnSupportedConfig * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI - * TestUseRTMForStackLocksOptionOnSupportedConfig + * compiler.rtm.cli.TestUseRTMForStackLocksOptionOnSupportedConfig */ -import jdk.test.lib.*; -import jdk.test.lib.cli.*; -import jdk.test.lib.cli.predicate.AndPredicate; +package compiler.rtm.cli; + import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.ExitCode; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; public class TestUseRTMForStackLocksOptionOnSupportedConfig extends CommandLineOptionTest { diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java index ea1555ab57f..563fec15126 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java @@ -30,20 +30,23 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseRTMForStackLocksOptionOnUnsupportedConfig + * + * @build compiler.rtm.cli.TestUseRTMForStackLocksOptionOnUnsupportedConfig * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI - * TestUseRTMForStackLocksOptionOnUnsupportedConfig + * compiler.rtm.cli.TestUseRTMForStackLocksOptionOnUnsupportedConfig */ +package compiler.rtm.cli; + +import compiler.testlibrary.rtm.predicate.SupportedCPU; +import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.test.lib.ExitCode; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; import jdk.test.lib.cli.predicate.NotPredicate; -import compiler.testlibrary.rtm.predicate.SupportedCPU; -import compiler.testlibrary.rtm.predicate.SupportedVM; public class TestUseRTMForStackLocksOptionOnUnsupportedConfig extends RTMGenericCommandLineOptionTest { diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java index ed8e386deb6..b82badc2858 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java @@ -30,18 +30,22 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseRTMLockingOptionOnSupportedConfig + * + * @build compiler.rtm.cli.TestUseRTMLockingOptionOnSupportedConfig * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseRTMLockingOptionOnSupportedConfig + * -XX:+WhiteBoxAPI + * compiler.rtm.cli.TestUseRTMLockingOptionOnSupportedConfig */ -import jdk.test.lib.ExitCode; -import jdk.test.lib.cli.*; -import jdk.test.lib.cli.predicate.AndPredicate; +package compiler.rtm.cli; + import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.ExitCode; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; public class TestUseRTMLockingOptionOnSupportedConfig extends CommandLineOptionTest { diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java index e5d24060824..25e173e12f3 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java @@ -30,19 +30,24 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseRTMLockingOptionOnUnsupportedCPU + * + * @build compiler.rtm.cli.TestUseRTMLockingOptionOnUnsupportedCPU * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseRTMLockingOptionOnUnsupportedCPU + * -XX:+WhiteBoxAPI + * compiler.rtm.cli.TestUseRTMLockingOptionOnUnsupportedCPU */ -import jdk.test.lib.*; -import jdk.test.lib.cli.*; -import jdk.test.lib.cli.predicate.AndPredicate; -import jdk.test.lib.cli.predicate.NotPredicate; +package compiler.rtm.cli; + import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.ExitCode; +import jdk.test.lib.Platform; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; +import jdk.test.lib.cli.predicate.NotPredicate; public class TestUseRTMLockingOptionOnUnsupportedCPU extends CommandLineOptionTest { diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java index 6b9c50d678b..f042a9d3b64 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java @@ -30,19 +30,23 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseRTMLockingOptionOnUnsupportedVM + * + * @build compiler.rtm.cli.TestUseRTMLockingOptionOnUnsupportedVM * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseRTMLockingOptionOnUnsupportedVM + * -XX:+WhiteBoxAPI + * compiler.rtm.cli.TestUseRTMLockingOptionOnUnsupportedVM */ -import jdk.test.lib.ExitCode; -import jdk.test.lib.cli.*; -import jdk.test.lib.cli.predicate.AndPredicate; -import jdk.test.lib.cli.predicate.NotPredicate; +package compiler.rtm.cli; + import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.ExitCode; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; +import jdk.test.lib.cli.predicate.NotPredicate; public class TestUseRTMLockingOptionOnUnsupportedVM extends CommandLineOptionTest { diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java index d43c25bfc92..cc004bd0aac 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java @@ -30,18 +30,22 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseRTMLockingOptionWithBiasedLocking + * + * @build compiler.rtm.cli.TestUseRTMLockingOptionWithBiasedLocking * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseRTMLockingOptionWithBiasedLocking + * -XX:+WhiteBoxAPI + * compiler.rtm.cli.TestUseRTMLockingOptionWithBiasedLocking */ -import jdk.test.lib.*; -import jdk.test.lib.cli.*; -import jdk.test.lib.cli.predicate.AndPredicate; +package compiler.rtm.cli; + import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.ExitCode; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; public class TestUseRTMLockingOptionWithBiasedLocking extends CommandLineOptionTest { diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java b/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java index 9683da33187..5d365b7e7b3 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java @@ -26,13 +26,16 @@ * @test * @bug 8031320 * @summary Verify processing of UseRTMXendForLockBusy option. - * @library /testlibrary + * @library /testlibrary / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseRTMXendForLockBusyOption - * @run main/othervm TestUseRTMXendForLockBusyOption + * + * @build compiler.rtm.cli.TestUseRTMXendForLockBusyOption + * @run main/othervm compiler.rtm.cli.TestUseRTMXendForLockBusyOption */ +package compiler.rtm.cli; + public class TestUseRTMXendForLockBusyOption extends RTMGenericCommandLineOptionTest { private static final String DEFAULT_VALUE = "true"; diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java index c9b601247b8..893fbc80bc2 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java @@ -30,21 +30,30 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMAbortRatio + * @build compiler.rtm.locking.TestRTMAbortRatio * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestRTMAbortRatio + * -XX:+WhiteBoxAPI + * compiler.rtm.locking.TestRTMAbortRatio */ -import java.util.List; -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +package compiler.rtm.locking; + +import compiler.testlibrary.rtm.AbortProvoker; +import compiler.testlibrary.rtm.CompilableTest; +import compiler.testlibrary.rtm.RTMLockingStatistics; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.internal.misc.Unsafe; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.Utils; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.List; /** * Test verifies that method will be deoptimized on high abort ratio diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java b/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java index c3a4f39b8fc..2d8492ec8e9 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java @@ -30,20 +30,28 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMAbortThreshold + * @build compiler.rtm.locking.TestRTMAbortThreshold * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestRTMAbortThreshold + * -XX:+WhiteBoxAPI + * compiler.rtm.locking.TestRTMAbortThreshold */ -import java.util.List; -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +package compiler.rtm.locking; + +import compiler.testlibrary.rtm.AbortProvoker; +import compiler.testlibrary.rtm.AbortType; +import compiler.testlibrary.rtm.RTMLockingStatistics; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.List; /** * Test verifies that on RTMAbortThreshold option actually affects how soon diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java index cbb3da2a191..606ed8cf7f8 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java @@ -32,21 +32,30 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMAfterNonRTMDeopt + * @build compiler.rtm.locking.TestRTMAfterNonRTMDeopt * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestRTMAfterNonRTMDeopt + * -XX:+WhiteBoxAPI + * compiler.rtm.locking.TestRTMAfterNonRTMDeopt */ -import java.util.List; -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +package compiler.rtm.locking; + +import compiler.testlibrary.rtm.AbortProvoker; +import compiler.testlibrary.rtm.CompilableTest; +import compiler.testlibrary.rtm.RTMLockingStatistics; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.internal.misc.Unsafe; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.Utils; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.List; /** * To verify that with +UseRTMDeopt method's RTM state will be diff --git a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java index 25e24e45384..f53a32c9f58 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java @@ -30,20 +30,28 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMDeoptOnHighAbortRatio + * @build compiler.rtm.locking.TestRTMDeoptOnHighAbortRatio * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestRTMDeoptOnHighAbortRatio + * -XX:+WhiteBoxAPI + * compiler.rtm.locking.TestRTMDeoptOnHighAbortRatio */ -import java.util.List; -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +package compiler.rtm.locking; + +import compiler.testlibrary.rtm.AbortProvoker; +import compiler.testlibrary.rtm.AbortType; +import compiler.testlibrary.rtm.RTMLockingStatistics; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.List; /** * Test verifies that on high abort ratio method wil be deoptimized with diff --git a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java index ded714888d6..567ec6278a1 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java @@ -29,21 +29,30 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMDeoptOnLowAbortRatio + * @build compiler.rtm.locking.TestRTMDeoptOnLowAbortRatio * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestRTMDeoptOnLowAbortRatio + * -XX:+WhiteBoxAPI + * compiler.rtm.locking.TestRTMDeoptOnLowAbortRatio */ -import java.util.List; -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +package compiler.rtm.locking; + +import compiler.testlibrary.rtm.AbortProvoker; +import compiler.testlibrary.rtm.CompilableTest; +import compiler.testlibrary.rtm.RTMLockingStatistics; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.internal.misc.Unsafe; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.Utils; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.List; /** * Test verifies that low abort ratio method will be deoptimized with diff --git a/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java b/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java index 8124d4107e0..7c6ee4658bc 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java @@ -30,19 +30,25 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMLockingCalculationDelay + * @build compiler.rtm.locking.TestRTMLockingCalculationDelay * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestRTMLockingCalculationDelay + * -XX:+WhiteBoxAPI + * compiler.rtm.locking.TestRTMLockingCalculationDelay */ -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +package compiler.rtm.locking; + +import compiler.testlibrary.rtm.AbortProvoker; +import compiler.testlibrary.rtm.AbortType; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; /** * Test verifies that abort ratio calculation could be delayed using diff --git a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java index 415f872d43d..d3ce56ca214 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java @@ -30,21 +30,30 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMLockingThreshold + * @build compiler.rtm.locking.TestRTMLockingThreshold * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestRTMLockingThreshold + * -XX:+WhiteBoxAPI + * compiler.rtm.locking.TestRTMLockingThreshold */ -import java.util.List; -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +package compiler.rtm.locking; + +import compiler.testlibrary.rtm.AbortProvoker; +import compiler.testlibrary.rtm.CompilableTest; +import compiler.testlibrary.rtm.RTMLockingStatistics; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.internal.misc.Unsafe; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.Utils; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.List; /** * Test verifies that RTMLockingThreshold option actually affects how soon diff --git a/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java b/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java index 82c884b061f..2a1fc7d8871 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java @@ -29,21 +29,28 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMRetryCount + * @build compiler.rtm.locking.TestRTMRetryCount * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestRTMRetryCount + * -XX:+WhiteBoxAPI + * compiler.rtm.locking.TestRTMRetryCount */ -import java.util.List; +package compiler.rtm.locking; -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +import compiler.testlibrary.rtm.BusyLock; +import compiler.testlibrary.rtm.CompilableTest; +import compiler.testlibrary.rtm.RTMLockingStatistics; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.List; /** * Test verifies that RTMRetryCount option actually affects amount of diff --git a/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java b/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java index 47e89b079cd..f6e849e76eb 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java @@ -30,20 +30,28 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMSpinLoopCount + * @build compiler.rtm.locking.TestRTMSpinLoopCount * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestRTMSpinLoopCount + * -XX:+WhiteBoxAPI + * compiler.rtm.locking.TestRTMSpinLoopCount */ -import java.util.List; -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +package compiler.rtm.locking; + +import compiler.testlibrary.rtm.BusyLock; +import compiler.testlibrary.rtm.CompilableTest; +import compiler.testlibrary.rtm.RTMLockingStatistics; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.List; /** * Test verifies that RTMSpinLoopCount increase time spent between retries diff --git a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java index 41aeddb71a3..6ae82df25d4 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java @@ -30,22 +30,30 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestRTMTotalCountIncrRate + * @build compiler.rtm.locking.TestRTMTotalCountIncrRate * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestRTMTotalCountIncrRate + * -XX:+WhiteBoxAPI + * compiler.rtm.locking.TestRTMTotalCountIncrRate */ -import jdk.internal.misc.Unsafe; -import java.util.List; +package compiler.rtm.locking; -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +import compiler.testlibrary.rtm.AbortProvoker; +import compiler.testlibrary.rtm.CompilableTest; +import compiler.testlibrary.rtm.RTMLockingStatistics; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.internal.misc.Unsafe; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.Utils; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.List; /** * Test verifies that with RTMTotalCountIncrRate=1 RTM locking statistics diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java b/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java index 9bc68b458b4..be13c8096e3 100644 --- a/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java +++ b/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java @@ -30,21 +30,28 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseRTMAfterLockInflation + * @build compiler.rtm.locking.TestUseRTMAfterLockInflation * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseRTMAfterLockInflation + * -XX:+WhiteBoxAPI + * compiler.rtm.locking.TestUseRTMAfterLockInflation */ -import java.util.List; +package compiler.rtm.locking; -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +import compiler.testlibrary.rtm.AbortProvoker; +import compiler.testlibrary.rtm.AbortType; +import compiler.testlibrary.rtm.RTMLockingStatistics; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.List; /** * Test verifies that RTM is used after lock inflation by executing compiled diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java b/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java index 054d2f7eaa1..05578b60d72 100644 --- a/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java +++ b/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java @@ -30,19 +30,25 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseRTMDeopt + * @build compiler.rtm.locking.TestUseRTMDeopt * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseRTMDeopt + * -XX:+WhiteBoxAPI + * compiler.rtm.locking.TestUseRTMDeopt */ -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +package compiler.rtm.locking; + +import compiler.testlibrary.rtm.AbortProvoker; +import compiler.testlibrary.rtm.AbortType; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; /** * Test verifies that usage of UseRTMDeopt option affects uncommon traps usage diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java b/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java index b9c23a43d44..94c4978d1f2 100644 --- a/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java +++ b/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java @@ -29,21 +29,27 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseRTMForInflatedLocks + * @build compiler.rtm.locking.TestUseRTMForInflatedLocks * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseRTMForInflatedLocks + * -XX:+WhiteBoxAPI compiler.rtm.locking.TestUseRTMForInflatedLocks */ -import java.util.List; +package compiler.rtm.locking; -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +import compiler.testlibrary.rtm.AbortProvoker; +import compiler.testlibrary.rtm.AbortType; +import compiler.testlibrary.rtm.RTMLockingStatistics; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.List; /** * Test verifies that RTM-based lock elision could be used for inflated locks diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java b/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java index afede71949f..6bb2646b745 100644 --- a/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java +++ b/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java @@ -29,21 +29,28 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseRTMForStackLocks + * @build compiler.rtm.locking.TestUseRTMForStackLocks * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseRTMForStackLocks + * -XX:+WhiteBoxAPI + * compiler.rtm.locking.TestUseRTMForStackLocks */ -import java.util.List; +package compiler.rtm.locking; -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +import compiler.testlibrary.rtm.AbortProvoker; +import compiler.testlibrary.rtm.AbortType; +import compiler.testlibrary.rtm.RTMLockingStatistics; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.List; /** * Test verifies that RTM-based lock elision could be used for stack locks diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java b/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java index c61e6bcbb9a..d8dc7ca8f98 100644 --- a/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java +++ b/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java @@ -30,21 +30,29 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseRTMXendForLockBusy + * @build compiler.rtm.locking.TestUseRTMXendForLockBusy * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseRTMXendForLockBusy + * -XX:+WhiteBoxAPI + * compiler.rtm.locking.TestUseRTMXendForLockBusy */ -import java.util.List; +package compiler.rtm.locking; -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +import compiler.testlibrary.rtm.AbortType; +import compiler.testlibrary.rtm.BusyLock; +import compiler.testlibrary.rtm.CompilableTest; +import compiler.testlibrary.rtm.RTMLockingStatistics; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.List; /** * Test verifies that with +UseRTMXendForLockBusy there will be no aborts diff --git a/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java b/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java index 567ddd57cf7..30d747e0fe0 100644 --- a/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java +++ b/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java @@ -30,20 +30,28 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestNoRTMLockElidingOption + * @build compiler.rtm.method_options.TestNoRTMLockElidingOption * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestNoRTMLockElidingOption + * -XX:+WhiteBoxAPI + * compiler.rtm.method_options.TestNoRTMLockElidingOption */ -import java.util.List; -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +package compiler.rtm.method_options; + +import compiler.testlibrary.rtm.AbortProvoker; +import compiler.testlibrary.rtm.AbortType; +import compiler.testlibrary.rtm.RTMLockingStatistics; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.List; /** * Test verifies that method tagged with option NoRTMLockElidingOption diff --git a/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java b/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java index acb8bdd8bb6..50808348c0e 100644 --- a/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java +++ b/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java @@ -31,20 +31,28 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestUseRTMLockElidingOption + * @build compiler.rtm.method_options.TestUseRTMLockElidingOption * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestUseRTMLockElidingOption + * -XX:+WhiteBoxAPI + * compiler.rtm.method_options.TestUseRTMLockElidingOption */ -import java.util.List; -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +package compiler.rtm.method_options; + +import compiler.testlibrary.rtm.AbortProvoker; +import compiler.testlibrary.rtm.AbortType; +import compiler.testlibrary.rtm.RTMLockingStatistics; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.List; /** * Test verifies that method tagged with option UseRTMLockElidingOption diff --git a/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java b/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java index 40aa1a3c7af..adeed6d3ec5 100644 --- a/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java +++ b/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java @@ -32,21 +32,31 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TestPrintPreciseRTMLockingStatistics + * @build compiler.rtm.print.TestPrintPreciseRTMLockingStatistics * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI TestPrintPreciseRTMLockingStatistics + * -XX:+WhiteBoxAPI + * compiler.rtm.print.TestPrintPreciseRTMLockingStatistics */ -import java.util.*; -import jdk.test.lib.*; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.cli.predicate.AndPredicate; -import compiler.testlibrary.rtm.*; +package compiler.rtm.print; + +import compiler.testlibrary.rtm.AbortProvoker; +import compiler.testlibrary.rtm.AbortType; +import compiler.testlibrary.rtm.RTMLockingStatistics; +import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; +import jdk.test.lib.Asserts; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; + +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; /** * Test verifies that VM output does not contain RTM locking statistics when it diff --git a/hotspot/test/compiler/runtime/6778657/Test.java b/hotspot/test/compiler/runtime/6778657/Test.java deleted file mode 100644 index 116693a7096..00000000000 --- a/hotspot/test/compiler/runtime/6778657/Test.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 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 6778657 - * @summary Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour - */ - -public class Test { - public static void check_f2i(int expect) { - float check = expect; - check *= 2; - int actual = (int) check; - if (actual != expect) - throw new RuntimeException("expecting " + expect + ", got " + actual); - } - - public static void check_f2l(long expect) { - float check = expect; - check *= 2; - long actual = (long) check; - if (actual != expect) - throw new RuntimeException("expecting " + expect + ", got " + actual); - } - - public static void check_d2i(int expect) { - double check = expect; - check *= 2; - int actual = (int) check; - if (actual != expect) - throw new RuntimeException("expecting " + expect + ", got " + actual); - } - - public static void check_d2l(long expect) { - double check = expect; - check *= 2; - long actual = (long) check; - if (actual != expect) - throw new RuntimeException("expecting " + expect + ", got " + actual); - } - - public static void main(String[] args) { - check_f2i(Integer.MAX_VALUE); - check_f2i(Integer.MIN_VALUE); - check_f2l(Long.MAX_VALUE); - check_f2l(Long.MIN_VALUE); - check_d2i(Integer.MAX_VALUE); - check_d2i(Integer.MIN_VALUE); - check_d2l(Long.MAX_VALUE); - check_d2l(Long.MIN_VALUE); - } -} - diff --git a/hotspot/test/compiler/runtime/7196199/Test7196199.java b/hotspot/test/compiler/runtime/7196199/Test7196199.java deleted file mode 100644 index 8f0c520df0e..00000000000 --- a/hotspot/test/compiler/runtime/7196199/Test7196199.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2012, 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 7196199 - * @summary java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect - * - * @run main/othervm/timeout=400 -Xmx32m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation -XX:CompileCommand=exclude,Test7196199.test -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100 Test7196199 - */ - - -public class Test7196199 { - private static final int ARRLEN = 97; - private static final int ITERS = 5000; - private static final int INI_ITERS = 1000; - private static final int SFP_ITERS = 10000; - private static final float SFP_ITERS_F = 10000.f; - private static final float VALUE = 15.f; - public static void main(String args[]) { - int errn = test(); - if (errn > 0) { - System.err.println("FAILED: " + errn + " errors"); - System.exit(97); - } - System.out.println("PASSED"); - } - - static int test() { - float[] a0 = new float[ARRLEN]; - float[] a1 = new float[ARRLEN]; - // Initialize - for (int i=0; i 0) - return errn; - - System.out.println("Time"); - long start, end; - - start = System.currentTimeMillis(); - for (int i=0; i 0) { // substaction works with unsigned values - // OldGen is placed before youngger for ParallelOldGC. - upper_limit = low_limit + 21000000l; // +20971520 - } - // Each A[one_card] size is 512 bytes, - // it will take about 40000 allocations to trigger GC. - // cache[] has 8192 elements so GC should happen - // each 5th iteration. - for(long l = 0; l < 20; l++) { - fill_heap(); - if (debug) { - System.out.println("test oop_disjoint_arraycopy"); - } - testA_arraycopy(); - if (debug) { - System.out.println("test checkcast_arraycopy"); - } - testB_arraycopy(); - // Execute arraycopy to the topmost array in young gen - if (debug) { - int top_index = get_top_address(low_limit, upper_limit); - if (top_index >= 0) { - long addr = wb.getObjectAddress(cache[top_index]); - System.out.println("top_addr: 0x" + Long.toHexString(addr) + ", 0x" + Long.toHexString(addr + 512)); - } - } - } - } - static void fill_heap() { - for (int i = 0; i < cache.length; ++i) { - o = new Test8010927[one_card]; - System.arraycopy(masterA, 0, o, 0, masterA.length); - cache[i] = o; - } - for (long j = 0; j < 256; ++j) { - o = new Long[10000]; // to trigger GC - } - } - static void testA_arraycopy() { - for (int i = 0; i < cache.length; ++i) { - System.arraycopy(masterA, 0, cache[i], 0, masterA.length); - } - } - static void testB_arraycopy() { - for (int i = 0; i < cache.length; ++i) { - System.arraycopy(masterB, 0, cache[i], 0, masterB.length); - } - } - static int get_top_address(long min, long max) { - int index = -1; - long addr = min; - for (int i = 0; i < cache.length; ++i) { - long test = wb.getObjectAddress(cache[i]); - if (((test - addr) > 0) && ((max - test) > 0)) { // substaction works with unsigned values - addr = test; - index = i; - } - } - return index; - } -} diff --git a/hotspot/test/compiler/runtime/7141637/SpreadNullArg.java b/hotspot/test/compiler/runtime/SpreadNullArg.java similarity index 85% rename from hotspot/test/compiler/runtime/7141637/SpreadNullArg.java rename to hotspot/test/compiler/runtime/SpreadNullArg.java index fac5d4723a0..826058ed378 100644 --- a/hotspot/test/compiler/runtime/7141637/SpreadNullArg.java +++ b/hotspot/test/compiler/runtime/SpreadNullArg.java @@ -24,11 +24,14 @@ /* * @test SpreadNullArg * @bug 7141637 - * @summary verifies that the MethodHandle spread adapter can gracefully handle null arguments. - * @run main SpreadNullArg + * @summary verifies that the MethodHandle spread adapter can gracefully handle null arguments. + * + * @run main compiler.runtime.SpreadNullArg * @author volker.simonis@gmail.com */ +package compiler.runtime; + import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; @@ -44,7 +47,7 @@ public class SpreadNullArg { try { mh_spread_target = - MethodHandles.lookup().findStatic(SpreadNullArg.class, "target_spread_arg", mt_ref_arg); + MethodHandles.lookup().findStatic(SpreadNullArg.class, "target_spread_arg", mt_ref_arg); result = (int) mh_spreadInvoker.invokeExact(mh_spread_target, (Object[]) null); throw new Error("Expected IllegalArgumentException was not thrown"); } catch (IllegalArgumentException e) { @@ -55,7 +58,7 @@ public class SpreadNullArg { if (result != 42) { throw new Error("result [" + result - + "] != 42 : Expected IllegalArgumentException was not thrown?"); + + "] != 42 : Expected IllegalArgumentException was not thrown?"); } } diff --git a/hotspot/test/compiler/runtime/6865265/StackOverflowBug.java b/hotspot/test/compiler/runtime/StackOverflowBug.java similarity index 53% rename from hotspot/test/compiler/runtime/6865265/StackOverflowBug.java rename to hotspot/test/compiler/runtime/StackOverflowBug.java index c5d0f3b62e1..a4ee2671c0c 100644 --- a/hotspot/test/compiler/runtime/6865265/StackOverflowBug.java +++ b/hotspot/test/compiler/runtime/StackOverflowBug.java @@ -28,40 +28,41 @@ * @summary JVM crashes with "missing exception handler" error * @author volker.simonis@sap.com * - * @run main/othervm -XX:CompileThreshold=100 -Xbatch -Xss512k StackOverflowBug + * @run main/othervm -XX:CompileThreshold=100 -Xbatch -Xss512k + * compiler.runtime.StackOverflowBug */ +package compiler.runtime; public class StackOverflowBug { - public static int run() { - try { - try { - return run(); - } catch (Throwable e) { - // Notice that the class 'Throwable' is NOT resolved by the verifier, - // because the verifier only checks if 'Throwable' is assignable to - // 'java.lang.Throwable' and this check succeeds immediately if the two - // types have equal names (see 'VerificationType::is_assignable_from' which - // is called from 'ClassVerifier::verify_exception_handler_table'). - // This is strange, because if the two classes have different names, - // 'is_assignable_from()' calls 'is_reference_assignable_from()' which resolves - // both classes by calling 'SystemDictionary::resolve_or_fail()'. This call - // also takes into account the current class loader (i.e. the one which was used - // to load this class) and would place a corresponding - // "java.lang.Throwable / current-Classloader" entry into the system dictionary. - // This would in turn allow C2 to see 'java.lang.Throwable' as "loaded" - // (see 'Parse::catch_inline_exceptions()') when this method is compiled. - return 42; - } + public static int run() { + try { + try { + return run(); + } catch (Throwable e) { + // Notice that the class 'Throwable' is NOT resolved by the verifier, + // because the verifier only checks if 'Throwable' is assignable to + // 'java.lang.Throwable' and this check succeeds immediately if the two + // types have equal names (see 'VerificationType::is_assignable_from' which + // is called from 'ClassVerifier::verify_exception_handler_table'). + // This is strange, because if the two classes have different names, + // 'is_assignable_from()' calls 'is_reference_assignable_from()' which resolves + // both classes by calling 'SystemDictionary::resolve_or_fail()'. This call + // also takes into account the current class loader (i.e. the one which was used + // to load this class) and would place a corresponding + // "java.lang.Throwable / current-Classloader" entry into the system dictionary. + // This would in turn allow C2 to see 'java.lang.Throwable' as "loaded" + // (see 'Parse::catch_inline_exceptions()') when this method is compiled. + return 42; + } + } finally { + } } - finally { - } - } - public static void main(String argv[]) { - run(); - } + public static void main(String argv[]) { + run(); + } } /* diff --git a/hotspot/test/compiler/runtime/Test6778657.java b/hotspot/test/compiler/runtime/Test6778657.java new file mode 100644 index 00000000000..37787d2ff88 --- /dev/null +++ b/hotspot/test/compiler/runtime/Test6778657.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2008, 2009, 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 6778657 + * @summary Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour + * + * @run main compiler.runtime.Test6778657 + */ + +package compiler.runtime; + +public class Test6778657 { + public static void check_f2i(int expect) { + float check = expect; + check *= 2; + int actual = (int) check; + if (actual != expect) { + throw new RuntimeException("expecting " + expect + ", got " + actual); + } + } + + public static void check_f2l(long expect) { + float check = expect; + check *= 2; + long actual = (long) check; + if (actual != expect) { + throw new RuntimeException("expecting " + expect + ", got " + actual); + } + } + + public static void check_d2i(int expect) { + double check = expect; + check *= 2; + int actual = (int) check; + if (actual != expect) { + throw new RuntimeException("expecting " + expect + ", got " + actual); + } + } + + public static void check_d2l(long expect) { + double check = expect; + check *= 2; + long actual = (long) check; + if (actual != expect) { + throw new RuntimeException("expecting " + expect + ", got " + actual); + } + } + + public static void main(String[] args) { + check_f2i(Integer.MAX_VALUE); + check_f2i(Integer.MIN_VALUE); + check_f2l(Long.MAX_VALUE); + check_f2l(Long.MIN_VALUE); + check_d2i(Integer.MAX_VALUE); + check_d2i(Integer.MIN_VALUE); + check_d2l(Long.MAX_VALUE); + check_d2l(Long.MIN_VALUE); + } +} + diff --git a/hotspot/test/compiler/runtime/6826736/Test.java b/hotspot/test/compiler/runtime/Test6826736.java similarity index 84% rename from hotspot/test/compiler/runtime/6826736/Test.java rename to hotspot/test/compiler/runtime/Test6826736.java index e1e1e8d2341..1fb8dd625c7 100644 --- a/hotspot/test/compiler/runtime/6826736/Test.java +++ b/hotspot/test/compiler/runtime/Test6826736.java @@ -27,10 +27,17 @@ * @bug 6826736 * @summary CMS: core dump with -XX:+UseCompressedOops * - * @run main/othervm/timeout=600 -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:+ScavengeALot -XX:+UseCompressedOops -XX:HeapBaseMinAddress=32g -XX:CompileThreshold=100 -XX:CompileOnly=Test.test -XX:-BlockLayoutRotateLoops -XX:LoopUnrollLimit=0 -Xmx256m -XX:ParallelGCThreads=4 Test + * @run main/othervm/timeout=600 -XX:+IgnoreUnrecognizedVMOptions -Xbatch + * -XX:+ScavengeALot -XX:+UseCompressedOops -XX:HeapBaseMinAddress=32g + * -XX:CompileThreshold=100 -XX:-BlockLayoutRotateLoops + * -XX:LoopUnrollLimit=0 -Xmx256m -XX:ParallelGCThreads=4 + * -XX:CompileCommand=compileonly,compiler.runtime.Test6826736::test + * compiler.runtime.Test6826736 */ -public class Test { +package compiler.runtime; + +public class Test6826736 { int[] arr; int[] arr2; int test(int r) { @@ -50,7 +57,7 @@ public class Test { public static void main(String[] args) { int r = 0; - Test t = new Test(); + Test6826736 t = new Test6826736(); for (int i = 0; i < 100; i++) { t.arr = new int[100]; r = t.test(r); diff --git a/hotspot/test/compiler/runtime/6859338/Test6859338.java b/hotspot/test/compiler/runtime/Test6859338.java similarity index 92% rename from hotspot/test/compiler/runtime/6859338/Test6859338.java rename to hotspot/test/compiler/runtime/Test6859338.java index 73576840db1..b7db7141ac4 100644 --- a/hotspot/test/compiler/runtime/6859338/Test6859338.java +++ b/hotspot/test/compiler/runtime/Test6859338.java @@ -27,9 +27,13 @@ * @bug 6859338 * @summary Assertion failure in sharedRuntime.cpp * - * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-InlineObjectHash -Xbatch -XX:-ProfileInterpreter Test6859338 + * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions + * -XX:-InlineObjectHash -Xbatch -XX:-ProfileInterpreter + * compiler.runtime.Test6859338 */ +package compiler.runtime; + public class Test6859338 { static Object[] o = new Object[] { new Object(), null }; public static void main(String[] args) { diff --git a/hotspot/test/compiler/runtime/6863420/Test.java b/hotspot/test/compiler/runtime/Test6863420.java similarity index 95% rename from hotspot/test/compiler/runtime/6863420/Test.java rename to hotspot/test/compiler/runtime/Test6863420.java index 11d91d35aeb..e18035cc259 100644 --- a/hotspot/test/compiler/runtime/6863420/Test.java +++ b/hotspot/test/compiler/runtime/Test6863420.java @@ -27,11 +27,15 @@ * @bug 6863420 * @summary os::javaTimeNanos() go backward on Solaris x86 * - * Notice the internal timeout in timeout thread Test.TOT. - * @run main/othervm/timeout=300 Test + * @run main/othervm/timeout=300 compiler.runtime.Test6863420 + */ +/* + * Notice the internal timeout in timeout thread Test6863420.TOT. */ -public class Test { +package compiler.runtime; + +public class Test6863420 { static final int INTERNAL_TIMEOUT=240; static class TOT extends Thread { diff --git a/hotspot/test/compiler/runtime/6892265/Test.java b/hotspot/test/compiler/runtime/Test6892265.java similarity index 56% rename from hotspot/test/compiler/runtime/6892265/Test.java rename to hotspot/test/compiler/runtime/Test6892265.java index fd511939638..2f6df9153f1 100644 --- a/hotspot/test/compiler/runtime/6892265/Test.java +++ b/hotspot/test/compiler/runtime/Test6892265.java @@ -27,39 +27,41 @@ * @bug 6892265 * @summary System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes * - * @run main/othervm Test + * @run main/othervm compiler.runtime.Test6892265 */ -public class Test { - static final int NCOPY = 1; - static final int OVERFLOW = 1; - static int[] src2 = new int[NCOPY]; - static int[] dst2; +package compiler.runtime; - static void test() { - int N; - int SIZE; +public class Test6892265 { + static final int NCOPY = 1; + static final int OVERFLOW = 1; + static int[] src2 = new int[NCOPY]; + static int[] dst2; - N = Integer.MAX_VALUE/4 + OVERFLOW; - System.arraycopy(src2, 0, dst2, N, NCOPY); - System.arraycopy(dst2, N, src2, 0, NCOPY); - } + static void test() { + int N; + int SIZE; - public static void main(String[] args) { - try { - dst2 = new int[NCOPY + Integer.MAX_VALUE/4 + OVERFLOW]; - } catch (OutOfMemoryError e) { - System.exit(95); // Not enough memory + N = Integer.MAX_VALUE / 4 + OVERFLOW; + System.arraycopy(src2, 0, dst2, N, NCOPY); + System.arraycopy(dst2, N, src2, 0, NCOPY); } - System.out.println("warmup"); - for (int i=0; i <11000; i++) { - test(); + + public static void main(String[] args) { + try { + dst2 = new int[NCOPY + Integer.MAX_VALUE / 4 + OVERFLOW]; + } catch (OutOfMemoryError e) { + System.exit(95); // Not enough memory + } + System.out.println("warmup"); + for (int i = 0; i < 11000; i++) { + test(); + } + System.out.println("start"); + for (int i = 0; i < 1000; i++) { + test(); + } + System.out.println("finish"); } - System.out.println("start"); - for (int i=0; i <1000; i++) { - test(); - } - System.out.println("finish"); - } } diff --git a/hotspot/test/compiler/runtime/7088020/Test7088020.java b/hotspot/test/compiler/runtime/Test7088020.java similarity index 92% rename from hotspot/test/compiler/runtime/7088020/Test7088020.java rename to hotspot/test/compiler/runtime/Test7088020.java index 4ea991340bd..fa11ec6a54e 100644 --- a/hotspot/test/compiler/runtime/7088020/Test7088020.java +++ b/hotspot/test/compiler/runtime/Test7088020.java @@ -27,11 +27,15 @@ * @bug 7088020 * @summary SEGV in JNIHandleBlock::release_block * - * @run main Test7088020 + * @run main compiler.runtime.Test7088020 */ -import java.lang.invoke.*; +package compiler.runtime; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.lang.invoke.WrongMethodTypeException; public class Test7088020 { public static boolean test() { diff --git a/hotspot/test/compiler/runtime/Test7196199.java b/hotspot/test/compiler/runtime/Test7196199.java new file mode 100644 index 00000000000..1a83660577a --- /dev/null +++ b/hotspot/test/compiler/runtime/Test7196199.java @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2012, 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 7196199 + * @summary java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect + * + * @run main/othervm/timeout=400 -Xmx32m -Xbatch -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation + * -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100 + * -XX:CompileCommand=exclude,compiler.runtime.Test7196199::test + * compiler.runtime.Test7196199 + */ + +package compiler.runtime; + +public class Test7196199 { + private static final int ARRLEN = 97; + private static final int ITERS = 5000; + private static final int INI_ITERS = 1000; + private static final int SFP_ITERS = 10000; + private static final float SFP_ITERS_F = 10000.f; + private static final float VALUE = 15.f; + + public static void main(String args[]) { + int errn = test(); + if (errn > 0) { + System.err.println("FAILED: " + errn + " errors"); + System.exit(97); + } + System.out.println("PASSED"); + } + + static int test() { + float[] a0 = new float[ARRLEN]; + float[] a1 = new float[ARRLEN]; + // Initialize + for (int i = 0; i < ARRLEN; i++) { + a0[i] = 0.f; + a1[i] = (float) i; + } + System.out.println("Warmup"); + for (int i = 0; i < INI_ITERS; i++) { + test_incrc(a0); + test_incrv(a0, VALUE); + test_addc(a0, a1); + test_addv(a0, a1, VALUE); + } + // Test and verify results + System.out.println("Verification"); + int errn = 0; + for (int i = 0; i < ARRLEN; i++) + a0[i] = 0.f; + + System.out.println(" test_incrc"); + for (int j = 0; j < ITERS; j++) { + test_incrc(a0); + for (int i = 0; i < ARRLEN; i++) { + errn += verify("test_incrc: ", i, a0[i], VALUE * SFP_ITERS_F); + a0[i] = 0.f; // Reset + } + } + + System.out.println(" test_incrv"); + for (int j = 0; j < ITERS; j++) { + test_incrv(a0, VALUE); + for (int i = 0; i < ARRLEN; i++) { + errn += verify("test_incrv: ", i, a0[i], VALUE * SFP_ITERS_F); + a0[i] = 0.f; // Reset + } + } + + System.out.println(" test_addc"); + for (int j = 0; j < ITERS; j++) { + test_addc(a0, a1); + for (int i = 0; i < ARRLEN; i++) { + errn += verify("test_addc: ", i, a0[i], ((float) i + VALUE) * SFP_ITERS_F); + a0[i] = 0.f; // Reset + } + } + + System.out.println(" test_addv"); + for (int j = 0; j < ITERS; j++) { + test_addv(a0, a1, VALUE); + for (int i = 0; i < ARRLEN; i++) { + errn += verify("test_addv: ", i, a0[i], ((float) i + VALUE) * SFP_ITERS_F); + a0[i] = 0.f; // Reset + } + } + + if (errn > 0) + return errn; + + System.out.println("Time"); + long start, end; + + start = System.currentTimeMillis(); + for (int i = 0; i < INI_ITERS; i++) { + test_incrc(a0); + } + end = System.currentTimeMillis(); + System.out.println("test_incrc: " + (end - start)); + + start = System.currentTimeMillis(); + for (int i = 0; i < INI_ITERS; i++) { + test_incrv(a0, VALUE); + } + end = System.currentTimeMillis(); + System.out.println("test_incrv: " + (end - start)); + + start = System.currentTimeMillis(); + for (int i = 0; i < INI_ITERS; i++) { + test_addc(a0, a1); + } + end = System.currentTimeMillis(); + System.out.println("test_addc: " + (end - start)); + + start = System.currentTimeMillis(); + for (int i = 0; i < INI_ITERS; i++) { + test_addv(a0, a1, VALUE); + } + end = System.currentTimeMillis(); + System.out.println("test_addv: " + (end - start)); + + return errn; + } + + static void test_incrc(float[] a0) { + // Non-counted loop with safepoint. + for (long l = 0; l < SFP_ITERS; l++) { + // Counted and vectorized loop. + for (int i = 0; i < a0.length; i += 1) { + a0[i] += VALUE; + } + } + } + + static void test_incrv(float[] a0, float b) { + // Non-counted loop with safepoint. + for (long l = 0; l < SFP_ITERS; l++) { + // Counted and vectorized loop. + for (int i = 0; i < a0.length; i += 1) { + a0[i] += b; + } + } + } + + static void test_addc(float[] a0, float[] a1) { + // Non-counted loop with safepoint. + for (long l = 0; l < SFP_ITERS; l++) { + // Counted and vectorized loop. + for (int i = 0; i < a0.length; i += 1) { + a0[i] += a1[i] + VALUE; + } + } + } + + static void test_addv(float[] a0, float[] a1, float b) { + // Non-counted loop with safepoint. + for (long l = 0; l < SFP_ITERS; l++) { + // Counted and vectorized loop. + for (int i = 0; i < a0.length; i += 1) { + a0[i] += a1[i] + b; + } + } + } + + static int verify(String text, int i, float elem, float val) { + if (elem != val) { + System.err.println(text + "[" + i + "] = " + elem + " != " + val); + return 1; + } + return 0; + } +} + diff --git a/hotspot/test/compiler/runtime/Test8010927.java b/hotspot/test/compiler/runtime/Test8010927.java new file mode 100644 index 00000000000..64dc5cab142 --- /dev/null +++ b/hotspot/test/compiler/runtime/Test8010927.java @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2013, 2015, 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 8010927 + * @summary Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy + * @library /test/lib /testlibrary + * @modules java.base/jdk.internal.misc + * @build compiler.runtime.Test8010927 + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions + * -XX:+WhiteBoxAPI -Xbootclasspath/a:. -Xmx64m -XX:NewSize=20971520 + * -XX:MaxNewSize=32m -XX:-UseTLAB -XX:-UseAdaptiveSizePolicy + * compiler.runtime.Test8010927 + */ + +package compiler.runtime; + +import jdk.internal.misc.Unsafe; +import sun.hotspot.WhiteBox; + +import java.lang.reflect.Field; + +/** + * The test creates uncommitted space between oldgen and young gen + * by specifying MaxNewSize bigger than NewSize. + * NewSize = 20971520 = (512*4K) * 10 for 4k pages + * Then it tries to execute arraycopy() with elements type check + * to the array at the end of survive space near unused space. + */ + +public class Test8010927 { + + private static final Unsafe U; + + static { + try { + Field unsafe = Unsafe.class.getDeclaredField("theUnsafe"); + unsafe.setAccessible(true); + U = (Unsafe) unsafe.get(null); + } catch (Exception e) { + throw new Error(e); + } + } + + public static Object[] o; + + public static final boolean debug = Boolean.getBoolean("debug"); + + // 2 different obect arrays but same element types + static Test8010927[] masterA; + static Object[] masterB; + static final Test8010927 elem = new Test8010927(); + static final WhiteBox wb = WhiteBox.getWhiteBox(); + + static final int obj_header_size = U.ARRAY_OBJECT_BASE_OFFSET; + static final int heap_oop_size = wb.getHeapOopSize(); + static final int card_size = 512; + static final int one_card = (card_size - obj_header_size) / heap_oop_size; + + static final int surv_size = 2112 * 1024; + + // The size is big to not fit into survive space. + static final Object[] cache = new Object[(surv_size / card_size)]; + + public static void main(String[] args) { + masterA = new Test8010927[one_card]; + masterB = new Object[one_card]; + for (int i = 0; i < one_card; ++i) { + masterA[i] = elem; + masterB[i] = elem; + } + + // Move cache[] to the old gen. + long low_limit = wb.getObjectAddress(cache); + System.gc(); + // Move 'cache' to oldgen. + long upper_limit = wb.getObjectAddress(cache); + if ((low_limit - upper_limit) > 0) { // substaction works with unsigned values + // OldGen is placed before youngger for ParallelOldGC. + upper_limit = low_limit + 21000000l; // +20971520 + } + // Each A[one_card] size is 512 bytes, + // it will take about 40000 allocations to trigger GC. + // cache[] has 8192 elements so GC should happen + // each 5th iteration. + for (long l = 0; l < 20; l++) { + fill_heap(); + if (debug) { + System.out.println("test oop_disjoint_arraycopy"); + } + testA_arraycopy(); + if (debug) { + System.out.println("test checkcast_arraycopy"); + } + testB_arraycopy(); + // Execute arraycopy to the topmost array in young gen + if (debug) { + int top_index = get_top_address(low_limit, upper_limit); + if (top_index >= 0) { + long addr = wb.getObjectAddress(cache[top_index]); + System.out.println("top_addr: 0x" + Long.toHexString(addr) + ", 0x" + Long.toHexString(addr + 512)); + } + } + } + } + + static void fill_heap() { + for (int i = 0; i < cache.length; ++i) { + o = new Test8010927[one_card]; + System.arraycopy(masterA, 0, o, 0, masterA.length); + cache[i] = o; + } + for (long j = 0; j < 256; ++j) { + o = new Long[10000]; // to trigger GC + } + } + + static void testA_arraycopy() { + for (int i = 0; i < cache.length; ++i) { + System.arraycopy(masterA, 0, cache[i], 0, masterA.length); + } + } + + static void testB_arraycopy() { + for (int i = 0; i < cache.length; ++i) { + System.arraycopy(masterB, 0, cache[i], 0, masterB.length); + } + } + + static int get_top_address(long min, long max) { + int index = -1; + long addr = min; + for (int i = 0; i < cache.length; ++i) { + long test = wb.getObjectAddress(cache[i]); + if (((test - addr) > 0) && ((max - test) > 0)) { // substaction works with unsigned values + addr = test; + index = i; + } + } + return index; + } +} diff --git a/hotspot/test/compiler/runtime/6891750/Test6891750.java b/hotspot/test/compiler/runtime/cr6891750/Test6891750.java similarity index 97% rename from hotspot/test/compiler/runtime/6891750/Test6891750.java rename to hotspot/test/compiler/runtime/cr6891750/Test6891750.java index 05381e8cd74..a375639d107 100644 --- a/hotspot/test/compiler/runtime/6891750/Test6891750.java +++ b/hotspot/test/compiler/runtime/cr6891750/Test6891750.java @@ -26,10 +26,11 @@ * @test * @bug 6891750 * @summary deopt blob kills values in O5 - * - * @run main Test6891750 + * @run main compiler.runtime.cr6891750.Test6891750 */ +package compiler.runtime.cr6891750; + abstract class Base6891750 extends Thread { abstract public long m(); } diff --git a/hotspot/test/compiler/runtime/8015436/Test8015436.java b/hotspot/test/compiler/runtime/cr8015436/Test8015436.java similarity index 92% rename from hotspot/test/compiler/runtime/8015436/Test8015436.java rename to hotspot/test/compiler/runtime/cr8015436/Test8015436.java index 268e04acbe7..8c70624f32a 100644 --- a/hotspot/test/compiler/runtime/8015436/Test8015436.java +++ b/hotspot/test/compiler/runtime/cr8015436/Test8015436.java @@ -25,8 +25,8 @@ * @test * @bug 8015436 * @summary the IK _initial_method_idnum value must be adjusted if overpass methods are added - * @run main Test8015436 * + * @run main compiler.runtime.cr8015436.Test8015436 */ /* @@ -38,15 +38,11 @@ * All the invocations of the defaultMethod() must be completed successfully. */ -import java.lang.invoke.*; +package compiler.runtime.cr8015436; -interface InterfaceWithDefaultMethod { - public void someMethod(); - - default public void defaultMethod(String str){ - System.out.println("defaultMethod() " + str); - } -} +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; public class Test8015436 implements InterfaceWithDefaultMethod { @Override @@ -66,6 +62,13 @@ public class Test8015436 implements InterfaceWithDefaultMethod { } } +interface InterfaceWithDefaultMethod { + public void someMethod(); + + default public void defaultMethod(String str){ + System.out.println("defaultMethod() " + str); + } +} /* * A successful execution gives the output: * someMethod() invoked diff --git a/hotspot/test/compiler/runtime/safepoints/TestRegisterRestoring.java b/hotspot/test/compiler/runtime/safepoints/TestRegisterRestoring.java index 08c2cb75a86..07b15422324 100644 --- a/hotspot/test/compiler/runtime/safepoints/TestRegisterRestoring.java +++ b/hotspot/test/compiler/runtime/safepoints/TestRegisterRestoring.java @@ -27,36 +27,43 @@ * @test * @bug 8148490 * @summary Test correct saving and restoring of vector registers at safepoints. - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:-TieredCompilation -XX:CompileCommand=exclude,TestRegisterRestoring::main -XX:+SafepointALot TestRegisterRestoring + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:-TieredCompilation + * -XX:+SafepointALot + * -XX:CompileCommand=exclude,compiler.runtime.safepoints.TestRegisterRestoring::main + * compiler.runtime.safepoints.TestRegisterRestoring */ -public class TestRegisterRestoring { - public static void main(String args[]) throws Exception { - // Initialize - float[] array = new float[100]; - for (int i = 0; i < array.length; ++i) { - array[i] = 0; - } - // Test - for (int j = 0; j < 20_000; ++j) { - increment(array); - // Check result - for (int i = 0; i < array.length; i++) { - if (array[i] != 10_000) { - throw new RuntimeException("Test failed: array[" + i + "] = " + array[i] + " but should be 10.000"); - } - array[i] = 0; - } - } - } - static void increment(float[] array) { - // Loop with safepoint - for (long l = 0; l < 10_000; l++) { - // Vectorized loop - for (int i = 0; i < array.length; ++i) { - array[i] += 1; - } +package compiler.runtime.safepoints; + +public class TestRegisterRestoring { + public static void main(String args[]) throws Exception { + // Initialize + float[] array = new float[100]; + for (int i = 0; i < array.length; ++i) { + array[i] = 0; + } + // Test + for (int j = 0; j < 20_000; ++j) { + increment(array); + // Check result + for (int i = 0; i < array.length; i++) { + if (array[i] != 10_000) { + throw new RuntimeException("Test failed: array[" + i + "] = " + array[i] + " but should be 10.000"); + } + array[i] = 0; + } + } + } + + static void increment(float[] array) { + // Loop with safepoint + for (long l = 0; l < 10_000; l++) { + // Vectorized loop + for (int i = 0; i < array.length; ++i) { + array[i] += 1; + } + } } - } } diff --git a/hotspot/test/compiler/stable/StableConfiguration.java b/hotspot/test/compiler/stable/StableConfiguration.java index 6f11dcd68b4..dc608dfb55d 100644 --- a/hotspot/test/compiler/stable/StableConfiguration.java +++ b/hotspot/test/compiler/stable/StableConfiguration.java @@ -27,8 +27,6 @@ package compiler.stable; import sun.hotspot.WhiteBox; -import java.lang.reflect.Method; - public class StableConfiguration { static final WhiteBox WB = WhiteBox.getWhiteBox(); public static final boolean isStableEnabled; diff --git a/hotspot/test/compiler/stable/TestStableBoolean.java b/hotspot/test/compiler/stable/TestStableBoolean.java index 0e9f7bc396a..dbb9705e0dd 100644 --- a/hotspot/test/compiler/stable/TestStableBoolean.java +++ b/hotspot/test/compiler/stable/TestStableBoolean.java @@ -58,6 +58,7 @@ package compiler.stable; import jdk.internal.vm.annotation.Stable; + import java.lang.reflect.InvocationTargetException; public class TestStableBoolean { diff --git a/hotspot/test/compiler/stable/TestStableByte.java b/hotspot/test/compiler/stable/TestStableByte.java index 46f4711c19d..5561b4b34e6 100644 --- a/hotspot/test/compiler/stable/TestStableByte.java +++ b/hotspot/test/compiler/stable/TestStableByte.java @@ -58,6 +58,7 @@ package compiler.stable; import jdk.internal.vm.annotation.Stable; + import java.lang.reflect.InvocationTargetException; public class TestStableByte { diff --git a/hotspot/test/compiler/stable/TestStableChar.java b/hotspot/test/compiler/stable/TestStableChar.java index 95c95c1a1f7..8a1f51ec78e 100644 --- a/hotspot/test/compiler/stable/TestStableChar.java +++ b/hotspot/test/compiler/stable/TestStableChar.java @@ -57,9 +57,10 @@ package compiler.stable; -import java.lang.reflect.InvocationTargetException; import jdk.internal.vm.annotation.Stable; +import java.lang.reflect.InvocationTargetException; + public class TestStableChar { static final boolean isStableEnabled = StableConfiguration.isStableEnabled; diff --git a/hotspot/test/compiler/stable/TestStableDouble.java b/hotspot/test/compiler/stable/TestStableDouble.java index 34a3df697ea..ff96b2c7c6a 100644 --- a/hotspot/test/compiler/stable/TestStableDouble.java +++ b/hotspot/test/compiler/stable/TestStableDouble.java @@ -57,9 +57,10 @@ package compiler.stable; -import java.lang.reflect.InvocationTargetException; import jdk.internal.vm.annotation.Stable; +import java.lang.reflect.InvocationTargetException; + public class TestStableDouble { static final boolean isStableEnabled = StableConfiguration.isStableEnabled; diff --git a/hotspot/test/compiler/stable/TestStableFloat.java b/hotspot/test/compiler/stable/TestStableFloat.java index 0f9fc974269..ab879c5c242 100644 --- a/hotspot/test/compiler/stable/TestStableFloat.java +++ b/hotspot/test/compiler/stable/TestStableFloat.java @@ -58,6 +58,7 @@ package compiler.stable; import jdk.internal.vm.annotation.Stable; + import java.lang.reflect.InvocationTargetException; public class TestStableFloat { diff --git a/hotspot/test/compiler/stable/TestStableInt.java b/hotspot/test/compiler/stable/TestStableInt.java index 4da1d89509e..e203a269421 100644 --- a/hotspot/test/compiler/stable/TestStableInt.java +++ b/hotspot/test/compiler/stable/TestStableInt.java @@ -58,6 +58,7 @@ package compiler.stable; import jdk.internal.vm.annotation.Stable; + import java.lang.reflect.InvocationTargetException; public class TestStableInt { diff --git a/hotspot/test/compiler/stable/TestStableLong.java b/hotspot/test/compiler/stable/TestStableLong.java index dfbf93b623f..11e6a95416c 100644 --- a/hotspot/test/compiler/stable/TestStableLong.java +++ b/hotspot/test/compiler/stable/TestStableLong.java @@ -58,6 +58,7 @@ package compiler.stable; import jdk.internal.vm.annotation.Stable; + import java.lang.reflect.InvocationTargetException; public class TestStableLong { diff --git a/hotspot/test/compiler/stable/TestStableMemoryBarrier.java b/hotspot/test/compiler/stable/TestStableMemoryBarrier.java index 4a421c61e33..78372029838 100644 --- a/hotspot/test/compiler/stable/TestStableMemoryBarrier.java +++ b/hotspot/test/compiler/stable/TestStableMemoryBarrier.java @@ -27,8 +27,6 @@ * @test TestStableMemoryBarrier * @bug 8139758 * @summary tests memory barrier correctly inserted for stable fields - * @library /testlibrary /test/lib - * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * * @run main/bootclasspath/othervm -Xcomp -XX:CompileOnly=::testCompile diff --git a/hotspot/test/compiler/stable/TestStableMismatched.java b/hotspot/test/compiler/stable/TestStableMismatched.java index a71ee78aa66..57578fc55cf 100644 --- a/hotspot/test/compiler/stable/TestStableMismatched.java +++ b/hotspot/test/compiler/stable/TestStableMismatched.java @@ -26,13 +26,17 @@ * @test TestStableMismatched * @bug 8158228 * @summary Tests if mismatched char load from stable byte[] returns correct result + * * @run main/othervm -XX:-CompactStrings -XX:TieredStopAtLevel=1 -Xcomp - * -XX:CompileOnly=TestStableMismatched::test,::charAt - * TestStableMismatched + * -XX:CompileOnly=compiler.stable.TestStableMismatched::test,::charAt + * compiler.stable.TestStableMismatched * @run main/othervm -XX:-CompactStrings -XX:-TieredCompilation -Xcomp - * -XX:CompileOnly=TestStableMismatched::test,::charAt - * TestStableMismatched + * -XX:CompileOnly=compiler.stable.TestStableMismatched::test,::charAt + * compiler.stable.TestStableMismatched */ + +package compiler.stable; + public class TestStableMismatched { public static void main(String args[]) { test(); diff --git a/hotspot/test/compiler/stable/TestStableObject.java b/hotspot/test/compiler/stable/TestStableObject.java index 1ad6b681a08..58affb9a76b 100644 --- a/hotspot/test/compiler/stable/TestStableObject.java +++ b/hotspot/test/compiler/stable/TestStableObject.java @@ -58,6 +58,7 @@ package compiler.stable; import jdk.internal.vm.annotation.Stable; + import java.lang.reflect.InvocationTargetException; public class TestStableObject { diff --git a/hotspot/test/compiler/stable/TestStableShort.java b/hotspot/test/compiler/stable/TestStableShort.java index acd8182f167..d893f8d56be 100644 --- a/hotspot/test/compiler/stable/TestStableShort.java +++ b/hotspot/test/compiler/stable/TestStableShort.java @@ -58,6 +58,7 @@ package compiler.stable; import jdk.internal.vm.annotation.Stable; + import java.lang.reflect.InvocationTargetException; public class TestStableShort { diff --git a/hotspot/test/compiler/stable/TestStableUByte.java b/hotspot/test/compiler/stable/TestStableUByte.java index 788fecacde5..5431345f757 100644 --- a/hotspot/test/compiler/stable/TestStableUByte.java +++ b/hotspot/test/compiler/stable/TestStableUByte.java @@ -57,8 +57,8 @@ * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1 * compiler.stable.TestStableUByte - * */ + package compiler.stable; import jdk.internal.vm.annotation.Stable; diff --git a/hotspot/test/compiler/stable/TestStableUShort.java b/hotspot/test/compiler/stable/TestStableUShort.java index 43ebf3c6383..88f5cb46119 100644 --- a/hotspot/test/compiler/stable/TestStableUShort.java +++ b/hotspot/test/compiler/stable/TestStableUShort.java @@ -57,8 +57,8 @@ * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1 * compiler.stable.TestStableUShort - * */ + package compiler.stable; import jdk.internal.vm.annotation.Stable; diff --git a/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java b/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java index 1eebffc1893..7abfc6314cb 100644 --- a/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java +++ b/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java @@ -28,8 +28,15 @@ * @library /testlibrary * @modules java.base/jdk.internal.misc * java.management + * + * @run driver compiler.startup.NumCompilerThreadsCheck */ -import jdk.test.lib.*; + +package compiler.startup; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.Platform; +import jdk.test.lib.ProcessTools; public class NumCompilerThreadsCheck { diff --git a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java index f95984660c5..2ff643765ab 100644 --- a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java +++ b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java @@ -28,11 +28,18 @@ * to initialize all compiler threads. The option -Xcomp gives the VM more time to * trigger the old bug. * @library /testlibrary - * @ignore 8134286 * @modules java.base/jdk.internal.misc * java.management + * + * @ignore 8134286 + * @run driver compiler.startup.SmallCodeCacheStartup */ -import jdk.test.lib.*; + +package compiler.startup; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; + import static jdk.test.lib.Asserts.assertTrue; public class SmallCodeCacheStartup { diff --git a/hotspot/test/compiler/startup/StartupOutput.java b/hotspot/test/compiler/startup/StartupOutput.java index 5d15e404921..b8cd3157d59 100644 --- a/hotspot/test/compiler/startup/StartupOutput.java +++ b/hotspot/test/compiler/startup/StartupOutput.java @@ -28,18 +28,24 @@ * @library /testlibrary * @modules java.base/jdk.internal.misc * java.management + * + * @run driver compiler.startup.StartupOutput */ -import jdk.test.lib.*; + +package compiler.startup; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.ProcessTools; public class StartupOutput { - public static void main(String[] args) throws Exception { - ProcessBuilder pb; - OutputAnalyzer out; + public static void main(String[] args) throws Exception { + ProcessBuilder pb; + OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder("-Xint", "-XX:+DisplayVMOutputToStdout", "-version"); - out = new OutputAnalyzer(pb.start()); - out.shouldNotContain("no space to run compilers"); + pb = ProcessTools.createJavaProcessBuilder("-Xint", "-XX:+DisplayVMOutputToStdout", "-version"); + out = new OutputAnalyzer(pb.start()); + out.shouldNotContain("no space to run compilers"); - out.shouldHaveExitValue(0); - } + out.shouldHaveExitValue(0); + } } diff --git a/hotspot/test/compiler/startup/TieredStopAtLevel0SanityTest.java b/hotspot/test/compiler/startup/TieredStopAtLevel0SanityTest.java index a7dbf2badc0..2dbce93a853 100644 --- a/hotspot/test/compiler/startup/TieredStopAtLevel0SanityTest.java +++ b/hotspot/test/compiler/startup/TieredStopAtLevel0SanityTest.java @@ -25,9 +25,13 @@ * @test * @bug 8154151 * @summary Sanity test flag combo that force compiles on level 0 - * @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:TieredStopAtLevel=0 TieredStopAtLevel0SanityTest + * + * @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:TieredStopAtLevel=0 + * compiler.startup.TieredStopAtLevel0SanityTest */ +package compiler.startup; + public class TieredStopAtLevel0SanityTest { public static void main(String[] args) throws Exception { System.out.println("Hello world!"); diff --git a/hotspot/test/compiler/stringopts/TestOptimizeStringConcat.java b/hotspot/test/compiler/stringopts/TestOptimizeStringConcat.java index 2f0ec3c0353..1f14cee6f0a 100644 --- a/hotspot/test/compiler/stringopts/TestOptimizeStringConcat.java +++ b/hotspot/test/compiler/stringopts/TestOptimizeStringConcat.java @@ -26,9 +26,14 @@ * @bug 8068909 * @key regression * @summary test that string optimizations produce code, that doesn't lead to a crash. - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestOptimizeStringConcat + * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.stringopts.TestOptimizeStringConcat * @author axel.siebenborn@sap.com */ + +package compiler.stringopts; + public class TestOptimizeStringConcat { static boolean checkArgumentSyntax(String value, String allowedchars, String notallowedchars, String logmsg) { diff --git a/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java b/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java index 2d09be12714..b25c225d413 100644 --- a/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java +++ b/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java @@ -22,19 +22,26 @@ */ -import java.util.Arrays; + /* * @test * @bug 8159244 - * @requires vm.gc == "Parallel" | vm.gc == "null" * @summary Verifies that no partially initialized String object escapes from * C2's String concat optimization in a highly concurrent setting. * This test triggers the bug in about 1 out of 10 runs. + * @requires vm.gc == "Parallel" | vm.gc == "null" + * * @compile -XDstringConcat=inline TestStringObjectInitialization.java * @run main/othervm/timeout=300 -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-CompactStrings - * -XX:-UseG1GC -XX:+UseParallelGC TestStringObjectInitialization + * -XX:-UseG1GC -XX:+UseParallelGC + * compiler.stringopts.TestStringObjectInitialization */ + +package compiler.stringopts; + +import java.util.Arrays; + public class TestStringObjectInitialization { String myString; @@ -59,19 +66,19 @@ public class TestStringObjectInitialization { // Trigger C2's string concatenation optimization add(s + Arrays.toString(sArray) + " const "); } -} -class Runner implements Runnable { - private TestStringObjectInitialization test; + private static class Runner implements Runnable { + private TestStringObjectInitialization test; - public Runner(TestStringObjectInitialization t) { - test = t; - } + public Runner(TestStringObjectInitialization t) { + test = t; + } - public void run(){ - String[] array = {"a", "b", "c"}; - for (int i = 0; i < 10000; ++i) { - test.run("a", array); + public void run() { + String[] array = {"a", "b", "c"}; + for (int i = 0; i < 10000; ++i) { + test.run("a", array); + } } } } diff --git a/hotspot/test/compiler/testlibrary/CompilerUtils.java b/hotspot/test/compiler/testlibrary/CompilerUtils.java index 3af7e76c5d3..55871ad2b46 100644 --- a/hotspot/test/compiler/testlibrary/CompilerUtils.java +++ b/hotspot/test/compiler/testlibrary/CompilerUtils.java @@ -25,9 +25,10 @@ package compiler.testlibrary; import jdk.test.lib.Asserts; import jdk.test.lib.Platform; -import java.util.stream.IntStream; import sun.hotspot.WhiteBox; +import java.util.stream.IntStream; + public class CompilerUtils { private CompilerUtils() { diff --git a/hotspot/test/compiler/testlibrary/rtm/AbortProvoker.java b/hotspot/test/compiler/testlibrary/rtm/AbortProvoker.java index c7ae7f48b9c..37b7ff67b43 100644 --- a/hotspot/test/compiler/testlibrary/rtm/AbortProvoker.java +++ b/hotspot/test/compiler/testlibrary/rtm/AbortProvoker.java @@ -24,13 +24,13 @@ package compiler.testlibrary.rtm; +import jdk.test.lib.Asserts; +import sun.hotspot.WhiteBox; + import java.util.Objects; import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.CyclicBarrier; -import jdk.test.lib.Asserts; -import sun.hotspot.WhiteBox; - /** * Base class for different transactional execution abortion * provokers aimed to force abort due to specified reason. diff --git a/hotspot/test/compiler/testlibrary/rtm/RTMLockingStatistics.java b/hotspot/test/compiler/testlibrary/rtm/RTMLockingStatistics.java index bf8598da1ed..a5584920e93 100644 --- a/hotspot/test/compiler/testlibrary/rtm/RTMLockingStatistics.java +++ b/hotspot/test/compiler/testlibrary/rtm/RTMLockingStatistics.java @@ -28,8 +28,8 @@ import java.util.EnumMap; import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.regex.Pattern; import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Wrapper for +UsePreciseRTMLockingStatistics output. diff --git a/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java b/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java index f608d00c163..65cbf0a65d7 100644 --- a/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java +++ b/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java @@ -24,21 +24,21 @@ package compiler.testlibrary.rtm; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import java.util.LinkedList; -import java.util.Arrays; -import java.util.Collections; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.ProcessTools; import jdk.test.lib.Utils; import jdk.test.lib.cli.CommandLineOptionTest; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + /** * Auxiliary methods used for RTM testing. */ diff --git a/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java b/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java index 6bab4cd6d36..b7891eecad5 100644 --- a/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java +++ b/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java @@ -24,8 +24,8 @@ package compiler.testlibrary.rtm; -import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; +import jdk.test.lib.Utils; /** * Current RTM locking implementation force transaction abort diff --git a/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java b/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java index 8796d79f4d0..d634727691c 100644 --- a/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java +++ b/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java @@ -24,12 +24,11 @@ package compiler.testlibrary.rtm.predicate; +import jdk.test.lib.Platform; import sun.hotspot.cpuinfo.CPUInfo; import java.util.function.BooleanSupplier; -import jdk.test.lib.Platform; - public class SupportedCPU implements BooleanSupplier { @Override public boolean getAsBoolean() { diff --git a/hotspot/test/compiler/testlibrary/uncommontrap/Verifier.java b/hotspot/test/compiler/testlibrary/uncommontrap/Verifier.java index c22db58e2a4..31ccc34b744 100644 --- a/hotspot/test/compiler/testlibrary/uncommontrap/Verifier.java +++ b/hotspot/test/compiler/testlibrary/uncommontrap/Verifier.java @@ -23,6 +23,8 @@ package compiler.testlibrary.uncommontrap; +import jdk.test.lib.Asserts; + import java.io.FileReader; import java.io.IOException; import java.nio.file.Files; @@ -33,8 +35,6 @@ import java.util.List; import java.util.Properties; import java.util.regex.Pattern; -import jdk.test.lib.Asserts; - /** * Utility tool aimed to verify presence or absence of specified uncommon trap * in compilation log. diff --git a/hotspot/test/compiler/tiered/CompLevelsTest.java b/hotspot/test/compiler/tiered/CompLevelsTest.java index 3aa5ba1d627..a084110e800 100644 --- a/hotspot/test/compiler/tiered/CompLevelsTest.java +++ b/hotspot/test/compiler/tiered/CompLevelsTest.java @@ -27,6 +27,8 @@ * @author igor.ignatyev@oracle.com */ +package compiler.tiered; + import compiler.whitebox.CompilerWhiteBoxTest; public abstract class CompLevelsTest extends CompilerWhiteBoxTest { diff --git a/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java b/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java index 4c6e972e0c2..6393f5c9268 100644 --- a/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java +++ b/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java @@ -23,21 +23,27 @@ /** * @test ConstantGettersTransitionsTest + * @summary Test the correctness of compilation level transitions for constant getters methods * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build TransitionsTestExecutor ConstantGettersTransitionsTest + * + * @build compiler.tiered.TransitionsTestExecutor + * compiler.tiered.ConstantGettersTransitionsTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:+TieredCompilation -XX:-UseCounterDecay - * -XX:CompileCommand=compileonly,ConstantGettersTestCase$TrivialMethods::* - * TransitionsTestExecutor ConstantGettersTransitionsTest - * @summary Test the correctness of compilation level transitions for constant getters methods + * -XX:+WhiteBoxAPI -XX:+TieredCompilation -XX:-UseCounterDecay + * -XX:CompileCommand=compileonly,compiler.tiered.ConstantGettersTransitionsTest$ConstantGettersTestCase$TrivialMethods::* + * compiler.tiered.TransitionsTestExecutor + * compiler.tiered.ConstantGettersTransitionsTest */ +package compiler.tiered; + +import compiler.whitebox.CompilerWhiteBoxTest; + import java.lang.reflect.Executable; import java.util.concurrent.Callable; -import compiler.whitebox.CompilerWhiteBoxTest; public class ConstantGettersTransitionsTest extends LevelTransitionTest { public static void main(String[] args) { @@ -57,141 +63,141 @@ public class ConstantGettersTransitionsTest extends LevelTransitionTest { private ConstantGettersTransitionsTest(TestCase testCase) { super(testCase); } -} -enum ConstantGettersTestCase implements CompilerWhiteBoxTest.TestCase { - ICONST_M1, - ICONST_0, - ICONST_1, - ICONST_2, - ICONST_3, - ICONST_4, - ICONST_5, - LCONST_0, - LCONST_1, - FCONST_0, - FCONST_1, - FCONST_2, - DCONST_0, - DCONST_1, - DCONST_W, - BYTE, - SHORT, - CHAR; + private static enum ConstantGettersTestCase implements CompilerWhiteBoxTest.TestCase { + ICONST_M1, + ICONST_0, + ICONST_1, + ICONST_2, + ICONST_3, + ICONST_4, + ICONST_5, + LCONST_0, + LCONST_1, + FCONST_0, + FCONST_1, + FCONST_2, + DCONST_0, + DCONST_1, + DCONST_W, + BYTE, + SHORT, + CHAR; - private final Executable executable; - private final Callable callable; + private final Executable executable; + private final Callable callable; - @Override - public Executable getExecutable() { - return executable; - } - - @Override - public Callable getCallable() { - return callable; - } - - @Override - public boolean isOsr() { - return false; - } - - private ConstantGettersTestCase() { - String name = "make" + this.name(); - this.executable = LevelTransitionTest.Helper.getMethod(TrivialMethods.class, name); - this.callable = LevelTransitionTest.Helper.getCallable(new TrivialMethods(), name); - } - - /** - * Contains methods that load constants with certain types of bytecodes - * See JVMS 2.11.2. Load and Store Instructions - * Note that it doesn't have a method for ldc_w instruction - */ - private static class TrivialMethods { - public static int makeICONST_M1() { - return -1; + @Override + public Executable getExecutable() { + return executable; } - public static int makeICONST_0() { - return 0; + @Override + public Callable getCallable() { + return callable; } - public static int makeICONST_1() { - return 1; + @Override + public boolean isOsr() { + return false; } - public static int makeICONST_2() { - return 2; + private ConstantGettersTestCase() { + String name = "make" + this.name(); + this.executable = LevelTransitionTest.Helper.getMethod(TrivialMethods.class, name); + this.callable = LevelTransitionTest.Helper.getCallable(new TrivialMethods(), name); } - public static int makeICONST_3() { - return 3; - } + /** + * Contains methods that load constants with certain types of bytecodes + * See JVMS 2.11.2. Load and Store Instructions + * Note that it doesn't have a method for ldc_w instruction + */ + private static class TrivialMethods { + public static int makeICONST_M1() { + return -1; + } - public static int makeICONST_4() { - return 4; - } + public static int makeICONST_0() { + return 0; + } - public static int makeICONST_5() { - return 5; - } + public static int makeICONST_1() { + return 1; + } - public static long makeLCONST_0() { - return 0L; - } + public static int makeICONST_2() { + return 2; + } - public static long makeLCONST_1() { - return 1L; - } + public static int makeICONST_3() { + return 3; + } - public static float makeFCONST_0() { - return 0F; - } + public static int makeICONST_4() { + return 4; + } - public static float makeFCONST_1() { - return 1F; - } + public static int makeICONST_5() { + return 5; + } - public static float makeFCONST_2() { - return 2F; - } + public static long makeLCONST_0() { + return 0L; + } - public static double makeDCONST_0() { - return 0D; - } + public static long makeLCONST_1() { + return 1L; + } - public static double makeDCONST_1() { - return 1D; - } + public static float makeFCONST_0() { + return 0F; + } - public static double makeDCONST_W() { - // ldc2_w - return Double.MAX_VALUE; - } + public static float makeFCONST_1() { + return 1F; + } - public static Object makeOBJECT() { - // aconst_null - return null; - } + public static float makeFCONST_2() { + return 2F; + } - public static byte makeBYTE() { - // bipush - return (byte) 0x7F; - } + public static double makeDCONST_0() { + return 0D; + } - public static short makeSHORT() { - // sipush - return (short) 0x7FFF; - } + public static double makeDCONST_1() { + return 1D; + } - public static char makeCHAR() { - // ldc - return (char) 0xFFFF; - } + public static double makeDCONST_W() { + // ldc2_w + return Double.MAX_VALUE; + } - public static boolean makeBOOLEAN() { - return true; + public static Object makeOBJECT() { + // aconst_null + return null; + } + + public static byte makeBYTE() { + // bipush + return (byte) 0x7F; + } + + public static short makeSHORT() { + // sipush + return (short) 0x7FFF; + } + + public static char makeCHAR() { + // ldc + return (char) 0xFFFF; + } + + public static boolean makeBOOLEAN() { + return true; + } } } -} +} \ No newline at end of file diff --git a/hotspot/test/compiler/tiered/LevelTransitionTest.java b/hotspot/test/compiler/tiered/LevelTransitionTest.java index 01220a2e5a2..d49d995ef33 100644 --- a/hotspot/test/compiler/tiered/LevelTransitionTest.java +++ b/hotspot/test/compiler/tiered/LevelTransitionTest.java @@ -23,29 +23,37 @@ /** * @test LevelTransitionTest + * @summary Test the correctness of compilation level transitions for different methods * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management + * * @ignore 8067651 - * @build TransitionsTestExecutor LevelTransitionTest - * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission + * @build compiler.tiered.TransitionsTestExecutor compiler.tiered.LevelTransitionTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:+TieredCompilation + * -XX:+WhiteBoxAPI -XX:+TieredCompilation -XX:-UseCounterDecay * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* - * -XX:CompileCommand=compileonly,ExtendedTestCase$CompileMethodHolder::* - * TransitionsTestExecutor LevelTransitionTest - * @summary Test the correctness of compilation level transitions for different methods + * -XX:CompileCommand=compileonly,compiler.tiered.LevelTransitionTest$ExtendedTestCase$CompileMethodHolder::* + * compiler.tiered.TransitionsTestExecutor + * compiler.tiered.LevelTransitionTest */ +package compiler.tiered; + +import compiler.whitebox.CompilerWhiteBoxTest; +import compiler.whitebox.SimpleTestCase; + import java.lang.reflect.Executable; import java.lang.reflect.Method; import java.util.Objects; import java.util.concurrent.Callable; -import compiler.whitebox.CompilerWhiteBoxTest; -import compiler.whitebox.SimpleTestCase; public class LevelTransitionTest extends TieredLevelsTest { - /** Shows if method was profiled by being executed on levels 2 or 3 */ + /** + * Shows if method was profiled by being executed on levels 2 or 3 + */ protected boolean isMethodProfiled; private int transitionCount; @@ -103,7 +111,8 @@ public class LevelTransitionTest extends TieredLevelsTest { System.out.printf("Method %s is compiled on level %d. Expected level is %d%n", method, newLevel, expected); checkLevel(expected, newLevel); printInfo(); - }; + } + ; } /** @@ -195,59 +204,66 @@ public class LevelTransitionTest extends TieredLevelsTest { }; } } -} -enum ExtendedTestCase implements CompilerWhiteBoxTest.TestCase { - ACCESSOR_TEST("accessor"), - NONTRIVIAL_METHOD_TEST("nonTrivialMethod"), - TRIVIAL_CODE_TEST("trivialCode"); + private static enum ExtendedTestCase implements CompilerWhiteBoxTest.TestCase { + ACCESSOR_TEST("accessor"), + NONTRIVIAL_METHOD_TEST("nonTrivialMethod"), + TRIVIAL_CODE_TEST("trivialCode"); - private final Executable executable; - private final Callable callable; + private final Executable executable; + private final Callable callable; - @Override - public Executable getExecutable() { - return executable; - } + @Override + public Executable getExecutable() { + return executable; + } - @Override - public Callable getCallable() { - return callable; - } + @Override + public Callable getCallable() { + return callable; + } - @Override - public boolean isOsr() { - return false; - } + @Override + public boolean isOsr() { + return false; + } - private ExtendedTestCase(String methodName) { - this.executable = LevelTransitionTest.Helper.getMethod(CompileMethodHolder.class, methodName); - this.callable = LevelTransitionTest.Helper.getCallable(new CompileMethodHolder(), methodName); - } + private ExtendedTestCase(String methodName) { + this.executable = LevelTransitionTest.Helper.getMethod(CompileMethodHolder.class, methodName); + this.callable = LevelTransitionTest.Helper.getCallable(new CompileMethodHolder(), methodName); + } - private static class CompileMethodHolder { - private final int iter = 10; - private int field = 42; + private static class CompileMethodHolder { + private final int iter = 10; + private int field = 42; - /** Non-trivial method for threshold policy: contains loops */ - public int nonTrivialMethod() { - int acc = 0; - for (int i = 0; i < iter; i++) { - acc += i; + /** + * Non-trivial method for threshold policy: contains loops + */ + public int nonTrivialMethod() { + int acc = 0; + for (int i = 0; i < iter; i++) { + acc += i; + } + return acc; } - return acc; - } - /** Field accessor method */ - public int accessor() { - return field; - } + /** + * Field accessor method + */ + public int accessor() { + return field; + } - /** Method considered as trivial by amount of code */ - public int trivialCode() { - int var = 0xBAAD_C0DE; - var *= field; - return var; + /** + * Method considered as trivial by amount of code + */ + public int trivialCode() { + int var = 0xBAAD_C0DE; + var *= field; + return var; + } } } -} + +} \ No newline at end of file diff --git a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java index 9c471c69618..c3461924928 100644 --- a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java +++ b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java @@ -23,21 +23,22 @@ /** * @test NonTieredLevelsTest + * @summary Verify that only one level can be used * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc - * @modules java.management + * java.management * @ignore 8157984 - * @build NonTieredLevelsTest + * @build compiler.tiered.NonTieredLevelsTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:-TieredCompilation * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* - * NonTieredLevelsTest - * @summary Verify that only one level can be used - * @author igor.ignatyev@oracle.com + * compiler.tiered.NonTieredLevelsTest */ +package compiler.tiered; + import java.util.function.IntPredicate; import compiler.whitebox.CompilerWhiteBoxTest; diff --git a/hotspot/test/compiler/tiered/TieredLevelsTest.java b/hotspot/test/compiler/tiered/TieredLevelsTest.java index 2f36bd54713..768022ba3a0 100644 --- a/hotspot/test/compiler/tiered/TieredLevelsTest.java +++ b/hotspot/test/compiler/tiered/TieredLevelsTest.java @@ -23,24 +23,26 @@ /** * @test TieredLevelsTest + * @summary Verify that all levels < 'TieredStopAtLevel' can be used * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc - * @modules java.management - * @build TieredLevelsTest + * java.management + * + * @build compiler.tiered.TieredLevelsTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* - * TieredLevelsTest - * @summary Verify that all levels < 'TieredStopAtLevel' can be used - * @author igor.ignatyev@oracle.com + * compiler.tiered.TieredLevelsTest */ +package compiler.tiered; + import compiler.whitebox.CompilerWhiteBoxTest; public class TieredLevelsTest extends CompLevelsTest { - public static void main(String[] args) throws Exception, Throwable { + public static void main(String[] args) throws Throwable { if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) { return; } diff --git a/hotspot/test/compiler/tiered/TransitionsTestExecutor.java b/hotspot/test/compiler/tiered/TransitionsTestExecutor.java index 630bac2b79a..832678bd862 100644 --- a/hotspot/test/compiler/tiered/TransitionsTestExecutor.java +++ b/hotspot/test/compiler/tiered/TransitionsTestExecutor.java @@ -21,6 +21,9 @@ * questions. */ +package compiler.tiered; + +import compiler.whitebox.CompilerWhiteBoxTest; import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.ProcessTools; @@ -29,7 +32,6 @@ import java.lang.management.RuntimeMXBean; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import compiler.whitebox.CompilerWhiteBoxTest; /** * Executes given test in a separate VM with enabled Tiered Compilation for @@ -59,9 +61,6 @@ public class TransitionsTestExecutor { Collections.addAll(args, policy, testName); OutputAnalyzer out = ProcessTools.executeTestJvm(args.toArray(new String[args.size()])); - int exitCode = out.getExitValue(); - if (exitCode != 0) { - throw new Error("Test execution failed with exit code " + exitCode); - } + out.shouldHaveExitValue(0); } } diff --git a/hotspot/test/compiler/types/TestMeetExactConstantArrays.java b/hotspot/test/compiler/types/TestMeetExactConstantArrays.java index 951288ec21e..1016d1b276e 100644 --- a/hotspot/test/compiler/types/TestMeetExactConstantArrays.java +++ b/hotspot/test/compiler/types/TestMeetExactConstantArrays.java @@ -25,10 +25,12 @@ * @test * @bug 8075587 * @summary meet of 2 constant arrays result in bottom - * @run main/othervm TestMeetExactConstantArrays * + * @run main/othervm compiler.types.TestMeetExactConstantArrays */ +package compiler.types; + public class TestMeetExactConstantArrays { public abstract static class NumbersHolder { public Number[] getNumbers() { diff --git a/hotspot/test/compiler/types/TestMeetIncompatibleInterfaceArrays.java b/hotspot/test/compiler/types/TestMeetIncompatibleInterfaceArrays.java index 9769afccc81..a5cf25d090b 100644 --- a/hotspot/test/compiler/types/TestMeetIncompatibleInterfaceArrays.java +++ b/hotspot/test/compiler/types/TestMeetIncompatibleInterfaceArrays.java @@ -28,9 +28,10 @@ * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.misc * @library /testlibrary /test/lib + * * @build sun.hotspot.WhiteBox - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm * -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions @@ -41,10 +42,10 @@ * -XX:CICompilerCount=1 * -XX:+PrintCompilation * -XX:+PrintInlining - * -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*.run - * -XX:CompileCommand=dontinline,TestMeetIncompatibleInterfaceArrays$Helper.createI2* + * -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*::run + * -XX:CompileCommand=dontinline,compiler.types.TestMeetIncompatibleInterfaceArrays$Helper::createI2* * -XX:CompileCommand=quiet - * TestMeetIncompatibleInterfaceArrays 0 + * compiler.types.TestMeetIncompatibleInterfaceArrays 0 * @run main/othervm * -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions @@ -55,10 +56,10 @@ * -XX:CICompilerCount=1 * -XX:+PrintCompilation * -XX:+PrintInlining - * -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*.run - * -XX:CompileCommand=inline,TestMeetIncompatibleInterfaceArrays$Helper.createI2* + * -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*::run + * -XX:CompileCommand=inline,compiler.types.TestMeetIncompatibleInterfaceArrays$Helper::createI2* * -XX:CompileCommand=quiet - * TestMeetIncompatibleInterfaceArrays 1 + * compiler.types.TestMeetIncompatibleInterfaceArrays 1 * @run main/othervm * -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions @@ -72,22 +73,39 @@ * -XX:CICompilerCount=2 * -XX:+PrintCompilation * -XX:+PrintInlining - * -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*.run - * -XX:CompileCommand=compileonly,TestMeetIncompatibleInterfaceArrays$Helper.createI2* - * -XX:CompileCommand=inline,TestMeetIncompatibleInterfaceArrays$Helper.createI2* + * -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*::run + * -XX:CompileCommand=compileonly,compiler.types.TestMeetIncompatibleInterfaceArrays$Helper::createI2* + * -XX:CompileCommand=inline,compiler.types.TestMeetIncompatibleInterfaceArrays$Helper::createI2* * -XX:CompileCommand=quiet - * TestMeetIncompatibleInterfaceArrays 2 + * compiler.types.TestMeetIncompatibleInterfaceArrays 2 * * @author volker.simonis@gmail.com */ +package compiler.types; + +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.MethodVisitor; +import sun.hotspot.WhiteBox; + import java.io.FileOutputStream; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import jdk.internal.org.objectweb.asm.ClassWriter; -import jdk.internal.org.objectweb.asm.MethodVisitor; -import static jdk.internal.org.objectweb.asm.Opcodes.*; -import sun.hotspot.WhiteBox; + +import static jdk.internal.org.objectweb.asm.Opcodes.AALOAD; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC; +import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD; +import static jdk.internal.org.objectweb.asm.Opcodes.ARETURN; +import static jdk.internal.org.objectweb.asm.Opcodes.ASTORE; +import static jdk.internal.org.objectweb.asm.Opcodes.GETSTATIC; +import static jdk.internal.org.objectweb.asm.Opcodes.ICONST_0; +import static jdk.internal.org.objectweb.asm.Opcodes.INVOKEINTERFACE; +import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESPECIAL; +import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESTATIC; +import static jdk.internal.org.objectweb.asm.Opcodes.INVOKEVIRTUAL; +import static jdk.internal.org.objectweb.asm.Opcodes.RETURN; +import static jdk.internal.org.objectweb.asm.Opcodes.V1_8; public class TestMeetIncompatibleInterfaceArrays extends ClassLoader { @@ -245,14 +263,14 @@ public class TestMeetIncompatibleInterfaceArrays extends ClassLoader { constr.visitMaxs(0, 0); constr.visitEnd(); MethodVisitor run = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "run", - "()" + a + "LTestMeetIncompatibleInterfaceArrays$I1;", null, null); + "()" + a + "Lcompiler/types/TestMeetIncompatibleInterfaceArrays$I1;", null, null); run.visitCode(); if (dim == 4) { - run.visitMethodInsn(INVOKESTATIC, "TestMeetIncompatibleInterfaceArrays$Helper", createName + 3, - "()" + "[[[" + "LTestMeetIncompatibleInterfaceArrays$I2;", false); + run.visitMethodInsn(INVOKESTATIC, "compiler/types/TestMeetIncompatibleInterfaceArrays$Helper", createName + 3, + "()" + "[[[" + "Lcompiler/types/TestMeetIncompatibleInterfaceArrays$I2;", false); } else { - run.visitMethodInsn(INVOKESTATIC, "TestMeetIncompatibleInterfaceArrays$Helper", createName + dim, - "()" + a + "LTestMeetIncompatibleInterfaceArrays$I2;", false); + run.visitMethodInsn(INVOKESTATIC, "compiler/types/TestMeetIncompatibleInterfaceArrays$Helper", createName + dim, + "()" + a + "Lcompiler/types/TestMeetIncompatibleInterfaceArrays$I2;", false); } run.visitInsn(ARETURN); run.visitMaxs(0, 0); @@ -260,7 +278,7 @@ public class TestMeetIncompatibleInterfaceArrays extends ClassLoader { MethodVisitor test = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "test", "()V", null, null); test.visitCode(); test.visitMethodInsn(INVOKESTATIC, baseClassName + dim + "ASM", "run", - "()" + a + "LTestMeetIncompatibleInterfaceArrays$I1;", false); + "()" + a + "Lcompiler/types/TestMeetIncompatibleInterfaceArrays$I1;", false); test.visitVarInsn(ASTORE, 0); if (dim > 0) { test.visitVarInsn(ALOAD, 0); @@ -272,7 +290,7 @@ public class TestMeetIncompatibleInterfaceArrays extends ClassLoader { } test.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); test.visitVarInsn(ALOAD, dim > 0 ? 1 : 0); - test.visitMethodInsn(INVOKEINTERFACE, "TestMeetIncompatibleInterfaceArrays$I1", "getName", + test.visitMethodInsn(INVOKEINTERFACE, "compiler/types/TestMeetIncompatibleInterfaceArrays$I1", "getName", "()Ljava/lang/String;", true); test.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/Object;)V", false); test.visitInsn(RETURN); @@ -296,9 +314,9 @@ public class TestMeetIncompatibleInterfaceArrays extends ClassLoader { final int pass = Integer.parseInt(args.length > 0 ? args[0] : "0"); // Load and initialize some classes required for compilation - Class.forName("TestMeetIncompatibleInterfaceArrays$I1"); - Class.forName("TestMeetIncompatibleInterfaceArrays$I2"); - Class.forName("TestMeetIncompatibleInterfaceArrays$Helper"); + Class.forName("compiler.types.TestMeetIncompatibleInterfaceArrays$I1"); + Class.forName("compiler.types.TestMeetIncompatibleInterfaceArrays$I2"); + Class.forName("compiler.types.TestMeetIncompatibleInterfaceArrays$Helper"); for (int g = 0; g < 2; g++) { String baseClassName = "MeetIncompatibleInterfaceArrays"; diff --git a/hotspot/test/compiler/types/TestMeetTopArrayExactConstantArray.java b/hotspot/test/compiler/types/TestMeetTopArrayExactConstantArray.java index 4ec6e7b03af..73234b48203 100644 --- a/hotspot/test/compiler/types/TestMeetTopArrayExactConstantArray.java +++ b/hotspot/test/compiler/types/TestMeetTopArrayExactConstantArray.java @@ -25,10 +25,15 @@ * @test * @bug 8027571 * @summary meet of TopPTR exact array with constant array is not symmetric - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation -XX:-BackgroundCompilation TestMeetTopArrayExactConstantArray * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement + * -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation + * -XX:-BackgroundCompilation + * compiler.types.TestMeetTopArrayExactConstantArray */ +package compiler.types; + public class TestMeetTopArrayExactConstantArray { static class A { diff --git a/hotspot/test/compiler/types/TestPhiElimination.java b/hotspot/test/compiler/types/TestPhiElimination.java index 5029b99ee77..d6e89586a16 100644 --- a/hotspot/test/compiler/types/TestPhiElimination.java +++ b/hotspot/test/compiler/types/TestPhiElimination.java @@ -26,8 +26,13 @@ * @test * @bug 8150804 * @summary Tests elimination of Phi nodes without losing type information. - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestPhiElimination + * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.types.TestPhiElimination */ + +package compiler.types; + public class TestPhiElimination { /* A::get() is inlined into test(obj) producing the following graph: @@ -90,23 +95,20 @@ public class TestPhiElimination { } } -} + static class A extends TestPhiElimination { + public Object f; -class A extends TestPhiElimination { - public Object f; - - public A create() { - return new A(); - } - - public synchronized Object get() { - if (f == null) { - f = create(); + public A create() { + return new A(); + } + + public synchronized Object get() { + if (f == null) { + f = create(); + } + return f; } - return f; } -} - -class B extends A { + static class B extends A { } } diff --git a/hotspot/test/compiler/types/TestSpeculationFailedHigherEqual.java b/hotspot/test/compiler/types/TestSpeculationFailedHigherEqual.java index 70d5566ad33..323edd95c5e 100644 --- a/hotspot/test/compiler/types/TestSpeculationFailedHigherEqual.java +++ b/hotspot/test/compiler/types/TestSpeculationFailedHigherEqual.java @@ -25,10 +25,14 @@ * @test * @bug 8027422 * @summary type methods shouldn't always operate on speculative part - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation -XX:-BackgroundCompilation TestSpeculationFailedHigherEqual * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:TypeProfileLevel=222 + * -XX:+UseTypeSpeculation -XX:-BackgroundCompilation + * compiler.types.TestSpeculationFailedHigherEqual */ +package compiler.types; + public class TestSpeculationFailedHigherEqual { static class A { diff --git a/hotspot/test/compiler/types/TestTypePropagationToCmpU.java b/hotspot/test/compiler/types/TestTypePropagationToCmpU.java index 9e08a8b4cf0..abc0ab24899 100644 --- a/hotspot/test/compiler/types/TestTypePropagationToCmpU.java +++ b/hotspot/test/compiler/types/TestTypePropagationToCmpU.java @@ -25,8 +25,12 @@ * @test * @bug 8080156 8060036 * @summary Test correctness of type propagation to CmpUNodes. - * @run main TestTypePropagationToCmpU + * + * @run main compiler.types.TestTypePropagationToCmpU */ + +package compiler.types; + public class TestTypePropagationToCmpU { public static void main(String[] args) { try { diff --git a/hotspot/test/compiler/types/TypeSpeculation.java b/hotspot/test/compiler/types/TypeSpeculation.java index 6f146b84ede..4bc53ace9b3 100644 --- a/hotspot/test/compiler/types/TypeSpeculation.java +++ b/hotspot/test/compiler/types/TypeSpeculation.java @@ -25,10 +25,15 @@ * @test * @bug 8024070 * @summary Test that type speculation doesn't cause incorrect execution - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation TypeSpeculation * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement + * -XX:-BackgroundCompilation -XX:TypeProfileLevel=222 + * -XX:+UseTypeSpeculation + * compiler.types.TypeSpeculation */ +package compiler.types; + public class TypeSpeculation { interface I { diff --git a/hotspot/test/compiler/types/correctness/CorrectnessTest.java b/hotspot/test/compiler/types/correctness/CorrectnessTest.java index 7add6555e4b..832e71cf265 100644 --- a/hotspot/test/compiler/types/correctness/CorrectnessTest.java +++ b/hotspot/test/compiler/types/correctness/CorrectnessTest.java @@ -24,47 +24,60 @@ /* * @test CorrectnessTest * @bug 8038418 - * @library /testlibrary /test/lib + * @summary Tests correctness of type usage with type profiling and speculations + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management * @ignore 8066173 - * @compile execution/TypeConflict.java execution/TypeProfile.java - * execution/MethodHandleDelegate.java - * @build CorrectnessTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @build compiler.types.correctness.CorrectnessTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation - * -XX:CompileCommand=exclude,execution/*::methodNotToCompile - * -XX:CompileCommand=dontinline,scenarios/Scenario::collectReturnType - * CorrectnessTest RETURN + * -XX:CompileCommand=exclude,compiler.types.correctness.execution.*::methodNotToCompile + * -XX:CompileCommand=dontinline,compiler.types.correctness.scenarios.Scenario::collectReturnType + * compiler.types.correctness.CorrectnessTest RETURN * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation - * -XX:CompileCommand=exclude,execution/*::methodNotToCompile - * -XX:CompileCommand=dontinline,scenarios/Scenario::collectReturnType - * CorrectnessTest PARAMETERS + * -XX:CompileCommand=exclude,compiler.types.correctness.execution.*::methodNotToCompile + * -XX:CompileCommand=dontinline,compiler.types.correctness.scenarios.Scenario::collectReturnType + * compiler.types.correctness.CorrectnessTest PARAMETERS * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation - * -XX:CompileCommand=exclude,execution/*::methodNotToCompile - * -XX:CompileCommand=dontinline,scenarios/Scenario::collectReturnType - * CorrectnessTest ARGUMENTS - * @summary Tests correctness of type usage with type profiling and speculations + * -XX:CompileCommand=exclude,compiler.types.correctness.execution.*::methodNotToCompile + * -XX:CompileCommand=dontinline,compiler.types.correctness.scenarios.Scenario::collectReturnType + * compiler.types.correctness.CorrectnessTest ARGUMENTS */ +package compiler.types.correctness; + +import compiler.types.correctness.execution.Execution; +import compiler.types.correctness.execution.MethodHandleDelegate; +import compiler.types.correctness.execution.TypeConflict; +import compiler.types.correctness.execution.TypeProfile; +import compiler.types.correctness.hierarchies.DefaultMethodInterface; +import compiler.types.correctness.hierarchies.DefaultMethodInterface2; +import compiler.types.correctness.hierarchies.Linear; +import compiler.types.correctness.hierarchies.Linear2; +import compiler.types.correctness.hierarchies.NullableType; +import compiler.types.correctness.hierarchies.OneRank; +import compiler.types.correctness.hierarchies.TypeHierarchy; +import compiler.types.correctness.scenarios.ArrayCopy; +import compiler.types.correctness.scenarios.ArrayReferenceStore; +import compiler.types.correctness.scenarios.CheckCast; +import compiler.types.correctness.scenarios.ClassIdentity; +import compiler.types.correctness.scenarios.ClassInstanceOf; +import compiler.types.correctness.scenarios.ClassIsInstance; +import compiler.types.correctness.scenarios.ProfilingType; +import compiler.types.correctness.scenarios.ReceiverAtInvokes; +import compiler.types.correctness.scenarios.Scenario; import jdk.test.lib.Asserts; import jdk.test.lib.Platform; -import execution.Execution; -import execution.MethodHandleDelegate; -import execution.TypeConflict; -import execution.TypeProfile; -import hierarchies.*; -import scenarios.*; import sun.hotspot.WhiteBox; -import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; diff --git a/hotspot/test/compiler/types/correctness/OffTest.java b/hotspot/test/compiler/types/correctness/OffTest.java index ecab6e8a6e1..ad623fe2cb5 100644 --- a/hotspot/test/compiler/types/correctness/OffTest.java +++ b/hotspot/test/compiler/types/correctness/OffTest.java @@ -24,24 +24,25 @@ /* * @test CorrectnessTest * @bug 8038418 - * @library /testlibrary /test/lib + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management + * * @ignore 8066173 - * @compile execution/TypeConflict.java execution/TypeProfile.java - * execution/MethodHandleDelegate.java - * @build CorrectnessTest - * @build OffTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/timeout=1200 OffTest + * @build compiler.types.correctness.OffTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/timeout=1200 compiler.types.correctness.OffTest */ +package compiler.types.correctness; + +import compiler.types.correctness.scenarios.ProfilingType; import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.ProcessTools; import jdk.test.lib.Utils; + import java.util.Random; -import scenarios.ProfilingType; public class OffTest { private static final String[] OPTIONS = { @@ -50,8 +51,8 @@ public class OffTest { "-XX:+UnlockExperimentalVMOptions", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", - "-XX:CompileCommand=exclude,execution/*::methodNotToCompile", - "-XX:CompileCommand=dontinline,scenarios/Scenario::collectReturnType", + "-XX:CompileCommand=exclude,compiler.types.correctness.execution.*::methodNotToCompile", + "-XX:CompileCommand=dontinline,compiler.types.correctness.scenarios.Scenario::collectReturnType", "", // -XX:TypeProfileLevel=? "", // -XX:?UseTypeSpeculation CorrectnessTest.class.getName(), diff --git a/hotspot/test/compiler/types/correctness/execution/Execution.java b/hotspot/test/compiler/types/correctness/execution/Execution.java index f0b1949f889..f8b52bb5098 100644 --- a/hotspot/test/compiler/types/correctness/execution/Execution.java +++ b/hotspot/test/compiler/types/correctness/execution/Execution.java @@ -20,10 +20,10 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package execution; +package compiler.types.correctness.execution; -import hierarchies.TypeHierarchy; -import scenarios.Scenario; +import compiler.types.correctness.hierarchies.TypeHierarchy; +import compiler.types.correctness.scenarios.Scenario; /** * Execution scenario represents test methods execution type. @@ -33,7 +33,7 @@ import scenarios.Scenario; public interface Execution { /** * Executes the test code of the given scenario - * See {@link scenarios.Scenario#run(T)} + * See {@link Scenario#run(T)} * * @param scenario test scenario */ diff --git a/hotspot/test/compiler/types/correctness/execution/MethodHandleDelegate.java b/hotspot/test/compiler/types/correctness/execution/MethodHandleDelegate.java index d067449335c..ca61ed14ab3 100644 --- a/hotspot/test/compiler/types/correctness/execution/MethodHandleDelegate.java +++ b/hotspot/test/compiler/types/correctness/execution/MethodHandleDelegate.java @@ -21,10 +21,10 @@ * questions. */ -package execution; +package compiler.types.correctness.execution; -import hierarchies.TypeHierarchy; -import scenarios.Scenario; +import compiler.types.correctness.hierarchies.TypeHierarchy; +import compiler.types.correctness.scenarios.Scenario; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; diff --git a/hotspot/test/compiler/types/correctness/execution/TypeConflict.java b/hotspot/test/compiler/types/correctness/execution/TypeConflict.java index a17150484e7..69f779dd6c9 100644 --- a/hotspot/test/compiler/types/correctness/execution/TypeConflict.java +++ b/hotspot/test/compiler/types/correctness/execution/TypeConflict.java @@ -21,10 +21,10 @@ * questions. */ -package execution; +package compiler.types.correctness.execution; -import hierarchies.TypeHierarchy; -import scenarios.Scenario; +import compiler.types.correctness.hierarchies.TypeHierarchy; +import compiler.types.correctness.scenarios.Scenario; /** * Type profiling conflict execution scenario. The main goal is diff --git a/hotspot/test/compiler/types/correctness/execution/TypeProfile.java b/hotspot/test/compiler/types/correctness/execution/TypeProfile.java index 446fdb8fe1b..69f75bbaef6 100644 --- a/hotspot/test/compiler/types/correctness/execution/TypeProfile.java +++ b/hotspot/test/compiler/types/correctness/execution/TypeProfile.java @@ -21,10 +21,10 @@ * questions. */ -package execution; +package compiler.types.correctness.execution; -import hierarchies.TypeHierarchy; -import scenarios.Scenario; +import compiler.types.correctness.hierarchies.TypeHierarchy; +import compiler.types.correctness.scenarios.Scenario; /** * Profile type execution scenario. Executes tester method diff --git a/hotspot/test/compiler/types/correctness/hierarchies/DefaultMethodInterface.java b/hotspot/test/compiler/types/correctness/hierarchies/DefaultMethodInterface.java index bad66a0edc0..f46a0e893f3 100644 --- a/hotspot/test/compiler/types/correctness/hierarchies/DefaultMethodInterface.java +++ b/hotspot/test/compiler/types/correctness/hierarchies/DefaultMethodInterface.java @@ -21,7 +21,7 @@ * questions. */ -package hierarchies; +package compiler.types.correctness.hierarchies; public class DefaultMethodInterface { private DefaultMethodInterface() { diff --git a/hotspot/test/compiler/types/correctness/hierarchies/DefaultMethodInterface2.java b/hotspot/test/compiler/types/correctness/hierarchies/DefaultMethodInterface2.java index 05c0ded0068..df32685a239 100644 --- a/hotspot/test/compiler/types/correctness/hierarchies/DefaultMethodInterface2.java +++ b/hotspot/test/compiler/types/correctness/hierarchies/DefaultMethodInterface2.java @@ -21,7 +21,7 @@ * questions. */ -package hierarchies; +package compiler.types.correctness.hierarchies; public class DefaultMethodInterface2 { private DefaultMethodInterface2() { diff --git a/hotspot/test/compiler/types/correctness/hierarchies/Linear.java b/hotspot/test/compiler/types/correctness/hierarchies/Linear.java index 85927efc651..519157ae4eb 100644 --- a/hotspot/test/compiler/types/correctness/hierarchies/Linear.java +++ b/hotspot/test/compiler/types/correctness/hierarchies/Linear.java @@ -21,7 +21,7 @@ * questions. */ -package hierarchies; +package compiler.types.correctness.hierarchies; public class Linear { private Linear() { diff --git a/hotspot/test/compiler/types/correctness/hierarchies/Linear2.java b/hotspot/test/compiler/types/correctness/hierarchies/Linear2.java index a5df9b91213..10d31955a6b 100644 --- a/hotspot/test/compiler/types/correctness/hierarchies/Linear2.java +++ b/hotspot/test/compiler/types/correctness/hierarchies/Linear2.java @@ -21,7 +21,7 @@ * questions. */ -package hierarchies; +package compiler.types.correctness.hierarchies; public class Linear2 { private Linear2() { diff --git a/hotspot/test/compiler/types/correctness/hierarchies/NullableType.java b/hotspot/test/compiler/types/correctness/hierarchies/NullableType.java index 409a7c8e0ba..f338c1ea432 100644 --- a/hotspot/test/compiler/types/correctness/hierarchies/NullableType.java +++ b/hotspot/test/compiler/types/correctness/hierarchies/NullableType.java @@ -21,7 +21,7 @@ * questions. */ -package hierarchies; +package compiler.types.correctness.hierarchies; public class NullableType extends TypeHierarchy { diff --git a/hotspot/test/compiler/types/correctness/hierarchies/OneRank.java b/hotspot/test/compiler/types/correctness/hierarchies/OneRank.java index 4dcba0fd584..c29b9b9881e 100644 --- a/hotspot/test/compiler/types/correctness/hierarchies/OneRank.java +++ b/hotspot/test/compiler/types/correctness/hierarchies/OneRank.java @@ -21,7 +21,7 @@ * questions. */ -package hierarchies; +package compiler.types.correctness.hierarchies; public class OneRank { private OneRank() { diff --git a/hotspot/test/compiler/types/correctness/hierarchies/TypeHierarchy.java b/hotspot/test/compiler/types/correctness/hierarchies/TypeHierarchy.java index 91e168b4be9..5c9821b6f07 100644 --- a/hotspot/test/compiler/types/correctness/hierarchies/TypeHierarchy.java +++ b/hotspot/test/compiler/types/correctness/hierarchies/TypeHierarchy.java @@ -21,7 +21,7 @@ * questions. */ -package hierarchies; +package compiler.types.correctness.hierarchies; /** * Type hierarchy contains classes the type profiling and speculation are tested with diff --git a/hotspot/test/compiler/types/correctness/scenarios/ArrayCopy.java b/hotspot/test/compiler/types/correctness/scenarios/ArrayCopy.java index 3f51162bc03..1e3f3d74413 100644 --- a/hotspot/test/compiler/types/correctness/scenarios/ArrayCopy.java +++ b/hotspot/test/compiler/types/correctness/scenarios/ArrayCopy.java @@ -21,9 +21,9 @@ * questions. */ -package scenarios; +package compiler.types.correctness.scenarios; -import hierarchies.TypeHierarchy; +import compiler.types.correctness.hierarchies.TypeHierarchy; import java.util.Arrays; diff --git a/hotspot/test/compiler/types/correctness/scenarios/ArrayReferenceStore.java b/hotspot/test/compiler/types/correctness/scenarios/ArrayReferenceStore.java index f63e47e1879..868f786244e 100644 --- a/hotspot/test/compiler/types/correctness/scenarios/ArrayReferenceStore.java +++ b/hotspot/test/compiler/types/correctness/scenarios/ArrayReferenceStore.java @@ -21,9 +21,9 @@ * questions. */ -package scenarios; +package compiler.types.correctness.scenarios; -import hierarchies.TypeHierarchy; +import compiler.types.correctness.hierarchies.TypeHierarchy; import java.util.Arrays; diff --git a/hotspot/test/compiler/types/correctness/scenarios/ArrayScenario.java b/hotspot/test/compiler/types/correctness/scenarios/ArrayScenario.java index e93a578767d..5530bc5e7a7 100644 --- a/hotspot/test/compiler/types/correctness/scenarios/ArrayScenario.java +++ b/hotspot/test/compiler/types/correctness/scenarios/ArrayScenario.java @@ -21,10 +21,10 @@ * questions. */ -package scenarios; +package compiler.types.correctness.scenarios; +import compiler.types.correctness.hierarchies.TypeHierarchy; import jdk.test.lib.Asserts; -import hierarchies.TypeHierarchy; import java.lang.reflect.Array; import java.util.Arrays; diff --git a/hotspot/test/compiler/types/correctness/scenarios/CheckCast.java b/hotspot/test/compiler/types/correctness/scenarios/CheckCast.java index 97e6de67d3d..2863381c360 100644 --- a/hotspot/test/compiler/types/correctness/scenarios/CheckCast.java +++ b/hotspot/test/compiler/types/correctness/scenarios/CheckCast.java @@ -21,10 +21,10 @@ * questions. */ -package scenarios; +package compiler.types.correctness.scenarios; +import compiler.types.correctness.hierarchies.TypeHierarchy; import jdk.test.lib.Asserts; -import hierarchies.TypeHierarchy; import java.util.Objects; diff --git a/hotspot/test/compiler/types/correctness/scenarios/ClassIdentity.java b/hotspot/test/compiler/types/correctness/scenarios/ClassIdentity.java index 84fe2ed3138..bc6cc25febf 100644 --- a/hotspot/test/compiler/types/correctness/scenarios/ClassIdentity.java +++ b/hotspot/test/compiler/types/correctness/scenarios/ClassIdentity.java @@ -21,10 +21,10 @@ * questions. */ -package scenarios; +package compiler.types.correctness.scenarios; +import compiler.types.correctness.hierarchies.TypeHierarchy; import jdk.test.lib.Asserts; -import hierarchies.TypeHierarchy; /** * Tests pattern: if (a.getClass() == D.class) diff --git a/hotspot/test/compiler/types/correctness/scenarios/ClassInstanceOf.java b/hotspot/test/compiler/types/correctness/scenarios/ClassInstanceOf.java index 8b39043ed76..2192fe091f4 100644 --- a/hotspot/test/compiler/types/correctness/scenarios/ClassInstanceOf.java +++ b/hotspot/test/compiler/types/correctness/scenarios/ClassInstanceOf.java @@ -21,10 +21,10 @@ * questions. */ -package scenarios; +package compiler.types.correctness.scenarios; +import compiler.types.correctness.hierarchies.TypeHierarchy; import jdk.test.lib.Asserts; -import hierarchies.TypeHierarchy; /** * Tests instanceof diff --git a/hotspot/test/compiler/types/correctness/scenarios/ClassIsInstance.java b/hotspot/test/compiler/types/correctness/scenarios/ClassIsInstance.java index b4cd94d23d9..6c466c42c46 100644 --- a/hotspot/test/compiler/types/correctness/scenarios/ClassIsInstance.java +++ b/hotspot/test/compiler/types/correctness/scenarios/ClassIsInstance.java @@ -21,10 +21,10 @@ * questions. */ -package scenarios; +package compiler.types.correctness.scenarios; +import compiler.types.correctness.hierarchies.TypeHierarchy; import jdk.test.lib.Asserts; -import hierarchies.TypeHierarchy; /** * Tests {@link Class#isInstance(Object)} diff --git a/hotspot/test/compiler/types/correctness/scenarios/ProfilingType.java b/hotspot/test/compiler/types/correctness/scenarios/ProfilingType.java index 449fb166658..d94a9e59e74 100644 --- a/hotspot/test/compiler/types/correctness/scenarios/ProfilingType.java +++ b/hotspot/test/compiler/types/correctness/scenarios/ProfilingType.java @@ -21,7 +21,7 @@ * questions. */ -package scenarios; +package compiler.types.correctness.scenarios; public enum ProfilingType { /** type profiling of return values of reference types from an invoke */ diff --git a/hotspot/test/compiler/types/correctness/scenarios/ReceiverAtInvokes.java b/hotspot/test/compiler/types/correctness/scenarios/ReceiverAtInvokes.java index f98632d7283..a6c430ef7cf 100644 --- a/hotspot/test/compiler/types/correctness/scenarios/ReceiverAtInvokes.java +++ b/hotspot/test/compiler/types/correctness/scenarios/ReceiverAtInvokes.java @@ -21,10 +21,10 @@ * questions. */ -package scenarios; +package compiler.types.correctness.scenarios; +import compiler.types.correctness.hierarchies.TypeHierarchy; import jdk.test.lib.Asserts; -import hierarchies.TypeHierarchy; /** * Receiver at invokes profiling and speculation diff --git a/hotspot/test/compiler/types/correctness/scenarios/Scenario.java b/hotspot/test/compiler/types/correctness/scenarios/Scenario.java index 48679206225..d2aea494d74 100644 --- a/hotspot/test/compiler/types/correctness/scenarios/Scenario.java +++ b/hotspot/test/compiler/types/correctness/scenarios/Scenario.java @@ -21,9 +21,9 @@ * questions. */ -package scenarios; +package compiler.types.correctness.scenarios; -import hierarchies.TypeHierarchy; +import compiler.types.correctness.hierarchies.TypeHierarchy; /** * Test scenario diff --git a/hotspot/test/compiler/uncommontrap/DeoptReallocFailure.java b/hotspot/test/compiler/uncommontrap/DeoptReallocFailure.java index 1064527b9da..03636892492 100644 --- a/hotspot/test/compiler/uncommontrap/DeoptReallocFailure.java +++ b/hotspot/test/compiler/uncommontrap/DeoptReallocFailure.java @@ -25,30 +25,37 @@ * @test * @bug 8146416 * @library /test/lib /testlibrary / + * * @build sun.hotspot.WhiteBox - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbatch -XX:CompileCommand=exclude,DeoptReallocFailure::main -Xmx100m DeoptReallocFailure + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -Xbatch -Xmx100m + * -XX:CompileCommand=exclude,compiler.uncommontrap.DeoptReallocFailure::main + * compiler.uncommontrap.DeoptReallocFailure * */ -import java.lang.reflect.Method; + +package compiler.uncommontrap; + import sun.hotspot.WhiteBox; -class MemoryChunk { - MemoryChunk other; - Object[][] array; - - MemoryChunk(MemoryChunk other) { - this.other = other; - array = new Object[1024 * 256][]; - } -} - -class NoEscape { - long f1; -} +import java.lang.reflect.Method; public class DeoptReallocFailure { + static class MemoryChunk { + MemoryChunk other; + Object[][] array; + + MemoryChunk(MemoryChunk other) { + this.other = other; + array = new Object[1024 * 256][]; + } + } + + static class NoEscape { + long f1; + } static MemoryChunk root; private static final WhiteBox WB = WhiteBox.getWhiteBox(); diff --git a/hotspot/test/compiler/uncommontrap/StackOverflowGuardPagesOff.java b/hotspot/test/compiler/uncommontrap/StackOverflowGuardPagesOff.java index 835283c0bd3..3d0e84b81c3 100644 --- a/hotspot/test/compiler/uncommontrap/StackOverflowGuardPagesOff.java +++ b/hotspot/test/compiler/uncommontrap/StackOverflowGuardPagesOff.java @@ -25,10 +25,16 @@ * @test * @bug 8029383 * @summary stack overflow if callee is marked for deoptimization causes crash - * @run main/othervm -XX:TieredStopAtLevel=1 -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,StackOverflowGuardPagesOff::m1 -XX:CompileCommand=exclude,StackOverflowGuardPagesOff::m2 -Xss512K -XX:-UseOnStackReplacement StackOverflowGuardPagesOff * + * @run main/othervm -XX:TieredStopAtLevel=1 -XX:-BackgroundCompilation + * -XX:CompileCommand=dontinline,compiler.uncommontrap.StackOverflowGuardPagesOff::m1 + * -XX:CompileCommand=exclude,compiler.uncommontrap.StackOverflowGuardPagesOff::m2 + * -Xss512K -XX:-UseOnStackReplacement + * compiler.uncommontrap.StackOverflowGuardPagesOff */ +package compiler.uncommontrap; + // This test calls m2 recursively until a stack overflow. Then calls // m3 that calls m1. m1 triggers B's class loading, as a result m1 and // m3 needs to be deoptimized. Deoptimization of m1 causes a stack diff --git a/hotspot/test/compiler/uncommontrap/8009761/Test8009761.java b/hotspot/test/compiler/uncommontrap/Test8009761.java similarity index 97% rename from hotspot/test/compiler/uncommontrap/8009761/Test8009761.java rename to hotspot/test/compiler/uncommontrap/Test8009761.java index 91b58c651bb..df9141e3db6 100644 --- a/hotspot/test/compiler/uncommontrap/8009761/Test8009761.java +++ b/hotspot/test/compiler/uncommontrap/Test8009761.java @@ -21,20 +21,28 @@ * questions. */ -import sun.hotspot.WhiteBox; -import java.lang.reflect.Method; - /* * @test * @bug 8009761 - * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib * @summary Deoptimization on sparc doesn't set Llast_SP correctly in the interpreter frames it creates - * @build Test8009761 - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=exclude,Test8009761::m2 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -Xss512K Test8009761 + * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc + * + * @build compiler.uncommontrap.Test8009761 + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -Xss512K + * -XX:CompileCommand=exclude,compiler.uncommontrap.Test8009761::m2 + * compiler.uncommontrap.Test8009761 */ + +package compiler.uncommontrap; + +import sun.hotspot.WhiteBox; + +import java.lang.reflect.Method; + public class Test8009761 { private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); diff --git a/hotspot/test/compiler/uncommontrap/TestDeoptOOM.java b/hotspot/test/compiler/uncommontrap/TestDeoptOOM.java index 5342582fb00..75a00d236c5 100644 --- a/hotspot/test/compiler/uncommontrap/TestDeoptOOM.java +++ b/hotspot/test/compiler/uncommontrap/TestDeoptOOM.java @@ -25,10 +25,15 @@ * @test * @bug 6898462 * @summary failed reallocations of scalar replaced objects during deoptimization causes crash - * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=exclude,TestDeoptOOM::main -XX:CompileCommand=exclude,TestDeoptOOM::m9_1 -Xmx128M TestDeoptOOM * + * @run main/othervm -XX:-BackgroundCompilation -Xmx128M + * -XX:CompileCommand=exclude,compiler.uncommontrap.TestDeoptOOM::main + * -XX:CompileCommand=exclude,compiler.uncommontrap.TestDeoptOOM::m9_1 + * compiler.uncommontrap.TestDeoptOOM */ +package compiler.uncommontrap; + public class TestDeoptOOM { long f1; diff --git a/hotspot/test/compiler/uncommontrap/TestLockEliminatedAtDeopt.java b/hotspot/test/compiler/uncommontrap/TestLockEliminatedAtDeopt.java index 153b214c26c..6491f8e5eca 100644 --- a/hotspot/test/compiler/uncommontrap/TestLockEliminatedAtDeopt.java +++ b/hotspot/test/compiler/uncommontrap/TestLockEliminatedAtDeopt.java @@ -25,10 +25,15 @@ * @test * @bug 8032011 * @summary biased locking's revoke_bias locks monitor in compiled frame with eliminated lock - * @run main/othervm -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestLockEliminatedAtDeopt$A.m2 -XX:-BackgroundCompilation -XX:BiasedLockingStartupDelay=0 TestLockEliminatedAtDeopt * + * @run main/othervm -XX:-UseOnStackReplacement + * -XX:CompileCommand=dontinline,compiler.uncommontrap.TestLockEliminatedAtDeopt$A::m2 + * -XX:-BackgroundCompilation -XX:BiasedLockingStartupDelay=0 + * compiler.uncommontrap.TestLockEliminatedAtDeopt */ +package compiler.uncommontrap; + public class TestLockEliminatedAtDeopt { static class A { diff --git a/hotspot/test/compiler/uncommontrap/TestStackBangMonitorOwned.java b/hotspot/test/compiler/uncommontrap/TestStackBangMonitorOwned.java index c07a995dd87..e1c45a7b267 100644 --- a/hotspot/test/compiler/uncommontrap/TestStackBangMonitorOwned.java +++ b/hotspot/test/compiler/uncommontrap/TestStackBangMonitorOwned.java @@ -25,9 +25,15 @@ * @test * @bug 8032410 * @summary Stack overflow at deoptimization doesn't release owned monitors - * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestStackBangMonitorOwned::m1 -XX:CompileCommand=exclude,TestStackBangMonitorOwned::m2 -Xss512K -XX:-UseOnStackReplacement TestStackBangMonitorOwned * + * @run main/othervm -XX:-BackgroundCompilation -Xss512K -XX:-UseOnStackReplacement + * -XX:CompileCommand=dontinline,compiler.uncommontrap.TestStackBangMonitorOwned::m1 + * -XX:CompileCommand=exclude,compiler.uncommontrap.TestStackBangMonitorOwned::m2 + * compiler.uncommontrap.TestStackBangMonitorOwned */ + +package compiler.uncommontrap; + public class TestStackBangMonitorOwned { static class UnloadedClass1 { diff --git a/hotspot/test/compiler/uncommontrap/TestStackBangRbp.java b/hotspot/test/compiler/uncommontrap/TestStackBangRbp.java index 9b96951a2a6..c2c80ef565e 100644 --- a/hotspot/test/compiler/uncommontrap/TestStackBangRbp.java +++ b/hotspot/test/compiler/uncommontrap/TestStackBangRbp.java @@ -25,9 +25,15 @@ * @test * @bug 8028308 * @summary rbp not restored when stack overflow is thrown from deopt/uncommon trap blobs - * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestStackBangRbp::m1 -XX:CompileCommand=exclude,TestStackBangRbp::m2 -Xss512K -XX:-UseOnStackReplacement TestStackBangRbp * + * @run main/othervm -XX:-BackgroundCompilation -Xss512K -XX:-UseOnStackReplacement + * -XX:CompileCommand=dontinline,compiler.uncommontrap.TestStackBangRbp::m1 + * -XX:CompileCommand=exclude,compiler.uncommontrap.TestStackBangRbp::m2 + * compiler.uncommontrap.TestStackBangRbp */ + +package compiler.uncommontrap; + public class TestStackBangRbp { static class UnloadedClass1 { diff --git a/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java b/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java index 3de7157aab5..25e4413949a 100644 --- a/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java +++ b/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java @@ -30,51 +30,67 @@ * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build TestUnstableIfTrap jdk.test.lib.* compiler.testlibrary.uncommontrap.Verifier + * + * @build compiler.uncommontrap.TestUnstableIfTrap + * jdk.test.lib.* + * compiler.testlibrary.uncommontrap.Verifier * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbatch -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+LogCompilation * -XX:CompileCommand=compileonly,UnstableIfExecutable.test * -XX:LogFile=always_taken_not_fired.xml - * TestUnstableIfTrap ALWAYS_TAKEN false + * compiler.uncommontrap.TestUnstableIfTrap ALWAYS_TAKEN false * @run main/othervm -Xbatch -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+LogCompilation * -XX:CompileCommand=compileonly,UnstableIfExecutable.test * -XX:LogFile=always_taken_fired.xml - * TestUnstableIfTrap ALWAYS_TAKEN true + * compiler.uncommontrap.TestUnstableIfTrap ALWAYS_TAKEN true * @run main/othervm -Xbatch -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+LogCompilation * -XX:CompileCommand=compileonly,UnstableIfExecutable.test * -XX:LogFile=never_taken_not_fired.xml - * TestUnstableIfTrap NEVER_TAKEN false + * compiler.uncommontrap.TestUnstableIfTrap NEVER_TAKEN false * @run main/othervm -Xbatch -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+LogCompilation * -XX:CompileCommand=compileonly,UnstableIfExecutable.test * -XX:LogFile=never_taken_fired.xml - * TestUnstableIfTrap NEVER_TAKEN true + * compiler.uncommontrap.TestUnstableIfTrap NEVER_TAKEN true * @run driver compiler.testlibrary.uncommontrap.Verifier always_taken_not_fired.xml * always_taken_fired.xml * never_taken_not_fired.xml * never_taken_fired.xml */ +package compiler.uncommontrap; + +import compiler.testlibrary.uncommontrap.Verifier; +import jdk.internal.org.objectweb.asm.ClassVisitor; +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.Label; +import jdk.internal.org.objectweb.asm.MethodVisitor; +import jdk.test.lib.ByteCodeLoader; +import jdk.test.lib.Platform; +import sun.hotspot.WhiteBox; + import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.lang.reflect.Method; import java.util.Properties; -import jdk.test.lib.ByteCodeLoader; -import jdk.test.lib.Platform; -import jdk.internal.org.objectweb.asm.ClassVisitor; -import jdk.internal.org.objectweb.asm.ClassWriter; -import jdk.internal.org.objectweb.asm.Label; -import jdk.internal.org.objectweb.asm.MethodVisitor; -import static jdk.internal.org.objectweb.asm.Opcodes.*; - -import sun.hotspot.WhiteBox; -import compiler.testlibrary.uncommontrap.Verifier; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_ABSTRACT; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_VOLATILE; +import static jdk.internal.org.objectweb.asm.Opcodes.GETSTATIC; +import static jdk.internal.org.objectweb.asm.Opcodes.GOTO; +import static jdk.internal.org.objectweb.asm.Opcodes.IADD; +import static jdk.internal.org.objectweb.asm.Opcodes.ICONST_1; +import static jdk.internal.org.objectweb.asm.Opcodes.IFEQ; +import static jdk.internal.org.objectweb.asm.Opcodes.ILOAD; +import static jdk.internal.org.objectweb.asm.Opcodes.ISUB; +import static jdk.internal.org.objectweb.asm.Opcodes.RETURN; public class TestUnstableIfTrap { private static final WhiteBox WB = WhiteBox.getWhiteBox(); diff --git a/hotspot/test/compiler/uncommontrap/TraceDeoptimizationNoRealloc.java b/hotspot/test/compiler/uncommontrap/TraceDeoptimizationNoRealloc.java index 563bbbbe00e..4a371a525b3 100644 --- a/hotspot/test/compiler/uncommontrap/TraceDeoptimizationNoRealloc.java +++ b/hotspot/test/compiler/uncommontrap/TraceDeoptimizationNoRealloc.java @@ -25,10 +25,14 @@ * @test * @bug 8067144 * @summary -XX:+TraceDeoptimization tries to print realloc'ed objects even when there are none - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+IgnoreUnrecognizedVMOptions -XX:+TraceDeoptimization TraceDeoptimizationNoRealloc * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * -XX:+IgnoreUnrecognizedVMOptions -XX:+TraceDeoptimization + * compiler.uncommontrap.TraceDeoptimizationNoRealloc */ +package compiler.uncommontrap; + public class TraceDeoptimizationNoRealloc { static void m(boolean some_condition) { diff --git a/hotspot/test/compiler/uncommontrap/UncommonTrapStackBang.java b/hotspot/test/compiler/uncommontrap/UncommonTrapStackBang.java index e0c093b7b6f..d286d804cf5 100644 --- a/hotspot/test/compiler/uncommontrap/UncommonTrapStackBang.java +++ b/hotspot/test/compiler/uncommontrap/UncommonTrapStackBang.java @@ -27,8 +27,10 @@ * @bug 8026775 * @summary Uncommon trap blob did not bang all the stack shadow pages * - * @run main/othervm UncommonTrapStackBang - * + * @run main/othervm compiler.uncommontrap.UncommonTrapStackBang + */ + +/* * Note: This test does not reproduce the problem with absolute * certainty. Empirically the bug reproduces on Windows some 80+% of * the time. Setting everything up to fail in 100% of the cases turns @@ -55,6 +57,9 @@ * which raises an exception on Windows when the stack bang in * StringBuilder is performed. */ + +package compiler.uncommontrap; + public class UncommonTrapStackBang extends Thread { class Foo { } diff --git a/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java b/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java index a6707d536f9..be07553cac2 100644 --- a/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java +++ b/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java @@ -25,14 +25,18 @@ * @test * @bug 8016474 * @summary The bug only happens with C1 and G1 using a different ObjectAlignmentInBytes than KlassAlignmentInBytes (which is 8) + * * @modules java.base/jdk.internal.misc - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=32 GetUnsafeObjectG1PreBarrier + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=32 + * compiler.unsafe.GetUnsafeObjectG1PreBarrier */ -import java.lang.reflect.Field; +package compiler.unsafe; import jdk.internal.misc.Unsafe; +import java.lang.reflect.Field; + public class GetUnsafeObjectG1PreBarrier { private static final Unsafe unsafe; private static final int N = 100_000; diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java index 816977dfb53..e98e8b43e9f 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for boolean + * * @modules java.base/jdk.internal.misc - * @run testng/othervm -Diters=100 -Xint JdkInternalMiscUnsafeAccessTestBoolean - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestBoolean - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation JdkInternalMiscUnsafeAccessTestBoolean - * @run testng/othervm -Diters=20000 JdkInternalMiscUnsafeAccessTestBoolean + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.JdkInternalMiscUnsafeAccessTestBoolean + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestBoolean + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.JdkInternalMiscUnsafeAccessTestBoolean + * @run testng/othervm -Diters=20000 compiler.unsafe.JdkInternalMiscUnsafeAccessTestBoolean */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java index 9ce6f053fda..78282444e1b 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for byte + * * @modules java.base/jdk.internal.misc - * @run testng/othervm -Diters=100 -Xint JdkInternalMiscUnsafeAccessTestByte - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestByte - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation JdkInternalMiscUnsafeAccessTestByte - * @run testng/othervm -Diters=20000 JdkInternalMiscUnsafeAccessTestByte + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.JdkInternalMiscUnsafeAccessTestByte + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestByte + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.JdkInternalMiscUnsafeAccessTestByte + * @run testng/othervm -Diters=20000 compiler.unsafe.JdkInternalMiscUnsafeAccessTestByte */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java index df81a2fe941..c774f6b68b2 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for char + * * @modules java.base/jdk.internal.misc - * @run testng/othervm -Diters=100 -Xint JdkInternalMiscUnsafeAccessTestChar - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestChar - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation JdkInternalMiscUnsafeAccessTestChar - * @run testng/othervm -Diters=20000 JdkInternalMiscUnsafeAccessTestChar + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.JdkInternalMiscUnsafeAccessTestChar + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestChar + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.JdkInternalMiscUnsafeAccessTestChar + * @run testng/othervm -Diters=20000 compiler.unsafe.JdkInternalMiscUnsafeAccessTestChar */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java index 83874a55504..8a366bf0be4 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for double + * * @modules java.base/jdk.internal.misc - * @run testng/othervm -Diters=100 -Xint JdkInternalMiscUnsafeAccessTestDouble - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestDouble - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation JdkInternalMiscUnsafeAccessTestDouble - * @run testng/othervm -Diters=20000 JdkInternalMiscUnsafeAccessTestDouble + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.JdkInternalMiscUnsafeAccessTestDouble + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestDouble + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.JdkInternalMiscUnsafeAccessTestDouble + * @run testng/othervm -Diters=20000 compiler.unsafe.JdkInternalMiscUnsafeAccessTestDouble */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java index f5191f00af3..03df5ea5c03 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for float + * * @modules java.base/jdk.internal.misc - * @run testng/othervm -Diters=100 -Xint JdkInternalMiscUnsafeAccessTestFloat - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestFloat - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation JdkInternalMiscUnsafeAccessTestFloat - * @run testng/othervm -Diters=20000 JdkInternalMiscUnsafeAccessTestFloat + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.JdkInternalMiscUnsafeAccessTestFloat + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestFloat + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.JdkInternalMiscUnsafeAccessTestFloat + * @run testng/othervm -Diters=20000 compiler.unsafe.JdkInternalMiscUnsafeAccessTestFloat */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java index 6428c0d55e4..61498e623e1 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for int + * * @modules java.base/jdk.internal.misc - * @run testng/othervm -Diters=100 -Xint JdkInternalMiscUnsafeAccessTestInt - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestInt - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation JdkInternalMiscUnsafeAccessTestInt - * @run testng/othervm -Diters=20000 JdkInternalMiscUnsafeAccessTestInt + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.JdkInternalMiscUnsafeAccessTestInt + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestInt + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.JdkInternalMiscUnsafeAccessTestInt + * @run testng/othervm -Diters=20000 compiler.unsafe.JdkInternalMiscUnsafeAccessTestInt */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java index 505681a43af..3a07e8e89be 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for long + * * @modules java.base/jdk.internal.misc - * @run testng/othervm -Diters=100 -Xint JdkInternalMiscUnsafeAccessTestLong - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestLong - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation JdkInternalMiscUnsafeAccessTestLong - * @run testng/othervm -Diters=20000 JdkInternalMiscUnsafeAccessTestLong + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.JdkInternalMiscUnsafeAccessTestLong + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestLong + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.JdkInternalMiscUnsafeAccessTestLong + * @run testng/othervm -Diters=20000 compiler.unsafe.JdkInternalMiscUnsafeAccessTestLong */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java index 7fc59cd929c..1c5c2d0d701 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for Object + * * @modules java.base/jdk.internal.misc - * @run testng/othervm -Diters=100 -Xint JdkInternalMiscUnsafeAccessTestObject - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestObject - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation JdkInternalMiscUnsafeAccessTestObject - * @run testng/othervm -Diters=20000 JdkInternalMiscUnsafeAccessTestObject + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.JdkInternalMiscUnsafeAccessTestObject + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestObject + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.JdkInternalMiscUnsafeAccessTestObject + * @run testng/othervm -Diters=20000 compiler.unsafe.JdkInternalMiscUnsafeAccessTestObject */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java index 12ab68cfed7..30deaa8f6e5 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for short + * * @modules java.base/jdk.internal.misc - * @run testng/othervm -Diters=100 -Xint JdkInternalMiscUnsafeAccessTestShort - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 JdkInternalMiscUnsafeAccessTestShort - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation JdkInternalMiscUnsafeAccessTestShort - * @run testng/othervm -Diters=20000 JdkInternalMiscUnsafeAccessTestShort + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.JdkInternalMiscUnsafeAccessTestShort + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.JdkInternalMiscUnsafeAccessTestShort + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.JdkInternalMiscUnsafeAccessTestShort + * @run testng/othervm -Diters=20000 compiler.unsafe.JdkInternalMiscUnsafeAccessTestShort */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java index 45959f00cfa..f5b76819f14 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java @@ -26,13 +26,18 @@ * @bug 8158260 * @summary Test unaligned Unsafe accesses * @modules java.base/jdk.internal.misc - * @run main/othervm -Diters=20000 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation JdkInternalMiscUnsafeUnalignedAccess + * + * @run main/othervm -Diters=20000 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation + * compiler.unsafe.JdkInternalMiscUnsafeUnalignedAccess * @author volker.simonis@gmail.com */ +package compiler.unsafe; + +import jdk.internal.misc.Unsafe; + import java.lang.reflect.Field; import java.nio.ByteOrder; -import jdk.internal.misc.Unsafe; public class JdkInternalMiscUnsafeUnalignedAccess { static final int ITERS = Integer.getInteger("iters", 20_000); diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java index c5349ff404c..7200bf754c8 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for boolean + * * @modules jdk.unsupported/sun.misc - * @run testng/othervm -Diters=100 -Xint SunMiscUnsafeAccessTestBoolean - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestBoolean - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation SunMiscUnsafeAccessTestBoolean - * @run testng/othervm -Diters=20000 SunMiscUnsafeAccessTestBoolean + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.SunMiscUnsafeAccessTestBoolean + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestBoolean + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.SunMiscUnsafeAccessTestBoolean + * @run testng/othervm -Diters=20000 compiler.unsafe.SunMiscUnsafeAccessTestBoolean */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java index e15bd64089d..a30c01ff0f6 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for byte + * * @modules jdk.unsupported/sun.misc - * @run testng/othervm -Diters=100 -Xint SunMiscUnsafeAccessTestByte - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestByte - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation SunMiscUnsafeAccessTestByte - * @run testng/othervm -Diters=20000 SunMiscUnsafeAccessTestByte + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.SunMiscUnsafeAccessTestByte + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestByte + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.SunMiscUnsafeAccessTestByte + * @run testng/othervm -Diters=20000 compiler.unsafe.SunMiscUnsafeAccessTestByte */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java index 3c349085127..12dbb25030b 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for char + * * @modules jdk.unsupported/sun.misc - * @run testng/othervm -Diters=100 -Xint SunMiscUnsafeAccessTestChar - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestChar - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation SunMiscUnsafeAccessTestChar - * @run testng/othervm -Diters=20000 SunMiscUnsafeAccessTestChar + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.SunMiscUnsafeAccessTestChar + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestChar + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.SunMiscUnsafeAccessTestChar + * @run testng/othervm -Diters=20000 compiler.unsafe.SunMiscUnsafeAccessTestChar */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java index 9300fc0c17d..5fedde71510 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for double + * * @modules jdk.unsupported/sun.misc - * @run testng/othervm -Diters=100 -Xint SunMiscUnsafeAccessTestDouble - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestDouble - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation SunMiscUnsafeAccessTestDouble - * @run testng/othervm -Diters=20000 SunMiscUnsafeAccessTestDouble + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.SunMiscUnsafeAccessTestDouble + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestDouble + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.SunMiscUnsafeAccessTestDouble + * @run testng/othervm -Diters=20000 compiler.unsafe.SunMiscUnsafeAccessTestDouble */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java index 39a3f51b497..621e4ae3863 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for float + * * @modules jdk.unsupported/sun.misc - * @run testng/othervm -Diters=100 -Xint SunMiscUnsafeAccessTestFloat - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestFloat - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation SunMiscUnsafeAccessTestFloat - * @run testng/othervm -Diters=20000 SunMiscUnsafeAccessTestFloat + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.SunMiscUnsafeAccessTestFloat + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestFloat + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.SunMiscUnsafeAccessTestFloat + * @run testng/othervm -Diters=20000 compiler.unsafe.SunMiscUnsafeAccessTestFloat */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java index 5b505ad3d05..1e49aacb287 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for int + * * @modules jdk.unsupported/sun.misc - * @run testng/othervm -Diters=100 -Xint SunMiscUnsafeAccessTestInt - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestInt - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation SunMiscUnsafeAccessTestInt - * @run testng/othervm -Diters=20000 SunMiscUnsafeAccessTestInt + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.SunMiscUnsafeAccessTestInt + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestInt + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.SunMiscUnsafeAccessTestInt + * @run testng/othervm -Diters=20000 compiler.unsafe.SunMiscUnsafeAccessTestInt */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java index 2864b042886..e484bcec291 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for long + * * @modules jdk.unsupported/sun.misc - * @run testng/othervm -Diters=100 -Xint SunMiscUnsafeAccessTestLong - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestLong - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation SunMiscUnsafeAccessTestLong - * @run testng/othervm -Diters=20000 SunMiscUnsafeAccessTestLong + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.SunMiscUnsafeAccessTestLong + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestLong + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.SunMiscUnsafeAccessTestLong + * @run testng/othervm -Diters=20000 compiler.unsafe.SunMiscUnsafeAccessTestLong */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java index b56cc413504..1241f0fbcd4 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for Object + * * @modules jdk.unsupported/sun.misc - * @run testng/othervm -Diters=100 -Xint SunMiscUnsafeAccessTestObject - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestObject - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation SunMiscUnsafeAccessTestObject - * @run testng/othervm -Diters=20000 SunMiscUnsafeAccessTestObject + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.SunMiscUnsafeAccessTestObject + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestObject + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.SunMiscUnsafeAccessTestObject + * @run testng/othervm -Diters=20000 compiler.unsafe.SunMiscUnsafeAccessTestObject */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java index 4d43464e312..d1d7b632389 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for short + * * @modules jdk.unsupported/sun.misc - * @run testng/othervm -Diters=100 -Xint SunMiscUnsafeAccessTestShort - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 SunMiscUnsafeAccessTestShort - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation SunMiscUnsafeAccessTestShort - * @run testng/othervm -Diters=20000 SunMiscUnsafeAccessTestShort + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.SunMiscUnsafeAccessTestShort + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.SunMiscUnsafeAccessTestShort + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.SunMiscUnsafeAccessTestShort + * @run testng/othervm -Diters=20000 compiler.unsafe.SunMiscUnsafeAccessTestShort */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/unsafe/TestUnsafeLoadControl.java b/hotspot/test/compiler/unsafe/TestUnsafeLoadControl.java index 3fc0e821a68..fde5d53dcd1 100644 --- a/hotspot/test/compiler/unsafe/TestUnsafeLoadControl.java +++ b/hotspot/test/compiler/unsafe/TestUnsafeLoadControl.java @@ -26,13 +26,17 @@ * @bug 8077504 * @summary Unsafe load can loose control dependency and cause crash * @modules java.base/jdk.internal.misc - * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestUnsafeLoadControl * + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * compiler.unsafe.TestUnsafeLoadControl */ -import java.lang.reflect.Field; +package compiler.unsafe; + import jdk.internal.misc.Unsafe; +import java.lang.reflect.Field; + public class TestUnsafeLoadControl { private static final Unsafe UNSAFE; diff --git a/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java b/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java index 77014439673..d1548ab7ef7 100644 --- a/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java +++ b/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java @@ -37,24 +37,26 @@ * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions * -Xbatch -XX:-TieredCompilation * -XX:+FoldStableValues - * -XX:CompileCommand=dontinline,UnsafeGetConstantField.checkGetAddress() - * -XX:CompileCommand=dontinline,*.test* + * -XX:CompileCommand=dontinline,compiler.unsafe.UnsafeGetConstantField::checkGetAddress + * -XX:CompileCommand=dontinline,*::test* * -XX:+UseUnalignedAccesses - * -XaddReads:java.base=ALL-UNNAMED + * -XaddReads:java.base=ALL-UNNAMED * compiler.unsafe.UnsafeGetConstantField * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions * -Xbatch -XX:-TieredCompilation * -XX:+FoldStableValues - * -XX:CompileCommand=dontinline,UnsafeGetConstantField.checkGetAddress() - * -XX:CompileCommand=dontinline,*.test* - * -XX:CompileCommand=inline,*Unsafe.get* + * -XX:CompileCommand=dontinline,compiler.unsafe.UnsafeGetConstantField::checkGetAddress + * -XX:CompileCommand=dontinline,*::test* + * -XX:CompileCommand=inline,*Unsafe::get* * -XX:-UseUnalignedAccesses - * -XaddReads:java.base=ALL-UNNAMED + * -XaddReads:java.base=ALL-UNNAMED * compiler.unsafe.UnsafeGetConstantField */ + package compiler.unsafe; +import jdk.internal.misc.Unsafe; import jdk.internal.org.objectweb.asm.ClassWriter; import jdk.internal.org.objectweb.asm.FieldVisitor; import jdk.internal.org.objectweb.asm.MethodVisitor; @@ -63,14 +65,28 @@ import jdk.internal.org.objectweb.asm.Type; import jdk.internal.vm.annotation.Stable; import jdk.test.lib.Asserts; import jdk.test.lib.Platform; -import jdk.internal.misc.Unsafe; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import static jdk.internal.org.objectweb.asm.Opcodes.*; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_FINAL; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC; +import static jdk.internal.org.objectweb.asm.Opcodes.ACONST_NULL; +import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD; +import static jdk.internal.org.objectweb.asm.Opcodes.ARETURN; +import static jdk.internal.org.objectweb.asm.Opcodes.DUP; +import static jdk.internal.org.objectweb.asm.Opcodes.GETFIELD; +import static jdk.internal.org.objectweb.asm.Opcodes.GETSTATIC; +import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESPECIAL; +import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESTATIC; +import static jdk.internal.org.objectweb.asm.Opcodes.INVOKEVIRTUAL; +import static jdk.internal.org.objectweb.asm.Opcodes.NEW; +import static jdk.internal.org.objectweb.asm.Opcodes.PUTFIELD; +import static jdk.internal.org.objectweb.asm.Opcodes.PUTSTATIC; +import static jdk.internal.org.objectweb.asm.Opcodes.RETURN; public class UnsafeGetConstantField { static final Class THIS_CLASS = UnsafeGetConstantField.class; diff --git a/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java b/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java index c4d56725765..7476a908096 100644 --- a/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java +++ b/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java @@ -39,15 +39,18 @@ * -XX:CompileCommand=dontinline,*Test::test* * compiler.unsafe.UnsafeGetStableArrayElement */ + package compiler.unsafe; import jdk.internal.misc.Unsafe; import jdk.internal.vm.annotation.Stable; -import java.util.concurrent.Callable; import jdk.test.lib.Platform; +import java.util.concurrent.Callable; + import static jdk.internal.misc.Unsafe.*; -import static jdk.test.lib.Asserts.*; +import static jdk.test.lib.Asserts.assertEQ; +import static jdk.test.lib.Asserts.assertNE; public class UnsafeGetStableArrayElement { @Stable static final boolean[] STABLE_BOOLEAN_ARRAY = new boolean[16]; diff --git a/hotspot/test/compiler/unsafe/UnsafeRaw.java b/hotspot/test/compiler/unsafe/UnsafeRaw.java index bb2e9a1aeca..af1a1cd0b96 100644 --- a/hotspot/test/compiler/unsafe/UnsafeRaw.java +++ b/hotspot/test/compiler/unsafe/UnsafeRaw.java @@ -28,12 +28,15 @@ * @library /testlibrary * @modules java.base/jdk.internal.misc * java.management - * @run main/othervm -Xbatch UnsafeRaw + * @run main/othervm -Xbatch compiler.unsafe.UnsafeRaw */ -import jdk.test.lib.Utils; -import java.util.Random; +package compiler.unsafe; + import jdk.internal.misc.Unsafe; +import jdk.test.lib.Utils; + +import java.util.Random; public class UnsafeRaw { public static class Tests { diff --git a/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template b/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template index 2d1743ed607..55ed81fc059 100644 --- a/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template +++ b/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template @@ -25,13 +25,16 @@ * @test * @bug 8143628 * @summary Test unsafe access for $type$ + * * @modules $module$/$package$ - * @run testng/othervm -Diters=100 -Xint $Qualifier$UnsafeAccessTest$Type$ - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 $Qualifier$UnsafeAccessTest$Type$ - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation $Qualifier$UnsafeAccessTest$Type$ - * @run testng/othervm -Diters=20000 $Qualifier$UnsafeAccessTest$Type$ + * @run testng/othervm -Diters=100 -Xint compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$ + * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$ + * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$ + * @run testng/othervm -Diters=20000 compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$ */ +package compiler.unsafe; + import org.testng.annotations.Test; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/vectorization/TestNaNVector.java b/hotspot/test/compiler/vectorization/TestNaNVector.java index 302657951e1..d19f42e6ca3 100644 --- a/hotspot/test/compiler/vectorization/TestNaNVector.java +++ b/hotspot/test/compiler/vectorization/TestNaNVector.java @@ -25,9 +25,14 @@ * @test * @bug 8160425 * @summary Test vectorization with a signalling NaN. - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-OptimizeFill TestNaNVector - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-OptimizeFill -XX:MaxVectorSize=4 TestNaNVector + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-OptimizeFill + * compiler.vectorization.TestNaNVector + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-OptimizeFill + * -XX:MaxVectorSize=4 compiler.vectorization.TestNaNVector */ + +package compiler.vectorization; + public class TestNaNVector { private char[] array; private static final int LEN = 1024; diff --git a/hotspot/test/compiler/vectorization/TestVectorUnalignedOffset.java b/hotspot/test/compiler/vectorization/TestVectorUnalignedOffset.java index 081a6d9f8b8..c3f80c15d02 100644 --- a/hotspot/test/compiler/vectorization/TestVectorUnalignedOffset.java +++ b/hotspot/test/compiler/vectorization/TestVectorUnalignedOffset.java @@ -25,10 +25,11 @@ * @test * @bug 8155612 * @summary Aarch64: vector nodes need to support misaligned offset - * @run main/othervm -XX:-BackgroundCompilation TestVectorUnalignedOffset * + * @run main/othervm -XX:-BackgroundCompilation compiler.vectorization.TestVectorUnalignedOffset */ +package compiler.vectorization; public class TestVectorUnalignedOffset { diff --git a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java index db371183ddb..8f6517621cf 100644 --- a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java +++ b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java @@ -22,32 +22,37 @@ * */ -import java.lang.management.MemoryPoolMXBean; -import java.util.EnumSet; -import java.util.ArrayList; - -import sun.hotspot.WhiteBox; -import sun.hotspot.code.BlobType; -import jdk.test.lib.Asserts; -import jdk.test.lib.InfiniteLoop; - /* * @test AllocationCodeBlobTest - * @bug 8059624 8064669 - * @library /testlibrary /test/lib - * @modules java.base/jdk.internal.misc - * @modules java.management - * @build AllocationCodeBlobTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::* - * -XX:-SegmentedCodeCache AllocationCodeBlobTest - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::* - * -XX:+SegmentedCodeCache AllocationCodeBlobTest * @summary testing of WB::allocate/freeCodeBlob() + * @bug 8059624 8064669 + * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc + * java.management + * @build compiler.whitebox.AllocationCodeBlobTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::* + * -XX:-SegmentedCodeCache + * compiler.whitebox.AllocationCodeBlobTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::* + * -XX:+SegmentedCodeCache + * compiler.whitebox.AllocationCodeBlobTest */ + +package compiler.whitebox; + +import jdk.test.lib.Asserts; +import jdk.test.lib.InfiniteLoop; +import sun.hotspot.WhiteBox; +import sun.hotspot.code.BlobType; + +import java.lang.management.MemoryPoolMXBean; +import java.util.ArrayList; +import java.util.EnumSet; + public class AllocationCodeBlobTest { private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); private static final long CODE_CACHE_SIZE diff --git a/hotspot/test/compiler/whitebox/BlockingCompilation.java b/hotspot/test/compiler/whitebox/BlockingCompilation.java index 927cfea9ab4..a89ab057e3d 100644 --- a/hotspot/test/compiler/whitebox/BlockingCompilation.java +++ b/hotspot/test/compiler/whitebox/BlockingCompilation.java @@ -31,19 +31,22 @@ * compiler.testlibrary.CompilerUtils * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm/timeout=60 + * @run main/othervm * -Xbootclasspath/a:. * -Xmixed * -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI * -XX:+PrintCompilation - * BlockingCompilation + * compiler.whitebox.BlockingCompilation */ +package compiler.whitebox; + import compiler.testlibrary.CompilerUtils; +import sun.hotspot.WhiteBox; + import java.lang.reflect.Method; import java.util.Random; -import sun.hotspot.WhiteBox; public class BlockingCompilation { private static final WhiteBox WB = WhiteBox.getWhiteBox(); @@ -94,7 +97,9 @@ public class BlockingCompilation { // Blocking compilations on all levels, using the default versions of // WB.enqueueMethodForCompilation() and manually setting compiler directives. - String directive = "[{ match: \"BlockingCompilation.foo\", BackgroundCompilation: false }]"; + String directive = "[{ match: \"" + + BlockingCompilation.class.getName().replace('.', '/') + + ".foo\", BackgroundCompilation: false }]"; if (WB.addCompilerDirective(directive) != 1) { throw new Exception("Failed to add compiler directive"); } diff --git a/hotspot/test/compiler/whitebox/ClearMethodStateTest.java b/hotspot/test/compiler/whitebox/ClearMethodStateTest.java index 38eb99a672e..d0a06f99c56 100644 --- a/hotspot/test/compiler/whitebox/ClearMethodStateTest.java +++ b/hotspot/test/compiler/whitebox/ClearMethodStateTest.java @@ -21,23 +21,23 @@ * questions. */ -import java.util.function.Function; - -import compiler.whitebox.CompilerWhiteBoxTest; - /* * @test ClearMethodStateTest * @bug 8006683 8007288 8022832 + * @summary testing of WB::clearMethodState() * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc - * @modules java.management - * @build ClearMethodStateTest + * java.management + * @build compiler.whitebox.ClearMethodStateTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+PrintCompilation -XX:-UseCounterDecay ClearMethodStateTest - * @summary testing of WB::clearMethodState() - * @author igor.ignatyev@oracle.com + * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:+PrintCompilation -XX:-UseCounterDecay + * compiler.whitebox.ClearMethodStateTest */ + +package compiler.whitebox; + public class ClearMethodStateTest extends CompilerWhiteBoxTest { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java index e83cd1e96c7..3a05ec564d7 100644 --- a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java +++ b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java @@ -20,6 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package compiler.whitebox; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java index e47914968d9..2a718fcc3e2 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java @@ -21,21 +21,24 @@ * questions. */ -import compiler.whitebox.CompilerWhiteBoxTest; - /* * @test DeoptimizeAllTest * @bug 8006683 8007288 8022832 + * @summary testing of WB::deoptimizeAll() * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc - * @modules java.management - * @build DeoptimizeAllTest + * java.management + * @build compiler.whitebox.DeoptimizeAllTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* DeoptimizeAllTest - * @summary testing of WB::deoptimizeAll() - * @author igor.ignatyev@oracle.com + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:-UseCounterDecay + * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* + * compiler.whitebox.DeoptimizeAllTest */ + +package compiler.whitebox; + public class DeoptimizeAllTest extends CompilerWhiteBoxTest { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java b/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java index ce210944ad8..62f4154fb42 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java @@ -21,37 +21,37 @@ * questions. */ -import compiler.whitebox.CompilerWhiteBoxTest; - /* * @test DeoptimizeFramesTest * @bug 8028595 + * @summary testing of WB::deoptimizeFrames() * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc - * @modules java.management - * @build DeoptimizeFramesTest + * java.management + * @build compiler.whitebox.DeoptimizeFramesTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xmixed -XX:-UseCounterDecay - * -XX:CompileCommand=compileonly,DeoptimizeFramesTest$TestCaseImpl::method + * -XX:CompileCommand=compileonly,compiler.whitebox.DeoptimizeFramesTest$TestCaseImpl::method * -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom -XX:-DeoptimizeALot - * DeoptimizeFramesTest true + * compiler.whitebox.DeoptimizeFramesTest true * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xmixed -XX:-UseCounterDecay - * -XX:CompileCommand=compileonly,DeoptimizeFramesTest$TestCaseImpl::method + * -XX:CompileCommand=compileonly,compiler.whitebox.DeoptimizeFramesTest$TestCaseImpl::method * -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom -XX:-DeoptimizeALot - * DeoptimizeFramesTest false - * @summary testing of WB::deoptimizeFrames() + * compiler.whitebox.DeoptimizeFramesTest false */ + +package compiler.whitebox; + +import jdk.test.lib.Asserts; +import sun.hotspot.code.NMethod; + import java.lang.reflect.Executable; import java.util.concurrent.Callable; import java.util.concurrent.Phaser; -import sun.hotspot.code.NMethod; -import jdk.test.lib.Asserts; -import jdk.test.lib.InfiniteLoop; - public class DeoptimizeFramesTest extends CompilerWhiteBoxTest { private final boolean makeNotEntrant; private final Phaser phaser; diff --git a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java index 71ef586df6f..f505bbd5897 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java @@ -21,21 +21,24 @@ * questions. */ -import compiler.whitebox.CompilerWhiteBoxTest; - /* * @test DeoptimizeMethodTest * @bug 8006683 8007288 8022832 + * @summary testing of WB::deoptimizeMethod() * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc - * @modules java.management - * @build DeoptimizeMethodTest + * java.management + * @build compiler.whitebox.DeoptimizeMethodTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* DeoptimizeMethodTest - * @summary testing of WB::deoptimizeMethod() - * @author igor.ignatyev@oracle.com + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:-UseCounterDecay + * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* + * compiler.whitebox.DeoptimizeMethodTest */ + +package compiler.whitebox; + public class DeoptimizeMethodTest extends CompilerWhiteBoxTest { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java b/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java index 82397fe18b5..c5ec0286171 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java @@ -21,23 +21,28 @@ * questions. */ -import sun.hotspot.WhiteBox; -import java.lang.reflect.Executable; -import java.lang.reflect.Method; -import compiler.whitebox.CompilerWhiteBoxTest; /* * @test DeoptimizeMultipleOSRTest * @bug 8061817 + * @summary testing of WB::deoptimizeMethod() * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc - * @modules java.management - * @build DeoptimizeMultipleOSRTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,DeoptimizeMultipleOSRTest::triggerOSR DeoptimizeMultipleOSRTest - * @summary testing of WB::deoptimizeMethod() + * java.management + * @build compiler.whitebox.DeoptimizeMultipleOSRTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -XX:CompileCommand=compileonly,compiler.whitebox.DeoptimizeMultipleOSRTest::triggerOSR + * compiler.whitebox.DeoptimizeMultipleOSRTest */ + +package compiler.whitebox; + +import sun.hotspot.WhiteBox; + +import java.lang.reflect.Method; + public class DeoptimizeMultipleOSRTest { private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); private static final long BACKEDGE_THRESHOLD = 150000; diff --git a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java index 3bf0a1de446..ccb8ab0675e 100644 --- a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java +++ b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java @@ -21,21 +21,23 @@ * questions. */ -import compiler.whitebox.CompilerWhiteBoxTest; - /* * @test EnqueueMethodForCompilationTest * @bug 8006683 8007288 8022832 + * @summary testing of WB::enqueueMethodForCompilation() * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc - * @modules java.management - * @build EnqueueMethodForCompilationTest + * java.management + * @build compiler.whitebox.EnqueueMethodForCompilationTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+PrintCompilation -XX:-UseCounterDecay EnqueueMethodForCompilationTest - * @summary testing of WB::enqueueMethodForCompilation() - * @author igor.ignatyev@oracle.com + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:+PrintCompilation -XX:-UseCounterDecay + * compiler.whitebox.EnqueueMethodForCompilationTest */ + +package compiler.whitebox; + public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java index ea22e257c83..f9b7cda0dbb 100644 --- a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java +++ b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java @@ -22,31 +22,30 @@ * */ -import java.lang.reflect.Method; -import java.util.EnumSet; - -import sun.hotspot.WhiteBox; -import sun.hotspot.code.BlobType; - -import jdk.test.lib.Asserts; -import jdk.test.lib.InfiniteLoop; -import compiler.whitebox.CompilerWhiteBoxTest; - /* * @test * @bug 8059624 8064669 8153265 + * @summary testing of WB::forceNMethodSweep * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc - * @modules java.management - * @build ForceNMethodSweepTest + * java.management + * @build compiler.whitebox.ForceNMethodSweepTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:-TieredCompilation -XX:+WhiteBoxAPI * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* - * -XX:-BackgroundCompilation -XX:-UseCounterDecay ForceNMethodSweepTest - * @summary testing of WB::forceNMethodSweep + * -XX:-BackgroundCompilation -XX:-UseCounterDecay + * compiler.whitebox.ForceNMethodSweepTest */ + +package compiler.whitebox; + +import jdk.test.lib.Asserts; +import sun.hotspot.code.BlobType; + +import java.util.EnumSet; + public class ForceNMethodSweepTest extends CompilerWhiteBoxTest { public static void main(String[] args) throws Exception { CompilerWhiteBoxTest.main(ForceNMethodSweepTest::new, args); diff --git a/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java index 8b2acf48e28..c6493c0abfa 100644 --- a/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java +++ b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java @@ -22,31 +22,34 @@ * */ -import java.util.Arrays; -import java.util.EnumSet; - -import sun.hotspot.WhiteBox; -import sun.hotspot.code.CodeBlob; -import sun.hotspot.code.BlobType; -import jdk.test.lib.Asserts; - /* * @test GetCodeHeapEntriesTest * @bug 8059624 - * @library /testlibrary /test/lib + * @summary testing of WB::getCodeHeapEntries() + * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc - * @modules java.management - * @build GetCodeHeapEntriesTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * java.management + * @build compiler.whitebox.GetCodeHeapEntriesTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache - * GetCodeHeapEntriesTest + * compiler.whitebox.GetCodeHeapEntriesTest * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache - * GetCodeHeapEntriesTest - * @summary testing of WB::getCodeHeapEntries() + * compiler.whitebox.GetCodeHeapEntriesTest */ + +package compiler.whitebox; + +import jdk.test.lib.Asserts; +import sun.hotspot.WhiteBox; +import sun.hotspot.code.BlobType; +import sun.hotspot.code.CodeBlob; + +import java.util.Arrays; +import java.util.EnumSet; + public class GetCodeHeapEntriesTest { private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); private static final int SIZE = 1024; diff --git a/hotspot/test/compiler/whitebox/GetNMethodTest.java b/hotspot/test/compiler/whitebox/GetNMethodTest.java index bb9f9fc08f6..4b64a6c5236 100644 --- a/hotspot/test/compiler/whitebox/GetNMethodTest.java +++ b/hotspot/test/compiler/whitebox/GetNMethodTest.java @@ -22,24 +22,28 @@ * */ -import sun.hotspot.code.BlobType; -import sun.hotspot.code.NMethod; -import jdk.test.lib.Asserts; -import compiler.whitebox.CompilerWhiteBoxTest; - /* * @test GetNMethodTest * @bug 8038240 + * @summary testing of WB::getNMethod() * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc - * @modules java.management - * @build GetNMethodTest + * java.management + * @build compiler.whitebox.GetNMethodTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* GetNMethodTest - * @summary testing of WB::getNMethod() - * @author igor.ignatyev@oracle.com + * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:-UseCounterDecay + * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* + * compiler.whitebox.GetNMethodTest */ + +package compiler.whitebox; + +import jdk.test.lib.Asserts; +import sun.hotspot.code.BlobType; +import sun.hotspot.code.NMethod; + public class GetNMethodTest extends CompilerWhiteBoxTest { public static void main(String[] args) throws Exception { CompilerWhiteBoxTest.main(GetNMethodTest::new, args); diff --git a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java index ff34c2ae3c6..5bd3613b602 100644 --- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java +++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java @@ -24,22 +24,26 @@ /* * @test IsMethodCompilableTest * @bug 8007270 8006683 8007288 8022832 + * @summary testing of WB::isMethodCompilable() * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management * @build jdk.test.lib.* * sun.hotspot.WhiteBox - * @build IsMethodCompilableTest + * @build compiler.whitebox.IsMethodCompilableTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * jdk.test.lib.Platform - * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:-UseCounterDecay -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* IsMethodCompilableTest - * @summary testing of WB::isMethodCompilable() - * @author igor.ignatyev@oracle.com + * @run main/othervm/timeout=2400 -XX:-TieredCompilation -Xmixed + * -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -XX:PerMethodRecompilationCutoff=3 -XX:-UseCounterDecay + * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* + * compiler.whitebox.IsMethodCompilableTest */ +package compiler.whitebox; + import jdk.test.lib.Platform; -import compiler.whitebox.CompilerWhiteBoxTest; public class IsMethodCompilableTest extends CompilerWhiteBoxTest { /** diff --git a/hotspot/test/compiler/whitebox/LockCompilationTest.java b/hotspot/test/compiler/whitebox/LockCompilationTest.java index eb04651588f..e3b86823424 100644 --- a/hotspot/test/compiler/whitebox/LockCompilationTest.java +++ b/hotspot/test/compiler/whitebox/LockCompilationTest.java @@ -24,22 +24,20 @@ /* * @test LockCompilationTest * @bug 8059624 8152169 + * @summary testing of WB::lock/unlockCompilation() * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc - * @modules java.management - * @build LockCompilationTest + * java.management + * @build compiler.whitebox.LockCompilationTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay LockCompilationTest - * @summary testing of WB::lock/unlockCompilation() + * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:-UseCounterDecay + * compiler.whitebox.LockCompilationTest */ -import java.io.OutputStream; -import java.io.PrintWriter; -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.CyclicBarrier; +package compiler.whitebox; -import compiler.whitebox.CompilerWhiteBoxTest; import jdk.test.lib.Asserts; public class LockCompilationTest extends CompilerWhiteBoxTest { diff --git a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java index ba06694bd2a..6722acecc22 100644 --- a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java +++ b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java @@ -21,21 +21,23 @@ * questions. */ -import compiler.whitebox.CompilerWhiteBoxTest; - /* * @test MakeMethodNotCompilableTest * @bug 8012322 8006683 8007288 8022832 + * @summary testing of WB::makeMethodNotCompilable() * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc - * @modules java.management - * @build MakeMethodNotCompilableTest + * java.management + * @build compiler.whitebox.MakeMethodNotCompilableTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmixed -XX:-UseCounterDecay MakeMethodNotCompilableTest - * @summary testing of WB::makeMethodNotCompilable() - * @author igor.ignatyev@oracle.com + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -Xmixed -XX:-UseCounterDecay + * compiler.whitebox.MakeMethodNotCompilableTest */ + +package compiler.whitebox; + public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest { private int bci; public static void main(String[] args) throws Exception { diff --git a/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java b/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java index 3ba7b7797b8..5a8c7c33eeb 100644 --- a/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java +++ b/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java @@ -21,21 +21,24 @@ * questions. */ -import compiler.whitebox.CompilerWhiteBoxTest; - /* * @test SetDontInlineMethodTest * @bug 8006683 8007288 8022832 + * @summary testing of WB::testSetDontInlineMethod() * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc - * @modules java.management - * @build SetDontInlineMethodTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* SetDontInlineMethodTest - * @summary testing of WB::testSetDontInlineMethod() - * @author igor.ignatyev@oracle.com + * java.management + * @build compiler.whitebox.SetDontInlineMethodTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* + * compiler.whitebox.SetDontInlineMethodTest */ + +package compiler.whitebox; + public class SetDontInlineMethodTest extends CompilerWhiteBoxTest { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java b/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java index c04f234dea2..f3e27e94827 100644 --- a/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java +++ b/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java @@ -21,21 +21,24 @@ * questions. */ -import compiler.whitebox.CompilerWhiteBoxTest; - /* * @test SetForceInlineMethodTest * @bug 8006683 8007288 8022832 + * @summary testing of WB::testSetForceInlineMethod() * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc - * @modules java.management - * @build SetForceInlineMethodTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* SetForceInlineMethodTest - * @summary testing of WB::testSetForceInlineMethod() - * @author igor.ignatyev@oracle.com + * java.management + * @build compiler.whitebox.SetForceInlineMethodTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* + * compiler.whitebox.SetForceInlineMethodTest */ + +package compiler.whitebox; + public class SetForceInlineMethodTest extends CompilerWhiteBoxTest { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/compiler/whitebox/SimpleTestCase.java b/hotspot/test/compiler/whitebox/SimpleTestCase.java index 2de860e4fe9..196c39e3cc8 100644 --- a/hotspot/test/compiler/whitebox/SimpleTestCase.java +++ b/hotspot/test/compiler/whitebox/SimpleTestCase.java @@ -23,11 +23,12 @@ package compiler.whitebox; +import sun.hotspot.WhiteBox; + import java.lang.reflect.Constructor; import java.lang.reflect.Executable; import java.lang.reflect.Method; import java.util.concurrent.Callable; -import sun.hotspot.WhiteBox; public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase { /** constructor test case */ From b582e23cba08b3d7e0800d8e8683a09aa57c11f5 Mon Sep 17 00:00:00 2001 From: Stefan Anzinger Date: Tue, 12 Jul 2016 20:42:46 +0000 Subject: [PATCH 028/108] 8159368: [JVMCI] SPARCHotSpotRegisterConfig.callingConvention gives incorrect calling convention for native calls containing fp args Reviewed-by: kvn, iveresov --- hotspot/make/test/JtregNative.gmk | 1 + .../sparc/SPARCHotSpotRegisterConfig.java | 149 ++++++++++++------ .../jdk/vm/ci/code/test/TestAssembler.java | 49 +++++- .../code/test/amd64/AMD64TestAssembler.java | 145 ++++++++++++++++- .../code/test/sparc/SPARCTestAssembler.java | 146 +++++++++++++++-- 5 files changed, 424 insertions(+), 66 deletions(-) diff --git a/hotspot/make/test/JtregNative.gmk b/hotspot/make/test/JtregNative.gmk index f5553bd0a47..5f1b2ed66e1 100644 --- a/hotspot/make/test/JtregNative.gmk +++ b/hotspot/make/test/JtregNative.gmk @@ -52,6 +52,7 @@ BUILD_HOTSPOT_JTREG_NATIVE_SRC := \ $(HOTSPOT_TOPDIR)/test/compiler/calls \ $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/GetNamedModule \ $(HOTSPOT_TOPDIR)/test/testlibrary/jvmti \ + $(HOTSPOT_TOPDIR)/test/compiler/jvmci/jdk.vm.ci.code.test \ # # Add conditional directories here when needed. diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotRegisterConfig.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotRegisterConfig.java index bb25c611df5..3b07a90d352 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotRegisterConfig.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotRegisterConfig.java @@ -26,17 +26,41 @@ import static jdk.vm.ci.meta.JavaKind.Void; import static jdk.vm.ci.meta.Value.ILLEGAL; import static jdk.vm.ci.sparc.SPARC.REGISTER_SAFE_AREA_SIZE; import static jdk.vm.ci.sparc.SPARC.d0; +import static jdk.vm.ci.sparc.SPARC.d10; +import static jdk.vm.ci.sparc.SPARC.d12; +import static jdk.vm.ci.sparc.SPARC.d14; +import static jdk.vm.ci.sparc.SPARC.d16; +import static jdk.vm.ci.sparc.SPARC.d18; import static jdk.vm.ci.sparc.SPARC.d2; +import static jdk.vm.ci.sparc.SPARC.d20; +import static jdk.vm.ci.sparc.SPARC.d22; +import static jdk.vm.ci.sparc.SPARC.d24; +import static jdk.vm.ci.sparc.SPARC.d26; +import static jdk.vm.ci.sparc.SPARC.d28; +import static jdk.vm.ci.sparc.SPARC.d30; import static jdk.vm.ci.sparc.SPARC.d4; import static jdk.vm.ci.sparc.SPARC.d6; +import static jdk.vm.ci.sparc.SPARC.d8; import static jdk.vm.ci.sparc.SPARC.f0; import static jdk.vm.ci.sparc.SPARC.f1; +import static jdk.vm.ci.sparc.SPARC.f11; +import static jdk.vm.ci.sparc.SPARC.f13; +import static jdk.vm.ci.sparc.SPARC.f15; +import static jdk.vm.ci.sparc.SPARC.f17; +import static jdk.vm.ci.sparc.SPARC.f19; import static jdk.vm.ci.sparc.SPARC.f2; +import static jdk.vm.ci.sparc.SPARC.f21; +import static jdk.vm.ci.sparc.SPARC.f23; +import static jdk.vm.ci.sparc.SPARC.f25; +import static jdk.vm.ci.sparc.SPARC.f27; +import static jdk.vm.ci.sparc.SPARC.f29; import static jdk.vm.ci.sparc.SPARC.f3; +import static jdk.vm.ci.sparc.SPARC.f31; import static jdk.vm.ci.sparc.SPARC.f4; import static jdk.vm.ci.sparc.SPARC.f5; import static jdk.vm.ci.sparc.SPARC.f6; import static jdk.vm.ci.sparc.SPARC.f7; +import static jdk.vm.ci.sparc.SPARC.f9; import static jdk.vm.ci.sparc.SPARC.g0; import static jdk.vm.ci.sparc.SPARC.g2; import static jdk.vm.ci.sparc.SPARC.g6; @@ -95,11 +119,6 @@ public class SPARCHotSpotRegisterConfig implements RegisterConfig { private final RegisterAttributes[] attributesMap; - /** - * Does native code (C++ code) spill arguments in registers to the parent frame? - */ - private final boolean addNativeRegisterArgumentSlots; - @Override public RegisterArray getAllocatableRegisters() { return allocatable; @@ -124,10 +143,18 @@ public class SPARCHotSpotRegisterConfig implements RegisterConfig { private final RegisterArray cpuCallerParameterRegisters = new RegisterArray(o0, o1, o2, o3, o4, o5); private final RegisterArray cpuCalleeParameterRegisters = new RegisterArray(i0, i1, i2, i3, i4, i5); - private final RegisterArray fpuFloatParameterRegisters = new RegisterArray(f0, f1, f2, f3, f4, f5, f6, f7); - private final RegisterArray fpuDoubleParameterRegisters = new RegisterArray(d0, null, d2, null, d4, null, d6, null); + private final RegisterArray fpuFloatJavaParameterRegisters = new RegisterArray(f0, f1, f2, f3, f4, f5, f6, f7); + private final RegisterArray fpuDoubleJavaParameterRegisters = new RegisterArray(d0, null, d2, null, d4, null, d6, null); // @formatter:off + private final RegisterArray fpuFloatNativeParameterRegisters = new RegisterArray( + f1, f3, f5, f7, f9, f11, f13, f15, + f17, f19, f21, f23, f25, f27, f29, f31); + + private final RegisterArray fpuDoubleNativeParameterRegisters = new RegisterArray( + d0, d2, d4, d6, d8, d10, d12, d14, + d16, d18, d20, d22, d24, d26, d28, d30); + private final RegisterArray callerSaveRegisters; /** @@ -170,7 +197,6 @@ public class SPARCHotSpotRegisterConfig implements RegisterConfig { public SPARCHotSpotRegisterConfig(TargetDescription target, RegisterArray allocatable) { this.target = target; this.allocatable = allocatable; - this.addNativeRegisterArgumentSlots = false; HashSet callerSaveSet = new HashSet<>(target.arch.getAvailableValueRegisters().asList()); for (Register cs : windowSaveRegisters) { callerSaveSet.remove(cs); @@ -220,7 +246,7 @@ public class SPARCHotSpotRegisterConfig implements RegisterConfig { return hotspotType == HotSpotCallingConventionType.JavaCallee ? cpuCalleeParameterRegisters : cpuCallerParameterRegisters; case Double: case Float: - return fpuFloatParameterRegisters; + return fpuFloatJavaParameterRegisters; default: throw JVMCIError.shouldNotReachHere("Unknown JavaKind " + kind); } @@ -233,48 +259,77 @@ public class SPARCHotSpotRegisterConfig implements RegisterConfig { int currentGeneral = 0; int currentFloating = 0; int currentStackOffset = 0; + boolean isNative = type == HotSpotCallingConventionType.NativeCall; for (int i = 0; i < parameterTypes.length; i++) { final JavaKind kind = parameterTypes[i].getJavaKind().getStackKind(); - - switch (kind) { - case Byte: - case Boolean: - case Short: - case Char: - case Int: - case Long: - case Object: - if (currentGeneral < generalParameterRegisters.size()) { - Register register = generalParameterRegisters.get(currentGeneral++); - locations[i] = register.asValue(valueKindFactory.getValueKind(kind)); - } - break; - case Double: - if (currentFloating < fpuFloatParameterRegisters.size()) { - if (currentFloating % 2 != 0) { - // Make register number even to be a double reg - currentFloating++; + if (isNative) { + RegisterArray registerSet; + switch (kind) { + case Byte: + case Boolean: + case Short: + case Char: + case Int: + case Long: + case Object: + registerSet = generalParameterRegisters; + break; + case Double: + registerSet = fpuDoubleNativeParameterRegisters; + break; + case Float: + registerSet = fpuFloatNativeParameterRegisters; + break; + default: + throw JVMCIError.shouldNotReachHere(); + } + if (i < registerSet.size()) { + locations[i] = registerSet.get(i).asValue(valueKindFactory.getValueKind(kind)); + currentStackOffset += target.arch.getWordSize(); + } + } else { + switch (kind) { + case Byte: + case Boolean: + case Short: + case Char: + case Int: + case Long: + case Object: + if (currentGeneral < generalParameterRegisters.size()) { + Register register = generalParameterRegisters.get(currentGeneral++); + locations[i] = register.asValue(valueKindFactory.getValueKind(kind)); } - Register register = fpuDoubleParameterRegisters.get(currentFloating); - currentFloating += 2; // Only every second is a double register - locations[i] = register.asValue(valueKindFactory.getValueKind(kind)); - } - break; - case Float: - if (currentFloating < fpuFloatParameterRegisters.size()) { - Register register = fpuFloatParameterRegisters.get(currentFloating++); - locations[i] = register.asValue(valueKindFactory.getValueKind(kind)); - } - break; - default: - throw JVMCIError.shouldNotReachHere(); + break; + case Double: + if (currentFloating < fpuFloatJavaParameterRegisters.size()) { + if (currentFloating % 2 != 0) { + // Make register number even to be a double reg + currentFloating++; + } + Register register = fpuDoubleJavaParameterRegisters.get(currentFloating); + currentFloating += 2; // Only every second is a double register + locations[i] = register.asValue(valueKindFactory.getValueKind(kind)); + } + break; + case Float: + if (currentFloating < fpuFloatJavaParameterRegisters.size()) { + Register register = fpuFloatJavaParameterRegisters.get(currentFloating++); + locations[i] = register.asValue(valueKindFactory.getValueKind(kind)); + } + break; + default: + throw JVMCIError.shouldNotReachHere(); + } } if (locations[i] == null) { ValueKind valueKind = valueKindFactory.getValueKind(kind); - // Stack slot is always aligned to its size in bytes but minimum wordsize int typeSize = valueKind.getPlatformKind().getSizeInBytes(); + if (isNative) { + currentStackOffset += target.arch.getWordSize() - typeSize; + } currentStackOffset = roundUp(currentStackOffset, typeSize); int slotOffset = currentStackOffset + REGISTER_SAFE_AREA_SIZE; locations[i] = StackSlot.get(valueKind, slotOffset, !type.out); @@ -284,15 +339,7 @@ public class SPARCHotSpotRegisterConfig implements RegisterConfig { JavaKind returnKind = returnType == null ? Void : returnType.getJavaKind(); AllocatableValue returnLocation = returnKind == Void ? ILLEGAL : getReturnRegister(returnKind, type).asValue(valueKindFactory.getValueKind(returnKind.getStackKind())); - - int outArgSpillArea; - if (type == HotSpotCallingConventionType.NativeCall && addNativeRegisterArgumentSlots) { - // Space for native callee which may spill our outgoing arguments - outArgSpillArea = Math.min(locations.length, generalParameterRegisters.size()) * target.wordSize; - } else { - outArgSpillArea = 0; - } - return new CallingConvention(currentStackOffset + outArgSpillArea, returnLocation, locations); + return new CallingConvention(currentStackOffset, returnLocation, locations); } private static int roundUp(int number, int mod) { diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java index f657be71687..016b2ee74f3 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java @@ -23,10 +23,12 @@ package jdk.vm.ci.code.test; +import jdk.vm.ci.code.CallingConvention; import jdk.vm.ci.code.CodeCacheProvider; import jdk.vm.ci.code.DebugInfo; import jdk.vm.ci.code.Register; import jdk.vm.ci.code.StackSlot; +import jdk.vm.ci.code.ValueKindFactory; import jdk.vm.ci.code.site.Call; import jdk.vm.ci.code.site.ConstantReference; import jdk.vm.ci.code.site.DataPatch; @@ -41,6 +43,7 @@ import jdk.vm.ci.hotspot.HotSpotCompiledCode.Comment; import jdk.vm.ci.hotspot.HotSpotCompiledNmethod; import jdk.vm.ci.hotspot.HotSpotConstant; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; +import jdk.vm.ci.meta.AllocatableValue; import jdk.vm.ci.meta.Assumptions.Assumption; import jdk.vm.ci.meta.InvokeTarget; import jdk.vm.ci.meta.JavaKind; @@ -144,6 +147,11 @@ public abstract class TestAssembler { */ public abstract StackSlot emitFloatToStack(Register a); + /** + * Emit code to store a double-precision float from a register to a new stack slot. + */ + public abstract StackSlot emitDoubleToStack(Register a); + /** * Emit code to store a wide pointer from a register to a new stack slot. */ @@ -164,6 +172,11 @@ public abstract class TestAssembler { */ public abstract void emitIntRet(Register a); + /** + * Emit code to return from a function, returning a single precision float. + */ + public abstract void emitFloatRet(Register a); + /** * Emit code to return from a function, returning a wide oop pointer. */ @@ -193,7 +206,13 @@ public abstract class TestAssembler { private StackSlot deoptRescue; - private static class TestValueKind extends ValueKind { + public ValueKindFactory valueKindFactory = new ValueKindFactory() { + public TestValueKind getValueKind(JavaKind javaKind) { + return (TestValueKind) TestAssembler.this.getValueKind(javaKind); + } + }; + + static class TestValueKind extends ValueKind { TestValueKind(PlatformKind kind) { super(kind); @@ -340,6 +359,11 @@ public abstract class TestAssembler { data.putFloat(f); } + public void emitDouble(double f) { + ensureSize(data.position() + 8); + data.putDouble(f); + } + public void align(int alignment) { int pos = data.position(); int misaligned = pos % alignment; @@ -353,4 +377,27 @@ public abstract class TestAssembler { return Arrays.copyOf(data.array(), data.position()); } } + + /** + * Loads a primitive into the Allocatable av. Implementors may only implement + * primitive types. + */ + public abstract void emitLoad(AllocatableValue av, Object prim); + + /** + * Emit a call to a fixed address addr + */ + public abstract void emitCall(long addr); + + /** + * Emit code which is necessary to call a method with {@link CallingConvention} cc + * and arguments prim. + */ + public abstract void emitCallPrologue(CallingConvention cc, Object... prim); + + /** + * Emit code which is necessary after calling a method with CallingConvention cc. + */ + public abstract void emitCallEpilogue(CallingConvention cc); + } diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java index 078af122e6b..f59aa08e362 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java @@ -23,11 +23,15 @@ package jdk.vm.ci.code.test.amd64; +import static jdk.vm.ci.amd64.AMD64.xmm0; + import jdk.vm.ci.amd64.AMD64; import jdk.vm.ci.amd64.AMD64Kind; +import jdk.vm.ci.code.CallingConvention; import jdk.vm.ci.code.CodeCacheProvider; import jdk.vm.ci.code.DebugInfo; import jdk.vm.ci.code.Register; +import jdk.vm.ci.code.RegisterValue; import jdk.vm.ci.code.StackSlot; import jdk.vm.ci.code.site.ConstantReference; import jdk.vm.ci.code.site.DataSectionReference; @@ -36,6 +40,7 @@ import jdk.vm.ci.code.test.TestHotSpotVMConfig; import jdk.vm.ci.hotspot.HotSpotCallingConventionType; import jdk.vm.ci.hotspot.HotSpotConstant; import jdk.vm.ci.hotspot.HotSpotForeignCallTarget; +import jdk.vm.ci.meta.AllocatableValue; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.VMConstant; @@ -116,6 +121,10 @@ public class AMD64TestAssembler extends TestAssembler { @Override public Register emitLoadInt(int c) { Register ret = newRegister(); + return emitLoadInt(ret, c); + } + + public Register emitLoadInt(Register ret, int c) { emitREX(false, 0, 0, ret.encoding); code.emitByte(0xB8 | (ret.encoding & 0x7)); // MOV r32, imm32 code.emitInt(c); @@ -125,6 +134,10 @@ public class AMD64TestAssembler extends TestAssembler { @Override public Register emitLoadLong(long c) { Register ret = newRegister(); + return emitLoadLong(ret, c); + } + + public Register emitLoadLong(Register ret, long c) { emitREX(true, 0, 0, ret.encoding); code.emitByte(0xB8 | (ret.encoding & 0x7)); // MOV r64, imm64 code.emitLong(c); @@ -133,12 +146,16 @@ public class AMD64TestAssembler extends TestAssembler { @Override public Register emitLoadFloat(float c) { + Register ret = AMD64.xmm0; + return emitLoadFloat(ret, c); + } + + public Register emitLoadFloat(Register ret, float c) { DataSectionReference ref = new DataSectionReference(); ref.setOffset(data.position()); data.emitFloat(c); recordDataPatchInCode(ref); - Register ret = AMD64.xmm0; emitREX(false, ret.encoding, 0, 0); code.emitByte(0xF3); code.emitByte(0x0F); @@ -148,6 +165,26 @@ public class AMD64TestAssembler extends TestAssembler { return ret; } + public Register emitLoadDouble(double c) { + Register ret = AMD64.xmm0; + return emitLoadDouble(ret, c); + } + + public Register emitLoadDouble(Register ret, double c) { + DataSectionReference ref = new DataSectionReference(); + ref.setOffset(data.position()); + data.emitDouble(c); + + recordDataPatchInCode(ref); + emitREX(false, ret.encoding, 0, 0); + code.emitByte(0xF2); + code.emitByte(0x0F); + code.emitByte(0x10); // MOVSD xmm1, xmm2/m32 + code.emitByte(0x05 | ((ret.encoding & 0x7) << 3)); // xmm, [rip+offset] + code.emitInt(0xDEADDEAD); + return ret; + } + @Override public Register emitLoadPointer(HotSpotConstant c) { recordDataPatchInCode(new ConstantReference((VMConstant) c)); @@ -192,6 +229,10 @@ public class AMD64TestAssembler extends TestAssembler { @Override public StackSlot emitIntToStack(Register a) { StackSlot ret = newStackSlot(AMD64Kind.DWORD); + return emitIntToStack(ret, a); + } + + public StackSlot emitIntToStack(StackSlot ret, Register a) { // MOV r/m32,r32 emitModRMMemory(false, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16); return ret; @@ -200,6 +241,10 @@ public class AMD64TestAssembler extends TestAssembler { @Override public StackSlot emitLongToStack(Register a) { StackSlot ret = newStackSlot(AMD64Kind.QWORD); + return emitLongToStack(ret, a); + } + + public StackSlot emitLongToStack(StackSlot ret, Register a) { // MOV r/m64,r64 emitModRMMemory(true, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16); return ret; @@ -208,12 +253,40 @@ public class AMD64TestAssembler extends TestAssembler { @Override public StackSlot emitFloatToStack(Register a) { StackSlot ret = newStackSlot(AMD64Kind.SINGLE); + return emitFloatToStack(ret, a); + } + + public StackSlot emitFloatToStack(StackSlot ret, Register a) { emitREX(false, a.encoding, 0, 0); code.emitByte(0xF3); code.emitByte(0x0F); code.emitByte(0x11); // MOVSS xmm2/m32, xmm1 code.emitByte(0x85 | ((a.encoding & 0x7) << 3)); // [rbp+offset] - code.emitInt(ret.getRawOffset() + 16); + if (ret.getRawOffset() < 0) { + code.emitInt(ret.getRawOffset() + 16); + } else { + code.emitInt(-(frameSize - ret.getRawOffset()) + 16); + } + return ret; + } + + @Override + public StackSlot emitDoubleToStack(Register a) { + StackSlot ret = newStackSlot(AMD64Kind.DOUBLE); + return emitDoubleToStack(ret, a); + } + + public StackSlot emitDoubleToStack(StackSlot ret, Register a) { + emitREX(false, a.encoding, 0, 0); + code.emitByte(0xF2); + code.emitByte(0x0F); + code.emitByte(0x11); // MOVSD xmm2/m32, xmm1 + code.emitByte(0x85 | ((a.encoding & 0x7) << 3)); // [rbp+offset] + if (ret.getRawOffset() < 0) { + code.emitInt(ret.getRawOffset() + 16); + } else { + code.emitInt(-(frameSize - ret.getRawOffset()) + 16); + } return ret; } @@ -268,6 +341,14 @@ public class AMD64TestAssembler extends TestAssembler { code.emitByte(0xC3); // RET } + @Override + public void emitFloatRet(Register a) { + assert a == xmm0 : "Unimplemented move " + a; + emitMove(true, AMD64.rsp, AMD64.rbp); // MOV rsp, rbp + code.emitByte(0x58 | AMD64.rbp.encoding); // POP rbp + code.emitByte(0xC3); // RET + } + @Override public void emitPointerRet(Register a) { emitMove(true, AMD64.rax, a); // MOV rax, ... @@ -285,4 +366,64 @@ public class AMD64TestAssembler extends TestAssembler { code.emitByte(0x25); code.emitInt(0); } + + @Override + public void emitLoad(AllocatableValue av, Object prim) { + if (av instanceof RegisterValue) { + Register reg = ((RegisterValue) av).getRegister(); + if (prim instanceof Float) { + emitLoadFloat(reg, (Float) prim); + } else if (prim instanceof Double) { + emitLoadDouble(reg, (Double) prim); + } else if (prim instanceof Integer) { + emitLoadInt(reg, (Integer) prim); + } else if (prim instanceof Long) { + emitLoadLong(reg, (Long) prim); + } + } else if (av instanceof StackSlot) { + StackSlot slot = (StackSlot) av; + if (prim instanceof Float) { + emitFloatToStack(slot, emitLoadFloat((Float) prim)); + } else if (prim instanceof Double) { + emitDoubleToStack(slot, emitLoadDouble((Double) prim)); + } else if (prim instanceof Integer) { + emitIntToStack(slot, emitLoadInt((Integer) prim)); + } else if (prim instanceof Long) { + emitLongToStack(slot, emitLoadLong((Long) prim)); + } + assert false : "Unimplemented"; + } else { + throw new IllegalArgumentException("Unknown value " + av); + } + } + + @Override + public void emitCallPrologue(CallingConvention cc, Object... prim) { + emitGrowStack(cc.getStackSize()); + frameSize += cc.getStackSize(); + AllocatableValue[] args = cc.getArguments(); + // Do the emission in reverse, this avoids register collisons of xmm0 - which is used a + // scratch register when putting arguments on the stack. + for (int i = args.length - 1; i >= 0; i--) { + emitLoad(args[i], prim[i]); + } + } + + @Override + public void emitCall(long addr) { + Register target = emitLoadLong(addr); + code.emitByte(0xFF); // CALL r/m64 + int enc = target.encoding; + if (enc >= 8) { + code.emitByte(0x41); + enc -= 8; + } + code.emitByte(0xD0 | enc); + } + + @Override + public void emitCallEpilogue(CallingConvention cc) { + emitGrowStack(-cc.getStackSize()); + frameSize -= cc.getStackSize(); + } } diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/sparc/SPARCTestAssembler.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/sparc/SPARCTestAssembler.java index 26826fa2fc0..0ac920a4a59 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/sparc/SPARCTestAssembler.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/sparc/SPARCTestAssembler.java @@ -23,9 +23,12 @@ package jdk.vm.ci.code.test.sparc; +import jdk.vm.ci.code.CallingConvention; import jdk.vm.ci.code.CodeCacheProvider; import jdk.vm.ci.code.DebugInfo; import jdk.vm.ci.code.Register; +import jdk.vm.ci.code.Register.RegisterCategory; +import jdk.vm.ci.code.RegisterValue; import jdk.vm.ci.code.StackSlot; import jdk.vm.ci.code.site.ConstantReference; import jdk.vm.ci.code.site.DataSectionReference; @@ -36,6 +39,7 @@ import jdk.vm.ci.hotspot.HotSpotCompiledCode; import jdk.vm.ci.hotspot.HotSpotConstant; import jdk.vm.ci.hotspot.HotSpotForeignCallTarget; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; +import jdk.vm.ci.meta.AllocatableValue; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.VMConstant; import jdk.vm.ci.sparc.SPARC; @@ -44,6 +48,9 @@ import jdk.vm.ci.sparc.SPARCKind; public class SPARCTestAssembler extends TestAssembler { private static final int MASK13 = (1 << 13) - 1; + private static final Register scratchRegister = SPARC.g5; + private static final Register floatScratch = SPARC.f30; + private static final Register doubleScratch = SPARC.d62; public SPARCTestAssembler(CodeCacheProvider codeCache, TestHotSpotVMConfig config) { super(codeCache, config, 0, 16, SPARCKind.WORD, SPARC.l0, SPARC.l1, SPARC.l2, SPARC.l3, SPARC.l4, SPARC.l5, SPARC.l6, SPARC.l7); @@ -136,7 +143,7 @@ public class SPARCTestAssembler extends TestAssembler { return ret; } - private void loadIntToRegister(int c, Register ret) { + private Register loadIntToRegister(int c, Register ret) { int hi = c >>> 10; int lo = c & ((1 << 10) - 1); if (hi == 0) { @@ -147,6 +154,7 @@ public class SPARCTestAssembler extends TestAssembler { emitOp3(0b10, ret, 0b000010, ret, lo); // OR ret, lo, ret } } + return ret; } @Override @@ -164,12 +172,13 @@ public class SPARCTestAssembler extends TestAssembler { emitLoadPointerToRegister(ref, ret); } - public void emitLoadLongToRegister(long c, Register r) { + public Register emitLoadLongToRegister(long c, Register r) { if ((c & 0xFFFF_FFFFL) == c) { loadIntToRegister((int) c, r); } else { loadLongToRegister(c, r); } + return r; } private void emitPatchableSethi(Register ret, boolean wide) { @@ -185,16 +194,39 @@ public class SPARCTestAssembler extends TestAssembler { @Override public Register emitLoadFloat(float c) { + return emitLoadFloat(SPARC.f0, c); + } + + public Register emitLoadFloat(Register reg, float c) { + return emitLoadFloat(reg, c, newRegister()); + } + + public Register emitLoadFloat(Register reg, float c, Register scratch) { DataSectionReference ref = new DataSectionReference(); data.align(4); ref.setOffset(data.position()); data.emitFloat(c); - Register ptr = newRegister(); recordDataPatchInCode(ref); - emitPatchableSethi(ptr, true); - emitOp3(0b11, SPARC.f0, 0b100000, ptr, 0); // LDF [ptr+0], f0 - return SPARC.f0; + emitPatchableSethi(scratch, true); + emitOp3(0b11, reg, 0b100000, scratch, 0); // LDF [scratch+0], f0 + return reg; + } + + public Register emitLoadDouble(Register reg, double c) { + return emitLoadDouble(reg, c, newRegister()); + } + + public Register emitLoadDouble(Register reg, double c, Register scratch) { + DataSectionReference ref = new DataSectionReference(); + data.align(8); + ref.setOffset(data.position()); + data.emitDouble(c); + + recordDataPatchInCode(ref); + emitPatchableSethi(scratch, true); + emitOp3(0b11, reg, 0b100011, scratch, 0); // LDDF [ptr+0], f0 + return reg; } @Override @@ -240,24 +272,48 @@ public class SPARCTestAssembler extends TestAssembler { @Override public StackSlot emitIntToStack(Register a) { StackSlot ret = newStackSlot(SPARCKind.WORD); - // STW a, [fp+offset] - emitStore(0b000100, a, ret); + intToStack(a, ret); return ret; } + public void intToStack(Register a, StackSlot ret) { + // STW a, [(s|f)p+offset] + emitStore(0b000100, a, ret); + } + @Override public StackSlot emitLongToStack(Register a) { StackSlot ret = newStackSlot(SPARCKind.XWORD); - // STX a, [sp+offset] - emitStore(0b001110, a, ret); + longToStack(a, ret); return ret; } + public void longToStack(Register a, StackSlot ret) { + // STX a, [(f|s)p+offset] + emitStore(0b001110, a, ret); + } + @Override public StackSlot emitFloatToStack(Register a) { StackSlot ret = newStackSlot(SPARCKind.SINGLE); + floatToStack(a, ret); + return ret; + } + + public void floatToStack(Register a, StackSlot ret) { // STF a, [fp+offset] emitStore(0b100100, a, ret); + } + + @Override + public StackSlot emitDoubleToStack(Register a) { + StackSlot ret = newStackSlot(SPARCKind.DOUBLE); + return doubleToStack(a, ret); + } + + public StackSlot doubleToStack(Register a, StackSlot ret) { + // STD a, [(s|f)p+offset] + emitStore(0b100111, a, ret); return ret; } @@ -278,16 +334,22 @@ public class SPARCTestAssembler extends TestAssembler { } private void emitStore(int op3, Register a, StackSlot ret) { + Register base; + if (ret.getRawOffset() < 0) { + base = SPARC.fp; + } else { + base = SPARC.sp; + } int offset = ret.getRawOffset() + SPARC.STACK_BIAS; if (isSimm(offset, 13)) { // op3 a, [sp+offset] - emitOp3(0b11, a, op3, SPARC.fp, offset); + emitOp3(0b11, a, op3, base, offset); } else { assert a != SPARC.g3; Register r = SPARC.g3; loadLongToRegister(offset, r); // op3 a, [sp+g3] - emitOp3(0b11, a, op3, SPARC.fp, r); + emitOp3(0b11, a, op3, base, r); } } @@ -327,6 +389,13 @@ public class SPARCTestAssembler extends TestAssembler { emitPointerRet(a); } + @Override + public void emitFloatRet(Register a) { + assert a == SPARC.f0 : "Unimplemented"; + emitOp3(0b10, SPARC.g0, 0b111000, SPARC.i7, 8); // JMPL [i7+8], g0 + emitOp3(0b10, SPARC.g0, 0b111101, SPARC.g0, SPARC.g0); // RESTORE g0, g0, g0 + } + @Override public void emitPointerRet(Register a) { emitMove(SPARC.i0, a); @@ -349,4 +418,57 @@ public class SPARCTestAssembler extends TestAssembler { } return super.emitDataItem(c); } + + @Override + public void emitCall(long addr) { + Register dst = emitLoadLong(addr); + emitOp3(0b10, SPARC.o7, 0b111000, dst, 0); // JMPL [dst+0], o7 + emitNop(); + } + + @Override + public void emitLoad(AllocatableValue av, Object prim) { + if (av instanceof RegisterValue) { + Register reg = ((RegisterValue) av).getRegister(); + RegisterCategory cat = reg.getRegisterCategory(); + if (cat.equals(SPARC.FPUs)) { + emitLoadFloat(reg, (Float) prim, scratchRegister); + } else if (cat.equals(SPARC.FPUd)) { + emitLoadDouble(reg, (Double) prim, scratchRegister); + } else if (prim instanceof Integer) { + loadIntToRegister((Integer) prim, reg); + } else if (prim instanceof Long) { + loadLongToRegister((Long) prim, reg); + } + } else if (av instanceof StackSlot) { + StackSlot slot = (StackSlot) av; + if (prim instanceof Float) { + floatToStack(emitLoadFloat(floatScratch, (Float) prim, scratchRegister), slot); + } else if (prim instanceof Double) { + doubleToStack(emitLoadDouble(doubleScratch, (Double) prim, scratchRegister), slot); + } else if (prim instanceof Integer) { + intToStack(loadIntToRegister((Integer) prim, scratchRegister), slot); + } else if (prim instanceof Long) { + longToStack(emitLoadLongToRegister((Long) prim, scratchRegister), slot); + } + } else { + throw new IllegalArgumentException("Unknown value " + av); + } + } + + @Override + public void emitCallEpilogue(CallingConvention cc) { + // Nothing to do here. + } + + @Override + public void emitCallPrologue(CallingConvention cc, Object... prim) { + emitGrowStack(cc.getStackSize()); + frameSize += cc.getStackSize(); + AllocatableValue[] args = cc.getArguments(); + for (int i = 0; i < args.length; i++) { + emitLoad(args[i], prim[i]); + } + } + } From d442aea3c9d6b8bb750b3f5ce17eb97607aa9715 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 4 Jul 2016 16:28:27 +0200 Subject: [PATCH 029/108] 8056950: Compiled code (64-bit) on SPARC should sign extend INT parameters passed on registers to runtime or native methods Reviewed-by: thartmann, simonis --- hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp | 2 +- hotspot/src/share/vm/runtime/sharedRuntime.hpp | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp b/hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp index ddda08068bd..ba6d99cd8ea 100644 --- a/hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp @@ -32,7 +32,7 @@ const int StackAlignmentInBytes = (2*wordSize); // Indicates whether the C calling conventions require that // 32-bit integer argument values are extended to 64 bits. -const bool CCallingConventionRequiresIntsAsLongs = false; +const bool CCallingConventionRequiresIntsAsLongs = true; #define SUPPORTS_NATIVE_CX8 diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.hpp b/hotspot/src/share/vm/runtime/sharedRuntime.hpp index eb9797f26f5..02824bb485d 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp @@ -388,16 +388,6 @@ class SharedRuntime: AllStatic { static int c_calling_convention(const BasicType *sig_bt, VMRegPair *regs, VMRegPair *regs2, int total_args_passed); - // Compute the new number of arguments in the signature if 32 bit ints - // must be converted to longs. Needed if CCallingConventionRequiresIntsAsLongs - // is true. - static int convert_ints_to_longints_argcnt(int in_args_count, BasicType* in_sig_bt); - // Adapt a method's signature if it contains 32 bit integers that must - // be converted to longs. Needed if CCallingConventionRequiresIntsAsLongs - // is true. - static void convert_ints_to_longints(int i2l_argcnt, int& in_args_count, - BasicType*& in_sig_bt, VMRegPair*& in_regs); - static size_t trampoline_size(); static void generate_trampoline(MacroAssembler *masm, address destination); From b64a4110b33c91694536e096cc2570f8e87c596e Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Tue, 5 Jul 2016 07:57:09 +0200 Subject: [PATCH 030/108] 8159129: TestStringIntrinsicRangeChecks fails w/ No exception thrown for compressByte/inflateByte Need to convert char offsets to byte offsets before range check. Reviewed-by: vlivanov --- hotspot/src/share/vm/opto/library_call.cpp | 22 ++++++++++--------- .../TestStringIntrinsicRangeChecks.java | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index ffcddf60111..e8f6d7622df 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -1403,18 +1403,20 @@ bool LibraryCallKit::inline_string_copy(bool compress) { (!compress && src_elem == T_BYTE && (dst_elem == T_BYTE || dst_elem == T_CHAR)), "Unsupported array types for inline_string_copy"); - // Range checks - generate_string_range_check(src, src_offset, length, compress && src_elem == T_BYTE); - generate_string_range_check(dst, dst_offset, length, !compress && dst_elem == T_BYTE); - if (stopped()) { - return true; + // Convert char[] offsets to byte[] offsets + bool convert_src = (compress && src_elem == T_BYTE); + bool convert_dst = (!compress && dst_elem == T_BYTE); + if (convert_src) { + src_offset = _gvn.transform(new LShiftINode(src_offset, intcon(1))); + } else if (convert_dst) { + dst_offset = _gvn.transform(new LShiftINode(dst_offset, intcon(1))); } - // Convert char[] offsets to byte[] offsets - if (compress && src_elem == T_BYTE) { - src_offset = _gvn.transform(new LShiftINode(src_offset, intcon(1))); - } else if (!compress && dst_elem == T_BYTE) { - dst_offset = _gvn.transform(new LShiftINode(dst_offset, intcon(1))); + // Range checks + generate_string_range_check(src, src_offset, length, convert_src); + generate_string_range_check(dst, dst_offset, length, convert_dst); + if (stopped()) { + return true; } Node* src_start = array_element_address(src, src_offset, src_elem); diff --git a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java index d4e1fb0b40c..7c93f1405b6 100644 --- a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java +++ b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java @@ -30,7 +30,7 @@ * @library /compiler/patches /testlibrary /test/lib / * @build java.base/java.lang.Helper * @build compiler.intrinsics.string.TestStringIntrinsicRangeChecks - * @run main compiler.intrinsics.string.TestStringIntrinsicRangeChecks + * @run main/othervm -Xbatch -XX:CompileThreshold=100 -XX:-TieredCompilation compiler.intrinsics.string.TestStringIntrinsicRangeChecks */ package compiler.intrinsics.string; From 3e441ea1a22d49445b12554f05a91e0d6bf6e517 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Tue, 5 Jul 2016 17:57:20 -0700 Subject: [PATCH 031/108] 8159888: [JVMCI] the client VM build is broken when INCLUDE_JVMCI is defined Fix Client VM build Reviewed-by: twisti, kvn --- hotspot/.mx.jvmci/mx_jvmci.py | 2 +- hotspot/src/share/vm/compiler/oopMap.cpp | 16 +++------------- hotspot/src/share/vm/jvmci/jvmci_globals.cpp | 16 ++++++++++++++++ hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp | 2 +- .../src/share/vm/utilities/globalDefinitions.hpp | 2 +- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/hotspot/.mx.jvmci/mx_jvmci.py b/hotspot/.mx.jvmci/mx_jvmci.py index ede9029a5ba..daa27f5d607 100644 --- a/hotspot/.mx.jvmci/mx_jvmci.py +++ b/hotspot/.mx.jvmci/mx_jvmci.py @@ -64,7 +64,7 @@ _jvmciModes = { _jdkDebugLevels = ['release', 'fastdebug', 'slowdebug'] # TODO: add client once/if it can be built on 64-bit platforms -_jdkJvmVariants = ['server'] +_jdkJvmVariants = ['server', 'client'] """ Translation table from mx_jvmci:8 --vmbuild values to mx_jvmci:9 --jdk-debug-level values. diff --git a/hotspot/src/share/vm/compiler/oopMap.cpp b/hotspot/src/share/vm/compiler/oopMap.cpp index 197324a4ac4..378198ecb9b 100644 --- a/hotspot/src/share/vm/compiler/oopMap.cpp +++ b/hotspot/src/share/vm/compiler/oopMap.cpp @@ -273,14 +273,9 @@ class DoNothingClosure: public OopClosure { static DoNothingClosure do_nothing; static void add_derived_oop(oop* base, oop* derived) { -#ifndef TIERED +#if !defined(TIERED) && !defined(INCLUDE_JVMCI) COMPILER1_PRESENT(ShouldNotReachHere();) -#if INCLUDE_JVMCI - if (UseJVMCICompiler) { - ShouldNotReachHere(); - } -#endif -#endif // TIERED +#endif // !defined(TIERED) && !defined(INCLUDE_JVMCI) #if defined(COMPILER2) || INCLUDE_JVMCI DerivedPointerTable::add(derived, base); #endif // COMPILER2 || INCLUDE_JVMCI @@ -473,13 +468,8 @@ void OopMapSet::update_register_map(const frame *fr, RegisterMap *reg_map) { #ifndef PRODUCT bool ImmutableOopMap::has_derived_pointer() const { -#ifndef TIERED +#if !defined(TIERED) && !defined(INCLUDE_JVMCI) COMPILER1_PRESENT(return false); -#if INCLUDE_JVMCI - if (UseJVMCICompiler) { - return false; - } -#endif #endif // !TIERED #if defined(COMPILER2) || INCLUDE_JVMCI OopMapStream oms(this,OopMapValue::derived_oop_value); diff --git a/hotspot/src/share/vm/jvmci/jvmci_globals.cpp b/hotspot/src/share/vm/jvmci/jvmci_globals.cpp index 12dd0c1eeca..e76503668f8 100644 --- a/hotspot/src/share/vm/jvmci/jvmci_globals.cpp +++ b/hotspot/src/share/vm/jvmci/jvmci_globals.cpp @@ -148,6 +148,22 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() { #undef JVMCI_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE #undef JVMCI_EXPERIMENTAL_FLAG_VALUE_CHANGED_CHECK_CODE +#ifndef TIERED + // JVMCI is only usable as a jit compiler if the VM supports tiered compilation. +#define JVMCI_CHECK_TIERED_ONLY_FLAG(FLAG) \ + if (!FLAG_IS_DEFAULT(FLAG)) { \ + jio_fprintf(defaultStream::error_stream(), "VM option '%s' cannot be set in non-tiered VM\n", #FLAG); \ + return false; \ + } + JVMCI_CHECK_TIERED_ONLY_FLAG(UseJVMCICompiler) + JVMCI_CHECK_TIERED_ONLY_FLAG(BootstrapJVMCI) + JVMCI_CHECK_TIERED_ONLY_FLAG(PrintBootstrap) + JVMCI_CHECK_TIERED_ONLY_FLAG(JVMCIThreads) + JVMCI_CHECK_TIERED_ONLY_FLAG(JVMCIHostThreads) + JVMCI_CHECK_TIERED_ONLY_FLAG(JVMCICountersExcludeCompiler) +#undef JVMCI_CHECK_TIERED_ONLY_FLAG +#endif + return true; } diff --git a/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp b/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp index 9244cd46cda..b645ebe7d30 100644 --- a/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp +++ b/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp @@ -550,7 +550,7 @@ declare_function(os::javaTimeNanos) \ \ declare_function(Deoptimization::fetch_unroll_info) \ - COMPILER2_PRESENT(declare_function(Deoptimization::uncommon_trap)) \ + declare_function(Deoptimization::uncommon_trap) \ declare_function(Deoptimization::unpack_frames) \ \ declare_function(JVMCIRuntime::new_instance) \ diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp index 4c9e513c65a..3363bca7ba4 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp @@ -951,7 +951,7 @@ enum CompLevel { CompLevel_full_profile = 3, // C1, invocation & backedge counters + mdo CompLevel_full_optimization = 4, // C2, Shark or JVMCI -#if defined(COMPILER2) || defined(SHARK) || INCLUDE_JVMCI +#if defined(COMPILER2) || defined(SHARK) CompLevel_highest_tier = CompLevel_full_optimization, // pure C2 and tiered or JVMCI and tiered #elif defined(COMPILER1) CompLevel_highest_tier = CompLevel_simple, // pure C1 or JVMCI From 4c31d5f7450af82e47d6884a85806616fa171c4f Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Wed, 6 Jul 2016 15:05:28 +0300 Subject: [PATCH 032/108] 8160360: Mismatched field loads are folded in LoadNode::Value Reviewed-by: kvn, thartmann --- hotspot/src/share/vm/opto/library_call.cpp | 2 ++ hotspot/src/share/vm/opto/memnode.cpp | 9 ++++----- hotspot/src/share/vm/opto/type.hpp | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index e8f6d7622df..e579348281c 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -2337,6 +2337,8 @@ bool LibraryCallKit::inline_unsafe_access(bool is_store, const BasicType type, c return false; } mismatched = (bt != type); + } else if (alias_type->adr_type() == TypeOopPtr::BOTTOM) { + mismatched = true; // conservatively mark all "wide" on-heap accesses as mismatched } // First guess at the value type. diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp index f0d588a6d1a..1ea3bd2c902 100644 --- a/hotspot/src/share/vm/opto/memnode.cpp +++ b/hotspot/src/share/vm/opto/memnode.cpp @@ -1713,9 +1713,6 @@ const Type* LoadNode::Value(PhaseGVN* phase) const { } } } else if (tp->base() == Type::InstPtr) { - ciEnv* env = C->env(); - const TypeInstPtr* tinst = tp->is_instptr(); - ciKlass* klass = tinst->klass(); assert( off != Type::OffsetBot || // arrays can be cast to Objects tp->is_oopptr()->klass()->is_java_lang_Object() || @@ -1723,9 +1720,11 @@ const Type* LoadNode::Value(PhaseGVN* phase) const { C->has_unsafe_access(), "Field accesses must be precise" ); // For oop loads, we expect the _type to be precise. - // Optimizations for constant objects + + // Optimize loads from constant fields. + const TypeInstPtr* tinst = tp->is_instptr(); ciObject* const_oop = tinst->const_oop(); - if (const_oop != NULL && const_oop->is_instance()) { + if (!is_mismatched_access() && off != Type::OffsetBot && const_oop != NULL && const_oop->is_instance()) { const Type* con_type = Type::make_constant_from_field(const_oop->as_instance(), off, is_unsigned(), memory_type()); if (con_type != NULL) { return con_type; diff --git a/hotspot/src/share/vm/opto/type.hpp b/hotspot/src/share/vm/opto/type.hpp index 4c79e900bf2..07b91cb0245 100644 --- a/hotspot/src/share/vm/opto/type.hpp +++ b/hotspot/src/share/vm/opto/type.hpp @@ -936,7 +936,7 @@ public: }; //------------------------------TypeOopPtr------------------------------------- -// Some kind of oop (Java pointer), either klass or instance or array. +// Some kind of oop (Java pointer), either instance or array. class TypeOopPtr : public TypePtr { protected: TypeOopPtr(TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id, From 8afad6f4340866552b0f2230688b80b106f56fde Mon Sep 17 00:00:00 2001 From: Tatiana Pivovarova Date: Thu, 7 Jul 2016 13:53:52 +0300 Subject: [PATCH 033/108] 8160773: error: package jdk.internal.jimage does not exist Reviewed-by: dlong --- hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java | 3 ++- hotspot/test/testlibrary_tests/ctw/ClassesListTest.java | 3 ++- hotspot/test/testlibrary_tests/ctw/JarDirTest.java | 3 ++- hotspot/test/testlibrary_tests/ctw/JarsTest.java | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java b/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java index a11436606b2..eb29c5bfb58 100644 --- a/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java +++ b/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java @@ -25,7 +25,8 @@ * @test * @bug 8012447 * @library /testlibrary /test/lib /testlibrary/ctw/src - * @modules java.base/jdk.internal.misc + * @modules java.base/jdk.internal.jimage + * java.base/jdk.internal.misc * java.base/jdk.internal.reflect * java.management * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar diff --git a/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java b/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java index f9feeaadc2c..873180c5300 100644 --- a/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java +++ b/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java @@ -25,7 +25,8 @@ * @test * @bug 8012447 * @library /testlibrary /test/lib /testlibrary/ctw/src - * @modules java.base/jdk.internal.misc + * @modules java.base/jdk.internal.jimage + * java.base/jdk.internal.misc * java.base/jdk.internal.reflect * java.management * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar diff --git a/hotspot/test/testlibrary_tests/ctw/JarDirTest.java b/hotspot/test/testlibrary_tests/ctw/JarDirTest.java index 7bc97e6966c..57f12a6c4b5 100644 --- a/hotspot/test/testlibrary_tests/ctw/JarDirTest.java +++ b/hotspot/test/testlibrary_tests/ctw/JarDirTest.java @@ -25,7 +25,8 @@ * @test * @bug 8012447 * @library /testlibrary /test/lib /testlibrary/ctw/src - * @modules java.base/jdk.internal.misc + * @modules java.base/jdk.internal.jimage + * java.base/jdk.internal.misc * java.base/jdk.internal.reflect * java.compiler * java.management diff --git a/hotspot/test/testlibrary_tests/ctw/JarsTest.java b/hotspot/test/testlibrary_tests/ctw/JarsTest.java index e35791201b8..e9bc05c1201 100644 --- a/hotspot/test/testlibrary_tests/ctw/JarsTest.java +++ b/hotspot/test/testlibrary_tests/ctw/JarsTest.java @@ -25,7 +25,8 @@ * @test * @bug 8012447 * @library /testlibrary /test/lib /testlibrary/ctw/src - * @modules java.base/jdk.internal.misc + * @modules java.base/jdk.internal.jimage + * java.base/jdk.internal.misc * java.base/jdk.internal.reflect * java.compiler * java.management From e22a63d1c635b3289913453c9452feb95b60158e Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Thu, 7 Jul 2016 15:07:13 +0100 Subject: [PATCH 034/108] 8141633: Implement VarHandles/Unsafe intrinsics on AArch64 Reviewed-by: roland --- hotspot/src/cpu/aarch64/vm/aarch64.ad | 322 +++++++++++++++++- .../aarch64/vm/c1_LIRAssembler_aarch64.cpp | 4 +- hotspot/src/cpu/aarch64/vm/cas.m4 | 109 ++++++ .../cpu/aarch64/vm/macroAssembler_aarch64.cpp | 30 +- .../cpu/aarch64/vm/macroAssembler_aarch64.hpp | 5 +- 5 files changed, 444 insertions(+), 26 deletions(-) create mode 100644 hotspot/src/cpu/aarch64/vm/cas.m4 diff --git a/hotspot/src/cpu/aarch64/vm/aarch64.ad b/hotspot/src/cpu/aarch64/vm/aarch64.ad index 47bd7a6745a..50c6d33f39d 100644 --- a/hotspot/src/cpu/aarch64/vm/aarch64.ad +++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad @@ -1942,12 +1942,35 @@ source %{ bool is_CAS(int opcode) { - return (opcode == Op_CompareAndSwapI || - opcode == Op_CompareAndSwapL || - opcode == Op_CompareAndSwapN || - opcode == Op_CompareAndSwapP); + switch(opcode) { + // We handle these + case Op_CompareAndSwapI: + case Op_CompareAndSwapL: + case Op_CompareAndSwapP: + case Op_CompareAndSwapN: + // case Op_CompareAndSwapB: + // case Op_CompareAndSwapS: + return true; + // These are TBD + case Op_WeakCompareAndSwapB: + case Op_WeakCompareAndSwapS: + case Op_WeakCompareAndSwapI: + case Op_WeakCompareAndSwapL: + case Op_WeakCompareAndSwapP: + case Op_WeakCompareAndSwapN: + case Op_CompareAndExchangeB: + case Op_CompareAndExchangeS: + case Op_CompareAndExchangeI: + case Op_CompareAndExchangeL: + case Op_CompareAndExchangeP: + case Op_CompareAndExchangeN: + return false; + default: + return false; + } } + // leading_to_trailing // //graph traversal helper which detects the normal case Mem feed from @@ -4238,14 +4261,16 @@ encode %{ MacroAssembler _masm(&cbuf); guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding"); __ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register, - Assembler::xword, /*acquire*/ false, /*release*/ true); + Assembler::xword, /*acquire*/ false, /*release*/ true, + /*weak*/ false, noreg); %} enc_class aarch64_enc_cmpxchgw(memory mem, iRegINoSp oldval, iRegINoSp newval) %{ MacroAssembler _masm(&cbuf); guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding"); __ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register, - Assembler::word, /*acquire*/ false, /*release*/ true); + Assembler::word, /*acquire*/ false, /*release*/ true, + /*weak*/ false, noreg); %} @@ -4257,14 +4282,16 @@ encode %{ MacroAssembler _masm(&cbuf); guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding"); __ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register, - Assembler::xword, /*acquire*/ true, /*release*/ true); + Assembler::xword, /*acquire*/ true, /*release*/ true, + /*weak*/ false, noreg); %} enc_class aarch64_enc_cmpxchgw_acq(memory mem, iRegINoSp oldval, iRegINoSp newval) %{ MacroAssembler _masm(&cbuf); guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding"); __ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register, - Assembler::word, /*acquire*/ true, /*release*/ true); + Assembler::word, /*acquire*/ true, /*release*/ true, + /*weak*/ false, noreg); %} @@ -5803,6 +5830,7 @@ operand iRegLNoSp() %{ constraint(ALLOC_IN_RC(no_special_reg)); match(RegL); + match(iRegL_R0); format %{ %} interface(REG_INTER); %} @@ -5924,6 +5952,39 @@ operand iRegP_R10() interface(REG_INTER); %} +// Long 64 bit Register R0 only +operand iRegL_R0() +%{ + constraint(ALLOC_IN_RC(r0_reg)); + match(RegL); + match(iRegLNoSp); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +// Long 64 bit Register R2 only +operand iRegL_R2() +%{ + constraint(ALLOC_IN_RC(r2_reg)); + match(RegL); + match(iRegLNoSp); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +// Long 64 bit Register R3 only +operand iRegL_R3() +%{ + constraint(ALLOC_IN_RC(r3_reg)); + match(RegL); + match(iRegLNoSp); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + // Long 64 bit Register R11 only operand iRegL_R11() %{ @@ -5980,7 +6041,7 @@ operand iRegI_R3() %} -// Register R2 only +// Register R4 only operand iRegI_R4() %{ constraint(ALLOC_IN_RC(int_r4_reg)); @@ -6004,6 +6065,33 @@ operand iRegN() interface(REG_INTER); %} +operand iRegN_R0() +%{ + constraint(ALLOC_IN_RC(r0_reg)); + match(iRegN); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand iRegN_R2() +%{ + constraint(ALLOC_IN_RC(r2_reg)); + match(iRegN); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand iRegN_R3() +%{ + constraint(ALLOC_IN_RC(r3_reg)); + match(iRegN); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + // Integer 64 bit Register not Special operand iRegNNoSp() %{ @@ -9390,12 +9478,12 @@ instruct storeIConditional(indirect mem, iRegINoSp oldval, iRegINoSp newval, rFl ins_pipe(pipe_slow); %} -// XXX No flag versions for CompareAndSwap{I,L,P,N} because matcher -// can't match them - // standard CompareAndSwapX when we are using barriers // these have higher priority than the rules selected by a predicate +// XXX No flag versions for CompareAndSwap{I,L,P,N} because matcher +// can't match them + instruct compareAndSwapI(iRegINoSp res, indirect mem, iRegINoSp oldval, iRegINoSp newval, rFlagsReg cr) %{ match(Set res (CompareAndSwapI mem (Binary oldval newval))); @@ -9547,6 +9635,216 @@ instruct compareAndSwapNAcq(iRegINoSp res, indirect mem, iRegNNoSp oldval, iRegN %} +// --------------------------------------------------------------------- +// Sundry CAS operations. Note that release is always true, +// regardless of the memory ordering of the CAS. This is because we +// need the volatile case to be sequentially consistent but there is +// no trailing StoreLoad barrier emitted by C2. Unfortunately we +// can't check the type of memory ordering here, so we always emit a +// STLXR. + +// This section is generated from aarch64_ad_cas.m4 + + +instruct compareAndExchangeB(iRegI_R0 res, indirect mem, iRegI_R2 oldval, iRegI_R3 newval, rFlagsReg cr) %{ + match(Set res (CompareAndExchangeB mem (Binary oldval newval))); + ins_cost(2 * VOLATILE_REF_COST); + effect(KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# (byte, weak) if $mem == $oldval then $mem <-- $newval" + %} + ins_encode %{ + __ uxtbw(rscratch2, $oldval$$Register); + __ cmpxchg($mem$$Register, rscratch2, $newval$$Register, + Assembler::byte, /*acquire*/ false, /*release*/ true, + /*weak*/ false, $res$$Register); + __ sxtbw($res$$Register, $res$$Register); + %} + ins_pipe(pipe_slow); +%} + +instruct compareAndExchangeS(iRegI_R0 res, indirect mem, iRegI_R2 oldval, iRegI_R3 newval, rFlagsReg cr) %{ + match(Set res (CompareAndExchangeS mem (Binary oldval newval))); + ins_cost(2 * VOLATILE_REF_COST); + effect(KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# (short, weak) if $mem == $oldval then $mem <-- $newval" + %} + ins_encode %{ + __ uxthw(rscratch2, $oldval$$Register); + __ cmpxchg($mem$$Register, rscratch2, $newval$$Register, + Assembler::halfword, /*acquire*/ false, /*release*/ true, + /*weak*/ false, $res$$Register); + __ sxthw($res$$Register, $res$$Register); + %} + ins_pipe(pipe_slow); +%} + +instruct compareAndExchangeI(iRegI_R0 res, indirect mem, iRegI_R2 oldval, iRegI_R3 newval, rFlagsReg cr) %{ + match(Set res (CompareAndExchangeI mem (Binary oldval newval))); + ins_cost(2 * VOLATILE_REF_COST); + effect(KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# (int, weak) if $mem == $oldval then $mem <-- $newval" + %} + ins_encode %{ + __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register, + Assembler::word, /*acquire*/ false, /*release*/ true, + /*weak*/ false, $res$$Register); + %} + ins_pipe(pipe_slow); +%} + +instruct compareAndExchangeL(iRegL_R0 res, indirect mem, iRegL_R2 oldval, iRegL_R3 newval, rFlagsReg cr) %{ + match(Set res (CompareAndExchangeL mem (Binary oldval newval))); + ins_cost(2 * VOLATILE_REF_COST); + effect(KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# (long, weak) if $mem == $oldval then $mem <-- $newval" + %} + ins_encode %{ + __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register, + Assembler::xword, /*acquire*/ false, /*release*/ true, + /*weak*/ false, $res$$Register); + %} + ins_pipe(pipe_slow); +%} + +instruct compareAndExchangeN(iRegN_R0 res, indirect mem, iRegN_R2 oldval, iRegN_R3 newval, rFlagsReg cr) %{ + match(Set res (CompareAndExchangeN mem (Binary oldval newval))); + ins_cost(2 * VOLATILE_REF_COST); + effect(KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# (narrow oop, weak) if $mem == $oldval then $mem <-- $newval" + %} + ins_encode %{ + __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register, + Assembler::word, /*acquire*/ false, /*release*/ true, + /*weak*/ false, $res$$Register); + %} + ins_pipe(pipe_slow); +%} + +instruct compareAndExchangeP(iRegP_R0 res, indirect mem, iRegP_R2 oldval, iRegP_R3 newval, rFlagsReg cr) %{ + match(Set res (CompareAndExchangeP mem (Binary oldval newval))); + ins_cost(2 * VOLATILE_REF_COST); + effect(KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# (ptr, weak) if $mem == $oldval then $mem <-- $newval" + %} + ins_encode %{ + __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register, + Assembler::xword, /*acquire*/ false, /*release*/ true, + /*weak*/ false, $res$$Register); + %} + ins_pipe(pipe_slow); +%} + +instruct weakCompareAndSwapB(iRegINoSp res, indirect mem, iRegI oldval, iRegI newval, rFlagsReg cr) %{ + match(Set res (WeakCompareAndSwapB mem (Binary oldval newval))); + ins_cost(2 * VOLATILE_REF_COST); + effect(KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# (byte, weak) if $mem == $oldval then $mem <-- $newval" + "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)" + %} + ins_encode %{ + __ uxtbw(rscratch2, $oldval$$Register); + __ cmpxchg($mem$$Register, rscratch2, $newval$$Register, + Assembler::byte, /*acquire*/ false, /*release*/ true, + /*weak*/ true, noreg); + __ csetw($res$$Register, Assembler::EQ); + %} + ins_pipe(pipe_slow); +%} + +instruct weakCompareAndSwapS(iRegINoSp res, indirect mem, iRegI oldval, iRegI newval, rFlagsReg cr) %{ + match(Set res (WeakCompareAndSwapS mem (Binary oldval newval))); + ins_cost(2 * VOLATILE_REF_COST); + effect(KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# (short, weak) if $mem == $oldval then $mem <-- $newval" + "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)" + %} + ins_encode %{ + __ uxthw(rscratch2, $oldval$$Register); + __ cmpxchg($mem$$Register, rscratch2, $newval$$Register, + Assembler::halfword, /*acquire*/ false, /*release*/ true, + /*weak*/ true, noreg); + __ csetw($res$$Register, Assembler::EQ); + %} + ins_pipe(pipe_slow); +%} + +instruct weakCompareAndSwapI(iRegINoSp res, indirect mem, iRegI oldval, iRegI newval, rFlagsReg cr) %{ + match(Set res (WeakCompareAndSwapI mem (Binary oldval newval))); + ins_cost(2 * VOLATILE_REF_COST); + effect(KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# (int, weak) if $mem == $oldval then $mem <-- $newval" + "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)" + %} + ins_encode %{ + __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register, + Assembler::word, /*acquire*/ false, /*release*/ true, + /*weak*/ true, noreg); + __ csetw($res$$Register, Assembler::EQ); + %} + ins_pipe(pipe_slow); +%} + +instruct weakCompareAndSwapL(iRegINoSp res, indirect mem, iRegL oldval, iRegL newval, rFlagsReg cr) %{ + match(Set res (WeakCompareAndSwapL mem (Binary oldval newval))); + ins_cost(2 * VOLATILE_REF_COST); + effect(KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# (long, weak) if $mem == $oldval then $mem <-- $newval" + "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)" + %} + ins_encode %{ + __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register, + Assembler::xword, /*acquire*/ false, /*release*/ true, + /*weak*/ true, noreg); + __ csetw($res$$Register, Assembler::EQ); + %} + ins_pipe(pipe_slow); +%} + +instruct weakCompareAndSwapN(iRegINoSp res, indirect mem, iRegN oldval, iRegN newval, rFlagsReg cr) %{ + match(Set res (WeakCompareAndSwapN mem (Binary oldval newval))); + ins_cost(2 * VOLATILE_REF_COST); + effect(KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# (narrow oop, weak) if $mem == $oldval then $mem <-- $newval" + "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)" + %} + ins_encode %{ + __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register, + Assembler::word, /*acquire*/ false, /*release*/ true, + /*weak*/ true, noreg); + __ csetw($res$$Register, Assembler::EQ); + %} + ins_pipe(pipe_slow); +%} + +instruct weakCompareAndSwapP(iRegINoSp res, indirect mem, iRegP oldval, iRegP newval, rFlagsReg cr) %{ + match(Set res (WeakCompareAndSwapP mem (Binary oldval newval))); + ins_cost(2 * VOLATILE_REF_COST); + effect(KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# (ptr, weak) if $mem == $oldval then $mem <-- $newval" + "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)" + %} + ins_encode %{ + __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register, + Assembler::xword, /*acquire*/ false, /*release*/ true, + /*weak*/ true, noreg); + __ csetw($res$$Register, Assembler::EQ); + %} + ins_pipe(pipe_slow); +%} +// --------------------------------------------------------------------- + instruct get_and_setI(indirect mem, iRegINoSp newv, iRegI prev) %{ match(Set prev (GetAndSetI mem newv)); format %{ "atomic_xchgw $prev, $newv, [$mem]" %} diff --git a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp index e34c6fa2691..a2d1631bf54 100644 --- a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp @@ -1556,13 +1556,13 @@ void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) { } void LIR_Assembler::casw(Register addr, Register newval, Register cmpval) { - __ cmpxchg(addr, cmpval, newval, Assembler::word, /* acquire*/ true, /* release*/ true, rscratch1); + __ cmpxchg(addr, cmpval, newval, Assembler::word, /* acquire*/ true, /* release*/ true, /* weak*/ false, rscratch1); __ cset(rscratch1, Assembler::NE); __ membar(__ AnyAny); } void LIR_Assembler::casl(Register addr, Register newval, Register cmpval) { - __ cmpxchg(addr, cmpval, newval, Assembler::xword, /* acquire*/ true, /* release*/ true, rscratch1); + __ cmpxchg(addr, cmpval, newval, Assembler::xword, /* acquire*/ true, /* release*/ true, /* weak*/ false, rscratch1); __ cset(rscratch1, Assembler::NE); __ membar(__ AnyAny); } diff --git a/hotspot/src/cpu/aarch64/vm/cas.m4 b/hotspot/src/cpu/aarch64/vm/cas.m4 new file mode 100644 index 00000000000..eb276df3880 --- /dev/null +++ b/hotspot/src/cpu/aarch64/vm/cas.m4 @@ -0,0 +1,109 @@ +// Sundry CAS operations. Note that release is always true, +// regardless of the memory ordering of the CAS. This is because we +// need the volatile case to be sequentially consistent but there is +// no trailing StoreLoad barrier emitted by C2. Unfortunately we +// can't check the type of memory ordering here, so we always emit a +// STLXR. + +define(`CAS_INSN', +` +instruct compareAndExchange$1$5(iReg$2_R0 res, indirect mem, iReg$2_R2 oldval, iReg$2_R3 newval, rFlagsReg cr) %{ + match(Set res (CompareAndExchange$1 mem (Binary oldval newval))); + ifelse($5,Acq,' predicate(needs_acquiring_load_exclusive(n)); + ins_cost(VOLATILE_REF_COST);`,' ins_cost(2 * VOLATILE_REF_COST);`) + effect(KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval" + %} + ins_encode %{ + __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register, + Assembler::$4, /*acquire*/ ifelse($5,Acq,true,false), /*release*/ true, + /*weak*/ false, $res$$Register); + %} + ins_pipe(pipe_slow); +%}')dnl +define(`CAS_INSN4', +` +instruct compareAndExchange$1$7(iReg$2_R0 res, indirect mem, iReg$2_R2 oldval, iReg$2_R3 newval, rFlagsReg cr) %{ + match(Set res (CompareAndExchange$1 mem (Binary oldval newval))); + ifelse($7,Acq,' predicate(needs_acquiring_load_exclusive(n)); + ins_cost(VOLATILE_REF_COST);`,' ins_cost(2 * VOLATILE_REF_COST);`) + effect(KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval" + %} + ins_encode %{ + __ $5(rscratch2, $oldval$$Register); + __ cmpxchg($mem$$Register, rscratch2, $newval$$Register, + Assembler::$4, /*acquire*/ ifelse($5,Acq,true,false), /*release*/ true, + /*weak*/ false, $res$$Register); + __ $6($res$$Register, $res$$Register); + %} + ins_pipe(pipe_slow); +%}')dnl +CAS_INSN4(B,I,byte,byte,uxtbw,sxtbw) +CAS_INSN4(S,I,short,halfword,uxthw,sxthw) +CAS_INSN(I,I,int,word) +CAS_INSN(L,L,long,xword) +CAS_INSN(N,N,narrow oop,word) +CAS_INSN(P,P,ptr,xword) +dnl +dnl CAS_INSN4(B,I,byte,byte,uxtbw,sxtbw,Acq) +dnl CAS_INSN4(S,I,short,halfword,uxthw,sxthw,Acq) +dnl CAS_INSN(I,I,int,word,Acq) +dnl CAS_INSN(L,L,long,xword,Acq) +dnl CAS_INSN(N,N,narrow oop,word,Acq) +dnl CAS_INSN(P,P,ptr,xword,Acq) +dnl +define(`CAS_INSN2', +` +instruct weakCompareAndSwap$1$6(iRegINoSp res, indirect mem, iReg$2 oldval, iReg$2 newval, rFlagsReg cr) %{ + match(Set res (WeakCompareAndSwap$1 mem (Binary oldval newval))); + ifelse($6,Acq,' predicate(needs_acquiring_load_exclusive(n)); + ins_cost(VOLATILE_REF_COST);`,' ins_cost(2 * VOLATILE_REF_COST);`) + effect(KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval" + "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)" + %} + ins_encode %{ + __ uxt$5(rscratch2, $oldval$$Register); + __ cmpxchg($mem$$Register, rscratch2, $newval$$Register, + Assembler::$4, /*acquire*/ ifelse($6,Acq,true,false), /*release*/ true, + /*weak*/ true, noreg); + __ csetw($res$$Register, Assembler::EQ); + %} + ins_pipe(pipe_slow); +%}')dnl +define(`CAS_INSN3', +` +instruct weakCompareAndSwap$1$5(iRegINoSp res, indirect mem, iReg$2 oldval, iReg$2 newval, rFlagsReg cr) %{ + match(Set res (WeakCompareAndSwap$1 mem (Binary oldval newval))); + ifelse($5,Acq,' predicate(needs_acquiring_load_exclusive(n)); + ins_cost(VOLATILE_REF_COST);`,' ins_cost(2 * VOLATILE_REF_COST);`) + effect(KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval" + "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)" + %} + ins_encode %{ + __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register, + Assembler::$4, /*acquire*/ ifelse($5,Acq,true,false), /*release*/ true, + /*weak*/ true, noreg); + __ csetw($res$$Register, Assembler::EQ); + %} + ins_pipe(pipe_slow); +%}')dnl +CAS_INSN2(B,I,byte,byte,bw) +CAS_INSN2(S,I,short,halfword,hw) +CAS_INSN3(I,I,int,word) +CAS_INSN3(L,L,long,xword) +CAS_INSN3(N,N,narrow oop,word) +CAS_INSN3(P,P,ptr,xword) +dnl CAS_INSN2(B,I,byte,byte,bw,Acq) +dnl CAS_INSN2(S,I,short,halfword,hw,Acq) +dnl CAS_INSN3(I,I,int,word,Acq) +dnl CAS_INSN3(L,L,long,xword,Acq) +dnl CAS_INSN3(N,N,narrow oop,word,Acq) +dnl CAS_INSN3(P,P,ptr,xword,Acq) +dnl diff --git a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp index 430119dee39..f6227f19166 100644 --- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp @@ -2141,30 +2141,40 @@ void MacroAssembler::cmpxchgw(Register oldv, Register newv, Register addr, Regis b(*fail); } -// A generic CAS; success or failure is in the EQ flag. +// A generic CAS; success or failure is in the EQ flag. A weak CAS +// doesn't retry and may fail spuriously. If the oldval is wanted, +// Pass a register for the result, otherwise pass noreg. + +// Clobbers rscratch1 void MacroAssembler::cmpxchg(Register addr, Register expected, Register new_val, enum operand_size size, bool acquire, bool release, - Register tmp) { + bool weak, + Register result) { + if (result == noreg) result = rscratch1; if (UseLSE) { - mov(tmp, expected); - lse_cas(tmp, new_val, addr, size, acquire, release, /*not_pair*/ true); - cmp(tmp, expected); + mov(result, expected); + lse_cas(result, new_val, addr, size, acquire, release, /*not_pair*/ true); + cmp(result, expected); } else { BLOCK_COMMENT("cmpxchg {"); Label retry_load, done; if ((VM_Version::features() & VM_Version::CPU_STXR_PREFETCH)) prfm(Address(addr), PSTL1STRM); bind(retry_load); - load_exclusive(tmp, addr, size, acquire); + load_exclusive(result, addr, size, acquire); if (size == xword) - cmp(tmp, expected); + cmp(result, expected); else - cmpw(tmp, expected); + cmpw(result, expected); br(Assembler::NE, done); - store_exclusive(tmp, new_val, addr, size, release); - cbnzw(tmp, retry_load); + store_exclusive(rscratch1, new_val, addr, size, release); + if (weak) { + cmpw(rscratch1, 0u); // If the store fails, return NE to our caller. + } else { + cbnzw(rscratch1, retry_load); + } bind(done); BLOCK_COMMENT("} cmpxchg"); } diff --git a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp index d338ea4bf7c..51a47b7a83e 100644 --- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp @@ -995,10 +995,11 @@ public: } // A generic CAS; success or failure is in the EQ flag. + // Clobbers rscratch1 void cmpxchg(Register addr, Register expected, Register new_val, enum operand_size size, - bool acquire, bool release, - Register tmp = rscratch1); + bool acquire, bool release, bool weak, + Register result); // Calls From bb341f3b1152446001fde23cd69f074508f6f241 Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Fri, 8 Jul 2016 17:11:37 +0100 Subject: [PATCH 035/108] 8161072: AArch64: jtreg compiler/uncommontrap/TestDeoptOOM failure Reviewed-by: roland --- .../templateInterpreterGenerator_aarch64.cpp | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp index 4c54f8e357e..293024c9826 100644 --- a/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp @@ -437,6 +437,21 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, __ restore_locals(); __ restore_constant_pool_cache(); __ get_method(rmethod); + __ get_dispatch(); + + // Calculate stack limit + __ ldr(rscratch1, Address(rmethod, Method::const_offset())); + __ ldrh(rscratch1, Address(rscratch1, ConstMethod::max_stack_offset())); + __ add(rscratch1, rscratch1, frame::interpreter_frame_monitor_size() + 2); + __ ldr(rscratch2, + Address(rfp, frame::interpreter_frame_initial_sp_offset * wordSize)); + __ sub(rscratch1, rscratch2, rscratch1, ext::uxtx, 3); + __ andr(sp, rscratch1, -16); + + // Restore expression stack pointer + __ ldr(esp, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize)); + // NULL last_sp until next java call + __ str(zr, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize)); #if INCLUDE_JVMCI // Check if we need to take lock at entry of synchronized method. @@ -463,22 +478,6 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, __ bind(L); } - __ get_dispatch(); - - // Calculate stack limit - __ ldr(rscratch1, Address(rmethod, Method::const_offset())); - __ ldrh(rscratch1, Address(rscratch1, ConstMethod::max_stack_offset())); - __ add(rscratch1, rscratch1, frame::interpreter_frame_monitor_size() + 2); - __ ldr(rscratch2, - Address(rfp, frame::interpreter_frame_initial_sp_offset * wordSize)); - __ sub(rscratch1, rscratch2, rscratch1, ext::uxtx, 3); - __ andr(sp, rscratch1, -16); - - // Restore expression stack pointer - __ ldr(esp, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize)); - // NULL last_sp until next java call - __ str(zr, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize)); - __ dispatch_next(state, step); return entry; } From 0ad282bb4c79835213014cba67b89296bb4a6de8 Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Wed, 13 Jul 2016 15:19:34 +0100 Subject: [PATCH 036/108] 8159467: AArch64: Enable compact strings Reviewed-by: roland --- hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp index 60ca09675a9..6fb7e5f11d1 100644 --- a/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp @@ -70,11 +70,7 @@ define_pd_global(uintx, CMSYoungGenPerWorker, 64*M); // default max size of CMS define_pd_global(uintx, TypeProfileLevel, 111); -// No performance work done here yet. -define_pd_global(bool, CompactStrings, false); - -// avoid biased locking while we are bootstrapping the aarch64 build -define_pd_global(bool, UseBiasedLocking, false); +define_pd_global(bool, CompactStrings, true); // Clear short arrays bigger than one word in an arch-specific way define_pd_global(intx, InitArrayShortSize, BytesPerLong); From e19479825aa45be8497f92d2bbb6309fa00727f1 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Wed, 13 Jul 2016 18:03:15 +0300 Subject: [PATCH 037/108] 8151280: update hotspot tests to use vm.compMode instead of their own logic Update hs compiler tests to use vm.compMode instead of their own logic and to get VM mode using j.t.l.Platform Reviewed-by: kvn, dpochepk --- .../arraycopy/TestArrayCopyNoInitDeopt.java | 7 ++- .../stress/OverloadCompileQueueTest.java | 10 +--- .../TestEscapeThroughInvoke.java | 2 +- .../intrinsics/IntrinsicAvailableTest.java | 2 - .../bigInteger/MontgomeryMultiplyTest.java | 9 ++- .../intrinsics/bmi/verifycode/AndnTestI.java | 1 + .../intrinsics/bmi/verifycode/AndnTestL.java | 1 + .../intrinsics/bmi/verifycode/BlsiTestI.java | 1 + .../intrinsics/bmi/verifycode/BlsiTestL.java | 1 + .../bmi/verifycode/BlsmskTestI.java | 1 + .../bmi/verifycode/BlsmskTestL.java | 1 + .../intrinsics/bmi/verifycode/BlsrTestI.java | 1 + .../intrinsics/bmi/verifycode/BlsrTestL.java | 1 + .../bmi/verifycode/BmiIntrinsicBase.java | 27 ++++----- .../intrinsics/bmi/verifycode/LZcntTestI.java | 1 + .../intrinsics/bmi/verifycode/LZcntTestL.java | 1 + .../intrinsics/bmi/verifycode/TZcntTestI.java | 1 + .../intrinsics/bmi/verifycode/TZcntTestL.java | 1 + .../klass/CastNullCheckDroppingsTest.java | 9 ++- .../mathexact/sanity/IntrinsicBase.java | 56 +++++++------------ .../jvmci/compilerToVM/IsMatureTest.java | 18 +++--- .../compiler/tiered/NonTieredLevelsTest.java | 9 ++- .../types/correctness/CorrectnessTest.java | 4 +- .../unsafe/UnsafeGetConstantField.java | 11 ++-- .../unsafe/UnsafeGetStableArrayElement.java | 7 ++- .../whitebox/CompilerWhiteBoxTest.java | 15 ++--- .../whitebox/IsMethodCompilableTest.java | 4 +- .../testlibrary/jdk/test/lib/Platform.java | 15 ++++- ...stMutuallyExclusivePlatformPredicates.java | 1 + 29 files changed, 112 insertions(+), 106 deletions(-) diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java index 464d87dd79b..c3ee9a4d495 100644 --- a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java +++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java @@ -25,6 +25,7 @@ * @test * @bug 8072016 * @summary Infinite deoptimization/recompilation cycles in case of arraycopy with tightly coupled allocation + * @requires vm.flavor == "server" * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management @@ -86,9 +87,11 @@ public class TestArrayCopyNoInitDeopt { } static public void main(String[] args) throws Exception { + if (!Platform.isServer()) { + throw new Error("TESTBUG: Not server VM"); + } // Only execute if C2 is available - if (Platform.isServer() && - TIERED_STOP_AT_LEVEL == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) { + if (TIERED_STOP_AT_LEVEL == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) { int[] src = new int[10]; Object src_obj = new Object(); Method method_m1 = TestArrayCopyNoInitDeopt.class.getMethod("m1", Object.class); diff --git a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java index e95b27069de..4a93f2ef4dd 100644 --- a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java +++ b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java @@ -57,8 +57,6 @@ public class OverloadCompileQueueTest implements Runnable { private static final String METHOD_TO_ENQUEUE = "method"; private static final int LEVEL_SIMPLE = 1; private static final int LEVEL_FULL_OPTIMIZATION = 4; - private static final boolean INTERPRETED - = System.getProperty("java.vm.info").startsWith("interpreted "); private static final boolean TIERED_COMPILATION = Helper.WHITE_BOX.getBooleanVMFlag("TieredCompilation"); private static final int TIERED_STOP_AT_LEVEL @@ -74,15 +72,13 @@ public class OverloadCompileQueueTest implements Runnable { } else if (Platform.isClient() || Platform.isMinimal()) { AVAILABLE_LEVELS = new int[] { LEVEL_SIMPLE }; } else { - throw new Error(String.format( - "TESTBUG: unknown VM: %s", System.getProperty("java.vm.name"))); + throw new Error("TESTBUG: unknown VM: " + Platform.vmName); } } public static void main(String[] args) { - if (INTERPRETED) { - System.err.println("Test isn't applicable for interpreter. Skip test."); - return; + if (Platform.isInt()) { + throw new Error("TESTBUG: test can not be run in interpreter"); } new CodeCacheStressRunner(new OverloadCompileQueueTest()).runTest(); } diff --git a/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java b/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java index 4b465cfb8a4..50c7b8ceb10 100644 --- a/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java +++ b/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java @@ -78,4 +78,4 @@ public class TestEscapeThroughInvoke { } } } -} \ No newline at end of file +} diff --git a/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java b/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java index c0669bb92fc..dd55d5496c9 100644 --- a/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java +++ b/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java @@ -52,11 +52,9 @@ import java.lang.reflect.Executable; import java.util.concurrent.Callable; public class IntrinsicAvailableTest extends CompilerWhiteBoxTest { - protected String VMName; public IntrinsicAvailableTest(IntrinsicAvailableTestTestCase testCase) { super(testCase); - VMName = System.getProperty("java.vm.name"); } public static class IntrinsicAvailableTestTestCase implements TestCase { diff --git a/hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java b/hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java index 81a13088bae..01f3ce72203 100644 --- a/hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java +++ b/hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java @@ -26,6 +26,7 @@ * @test * @bug 8130150 8131779 8139907 * @summary Verify that the Montgomery multiply and square intrinsic works and correctly checks their arguments. + * @requires vm.flavor == "server" * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @@ -314,9 +315,11 @@ public class MontgomeryMultiplyTest { } public static void main(String args[]) { - if (Platform.isServer() && - wb.isIntrinsicAvailable(getExecutable(true), COMP_LEVEL_FULL_OPTIMIZATION) && - wb.isIntrinsicAvailable(getExecutable(false), COMP_LEVEL_FULL_OPTIMIZATION)) { + if (!Platform.isServer()) { + throw new Error("TESTBUG: Not server VM"); + } + if (wb.isIntrinsicAvailable(getExecutable(true), COMP_LEVEL_FULL_OPTIMIZATION) && + wb.isIntrinsicAvailable(getExecutable(false), COMP_LEVEL_FULL_OPTIMIZATION)) { try { new MontgomeryMultiplyTest().testMontgomeryMultiplyChecks(); new MontgomeryMultiplyTest().testResultValues(); diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java index 6b2f49fe8f8..ae940d793f7 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java @@ -24,6 +24,7 @@ /* * @test * @bug 8031321 + * @requires vm.flavor == "server" * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java index cf7088675c7..cf2729e39b1 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java @@ -24,6 +24,7 @@ /* * @test * @bug 8031321 + * @requires vm.flavor == "server" * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java index 15c45ecae3b..944d8745bec 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java @@ -24,6 +24,7 @@ /* * @test * @bug 8031321 + * @requires vm.flavor == "server" * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java index b8225a416a4..5d98755b03c 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java @@ -24,6 +24,7 @@ /* * @test * @bug 8031321 + * @requires vm.flavor == "server" * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java index d8a7b5101c1..0ed1d9d9791 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java @@ -24,6 +24,7 @@ /* * @test * @bug 8031321 + * @requires vm.flavor == "server" * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java index 799248edd1f..9554c5ef6e1 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java @@ -24,6 +24,7 @@ /* * @test * @bug 8031321 + * @requires vm.flavor == "server" * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java index 189f8f0bb74..b11e27580c6 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java @@ -24,6 +24,7 @@ /* * @test * @bug 8031321 + * @requires vm.flavor == "server" * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java index ba168a0359b..08038e17cef 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java @@ -24,6 +24,7 @@ /* * @test * @bug 8031321 + * @requires vm.flavor == "server" * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java index 6c65c6fb423..a118de00652 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java @@ -60,8 +60,11 @@ public class BmiIntrinsicBase extends CompilerWhiteBoxTest { } if (!Platform.isServer()) { - System.out.println("Not server VM, test SKIPPED"); - return; + throw new Error("TESTBUG: Not server VM"); + } + + if (Platform.isInt()) { + throw new Error("TESTBUG: test can not be run in interpreter"); } if (!CPUInfo.hasFeature(bmiTestCase.getCpuFlag())) { @@ -76,22 +79,12 @@ public class BmiIntrinsicBase extends CompilerWhiteBoxTest { System.out.println(testCase.name()); - switch (MODE) { - case "compiled mode": - case "mixed mode": - if (TIERED_COMPILATION && TIERED_STOP_AT_LEVEL != CompilerWhiteBoxTest.COMP_LEVEL_MAX) { - System.out.println("TieredStopAtLevel value (" + TIERED_STOP_AT_LEVEL + ") is too low, test SKIPPED"); - return; - } - deoptimize(); - compileAtLevelAndCheck(CompilerWhiteBoxTest.COMP_LEVEL_MAX); - break; - case "interpreted mode": // test is not applicable in this mode; - System.err.println("Warning: This test is not applicable in mode: " + MODE); - break; - default: - throw new AssertionError("Test bug, unknown VM mode: " + MODE); + if (TIERED_COMPILATION && TIERED_STOP_AT_LEVEL != CompilerWhiteBoxTest.COMP_LEVEL_MAX) { + System.out.println("TieredStopAtLevel value (" + TIERED_STOP_AT_LEVEL + ") is too low, test SKIPPED"); + return; } + deoptimize(); + compileAtLevelAndCheck(CompilerWhiteBoxTest.COMP_LEVEL_MAX); } protected void compileAtLevelAndCheck(int level) { diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java index 4b34e827df2..e2ba6930058 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java @@ -24,6 +24,7 @@ /* * @test * @bug 8031321 + * @requires vm.flavor == "server" * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java index 824d86cbae7..d68a32fe680 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java @@ -24,6 +24,7 @@ /* * @test * @bug 8031321 + * @requires vm.flavor == "server" * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java index d2a2b6fe3a4..4ab25be7b78 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java @@ -24,6 +24,7 @@ /* * @test * @bug 8031321 + * @requires vm.flavor == "server" * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java index 5f79523e531..02359f6c4ac 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java @@ -24,6 +24,7 @@ /* * @test * @bug 8031321 + * @requires vm.flavor == "server" * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java b/hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java index 499662238c8..cb6d70c03f6 100644 --- a/hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java +++ b/hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java @@ -25,6 +25,7 @@ * @test NullCheckDroppingsTest * @bug 8054492 * @summary Casting can result in redundant null checks in generated code + * @requires vm.flavor == "server" * @library /testlibrary /test/lib * @modules java.base/jdk.internal.misc * java.management @@ -85,18 +86,16 @@ public class CastNullCheckDroppingsTest { int[] asink; public static void main(String[] args) throws Exception { - - // Only test C2 in Server VM if (!Platform.isServer()) { - return; + throw new Error("TESTBUG: Not server VM"); } // Make sure background compilation is disabled if (WHITE_BOX.getBooleanVMFlag("BackgroundCompilation")) { - throw new AssertionError("Background compilation enabled"); + throw new Error("TESTBUG: Background compilation enabled"); } // Make sure Tiered compilation is disabled if (WHITE_BOX.getBooleanVMFlag("TieredCompilation")) { - throw new AssertionError("Tiered compilation enabled"); + throw new Error("TESTBUG: Tiered compilation enabled"); } Method methodClassCast = CastNullCheckDroppingsTest.class.getDeclaredMethod("testClassCast", String.class); diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java index 8710d20780a..b5aeffbe57e 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java @@ -32,12 +32,10 @@ import java.lang.reflect.Executable; import java.util.Properties; public abstract class IntrinsicBase extends CompilerWhiteBoxTest { - protected String javaVmName; protected String useMathExactIntrinsics; protected IntrinsicBase(TestCase testCase) { super(testCase); - javaVmName = System.getProperty("java.vm.name"); useMathExactIntrinsics = getVMOption("UseMathExactIntrinsics"); } @@ -46,39 +44,32 @@ public abstract class IntrinsicBase extends CompilerWhiteBoxTest { //java.lang.Math should be loaded to allow a compilation of the methods that use Math's method System.out.println("class java.lang.Math should be loaded. Proof: " + Math.class); printEnvironmentInfo(); + if (Platform.isInt()) { + throw new Error("TESTBUG: test can not be run in interpreter"); + } int expectedIntrinsicCount = 0; - switch (MODE) { - case "compiled mode": - case "mixed mode": - if (isServerVM()) { - if (TIERED_COMPILATION) { - int max_level = TIERED_STOP_AT_LEVEL; - expectedIntrinsicCount = (max_level == COMP_LEVEL_MAX) ? 1 : 0; - for (int i = CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE; i <= max_level; ++i) { - deoptimize(); - compileAtLevel(i); - } - } else { - expectedIntrinsicCount = 1; - deoptimize(); - compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_MAX); - } - } else { + if (Platform.isServer()) { + if (TIERED_COMPILATION) { + int max_level = TIERED_STOP_AT_LEVEL; + expectedIntrinsicCount = (max_level == COMP_LEVEL_MAX) ? 1 : 0; + for (int i = CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE; i <= max_level; ++i) { deoptimize(); - compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE); + compileAtLevel(i); } + } else { + expectedIntrinsicCount = 1; + deoptimize(); + compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_MAX); + } + } else { + deoptimize(); + compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE); + } - if (!isIntrinsicAvailable()) { - expectedIntrinsicCount = 0; - } - break; - case "interpreted mode": //test is not applicable in this mode; - System.err.println("Warning: This test is not applicable in mode: " + MODE); - break; - default: - throw new RuntimeException("Test bug, unknown VM mode: " + MODE); + if (!isIntrinsicAvailable()) { + expectedIntrinsicCount = 0; } System.out.println("Expected intrinsic count is " + expectedIntrinsicCount + " name " + getIntrinsicId()); @@ -93,9 +84,8 @@ public abstract class IntrinsicBase extends CompilerWhiteBoxTest { } protected void printEnvironmentInfo() { - System.out.println("java.vm.name=" + javaVmName); System.out.println("os.arch=" + Platform.getOsArch()); - System.out.println("java.vm.info=" + MODE); + System.out.println("java.vm.info=" + Platform.vmInfo); System.out.println("useMathExactIntrinsics=" + useMathExactIntrinsics); } @@ -125,10 +115,6 @@ public abstract class IntrinsicBase extends CompilerWhiteBoxTest { protected abstract String getIntrinsicId(); - protected boolean isServerVM() { - return javaVmName.toLowerCase().contains("server"); - } - static class IntTest extends IntrinsicBase { protected boolean isIntrinsicAvailable; // The tested intrinsic is available on the current platform. diff --git a/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java b/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java index e1206cf4cd0..1855ca27398 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java @@ -26,14 +26,15 @@ * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") * @library / /testlibrary /test/lib - * @library ../common/patches + * ../common/patches * @modules java.base/jdk.internal.misc - * @modules jdk.vm.ci/jdk.vm.ci.hotspot + * jdk.vm.ci/jdk.vm.ci.hotspot + * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.IsMatureTest - * @build sun.hotspot.WhiteBox - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * compiler.jvmci.compilerToVM.IsMatureTest + * sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI @@ -45,6 +46,7 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.testcases.SimpleClass; import compiler.whitebox.CompilerWhiteBoxTest; import jdk.test.lib.Asserts; +import jdk.test.lib.Platform; import jdk.vm.ci.hotspot.CompilerToVMHelper; import sun.hotspot.WhiteBox; @@ -52,8 +54,6 @@ import java.lang.reflect.Executable; public class IsMatureTest { private static final WhiteBox WB = WhiteBox.getWhiteBox(); - private static final boolean IS_XCOMP - = System.getProperty("java.vm.info").contains("compiled mode"); private static final boolean TIERED = WB.getBooleanVMFlag("TieredCompilation"); @@ -82,7 +82,7 @@ public class IsMatureTest { "Multiple times invoked method should have method data"); /* a method is not mature in Xcomp mode with tiered compilation disabled, see NonTieredCompPolicy::is_mature */ - Asserts.assertEQ(isMature, !(IS_XCOMP && !TIERED), + Asserts.assertEQ(isMature, !(Platform.isComp() && !TIERED), "Unexpected isMature state for multiple times invoked method"); } } diff --git a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java index c3461924928..d12fe340093 100644 --- a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java +++ b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java @@ -41,22 +41,21 @@ package compiler.tiered; import java.util.function.IntPredicate; import compiler.whitebox.CompilerWhiteBoxTest; +import jdk.test.lib.Platform; public class NonTieredLevelsTest extends CompLevelsTest { private static final int AVAILABLE_COMP_LEVEL; private static final IntPredicate IS_AVAILABLE_COMPLEVEL; static { - String vmName = System.getProperty("java.vm.name"); - if (vmName.endsWith(" Server VM")) { + if (Platform.isServer()) { AVAILABLE_COMP_LEVEL = COMP_LEVEL_FULL_OPTIMIZATION; IS_AVAILABLE_COMPLEVEL = x -> x == COMP_LEVEL_FULL_OPTIMIZATION; - } else if (vmName.endsWith(" Client VM") - || vmName.endsWith(" Minimal VM")) { + } else if (Platform.isClient() || Platform.isMinimal()) { AVAILABLE_COMP_LEVEL = COMP_LEVEL_SIMPLE; IS_AVAILABLE_COMPLEVEL = x -> x >= COMP_LEVEL_SIMPLE && x <= COMP_LEVEL_FULL_PROFILE; } else { - throw new RuntimeException("Unknown VM: " + vmName); + throw new Error("TESTBUG: unknown VM: " + Platform.vmName); } } diff --git a/hotspot/test/compiler/types/correctness/CorrectnessTest.java b/hotspot/test/compiler/types/correctness/CorrectnessTest.java index 832e71cf265..15a5bba240b 100644 --- a/hotspot/test/compiler/types/correctness/CorrectnessTest.java +++ b/hotspot/test/compiler/types/correctness/CorrectnessTest.java @@ -25,9 +25,11 @@ * @test CorrectnessTest * @bug 8038418 * @summary Tests correctness of type usage with type profiling and speculations + * @requires vm.flavor == "server" * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management + * * @ignore 8066173 * @build compiler.types.correctness.CorrectnessTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox @@ -88,7 +90,7 @@ public class CorrectnessTest { public static void main(String[] args) { if (!Platform.isServer()) { - System.out.println("ALL TESTS SKIPPED"); + throw new Error("TESTBUG: Not server VM"); } Asserts.assertGTE(args.length, 1); ProfilingType profilingType = ProfilingType.valueOf(args[0]); diff --git a/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java b/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java index d1548ab7ef7..d897ba9370a 100644 --- a/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java +++ b/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java @@ -28,7 +28,7 @@ * @summary tests on constant folding of unsafe get operations * @library /testlibrary * - * @requires vm.flavor != "client" + * @requires vm.flavor == "server" * * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.vm.annotation @@ -93,11 +93,12 @@ public class UnsafeGetConstantField { static final Unsafe U = Unsafe.getUnsafe(); public static void main(String[] args) { - if (Platform.isServer()) { - testUnsafeGetAddress(); - testUnsafeGetField(); - testUnsafeGetFieldUnaligned(); + if (!Platform.isServer()) { + throw new Error("TESTBUG: Not server VM"); } + testUnsafeGetAddress(); + testUnsafeGetField(); + testUnsafeGetFieldUnaligned(); System.out.println("TEST PASSED"); } diff --git a/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java b/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java index 7476a908096..956e993e2ce 100644 --- a/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java +++ b/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java @@ -28,7 +28,7 @@ * @summary tests on constant folding of unsafe get operations from stable arrays * @library /testlibrary * - * @requires vm.flavor != "client" + * @requires vm.flavor == "server" * * @modules java.base/jdk.internal.vm.annotation * java.base/jdk.internal.misc @@ -332,9 +332,10 @@ public class UnsafeGetStableArrayElement { } public static void main(String[] args) throws Exception { - if (Platform.isServer()) { - testUnsafeAccess(); + if (!Platform.isServer()) { + throw new Error("TESTBUG: Not server VM"); } + testUnsafeAccess(); System.out.println("TEST PASSED"); } } diff --git a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java index 3a05ec564d7..bc46d9ee317 100644 --- a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java +++ b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java @@ -23,6 +23,7 @@ package compiler.whitebox; +import jdk.test.lib.Platform; import sun.hotspot.WhiteBox; import sun.hotspot.code.NMethod; @@ -33,6 +34,7 @@ import java.util.function.Function; /** * Abstract class for WhiteBox testing of JIT. + * Depends on jdk.test.lib.Platform from testlibrary. * * @author igor.ignatyev@oracle.com */ @@ -75,8 +77,6 @@ public abstract class CompilerWhiteBoxTest { public static final int THRESHOLD; /** invocation count to trigger OSR compilation */ protected static final long BACKEDGE_THRESHOLD; - /** Value of {@code java.vm.info} (interpreted|mixed|comp mode) */ - protected static final String MODE = System.getProperty("java.vm.info"); static { if (TIERED_COMPILATION) { @@ -165,10 +165,8 @@ public abstract class CompilerWhiteBoxTest { * @see #test() */ protected final void runTest() { - if (CompilerWhiteBoxTest.MODE.startsWith("interpreted ")) { - System.err.println( - "Warning: test is not applicable in interpreted mode"); - return; + if (Platform.isInt()) { + throw new Error("TESTBUG: test can not be run in interpreter"); } System.out.println("at test's start:"); printInfo(); @@ -431,11 +429,10 @@ public abstract class CompilerWhiteBoxTest { * Xcomp, otherwise {@code false} */ protected boolean skipXcompOSR() { - boolean result = testCase.isOsr() - && CompilerWhiteBoxTest.MODE.startsWith("compiled "); + boolean result = testCase.isOsr() && Platform.isComp(); if (result && IS_VERBOSE) { System.err.printf("Warning: %s is not applicable in %s%n", - testCase.name(), CompilerWhiteBoxTest.MODE); + testCase.name(), Platform.vmInfo); } return result; } diff --git a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java index 5bd3613b602..6b806574407 100644 --- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java +++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java @@ -25,9 +25,11 @@ * @test IsMethodCompilableTest * @bug 8007270 8006683 8007288 8022832 * @summary testing of WB::isMethodCompilable() + * @requires vm.flavor == "server" * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management + * * @build jdk.test.lib.* * sun.hotspot.WhiteBox * @build compiler.whitebox.IsMethodCompilableTest @@ -84,7 +86,7 @@ public class IsMethodCompilableTest extends CompilerWhiteBoxTest { // Only c2 compilations can be disabled through PerMethodRecompilationCutoff if (!Platform.isServer()) { - return; + throw new Error("TESTBUG: Not server VM"); } if (skipXcompOSR()) { diff --git a/hotspot/test/testlibrary/jdk/test/lib/Platform.java b/hotspot/test/testlibrary/jdk/test/lib/Platform.java index 64773223556..611f49d6ba8 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/Platform.java +++ b/hotspot/test/testlibrary/jdk/test/lib/Platform.java @@ -31,12 +31,13 @@ import java.util.regex.Pattern; */ @Deprecated public class Platform { + public static final String vmName = System.getProperty("java.vm.name"); + public static final String vmInfo = System.getProperty("java.vm.info"); private static final String osName = System.getProperty("os.name"); private static final String dataModel = System.getProperty("sun.arch.data.model"); private static final String vmVersion = System.getProperty("java.vm.version"); private static final String jdkDebug = System.getProperty("jdk.debug"); private static final String osArch = System.getProperty("os.arch"); - private static final String vmName = System.getProperty("java.vm.name"); private static final String userName = System.getProperty("user.name"); private static final String compiler = System.getProperty("sun.management.compiler"); @@ -68,6 +69,18 @@ public class Platform { return compiler.contains("Tiered Compilers"); } + public static boolean isInt() { + return vmInfo.contains("interpreted"); + } + + public static boolean isMixed() { + return vmInfo.contains("mixed"); + } + + public static boolean isComp() { + return vmInfo.contains("compiled"); + } + public static boolean is32bit() { return dataModel.equals("32"); } diff --git a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java index 4f20576be77..90f72a60abd 100644 --- a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java +++ b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java @@ -49,6 +49,7 @@ public class TestMutuallyExclusivePlatformPredicates { BITNESS("is32bit", "is64bit"), OS("isAix", "isLinux", "isOSX", "isSolaris", "isWindows"), VM_TYPE("isClient", "isServer", "isGraal", "isMinimal", "isZero"), + MODE("isInt", "isMixed", "isComp"), IGNORED("isEmbedded", "isDebugBuild", "shouldSAAttach", "canPtraceAttachLinux", "canAttachOSX", "isTieredSupported"); From 684f63ba14bbf485f4625504762175e68e7f8808 Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Wed, 13 Jul 2016 19:08:07 +0300 Subject: [PATCH 038/108] 8160761: [TESTBUG] Several compiler tests fail with product bits Add UnlockDiagnosticVMOptions to tests Reviewed-by: goetz --- .../TestEliminatedCastPPAtPhi.java | 2 +- .../loopopts/TestPredicateLostDependency.java | 2 +- hotspot/test/compiler/membars/DekkerTest.java | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hotspot/test/compiler/controldependency/TestEliminatedCastPPAtPhi.java b/hotspot/test/compiler/controldependency/TestEliminatedCastPPAtPhi.java index 86dab6fada3..b3c3d038887 100644 --- a/hotspot/test/compiler/controldependency/TestEliminatedCastPPAtPhi.java +++ b/hotspot/test/compiler/controldependency/TestEliminatedCastPPAtPhi.java @@ -29,7 +29,7 @@ * @requires vm.gc=="Serial" | vm.gc=="Parallel" * * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement - * -XX:+IgnoreUnrecognizedVMOptions -XX:+StressGCM + * -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+StressGCM * compiler.controldependency.TestEliminatedCastPPAtPhi * */ diff --git a/hotspot/test/compiler/loopopts/TestPredicateLostDependency.java b/hotspot/test/compiler/loopopts/TestPredicateLostDependency.java index a1ee8d26231..666bc379772 100644 --- a/hotspot/test/compiler/loopopts/TestPredicateLostDependency.java +++ b/hotspot/test/compiler/loopopts/TestPredicateLostDependency.java @@ -27,7 +27,7 @@ * @bug 8069191 * @summary predicate moved out of loops and CastPP removal causes dependency to be lost * - * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+StressGCM + * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM * -XX:CompileCommand=compileonly,compiler.loopopts.TestPredicateLostDependency::m1 * compiler.loopopts.TestPredicateLostDependency * diff --git a/hotspot/test/compiler/membars/DekkerTest.java b/hotspot/test/compiler/membars/DekkerTest.java index 506d3afbc22..8fdb33cad4a 100644 --- a/hotspot/test/compiler/membars/DekkerTest.java +++ b/hotspot/test/compiler/membars/DekkerTest.java @@ -25,15 +25,15 @@ * @test * @bug 8007898 * @summary Incorrect optimization of Memory Barriers in Matcher::post_store_load_barrier(). - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation - * -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM - * compiler.membars.DekkerTest - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation - * -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM - * compiler.membars.DekkerTest - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation - * -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM - * compiler.membars.DekkerTest + * @run main/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM + * compiler.membars.DekkerTest + * @run main/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM + * compiler.membars.DekkerTest + * @run main/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions + * -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM + * compiler.membars.DekkerTest * @author Martin Doerr martin DOT doerr AT sap DOT com * * Run 3 times since the failure is intermittent. From 558ac48a19b9d6c7bdc8ed8269b958585dd2b760 Mon Sep 17 00:00:00 2001 From: Michael Haupt Date: Thu, 14 Jul 2016 08:33:08 +0200 Subject: [PATCH 039/108] 8161068: jdk.vm.ci.hotspot.test.MethodHandleAccessProviderTest fails Reviewed-by: never, dnsimon --- .../HotSpotMethodHandleAccessProvider.java | 71 ++++++++++++++----- .../test/MethodHandleAccessProviderTest.java | 2 +- 2 files changed, 54 insertions(+), 19 deletions(-) diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java index 821f3da899e..c4eab6cda82 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -28,10 +28,12 @@ import static jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.fromObjectClass; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.meta.ConstantReflectionProvider; import jdk.vm.ci.meta.JavaConstant; +import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.MethodHandleAccessProvider; import jdk.vm.ci.meta.ResolvedJavaField; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; +import jdk.vm.ci.meta.Signature; public class HotSpotMethodHandleAccessProvider implements MethodHandleAccessProvider { @@ -51,46 +53,80 @@ public class HotSpotMethodHandleAccessProvider implements MethodHandleAccessProv static final ResolvedJavaMethod lambdaFormCompileToBytecodeMethod; static final HotSpotResolvedJavaField memberNameVmtargetField; + static final ResolvedJavaType CLASS = fromObjectClass(LazyInitialization.class); + /** * Search for an instance field with the given name in a class. * * @param className name of the class to search in * @param fieldName name of the field to be searched - * @return resolved java field + * @param fieldType resolved Java type of the field + * @return resolved Java field * @throws ClassNotFoundException + * @throws NoSuchFieldError */ - private static ResolvedJavaField findFieldInClass(String className, String fieldName) throws ClassNotFoundException { + private static ResolvedJavaField findFieldInClass(String className, String fieldName, ResolvedJavaType fieldType) + throws ClassNotFoundException { Class clazz = Class.forName(className); ResolvedJavaType type = runtime().fromClass(clazz); ResolvedJavaField[] fields = type.getInstanceFields(false); for (ResolvedJavaField field : fields) { - if (field.getName().equals(fieldName)) { + if (field.getName().equals(fieldName) && field.getType().equals(fieldType)) { return field; } } - return null; + throw new NoSuchFieldError(fieldType.getName() + " " + className + "." + fieldName); } - private static ResolvedJavaMethod findMethodInClass(String className, String methodName) throws ClassNotFoundException { + private static ResolvedJavaMethod findMethodInClass(String className, String methodName, + ResolvedJavaType resultType, ResolvedJavaType[] parameterTypes) throws ClassNotFoundException { Class clazz = Class.forName(className); HotSpotResolvedObjectTypeImpl type = fromObjectClass(clazz); ResolvedJavaMethod result = null; for (ResolvedJavaMethod method : type.getDeclaredMethods()) { - if (method.getName().equals(methodName)) { - assert result == null : "more than one method found: " + className + "." + methodName; + if (method.getName().equals(methodName) && signatureMatches(method, resultType, parameterTypes)) { result = method; } } - assert result != null : "method not found: " + className + "." + methodName; + if (result == null) { + StringBuilder sig = new StringBuilder("("); + for (ResolvedJavaType t : parameterTypes) { + sig.append(t.getName()).append(","); + } + if (sig.length() > 1) { + sig.replace(sig.length() - 1, sig.length(), ")"); + } else { + sig.append(')'); + } + throw new NoSuchMethodError(resultType.getName() + " " + className + "." + methodName + sig.toString()); + } return result; } + private static boolean signatureMatches(ResolvedJavaMethod m, ResolvedJavaType resultType, + ResolvedJavaType[] parameterTypes) { + Signature s = m.getSignature(); + if (!s.getReturnType(CLASS).equals(resultType)) { + return false; + } + for (int i = 0; i < s.getParameterCount(false); ++i) { + if (!s.getParameterType(i, CLASS).equals(parameterTypes[i])) { + return false; + } + } + return true; + } + static { try { - methodHandleFormField = findFieldInClass("java.lang.invoke.MethodHandle", "form"); - lambdaFormVmentryField = findFieldInClass("java.lang.invoke.LambdaForm", "vmentry"); - lambdaFormCompileToBytecodeMethod = findMethodInClass("java.lang.invoke.LambdaForm", "compileToBytecode"); - memberNameVmtargetField = (HotSpotResolvedJavaField) findFieldInClass("java.lang.invoke.MemberName", "vmtarget"); + methodHandleFormField = findFieldInClass("java.lang.invoke.MethodHandle", "form", + fromObjectClass(Class.forName("java.lang.invoke.LambdaForm"))); + lambdaFormVmentryField = findFieldInClass("java.lang.invoke.LambdaForm", "vmentry", + fromObjectClass(Class.forName("java.lang.invoke.MemberName"))); + lambdaFormCompileToBytecodeMethod = findMethodInClass("java.lang.invoke.LambdaForm", "compileToBytecode", + new HotSpotResolvedPrimitiveType(JavaKind.Void), new ResolvedJavaType[]{}); + memberNameVmtargetField = (HotSpotResolvedJavaField) findFieldInClass("java.lang.invoke.MemberName", "vmtarget", + new HotSpotResolvedPrimitiveType(JavaKind.Long)); } catch (Throwable ex) { throw new JVMCIError(ex); } @@ -134,14 +170,12 @@ public class HotSpotMethodHandleAccessProvider implements MethodHandleAccessProv return null; } - JavaConstant memberName; if (forceBytecodeGeneration) { /* Invoke non-public method: MemberName LambdaForm.compileToBytecode() */ - memberName = LazyInitialization.lambdaFormCompileToBytecodeMethod.invoke(lambdaForm, new JavaConstant[0]); - } else { - /* Load non-public field: MemberName LambdaForm.vmentry */ - memberName = constantReflection.readFieldValue(LazyInitialization.lambdaFormVmentryField, lambdaForm); + LazyInitialization.lambdaFormCompileToBytecodeMethod.invoke(lambdaForm, new JavaConstant[0]); } + /* Load non-public field: MemberName LambdaForm.vmentry */ + JavaConstant memberName = constantReflection.readFieldValue(LazyInitialization.lambdaFormVmentryField, lambdaForm); return getTargetMethod(memberName); } @@ -163,3 +197,4 @@ public class HotSpotMethodHandleAccessProvider implements MethodHandleAccessProv return compilerToVM().getResolvedJavaMethod(object, LazyInitialization.memberNameVmtargetField.offset()); } } + diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java index b4b88bbd2a2..c94d47a2bca 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java @@ -24,12 +24,12 @@ /* * @test * @bug 8152343 + * @bug 8161068 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") * @library /testlibrary /test/lib /compiler/jvmci/jdk.vm.ci.hotspot.test/src * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.hotspot - * @ignore 8161068 * @run testng/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * jdk.vm.ci.hotspot.test.MethodHandleAccessProviderTest */ From 24fa7f4177f71c0b4c14ce3d210f0dd13d90b7af Mon Sep 17 00:00:00 2001 From: Dmitrij Pochepko Date: Thu, 14 Jul 2016 20:10:16 +0300 Subject: [PATCH 040/108] 8157984: [TESTBUG] Several compiler tests fails when are executed with -XX:TieredStopAtLevel=1 Reviewed-by: vlivanov --- .../compiler/rangechecks/TestRangeCheckSmearing.java | 4 ++-- hotspot/test/compiler/testlibrary/CompilerUtils.java | 11 +++++++++++ hotspot/test/compiler/tiered/NonTieredLevelsTest.java | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java index 446c87e6c40..17c43270c51 100644 --- a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java +++ b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java @@ -28,7 +28,6 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @ignore 8157984 * @build compiler.rangechecks.TestRangeCheckSmearing * @run driver ClassFileInstaller sun.hotspot.WhiteBox * jdk.test.lib.Platform @@ -41,6 +40,7 @@ package compiler.rangechecks; import compiler.whitebox.CompilerWhiteBoxTest; +import compiler.testlibrary.CompilerUtils; import jdk.test.lib.Platform; import sun.hotspot.WhiteBox; @@ -402,7 +402,7 @@ public class TestRangeCheckSmearing { System.out.println("ArrayIndexOutOfBoundsException was not thrown in "+name); } - if (Platform.isServer()) { + if (CompilerUtils.getMaxCompilationLevel() == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) { if (exceptionRequired == WHITE_BOX.isMethodCompiled(m)) { System.out.println((exceptionRequired?"Didn't deoptimized":"deoptimized") + " in "+name); test_success = false; diff --git a/hotspot/test/compiler/testlibrary/CompilerUtils.java b/hotspot/test/compiler/testlibrary/CompilerUtils.java index 55871ad2b46..fea72bd4c4b 100644 --- a/hotspot/test/compiler/testlibrary/CompilerUtils.java +++ b/hotspot/test/compiler/testlibrary/CompilerUtils.java @@ -23,6 +23,7 @@ package compiler.testlibrary; +import java.util.Arrays; import jdk.test.lib.Asserts; import jdk.test.lib.Platform; import sun.hotspot.WhiteBox; @@ -61,4 +62,14 @@ public class CompilerUtils { } return new int[0]; } + + /** + * Returns maximum compilation level available + * @return an int value representing maximum compilation level available + */ + public static int getMaxCompilationLevel() { + return Arrays.stream(getAvailableCompilationLevels()) + .max() + .getAsInt(); + } } diff --git a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java index d12fe340093..3973bdc5d3a 100644 --- a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java +++ b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java @@ -27,7 +27,7 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @ignore 8157984 + * @requires vm.opt.TieredStopAtLevel==null * @build compiler.tiered.NonTieredLevelsTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission From 0f34ca00f27d9e027780c7f35389e286f4e6ac87 Mon Sep 17 00:00:00 2001 From: Dmitrij Pochepko Date: Thu, 14 Jul 2016 20:11:55 +0300 Subject: [PATCH 041/108] 8157861: [TESTBUG] compiler/jvmci/compilerToVM/ReprofileTest.java failed with RuntimeException Reviewed-by: twisti --- hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java index e52ef816cf5..d9aa0b17aff 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java @@ -25,7 +25,7 @@ /** * @test * @bug 8136421 - * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") + * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") & (vm.opt.TieredStopAtLevel == null | vm.opt.TieredStopAtLevel == 3) * @library /testlibrary /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc @@ -35,7 +35,6 @@ * jdk.vm.ci/jdk.vm.ci.code * jdk.vm.ci/jdk.vm.ci.meta * - * @ignore 8157861 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build sun.hotspot.WhiteBox * @build compiler.jvmci.compilerToVM.ReprofileTest @@ -44,7 +43,7 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI - * -Xmixed + * -Xmixed -Xbatch * compiler.jvmci.compilerToVM.ReprofileTest */ From 6cf9b5c453f423ecc20c574ad8e334ea92aad8f6 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 23 Jun 2016 22:33:46 +0200 Subject: [PATCH 042/108] 8160245: C1: Clean up platform #defines in c1_LIR.hpp Also add fnoreg on x86, LIR_Address constructor without scale, clean up templateInterpreterGenerator.hpp and remove PPC32 special cases. Reviewed-by: coleenp, thartmann --- .../aarch64/vm/c1_LIRGenerator_aarch64.cpp | 2 - hotspot/src/cpu/aarch64/vm/c1_LIR_aarch64.cpp | 54 +++++++ hotspot/src/cpu/ppc/vm/c1_LIR_ppc.cpp | 64 ++++++++ hotspot/src/cpu/ppc/vm/register_ppc.hpp | 12 +- .../vm/templateInterpreterGenerator_ppc.cpp | 8 +- hotspot/src/cpu/sparc/vm/c1_LIR_sparc.cpp | 63 ++++++++ .../src/cpu/x86/vm/c1_LIRGenerator_x86.cpp | 4 - hotspot/src/cpu/x86/vm/c1_LIR_x86.cpp | 74 +++++++++ .../cpu/x86/vm/register_definitions_x86.cpp | 4 +- hotspot/src/cpu/x86/vm/register_x86.hpp | 4 +- hotspot/src/share/vm/c1/c1_Compilation.hpp | 7 +- hotspot/src/share/vm/c1/c1_LIR.cpp | 66 +------- hotspot/src/share/vm/c1/c1_LIR.hpp | 147 +++++++----------- .../templateInterpreterGenerator.hpp | 7 +- 14 files changed, 329 insertions(+), 187 deletions(-) create mode 100644 hotspot/src/cpu/aarch64/vm/c1_LIR_aarch64.cpp create mode 100644 hotspot/src/cpu/ppc/vm/c1_LIR_ppc.cpp create mode 100644 hotspot/src/cpu/sparc/vm/c1_LIR_sparc.cpp create mode 100644 hotspot/src/cpu/x86/vm/c1_LIR_x86.cpp diff --git a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp index 4690e75e3cf..e66f6ff5fe5 100644 --- a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp @@ -808,7 +808,6 @@ void LIRGenerator::do_CompareAndSwap(Intrinsic* x, ValueType* type) { } else { a = new LIR_Address(obj.result(), offset.result(), - LIR_Address::times_1, 0, as_BasicType(type)); } @@ -1002,7 +1001,6 @@ void LIRGenerator::do_update_CRC32(Intrinsic* x) { LIR_Address* a = new LIR_Address(base_op, index, - LIR_Address::times_1, offset, T_BYTE); BasicTypeList signature(3); diff --git a/hotspot/src/cpu/aarch64/vm/c1_LIR_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIR_aarch64.cpp new file mode 100644 index 00000000000..ce75dc552a9 --- /dev/null +++ b/hotspot/src/cpu/aarch64/vm/c1_LIR_aarch64.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016, 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. + * + */ + +#include "precompiled.hpp" +#include "asm/register.hpp" +#include "c1/c1_LIR.hpp" + +FloatRegister LIR_OprDesc::as_float_reg() const { + return as_FloatRegister(fpu_regnr()); +} + +FloatRegister LIR_OprDesc::as_double_reg() const { + return as_FloatRegister(fpu_regnrLo()); +} + +// Reg2 unused. +LIR_Opr LIR_OprFact::double_fpu(int reg1, int reg2) { + assert(as_FloatRegister(reg2) == fnoreg, "Not used on this platform"); + return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) | + (reg1 << LIR_OprDesc::reg2_shift) | + LIR_OprDesc::double_type | + LIR_OprDesc::fpu_register | + LIR_OprDesc::double_size); +} + +#ifndef PRODUCT +void LIR_Address::verify() const { + assert(base()->is_cpu_register(), "wrong base operand"); + assert(index()->is_illegal() || index()->is_double_cpu() || index()->is_single_cpu(), "wrong index operand"); + assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA, + "wrong type for addresses"); +} +#endif // PRODUCT diff --git a/hotspot/src/cpu/ppc/vm/c1_LIR_ppc.cpp b/hotspot/src/cpu/ppc/vm/c1_LIR_ppc.cpp new file mode 100644 index 00000000000..ef9b0833d38 --- /dev/null +++ b/hotspot/src/cpu/ppc/vm/c1_LIR_ppc.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016 SAP SE. 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. + * + */ + +#include "precompiled.hpp" +#include "asm/register.hpp" +#include "c1/c1_LIR.hpp" + +FloatRegister LIR_OprDesc::as_float_reg() const { + return as_FloatRegister(fpu_regnr()); +} + +FloatRegister LIR_OprDesc::as_double_reg() const { + return as_FloatRegister(fpu_regnrLo()); +} + +// Reg2 unused. +LIR_Opr LIR_OprFact::double_fpu(int reg1, int reg2) { + assert(!as_FloatRegister(reg2)->is_valid(), "Not used on this platform"); + return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) | + (reg1 << LIR_OprDesc::reg2_shift) | + LIR_OprDesc::double_type | + LIR_OprDesc::fpu_register | + LIR_OprDesc::double_size); +} + +#ifndef PRODUCT +void LIR_Address::verify() const { + assert(scale() == times_1, "Scaled addressing mode not available on PPC and should not be used"); + assert(disp() == 0 || index()->is_illegal(), "can't have both"); +#ifdef _LP64 + assert(base()->is_cpu_register(), "wrong base operand"); + assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand"); + assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA, + "wrong type for addresses"); +#else + assert(base()->is_single_cpu(), "wrong base operand"); + assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand"); + assert(base()->type() == T_OBJECT || base()->type() == T_INT || base()->type() == T_METADATA, + "wrong type for addresses"); +#endif +} +#endif // PRODUCT diff --git a/hotspot/src/cpu/ppc/vm/register_ppc.hpp b/hotspot/src/cpu/ppc/vm/register_ppc.hpp index fffd7dc54a1..e73dc18a30a 100644 --- a/hotspot/src/cpu/ppc/vm/register_ppc.hpp +++ b/hotspot/src/cpu/ppc/vm/register_ppc.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2014 SAP SE. All rights reserved. + * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016 SAP SE. 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 @@ -76,7 +76,7 @@ class RegisterImpl; typedef RegisterImpl* Register; inline Register as_Register(int encoding) { - assert(encoding >= 0 && encoding < 32, "bad register encoding"); + assert(encoding >= -1 && encoding < 32, "bad register encoding"); return (Register)(intptr_t)encoding; } @@ -91,7 +91,7 @@ class RegisterImpl: public AbstractRegisterImpl { inline friend Register as_Register(int encoding); // accessors - int encoding() const { assert(is_valid(), "invalid register"); return value(); } + int encoding() const { assert(is_valid(), "invalid register"); return value(); } inline VMReg as_VMReg(); Register successor() const { return as_Register(encoding() + 1); } @@ -247,7 +247,7 @@ class FloatRegisterImpl; typedef FloatRegisterImpl* FloatRegister; inline FloatRegister as_FloatRegister(int encoding) { - assert(encoding >= 0 && encoding < 32, "bad float register encoding"); + assert(encoding >= -1 && encoding < 32, "bad float register encoding"); return (FloatRegister)(intptr_t)encoding; } @@ -267,7 +267,7 @@ class FloatRegisterImpl: public AbstractRegisterImpl { FloatRegister successor() const { return as_FloatRegister(encoding() + 1); } // testers - bool is_valid() const { return (0 <= value() && value() < number_of_registers); } + bool is_valid() const { return (0 <= value() && value() < number_of_registers); } const char* name() const; }; diff --git a/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp b/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp index 591db706231..c37887fd9cf 100644 --- a/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp @@ -881,10 +881,6 @@ void TemplateInterpreterGenerator::generate_stack_overflow_check(Register Rmem_f BLOCK_COMMENT("} stack_overflow_check_with_compare"); } -void TemplateInterpreterGenerator::unlock_method(bool check_exceptions) { - __ unlock_object(R26_monitor, check_exceptions); -} - // Lock the current method, interpreter register window must be set up! void TemplateInterpreterGenerator::lock_method(Register Rflags, Register Rscratch1, Register Rscratch2, bool flags_preloaded) { const Register Robj_to_lock = Rscratch2; @@ -1566,7 +1562,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { if (synchronized) { // Don't check for exceptions since we're still in the i2n frame. Do that // manually afterwards. - unlock_method(false); + __ unlock_object(R26_monitor, false); // Can also unlock methods. } // Reset active handles after returning from native. @@ -1609,7 +1605,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { if (synchronized) { // Don't check for exceptions since we're still in the i2n frame. Do that // manually afterwards. - unlock_method(false); + __ unlock_object(R26_monitor, false); // Can also unlock methods. } BIND(exception_return_sync_check_already_unlocked); diff --git a/hotspot/src/cpu/sparc/vm/c1_LIR_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_LIR_sparc.cpp new file mode 100644 index 00000000000..e9467760679 --- /dev/null +++ b/hotspot/src/cpu/sparc/vm/c1_LIR_sparc.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2016, 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. + * + */ + +#include "precompiled.hpp" +#include "asm/register.hpp" +#include "c1/c1_FrameMap.hpp" +#include "c1/c1_LIR.hpp" + +FloatRegister LIR_OprDesc::as_float_reg() const { + return FrameMap::nr2floatreg(fpu_regnr()); +} + +FloatRegister LIR_OprDesc::as_double_reg() const { + return FrameMap::nr2floatreg(fpu_regnrHi()); +} + +LIR_Opr LIR_OprFact::double_fpu(int reg1, int reg2) { + assert(as_FloatRegister(reg2) != fnoreg, "Sparc holds double in two regs."); + return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) | + (reg2 << LIR_OprDesc::reg2_shift) | + LIR_OprDesc::double_type | + LIR_OprDesc::fpu_register | + LIR_OprDesc::double_size); +} + +#ifndef PRODUCT +void LIR_Address::verify() const { + assert(scale() == times_1, "Scaled addressing mode not available on SPARC and should not be used"); + assert(disp() == 0 || index()->is_illegal(), "can't have both"); +#ifdef _LP64 + assert(base()->is_cpu_register(), "wrong base operand"); + assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand"); + assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA, + "wrong type for addresses"); +#else + assert(base()->is_single_cpu(), "wrong base operand"); + assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand"); + assert(base()->type() == T_OBJECT || base()->type() == T_INT || base()->type() == T_METADATA, + "wrong type for addresses"); +#endif +} +#endif // PRODUCT diff --git a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp index 26488c92dc0..43e98a7d43f 100644 --- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp @@ -761,7 +761,6 @@ void LIRGenerator::do_CompareAndSwap(Intrinsic* x, ValueType* type) { } else { a = new LIR_Address(obj.result(), offset.result(), - LIR_Address::times_1, 0, as_BasicType(type)); } @@ -1081,7 +1080,6 @@ void LIRGenerator::do_update_CRC32(Intrinsic* x) { LIR_Address* a = new LIR_Address(base_op, index, - LIR_Address::times_1, offset, T_BYTE); BasicTypeList signature(3); @@ -1157,13 +1155,11 @@ void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) { LIR_Address* addr_a = new LIR_Address(result_a, result_aOffset, - LIR_Address::times_1, constant_aOffset, T_BYTE); LIR_Address* addr_b = new LIR_Address(result_b, result_bOffset, - LIR_Address::times_1, constant_bOffset, T_BYTE); diff --git a/hotspot/src/cpu/x86/vm/c1_LIR_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIR_x86.cpp new file mode 100644 index 00000000000..92277ee0631 --- /dev/null +++ b/hotspot/src/cpu/x86/vm/c1_LIR_x86.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2016, 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. + * + */ + +#include "precompiled.hpp" +#include "asm/register.hpp" +#include "c1/c1_FrameMap.hpp" +#include "c1/c1_LIR.hpp" + + +FloatRegister LIR_OprDesc::as_float_reg() const { + ShouldNotReachHere(); + return fnoreg; +} + +FloatRegister LIR_OprDesc::as_double_reg() const { + ShouldNotReachHere(); + return fnoreg; +} + +XMMRegister LIR_OprDesc::as_xmm_float_reg() const { + return FrameMap::nr2xmmreg(xmm_regnr()); +} + +XMMRegister LIR_OprDesc::as_xmm_double_reg() const { + assert(xmm_regnrLo() == xmm_regnrHi(), "assumed in calculation"); + return FrameMap::nr2xmmreg(xmm_regnrLo()); +} + +// Reg2 unused. +LIR_Opr LIR_OprFact::double_fpu(int reg1, int reg2) { + assert(as_FloatRegister(reg2) == fnoreg, "Not used on this platform"); + return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) | + (reg1 << LIR_OprDesc::reg2_shift) | + LIR_OprDesc::double_type | + LIR_OprDesc::fpu_register | + LIR_OprDesc::double_size); +} + +#ifndef PRODUCT +void LIR_Address::verify() const { +#ifdef _LP64 + assert(base()->is_cpu_register(), "wrong base operand"); + assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand"); + assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA, + "wrong type for addresses"); +#else + assert(base()->is_single_cpu(), "wrong base operand"); + assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand"); + assert(base()->type() == T_OBJECT || base()->type() == T_INT || base()->type() == T_METADATA, + "wrong type for addresses"); +#endif +} +#endif // PRODUCT diff --git a/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp b/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp index 6c0ca8e9b48..555365c9646 100644 --- a/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp +++ b/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, 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 @@ -50,6 +50,8 @@ REGISTER_DEFINITION(Register, r14); REGISTER_DEFINITION(Register, r15); #endif // AMD64 +REGISTER_DEFINITION(FloatRegister, fnoreg); + REGISTER_DEFINITION(XMMRegister, xnoreg); REGISTER_DEFINITION(XMMRegister, xmm0 ); REGISTER_DEFINITION(XMMRegister, xmm1 ); diff --git a/hotspot/src/cpu/x86/vm/register_x86.hpp b/hotspot/src/cpu/x86/vm/register_x86.hpp index 1d1c6eef627..f5c44964b96 100644 --- a/hotspot/src/cpu/x86/vm/register_x86.hpp +++ b/hotspot/src/cpu/x86/vm/register_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, 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 @@ -124,6 +124,8 @@ class FloatRegisterImpl: public AbstractRegisterImpl { }; +CONSTANT_REGISTER_DECLARATION(FloatRegister, fnoreg, (-1)); + // Use XMMRegister as shortcut class XMMRegisterImpl; typedef XMMRegisterImpl* XMMRegister; diff --git a/hotspot/src/share/vm/c1/c1_Compilation.hpp b/hotspot/src/share/vm/c1/c1_Compilation.hpp index a60d1fd62a3..bca812f606c 100644 --- a/hotspot/src/share/vm/c1/c1_Compilation.hpp +++ b/hotspot/src/share/vm/c1/c1_Compilation.hpp @@ -194,12 +194,7 @@ class Compilation: public StackObj { const char* bailout_msg() const { return _bailout_msg; } static int desired_max_code_buffer_size() { -#ifndef PPC32 - return (int) NMethodSizeLimit; // default 256K or 512K -#else - // conditional branches on PPC are restricted to 16 bit signed - return MIN2((unsigned int)NMethodSizeLimit,32*K); -#endif + return (int)NMethodSizeLimit; // default 64K } static int desired_max_constant_size() { return desired_max_code_buffer_size() / 10; diff --git a/hotspot/src/share/vm/c1/c1_LIR.cpp b/hotspot/src/share/vm/c1/c1_LIR.cpp index c650ec0b9df..ced682b5c0b 100644 --- a/hotspot/src/share/vm/c1/c1_LIR.cpp +++ b/hotspot/src/share/vm/c1/c1_LIR.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, 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 @@ -42,44 +42,6 @@ Register LIR_OprDesc::as_register_hi() const { return FrameMap::cpu_rnr2reg(cpu_regnrHi()); } -#if defined(X86) - -XMMRegister LIR_OprDesc::as_xmm_float_reg() const { - return FrameMap::nr2xmmreg(xmm_regnr()); -} - -XMMRegister LIR_OprDesc::as_xmm_double_reg() const { - assert(xmm_regnrLo() == xmm_regnrHi(), "assumed in calculation"); - return FrameMap::nr2xmmreg(xmm_regnrLo()); -} - -#endif // X86 - -#if defined(SPARC) || defined(PPC32) - -FloatRegister LIR_OprDesc::as_float_reg() const { - return FrameMap::nr2floatreg(fpu_regnr()); -} - -FloatRegister LIR_OprDesc::as_double_reg() const { - return FrameMap::nr2floatreg(fpu_regnrHi()); -} - -#endif - -#if defined(ARM) || defined(AARCH64) || defined(PPC64) - -FloatRegister LIR_OprDesc::as_float_reg() const { - return as_FloatRegister(fpu_regnr()); -} - -FloatRegister LIR_OprDesc::as_double_reg() const { - return as_FloatRegister(fpu_regnrLo()); -} - -#endif - - LIR_Opr LIR_OprFact::illegalOpr = LIR_OprFact::illegal(); LIR_Opr LIR_OprFact::value_type(ValueType* type) { @@ -140,32 +102,6 @@ LIR_Address::Scale LIR_Address::scale(BasicType type) { return LIR_Address::times_1; } - -#ifndef PRODUCT -void LIR_Address::verify0() const { -#if defined(SPARC) || defined(PPC) - assert(scale() == times_1, "Scaled addressing mode not available on SPARC/PPC and should not be used"); - assert(disp() == 0 || index()->is_illegal(), "can't have both"); -#endif -#ifdef _LP64 - assert(base()->is_cpu_register(), "wrong base operand"); -#ifndef AARCH64 - assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand"); -#else - assert(index()->is_illegal() || index()->is_double_cpu() || index()->is_single_cpu(), "wrong index operand"); -#endif - assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA, - "wrong type for addresses"); -#else - assert(base()->is_single_cpu(), "wrong base operand"); - assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand"); - assert(base()->type() == T_OBJECT || base()->type() == T_INT || base()->type() == T_METADATA, - "wrong type for addresses"); -#endif -} -#endif - - //--------------------------------------------------- char LIR_OprDesc::type_char(BasicType t) { diff --git a/hotspot/src/share/vm/c1/c1_LIR.hpp b/hotspot/src/share/vm/c1/c1_LIR.hpp index 2943b380901..7ca75ff3ebe 100644 --- a/hotspot/src/share/vm/c1/c1_LIR.hpp +++ b/hotspot/src/share/vm/c1/c1_LIR.hpp @@ -28,6 +28,7 @@ #include "c1/c1_Defs.hpp" #include "c1/c1_ValueType.hpp" #include "oops/method.hpp" +#include "utilities/globalDefinitions.hpp" class BlockBegin; class BlockList; @@ -438,15 +439,13 @@ class LIR_OprDesc: public CompilationResourceObj { return as_register(); } -#ifdef X86 - XMMRegister as_xmm_float_reg() const; - XMMRegister as_xmm_double_reg() const; - // for compatibility with RInfo - int fpu () const { return lo_reg_half(); } -#endif -#if defined(SPARC) || defined(ARM) || defined(PPC) || defined(AARCH64) FloatRegister as_float_reg () const; FloatRegister as_double_reg () const; +#ifdef X86 + XMMRegister as_xmm_float_reg () const; + XMMRegister as_xmm_double_reg() const; + // for compatibility with RInfo + int fpu() const { return lo_reg_half(); } #endif jint as_jint() const { return as_constant_ptr()->as_jint(); } @@ -534,14 +533,19 @@ class LIR_Address: public LIR_OprPtr { , _type(type) , _disp(0) { verify(); } -#if defined(X86) || defined(ARM) || defined(AARCH64) + LIR_Address(LIR_Opr base, LIR_Opr index, intx disp, BasicType type): + _base(base) + , _index(index) + , _scale(times_1) + , _type(type) + , _disp(disp) { verify(); } + LIR_Address(LIR_Opr base, LIR_Opr index, Scale scale, intx disp, BasicType type): _base(base) , _index(index) , _scale(scale) , _type(type) , _disp(disp) { verify(); } -#endif // X86 || ARM LIR_Opr base() const { return _base; } LIR_Opr index() const { return _index; } @@ -554,13 +558,7 @@ class LIR_Address: public LIR_OprPtr { virtual BasicType type() const { return _type; } virtual void print_value_on(outputStream* out) const PRODUCT_RETURN; - void verify0() const PRODUCT_RETURN; -#if defined(LIR_ADDRESS_PD_VERIFY) && !defined(PRODUCT) - void pd_verify() const; - void verify() const { pd_verify(); } -#else - void verify() const { verify0(); } -#endif + void verify() const PRODUCT_RETURN; static Scale scale(BasicType type); }; @@ -605,59 +603,49 @@ class LIR_OprFact: public AllStatic { LIR_OprDesc::double_size); } - static LIR_Opr single_fpu(int reg) { return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) | - LIR_OprDesc::float_type | - LIR_OprDesc::fpu_register | - LIR_OprDesc::single_size); } -#if defined(ARM32) - static LIR_Opr double_fpu(int reg1, int reg2) { return (LIR_Opr)((reg1 << LIR_OprDesc::reg1_shift) | (reg2 << LIR_OprDesc::reg2_shift) | LIR_OprDesc::double_type | LIR_OprDesc::fpu_register | LIR_OprDesc::double_size); } - static LIR_Opr single_softfp(int reg) { return (LIR_Opr)((reg << LIR_OprDesc::reg1_shift) | LIR_OprDesc::float_type | LIR_OprDesc::cpu_register | LIR_OprDesc::single_size); } - static LIR_Opr double_softfp(int reg1, int reg2) { return (LIR_Opr)((reg1 << LIR_OprDesc::reg1_shift) | (reg2 << LIR_OprDesc::reg2_shift) | LIR_OprDesc::double_type | LIR_OprDesc::cpu_register | LIR_OprDesc::double_size); } -#endif -#ifdef SPARC - static LIR_Opr double_fpu(int reg1, int reg2) { return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) | - (reg2 << LIR_OprDesc::reg2_shift) | - LIR_OprDesc::double_type | - LIR_OprDesc::fpu_register | - LIR_OprDesc::double_size); } -#endif -#if defined(X86) || defined(AARCH64) - static LIR_Opr double_fpu(int reg) { return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) | - (reg << LIR_OprDesc::reg2_shift) | - LIR_OprDesc::double_type | - LIR_OprDesc::fpu_register | - LIR_OprDesc::double_size); } + static LIR_Opr single_fpu(int reg) { + return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) | + LIR_OprDesc::float_type | + LIR_OprDesc::fpu_register | + LIR_OprDesc::single_size); + } - static LIR_Opr single_xmm(int reg) { return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) | - LIR_OprDesc::float_type | - LIR_OprDesc::fpu_register | - LIR_OprDesc::single_size | - LIR_OprDesc::is_xmm_mask); } - static LIR_Opr double_xmm(int reg) { return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) | - (reg << LIR_OprDesc::reg2_shift) | - LIR_OprDesc::double_type | - LIR_OprDesc::fpu_register | - LIR_OprDesc::double_size | - LIR_OprDesc::is_xmm_mask); } + // Platform dependant. + static LIR_Opr double_fpu(int reg1, int reg2 = -1 /*fnoreg*/); + +#ifdef __SOFTFP__ + static LIR_Opr single_softfp(int reg) { + return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) | + LIR_OprDesc::float_type | + LIR_OprDesc::cpu_register | + LIR_OprDesc::single_size); + } + static LIR_Opr double_softfp(int reg1, int reg2) { + return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) | + (reg2 << LIR_OprDesc::reg2_shift) | + LIR_OprDesc::double_type | + LIR_OprDesc::cpu_register | + LIR_OprDesc::double_size); + } +#endif // __SOFTFP__ + +#if defined(X86) + static LIR_Opr single_xmm(int reg) { + return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) | + LIR_OprDesc::float_type | + LIR_OprDesc::fpu_register | + LIR_OprDesc::single_size | + LIR_OprDesc::is_xmm_mask); + } + static LIR_Opr double_xmm(int reg) { + return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) | + (reg << LIR_OprDesc::reg2_shift) | + LIR_OprDesc::double_type | + LIR_OprDesc::fpu_register | + LIR_OprDesc::double_size | + LIR_OprDesc::is_xmm_mask); + } #endif // X86 -#if defined(PPC) - static LIR_Opr double_fpu(int reg) { return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) | - (reg << LIR_OprDesc::reg2_shift) | - LIR_OprDesc::double_type | - LIR_OprDesc::fpu_register | - LIR_OprDesc::double_size); } -#endif -#ifdef PPC32 - static LIR_Opr single_softfp(int reg) { return (LIR_Opr)((reg << LIR_OprDesc::reg1_shift) | - LIR_OprDesc::float_type | - LIR_OprDesc::cpu_register | - LIR_OprDesc::single_size); } - static LIR_Opr double_softfp(int reg1, int reg2) { return (LIR_Opr)((reg2 << LIR_OprDesc::reg1_shift) | - (reg1 << LIR_OprDesc::reg2_shift) | - LIR_OprDesc::double_type | - LIR_OprDesc::cpu_register | - LIR_OprDesc::double_size); } -#endif // PPC32 static LIR_Opr virtual_register(int index, BasicType type) { LIR_Opr res; @@ -1467,37 +1455,15 @@ class LIR_OpConvert: public LIR_Op1 { private: Bytecodes::Code _bytecode; ConversionStub* _stub; -#ifdef PPC32 - LIR_Opr _tmp1; - LIR_Opr _tmp2; -#endif public: LIR_OpConvert(Bytecodes::Code code, LIR_Opr opr, LIR_Opr result, ConversionStub* stub) : LIR_Op1(lir_convert, opr, result) , _stub(stub) -#ifdef PPC32 - , _tmp1(LIR_OprDesc::illegalOpr()) - , _tmp2(LIR_OprDesc::illegalOpr()) -#endif , _bytecode(code) {} -#ifdef PPC32 - LIR_OpConvert(Bytecodes::Code code, LIR_Opr opr, LIR_Opr result, ConversionStub* stub - ,LIR_Opr tmp1, LIR_Opr tmp2) - : LIR_Op1(lir_convert, opr, result) - , _stub(stub) - , _tmp1(tmp1) - , _tmp2(tmp2) - , _bytecode(code) {} -#endif - Bytecodes::Code bytecode() const { return _bytecode; } ConversionStub* stub() const { return _stub; } -#ifdef PPC32 - LIR_Opr tmp1() const { return _tmp1; } - LIR_Opr tmp2() const { return _tmp2; } -#endif virtual void emit_code(LIR_Assembler* masm); virtual LIR_OpConvert* as_OpConvert() { return this; } @@ -2136,9 +2102,6 @@ class LIR_List: public CompilationResourceObj { void safepoint(LIR_Opr tmp, CodeEmitInfo* info) { append(new LIR_Op1(lir_safepoint, tmp, info)); } -#ifdef PPC32 - void convert(Bytecodes::Code code, LIR_Opr left, LIR_Opr dst, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_OpConvert(code, left, dst, NULL, tmp1, tmp2)); } -#endif void convert(Bytecodes::Code code, LIR_Opr left, LIR_Opr dst, ConversionStub* stub = NULL/*, bool is_32bit = false*/) { append(new LIR_OpConvert(code, left, dst, stub)); } void logical_and (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_and, left, right, dst)); } diff --git a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp index 38bad1811d8..6f8972e38ac 100644 --- a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp +++ b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp @@ -101,14 +101,16 @@ class TemplateInterpreterGenerator: public AbstractInterpreterGenerator { address generate_Double_longBitsToDouble_entry(); address generate_Double_doubleToRawLongBits_entry(); #endif // IA32 + // Some platforms don't need registers, other need two. Unused function is + // left unimplemented. void generate_stack_overflow_check(void); + void generate_stack_overflow_check(Register Rframe_size, Register Rscratch); void generate_counter_incr(Label* overflow, Label* profile_method, Label* profile_method_continue); void generate_counter_overflow(Label& continue_entry); void generate_fixed_frame(bool native_call); #ifdef SPARC - void generate_stack_overflow_check(Register Rframe_size, Register Rscratch); void save_native_result(void); void restore_native_result(void); #endif // SPARC @@ -119,10 +121,7 @@ class TemplateInterpreterGenerator: public AbstractInterpreterGenerator { #ifdef PPC void lock_method(Register Rflags, Register Rscratch1, Register Rscratch2, bool flags_preloaded=false); - void unlock_method(bool check_exceptions = true); - void generate_fixed_frame(bool native_call, Register Rsize_of_parameters, Register Rsize_of_locals); - void generate_stack_overflow_check(Register Rframe_size, Register Rscratch1); #endif // PPC public: From 368df4fd8dab0fa75368662eb170d89e81c720ae Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Tue, 19 Jul 2016 18:11:03 +0000 Subject: [PATCH 043/108] 8161292: [JVMCI] missing test files from 8159368 Reviewed-by: twisti, kvn --- .../amd64/AMD64HotSpotRegisterConfig.java | 46 +++- .../jdk.vm.ci.code.test/libNativeCallTest.c | 196 ++++++++++++++ .../jdk/vm/ci/code/test/NativeCallTest.java | 241 ++++++++++++++++++ .../code/test/amd64/AMD64TestAssembler.java | 38 +-- 4 files changed, 494 insertions(+), 27 deletions(-) create mode 100644 hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/libNativeCallTest.c create mode 100644 hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java index 7f3eb35f7b3..705f0b997bb 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java @@ -105,7 +105,9 @@ public class AMD64HotSpotRegisterConfig implements RegisterConfig { private final RegisterArray javaGeneralParameterRegisters; private final RegisterArray nativeGeneralParameterRegisters; - private final RegisterArray xmmParameterRegisters = new RegisterArray(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7); + private final RegisterArray javaXMMParameterRegisters; + private final RegisterArray nativeXMMParameterRegisters; + private final boolean windowsOS; /* * Some ABIs (e.g. Windows) require a so-called "home space", that is a save area on the stack @@ -143,23 +145,27 @@ public class AMD64HotSpotRegisterConfig implements RegisterConfig { assert callerSaved.size() >= allocatable.size(); } - public AMD64HotSpotRegisterConfig(TargetDescription target, RegisterArray allocatable, boolean windowsOs) { + public AMD64HotSpotRegisterConfig(TargetDescription target, RegisterArray allocatable, boolean windowsOS) { this.target = target; + this.windowsOS = windowsOS; - if (windowsOs) { + if (windowsOS) { javaGeneralParameterRegisters = new RegisterArray(rdx, r8, r9, rdi, rsi, rcx); nativeGeneralParameterRegisters = new RegisterArray(rcx, rdx, r8, r9); + nativeXMMParameterRegisters = new RegisterArray(xmm0, xmm1, xmm2, xmm3); this.needsNativeStackHomeSpace = true; } else { javaGeneralParameterRegisters = new RegisterArray(rsi, rdx, rcx, r8, r9, rdi); nativeGeneralParameterRegisters = new RegisterArray(rdi, rsi, rdx, rcx, r8, r9); + nativeXMMParameterRegisters = new RegisterArray(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7); this.needsNativeStackHomeSpace = false; } + javaXMMParameterRegisters = new RegisterArray(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7); this.allocatable = allocatable; Set callerSaveSet = new HashSet<>(); allocatable.addTo(callerSaveSet); - xmmParameterRegisters.addTo(callerSaveSet); + javaXMMParameterRegisters.addTo(callerSaveSet); callerSaveSet.addAll(javaGeneralParameterRegisters.asList()); nativeGeneralParameterRegisters.addTo(callerSaveSet); callerSaved = new RegisterArray(callerSaveSet); @@ -187,11 +193,11 @@ public class AMD64HotSpotRegisterConfig implements RegisterConfig { public CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, ValueKindFactory valueKindFactory) { HotSpotCallingConventionType hotspotType = (HotSpotCallingConventionType) type; if (type == HotSpotCallingConventionType.NativeCall) { - return callingConvention(nativeGeneralParameterRegisters, returnType, parameterTypes, hotspotType, valueKindFactory); + return callingConvention(nativeGeneralParameterRegisters, nativeXMMParameterRegisters, windowsOS, returnType, parameterTypes, hotspotType, valueKindFactory); } // On x64, parameter locations are the same whether viewed // from the caller or callee perspective - return callingConvention(javaGeneralParameterRegisters, returnType, parameterTypes, hotspotType, valueKindFactory); + return callingConvention(javaGeneralParameterRegisters, javaXMMParameterRegisters, false, returnType, parameterTypes, hotspotType, valueKindFactory); } @Override @@ -208,14 +214,33 @@ public class AMD64HotSpotRegisterConfig implements RegisterConfig { return hotspotType == HotSpotCallingConventionType.NativeCall ? nativeGeneralParameterRegisters : javaGeneralParameterRegisters; case Float: case Double: - return xmmParameterRegisters; + return hotspotType == HotSpotCallingConventionType.NativeCall ? nativeXMMParameterRegisters : javaXMMParameterRegisters; default: throw JVMCIError.shouldNotReachHere(); } } - private CallingConvention callingConvention(RegisterArray generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, HotSpotCallingConventionType type, + /** + * Hand out registers matching the calling convention from the {@code generalParameterRegisters} + * and {@code xmmParameterRegisters} sets. Normally registers are handed out from each set + * individually based on the type of the argument. If the {@code unified} flag is true then hand + * out registers in a single sequence, selecting between the sets based on the type. This is to + * support the Windows calling convention which only ever passes 4 arguments in registers, no + * matter their types. + * + * @param generalParameterRegisters + * @param xmmParameterRegisters + * @param unified + * @param returnType + * @param parameterTypes + * @param type + * @param valueKindFactory + * @return the resulting calling convention + */ + private CallingConvention callingConvention(RegisterArray generalParameterRegisters, RegisterArray xmmParameterRegisters, boolean unified, JavaType returnType, JavaType[] parameterTypes, + HotSpotCallingConventionType type, ValueKindFactory valueKindFactory) { + assert !unified || generalParameterRegisters.size() == xmmParameterRegisters.size() : "must be same size in unified mode"; AllocatableValue[] locations = new AllocatableValue[parameterTypes.length]; int currentGeneral = 0; @@ -240,8 +265,8 @@ public class AMD64HotSpotRegisterConfig implements RegisterConfig { break; case Float: case Double: - if (currentXMM < xmmParameterRegisters.size()) { - Register register = xmmParameterRegisters.get(currentXMM++); + if ((unified ? currentGeneral : currentXMM) < xmmParameterRegisters.size()) { + Register register = xmmParameterRegisters.get(unified ? currentGeneral++ : currentXMM++); locations[i] = register.asValue(valueKindFactory.getValueKind(kind)); } break; @@ -255,6 +280,7 @@ public class AMD64HotSpotRegisterConfig implements RegisterConfig { currentStackOffset += Math.max(valueKind.getPlatformKind().getSizeInBytes(), target.wordSize); } } + assert !unified || currentXMM == 0 : "shouldn't be used in unified mode"; JavaKind returnKind = returnType == null ? JavaKind.Void : returnType.getJavaKind(); AllocatableValue returnLocation = returnKind == JavaKind.Void ? Value.ILLEGAL : getReturnRegister(returnKind).asValue(valueKindFactory.getValueKind(returnKind.getStackKind())); diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/libNativeCallTest.c b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/libNativeCallTest.c new file mode 100644 index 00000000000..55572e60f97 --- /dev/null +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/libNativeCallTest.c @@ -0,0 +1,196 @@ +/* + * Copyright (c) 2016, 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. + * + */ + +#include +#include + +#include "jni.h" + +#ifdef __cplusplus +extern "C" { +#endif + +jfloat JNICALL SS(jfloat f1, jfloat f2) { + return f1 + f2; +} + +JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getFF(JNIEnv *env, jclass clazz) { + return (jlong)(intptr_t)SS; +} + +JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1FF(JNIEnv *env, jclass clazz, jfloat a, jfloat b) { + return SS(a, b); +} + +jfloat JNICALL SDILDS(jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { + return (jfloat)(a + b + c + d + e + f); +} + +JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getSDILDS(JNIEnv *env, jclass clazz) { + return (jlong)(intptr_t)SDILDS; +} + +JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1SDILDS(JNIEnv *env, jclass clazz, + jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { + return SDILDS(a, b, c, d, e, f); +} + +jfloat JNICALL F32SDILDS(jfloat f00, jfloat f01, jfloat f02, jfloat f03, jfloat f04, jfloat f05, jfloat f06, jfloat f07, + jfloat f08, jfloat f09, jfloat f0a, jfloat f0b, jfloat f0c, jfloat f0d, jfloat f0e, jfloat f0f, + jfloat f10, jfloat f11, jfloat f12, jfloat f13, jfloat f14, jfloat f15, jfloat f16, jfloat f17, + jfloat f18, jfloat f19, jfloat f1a, jfloat f1b, jfloat f1c, jfloat f1d, jfloat f1e, jfloat f1f, + jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { + return (jfloat)(f00 + f01 + f02 + f03 + f04 + f05 + f06 + f07 + + f08 + f09 + f0a + f0b + f0c + f0d + f0e + f0f + + f10 + f11 + f12 + f13 + f14 + f15 + f16 + f17 + + f18 + f19 + f1a + f1b + f1c + f1d + f1e + f1f + + a + b + c + d + e + f); +} + +JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getF32SDILDS(JNIEnv *env, jclass clazz) { + return (jlong)(intptr_t)F32SDILDS; +} + +JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1F32SDILDS(JNIEnv *env, jclass clazz, + jfloat f00, jfloat f01, jfloat f02, jfloat f03, + jfloat f04, jfloat f05, jfloat f06, jfloat f07, + jfloat f08, jfloat f09, jfloat f0a, jfloat f0b, + jfloat f0c, jfloat f0d, jfloat f0e, jfloat f0f, + jfloat f10, jfloat f11, jfloat f12, jfloat f13, + jfloat f14, jfloat f15, jfloat f16, jfloat f17, + jfloat f18, jfloat f19, jfloat f1a, jfloat f1b, + jfloat f1c, jfloat f1d, jfloat f1e, jfloat f1f, + jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { + return F32SDILDS(f00, f01, f02, f03, f04, f05, f06, f07, + f08, f09, f0a, f0b, f0c, f0d, f0e, f0f, + f10, f11, f12, f13, f14, f15, f16, f17, + f18, f19, f1a, f1b, f1c, f1d, f1e, f1f, + a, b, c, d, e, f); +} + + +jfloat JNICALL D32SDILDS(jdouble d00, jdouble d01, jdouble d02, jdouble d03, jdouble d04, jdouble d05, jdouble d06, jdouble d07, + jdouble d08, jdouble d09, jdouble d0a, jdouble d0b, jdouble d0c, jdouble d0d, jdouble d0e, jdouble d0f, + jdouble d10, jdouble d11, jdouble d12, jdouble d13, jdouble d14, jdouble d15, jdouble d16, jdouble d17, + jdouble d18, jdouble d19, jdouble d1a, jdouble d1b, jdouble d1c, jdouble d1d, jdouble d1e, jdouble d1f, + jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { + return (jfloat)(d00 + d01 + d02 + d03 + d04 + d05 + d06 + d07 + + d08 + d09 + d0a + d0b + d0c + d0d + d0e + d0f + + d10 + d11 + d12 + d13 + d14 + d15 + d16 + d17 + + d18 + d19 + d1a + d1b + d1c + d1d + d1e + d1f + + a + b + c + d + e + f); +} + +JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getD32SDILDS(JNIEnv *env, jclass clazz) { + return (jlong)(intptr_t)D32SDILDS; +} + +JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1D32SDILDS(JNIEnv *env, jclass clazz, + jdouble d00, jdouble d01, jdouble d02, jdouble d03, + jdouble d04, jdouble d05, jdouble d06, jdouble d07, + jdouble d08, jdouble d09, jdouble d0a, jdouble d0b, + jdouble d0c, jdouble d0d, jdouble d0e, jdouble d0f, + jdouble d10, jdouble d11, jdouble d12, jdouble d13, + jdouble d14, jdouble d15, jdouble d16, jdouble d17, + jdouble d18, jdouble d19, jdouble d1a, jdouble d1b, + jdouble d1c, jdouble d1d, jdouble d1e, jdouble d1f, + jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { + return D32SDILDS(d00, d01, d02, d03, d04, d05, d06, d07, + d08, d09, d0a, d0b, d0c, d0d, d0e, d0f, + d10, d11, d12, d13, d14, d15, d16, d17, + d18, d19, d1a, d1b, d1c, d1d, d1e, d1f, + a, b, c, d, e, f); +} + + +jfloat JNICALL I32SDILDS(jint i00, jint i01, jint i02, jint i03, jint i04, jint i05, jint i06, jint i07, + jint i08, jint i09, jint i0a, jint i0b, jint i0c, jint i0d, jint i0e, jint i0f, + jint i10, jint i11, jint i12, jint i13, jint i14, jint i15, jint i16, jint i17, + jint i18, jint i19, jint i1a, jint i1b, jint i1c, jint i1d, jint i1e, jint i1f, + jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { + return (jfloat)(i00 + i01 + i02 + i03 + i04 + i05 + i06 + i07 + + i08 + i09 + i0a + i0b + i0c + i0d + i0e + i0f + + i10 + i11 + i12 + i13 + i14 + i15 + i16 + i17 + + i18 + i19 + i1a + i1b + i1c + i1d + i1e + i1f + + a + b + c + d + e + f); +} + +JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getI32SDILDS(JNIEnv *env, jclass clazz) { + return (jlong) (intptr_t) I32SDILDS; +} + +JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1I32SDILDS(JNIEnv *env, jclass clazz, + jint i00, jint i01, jint i02, jint i03, + jint i04, jint i05, jint i06, jint i07, + jint i08, jint i09, jint i0a, jint i0b, + jint i0c, jint i0d, jint i0e, jint i0f, + jint i10, jint i11, jint i12, jint i13, + jint i14, jint i15, jint i16, jint i17, + jint i18, jint i19, jint i1a, jint i1b, + jint i1c, jint i1d, jint i1e, jint i1f, + jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { + return I32SDILDS(i00, i01, i02, i03, i04, i05, i06, i07, + i08, i09, i0a, i0b, i0c, i0d, i0e, i0f, + i10, i11, i12, i13, i14, i15, i16, i17, + i18, i19, i1a, i1b, i1c, i1d, i1e, i1f, + a, b, c, d, e, f); +} + +jfloat JNICALL L32SDILDS(jlong l00, jlong l01, jlong l02, jlong l03, jlong l04, jlong l05, jlong l06, jlong l07, + jlong l08, jlong l09, jlong l0a, jlong l0b, jlong l0c, jlong l0d, jlong l0e, jlong l0f, + jlong l10, jlong l11, jlong l12, jlong l13, jlong l14, jlong l15, jlong l16, jlong l17, + jlong l18, jlong l19, jlong l1a, jlong l1b, jlong l1c, jlong l1d, jlong l1e, jlong l1f, + jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { + return (jfloat)(l00 + l01 + l02 + l03 + l04 + l05 + l06 + l07 + + l08 + l09 + l0a + l0b + l0c + l0d + l0e + l0f + + l10 + l11 + l12 + l13 + l14 + l15 + l16 + l17 + + l18 + l19 + l1a + l1b + l1c + l1d + l1e + l1f + + a + b + c + d + e + f); +} + +JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getL32SDILDS(JNIEnv *env, jclass clazz) { + return (jlong)(intptr_t)L32SDILDS; +} + +JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1L32SDILDS(JNIEnv *env, jclass clazz, + jlong l00, jlong l01, jlong l02, jlong l03, + jlong l04, jlong l05, jlong l06, jlong l07, + jlong l08, jlong l09, jlong l0a, jlong l0b, + jlong l0c, jlong l0d, jlong l0e, jlong l0f, + jlong l10, jlong l11, jlong l12, jlong l13, + jlong l14, jlong l15, jlong l16, jlong l17, + jlong l18, jlong l19, jlong l1a, jlong l1b, + jlong l1c, jlong l1d, jlong l1e, jlong l1f, + jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { + return L32SDILDS(l00, l01, l02, l03, l04, l05, l06, l07, + l08, l09, l0a, l0b, l0c, l0d, l0e, l0f, + l10, l11, l12, l13, l14, l15, l16, l17, + l18, l19, l1a, l1b, l1c, l1d, l1e, l1f, + a, b, c, d, e, f); +} + +#ifdef __cplusplus +} +#endif + diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java new file mode 100644 index 00000000000..c7bb20568d8 --- /dev/null +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2016, 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 + * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64" + * @library /test/lib /testlibrary / + * @modules jdk.vm.ci/jdk.vm.ci.hotspot + * jdk.vm.ci/jdk.vm.ci.code + * jdk.vm.ci/jdk.vm.ci.code.site + * jdk.vm.ci/jdk.vm.ci.meta + * jdk.vm.ci/jdk.vm.ci.runtime + * jdk.vm.ci/jdk.vm.ci.common + * jdk.vm.ci/jdk.vm.ci.amd64 + * jdk.vm.ci/jdk.vm.ci.sparc + * @compile CodeInstallationTest.java TestHotSpotVMConfig.java NativeCallTest.java TestAssembler.java sparc/SPARCTestAssembler.java amd64/AMD64TestAssembler.java + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Xbootclasspath/a:. jdk.vm.ci.code.test.NativeCallTest + */ +package jdk.vm.ci.code.test; + +import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.NativeCall; + +import org.junit.BeforeClass; +import org.junit.Test; + +import jdk.vm.ci.code.CallingConvention; +import jdk.vm.ci.code.RegisterValue; +import jdk.vm.ci.meta.JavaType; + +public class NativeCallTest extends CodeInstallationTest { + + @BeforeClass + public static void beforeClass() { + System.loadLibrary("NativeCallTest"); + } + + @Test + public void testFF() { + float a = 1.2345678f; + float b = 8.7654321f; + test("FF", getFF(), float.class, new Class[]{float.class, float.class}, new Object[]{a, b}); + } + + @Test + public void testSDILDS() { + float a = 1.2345678f; + double b = 3.212434; + int c = 43921652; + long d = 412435326; + double e = .31212333; + float f = 8.7654321f; + Class[] argClazz = new Class[]{float.class, double.class, int.class, long.class, double.class, + float.class}; + test("SDILDS", getSDILDS(), float.class, argClazz, new Object[]{a, b, c, d, e, f}); + } + + @Test + public void testF32SDILDS() { + int sCount = 32; + Object[] remainingArgs = new Object[]{ // Pairs of , + 1.2345678F, float.class, + 3.212434D, double.class, + 43921652, int.class, + 0xCAFEBABEDEADBEEFL, long.class, + .31212333D, double.class, + 8.7654321F, float.class + }; + Class[] argClazz = new Class[sCount + remainingArgs.length / 2]; + Object[] argValues = new Object[sCount + remainingArgs.length / 2]; + for (int i = 0; i < sCount; i++) { + argValues[i] = (float) i; + argClazz[i] = float.class; + } + for (int i = 0; i < remainingArgs.length; i += 2) { + argValues[sCount + i / 2] = remainingArgs[i + 0]; + argClazz[sCount + i / 2] = (Class) remainingArgs[i + 1]; + } + test("F32SDILDS", getF32SDILDS(), float.class, argClazz, argValues); + } + + @Test + public void testI32SDILDS() { + int sCount = 32; + Object[] remainingArgs = new Object[]{ // Pairs of , + 1.2345678F, float.class, + 3.212434D, double.class, + 43921652, int.class, + 0xCAFEBABEDEADBEEFL, long.class, + .31212333D, double.class, + 8.7654321F, float.class + }; + Class[] argClazz = new Class[sCount + remainingArgs.length / 2]; + Object[] argValues = new Object[sCount + remainingArgs.length / 2]; + for (int i = 0; i < sCount; i++) { + argValues[i] = i; + argClazz[i] = int.class; + } + for (int i = 0; i < remainingArgs.length; i += 2) { + argValues[sCount + i / 2] = remainingArgs[i + 0]; + argClazz[sCount + i / 2] = (Class) remainingArgs[i + 1]; + } + test("I32SDILDS", getI32SDILDS(), float.class, argClazz, argValues); + } + + public void test(String name, long addr, Class returnClazz, Class[] types, Object[] values) { + try { + test(asm -> { + JavaType[] argTypes = new JavaType[types.length]; + int i = 0; + for (Class clazz : types) { + argTypes[i++] = metaAccess.lookupJavaType(clazz); + } + JavaType returnType = metaAccess.lookupJavaType(returnClazz); + CallingConvention cc = codeCache.getRegisterConfig().getCallingConvention(NativeCall, returnType, argTypes, asm.valueKindFactory); + asm.emitCallPrologue(cc, values); + asm.emitCall(addr); + asm.emitCallEpilogue(cc); + asm.emitFloatRet(((RegisterValue) cc.getReturn()).getRegister()); + }, getMethod(name, types), values); + } catch (Throwable e) { + e.printStackTrace(); + throw e; + } + } + + public static native long getFF(); + + public static native float _FF(float a, float b); + + public static float FF(float a, float b) { + return _FF(a, b); + } + + public static native long getSDILDS(); + + public static native float _SDILDS(float a, double b, int c, long d, double e, float f); + + public static float SDILDS(float a, double b, int c, long d, double e, float f) { + return _SDILDS(a, b, c, d, e, f); + } + + public static native long getF32SDILDS(); + + public static native float _F32SDILDS(float f00, float f01, float f02, float f03, float f04, float f05, float f06, float f07, + float f08, float f09, float f0a, float f0b, float f0c, float f0d, float f0e, float f0f, + float f10, float f11, float f12, float f13, float f14, float f15, float f16, float f17, + float f18, float f19, float f1a, float f1b, float f1c, float f1d, float f1e, float f1f, + float a, double b, int c, long d, double e, float f); + + public static float F32SDILDS(float f00, float f01, float f02, float f03, float f04, float f05, float f06, float f07, + float f08, float f09, float f0a, float f0b, float f0c, float f0d, float f0e, float f0f, + float f10, float f11, float f12, float f13, float f14, float f15, float f16, float f17, + float f18, float f19, float f1a, float f1b, float f1c, float f1d, float f1e, float f1f, + float a, double b, int c, long d, double e, float f) { + return _F32SDILDS(f00, f01, f02, f03, f04, f05, f06, f07, + f08, f09, f0a, f0b, f0c, f0d, f0e, f0f, + f10, f11, f12, f13, f14, f15, f16, f17, + f18, f19, f1a, f1b, f1c, f1d, f1e, f1f, + a, b, c, d, e, f); + } + + public static native long getD32SDILDS(); + + public static native float _D32SDILDS(double d00, double d01, double d02, double d03, double d04, double d05, double d06, double d07, + double d08, double d09, double d0a, double d0b, double d0c, double d0d, double d0e, double d0f, + double d10, double d11, double d12, double d13, double d14, double d15, double d16, double d17, + double d18, double d19, double d1a, double d1b, double d1c, double d1d, double d1e, double d1f, + float a, double b, int c, long d, double e, float f); + + public static float D32SDILDS(double d00, double d01, double d02, double d03, double d04, double d05, double d06, double d07, + double d08, double d09, double d0a, double d0b, double d0c, double d0d, double d0e, double d0f, + double d10, double d11, double d12, double d13, double d14, double d15, double d16, double d17, + double d18, double d19, double d1a, double d1b, double d1c, double d1d, double d1e, double d1f, + float a, double b, int c, long d, double e, float f) { + return _D32SDILDS(d00, d01, d02, d03, d04, d05, d06, d07, + d08, d09, d0a, d0b, d0c, d0d, d0e, d0d, + d10, d11, d12, d13, d14, d15, d16, d17, + d18, d19, d1a, d1b, d1c, d1d, d1e, d1f, + a, b, c, d, e, f); + } + + public static native long getI32SDILDS(); + + public static native float _I32SDILDS(int i00, int i01, int i02, int i03, int i04, int i05, int i06, int i07, + int i08, int i09, int i0a, int i0b, int i0c, int i0d, int i0e, int i0f, + int i10, int i11, int i12, int i13, int i14, int i15, int i16, int i17, + int i18, int i19, int i1a, int i1b, int i1c, int i1d, int i1e, int i1f, + float a, double b, int c, long d, double e, float f); + + public static float I32SDILDS(int i00, int i01, int i02, int i03, int i04, int i05, int i06, int i07, + int i08, int i09, int i0a, int i0b, int i0c, int i0d, int i0e, int i0f, + int i10, int i11, int i12, int i13, int i14, int i15, int i16, int i17, + int i18, int i19, int i1a, int i1b, int i1c, int i1d, int i1e, int i1f, + float a, double b, int c, long d, double e, float f) { + return _I32SDILDS(i00, i01, i02, i03, i04, i05, i06, i07, + i08, i09, i0a, i0b, i0c, i0d, i0e, i0f, + i10, i11, i12, i13, i14, i15, i16, i17, + i18, i19, i1a, i1b, i1c, i1d, i1e, i1f, + a, b, c, d, e, f); + } + + public static native long getL32SDILDS(); + + public static native float _L32SDILDS(long l00, long l01, long l02, long l03, long l04, long l05, long l06, long l07, + long l08, long l09, long l0a, long l0b, long l0c, long l0d, long l0e, long l0f, + long l10, long l11, long l12, long l13, long l14, long l15, long l16, long l17, + long l18, long l19, long l1a, long l1b, long l1c, long l1d, long l1e, long l1f, + float a, double b, int c, long d, double e, float f); + + public static float L32SDILDS(long l00, long l01, long l02, long l03, long l04, long l05, long l06, long l07, + long l08, long l09, long l0a, long l0b, long l0c, long l0d, long l0e, long l0f, + long l10, long l11, long l12, long l13, long l14, long l15, long l16, long l17, + long l18, long l19, long l1a, long l1b, long l1c, long l1d, long l1e, long l1f, + float a, double b, int c, long d, double e, float f) { + return _L32SDILDS(l00, l01, l02, l03, l04, l05, l06, l07, + l08, l09, l0a, l0b, l0c, l0d, l0e, l0f, + l10, l11, l12, l13, l14, l15, l16, l17, + l18, l19, l1a, l1b, l1c, l1d, l1e, l1f, + a, b, c, d, e, f); + } +} diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java index f59aa08e362..fd1eff615f2 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java @@ -46,6 +46,9 @@ import jdk.vm.ci.meta.VMConstant; public class AMD64TestAssembler extends TestAssembler { + private static final Register scratchRegister = AMD64.r12; + private static final Register doubleScratch = AMD64.xmm15; + public AMD64TestAssembler(CodeCacheProvider codeCache, TestHotSpotVMConfig config) { super(codeCache, config, 16, 16, AMD64Kind.DWORD, AMD64.rax, AMD64.rcx, AMD64.rdi, AMD64.r8, AMD64.r9, AMD64.r10); } @@ -226,6 +229,14 @@ public class AMD64TestAssembler extends TestAssembler { return ret; } + private int getAdjustedOffset(StackSlot ret) { + if (ret.getRawOffset() < 0) { + return ret.getRawOffset() + 16; + } else { + return -(frameSize - ret.getRawOffset()) + 16; + } + } + @Override public StackSlot emitIntToStack(Register a) { StackSlot ret = newStackSlot(AMD64Kind.DWORD); @@ -234,7 +245,7 @@ public class AMD64TestAssembler extends TestAssembler { public StackSlot emitIntToStack(StackSlot ret, Register a) { // MOV r/m32,r32 - emitModRMMemory(false, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16); + emitModRMMemory(false, 0x89, a.encoding, AMD64.rbp.encoding, getAdjustedOffset(ret)); return ret; } @@ -246,7 +257,7 @@ public class AMD64TestAssembler extends TestAssembler { public StackSlot emitLongToStack(StackSlot ret, Register a) { // MOV r/m64,r64 - emitModRMMemory(true, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16); + emitModRMMemory(true, 0x89, a.encoding, AMD64.rbp.encoding, getAdjustedOffset(ret)); return ret; } @@ -262,11 +273,7 @@ public class AMD64TestAssembler extends TestAssembler { code.emitByte(0x0F); code.emitByte(0x11); // MOVSS xmm2/m32, xmm1 code.emitByte(0x85 | ((a.encoding & 0x7) << 3)); // [rbp+offset] - if (ret.getRawOffset() < 0) { - code.emitInt(ret.getRawOffset() + 16); - } else { - code.emitInt(-(frameSize - ret.getRawOffset()) + 16); - } + code.emitInt(getAdjustedOffset(ret)); return ret; } @@ -282,11 +289,7 @@ public class AMD64TestAssembler extends TestAssembler { code.emitByte(0x0F); code.emitByte(0x11); // MOVSD xmm2/m32, xmm1 code.emitByte(0x85 | ((a.encoding & 0x7) << 3)); // [rbp+offset] - if (ret.getRawOffset() < 0) { - code.emitInt(ret.getRawOffset() + 16); - } else { - code.emitInt(-(frameSize - ret.getRawOffset()) + 16); - } + code.emitInt(getAdjustedOffset(ret)); return ret; } @@ -383,15 +386,16 @@ public class AMD64TestAssembler extends TestAssembler { } else if (av instanceof StackSlot) { StackSlot slot = (StackSlot) av; if (prim instanceof Float) { - emitFloatToStack(slot, emitLoadFloat((Float) prim)); + emitFloatToStack(slot, emitLoadFloat(doubleScratch, (Float) prim)); } else if (prim instanceof Double) { - emitDoubleToStack(slot, emitLoadDouble((Double) prim)); + emitDoubleToStack(slot, emitLoadDouble(doubleScratch, (Double) prim)); } else if (prim instanceof Integer) { - emitIntToStack(slot, emitLoadInt((Integer) prim)); + emitIntToStack(slot, emitLoadInt(scratchRegister, (Integer) prim)); } else if (prim instanceof Long) { - emitLongToStack(slot, emitLoadLong((Long) prim)); + emitLongToStack(slot, emitLoadLong(scratchRegister, (Long) prim)); + } else { + assert false : "Unimplemented"; } - assert false : "Unimplemented"; } else { throw new IllegalArgumentException("Unknown value " + av); } From 913ccd67d42714bcc6c1ce516f80157bc0166743 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Tue, 19 Jul 2016 18:59:11 +0000 Subject: [PATCH 044/108] 8161274: [JVMCI] compiler/jvmci/events/JvmciNotifyInstallEventTest.java fails with NoClassDefFound Reviewed-by: kvn, twisti --- hotspot/src/share/vm/compiler/compileBroker.cpp | 6 ++++++ hotspot/src/share/vm/jvmci/jvmciRuntime.cpp | 13 +++++++++++++ hotspot/src/share/vm/jvmci/jvmciRuntime.hpp | 5 +++++ .../src/share/vm/runtime/simpleThresholdPolicy.cpp | 12 ------------ hotspot/src/share/vm/runtime/thread.cpp | 5 +++-- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp index fee070e250a..f9768b50d99 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.cpp +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp @@ -1068,6 +1068,12 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci, return NULL; } +#if INCLUDE_JVMCI + if (comp->is_jvmci() && !JVMCIRuntime::can_initialize_JVMCI()) { + return NULL; + } +#endif + if (osr_bci == InvocationEntryBci) { // standard compilation CompiledMethod* method_code = method->code(); diff --git a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp index 970a588aabf..41cc0f17790 100644 --- a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp +++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp @@ -697,8 +697,21 @@ void JVMCIRuntime::initialize_JVMCI(TRAPS) { assert(_HotSpotJVMCIRuntime_initialized == true, "what?"); } +bool JVMCIRuntime::can_initialize_JVMCI() { + // Initializing JVMCI requires the module system to be initialized past phase 3. + // The JVMCI API itself isn't available until phase 2 and ServiceLoader (which + // JVMCI initialization requires) isn't usable until after phase 3. Testing + // whether the system loader is initialized satisfies all these invariants. + if (SystemDictionary::java_system_loader() == NULL) { + return false; + } + assert(Universe::is_module_initialized(), "must be"); + return true; +} + void JVMCIRuntime::initialize_well_known_classes(TRAPS) { if (JVMCIRuntime::_well_known_classes_initialized == false) { + guarantee(can_initialize_JVMCI(), "VM is not yet sufficiently booted to initialize JVMCI"); SystemDictionary::WKID scan = SystemDictionary::FIRST_JVMCI_WKID; SystemDictionary::initialize_wk_klasses_through(SystemDictionary::LAST_JVMCI_WKID, scan, CHECK); JVMCIJavaClasses::compute_offsets(CHECK); diff --git a/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp b/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp index cdc5957e635..0aa9bcade19 100644 --- a/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp +++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp @@ -86,6 +86,11 @@ class JVMCIRuntime: public AllStatic { static Handle callStatic(const char* className, const char* methodName, const char* returnType, JavaCallArguments* args, TRAPS); + /** + * Determines if the VM is sufficiently booted to initialize JVMCI. + */ + static bool can_initialize_JVMCI(); + /** * Trigger initialization of HotSpotJVMCIRuntime through JVMCI.getRuntime() */ diff --git a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp index 5850dfc2251..e38c69279a9 100644 --- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp +++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp @@ -237,18 +237,6 @@ void SimpleThresholdPolicy::compile(const methodHandle& mh, int bci, CompLevel l return; } -#if INCLUDE_JVMCI - // We can't compile with a JVMCI compiler until the module system is initialized past - // phase 3. The JVMCI API itself isn't available until phase 2 and ServiceLoader isn't - // usable until after phase 3. - if (level == CompLevel_full_optimization && EnableJVMCI && UseJVMCICompiler) { - if (SystemDictionary::java_system_loader() == NULL) { - return; - } - assert(Universe::is_module_initialized(), "must be"); - } -#endif - // Check if the method can be compiled. If it cannot be compiled with C1, continue profiling // in the interpreter and then compile with C2 (the transition function will request that, // see common() ). If the method cannot be compiled with C2 but still can with C1, compile it with diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 3dfc97f9bf8..26c7e870d07 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -3770,6 +3770,9 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { // Final system initialization including security manager and system class loader call_initPhase3(CHECK_JNI_ERR); + // cache the system class loader + SystemDictionary::compute_java_system_loader(CHECK_(JNI_ERR)); + #if INCLUDE_JVMCI if (EnableJVMCI && UseJVMCICompiler && (!UseInterpreter || !BackgroundCompilation)) { // 8145270: Force initialization of JVMCI runtime otherwise requests for blocking @@ -3777,8 +3780,6 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { JVMCIRuntime::force_initialization(CHECK_JNI_ERR); } #endif - // cache the system class loader - SystemDictionary::compute_java_system_loader(CHECK_(JNI_ERR)); // Always call even when there are not JVMTI environments yet, since environments // may be attached late and JVMTI must track phases of VM execution From e26d43a2a3a1cc6fea147d6fa387aff5b8426061 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Tue, 19 Jul 2016 18:17:40 -0700 Subject: [PATCH 045/108] 8161603: [JVMCI] HotSpotVMConfig.baseVtableLength is incorrectly computed Reviewed-by: kvn --- .../jdk/vm/ci/hotspot/HotSpotVMConfig.java | 2 +- .../runtime/test/TestResolvedJavaMethod.java | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java index c446eda9aac..46f5d71096c 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java @@ -252,7 +252,7 @@ class HotSpotVMConfig extends HotSpotVMConfigAccess { final int universeBaseVtableSize = getFieldValue("CompilerToVM::Data::Universe_base_vtable_size", Integer.class, "int"); final int baseVtableLength() { - return universeBaseVtableSize / vtableEntrySize; + return universeBaseVtableSize / (vtableEntrySize / heapWordSize); } final int klassOffset = getFieldValue("java_lang_Class::_klass_offset", Integer.class, "int"); diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java index 4f1fecb856d..3333734e64e 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java @@ -422,6 +422,25 @@ public class TestResolvedJavaMethod extends MethodUniverse { assertFalse(ResolvedJavaMethod.isSignaturePolymorphic(metaAccess.lookupJavaType(Object.class), "toString", metaAccess)); } + /** + * All public non-final methods should be available in the vtable. + */ + @Test + public void testVirtualMethodTableAccess() { + for (Class c : classes) { + if (c.isPrimitive() || c.isInterface()) { + continue; + } + ResolvedJavaType receiverType = metaAccess.lookupJavaType(c); + for (Method m : c.getMethods()) { + ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m); + if (!method.isStatic() && !method.isFinal() && !method.getDeclaringClass().isLeaf() && !method.getDeclaringClass().isInterface()) { + assertTrue(method + " not available in " + receiverType, method.isInVirtualMethodTable(receiverType)); + } + } + } + } + private Method findTestMethod(Method apiMethod) { String testName = apiMethod.getName() + "Test"; for (Method m : getClass().getDeclaredMethods()) { From 71fd93cbb74e364b29ee48e5090104f6db9eef14 Mon Sep 17 00:00:00 2001 From: Dmitrij Pochepko Date: Wed, 20 Jul 2016 19:29:10 +0300 Subject: [PATCH 046/108] 8161508: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before materialization Reviewed-by: kvn --- .../jvmci/compilerToVM/MaterializeVirtualObjectTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java index 066bc1661b7..7607d39a6aa 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java @@ -25,6 +25,8 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") + * & (vm.compMode != "Xcomp" | vm.opt.TieredCompilation == null | vm.opt.TieredCompilation == true) + * @summary no "-Xcomp -XX:-TieredCompilation" combination allowed until JDK-8140018 is resolved * @library / /testlibrary /test/lib * @library ../common/patches * @modules java.base/jdk.internal.misc @@ -43,7 +45,7 @@ * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * -XX:CompileCommand=exclude,*::check - * -XX:+DoEscapeAnalysis + * -XX:+DoEscapeAnalysis -XX:-UseCounterDecay * -Xbatch * -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=false * compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest @@ -51,7 +53,7 @@ * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * -XX:CompileCommand=exclude,*::check - * -XX:+DoEscapeAnalysis + * -XX:+DoEscapeAnalysis -XX:-UseCounterDecay * -Xbatch * -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=true * compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest From 70dd85aca8035a24110ea2d2a30ae35761a410ff Mon Sep 17 00:00:00 2001 From: Dmitrij Pochepko Date: Wed, 20 Jul 2016 19:31:34 +0300 Subject: [PATCH 047/108] 8158756: [Testbug] serviceability/dcmd/compiler/CompilerQueueTest.java fails with TieredStopAtLevel=1 Reviewed-by: thartmann --- .../test/serviceability/dcmd/compiler/CompilerQueueTest.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java b/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java index 346ce045018..217e9c29fa8 100644 --- a/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java +++ b/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java @@ -30,9 +30,6 @@ * java.management * jdk.jvmstat/sun.jvmstat.monitor * @summary Test of diagnostic command Compiler.queue - * Fails intermittently on 32-bit VMs due to 8158756 so quarantine - * it on those platforms: - * @requires vm.bits != "32" * @build jdk.test.lib.* * jdk.test.lib.dcmd.* * sun.hotspot.WhiteBox @@ -110,7 +107,7 @@ public class CompilerQueueTest { boolean added = WB.enqueueMethodForCompilation(testcase.method, testcase.level); // Set results to false for those methods we must to find // We will also assert if we find any test method we don't expect - Assert.assertTrue(WB.isMethodQueuedForCompilation(testcase.method)); + Assert.assertEquals(added, WB.isMethodQueuedForCompilation(testcase.method)); testcase.check = false; } From 8ad8a1e35ef2674f33b77461b0879fc93d8543bb Mon Sep 17 00:00:00 2001 From: Dmitrij Pochepko Date: Wed, 20 Jul 2016 19:33:22 +0300 Subject: [PATCH 048/108] 8161695: compiler/jsr292/MHInlineTest.java can't be run on client-only platforms Reviewed-by: kvn --- hotspot/test/compiler/jsr292/MHInlineTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/test/compiler/jsr292/MHInlineTest.java b/hotspot/test/compiler/jsr292/MHInlineTest.java index c13146fa34d..150b79e9ec2 100644 --- a/hotspot/test/compiler/jsr292/MHInlineTest.java +++ b/hotspot/test/compiler/jsr292/MHInlineTest.java @@ -46,7 +46,7 @@ public class MHInlineTest { public static void main(String[] args) throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", - "-server", "-XX:-TieredCompilation", "-Xbatch", + "-XX:-TieredCompilation", "-Xbatch", "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining", "-XX:CompileCommand=dontinline,compiler.jsr292.MHInlineTest::test*", Launcher.class.getName()); From 48476abaa6fe4e7e457450a303c84d552143c911 Mon Sep 17 00:00:00 2001 From: Dmitrij Pochepko Date: Wed, 20 Jul 2016 19:35:08 +0300 Subject: [PATCH 049/108] 8071652: -XX:CompileOnly does not behave as documented Reviewed-by: kvn --- hotspot/src/share/vm/compiler/compilerOracle.cpp | 16 ++-------------- .../sha/sanity/TestSHA256Intrinsics.java | 8 ++++---- .../sanity/TestSHA256MultiBlockIntrinsics.java | 8 ++++---- .../sha/sanity/TestSHA512Intrinsics.java | 8 ++++---- .../sanity/TestSHA512MultiBlockIntrinsics.java | 12 ++++++------ 5 files changed, 20 insertions(+), 32 deletions(-) diff --git a/hotspot/src/share/vm/compiler/compilerOracle.cpp b/hotspot/src/share/vm/compiler/compilerOracle.cpp index 4e5b240c6bc..3327dea26ab 100644 --- a/hotspot/src/share/vm/compiler/compilerOracle.cpp +++ b/hotspot/src/share/vm/compiler/compilerOracle.cpp @@ -819,7 +819,6 @@ void CompilerOracle::parse_compile_only(char * line) { if (className == NULL) { className = newName; - c_match = MethodMatcher::Prefix; } else { methodName = newName; } @@ -829,26 +828,15 @@ void CompilerOracle::parse_compile_only(char * line) { if (className == NULL) { className = ""; c_match = MethodMatcher::Any; - } else { - // foo/bar.blah is an exact match on foo/bar, bar.blah is a suffix match on bar - if (strchr(className, '/') != NULL) { - c_match = MethodMatcher::Exact; - } else { - c_match = MethodMatcher::Suffix; - } } } else { // got foo or foo/bar if (className == NULL) { ShouldNotReachHere(); } else { - // got foo or foo/bar - if (strchr(className, '/') != NULL) { - c_match = MethodMatcher::Prefix; - } else if (className[0] == '\0') { + // missing class name handled as "Any" class match + if (className[0] == '\0') { c_match = MethodMatcher::Any; - } else { - c_match = MethodMatcher::Substring; } } } diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java index c0d7c8015ff..85aa415fb7f 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java @@ -38,7 +38,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_224.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA + * -XX:CompileOnly=sun/security/provider/SHA2 * -XX:+UseSHA256Intrinsics * -Dalgorithm=SHA-224 * compiler.intrinsics.sha.sanity.TestSHA256Intrinsics @@ -47,7 +47,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=negative_224.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA + * -XX:CompileOnly=sun/security/provider/SHA2 * -XX:-UseSHA256Intrinsics * -Dalgorithm=SHA-224 * compiler.intrinsics.sha.sanity.TestSHA256Intrinsics @@ -56,7 +56,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_256.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA + * -XX:CompileOnly=sun/security/provider/SHA2 * -XX:+UseSHA256Intrinsics * -Dalgorithm=SHA-256 * compiler.intrinsics.sha.sanity.TestSHA256Intrinsics @@ -65,7 +65,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=negative_256.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA + * -XX:CompileOnly=sun/security/provider/SHA2 * -XX:-UseSHA256Intrinsics * -Dalgorithm=SHA-256 * compiler.intrinsics.sha.sanity.TestSHA256Intrinsics diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java index 2c5a67f2000..292e0d07ae6 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java @@ -38,7 +38,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_224.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA + * -XX:CompileOnly=sun/security/provider/SHA2 * -XX:+UseSHA256Intrinsics -XX:-UseSHA1Intrinsics * -XX:-UseSHA512Intrinsics * -Dalgorithm=SHA-224 @@ -48,7 +48,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_224_def.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA + * -XX:CompileOnly=sun/security/provider/SHA2 * -XX:+UseSHA256Intrinsics -Dalgorithm=SHA-224 * compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -56,7 +56,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=negative_224.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA -XX:-UseSHA + * -XX:CompileOnly=sun/security/provider/SHA2 -XX:-UseSHA * -Dalgorithm=SHA-224 * compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -64,7 +64,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_256.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA + * -XX:CompileOnly=sun/security/provider/SHA2 * -XX:+UseSHA256Intrinsics -XX:-UseSHA1Intrinsics * -XX:-UseSHA512Intrinsics * -Dalgorithm=SHA-256 diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java index 2b4fac3bb0f..591190607b3 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java @@ -38,7 +38,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_384.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA + * -XX:CompileOnly=sun/security/provider/SHA2 * -XX:+UseSHA512Intrinsics * -Dalgorithm=SHA-384 * compiler.intrinsics.sha.sanity.TestSHA512Intrinsics @@ -47,7 +47,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=negative_384.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA + * -XX:CompileOnly=sun/security/provider/SHA2 * -XX:-UseSHA512Intrinsics * -Dalgorithm=SHA-384 * compiler.intrinsics.sha.sanity.TestSHA512Intrinsics @@ -56,7 +56,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_512.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA + * -XX:CompileOnly=sun/security/provider/SHA2 * -XX:+UseSHA512Intrinsics * -Dalgorithm=SHA-512 * compiler.intrinsics.sha.sanity.TestSHA512Intrinsics @@ -65,7 +65,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=negative_512.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA + * -XX:CompileOnly=sun/security/provider/SHA2 * -XX:-UseSHA512Intrinsics * -Dalgorithm=SHA-512 * compiler.intrinsics.sha.sanity.TestSHA512Intrinsics diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java index 1b5f9a644b9..2fd2815645b 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java @@ -38,7 +38,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_384.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA + * -XX:CompileOnly=sun/security/provider/SHA2 * -XX:+UseSHA512Intrinsics -XX:-UseSHA1Intrinsics * -XX:-UseSHA256Intrinsics * -Dalgorithm=SHA-384 @@ -48,7 +48,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_384_def.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA + * -XX:CompileOnly=sun/security/provider/SHA2 * -XX:+UseSHA512Intrinsics -Dalgorithm=SHA-384 * compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -56,7 +56,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=negative_384.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA -XX:-UseSHA + * -XX:CompileOnly=sun/security/provider/SHA2 -XX:-UseSHA * -Dalgorithm=SHA-384 * compiler.intrinsics.sha.sanity.TestSHA1Intrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -64,7 +64,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_512.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA + * -XX:CompileOnly=sun/security/provider/SHA2 * -XX:+UseSHA512Intrinsics -XX:-UseSHA1Intrinsics * -XX:-UseSHA256Intrinsics * -Dalgorithm=SHA-512 @@ -74,7 +74,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_512_def.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA + * -XX:CompileOnly=sun/security/provider/SHA2 * -XX:+UseSHA512Intrinsics -Dalgorithm=SHA-512 * compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -82,7 +82,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=negative_512.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA -XX:-UseSHA + * -XX:CompileOnly=sun/security/provider/SHA2 -XX:-UseSHA * -Dalgorithm=SHA-512 * compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics * @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE From 86961b9419ccc180ef843f4716b7682d21934472 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Wed, 20 Jul 2016 22:18:13 +0000 Subject: [PATCH 050/108] 8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags Reviewed-by: twisti, kvn, never --- .../src/share/vm/jvmci/jvmciCodeInstaller.cpp | 2 +- hotspot/src/share/vm/jvmci/jvmci_globals.cpp | 249 ++++-------------- hotspot/src/share/vm/jvmci/jvmci_globals.hpp | 12 +- hotspot/src/share/vm/runtime/arguments.cpp | 6 +- ...JvmciNotifyBootstrapFinishedEventTest.java | 4 +- .../events/JvmciNotifyInstallEventTest.java | 6 +- 6 files changed, 62 insertions(+), 217 deletions(-) diff --git a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp index 979be2a66e6..c0375f1b39e 100644 --- a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp +++ b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp @@ -782,7 +782,7 @@ JVMCIEnv::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer, } last_pc_offset = pc_offset; - if (CodeInstallSafepointChecks && SafepointSynchronize::do_call_back()) { + if (SafepointSynchronize::do_call_back()) { // this is a hacky way to force a safepoint check but nothing else was jumping out at me. ThreadToNativeFromVM ttnfv(JavaThread::current()); } diff --git a/hotspot/src/share/vm/jvmci/jvmci_globals.cpp b/hotspot/src/share/vm/jvmci/jvmci_globals.cpp index e76503668f8..7308935d79b 100644 --- a/hotspot/src/share/vm/jvmci/jvmci_globals.cpp +++ b/hotspot/src/share/vm/jvmci/jvmci_globals.cpp @@ -39,212 +39,65 @@ JVMCI_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ IGNORE_CONSTRAINT, \ IGNORE_WRITEABLE) -#define JVMCI_IGNORE_FLAG_FOUR_PARAM(type, name, value, doc) -#define JVMCI_IGNORE_FLAG_THREE_PARAM(type, name, doc) - // Return true if jvmci flags are consistent. bool JVMCIGlobals::check_jvmci_flags_are_consistent() { - if (EnableJVMCI) { - return true; - } - - // "FLAG_IS_DEFAULT" fail count. - int fail_count = 0; - // Number of "FLAG_IS_DEFAULT" fails that should be skipped before code - // detect real consistency failure. - int skip_fail_count; - - // EnableJVMCI flag is false here. - // If any other flag is changed, consistency check should fail. - // JVMCI_FLAGS macros added below can handle all JVMCI flags automatically. - // But it contains check for EnableJVMCI flag too, which is required to be - // skipped. This can't be handled easily! - // So the code looks for at-least two flag changes to detect consistency - // failure when EnableJVMCI flag is changed. - // Otherwise one flag change is sufficient to detect consistency failure. - // Set skip_fail_count to 0 if EnableJVMCI flag is default. - // Set skip_fail_count to 1 if EnableJVMCI flag is changed. - // This value will be used to skip fails in macro expanded code later. - if (!FLAG_IS_DEFAULT(EnableJVMCI)) { - skip_fail_count = 1; - } else { - skip_fail_count = 0; - } - -#define EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(FLAG) \ - if (!FLAG_IS_DEFAULT(FLAG)) { \ - fail_count++; \ - if (fail_count > skip_fail_count) { \ - return false; \ - } \ - } - -#define JVMCI_DIAGNOSTIC_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name) -#define JVMCI_EXPERIMENTAL_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name) - - // Check consistency of diagnostic flags if UnlockDiagnosticVMOptions is true - // or not default. UnlockDiagnosticVMOptions is default true in debug builds. - if (UnlockDiagnosticVMOptions || !FLAG_IS_DEFAULT(UnlockDiagnosticVMOptions)) { - JVMCI_FLAGS(JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - JVMCI_IGNORE_FLAG_THREE_PARAM, \ - JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - JVMCI_IGNORE_FLAG_THREE_PARAM, \ - JVMCI_DIAGNOSTIC_FLAG_VALUE_CHANGED_CHECK_CODE, \ - JVMCI_IGNORE_FLAG_THREE_PARAM, \ - JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - IGNORE_RANGE, \ - IGNORE_CONSTRAINT, \ - IGNORE_WRITEABLE) - } - - // Check consistency of experimental flags if UnlockExperimentalVMOptions is - // true or not default. - if (UnlockExperimentalVMOptions || !FLAG_IS_DEFAULT(UnlockExperimentalVMOptions)) { - JVMCI_FLAGS(JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - JVMCI_IGNORE_FLAG_THREE_PARAM, \ - JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - JVMCI_IGNORE_FLAG_THREE_PARAM, \ - JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - JVMCI_IGNORE_FLAG_THREE_PARAM, \ - JVMCI_EXPERIMENTAL_FLAG_VALUE_CHANGED_CHECK_CODE, \ - JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - IGNORE_RANGE, \ - IGNORE_CONSTRAINT, \ - IGNORE_WRITEABLE) - } #ifndef PRODUCT -#define JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name) -#define JVMCI_PD_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name) -#define JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name) +#define APPLY_JVMCI_FLAGS(params3, params4) \ + JVMCI_FLAGS(params4, params3, params4, params3, params4, params3, params4, params4, IGNORE_RANGE, IGNORE_CONSTRAINT, IGNORE_WRITEABLE) +#define JVMCI_DECLARE_CHECK4(type, name, value, doc) bool name##checked = false; +#define JVMCI_DECLARE_CHECK3(type, name, doc) bool name##checked = false; +#define JVMCI_FLAG_CHECKED(name) name##checked = true; + APPLY_JVMCI_FLAGS(JVMCI_DECLARE_CHECK3, JVMCI_DECLARE_CHECK4) #else -#define JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc) -#define JVMCI_PD_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, doc) -#define JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc) +#define JVMCI_FLAG_CHECKED(name) #endif -#define JVMCI_PD_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name) -#define JVMCI_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name) - - JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE, \ - JVMCI_PD_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE, \ - JVMCI_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE, \ - JVMCI_PD_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE, \ - JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - JVMCI_IGNORE_FLAG_THREE_PARAM, \ - JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE, \ - IGNORE_RANGE, \ - IGNORE_CONSTRAINT, \ - IGNORE_WRITEABLE) - -#undef EMIT_FLAG_VALUE_CHANGED_CHECK_CODE -#undef JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE -#undef JVMCI_PD_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE -#undef JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE -#undef JVMCI_DIAGNOSTIC_FLAG_VALUE_CHANGED_CHECK_CODE -#undef JVMCI_PD_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE -#undef JVMCI_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE -#undef JVMCI_EXPERIMENTAL_FLAG_VALUE_CHANGED_CHECK_CODE - -#ifndef TIERED - // JVMCI is only usable as a jit compiler if the VM supports tiered compilation. -#define JVMCI_CHECK_TIERED_ONLY_FLAG(FLAG) \ - if (!FLAG_IS_DEFAULT(FLAG)) { \ - jio_fprintf(defaultStream::error_stream(), "VM option '%s' cannot be set in non-tiered VM\n", #FLAG); \ - return false; \ + // Checks that a given flag is not set if a given guard flag is false. +#define CHECK_NOT_SET(FLAG, GUARD) \ + JVMCI_FLAG_CHECKED(FLAG) \ + if (!GUARD && !FLAG_IS_DEFAULT(FLAG)) { \ + jio_fprintf(defaultStream::error_stream(), \ + "Improperly specified VM option '%s': '%s' must be enabled\n", #FLAG, #GUARD); \ + return false; \ } - JVMCI_CHECK_TIERED_ONLY_FLAG(UseJVMCICompiler) - JVMCI_CHECK_TIERED_ONLY_FLAG(BootstrapJVMCI) - JVMCI_CHECK_TIERED_ONLY_FLAG(PrintBootstrap) - JVMCI_CHECK_TIERED_ONLY_FLAG(JVMCIThreads) - JVMCI_CHECK_TIERED_ONLY_FLAG(JVMCIHostThreads) - JVMCI_CHECK_TIERED_ONLY_FLAG(JVMCICountersExcludeCompiler) -#undef JVMCI_CHECK_TIERED_ONLY_FLAG -#endif + JVMCI_FLAG_CHECKED(UseJVMCICompiler) + JVMCI_FLAG_CHECKED(EnableJVMCI) + + CHECK_NOT_SET(BootstrapJVMCI, UseJVMCICompiler) + CHECK_NOT_SET(PrintBootstrap, UseJVMCICompiler) + CHECK_NOT_SET(JVMCIThreads, UseJVMCICompiler) + CHECK_NOT_SET(JVMCIHostThreads, UseJVMCICompiler) + + if (UseJVMCICompiler) { + if (!FLAG_IS_DEFAULT(EnableJVMCI) && !EnableJVMCI) { + jio_fprintf(defaultStream::error_stream(), + "Improperly specified VM option UseJVMCICompiler: EnableJVMCI cannot be disabled\n"); + return false; + } + FLAG_SET_DEFAULT(EnableJVMCI, true); + } + + CHECK_NOT_SET(JVMCITraceLevel, EnableJVMCI) + CHECK_NOT_SET(JVMCICounterSize, EnableJVMCI) + CHECK_NOT_SET(JVMCICountersExcludeCompiler, EnableJVMCI) + CHECK_NOT_SET(JVMCIUseFastLocking, EnableJVMCI) + CHECK_NOT_SET(JVMCINMethodSizeLimit, EnableJVMCI) + CHECK_NOT_SET(TraceUncollectedSpeculations, EnableJVMCI) + +#ifndef PRODUCT +#define JVMCI_CHECK4(type, name, value, doc) assert(name##checked, #name " flag not checked"); +#define JVMCI_CHECK3(type, name, doc) assert(name##checked, #name " flag not checked"); + // Ensures that all JVMCI flags are checked by this method. + APPLY_JVMCI_FLAGS(JVMCI_CHECK3, JVMCI_CHECK4) +#undef APPLY_JVMCI_FLAGS +#undef JVMCI_DECLARE_CHECK3 +#undef JVMCI_DECLARE_CHECK4 +#undef JVMCI_CHECK3 +#undef JVMCI_CHECK4 +#undef JVMCI_FLAG_CHECKED +#endif +#undef CHECK_NOT_SET return true; } - -// Print jvmci arguments inconsistency error message. -void JVMCIGlobals::print_jvmci_args_inconsistency_error_message() { - const char* error_msg = "Improperly specified VM option '%s'\n"; - jio_fprintf(defaultStream::error_stream(), "EnableJVMCI must be enabled\n"); - -#define EMIT_CHECK_PRINT_ERR_MSG_CODE(FLAG) \ - if (!FLAG_IS_DEFAULT(FLAG)) { \ - if (strcmp(#FLAG, "EnableJVMCI")) { \ - jio_fprintf(defaultStream::error_stream(), error_msg, #FLAG); \ - } \ - } - -#define JVMCI_DIAGNOSTIC_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc) EMIT_CHECK_PRINT_ERR_MSG_CODE(name) -#define JVMCI_EXPERIMENTAL_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc) EMIT_CHECK_PRINT_ERR_MSG_CODE(name) - - if (UnlockDiagnosticVMOptions || !FLAG_IS_DEFAULT(UnlockDiagnosticVMOptions)) { - JVMCI_FLAGS(JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - JVMCI_IGNORE_FLAG_THREE_PARAM, \ - JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - JVMCI_IGNORE_FLAG_THREE_PARAM, \ - JVMCI_DIAGNOSTIC_FLAG_CHECK_PRINT_ERR_MSG_CODE, \ - JVMCI_IGNORE_FLAG_THREE_PARAM, \ - JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - IGNORE_RANGE, \ - IGNORE_CONSTRAINT, \ - IGNORE_WRITEABLE) - } - - if (UnlockExperimentalVMOptions || !FLAG_IS_DEFAULT(UnlockExperimentalVMOptions)) { - JVMCI_FLAGS(JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - JVMCI_IGNORE_FLAG_THREE_PARAM, \ - JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - JVMCI_IGNORE_FLAG_THREE_PARAM, \ - JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - JVMCI_IGNORE_FLAG_THREE_PARAM, \ - JVMCI_EXPERIMENTAL_FLAG_CHECK_PRINT_ERR_MSG_CODE, \ - JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - IGNORE_RANGE, \ - IGNORE_CONSTRAINT, \ - IGNORE_WRITEABLE) - } - -#ifndef PRODUCT -#define JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc) EMIT_CHECK_PRINT_ERR_MSG_CODE(name) -#define JVMCI_PD_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, doc) EMIT_CHECK_PRINT_ERR_MSG_CODE(name) -#define JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc) EMIT_CHECK_PRINT_ERR_MSG_CODE(name) -#else -#define JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc) -#define JVMCI_PD_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, doc) -#define JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc) -#endif - -#define JVMCI_PD_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, doc) EMIT_CHECK_PRINT_ERR_MSG_CODE(name) -#define JVMCI_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc) EMIT_CHECK_PRINT_ERR_MSG_CODE(name) - - JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE, \ - JVMCI_PD_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE, \ - JVMCI_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE, \ - JVMCI_PD_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE, \ - JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - JVMCI_IGNORE_FLAG_THREE_PARAM, \ - JVMCI_IGNORE_FLAG_FOUR_PARAM, \ - JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE, \ - IGNORE_RANGE, \ - IGNORE_CONSTRAINT, \ - IGNORE_WRITEABLE) - -#undef EMIT_CHECK_PRINT_ERR_MSG_CODE -#undef JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE -#undef JVMCI_PD_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE -#undef JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE -#undef JVMCI_PD_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE -#undef JVMCI_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE -#undef JVMCI_DIAGNOSTIC_FLAG_CHECK_PRINT_ERR_MSG_CODE -#undef JVMCI_EXPERIMENTAL_FLAG_CHECK_PRINT_ERR_MSG_CODE - -} - -#undef JVMCI_IGNORE_FLAG_FOUR_PARAM -#undef JVMCI_IGNORE_FLAG_THREE_PARAM diff --git a/hotspot/src/share/vm/jvmci/jvmci_globals.hpp b/hotspot/src/share/vm/jvmci/jvmci_globals.hpp index 0a19e616e2a..c2905f5f110 100644 --- a/hotspot/src/share/vm/jvmci/jvmci_globals.hpp +++ b/hotspot/src/share/vm/jvmci/jvmci_globals.hpp @@ -29,8 +29,7 @@ // // Defines all global flags used by the JVMCI compiler. Only flags that need -// to be accessible to the JVMCI C++ code should be defined here. All other -// JVMCI flags should be defined in JVMCIOptions.java. +// to be accessible to the JVMCI C++ code should be defined here. // #define JVMCI_FLAGS(develop, \ develop_pd, \ @@ -64,9 +63,6 @@ "Force number of compiler threads for JVMCI host compiler") \ range(1, max_jint) \ \ - experimental(bool, CodeInstallSafepointChecks, true, \ - "Perform explicit safepoint checks while installing code") \ - \ NOT_COMPILER2(product(intx, MaxVectorSize, 64, \ "Max vector size in bytes, " \ "actual size could be less depending on elements type")) \ @@ -112,9 +108,9 @@ JVMCI_FLAGS(DECLARE_DEVELOPER_FLAG, \ class JVMCIGlobals { public: - // Return true if jvmci flags are consistent. + // Return true if jvmci flags are consistent. If not consistent, + // an error message describing the inconsistency is printed before + // returning false. static bool check_jvmci_flags_are_consistent(); - // Print jvmci arguments inconsistency error message. - static void print_jvmci_args_inconsistency_error_message(); }; #endif // SHARE_VM_JVMCI_JVMCIGLOBALS_HPP diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index a9e944e4f7f..d9581445606 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -2276,11 +2276,7 @@ bool Arguments::sun_java_launcher_is_altjvm() { #if INCLUDE_JVMCI // Check consistency of jvmci vm argument settings. bool Arguments::check_jvmci_args_consistency() { - if (!EnableJVMCI && !JVMCIGlobals::check_jvmci_flags_are_consistent()) { - JVMCIGlobals::print_jvmci_args_inconsistency_error_message(); - return false; - } - return true; + return JVMCIGlobals::check_jvmci_flags_are_consistent(); } #endif //INCLUDE_JVMCI diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java index eb387617768..bcfc52f64b7 100644 --- a/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java +++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java @@ -49,12 +49,12 @@ * compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest * jdk.test.lib.Asserts * jdk.test.lib.Utils - * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * @run main/othervm -XX:+UnlockExperimentalVMOptions * -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:. * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI * -Dcompiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap=false * compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest - * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * @run main/othervm -XX:+UnlockExperimentalVMOptions * -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:. * -XX:+UseJVMCICompiler -XX:+BootstrapJVMCI * -Dcompiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap=true diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java index a40a2bb17ee..6f5c83ab068 100644 --- a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java +++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java @@ -52,17 +52,17 @@ * compiler.jvmci.common.testcases.SimpleClass * jdk.test.lib.Asserts * jdk.test.lib.Utils - * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * @run main/othervm -XX:+UnlockExperimentalVMOptions * -Xbootclasspath/a:. -Xmixed * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false * compiler.jvmci.events.JvmciNotifyInstallEventTest - * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * @run main/othervm -XX:+UnlockExperimentalVMOptions * -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false * compiler.jvmci.events.JvmciNotifyInstallEventTest - * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * @run main/othervm -XX:+UnlockExperimentalVMOptions * -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI -XX:JVMCINMethodSizeLimit=0 * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false From cabbc68c6447da3baf814e2f7c01ee72879ff223 Mon Sep 17 00:00:00 2001 From: Yang Zhang Date: Fri, 22 Jul 2016 17:05:08 +0100 Subject: [PATCH 051/108] 8161190: AArch64: Fix overflow in immediate cmp instruction Use subs instead of cmp to compare BlockZeroingLowLimit. Subs can check and handle immediate out of range correctly. Reviewed-by: aph --- hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp | 2 +- hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp index f6227f19166..6e686f51b1b 100644 --- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp @@ -4916,7 +4916,7 @@ void MacroAssembler::block_zero(Register base, Register cnt, bool is_large) // alignment. if (!is_large || !(BlockZeroingLowLimit >= zva_length * 2)) { int low_limit = MAX2(zva_length * 2, (int)BlockZeroingLowLimit); - cmp(cnt, low_limit >> 3); + subs(tmp, cnt, low_limit >> 3); br(Assembler::LT, small); } diff --git a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp index 6ca67ac7005..13071f52aba 100644 --- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp @@ -2346,8 +2346,9 @@ class StubGenerator: public StubCodeGenerator { __ subw(count, count, cnt_words, Assembler::LSL, 3 - shift); if (UseBlockZeroing) { Label non_block_zeroing, rest; + Register tmp = rscratch1; // count >= BlockZeroingLowLimit && value == 0 - __ cmp(cnt_words, BlockZeroingLowLimit >> 3); + __ subs(tmp, cnt_words, BlockZeroingLowLimit >> 3); __ ccmp(value, 0 /* comparing value */, 0 /* NZCV */, Assembler::GE); __ br(Assembler::NE, non_block_zeroing); __ mov(bz_base, to); From c52af628aba14b72ffd5dbca39ce198642d34091 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Mon, 18 Jul 2016 20:45:51 +0200 Subject: [PATCH 052/108] 8161651: Logic in ConnectionGraph::split_unique_types() wrongly assumes node always have memory input Reviewed-by: thartmann, kvn --- hotspot/src/share/vm/opto/escape.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/opto/escape.cpp b/hotspot/src/share/vm/opto/escape.cpp index 892a0d3defa..9d7020f9ddb 100644 --- a/hotspot/src/share/vm/opto/escape.cpp +++ b/hotspot/src/share/vm/opto/escape.cpp @@ -3134,8 +3134,8 @@ void ConnectionGraph::split_unique_types(GrowableArray &alloc_worklist, } } else { uint op = use->Opcode(); - if ((use->in(MemNode::Memory) == n) && - (op == Op_StrCompressedCopy || op == Op_StrInflatedCopy)) { + if ((op == Op_StrCompressedCopy || op == Op_StrInflatedCopy) && + (use->in(MemNode::Memory) == n)) { // They overwrite memory edge corresponding to destination array, memnode_worklist.append_if_missing(use); } else if (!(op == Op_CmpP || op == Op_Conv2B || From e94d8e44dd706b2e1433913588898ca1f46d0cbd Mon Sep 17 00:00:00 2001 From: Christian Thalinger Date: Fri, 22 Jul 2016 12:47:08 -1000 Subject: [PATCH 053/108] 8162427: fix indent in CompileTask::print_tty Reviewed-by: kvn --- hotspot/src/share/vm/compiler/compileTask.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/compiler/compileTask.cpp b/hotspot/src/share/vm/compiler/compileTask.cpp index 9c3ea04a3ad..b5af75d1187 100644 --- a/hotspot/src/share/vm/compiler/compileTask.cpp +++ b/hotspot/src/share/vm/compiler/compileTask.cpp @@ -186,8 +186,10 @@ void CompileTask::print_line_on_error(outputStream* st, char* buf, int buflen) { void CompileTask::print_tty() { ttyLocker ttyl; // keep the following output all in one block // print compiler name if requested - if (CIPrintCompilerName) tty->print("%s:", CompileBroker::compiler_name(comp_level())); - print(tty); + if (CIPrintCompilerName) { + tty->print("%s:", CompileBroker::compiler_name(comp_level())); + } + print(tty); } // ------------------------------------------------------------------ From 52d291dd00f74fa531101a8eb6f1bdbbdbff1097 Mon Sep 17 00:00:00 2001 From: Dmitrij Pochepko Date: Mon, 25 Jul 2016 21:02:51 +0300 Subject: [PATCH 054/108] 8162376: TestSHA512Intrinsics.java failed with Unexpected count of intrinsic _sha5_implCompress is expected Reviewed-by: kvn --- .../intrinsics/sha/sanity/TestSHA512Intrinsics.java | 8 ++++---- .../sha/sanity/TestSHA512MultiBlockIntrinsics.java | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java index 591190607b3..de8be87349b 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java @@ -38,7 +38,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_384.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA2 + * -XX:CompileOnly=sun/security/provider/SHA5 * -XX:+UseSHA512Intrinsics * -Dalgorithm=SHA-384 * compiler.intrinsics.sha.sanity.TestSHA512Intrinsics @@ -47,7 +47,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=negative_384.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA2 + * -XX:CompileOnly=sun/security/provider/SHA5 * -XX:-UseSHA512Intrinsics * -Dalgorithm=SHA-384 * compiler.intrinsics.sha.sanity.TestSHA512Intrinsics @@ -56,7 +56,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_512.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA2 + * -XX:CompileOnly=sun/security/provider/SHA5 * -XX:+UseSHA512Intrinsics * -Dalgorithm=SHA-512 * compiler.intrinsics.sha.sanity.TestSHA512Intrinsics @@ -65,7 +65,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=negative_512.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA2 + * -XX:CompileOnly=sun/security/provider/SHA5 * -XX:-UseSHA512Intrinsics * -Dalgorithm=SHA-512 * compiler.intrinsics.sha.sanity.TestSHA512Intrinsics diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java index 2fd2815645b..0086412db82 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java @@ -38,7 +38,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_384.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA2 + * -XX:CompileOnly=sun/security/provider/SHA5 * -XX:+UseSHA512Intrinsics -XX:-UseSHA1Intrinsics * -XX:-UseSHA256Intrinsics * -Dalgorithm=SHA-384 @@ -48,7 +48,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_384_def.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA2 + * -XX:CompileOnly=sun/security/provider/SHA5 * -XX:+UseSHA512Intrinsics -Dalgorithm=SHA-384 * compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -56,7 +56,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=negative_384.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA2 -XX:-UseSHA + * -XX:CompileOnly=sun/security/provider/SHA5 -XX:-UseSHA * -Dalgorithm=SHA-384 * compiler.intrinsics.sha.sanity.TestSHA1Intrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -64,7 +64,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_512.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA2 + * -XX:CompileOnly=sun/security/provider/SHA5 * -XX:+UseSHA512Intrinsics -XX:-UseSHA1Intrinsics * -XX:-UseSHA256Intrinsics * -Dalgorithm=SHA-512 @@ -74,7 +74,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=positive_512_def.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA2 + * -XX:CompileOnly=sun/security/provider/SHA5 * -XX:+UseSHA512Intrinsics -Dalgorithm=SHA-512 * compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -82,7 +82,7 @@ * -XX:Tier4InvocationThreshold=500 * -XX:+LogCompilation -XX:LogFile=negative_512.log * -XX:CompileOnly=sun/security/provider/DigestBase - * -XX:CompileOnly=sun/security/provider/SHA2 -XX:-UseSHA + * -XX:CompileOnly=sun/security/provider/SHA5 -XX:-UseSHA * -Dalgorithm=SHA-512 * compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics * @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE From eded7ae7949c961e8561dca56cd8fc7953553838 Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Thu, 23 Jun 2016 17:58:59 +0000 Subject: [PATCH 055/108] 8157306: Random infrequent null pointer exceptions in javac Reviewed-by: kvn --- hotspot/src/share/vm/opto/lcm.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/opto/lcm.cpp b/hotspot/src/share/vm/opto/lcm.cpp index 431bba14c7e..aabb17ac8d1 100644 --- a/hotspot/src/share/vm/opto/lcm.cpp +++ b/hotspot/src/share/vm/opto/lcm.cpp @@ -1293,11 +1293,12 @@ void PhaseCFG::call_catch_cleanup(Block* block) { Block *sb = block->_succs[i]; // Clone the entire area; ignoring the edge fixup for now. for( uint j = end; j > beg; j-- ) { - // It is safe here to clone a node with anti_dependence - // since clones dominate on each path. Node *clone = block->get_node(j-1)->clone(); sb->insert_node(clone, 1); map_node_to_block(clone, sb); + if (clone->needs_anti_dependence_check()) { + insert_anti_dependences(sb, clone); + } } } From 631036a07b39aa279e4827514645c72c27dee519 Mon Sep 17 00:00:00 2001 From: Jon Masamitsu Date: Wed, 6 Jul 2016 13:23:10 -0700 Subject: [PATCH 056/108] 8155263: DisableStartThread should not be applied to GC worker threads Reviewed-by: tschatzl, sangheki --- hotspot/src/share/vm/gc/shared/concurrentGCThread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/gc/shared/concurrentGCThread.cpp b/hotspot/src/share/vm/gc/shared/concurrentGCThread.cpp index 322931e977d..df72f041486 100644 --- a/hotspot/src/share/vm/gc/shared/concurrentGCThread.cpp +++ b/hotspot/src/share/vm/gc/shared/concurrentGCThread.cpp @@ -43,7 +43,7 @@ void ConcurrentGCThread::create_and_start(ThreadPriority prio) { // unless "aggressive mode" set; priority // should be just less than that of VMThread. os::set_priority(this, prio); - if (!_should_terminate && !DisableStartThread) { + if (!_should_terminate) { os::start_thread(this); } } From aa7a85dcbf15465a4afcf216b4c907824a620df5 Mon Sep 17 00:00:00 2001 From: Richard Reingruber Date: Wed, 13 Jul 2016 10:51:19 +0300 Subject: [PATCH 057/108] 8134434: JVM_DoPrivileged() fires assert(_exception_caught == false) failed: _exception_caught is out of phase Explicitly set exception detected inside rethrow_C Reviewed-by: goetz, sspitsyn --- hotspot/src/share/vm/opto/runtime.cpp | 6 ++ .../ExceptionCaughtOutOfPhaseTest.java | 61 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 hotspot/test/serviceability/jvmti/ExceptionCaughtOutOfPhase/ExceptionCaughtOutOfPhaseTest.java diff --git a/hotspot/src/share/vm/opto/runtime.cpp b/hotspot/src/share/vm/opto/runtime.cpp index 53db5ec4d0c..3626009a15c 100644 --- a/hotspot/src/share/vm/opto/runtime.cpp +++ b/hotspot/src/share/vm/opto/runtime.cpp @@ -59,6 +59,7 @@ #include "opto/mulnode.hpp" #include "opto/runtime.hpp" #include "opto/subnode.hpp" +#include "prims/jvmtiThreadState.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/fprofiler.hpp" #include "runtime/handles.inline.hpp" @@ -1451,6 +1452,11 @@ address OptoRuntime::rethrow_C(oopDesc* exception, JavaThread* thread, address r } #endif + JvmtiThreadState *state = thread->jvmti_thread_state(); + if (state != NULL) { + state->set_exception_detected(); + } + thread->set_vm_result(exception); // Frame not compiled (handles deoptimization blob) return SharedRuntime::raw_exception_handler_for_return_address(thread, ret_pc); diff --git a/hotspot/test/serviceability/jvmti/ExceptionCaughtOutOfPhase/ExceptionCaughtOutOfPhaseTest.java b/hotspot/test/serviceability/jvmti/ExceptionCaughtOutOfPhase/ExceptionCaughtOutOfPhaseTest.java new file mode 100644 index 00000000000..2c823d3819b --- /dev/null +++ b/hotspot/test/serviceability/jvmti/ExceptionCaughtOutOfPhase/ExceptionCaughtOutOfPhaseTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016, 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. + */ + +import java.security.AccessController; +import java.security.PrivilegedAction; + +/* + * @test + * @bug 8134434 + * @summary JVM_DoPrivileged() fires assert(_exception_caught == false) failed: _exception_caught is out of phase + * @run main/othervm -agentlib:jdwp=transport=dt_socket,address=9000,server=y,suspend=n -Xbatch ExceptionCaughtOutOfPhaseTest + */ + +public class ExceptionCaughtOutOfPhaseTest { + public static void main(String[] args) { + PrivilegedAction action = new HotThrowingAction(); + System.out.println("### Warm-up"); + for(int i=0; i<11000; i++) { + try { + action.run(); // call run() to get it compiled + } catch(Throwable t) { + // ignored + } + } + + System.out.println("### Warm-up done"); + System.out.println("### Executing privileged action"); + + try { + AccessController.doPrivileged(action); + } catch (Error e) { + // ignored + } + } + + public static class HotThrowingAction implements PrivilegedAction { + public Object run() { + throw new Error(); + } + } +} From 7431d74121d466e62ae0bee5f14c67ea314dac5d Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Thu, 7 Jul 2016 18:40:53 +0100 Subject: [PATCH 058/108] 8156980: Hotspot build doesn't have -std=gnu++98 gcc option 8157358: Syntax error in TOOLCHAIN_CHECK_COMPILER_VERSION Add flags for GCC 6 to JVM_CFLAGS and fix prefix handling Reviewed-by: erikj, kbarrett --- hotspot/make/gensrc/GensrcAdlc.gmk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hotspot/make/gensrc/GensrcAdlc.gmk b/hotspot/make/gensrc/GensrcAdlc.gmk index a33d42db206..16c1b671503 100644 --- a/hotspot/make/gensrc/GensrcAdlc.gmk +++ b/hotspot/make/gensrc/GensrcAdlc.gmk @@ -51,6 +51,9 @@ ifeq ($(call check-jvm-feature, compiler2), true) ADLC_CFLAGS_WARNINGS := -W3 -D_CRT_SECURE_NO_WARNINGS endif + # Set the C++ standard if supported + ADLC_CFLAGS += $(CXXSTD_CXXFLAG) + # NOTE: The old build didn't set -DASSERT for windows but it doesn't seem to # hurt. ADLC_CFLAGS += -DASSERT From edbcea17d096b891c45f6521aa2ff6872d23bc09 Mon Sep 17 00:00:00 2001 From: Calvin Cheung Date: Wed, 13 Jul 2016 18:26:51 -0700 Subject: [PATCH 059/108] 8159901: missing newline char in the exception messages in diagnosticArgument.cpp Reviewed-by: fparain, egahlin, iklam --- .../share/vm/services/diagnosticArgument.cpp | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/hotspot/src/share/vm/services/diagnosticArgument.cpp b/hotspot/src/share/vm/services/diagnosticArgument.cpp index 0c51a708e9a..abd83499d19 100644 --- a/hotspot/src/share/vm/services/diagnosticArgument.cpp +++ b/hotspot/src/share/vm/services/diagnosticArgument.cpp @@ -98,7 +98,7 @@ template <> void DCmdArgument::parse_value(const char* str, strncpy(buf, str, len); buf[len] = '\0'; Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_IllegalArgumentException(), - "Integer parsing error in command argument '%s'. Could not parse: %s.", _name, buf); + "Integer parsing error in command argument '%s'. Could not parse: %s.\n", _name, buf); } } @@ -132,7 +132,7 @@ template <> void DCmdArgument::parse_value(const char* str, strncpy(buf, str, len); buf[len] = '\0'; Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_IllegalArgumentException(), - "Boolean parsing error in command argument '%s'. Could not parse: %s.", _name, buf); + "Boolean parsing error in command argument '%s'. Could not parse: %s.\n", _name, buf); } } } @@ -183,13 +183,13 @@ template <> void DCmdArgument::parse_value(const char* str, size_t len, TRAPS) { if (str == NULL) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), - "Integer parsing error nanotime value: syntax error, value is null"); + "Integer parsing error nanotime value: syntax error, value is null\n"); } int argc = sscanf(str, JLONG_FORMAT, &_value._time); if (argc != 1) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), - "Integer parsing error nanotime value: syntax error"); + "Integer parsing error nanotime value: syntax error\n"); } size_t idx = 0; while(idx < len && isdigit(str[idx])) { @@ -199,7 +199,7 @@ template <> void DCmdArgument::parse_value(const char* str, // only accept missing unit if the value is 0 if (_value._time != 0) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), - "Integer parsing error nanotime value: unit required"); + "Integer parsing error nanotime value: unit required\n"); } else { _value._nanotime = 0; strcpy(_value._unit, "ns"); @@ -207,7 +207,7 @@ template <> void DCmdArgument::parse_value(const char* str, } } else if(len - idx > 2) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), - "Integer parsing error nanotime value: illegal unit"); + "Integer parsing error nanotime value: illegal unit\n"); } else { strncpy(_value._unit, &str[idx], len - idx); /*Write an extra null termination. This is safe because _value._unit @@ -234,7 +234,7 @@ template <> void DCmdArgument::parse_value(const char* str, _value._nanotime = _value._time * 24 * 60 * 60 * 1000 * 1000 * 1000; } else { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), - "Integer parsing error nanotime value: illegal unit"); + "Integer parsing error nanotime value: illegal unit\n"); } } @@ -280,12 +280,11 @@ template <> void DCmdArgument::parse_value(const char* str, size_t len, TRAPS) { if (str == NULL) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), - "Parsing error memory size value: syntax error, value is null"); + "Parsing error memory size value: syntax error, value is null\n"); } - if (*str == '-') { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), - "Parsing error memory size value: negative values not allowed"); + "Parsing error memory size value: negative values not allowed\n"); } int res = sscanf(str, UINT64_FORMAT "%c", &_value._val, &_value._multiplier); if (res == 2) { @@ -310,7 +309,7 @@ template <> void DCmdArgument::parse_value(const char* str, _value._size = _value._val; } else { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), - "Parsing error memory size value: invalid value"); + "Parsing error memory size value: invalid value\n"); } } From dd05422209dbf6ff7d8cefd2bf7dc11f772ab6fc Mon Sep 17 00:00:00 2001 From: Michail Chernov Date: Tue, 12 Jul 2016 15:06:18 +0300 Subject: [PATCH 060/108] 8158508: gc/logging/TestUnifiedLoggingSwitchStress.java timeout Reviewed-by: jmasa, tschatzl --- hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java b/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java index 647cd63128e..37fd5b251db 100644 --- a/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java +++ b/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java @@ -43,6 +43,7 @@ import java.util.Random; * @summary Switches gc log level on fly while stressing memory/gc * @key gc * @key stress + * @requires !vm.flightRecorder * @library /testlibrary /test/lib / * @modules java.management java.base/jdk.internal.misc * From 22f1fb042eddc5554eccac62c56ebf474afb0343 Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Fri, 15 Jul 2016 12:36:18 +0200 Subject: [PATCH 061/108] 8151163: All Buffer implementations should leverage Unsafe unaligned accessors Reviewed-by: shade, aph --- .../intrinsics/unsafe/ByteBufferTest.java | 750 ++++++++++++++++++ .../unsafe/DirectByteBufferTest.java | 50 ++ .../intrinsics/unsafe/HeapByteBufferTest.java | 525 +----------- 3 files changed, 830 insertions(+), 495 deletions(-) create mode 100644 hotspot/test/compiler/intrinsics/unsafe/ByteBufferTest.java create mode 100644 hotspot/test/compiler/intrinsics/unsafe/DirectByteBufferTest.java diff --git a/hotspot/test/compiler/intrinsics/unsafe/ByteBufferTest.java b/hotspot/test/compiler/intrinsics/unsafe/ByteBufferTest.java new file mode 100644 index 00000000000..6294e90a8a9 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/unsafe/ByteBufferTest.java @@ -0,0 +1,750 @@ +/* + * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Red Hat Inc. 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. + */ + +import jdk.test.lib.Utils; + +import java.nio.Buffer; +import java.nio.BufferOverflowException; +import java.nio.BufferUnderflowException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.CharBuffer; +import java.nio.DoubleBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import java.nio.LongBuffer; +import java.nio.ShortBuffer; +import java.util.Arrays; +import java.util.Random; + +import static java.nio.ByteOrder.BIG_ENDIAN; +import static java.nio.ByteOrder.LITTLE_ENDIAN; + +// A wrapper for a ByteBuffer which maintains a backing array and a +// position. Whenever this wrapper is written the backing array and +// the wrapped byte buffer are updated together, and whenever it is +// read we check that the ByteBuffer and the backing array are identical. + +class MyByteBuffer { + final ByteBuffer buf; + final byte[] bytes; + int pos; + ByteOrder byteOrder = BIG_ENDIAN; + + MyByteBuffer(ByteBuffer buf) { + this.buf = buf; + this.bytes = new byte[buf.capacity()]; + pos = 0; + } + + public final MyByteBuffer order(ByteOrder bo) { + byteOrder = bo; + buf.order(bo); + return this; + } + + static MyByteBuffer allocate(int capacity) { + return new MyByteBuffer(ByteBuffer.allocate(capacity)); + } + + static MyByteBuffer allocateDirect(int capacity) { + return new MyByteBuffer(ByteBuffer.allocateDirect(capacity)); + } + + int capacity() { return bytes.length; } + int position() { + if (buf.position() != pos) + throw new RuntimeException(); + return buf.position(); + } + + byte[] actualArray() { + buf.rewind(); + byte[] actual = new byte[bytes.length]; + buf.get(actual, 0, actual.length); + buf.rewind(); + + return actual; + } + byte[] expectedArray() { return bytes; } + + private static byte long7(long x) { return (byte)(x >> 56); } + private static byte long6(long x) { return (byte)(x >> 48); } + private static byte long5(long x) { return (byte)(x >> 40); } + private static byte long4(long x) { return (byte)(x >> 32); } + private static byte long3(long x) { return (byte)(x >> 24); } + private static byte long2(long x) { return (byte)(x >> 16); } + private static byte long1(long x) { return (byte)(x >> 8); } + private static byte long0(long x) { return (byte)(x ); } + + private static byte int3(int x) { return (byte)(x >> 24); } + private static byte int2(int x) { return (byte)(x >> 16); } + private static byte int1(int x) { return (byte)(x >> 8); } + private static byte int0(int x) { return (byte)(x ); } + + private static byte short1(short x) { return (byte)(x >> 8); } + private static byte short0(short x) { return (byte)(x ); } + + byte _get(long i) { return bytes[(int)i]; } + void _put(long i, byte x) { bytes[(int)i] = x; } + + private void putLongX(long a, long x) { + if (byteOrder == BIG_ENDIAN) { + x = Long.reverseBytes(x); + } + _put(a + 7, long7(x)); + _put(a + 6, long6(x)); + _put(a + 5, long5(x)); + _put(a + 4, long4(x)); + _put(a + 3, long3(x)); + _put(a + 2, long2(x)); + _put(a + 1, long1(x)); + _put(a , long0(x)); + } + + private void putIntX(long a, int x) { + if (byteOrder == BIG_ENDIAN) { + x = Integer.reverseBytes(x); + } + _put(a + 3, int3(x)); + _put(a + 2, int2(x)); + _put(a + 1, int1(x)); + _put(a , int0(x)); + } + + private void putShortX(int bi, short x) { + if (byteOrder == BIG_ENDIAN) { + x = Short.reverseBytes(x); + } + _put(bi , short0(x)); + _put(bi + 1, short1(x)); + } + + static private int makeInt(byte b3, byte b2, byte b1, byte b0) { + return (((b3 ) << 24) | + ((b2 & 0xff) << 16) | + ((b1 & 0xff) << 8) | + ((b0 & 0xff) )); + } + int getIntX(long a) { + int x = makeInt(_get(a + 3), + _get(a + 2), + _get(a + 1), + _get(a)); + if (byteOrder == BIG_ENDIAN) { + x = Integer.reverseBytes(x); + } + return x; + } + + static private long makeLong(byte b7, byte b6, byte b5, byte b4, + byte b3, byte b2, byte b1, byte b0) + { + return ((((long)b7 ) << 56) | + (((long)b6 & 0xff) << 48) | + (((long)b5 & 0xff) << 40) | + (((long)b4 & 0xff) << 32) | + (((long)b3 & 0xff) << 24) | + (((long)b2 & 0xff) << 16) | + (((long)b1 & 0xff) << 8) | + (((long)b0 & 0xff) )); + } + + long getLongX(long a) { + long x = makeLong(_get(a + 7), + _get(a + 6), + _get(a + 5), + _get(a + 4), + _get(a + 3), + _get(a + 2), + _get(a + 1), + _get(a)); + if (byteOrder == BIG_ENDIAN) { + x = Long.reverseBytes(x); + } + return x; + } + + static private short makeShort(byte b1, byte b0) { + return (short)((b1 << 8) | (b0 & 0xff)); + } + + short getShortX(long a) { + short x = makeShort(_get(a + 1), + _get(a )); + if (byteOrder == BIG_ENDIAN) { + x = Short.reverseBytes(x); + } + return x; + } + + double getDoubleX(long a) { + long x = getLongX(a); + return Double.longBitsToDouble(x); + } + + double getFloatX(long a) { + int x = getIntX(a); + return Float.intBitsToFloat(x); + } + + void ck(long x, long y) { + if (x != y) { + throw new RuntimeException(" x = " + Long.toHexString(x) + ", y = " + Long.toHexString(y)); + } + } + + void ck(double x, double y) { + if (x == x && y == y && x != y) { + ck(x, y); + } + } + + // Method accessors + + long getLong(int i) { ck(buf.getLong(i), getLongX(i)); return buf.getLong(i); } + int getInt(int i) { ck(buf.getInt(i), getIntX(i)); return buf.getInt(i); } + short getShort(int i) { ck(buf.getShort(i), getShortX(i)); return buf.getShort(i); } + char getChar(int i) { ck(buf.getChar(i), (char)getShortX(i)); return buf.getChar(i); } + double getDouble(int i) { ck(buf.getDouble(i), getDoubleX(i)); return buf.getDouble(i); } + float getFloat(int i) { ck(buf.getFloat(i), getFloatX(i)); return buf.getFloat(i); } + + void putLong(int i, long x) { buf.putLong(i, x); putLongX(i, x); } + void putInt(int i, int x) { buf.putInt(i, x); putIntX(i, x); } + void putShort(int i, short x) { buf.putShort(i, x); putShortX(i, x); } + void putChar(int i, char x) { buf.putChar(i, x); putShortX(i, (short)x); } + void putDouble(int i, double x) { buf.putDouble(i, x); putLongX(i, Double.doubleToRawLongBits(x)); } + void putFloat(int i, float x) { buf.putFloat(i, x); putIntX(i, Float.floatToRawIntBits(x)); } + + long getLong() { ck(buf.getLong(buf.position()), getLongX(pos)); long x = buf.getLong(); pos += 8; return x; } + int getInt() { ck(buf.getInt(buf.position()), getIntX(pos)); int x = buf.getInt(); pos += 4; return x; } + short getShort() { ck(buf.getShort(buf.position()), getShortX(pos)); short x = buf.getShort(); pos += 2; return x; } + char getChar() { ck(buf.getChar(buf.position()), (char)getShortX(pos)); char x = buf.getChar(); pos += 2; return x; } + double getDouble() { ck(buf.getDouble(buf.position()), getDoubleX(pos)); double x = buf.getDouble(); pos += 8; return x; } + float getFloat() { ck(buf.getFloat(buf.position()), getFloatX(pos)); float x = buf.getFloat(); pos += 4; return x; } + + void putLong(long x) { putLongX(pos, x); pos += 8; buf.putLong(x); } + void putInt(int x) { putIntX(pos, x); pos += 4; buf.putInt(x); } + void putShort(short x) { putShortX(pos, x); pos += 2; buf.putShort(x); } + void putChar(char x) { putShortX(pos, (short)x); pos += 2; buf.putChar(x); } + void putDouble(double x) { putLongX(pos, Double.doubleToRawLongBits(x)); pos += 8; buf.putDouble(x); } + void putFloat(float x) { putIntX(pos, Float.floatToRawIntBits(x)); pos += 4; buf.putFloat(x); } + + // View accessors + + long getLong(LongBuffer vb, int i) { ck(vb.get(i / 8), getLongX(i)); return vb.get(i / 8); } + int getInt(IntBuffer vb, int i) { ck(vb.get(i / 4), getIntX(i)); return vb.get(i / 4); } + short getShort(ShortBuffer vb, int i) { ck(vb.get(i / 2), getShortX(i)); return vb.get(i / 2); } + char getChar(CharBuffer vb, int i) { ck(vb.get(i / 2), (char)getShortX(i)); return vb.get(i / 2); } + double getDouble(DoubleBuffer vb, int i) { ck(vb.get(i / 8), getDoubleX(i)); return vb.get(i / 8); } + float getFloat(FloatBuffer vb, int i) { ck(vb.get(i / 4), getFloatX(i)); return vb.get(i / 4); } + + void putLong(LongBuffer vb, int i, long x) { vb.put(i / 8, x); putLongX(i, x); } + void putInt(IntBuffer vb, int i, int x) { vb.put(i / 4, x); putIntX(i, x); } + void putShort(ShortBuffer vb, int i, short x) { vb.put(i / 2, x); putShortX(i, x); } + void putChar(CharBuffer vb, int i, char x) { vb.put(i / 2, x); putShortX(i, (short)x); } + void putDouble(DoubleBuffer vb, int i, double x) { vb.put(i / 8, x); putLongX(i, Double.doubleToRawLongBits(x)); } + void putFloat(FloatBuffer vb, int i, float x) { vb.put(i / 4, x); putIntX(i, Float.floatToRawIntBits(x)); } + + long getLong(LongBuffer v) { ck(v.get(v.position()), getLongX(pos)); long x = v.get(); pos += 8; return x; } + int getInt(IntBuffer v) { ck(v.get(v.position()), getIntX(pos)); int x = v.get(); pos += 4; return x; } + short getShort(ShortBuffer v) { ck(v.get(v.position()), getShortX(pos)); short x = v.get(); pos += 2; return x; } + char getChar(CharBuffer v) { ck(v.get(v.position()), (char)getShortX(pos)); char x = v.get(); pos += 2; return x; } + double getDouble(DoubleBuffer v) { ck(v.get(v.position()), getDoubleX(pos)); double x = v.get(); pos += 8; return x; } + float getFloat(FloatBuffer v) { ck(v.get(v.position()), getFloatX(pos)); float x = v.get(); pos += 4; return x; } + + void putLong(LongBuffer v, long x) { putLongX(pos, x); pos += 8; v.put(x); } + void putInt(IntBuffer v, int x) { putIntX(pos, x); pos += 4; v.put(x); } + void putShort(ShortBuffer v, short x) { putShortX(pos, x); pos += 2; v.put(x); } + void putChar(CharBuffer v, char x) { putShortX(pos, (short)x); pos += 2; v.put(x); } + void putDouble(DoubleBuffer v, double x) { putLongX(pos, Double.doubleToRawLongBits(x)); pos += 8; v.put(x); } + void putFloat(FloatBuffer v, float x) { putIntX(pos, Float.floatToRawIntBits(x)); pos += 4; v.put(x); } + + void rewind() { pos = 0; buf.rewind(); } +} + +public abstract class ByteBufferTest implements Runnable { + + Random random = Utils.getRandomInstance(); + MyByteBuffer data; + + static int randomOffset(Random r, MyByteBuffer buf, int size) { + return r.nextInt(buf.capacity() - size); + } + + static int randomAlignedOffset(Random r, MyByteBuffer buf, int unitSize) { + return r.nextInt(buf.capacity() / unitSize) * unitSize; + } + + long iterations; + + ByteBufferTest(long iterations, boolean direct) { + this.iterations = iterations; + data = direct + ? MyByteBuffer.allocateDirect(1024) + : MyByteBuffer.allocate(1024); + } + + // The core of the test. Walk over the buffer reading and writing + // random data, XORing it as we go. We can detect writes in the + // wrong place, writes which are too long or too short, and reads + // or writes of the wrong data, + void step(Random r) { + stepUsingAccessors(r); + stepUsingViews(r); + } + + void stepUsingAccessors(Random r) { + data.order((r.nextInt() & 1) != 0 ? BIG_ENDIAN : LITTLE_ENDIAN); + + data.rewind(); + while (data.position() < data.capacity()) + data.putLong(data.getLong() ^ random.nextLong()); + + data.rewind(); + while (data.position() < data.capacity()) + data.putInt(data.getInt() ^ random.nextInt()); + + data.rewind(); + while (data.position() < data.capacity()) + data.putShort((short)(data.getShort() ^ random.nextInt())); + + data.rewind(); + while (data.position() < data.capacity()) + data.putChar((char)(data.getChar() ^ random.nextInt())); + + data.rewind(); + while (data.position() < data.capacity()) + data.putDouble(combine(data.getDouble(), random.nextLong())); + + data.rewind(); + while (data.position() < data.capacity()) + data.putFloat(combine(data.getFloat(), random.nextInt())); + + for (int i = 0; i < 100; i++) { + int offset = randomOffset(r, data, Long.BYTES); + data.putLong(offset, data.getLong(offset) ^ random.nextLong()); + } + for (int i = 0; i < 100; i++) { + int offset = randomOffset(r, data, Integer.BYTES); + data.putInt(offset, data.getInt(offset) ^ random.nextInt()); + } + for (int i = 0; i < 100; i++) { + int offset = randomOffset(r, data, Short.BYTES); + data.putShort(offset, (short)(data.getShort(offset) ^ random.nextInt())); + } + for (int i = 0; i < 100; i++) { + int offset = randomOffset(r, data, Character.BYTES); + data.putChar(offset, (char)(data.getChar(offset) ^ random.nextInt())); + } + for (int i = 0; i < 100; i++) { + int offset = randomOffset(r, data, Double.BYTES); + data.putDouble(offset, combine(data.getDouble(offset), random.nextLong())); + } + for (int i = 0; i < 100; i++) { + int offset = randomOffset(r, data, Float.BYTES); + data.putFloat(offset, combine(data.getFloat(offset), random.nextInt())); + } + } + + void stepUsingViews(Random r) { + data.order((r.nextInt() & 1) != 0 ? BIG_ENDIAN : LITTLE_ENDIAN); + + data.rewind(); + LongBuffer lbuf = data.buf.asLongBuffer(); + while (lbuf.position() < data.capacity() / Long.BYTES) + data.putLong(lbuf, data.getLong(lbuf) ^ random.nextLong()); + + data.rewind(); + IntBuffer ibuf = data.buf.asIntBuffer(); + while (ibuf.position() < data.capacity() / Integer.BYTES) + data.putInt(ibuf, data.getInt(ibuf) ^ random.nextInt()); + + data.rewind(); + ShortBuffer sbuf = data.buf.asShortBuffer(); + while (sbuf.position() < data.capacity() / Short.BYTES) + data.putShort(sbuf, (short)(data.getShort(sbuf) ^ random.nextInt())); + + data.rewind(); + CharBuffer cbuf = data.buf.asCharBuffer(); + while (cbuf.position() < data.capacity() / Character.BYTES) + data.putChar(cbuf, (char)(data.getChar(cbuf) ^ random.nextInt())); + + data.rewind(); + DoubleBuffer dbuf = data.buf.asDoubleBuffer(); + while (dbuf.position() < data.capacity() / Double.BYTES) + data.putDouble(dbuf, combine(data.getDouble(dbuf), random.nextLong())); + + data.rewind(); + FloatBuffer fbuf = data.buf.asFloatBuffer(); + while (fbuf.position() < data.capacity() / Float.BYTES) + data.putFloat(fbuf, combine(data.getFloat(fbuf), random.nextInt())); + + for (int i = 0; i < 100; i++) { + int offset = randomAlignedOffset(r, data, Long.BYTES); + data.putLong(lbuf, offset, data.getLong(lbuf, offset) ^ random.nextLong()); + } + for (int i = 0; i < 100; i++) { + int offset = randomAlignedOffset(r, data, Integer.BYTES); + data.putInt(ibuf, offset, data.getInt(ibuf, offset) ^ random.nextInt()); + } + for (int i = 0; i < 100; i++) { + int offset = randomAlignedOffset(r, data, Short.BYTES); + data.putShort(sbuf, offset, (short)(data.getShort(sbuf, offset) ^ random.nextInt())); + } + for (int i = 0; i < 100; i++) { + int offset = randomAlignedOffset(r, data, Character.BYTES); + data.putChar(cbuf, offset, (char)(data.getChar(cbuf, offset) ^ random.nextInt())); + } + for (int i = 0; i < 100; i++) { + int offset = randomAlignedOffset(r, data, Double.BYTES); + data.putDouble(dbuf, offset, combine(data.getDouble(dbuf, offset), random.nextLong())); + } + for (int i = 0; i < 100; i++) { + int offset = randomAlignedOffset(r, data, Float.BYTES); + data.putFloat(fbuf, offset, combine(data.getFloat(fbuf, offset), random.nextInt())); + } + } + + // XOR the bit pattern of a double and a long, returning the + // result as a double. + // + // We convert signalling NaNs to quiet NaNs. We need to do this + // because some platforms (in particular legacy 80x87) do not + // provide transparent conversions between integer and + // floating-point types even when using raw conversions but + // quietly convert sNaN to qNaN. This causes spurious test + // failures when the template interpreter uses 80x87 and the JITs + // use XMM registers. + // + public double combine(double prev, long bits) { + bits ^= Double.doubleToRawLongBits(prev); + double result = Double.longBitsToDouble(bits); + if (Double.isNaN(result)) { + result = Double.longBitsToDouble(bits | 0x8000000000000l); + } + return result; + } + + // XOR the bit pattern of a float and an int, returning the result + // as a float. Convert sNaNs to qNaNs. + public Float combine(float prev, int bits) { + bits ^= Float.floatToRawIntBits(prev); + Float result = Float.intBitsToFloat(bits); + if (Float.isNaN(result)) { + result = Float.intBitsToFloat(bits | 0x400000); + } + return result; + } + + enum PrimitiveType { + BYTE(1), CHAR(2), SHORT(2), INT(4), LONG(8), FLOAT(4), DOUBLE(8); + + public final int size; + PrimitiveType(int size) { + this.size = size; + } + } + + Buffer asView(ByteBuffer b, PrimitiveType t) { + switch (t) { + case BYTE: return b; + case CHAR: return b.asCharBuffer(); + case SHORT: return b.asShortBuffer(); + case INT: return b.asIntBuffer(); + case LONG: return b.asLongBuffer(); + case FLOAT: return b.asFloatBuffer(); + case DOUBLE: return b.asDoubleBuffer(); + } + throw new InternalError("Should not reach here"); + } + + void getOne(ByteBuffer b, PrimitiveType t) { + switch (t) { + case BYTE: b.get(); break; + case CHAR: b.getChar(); break; + case SHORT: b.getShort(); break; + case INT: b.getInt(); break; + case LONG: b.getLong(); break; + case FLOAT: b.getFloat(); break; + case DOUBLE: b.getDouble(); break; + } + } + + void putOne(ByteBuffer b, PrimitiveType t) { + switch (t) { + case BYTE: b.put((byte)0); break; + case CHAR: b.putChar('0'); break; + case SHORT: b.putShort((short)0); break; + case INT: b.putInt(0); break; + case LONG: b.putLong(0); break; + case FLOAT: b.putFloat(0); break; + case DOUBLE: b.putDouble(0); break; + } + } + + void asViewGetOne(ByteBuffer b, PrimitiveType t) { + switch (t) { + case BYTE: b.get(); break; + case CHAR: b.asCharBuffer().get(); break; + case SHORT: b.asShortBuffer().get(); break; + case INT: b.asIntBuffer().get(); break; + case LONG: b.asLongBuffer().get(); break; + case FLOAT: b.asFloatBuffer().get(); break; + case DOUBLE: b.asDoubleBuffer().get(); break; + } + } + + void asViewPutOne(ByteBuffer b, PrimitiveType t) { + switch (t) { + case BYTE: b.put((byte)0); break; + case CHAR: b.asCharBuffer().put('0'); break; + case SHORT: b.asShortBuffer().put((short)0); break; + case INT: b.asIntBuffer().put(0); break; + case LONG: b.asLongBuffer().put(0); break; + case FLOAT: b.asFloatBuffer().put(0); break; + case DOUBLE: b.asDoubleBuffer().put(0); break; + } + } + + void getOne(ByteBuffer b, PrimitiveType t, int index) { + switch (t) { + case BYTE: b.get(index); break; + case CHAR: b.getChar(index); break; + case SHORT: b.getShort(index); break; + case INT: b.getInt(index); break; + case LONG: b.getLong(index); break; + case FLOAT: b.getFloat(index); break; + case DOUBLE: b.getDouble(index); break; + } + } + + void putOne(ByteBuffer b, PrimitiveType t, int index) { + switch (t) { + case BYTE: b.put(index, (byte)0); break; + case CHAR: b.putChar(index, '0'); break; + case SHORT: b.putShort(index, (short)0); break; + case INT: b.putInt(index, 0); break; + case LONG: b.putLong(index, 0); break; + case FLOAT: b.putFloat(index, 0); break; + case DOUBLE: b.putDouble(index, 0); break; + } + } + + void asViewGetOne(Buffer v, PrimitiveType t, int index) { + switch (t) { + case BYTE: ((ByteBuffer) v).get(index); break; + case CHAR: ((CharBuffer) v).get(index); break; + case SHORT: ((ShortBuffer) v).get(index); break; + case INT: ((IntBuffer) v).get(index); break; + case LONG: ((LongBuffer) v).get(index); break; + case FLOAT: ((FloatBuffer) v).get(index); break; + case DOUBLE: ((DoubleBuffer) v).get(index); break; + } + } + + void asViewPutOne(Buffer v, PrimitiveType t, int index) { + switch (t) { + case BYTE: ((ByteBuffer) v).put(index, (byte)0); break; + case CHAR: ((CharBuffer) v).put(index, '0'); break; + case SHORT: ((ShortBuffer) v).put(index, (short)0); break; + case INT: ((IntBuffer) v).put(index, 0); break; + case LONG: ((LongBuffer) v).put(index, 0); break; + case FLOAT: ((FloatBuffer) v).put(index, 0); break; + case DOUBLE: ((DoubleBuffer) v).put(index, 0); break; + } + } + + void checkBoundaryConditions() { + for (int i = 0; i < 100; i++) { + int bufSize = random.nextInt(16); + ByteBuffer buf = data.buf.isDirect() + ? ByteBuffer.allocateDirect(bufSize) + : ByteBuffer.allocate(bufSize); + for (PrimitiveType t : PrimitiveType.values()) { + buf.rewind(); + Buffer viewBuf = asView(buf, t); + for (int j = 0; j < 100; j++) { + int offset = random.nextInt(32) - 8; + int threw = 0; + int checks = 6; + try { + try { + buf.position(offset); + getOne(buf, t); + } + catch (BufferUnderflowException e) { + if (offset + t.size < bufSize) + throw new RuntimeException + ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); + threw++; + } + catch (IllegalArgumentException e) { + if (offset >= 0 && offset + t.size < bufSize) + throw new RuntimeException + ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); + threw++; + } + + try { + buf.position(offset); + asViewGetOne(buf, t); + } + catch (BufferUnderflowException e) { + if (offset + t.size < bufSize) + throw new RuntimeException + ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); + threw++; + } + catch (IllegalArgumentException e) { + if (offset >= 0 && offset + t.size < bufSize) + throw new RuntimeException + ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); + threw++; + } + + try { + buf.position(offset); + putOne(buf, t); + } + catch (BufferOverflowException e) { + if (offset + t.size < bufSize) + throw new RuntimeException + ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); + threw++; + } + catch (IllegalArgumentException e) { + if (offset >= 0 && offset + t.size < bufSize) + throw new RuntimeException + ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); + threw++; + } + + try { + buf.position(offset); + asViewPutOne(buf, t); + } + catch (BufferOverflowException e) { + if (offset + t.size < bufSize) + throw new RuntimeException + ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); + threw++; + } + catch (IllegalArgumentException e) { + if (offset >= 0 && offset + t.size < bufSize) + throw new RuntimeException + ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); + threw++; + } + + try { + putOne(buf, t, offset); + } + catch (IndexOutOfBoundsException e) { + if (offset >= 0 && offset + t.size < bufSize) + throw new RuntimeException + ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); + threw++; + } + + try { + getOne(buf, t, offset); + } + catch (IndexOutOfBoundsException e) { + if (offset >= 0 && offset + t.size < bufSize) + throw new RuntimeException + ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); + threw++; + } + + // If offset is aligned access using the view + if (offset % t.size == 0) { + checks = 8; + int viewOffset = offset / t.size; + + + try { + asViewPutOne(viewBuf, t, viewOffset); + } + catch (IndexOutOfBoundsException e) { + if (offset >= 0 && offset + t.size < bufSize) + throw new RuntimeException + ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); + threw++; + } + + try { + asViewGetOne(viewBuf, t, viewOffset); + } + catch (IndexOutOfBoundsException e) { + if (offset >= 0 && offset + t.size < bufSize) + throw new RuntimeException + ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); + threw++; + } + } + + if (threw == 0) { + // Make sure that we should not have thrown. + if (offset < 0 || offset + t.size > bufSize) { + throw new RuntimeException + ("should have thrown but did not, type = " + t + + ", offset = " + offset + ", bufSize = " + bufSize); + } + } + else if (threw != checks) { + // If one of the {get,put} operations threw + // due to an invalid offset then all four of + // them should have thrown. + throw new RuntimeException + ("should have thrown but at least one did not, type = " + t + + ", offset = " + offset + ", bufSize = " + bufSize); + } + } + catch (Throwable th) { + throw new RuntimeException + ("unexpected throw: type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, th); + + } + } + } + } + } + + public void run() { + checkBoundaryConditions(); + + for (int i = 0; i < data.capacity(); i += 8) { + data.putLong(i, random.nextLong()); + } + + for (int i = 0; i < iterations; i++) { + step(random); + } + + if (!Arrays.equals(data.actualArray(), data.expectedArray())) { + throw new RuntimeException(); + } + } +} diff --git a/hotspot/test/compiler/intrinsics/unsafe/DirectByteBufferTest.java b/hotspot/test/compiler/intrinsics/unsafe/DirectByteBufferTest.java new file mode 100644 index 00000000000..5c2765378a3 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/unsafe/DirectByteBufferTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, Red Hat Inc. 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 8026049 8151163 + * @modules java.base/jdk.internal.misc + * @library /testlibrary + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses -Djdk.test.lib.random.seed=0 DirectByteBufferTest + * @run main/othervm -Djdk.test.lib.random.seed=0 DirectByteBufferTest + * @summary Verify that direct byte buffers are correctly accessed. + */ + +public class DirectByteBufferTest extends ByteBufferTest { + + public DirectByteBufferTest(long iterations, boolean direct) { + super(iterations, direct); + } + + public static void main(String[] args) { + // The number of iterations is high to ensure that tiered + // compilation kicks in all the way up to C2. + long iterations = 100000; + if (args.length > 0) + iterations = Long.parseLong(args[0]); + + new DirectByteBufferTest(iterations, true).run(); + } +} diff --git a/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java b/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java index 7c46ab1d555..0058d9f839b 100644 --- a/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java +++ b/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java @@ -1,506 +1,41 @@ -// -// Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. -// Copyright (c) 2015, Red Hat Inc. 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. -// -// - -import java.nio.BufferOverflowException; -import java.nio.BufferUnderflowException; -import java.nio.ByteBuffer; -import static java.nio.ByteOrder.BIG_ENDIAN; -import static java.nio.ByteOrder.LITTLE_ENDIAN; -import java.nio.ByteOrder; -import java.util.Arrays; -import java.util.Random; -import jdk.test.lib.Utils; +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, Red Hat Inc. 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 8026049 + * @bug 8026049 8151163 * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses -Djdk.test.lib.random.seed=0 HeapByteBufferTest * @run main/othervm -Djdk.test.lib.random.seed=0 HeapByteBufferTest - * @summary Verify that byte buffers are correctly accessed. + * @summary Verify that heap byte buffers are correctly accessed. */ -// A wrapper for a ByteBuffer which maintains a backing array and a -// position. Whenever this wrapper is written the backing array and -// the wrapped byte buffer are updated together, and whenever it is -// read we check that the ByteBuffer and the backing array are identical. +public class HeapByteBufferTest extends ByteBufferTest { -class MyByteBuffer { - final ByteBuffer buf; - final byte[] bytes; - int pos; - ByteOrder byteOrder = BIG_ENDIAN; - - MyByteBuffer(ByteBuffer buf, byte[] bytes) { - this.buf = buf; - this.bytes = Arrays.copyOf(bytes, bytes.length); - pos = 0; - } - - public final MyByteBuffer order(ByteOrder bo) { - byteOrder = bo; - buf.order(bo); - return this; - } - - static MyByteBuffer wrap(byte[] bytes) { - return new MyByteBuffer(ByteBuffer.wrap(bytes), bytes); - } - - int capacity() { return bytes.length; } - int position() { - if (buf.position() != pos) - throw new RuntimeException(); - return buf.position(); - } - - byte[] array() { return buf.array(); } - byte[] backingArray() { return bytes; } - - private static byte long7(long x) { return (byte)(x >> 56); } - private static byte long6(long x) { return (byte)(x >> 48); } - private static byte long5(long x) { return (byte)(x >> 40); } - private static byte long4(long x) { return (byte)(x >> 32); } - private static byte long3(long x) { return (byte)(x >> 24); } - private static byte long2(long x) { return (byte)(x >> 16); } - private static byte long1(long x) { return (byte)(x >> 8); } - private static byte long0(long x) { return (byte)(x ); } - - private static byte int3(int x) { return (byte)(x >> 24); } - private static byte int2(int x) { return (byte)(x >> 16); } - private static byte int1(int x) { return (byte)(x >> 8); } - private static byte int0(int x) { return (byte)(x ); } - - private static byte short1(short x) { return (byte)(x >> 8); } - private static byte short0(short x) { return (byte)(x ); } - - byte _get(long i) { return bytes[(int)i]; } - void _put(long i, byte x) { bytes[(int)i] = x; } - - private void putLongX(long a, long x) { - if (byteOrder == BIG_ENDIAN) { - x = Long.reverseBytes(x); - } - _put(a + 7, long7(x)); - _put(a + 6, long6(x)); - _put(a + 5, long5(x)); - _put(a + 4, long4(x)); - _put(a + 3, long3(x)); - _put(a + 2, long2(x)); - _put(a + 1, long1(x)); - _put(a , long0(x)); - } - - private void putIntX(long a, int x) { - if (byteOrder == BIG_ENDIAN) { - x = Integer.reverseBytes(x); - } - _put(a + 3, int3(x)); - _put(a + 2, int2(x)); - _put(a + 1, int1(x)); - _put(a , int0(x)); - } - - private void putShortX(int bi, short x) { - if (byteOrder == BIG_ENDIAN) { - x = Short.reverseBytes(x); - } - _put(bi , short0(x)); - _put(bi + 1, short1(x)); - } - - static private int makeInt(byte b3, byte b2, byte b1, byte b0) { - return (((b3 ) << 24) | - ((b2 & 0xff) << 16) | - ((b1 & 0xff) << 8) | - ((b0 & 0xff) )); - } - int getIntX(long a) { - int x = makeInt(_get(a + 3), - _get(a + 2), - _get(a + 1), - _get(a)); - if (byteOrder == BIG_ENDIAN) { - x = Integer.reverseBytes(x); - } - return x; - } - - static private long makeLong(byte b7, byte b6, byte b5, byte b4, - byte b3, byte b2, byte b1, byte b0) - { - return ((((long)b7 ) << 56) | - (((long)b6 & 0xff) << 48) | - (((long)b5 & 0xff) << 40) | - (((long)b4 & 0xff) << 32) | - (((long)b3 & 0xff) << 24) | - (((long)b2 & 0xff) << 16) | - (((long)b1 & 0xff) << 8) | - (((long)b0 & 0xff) )); - } - - long getLongX(long a) { - long x = makeLong(_get(a + 7), - _get(a + 6), - _get(a + 5), - _get(a + 4), - _get(a + 3), - _get(a + 2), - _get(a + 1), - _get(a)); - if (byteOrder == BIG_ENDIAN) { - x = Long.reverseBytes(x); - } - return x; - } - - static private short makeShort(byte b1, byte b0) { - return (short)((b1 << 8) | (b0 & 0xff)); - } - - short getShortX(long a) { - short x = makeShort(_get(a + 1), - _get(a )); - if (byteOrder == BIG_ENDIAN) { - x = Short.reverseBytes(x); - } - return x; - } - - double getDoubleX(long a) { - long x = getLongX(a); - return Double.longBitsToDouble(x); - } - - double getFloatX(long a) { - int x = getIntX(a); - return Float.intBitsToFloat(x); - } - - void ck(long x, long y) { - if (x != y) { - throw new RuntimeException(" x = " + Long.toHexString(x) + ", y = " + Long.toHexString(y)); - } - } - - void ck(double x, double y) { - if (x == x && y == y && x != y) { - ck(x, y); - } - } - - long getLong(int i) { ck(buf.getLong(i), getLongX(i)); return buf.getLong(i); } - int getInt(int i) { ck(buf.getInt(i), getIntX(i)); return buf.getInt(i); } - short getShort(int i) { ck(buf.getShort(i), getShortX(i)); return buf.getShort(i); } - char getChar(int i) { ck(buf.getChar(i), (char)getShortX(i)); return buf.getChar(i); } - double getDouble(int i) { ck(buf.getDouble(i), getDoubleX(i)); return buf.getDouble(i); } - float getFloat(int i) { ck(buf.getFloat(i), getFloatX(i)); return buf.getFloat(i); } - - void putLong(int i, long x) { buf.putLong(i, x); putLongX(i, x); } - void putInt(int i, int x) { buf.putInt(i, x); putIntX(i, x); } - void putShort(int i, short x) { buf.putShort(i, x); putShortX(i, x); } - void putChar(int i, char x) { buf.putChar(i, x); putShortX(i, (short)x); } - void putDouble(int i, double x) { buf.putDouble(i, x); putLongX(i, Double.doubleToRawLongBits(x)); } - void putFloat(int i, float x) { buf.putFloat(i, x); putIntX(i, Float.floatToRawIntBits(x)); } - - long getLong() { ck(buf.getLong(buf.position()), getLongX(pos)); long x = buf.getLong(); pos += 8; return x; } - int getInt() { ck(buf.getInt(buf.position()), getIntX(pos)); int x = buf.getInt(); pos += 4; return x; } - short getShort() { ck(buf.getShort(buf.position()), getShortX(pos)); short x = buf.getShort(); pos += 2; return x; } - char getChar() { ck(buf.getChar(buf.position()), (char)getShortX(pos)); char x = buf.getChar(); pos += 2; return x; } - double getDouble() { ck(buf.getDouble(buf.position()), getDoubleX(pos)); double x = buf.getDouble(); pos += 8; return x; } - float getFloat() { ck(buf.getFloat(buf.position()), getFloatX(pos)); float x = buf.getFloat(); pos += 4; return x; } - - void putLong(long x) { putLongX(pos, x); pos += 8; buf.putLong(x); } - void putInt(int x) { putIntX(pos, x); pos += 4; buf.putInt(x); } - void putShort(short x) { putShortX(pos, x); pos += 2; buf.putShort(x); } - void putChar(char x) { putShortX(pos, (short)x); pos += 2; buf.putChar(x); } - void putDouble(double x) { putLongX(pos, Double.doubleToRawLongBits(x)); pos += 8; buf.putDouble(x); } - void putFloat(float x) { putIntX(pos, Float.floatToRawIntBits(x)); pos += 4; buf.putFloat(x); } - - void rewind() { pos = 0; buf.rewind(); } -} - -public class HeapByteBufferTest implements Runnable { - - Random random = Utils.getRandomInstance(); - MyByteBuffer data = MyByteBuffer.wrap(new byte[1024]); - - int randomOffset(Random r, MyByteBuffer buf, int size) { - return r.nextInt(buf.capacity() - size); - } - - long iterations; - - HeapByteBufferTest(long iterations) { - this.iterations = iterations; - } - - // The core of the test. Walk over the buffer reading and writing - // random data, XORing it as we go. We can detect writes in the - // wrong place, writes which are too long or too short, and reads - // or writes of the wrong data, - void step(Random r) { - data.order((r.nextInt() & 1) != 0 ? BIG_ENDIAN : LITTLE_ENDIAN); - - data.rewind(); - while (data.position() < data.capacity()) - data.putLong(data.getLong() ^ random.nextLong()); - - data.rewind(); - while (data.position() < data.capacity()) - data.putInt(data.getInt() ^ random.nextInt()); - - data.rewind(); - while (data.position() < data.capacity()) - data.putShort((short)(data.getShort() ^ random.nextInt())); - - data.rewind(); - while (data.position() < data.capacity()) - data.putChar((char)(data.getChar() ^ random.nextInt())); - - data.rewind(); - while (data.position() < data.capacity()) { - data.putDouble(combine(data.getDouble(), random.nextLong())); - } - - data.rewind(); - while (data.position() < data.capacity()) - data.putFloat(combine(data.getFloat(), random.nextInt())); - - for (int i = 0; i < 100; i++) { - int offset = randomOffset(r, data, 8); - data.putLong(offset, data.getLong(offset) ^ random.nextLong()); - } - for (int i = 0; i < 100; i++) { - int offset = randomOffset(r, data, 4); - data.putInt(offset, data.getInt(offset) ^ random.nextInt()); - } - for (int i = 0; i < 100; i++) { - int offset = randomOffset(r, data, 2); - data.putShort(offset, (short)(data.getShort(offset) ^ random.nextInt())); - } - for (int i = 0; i < 100; i++) { - int offset = randomOffset(r, data, 2); - data.putChar(offset, (char)(data.getChar(offset) ^ random.nextInt())); - } - for (int i = 0; i < 100; i++) { - int offset = randomOffset(r, data, 8); - data.putDouble(offset, combine(data.getDouble(offset), random.nextLong())); - } - for (int i = 0; i < 100; i++) { - int offset = randomOffset(r, data, 4); - data.putFloat(offset, combine(data.getFloat(offset), random.nextInt())); - } - } - - // XOR the bit pattern of a double and a long, returning the - // result as a double. - // - // We convert signalling NaNs to quiet NaNs. We need to do this - // because some platforms (in particular legacy 80x87) do not - // provide transparent conversions between integer and - // floating-point types even when using raw conversions but - // quietly convert sNaN to qNaN. This causes spurious test - // failures when the template interpreter uses 80x87 and the JITs - // use XMM registers. - // - public double combine(double prev, long bits) { - bits ^= Double.doubleToRawLongBits(prev); - double result = Double.longBitsToDouble(bits); - if (Double.isNaN(result)) { - result = Double.longBitsToDouble(bits | 0x8000000000000l); - } - return result; - } - - // XOR the bit pattern of a float and an int, returning the result - // as a float. Convert sNaNs to qNaNs. - public Float combine(float prev, int bits) { - bits ^= Float.floatToRawIntBits(prev); - Float result = Float.intBitsToFloat(bits); - if (Float.isNaN(result)) { - result = Float.intBitsToFloat(bits | 0x400000); - } - return result; - } - - enum PrimitiveType { - BYTE(1), CHAR(2), SHORT(2), INT(4), LONG(8), FLOAT(4), DOUBLE(8); - - public final int size; - PrimitiveType(int size) { - this.size = size; - } - } - - void getOne(ByteBuffer b, PrimitiveType t) { - switch (t) { - case BYTE: b.get(); break; - case CHAR: b.getChar(); break; - case SHORT: b.getShort(); break; - case INT: b.getInt(); break; - case LONG: b.getLong(); break; - case FLOAT: b.getFloat(); break; - case DOUBLE: b.getDouble(); break; - } - } - - void putOne(ByteBuffer b, PrimitiveType t) { - switch (t) { - case BYTE: b.put((byte)0); break; - case CHAR: b.putChar('0'); break; - case SHORT: b.putShort((short)0); break; - case INT: b.putInt(0); break; - case LONG: b.putLong(0); break; - case FLOAT: b.putFloat(0); break; - case DOUBLE: b.putDouble(0); break; - } - } - - void getOne(ByteBuffer b, PrimitiveType t, int index) { - switch (t) { - case BYTE: b.get(index); break; - case CHAR: b.getChar(index); break; - case SHORT: b.getShort(index); break; - case INT: b.getInt(index); break; - case LONG: b.getLong(index); break; - case FLOAT: b.getFloat(index); break; - case DOUBLE: b.getDouble(index); break; - } - } - - void putOne(ByteBuffer b, PrimitiveType t, int index) { - switch (t) { - case BYTE: b.put(index, (byte)0); break; - case CHAR: b.putChar(index, '0'); break; - case SHORT: b.putShort(index, (short)0); break; - case INT: b.putInt(index, 0); break; - case LONG: b.putLong(index, 0); break; - case FLOAT: b.putFloat(index, 0); break; - case DOUBLE: b.putDouble(index, 0); break; - } - } - - void checkBoundaryConditions() { - for (int i = 0; i < 100; i++) { - int bufSize = random.nextInt(16); - byte[] bytes = new byte[bufSize]; - ByteBuffer buf = ByteBuffer.wrap(bytes); - for (int j = 0; j < 100; j++) { - int offset = random.nextInt(32) - 8; - for (PrimitiveType t : PrimitiveType.values()) { - int threw = 0; - try { - try { - buf.position(offset); - getOne(buf, t); - } catch (BufferUnderflowException e) { - if (offset + t.size < bufSize) - throw new RuntimeException - ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); - threw++; - } catch (IllegalArgumentException e) { - if (offset >= 0 && offset + t.size < bufSize) - throw new RuntimeException - ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); - threw++; - } - - try { - buf.position(offset); - putOne(buf, t); - } catch (BufferOverflowException e) { - if (offset + t.size < bufSize) - throw new RuntimeException - ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); - threw++; - } catch (IllegalArgumentException e) { - if (offset >= 0 && offset + t.size < bufSize) - throw new RuntimeException - ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); - threw++; - } - - try { - putOne(buf, t, offset); - } catch (IndexOutOfBoundsException e) { - if (offset >= 0 && offset + t.size < bufSize) - throw new RuntimeException - ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); - threw++; - } - - try { - getOne(buf, t, offset); - } catch (IndexOutOfBoundsException e) { - if (offset >= 0 && offset + t.size < bufSize) - throw new RuntimeException - ("type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, e); - threw++; - } - - if (threw == 0) { - // Make sure that we should not have thrown. - if (offset < 0 || offset + t.size > bufSize) { - throw new RuntimeException - ("should have thrown but did not, type = " + t - + ", offset = " + offset + ", bufSize = " + bufSize); - } - } else if (threw != 4) { - // If one of the {get,put} operations threw - // due to an invalid offset then all four of - // them should have thrown. - throw new RuntimeException - ("should have thrown but at least one did not, type = " + t - + ", offset = " + offset + ", bufSize = " + bufSize); - } - } catch (Throwable th) { - throw new RuntimeException - ("unexpected throw: type = " + t + ", offset = " + offset + ", bufSize = " + bufSize, th); - - } - } - } - } - } - - public void run() { - checkBoundaryConditions(); - - for (int i = 0; i < data.capacity(); i += 8) { - data.putLong(i, random.nextLong()); - } - - for (int i = 0; i < iterations; i++) { - step(random); - } - - if (!Arrays.equals(data.array(), data.backingArray())) { - throw new RuntimeException(); - } + public HeapByteBufferTest(long iterations, boolean direct) { + super(iterations, direct); } public static void main(String[] args) { @@ -510,6 +45,6 @@ public class HeapByteBufferTest implements Runnable { if (args.length > 0) iterations = Long.parseLong(args[0]); - new HeapByteBufferTest(iterations).run(); + new HeapByteBufferTest(iterations, false).run(); } -} +} \ No newline at end of file From 12445728415bd87e1358b504041a5c1d9899efc5 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Fri, 15 Jul 2016 13:33:44 +0200 Subject: [PATCH 062/108] 8160897: Concurrent mark mark stack memory allocation leaks memory Fix and clean up concurrent mark mark stack memory allocation. Reviewed-by: jmasa, sangheki --- .../src/share/vm/gc/g1/g1ConcurrentMark.cpp | 181 +++++++++--------- .../src/share/vm/gc/g1/g1ConcurrentMark.hpp | 91 ++++----- .../vm/gc/g1/g1ConcurrentMark.inline.hpp | 5 +- hotspot/src/share/vm/memory/virtualspace.cpp | 2 +- 4 files changed, 141 insertions(+), 138 deletions(-) diff --git a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp index e61175a4205..29909fa40c4 100644 --- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp +++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp @@ -132,109 +132,114 @@ void G1CMBitMap::clear_range(MemRegion mr) { heapWordToOffset(mr.end()), false); } -G1CMMarkStack::G1CMMarkStack(G1ConcurrentMark* cm) : - _base(NULL), _cm(cm) -{} +G1CMMarkStack::G1CMMarkStack() : + _reserved_space(), + _base(NULL), + _capacity(0), + _saved_index((size_t)AllBits), + _should_expand(false) { + set_empty(); +} -bool G1CMMarkStack::allocate(size_t capacity) { - // allocate a stack of the requisite depth - ReservedSpace rs(ReservedSpace::allocation_align_size_up(capacity * sizeof(oop))); +bool G1CMMarkStack::resize(size_t new_capacity) { + assert(is_empty(), "Only resize when stack is empty."); + assert(new_capacity <= MarkStackSizeMax, + "Trying to resize stack to " SIZE_FORMAT " elements when the maximum is " SIZE_FORMAT, new_capacity, MarkStackSizeMax); + + size_t reservation_size = ReservedSpace::allocation_align_size_up(new_capacity * sizeof(oop)); + + ReservedSpace rs(reservation_size); if (!rs.is_reserved()) { - log_warning(gc)("ConcurrentMark MarkStack allocation failure"); + log_warning(gc)("Failed to reserve memory for new overflow mark stack with " SIZE_FORMAT " elements and size " SIZE_FORMAT "B.", new_capacity, reservation_size); return false; } - MemTracker::record_virtual_memory_type((address)rs.base(), mtGC); - if (!_virtual_space.initialize(rs, rs.size())) { - log_warning(gc)("ConcurrentMark MarkStack backing store failure"); - // Release the virtual memory reserved for the marking stack + + VirtualSpace vs; + + if (!vs.initialize(rs, rs.size())) { rs.release(); + log_warning(gc)("Failed to commit memory for new overflow mark stack of size " SIZE_FORMAT "B.", rs.size()); return false; } - assert(_virtual_space.committed_size() == rs.size(), - "Didn't reserve backing store for all of G1ConcurrentMark stack?"); - _base = (oop*) _virtual_space.low(); - setEmpty(); - _capacity = (jint) capacity; - _saved_index = -1; + + assert(vs.committed_size() == rs.size(), "Failed to commit all of the mark stack."); + + // Release old mapping. + _reserved_space.release(); + + // Save new mapping for future unmapping. + _reserved_space = rs; + + MemTracker::record_virtual_memory_type((address)_reserved_space.base(), mtGC); + + _base = (oop*) vs.low(); + _capacity = new_capacity; + set_empty(); _should_expand = false; + return true; } -void G1CMMarkStack::expand() { - // Called, during remark, if we've overflown the marking stack during marking. - assert(isEmpty(), "stack should been emptied while handling overflow"); - assert(_capacity <= (jint) MarkStackSizeMax, "stack bigger than permitted"); - // Clear expansion flag - _should_expand = false; - if (_capacity == (jint) MarkStackSizeMax) { - log_trace(gc)("(benign) Can't expand marking stack capacity, at max size limit"); - return; - } - // Double capacity if possible - jint new_capacity = MIN2(_capacity*2, (jint) MarkStackSizeMax); - // Do not give up existing stack until we have managed to - // get the double capacity that we desired. - ReservedSpace rs(ReservedSpace::allocation_align_size_up(new_capacity * - sizeof(oop))); - if (rs.is_reserved()) { - // Release the backing store associated with old stack - _virtual_space.release(); - // Reinitialize virtual space for new stack - if (!_virtual_space.initialize(rs, rs.size())) { - fatal("Not enough swap for expanded marking stack capacity"); - } - _base = (oop*)(_virtual_space.low()); - _index = 0; - _capacity = new_capacity; - } else { - // Failed to double capacity, continue; - log_trace(gc)("(benign) Failed to expand marking stack capacity from " SIZE_FORMAT "K to " SIZE_FORMAT "K", - _capacity / K, new_capacity / K); - } +bool G1CMMarkStack::allocate(size_t capacity) { + return resize(capacity); } -void G1CMMarkStack::set_should_expand() { - // If we're resetting the marking state because of an - // marking stack overflow, record that we should, if - // possible, expand the stack. - _should_expand = _cm->has_overflown(); +void G1CMMarkStack::expand() { + // Clear expansion flag + _should_expand = false; + + if (_capacity == MarkStackSizeMax) { + log_debug(gc)("Can not expand overflow mark stack further, already at maximum capacity of " SIZE_FORMAT " elements.", _capacity); + return; + } + size_t old_capacity = _capacity; + // Double capacity if possible + size_t new_capacity = MIN2(old_capacity * 2, MarkStackSizeMax); + + if (resize(new_capacity)) { + log_debug(gc)("Expanded marking stack capacity from " SIZE_FORMAT " to " SIZE_FORMAT " elements", + old_capacity, new_capacity); + } else { + log_warning(gc)("Failed to expand marking stack capacity from " SIZE_FORMAT " to " SIZE_FORMAT " elements", + old_capacity, new_capacity); + } } G1CMMarkStack::~G1CMMarkStack() { if (_base != NULL) { _base = NULL; - _virtual_space.release(); + _reserved_space.release(); } } -void G1CMMarkStack::par_push_arr(oop* ptr_arr, int n) { +void G1CMMarkStack::par_push_arr(oop* buffer, size_t n) { MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); - jint start = _index; - jint next_index = start + n; + size_t start = _index; + size_t next_index = start + n; if (next_index > _capacity) { _overflow = true; return; } // Otherwise. _index = next_index; - for (int i = 0; i < n; i++) { - int ind = start + i; + for (size_t i = 0; i < n; i++) { + size_t ind = start + i; assert(ind < _capacity, "By overflow test above."); - _base[ind] = ptr_arr[i]; + _base[ind] = buffer[i]; } } -bool G1CMMarkStack::par_pop_arr(oop* ptr_arr, int max, int* n) { +bool G1CMMarkStack::par_pop_arr(oop* buffer, size_t max, size_t* n) { MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); - jint index = _index; + size_t index = _index; if (index == 0) { *n = 0; return false; } else { - int k = MIN2(max, index); - jint new_ind = index - k; - for (int j = 0; j < k; j++) { - ptr_arr[j] = _base[new_ind + j]; + size_t k = MIN2(max, index); + size_t new_ind = index - k; + for (size_t j = 0; j < k; j++) { + buffer[j] = _base[new_ind + j]; } _index = new_ind; *n = k; @@ -243,20 +248,14 @@ bool G1CMMarkStack::par_pop_arr(oop* ptr_arr, int max, int* n) { } void G1CMMarkStack::note_start_of_gc() { - assert(_saved_index == -1, - "note_start_of_gc()/end_of_gc() bracketed incorrectly"); + assert(_saved_index == (size_t)AllBits, "note_start_of_gc()/end_of_gc() calls bracketed incorrectly"); _saved_index = _index; } void G1CMMarkStack::note_end_of_gc() { - // This is intentionally a guarantee, instead of an assert. If we - // accidentally add something to the mark stack during GC, it - // will be a correctness issue so it's better if we crash. we'll - // only check this once per GC anyway, so it won't be a performance - // issue in any way. - guarantee(_saved_index == _index, - "saved index: %d index: %d", _saved_index, _index); - _saved_index = -1; + guarantee(!stack_modified(), "Saved index " SIZE_FORMAT " must be the same as " SIZE_FORMAT, _saved_index, _index); + + _saved_index = (size_t)AllBits; } G1CMRootRegions::G1CMRootRegions() : @@ -351,7 +350,7 @@ G1ConcurrentMark::G1ConcurrentMark(G1CollectedHeap* g1h, G1RegionToSpaceMapper* _prevMarkBitMap(&_markBitMap1), _nextMarkBitMap(&_markBitMap2), - _markStack(this), + _global_mark_stack(), // _finger set in set_non_marking_state _max_worker_id(ParallelGCThreads), @@ -485,8 +484,8 @@ G1ConcurrentMark::G1ConcurrentMark(G1CollectedHeap* g1h, G1RegionToSpaceMapper* } } - if (!_markStack.allocate(MarkStackSize)) { - log_warning(gc)("Failed to allocate CM marking stack"); + if (!_global_mark_stack.allocate(MarkStackSize)) { + vm_exit_during_initialization("Failed to allocate initial concurrent mark overflow mark stack."); return; } @@ -541,8 +540,8 @@ void G1ConcurrentMark::reset() { void G1ConcurrentMark::reset_marking_state(bool clear_overflow) { - _markStack.set_should_expand(); - _markStack.setEmpty(); // Also clears the _markStack overflow flag + _global_mark_stack.set_should_expand(has_overflown()); + _global_mark_stack.set_empty(); // Also clears the overflow stack's overflow flag if (clear_overflow) { clear_has_overflown(); } else { @@ -1076,7 +1075,7 @@ void G1ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) { weakRefsWork(clear_all_soft_refs); if (has_overflown()) { - // Oops. We overflowed. Restart concurrent marking. + // We overflowed. Restart concurrent marking. _restart_for_overflow = true; // Verify the heap w.r.t. the previous marking bitmap. @@ -1109,8 +1108,8 @@ void G1ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) { } // Expand the marking stack, if we have to and if we can. - if (_markStack.should_expand()) { - _markStack.expand(); + if (_global_mark_stack.should_expand()) { + _global_mark_stack.expand(); } // Statistics @@ -1637,7 +1636,7 @@ void G1ConcurrentMark::weakRefsWork(bool clear_all_soft_refs) { // Set the soft reference policy rp->setup_policy(clear_all_soft_refs); - assert(_markStack.isEmpty(), "mark stack should be empty"); + assert(_global_mark_stack.is_empty(), "mark stack should be empty"); // Instances of the 'Keep Alive' and 'Complete GC' closures used // in serial reference processing. Note these closures are also @@ -1692,10 +1691,10 @@ void G1ConcurrentMark::weakRefsWork(bool clear_all_soft_refs) { // oop closures will set the has_overflown flag if we overflow the // global marking stack. - assert(_markStack.overflow() || _markStack.isEmpty(), + assert(_global_mark_stack.overflow() || _global_mark_stack.is_empty(), "mark stack should be empty (unless it overflowed)"); - if (_markStack.overflow()) { + if (_global_mark_stack.overflow()) { // This should have been done already when we tried to push an // entry on to the global mark stack. But let's do it again. set_has_overflown(); @@ -1714,7 +1713,7 @@ void G1ConcurrentMark::weakRefsWork(bool clear_all_soft_refs) { return; } - assert(_markStack.isEmpty(), "Marking should have completed"); + assert(_global_mark_stack.is_empty(), "Marking should have completed"); // Unload Klasses, String, Symbols, Code Cache, etc. if (ClassUnloadingWithConcurrentMark) { @@ -1967,7 +1966,7 @@ void G1ConcurrentMark::verify_no_cset_oops() { } // Verify entries on the global mark stack - _markStack.iterate(VerifyNoCSetOops("Stack")); + _global_mark_stack.iterate(VerifyNoCSetOops("Stack")); // Verify entries on the task queues for (uint i = 0; i < _max_worker_id; ++i) { @@ -2366,13 +2365,13 @@ void G1CMTask::get_entries_from_global_stack() { // local array where we'll store the entries that will be popped // from the global stack. oop buffer[global_stack_transfer_size]; - int n; + size_t n; _cm->mark_stack_pop(buffer, global_stack_transfer_size, &n); assert(n <= global_stack_transfer_size, "we should not pop more than the given limit"); if (n > 0) { // yes, we did actually pop at least one entry - for (int i = 0; i < n; ++i) { + for (size_t i = 0; i < n; ++i) { bool success = _task_queue->push(buffer[i]); // We only call this when the local queue is empty or under a // given target limit. So, we do not expect this push to fail. diff --git a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp index 03e33461b44..0331976a4a6 100644 --- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp +++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp @@ -145,53 +145,56 @@ class G1CMBitMap : public G1CMBitMapRO { void clear_range(MemRegion mr); }; -// Represents a marking stack used by ConcurrentMarking in the G1 collector. +// Represents the overflow mark stack used by concurrent marking. +// +// Stores oops in a huge buffer in virtual memory that is always fully committed. +// Resizing may only happen during a STW pause when the stack is empty. class G1CMMarkStack VALUE_OBJ_CLASS_SPEC { - VirtualSpace _virtual_space; // Underlying backing store for actual stack - G1ConcurrentMark* _cm; - oop* _base; // bottom of stack - jint _index; // one more than last occupied index - jint _capacity; // max #elements - jint _saved_index; // value of _index saved at start of GC + ReservedSpace _reserved_space; // Space currently reserved for the mark stack. + + oop* _base; // Bottom address of allocated memory area. + size_t _capacity; // Maximum number of elements. + size_t _index; // One more than last occupied index. + + size_t _saved_index; // Value of _index saved at start of GC to detect mark stack modifications during that time. bool _overflow; bool _should_expand; + // Resizes the mark stack to the given new capacity. Releases any previous + // memory if successful. + bool resize(size_t new_capacity); + + bool stack_modified() const { return _index != _saved_index; } public: - G1CMMarkStack(G1ConcurrentMark* cm); + G1CMMarkStack(); ~G1CMMarkStack(); bool allocate(size_t capacity); - // Pushes the first "n" elements of "ptr_arr" on the stack. - // Locking impl: concurrency is allowed only with - // "par_push_arr" and/or "par_pop_arr" operations, which use the same - // locking strategy. - void par_push_arr(oop* ptr_arr, int n); + // Pushes the first "n" elements of the given buffer on the stack. + void par_push_arr(oop* buffer, size_t n); - // If returns false, the array was empty. Otherwise, removes up to "max" - // elements from the stack, and transfers them to "ptr_arr" in an - // unspecified order. The actual number transferred is given in "n" ("n - // == 0" is deliberately redundant with the return value.) Locking impl: - // concurrency is allowed only with "par_push_arr" and/or "par_pop_arr" - // operations, which use the same locking strategy. - bool par_pop_arr(oop* ptr_arr, int max, int* n); + // Moves up to max elements from the stack into the given buffer. Returns + // the number of elements pushed, and false if the array has been empty. + // Returns true if the buffer contains at least one element. + bool par_pop_arr(oop* buffer, size_t max, size_t* n); - bool isEmpty() { return _index == 0; } - int maxElems() { return _capacity; } + bool is_empty() const { return _index == 0; } + size_t capacity() const { return _capacity; } - bool overflow() { return _overflow; } + bool overflow() const { return _overflow; } void clear_overflow() { _overflow = false; } bool should_expand() const { return _should_expand; } - void set_should_expand(); + void set_should_expand(bool value) { _should_expand = value; } // Expand the stack, typically in response to an overflow condition void expand(); - int size() { return _index; } + size_t size() const { return _index; } - void setEmpty() { _index = 0; clear_overflow(); } + void set_empty() { _index = 0; clear_overflow(); } // Record the current index. void note_start_of_gc(); @@ -308,7 +311,7 @@ protected: G1CMRootRegions _root_regions; // For gray objects - G1CMMarkStack _markStack; // Grey objects behind global finger + G1CMMarkStack _global_mark_stack; // Grey objects behind global finger HeapWord* volatile _finger; // The global finger, region aligned, // always points to the end of the // last claimed region @@ -478,21 +481,21 @@ public: // The push and pop operations are used by tasks for transfers // between task-local queues and the global mark stack, and use // locking for concurrency safety. - bool mark_stack_push(oop* arr, int n) { - _markStack.par_push_arr(arr, n); - if (_markStack.overflow()) { + bool mark_stack_push(oop* arr, size_t n) { + _global_mark_stack.par_push_arr(arr, n); + if (_global_mark_stack.overflow()) { set_has_overflown(); return false; } return true; } - void mark_stack_pop(oop* arr, int max, int* n) { - _markStack.par_pop_arr(arr, max, n); + void mark_stack_pop(oop* arr, size_t max, size_t* n) { + _global_mark_stack.par_pop_arr(arr, max, n); } - size_t mark_stack_size() { return _markStack.size(); } - size_t partial_mark_stack_size_target() { return _markStack.maxElems()/3; } - bool mark_stack_overflow() { return _markStack.overflow(); } - bool mark_stack_empty() { return _markStack.isEmpty(); } + size_t mark_stack_size() { return _global_mark_stack.size(); } + size_t partial_mark_stack_size_target() { return _global_mark_stack.capacity()/3; } + bool mark_stack_overflow() { return _global_mark_stack.overflow(); } + bool mark_stack_empty() { return _global_mark_stack.is_empty(); } G1CMRootRegions* root_regions() { return &_root_regions; } @@ -598,12 +601,12 @@ public: // Notify data structures that a GC has started. void note_start_of_gc() { - _markStack.note_start_of_gc(); + _global_mark_stack.note_start_of_gc(); } // Notify data structures that a GC is finished. void note_end_of_gc() { - _markStack.note_end_of_gc(); + _global_mark_stack.note_end_of_gc(); } // Verify that there are no CSet oops on the stacks (taskqueues / @@ -660,17 +663,17 @@ private: class G1CMTask : public TerminatorTerminator { private: enum PrivateConstants { - // the regular clock call is called once the scanned words reaches + // The regular clock call is called once the scanned words reaches // this limit words_scanned_period = 12*1024, - // the regular clock call is called once the number of visited + // The regular clock call is called once the number of visited // references reaches this limit refs_reached_period = 384, - // initial value for the hash seed, used in the work stealing code + // Initial value for the hash seed, used in the work stealing code init_hash_seed = 17, - // how many entries will be transferred between global stack and - // local queues - global_stack_transfer_size = 16 + // How many entries will be transferred between global stack and + // local queues at once. + global_stack_transfer_size = 1024 }; uint _worker_id; diff --git a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.inline.hpp b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.inline.hpp index b0401d35935..40336ae6885 100644 --- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.inline.hpp +++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.inline.hpp @@ -91,8 +91,9 @@ inline bool G1CMBitMap::parMark(HeapWord* addr) { template inline void G1CMMarkStack::iterate(Fn fn) { - assert(_saved_index == _index, "saved index: %d index: %d", _saved_index, _index); - for (int i = 0; i < _index; ++i) { + assert_at_safepoint(true); + assert(!stack_modified(), "Saved index " SIZE_FORMAT " must be the same as " SIZE_FORMAT, _saved_index, _index); + for (size_t i = 0; i < _index; ++i) { fn(_base[i]); } } diff --git a/hotspot/src/share/vm/memory/virtualspace.cpp b/hotspot/src/share/vm/memory/virtualspace.cpp index 3cb6d21c7e8..63c1b926255 100644 --- a/hotspot/src/share/vm/memory/virtualspace.cpp +++ b/hotspot/src/share/vm/memory/virtualspace.cpp @@ -676,7 +676,7 @@ VirtualSpace::~VirtualSpace() { void VirtualSpace::release() { - // This does not release memory it never reserved. + // This does not release memory it reserved. // Caller must release via rs.release(); _low_boundary = NULL; _high_boundary = NULL; From 1075d11550250e13347338758127f538a6c359f2 Mon Sep 17 00:00:00 2001 From: Alan Burlison Date: Fri, 15 Jul 2016 09:36:28 -0700 Subject: [PATCH 063/108] 8160997: Solaris: deprecated and interfaces should be replaced Use final POSIX 1003.1c versions of getgrgid_r(), getgrnam_r(), getpwnam_r(), and getpwuid_r(). Reviewed-by: alanb, dcubed, simonis, dholmes --- hotspot/src/os/solaris/vm/os_solaris.cpp | 1 - .../src/os/solaris/vm/perfMemory_solaris.cpp | 24 +++++++++---------- .../solaris_sparc/vm/os_solaris_sparc.cpp | 1 - .../os_cpu/solaris_x86/vm/os_solaris_x86.cpp | 1 - 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index 67ca5eeb5f3..11d20a3dc2c 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -79,7 +79,6 @@ # include # include # include -# include # include # include # include diff --git a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp index a5bfbb7f555..dcf88d6c862 100644 --- a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp +++ b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp @@ -34,16 +34,18 @@ #include "utilities/exceptions.hpp" // put OS-includes here -# include -# include -# include -# include -# include -# include -# include -# include -# include +#include +#include +#include +#include +#include +#include +#include +#include +/* For POSIX-compliant getpwuid_r on Solaris */ +#define _POSIX_PTHREAD_SEMANTICS +#include static char* backing_store_file_name = NULL; // name of the backing store // file, if successfully created. @@ -453,12 +455,8 @@ static char* get_user_name(uid_t uid) { char* pwbuf = NEW_C_HEAP_ARRAY(char, bufsize, mtInternal); -#ifdef _GNU_SOURCE struct passwd* p = NULL; int result = getpwuid_r(uid, &pwent, pwbuf, (size_t)bufsize, &p); -#else // _GNU_SOURCE - struct passwd* p = getpwuid_r(uid, &pwent, pwbuf, (int)bufsize); -#endif // _GNU_SOURCE if (p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') { if (PrintMiscellaneous && Verbose) { diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp index 39663ed0e74..77db98f1989 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp +++ b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp @@ -74,7 +74,6 @@ # include # include # include -# include # include # include diff --git a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp index 695fc127835..8e8edf4b842 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp @@ -74,7 +74,6 @@ # include # include # include -# include # include # include # include // see comment in From b571e747c51595f2786b3094a7a7ac9feed5bd2c Mon Sep 17 00:00:00 2001 From: Gerald Thornbrugh Date: Fri, 15 Jul 2016 10:25:16 -0700 Subject: [PATCH 064/108] 8081770: [TESTBUG] regression Test7107135 needs to remove dependence on locally installed gcc Reviewed-by: cjplummer, dcubed --- hotspot/make/test/JtregNative.gmk | 10 ++ hotspot/test/runtime/7107135/Test7107135.sh | 100 ------------------ .../runtime/{7107135 => execstack}/Test.java | 6 +- .../{7107135 => execstack}/TestMT.java | 6 +- .../test/runtime/execstack/Testexecstack.java | 74 +++++++++++++ hotspot/test/runtime/execstack/libtest-rw.c | 45 ++++++++ .../test.c => execstack/libtest-rwx.c} | 10 +- 7 files changed, 143 insertions(+), 108 deletions(-) delete mode 100644 hotspot/test/runtime/7107135/Test7107135.sh rename hotspot/test/runtime/{7107135 => execstack}/Test.java (91%) rename hotspot/test/runtime/{7107135 => execstack}/TestMT.java (93%) create mode 100644 hotspot/test/runtime/execstack/Testexecstack.java create mode 100644 hotspot/test/runtime/execstack/libtest-rw.c rename hotspot/test/runtime/{7107135/test.c => execstack/libtest-rwx.c} (77%) diff --git a/hotspot/make/test/JtregNative.gmk b/hotspot/make/test/JtregNative.gmk index e89506b1c53..8136dbf92ac 100644 --- a/hotspot/make/test/JtregNative.gmk +++ b/hotspot/make/test/JtregNative.gmk @@ -62,12 +62,22 @@ BUILD_HOTSPOT_JTREG_NATIVE_SRC += \ $(HOTSPOT_TOPDIR)/test/runtime/ThreadSignalMask endif +ifeq ($(OPENJDK_TARGET_OS), linux) +BUILD_HOTSPOT_JTREG_NATIVE_SRC += \ + $(HOTSPOT_TOPDIR)/test/runtime/execstack +endif + ifeq ($(TOOLCHAIN_TYPE), solstudio) BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_liboverflow := -lc BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libSimpleClassFileLoadHook := -lc BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libGetNamedModuleTest := -lc endif +ifeq ($(OPENJDK_TARGET_OS), linux) + BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rw := -z noexecstack + BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rwx := -z execstack +endif + BUILD_HOTSPOT_JTREG_OUTPUT_DIR := $(BUILD_OUTPUT)/support/test/hotspot/jtreg/native BUILD_HOTSPOT_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/hotspot/jtreg diff --git a/hotspot/test/runtime/7107135/Test7107135.sh b/hotspot/test/runtime/7107135/Test7107135.sh deleted file mode 100644 index 5371b3a2d95..00000000000 --- a/hotspot/test/runtime/7107135/Test7107135.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/sh - -# -# Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2011 SAP SE. 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 Test7107135.sh -## @bug 7107135 -## @bug 8021296 -## @bug 8025519 -## @summary Stack guard pages lost after loading library with executable stack. -## @run shell Test7107135.sh -## - -if [ "${TESTSRC}" = "" ] -then - TESTSRC=${PWD} - echo "TESTSRC not set. Using "${TESTSRC}" as default" -fi -echo "TESTSRC=${TESTSRC}" -## Adding common setup Variables for running shell tests. -. ${TESTSRC}/../../test_env.sh - -# set platform-dependent variables -OS=`uname -s` -case "$OS" in - Linux) - echo "Testing on Linux" - gcc_cmd=`which gcc` - if [ "x$gcc_cmd" == "x" ]; then - echo "WARNING: gcc not found. Cannot execute test." 2>&1 - exit 0; - fi - ;; - *) - echo "Test passed; only valid for Linux" - exit 0; - ;; -esac - -ARCH=`uname -m` - -THIS_DIR=. - -cp ${TESTSRC}${FS}*.java ${THIS_DIR} -${COMPILEJAVA}${FS}bin${FS}javac *.java - -$gcc_cmd -fPIC -shared -c -o test.o \ - -I${COMPILEJAVA}${FS}include -I${COMPILEJAVA}${FS}include${FS}linux \ - ${TESTSRC}${FS}test.c - -ld -shared -z execstack -o libtest-rwx.so test.o -ld -shared -z noexecstack -o libtest-rw.so test.o - - -LD_LIBRARY_PATH=${THIS_DIR} -echo LD_LIBRARY_PATH = ${LD_LIBRARY_PATH} -export LD_LIBRARY_PATH - -# This should not fail. -echo Check testprogram. Expected to pass: -echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rw -${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rw - -echo -echo Test changing of stack protection: -echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rwx -${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rwx -JAVA_RETVAL=$? - -if [ "$JAVA_RETVAL" == "0" ] -then - echo - echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} TestMT test-rwx - ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} TestMT test-rwx - JAVA_RETVAL=$? -fi - -exit $JAVA_RETVAL diff --git a/hotspot/test/runtime/7107135/Test.java b/hotspot/test/runtime/execstack/Test.java similarity index 91% rename from hotspot/test/runtime/7107135/Test.java rename to hotspot/test/runtime/execstack/Test.java index 9b489347bd4..4fd931ee504 100644 --- a/hotspot/test/runtime/7107135/Test.java +++ b/hotspot/test/runtime/execstack/Test.java @@ -1,6 +1,6 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011 SAP SE. All rights reserved. + * Copyright (c) 2002-2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 SAP AG. 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 @@ -42,7 +42,7 @@ class Test { static int Runner() { counter = counter * -1; int i = counter; - if(counter < 2) counter += Runner(); + if (counter < 2) counter += Runner(); return i; } diff --git a/hotspot/test/runtime/7107135/TestMT.java b/hotspot/test/runtime/execstack/TestMT.java similarity index 93% rename from hotspot/test/runtime/7107135/TestMT.java rename to hotspot/test/runtime/execstack/TestMT.java index 4fc297dcd03..c02edd502db 100644 --- a/hotspot/test/runtime/7107135/TestMT.java +++ b/hotspot/test/runtime/execstack/TestMT.java @@ -1,6 +1,6 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011 SAP SE. All rights reserved. + * Copyright (c) 2002-2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 SAP AG. 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 @@ -37,7 +37,7 @@ class TestMT { return false; } - public static int counter = 1; + public static int counter = 1; static int Runner() { counter = counter * -1; int i = counter; diff --git a/hotspot/test/runtime/execstack/Testexecstack.java b/hotspot/test/runtime/execstack/Testexecstack.java new file mode 100644 index 00000000000..eb0b89f0117 --- /dev/null +++ b/hotspot/test/runtime/execstack/Testexecstack.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2016, 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 Testexecstack.java + * @bug 7107135 + * @bug 8021296 + * @bug 8025519 + * @summary Stack guard pages lost after loading library with executable stack. + * @requires (os.family == "linux") + * @library /testlibrary + * @build jdk.test.lib.* + * @compile Test.java + * @compile TestMT.java + * @run driver Testexecstack + */ + +import jdk.test.lib.*; + +public class Testexecstack { + + public static void main(String[] args) throws Throwable { + + // Get the library path property + String libpath = System.getProperty("java.library.path"); + + // Create a new java process for the Test Java/JNI test without + // an executeable stack + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-Djava.library.path=" + libpath + ":.", "Test", "test-rw"); + + // Start the process and check the output + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + + // Create a new java process for the Test Java/JNI test with an + // executable stack + pb = ProcessTools.createJavaProcessBuilder( + "-Djava.library.path=" + libpath + ":.", "Test", "test-rwx"); + + // Start the process and check the output + output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + + // Create a new java process for the TestMT Java/JNI test with an + // executable stack + pb = ProcessTools.createJavaProcessBuilder( + "-Djava.library.path=" + libpath + ":.", "TestMT", "test-rwx"); + + // Start the process and check the output + output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + } +} diff --git a/hotspot/test/runtime/execstack/libtest-rw.c b/hotspot/test/runtime/execstack/libtest-rw.c new file mode 100644 index 00000000000..93b11a17542 --- /dev/null +++ b/hotspot/test/runtime/execstack/libtest-rw.c @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2002-2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 SAP AG. 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. + */ + +/* + * This source file is the same as libtest-rwx.c and needs to be a separate + * file so it can be built with "-z noexecstack" by the build process. + * If any changes are made they probably also need to be made to libtest-rwx.c. + */ + +#include +#include +#include +#include "jni.h" +#ifdef __cplusplus +extern "C" { +#endif + +JNIEXPORT jint JNICALL Java_Test_someMethod(JNIEnv *env, jobject mainObject) { + return 3; +} + +#ifdef __cplusplus +} +#endif diff --git a/hotspot/test/runtime/7107135/test.c b/hotspot/test/runtime/execstack/libtest-rwx.c similarity index 77% rename from hotspot/test/runtime/7107135/test.c rename to hotspot/test/runtime/execstack/libtest-rwx.c index 3e39eaeb7f2..62b5ac9055e 100644 --- a/hotspot/test/runtime/7107135/test.c +++ b/hotspot/test/runtime/execstack/libtest-rwx.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011 SAP SE. All rights reserved. + * Copyright (c) 2002-2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 SAP AG. 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 @@ -22,6 +22,12 @@ * questions. */ +/* + * This source file is the same as libtest-rw.c and needs to be a separate + * file so it can be built with "-z execstack" by the build process. + * If any changes are made they probably also need to be made to libtest-rwx.c. + */ + #include #include #include From 2b23013b97ae98f663ddb82f278e56c826153f47 Mon Sep 17 00:00:00 2001 From: Gerald Thornbrugh Date: Fri, 15 Jul 2016 10:31:50 -0700 Subject: [PATCH 065/108] 8144279: [TESTBUG] hotspot/runtime/jsig/Test8017498.sh should use native library build support Reviewed-by: ccheung, cjplummer, dcubed --- hotspot/make/test/JtregNative.gmk | 3 +- hotspot/test/runtime/jsig/Test8017498.sh | 100 ------------------ .../runtime/jsig/{TestJNI.c => libTestJNI.c} | 0 3 files changed, 2 insertions(+), 101 deletions(-) delete mode 100644 hotspot/test/runtime/jsig/Test8017498.sh rename hotspot/test/runtime/jsig/{TestJNI.c => libTestJNI.c} (100%) diff --git a/hotspot/make/test/JtregNative.gmk b/hotspot/make/test/JtregNative.gmk index 8136dbf92ac..2eea65366ce 100644 --- a/hotspot/make/test/JtregNative.gmk +++ b/hotspot/make/test/JtregNative.gmk @@ -64,7 +64,8 @@ endif ifeq ($(OPENJDK_TARGET_OS), linux) BUILD_HOTSPOT_JTREG_NATIVE_SRC += \ - $(HOTSPOT_TOPDIR)/test/runtime/execstack + $(HOTSPOT_TOPDIR)/test/runtime/execstack \ + $(HOTSPOT_TOPDIR)/test/runtime/jsig endif ifeq ($(TOOLCHAIN_TYPE), solstudio) diff --git a/hotspot/test/runtime/jsig/Test8017498.sh b/hotspot/test/runtime/jsig/Test8017498.sh deleted file mode 100644 index 64b019d5a84..00000000000 --- a/hotspot/test/runtime/jsig/Test8017498.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/sh - -# -# Copyright (c) 2013, 2014, 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 Test8017498.sh -## @bug 8017498 -## @bug 8020791 -## @bug 8021296 -## @bug 8022301 -## @bug 8025519 -## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX -## @run shell/timeout=60 Test8017498.sh -## - -if [ -z "${TESTSRC}" ]; then - TESTSRC="${PWD}" - echo "TESTSRC not set. Using "${TESTSRC}" as default" -fi - -echo "TESTSRC=${TESTSRC}" -## Adding common setup Variables for running shell tests. -. ${TESTSRC}/../../test_env.sh - -EXTRA_CFLAG= - -# set platform-dependent variables -OS=`uname -s` -case "$OS" in - Linux) - echo "Testing on Linux" - gcc_cmd=`which gcc` - if [ -z "$gcc_cmd" ]; then - echo "WARNING: gcc not found. Cannot execute test." 2>&1 - exit 0; - fi - MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}${VM_CPU}${FS}libjsig.so - if [ "$VM_BITS" = "32" ] && [ "$VM_CPU" != "arm" ] && [ "$VM_CPU" != "ppc" ]; then - EXTRA_CFLAG=-m32 - fi - echo MY_LD_PRELOAD = ${MY_LD_PRELOAD} - ;; - *) - echo "Test passed; only valid for Linux" - exit 0; - ;; -esac - -THIS_DIR=. - -cp "${TESTSRC}${FS}"*.java "${THIS_DIR}" -${COMPILEJAVA}${FS}bin${FS}javac *.java - -$gcc_cmd -DLINUX -fPIC -shared \ - ${EXTRA_CFLAG} -z noexecstack \ - -o libTestJNI.so \ - -I${COMPILEJAVA}${FS}include \ - -I${COMPILEJAVA}${FS}include${FS}linux \ - ${TESTSRC}${FS}TestJNI.c - -if [ $? -ne 0 ] ; then - echo "Compile failed, Ignoring failed compilation and forcing the test to pass" - exit 0 -fi - -# run the java test in the background -cmd="LD_PRELOAD=$MY_LD_PRELOAD \ - ${TESTJAVA}${FS}bin${FS}java \ - -Djava.library.path=. -server TestJNI 100" -echo "$cmd > test.out" -eval $cmd > test.out - -if grep "old handler" test.out > ${NULL}; then - echo "Test Passed" - exit 0 -fi - -echo "Test Failed" -exit 1 diff --git a/hotspot/test/runtime/jsig/TestJNI.c b/hotspot/test/runtime/jsig/libTestJNI.c similarity index 100% rename from hotspot/test/runtime/jsig/TestJNI.c rename to hotspot/test/runtime/jsig/libTestJNI.c From 8f39b65deb860ccd351912609bb4aa587ec87a4a Mon Sep 17 00:00:00 2001 From: Gerald Thornbrugh Date: Fri, 15 Jul 2016 10:46:08 -0700 Subject: [PATCH 066/108] 8144278: [TESTBUG] hotspot/runtime/StackGuardPages/testme.sh should use native library build support Reviewed-by: erikj, dsamersoff, dholmes --- hotspot/make/test/JtregNative.gmk | 5 +- .../StackGuardPages/{invoke.c => exeinvoke.c} | 33 +++++++++-- .../test/runtime/StackGuardPages/testme.sh | 57 ++++++++----------- 3 files changed, 56 insertions(+), 39 deletions(-) rename hotspot/test/runtime/StackGuardPages/{invoke.c => exeinvoke.c} (89%) diff --git a/hotspot/make/test/JtregNative.gmk b/hotspot/make/test/JtregNative.gmk index 2eea65366ce..18972ee8a90 100644 --- a/hotspot/make/test/JtregNative.gmk +++ b/hotspot/make/test/JtregNative.gmk @@ -65,7 +65,8 @@ endif ifeq ($(OPENJDK_TARGET_OS), linux) BUILD_HOTSPOT_JTREG_NATIVE_SRC += \ $(HOTSPOT_TOPDIR)/test/runtime/execstack \ - $(HOTSPOT_TOPDIR)/test/runtime/jsig + $(HOTSPOT_TOPDIR)/test/runtime/jsig \ + $(HOTSPOT_TOPDIR)/test/runtime/StackGuardPages endif ifeq ($(TOOLCHAIN_TYPE), solstudio) @@ -77,6 +78,8 @@ endif ifeq ($(OPENJDK_TARGET_OS), linux) BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rw := -z noexecstack BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rwx := -z execstack + BUILD_HOTSPOT_JTREG_EXECUTABLES_LDFLAGS_exeinvoke := -ljvm -lpthread + BUILD_TEST_invoke_exeinvoke.c_OPTIMIZATION := NONE endif BUILD_HOTSPOT_JTREG_OUTPUT_DIR := $(BUILD_OUTPUT)/support/test/hotspot/jtreg/native diff --git a/hotspot/test/runtime/StackGuardPages/invoke.c b/hotspot/test/runtime/StackGuardPages/exeinvoke.c similarity index 89% rename from hotspot/test/runtime/StackGuardPages/invoke.c rename to hotspot/test/runtime/StackGuardPages/exeinvoke.c index 580e128bb22..fa2a06e9869 100644 --- a/hotspot/test/runtime/StackGuardPages/invoke.c +++ b/hotspot/test/runtime/StackGuardPages/exeinvoke.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2016, 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 @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,8 @@ #include +#define CLASS_PATH_OPT "-Djava.class.path=" + JavaVM* _jvm; static jmp_buf context; @@ -120,6 +123,7 @@ void *run_java_overflow (void *p) { fprintf(stderr, "Test ERROR. Can't call detach from current thread\n"); exit(7); } + return NULL; } void do_overflow(){ @@ -209,24 +213,42 @@ void *run_native_overflow(void *p) { void usage() { fprintf(stderr, "Usage: invoke test_java_overflow\n"); fprintf(stderr, " invoke test_native_overflow\n"); - exit(7); } int main (int argc, const char** argv) { JavaVMInitArgs vm_args; - JavaVMOption options[2]; + JavaVMOption options[3]; JNIEnv* env; + int optlen; + char *javaclasspath = NULL; + char javaclasspathopt[4096]; printf("Test started with pid: %ld\n", (long) getpid()); + /* set the java class path so the DoOverflow class can be found */ + javaclasspath = getenv("CLASSPATH"); + + if (javaclasspath == NULL) { + fprintf(stderr, "Test ERROR. CLASSPATH is not set\n"); + exit(7); + } + optlen = strlen(CLASS_PATH_OPT) + strlen(javaclasspath) + 1; + if (optlen > 4096) { + fprintf(stderr, "Test ERROR. CLASSPATH is too long\n"); + exit(7); + } + snprintf(javaclasspathopt, sizeof(javaclasspathopt), "%s%s", + CLASS_PATH_OPT, javaclasspath); + options[0].optionString = "-Xint"; - options[1].optionString = "-Xss512k"; + options[1].optionString = "-Xss328k"; + options[2].optionString = javaclasspathopt; vm_args.version = JNI_VERSION_1_2; vm_args.ignoreUnrecognized = JNI_TRUE; vm_args.options = options; - vm_args.nOptions = 2; + vm_args.nOptions = 3; if (JNI_CreateJavaVM (&_jvm, (void **)&env, &vm_args) < 0 ) { fprintf(stderr, "Test ERROR. Can't create JavaVM\n"); @@ -263,4 +285,5 @@ int main (int argc, const char** argv) { fprintf(stderr, "Test ERROR. Unknown parameter %s\n", ((argc > 1) ? argv[1] : "none")); usage(); + exit(7); } diff --git a/hotspot/test/runtime/StackGuardPages/testme.sh b/hotspot/test/runtime/StackGuardPages/testme.sh index 7f6a24a3d31..22c50010bfd 100644 --- a/hotspot/test/runtime/StackGuardPages/testme.sh +++ b/hotspot/test/runtime/StackGuardPages/testme.sh @@ -1,8 +1,29 @@ +# Copyright (c) 2014, 2016, 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. #!/bin/sh # # @test testme.sh # @summary Stack guard pages should be installed correctly and removed when thread is detached +# @compile DoOverflow.java # @run shell testme.sh # @@ -21,40 +42,10 @@ then exit 0 fi -gcc_cmd=`which gcc` -if [ "x$gcc_cmd" = "x" ]; then - echo "WARNING: gcc not found. Cannot execute test." 2>&1 - exit 0; -fi - -CFLAGS=-m${VM_BITS} - LD_LIBRARY_PATH=.:${TESTJAVA}/jre/lib/${VM_CPU}/${VM_TYPE}:${TESTJAVA}/lib/${VM_CPU}/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH -echo "Architecture: ${VM_CPU}" -echo "Compilation flag: ${CFLAGS}" -echo "VM type: ${VM_TYPE}" -echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}" - -# Note pthread may not be found thus invoke creation will fail to be created. -# Check to ensure you have a /usr/lib/libpthread.so if you don't please look -# for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation. - -cp ${TESTSRC}/DoOverflow.java . -${COMPILEJAVA}/bin/javac DoOverflow.java - -$gcc_cmd -DLINUX -g3 ${CFLAGS} -o invoke \ - -I${TESTJAVA}/include -I${TESTJAVA}/include/linux \ - -L${TESTJAVA}/jre/lib/${VM_CPU}/${VM_TYPE} \ - -L${TESTJAVA}/lib/${VM_CPU}/${VM_TYPE} \ - ${TESTSRC}/invoke.c -ljvm -lpthread - -if [ $? -ne 0 ] ; then - echo "Compile failed, Ignoring failed compilation and forcing the test to pass" - exit 0 -fi - -./invoke test_java_overflow -./invoke test_native_overflow +# Run the test for a java and native overflow +${TESTNATIVEPATH}/invoke test_java_overflow +${TESTNATIVEPATH}/invoke test_native_overflow exit $? From 3b6a62c9dcd78dd4d09cb1acea2b0a884a59e00e Mon Sep 17 00:00:00 2001 From: Ivan Gerasimov Date: Sat, 16 Jul 2016 23:10:00 +0300 Subject: [PATCH 067/108] 8160892: Race at the VM exit causes "WaitForMultipleObjects timed out" Reviewed-by: dcubed, dholmes --- hotspot/src/os/windows/vm/os_windows.cpp | 31 ++++++++++++++++++------ 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index 23a06c9db24..53e7ecb8a7d 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -3898,6 +3898,13 @@ int os::win32::exit_process_or_thread(Ept what, int exit_code) { DWORD res; HANDLE hproc, hthr; + // We only attempt to register threads until a process exiting + // thread manages to set the process_exiting flag. Any threads + // that come through here after the process_exiting flag is set + // are unregistered and will be caught in the SuspendThread() + // infinite loop below. + bool registered = false; + // The first thread that reached this point, initializes the critical section. if (!InitOnceExecuteOnce(&init_once_crit_sect, init_crit_sect_call, &crit_sect, NULL)) { warning("crit_sect initialization failed in %s: %d\n", __FILE__, __LINE__); @@ -3957,12 +3964,21 @@ int os::win32::exit_process_or_thread(Ept what, int exit_code) { 0, FALSE, DUPLICATE_SAME_ACCESS)) { warning("DuplicateHandle failed (%u) in %s: %d\n", GetLastError(), __FILE__, __LINE__); + + // We can't register this thread (no more handles) so this thread + // may be racing with a thread that is calling exit(). If the thread + // that is calling exit() has managed to set the process_exiting + // flag, then this thread will be caught in the SuspendThread() + // infinite loop below which closes that race. A small timing + // window remains before the process_exiting flag is set, but it + // is only exposed when we are out of handles. } else { ++handle_count; - } + registered = true; - // The current exiting thread has stored its handle in the array, and now - // should leave the critical section before calling _endthreadex(). + // The current exiting thread has stored its handle in the array, and now + // should leave the critical section before calling _endthreadex(). + } } else if (what != EPT_THREAD && handle_count > 0) { jlong start_time, finish_time, timeout_left; @@ -4012,10 +4028,11 @@ int os::win32::exit_process_or_thread(Ept what, int exit_code) { LeaveCriticalSection(&crit_sect); } - if (OrderAccess::load_acquire(&process_exiting) != 0 && + if (!registered && + OrderAccess::load_acquire(&process_exiting) != 0 && process_exiting != (jint)GetCurrentThreadId()) { - // Some other thread is about to call exit(), so we - // don't let the current thread proceed to exit() or _endthreadex() + // Some other thread is about to call exit(), so we don't let + // the current unregistered thread proceed to exit() or _endthreadex() while (true) { SuspendThread(GetCurrentThread()); // Avoid busy-wait loop, if SuspendThread() failed. @@ -4027,7 +4044,7 @@ int os::win32::exit_process_or_thread(Ept what, int exit_code) { // We are here if either // - there's no 'race at exit' bug on this OS release; // - initialization of the critical section failed (unlikely); - // - the current thread has stored its handle and left the critical section; + // - the current thread has registered itself and left the critical section; // - the process-exiting thread has raised the flag and left the critical section. if (what == EPT_THREAD) { _endthreadex((unsigned)exit_code); From a40bbfadaf9b57e8195d58a482386b5b7e5dafd7 Mon Sep 17 00:00:00 2001 From: Mikael Gerdin Date: Mon, 18 Jul 2016 14:30:39 +0200 Subject: [PATCH 068/108] 8161027: GPL header missing comma after year Reviewed-by: redestad, dholmes --- hotspot/src/share/vm/utilities/resourceHash.cpp | 2 +- hotspot/src/share/vm/utilities/resourceHash.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/utilities/resourceHash.cpp b/hotspot/src/share/vm/utilities/resourceHash.cpp index 36088acac61..7365c0c11c1 100644 --- a/hotspot/src/share/vm/utilities/resourceHash.cpp +++ b/hotspot/src/share/vm/utilities/resourceHash.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 diff --git a/hotspot/src/share/vm/utilities/resourceHash.hpp b/hotspot/src/share/vm/utilities/resourceHash.hpp index bfd0a1f2d94..6941d407ad8 100644 --- a/hotspot/src/share/vm/utilities/resourceHash.hpp +++ b/hotspot/src/share/vm/utilities/resourceHash.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 From c0e5b2646f88487bad63fcecc9710c10e9d060c8 Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Mon, 18 Jul 2016 14:20:30 -0700 Subject: [PATCH 069/108] 8161173: quarantine compiler/arraycopy/TestEliminatedArrayCopyDeopt.java 8161174: quarantine gc/stress/TestStressG1Humongous.java on 32-bit 8161175: quarantine serviceability/dcmd/compiler/CompilerQueueTest.java on 32-bit Reviewed-by: sspitsyn, jmasa, gtriantafill --- .../compiler/arraycopy/TestEliminatedArrayCopyDeopt.java | 1 + hotspot/test/gc/stress/TestStressG1Humongous.java | 3 +++ .../test/serviceability/dcmd/compiler/CompilerQueueTest.java | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java b/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java index fb98c652c71..553251a9b63 100644 --- a/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java +++ b/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java @@ -25,6 +25,7 @@ * @test * @bug 8130847 8156760 * @summary Eliminated instance/array written to by an array copy variant must be correctly initialized when reallocated at a deopt + * @ignore 8136818 * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestEliminatedArrayCopyDeopt * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+IgnoreUnrecognizedVMOptions -XX:-ReduceInitialCardMarks TestEliminatedArrayCopyDeopt */ diff --git a/hotspot/test/gc/stress/TestStressG1Humongous.java b/hotspot/test/gc/stress/TestStressG1Humongous.java index 6b507e40827..da98fcdf496 100644 --- a/hotspot/test/gc/stress/TestStressG1Humongous.java +++ b/hotspot/test/gc/stress/TestStressG1Humongous.java @@ -26,6 +26,9 @@ * @key gc * @key stress * @summary Stress G1 by humongous allocations in situation near OOM + * Fails intermittently on 32-bit VMs due to 8160827 so quarantine + * it on those platforms: + * @requires vm.bits != "32" * @requires vm.gc.G1 * @requires !vm.flightRecorder * @run main/othervm/timeout=200 -Xlog:gc=debug -Xmx1g -XX:+UseG1GC -XX:G1HeapRegionSize=4m diff --git a/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java b/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java index 708ee0bf005..346ce045018 100644 --- a/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java +++ b/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java @@ -29,6 +29,10 @@ * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor + * @summary Test of diagnostic command Compiler.queue + * Fails intermittently on 32-bit VMs due to 8158756 so quarantine + * it on those platforms: + * @requires vm.bits != "32" * @build jdk.test.lib.* * jdk.test.lib.dcmd.* * sun.hotspot.WhiteBox @@ -38,7 +42,6 @@ * @run testng/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -Xmixed -XX:+WhiteBoxAPI CompilerQueueTest * @run testng/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -Xmixed -XX:-TieredCompilation -XX:+WhiteBoxAPI CompilerQueueTest * @run testng/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -Xint -XX:+WhiteBoxAPI CompilerQueueTest - * @summary Test of diagnostic command Compiler.queue */ import compiler.testlibrary.CompilerUtils; From ada5ab192fa4c9d58e6380f0d82d93ef3d2cfdd5 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Tue, 19 Jul 2016 10:31:41 +0200 Subject: [PATCH 070/108] 8034842: Parallelize the Free CSet phase in G1 Reviewed-by: jmasa, ehelin --- .../src/share/vm/gc/g1/g1CollectedHeap.cpp | 360 ++++++++++++------ .../src/share/vm/gc/g1/g1CollectedHeap.hpp | 13 +- .../src/share/vm/gc/g1/g1ConcurrentMark.cpp | 4 +- .../src/share/vm/gc/g1/g1DefaultPolicy.cpp | 7 +- hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp | 12 +- hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp | 23 +- hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp | 2 +- hotspot/src/share/vm/gc/g1/heapRegion.cpp | 11 +- hotspot/src/share/vm/gc/g1/heapRegion.hpp | 7 +- hotspot/test/gc/g1/TestGCLogMessages.java | 2 + 10 files changed, 297 insertions(+), 144 deletions(-) diff --git a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp index 1369a3ef866..9a60b5a5c56 100644 --- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp @@ -4524,7 +4524,8 @@ void G1CollectedHeap::record_obj_copy_mem_stats() { void G1CollectedHeap::free_region(HeapRegion* hr, FreeRegionList* free_list, - bool par, + bool skip_remset, + bool skip_hot_card_cache, bool locked) { assert(!hr->is_free(), "the region should not be free"); assert(!hr->is_empty(), "the region should not be empty"); @@ -4539,20 +4540,20 @@ void G1CollectedHeap::free_region(HeapRegion* hr, // Clear the card counts for this region. // Note: we only need to do this if the region is not young // (since we don't refine cards in young regions). - if (!hr->is_young()) { + if (!skip_hot_card_cache && !hr->is_young()) { _hot_card_cache->reset_card_counts(hr); } - hr->hr_clear(par, true /* clear_space */, locked /* locked */); + hr->hr_clear(skip_remset, true /* clear_space */, locked /* locked */); free_list->add_ordered(hr); } void G1CollectedHeap::free_humongous_region(HeapRegion* hr, FreeRegionList* free_list, - bool par) { + bool skip_remset) { assert(hr->is_humongous(), "this is only for humongous regions"); assert(free_list != NULL, "pre-condition"); hr->clear_humongous(); - free_region(hr, free_list, par); + free_region(hr, free_list, skip_remset); } void G1CollectedHeap::remove_from_old_sets(const uint old_regions_removed, @@ -4600,137 +4601,280 @@ void G1CollectedHeap::scrub_rem_set() { workers()->run_task(&g1_par_scrub_rs_task); } -class G1FreeCollectionSetClosure : public HeapRegionClosure { +class G1FreeCollectionSetTask : public AbstractGangTask { private: + + // Closure applied to all regions in the collection set to do work that needs to + // be done serially in a single thread. + class G1SerialFreeCollectionSetClosure : public HeapRegionClosure { + private: + EvacuationInfo* _evacuation_info; + const size_t* _surviving_young_words; + + // Bytes used in successfully evacuated regions before the evacuation. + size_t _before_used_bytes; + // Bytes used in unsucessfully evacuated regions before the evacuation + size_t _after_used_bytes; + + size_t _bytes_allocated_in_old_since_last_gc; + + size_t _failure_used_words; + size_t _failure_waste_words; + + FreeRegionList _local_free_list; + public: + G1SerialFreeCollectionSetClosure(EvacuationInfo* evacuation_info, const size_t* surviving_young_words) : + HeapRegionClosure(), + _evacuation_info(evacuation_info), + _surviving_young_words(surviving_young_words), + _before_used_bytes(0), + _after_used_bytes(0), + _bytes_allocated_in_old_since_last_gc(0), + _failure_used_words(0), + _failure_waste_words(0), + _local_free_list("Local Region List for CSet Freeing") { + } + + virtual bool doHeapRegion(HeapRegion* r) { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + + assert(r->in_collection_set(), "Region %u should be in collection set.", r->hrm_index()); + g1h->clear_in_cset(r); + + if (r->is_young()) { + assert(r->young_index_in_cset() != -1 && (uint)r->young_index_in_cset() < g1h->collection_set()->young_region_length(), + "Young index %d is wrong for region %u of type %s with %u young regions", + r->young_index_in_cset(), + r->hrm_index(), + r->get_type_str(), + g1h->collection_set()->young_region_length()); + size_t words_survived = _surviving_young_words[r->young_index_in_cset()]; + r->record_surv_words_in_group(words_survived); + } + + if (!r->evacuation_failed()) { + assert(r->not_empty(), "Region %u is an empty region in the collection set.", r->hrm_index()); + _before_used_bytes += r->used(); + g1h->free_region(r, + &_local_free_list, + true, /* skip_remset */ + true, /* skip_hot_card_cache */ + true /* locked */); + } else { + r->uninstall_surv_rate_group(); + r->set_young_index_in_cset(-1); + r->set_evacuation_failed(false); + // When moving a young gen region to old gen, we "allocate" that whole region + // there. This is in addition to any already evacuated objects. Notify the + // policy about that. + // Old gen regions do not cause an additional allocation: both the objects + // still in the region and the ones already moved are accounted for elsewhere. + if (r->is_young()) { + _bytes_allocated_in_old_since_last_gc += HeapRegion::GrainBytes; + } + // The region is now considered to be old. + r->set_old(); + // Do some allocation statistics accounting. Regions that failed evacuation + // are always made old, so there is no need to update anything in the young + // gen statistics, but we need to update old gen statistics. + size_t used_words = r->marked_bytes() / HeapWordSize; + + _failure_used_words += used_words; + _failure_waste_words += HeapRegion::GrainWords - used_words; + + g1h->old_set_add(r); + _after_used_bytes += r->used(); + } + return false; + } + + void complete_work() { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + + _evacuation_info->set_regions_freed(_local_free_list.length()); + _evacuation_info->increment_collectionset_used_after(_after_used_bytes); + + g1h->prepend_to_freelist(&_local_free_list); + g1h->decrement_summary_bytes(_before_used_bytes); + + G1Policy* policy = g1h->g1_policy(); + policy->add_bytes_allocated_in_old_since_last_gc(_bytes_allocated_in_old_since_last_gc); + + g1h->alloc_buffer_stats(InCSetState::Old)->add_failure_used_and_waste(_failure_used_words, _failure_waste_words); + } + }; + + G1CollectionSet* _collection_set; + G1SerialFreeCollectionSetClosure _cl; const size_t* _surviving_young_words; - FreeRegionList _local_free_list; size_t _rs_lengths; - // Bytes used in successfully evacuated regions before the evacuation. - size_t _before_used_bytes; - // Bytes used in unsucessfully evacuated regions before the evacuation - size_t _after_used_bytes; - size_t _bytes_allocated_in_old_since_last_gc; + volatile jint _serial_work_claim; - size_t _failure_used_words; - size_t _failure_waste_words; + struct WorkItem { + uint region_idx; + bool is_young; + bool evacuation_failed; - double _young_time; - double _non_young_time; -public: - G1FreeCollectionSetClosure(const size_t* surviving_young_words) : - HeapRegionClosure(), - _surviving_young_words(surviving_young_words), - _local_free_list("Local Region List for CSet Freeing"), - _rs_lengths(0), - _before_used_bytes(0), - _after_used_bytes(0), - _bytes_allocated_in_old_since_last_gc(0), - _failure_used_words(0), - _failure_waste_words(0), - _young_time(0.0), - _non_young_time(0.0) { + WorkItem(HeapRegion* r) { + region_idx = r->hrm_index(); + is_young = r->is_young(); + evacuation_failed = r->evacuation_failed(); + } + }; + + volatile size_t _parallel_work_claim; + size_t _num_work_items; + WorkItem* _work_items; + + void do_serial_work() { + // Need to grab the lock to be allowed to modify the old region list. + MutexLockerEx x(OldSets_lock, Mutex::_no_safepoint_check_flag); + _collection_set->iterate(&_cl); } - virtual bool doHeapRegion(HeapRegion* r) { - double start_time = os::elapsedTime(); - - bool is_young = r->is_young(); - + void do_parallel_work_for_region(uint region_idx, bool is_young, bool evacuation_failed) { G1CollectedHeap* g1h = G1CollectedHeap::heap(); + + HeapRegion* r = g1h->region_at(region_idx); assert(!g1h->is_on_master_free_list(r), "sanity"); - _rs_lengths += r->rem_set()->occupied_locked(); + Atomic::add(r->rem_set()->occupied_locked(), &_rs_lengths); - assert(r->in_collection_set(), "Region %u should be in collection set.", r->hrm_index()); - g1h->clear_in_cset(r); - - if (is_young) { - int index = r->young_index_in_cset(); - assert(index != -1, "Young index in collection set must not be -1 for region %u", r->hrm_index()); - assert((uint) index < g1h->collection_set()->young_region_length(), "invariant"); - size_t words_survived = _surviving_young_words[index]; - r->record_surv_words_in_group(words_survived); - } else { - assert(r->young_index_in_cset() == -1, "Young index for old region %u in collection set must be -1", r->hrm_index()); + if (!is_young) { + g1h->_hot_card_cache->reset_card_counts(r); } - if (!r->evacuation_failed()) { - assert(r->not_empty(), "Region %u is an empty region in the collection set.", r->hrm_index()); - _before_used_bytes += r->used(); - g1h->free_region(r, &_local_free_list, false /* par */, true /* locked */); - } else { - r->uninstall_surv_rate_group(); - r->set_young_index_in_cset(-1); - r->set_evacuation_failed(false); - // When moving a young gen region to old gen, we "allocate" that whole region - // there. This is in addition to any already evacuated objects. Notify the - // policy about that. - // Old gen regions do not cause an additional allocation: both the objects - // still in the region and the ones already moved are accounted for elsewhere. - if (is_young) { - _bytes_allocated_in_old_since_last_gc += HeapRegion::GrainBytes; - } - // The region is now considered to be old. - r->set_old(); - // Do some allocation statistics accounting. Regions that failed evacuation - // are always made old, so there is no need to update anything in the young - // gen statistics, but we need to update old gen statistics. - size_t used_words = r->marked_bytes() / HeapWordSize; - - _failure_used_words += used_words; - _failure_waste_words += HeapRegion::GrainWords - used_words; - - g1h->old_set_add(r); - _after_used_bytes += r->used(); + if (!evacuation_failed) { + r->rem_set()->clear_locked(); } - - if (is_young) { - _young_time += os::elapsedTime() - start_time; - } else { - _non_young_time += os::elapsedTime() - start_time; - } - return false; } - FreeRegionList* local_free_list() { return &_local_free_list; } - size_t rs_lengths() const { return _rs_lengths; } - size_t before_used_bytes() const { return _before_used_bytes; } - size_t after_used_bytes() const { return _after_used_bytes; } + class G1PrepareFreeCollectionSetClosure : public HeapRegionClosure { + private: + size_t _cur_idx; + WorkItem* _work_items; + public: + G1PrepareFreeCollectionSetClosure(WorkItem* work_items) : HeapRegionClosure(), _cur_idx(0), _work_items(work_items) { } - size_t bytes_allocated_in_old_since_last_gc() const { return _bytes_allocated_in_old_since_last_gc; } + virtual bool doHeapRegion(HeapRegion* r) { + _work_items[_cur_idx++] = WorkItem(r); + return false; + } + }; - size_t failure_used_words() const { return _failure_used_words; } - size_t failure_waste_words() const { return _failure_waste_words; } + void prepare_work() { + G1PrepareFreeCollectionSetClosure cl(_work_items); + _collection_set->iterate(&cl); + } - double young_time() const { return _young_time; } - double non_young_time() const { return _non_young_time; } + void complete_work() { + _cl.complete_work(); + + G1Policy* policy = G1CollectedHeap::heap()->g1_policy(); + policy->record_max_rs_lengths(_rs_lengths); + policy->cset_regions_freed(); + } +public: + G1FreeCollectionSetTask(G1CollectionSet* collection_set, EvacuationInfo* evacuation_info, const size_t* surviving_young_words) : + AbstractGangTask("G1 Free Collection Set"), + _cl(evacuation_info, surviving_young_words), + _collection_set(collection_set), + _surviving_young_words(surviving_young_words), + _serial_work_claim(0), + _rs_lengths(0), + _parallel_work_claim(0), + _num_work_items(collection_set->region_length()), + _work_items(NEW_C_HEAP_ARRAY(WorkItem, _num_work_items, mtGC)) { + prepare_work(); + } + + ~G1FreeCollectionSetTask() { + complete_work(); + FREE_C_HEAP_ARRAY(WorkItem, _work_items); + } + + // Chunk size for work distribution. The chosen value has been determined experimentally + // to be a good tradeoff between overhead and achievable parallelism. + static uint chunk_size() { return 32; } + + virtual void work(uint worker_id) { + G1GCPhaseTimes* timer = G1CollectedHeap::heap()->g1_policy()->phase_times(); + + // Claim serial work. + if (_serial_work_claim == 0) { + jint value = Atomic::add(1, &_serial_work_claim) - 1; + if (value == 0) { + double serial_time = os::elapsedTime(); + do_serial_work(); + timer->record_serial_free_cset_time_ms((os::elapsedTime() - serial_time) * 1000.0); + } + } + + // Start parallel work. + double young_time = 0.0; + bool has_young_time = false; + double non_young_time = 0.0; + bool has_non_young_time = false; + + while (true) { + size_t end = Atomic::add(chunk_size(), &_parallel_work_claim); + size_t cur = end - chunk_size(); + + if (cur >= _num_work_items) { + break; + } + + double start_time = os::elapsedTime(); + + end = MIN2(end, _num_work_items); + + for (; cur < end; cur++) { + bool is_young = _work_items[cur].is_young; + + do_parallel_work_for_region(_work_items[cur].region_idx, is_young, _work_items[cur].evacuation_failed); + + double end_time = os::elapsedTime(); + double time_taken = end_time - start_time; + if (is_young) { + young_time += time_taken; + has_young_time = true; + } else { + non_young_time += time_taken; + has_non_young_time = true; + } + start_time = end_time; + } + } + + if (has_young_time) { + timer->record_time_secs(G1GCPhaseTimes::YoungFreeCSet, worker_id, young_time); + } + if (has_non_young_time) { + timer->record_time_secs(G1GCPhaseTimes::NonYoungFreeCSet, worker_id, young_time); + } + } }; void G1CollectedHeap::free_collection_set(G1CollectionSet* collection_set, EvacuationInfo& evacuation_info, const size_t* surviving_young_words) { _eden.clear(); - G1FreeCollectionSetClosure cl(surviving_young_words); - collection_set_iterate(&cl); + double free_cset_start_time = os::elapsedTime(); - evacuation_info.set_regions_freed(cl.local_free_list()->length()); - evacuation_info.increment_collectionset_used_after(cl.after_used_bytes()); + { + uint const num_chunks = MAX2(_collection_set.region_length() / G1FreeCollectionSetTask::chunk_size(), 1U); + uint const num_workers = MIN2(workers()->active_workers(), num_chunks); - G1Policy* policy = g1_policy(); + G1FreeCollectionSetTask cl(collection_set, &evacuation_info, surviving_young_words); - policy->record_max_rs_lengths(cl.rs_lengths()); - policy->cset_regions_freed(); - - prepend_to_freelist(cl.local_free_list()); - decrement_summary_bytes(cl.before_used_bytes()); - - policy->add_bytes_allocated_in_old_since_last_gc(cl.bytes_allocated_in_old_since_last_gc()); - - _old_evac_stats.add_failure_used_and_waste(cl.failure_used_words(), cl.failure_waste_words()); - - policy->phase_times()->record_young_free_cset_time_ms(cl.young_time() * 1000.0); - policy->phase_times()->record_non_young_free_cset_time_ms(cl.non_young_time() * 1000.0); + log_debug(gc, ergo)("Running %s using %u workers for collection set length %u", + cl.name(), + num_workers, + _collection_set.region_length()); + workers()->run_task(&cl, num_workers); + } + g1_policy()->phase_times()->record_total_free_cset_time_ms((os::elapsedTime() - free_cset_start_time) * 1000.0); collection_set->clear(); } @@ -4825,7 +4969,7 @@ class G1FreeHumongousRegionClosure : public HeapRegionClosure { _freed_bytes += r->used(); r->set_containing_set(NULL); _humongous_regions_removed++; - g1h->free_humongous_region(r, _free_region_list, false); + g1h->free_humongous_region(r, _free_region_list, false /* skip_remset */ ); r = next; } while (r != NULL); diff --git a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp index 134f3888ee5..b47778324b4 100644 --- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp @@ -118,6 +118,7 @@ class G1RegionMappingChangedListener : public G1MappingChangedListener { }; class G1CollectedHeap : public CollectedHeap { + friend class G1FreeCollectionSetTask; friend class VM_CollectForMetadataAllocation; friend class VM_G1CollectForAllocation; friend class VM_G1CollectFull; @@ -642,13 +643,15 @@ public: // adding it to the free list that's passed as a parameter (this is // usually a local list which will be appended to the master free // list later). The used bytes of freed regions are accumulated in - // pre_used. If par is true, the region's RSet will not be freed - // up. The assumption is that this will be done later. + // pre_used. If skip_remset is true, the region's RSet will not be freed + // up. If skip_hot_card_cache is true, the region's hot card cache will not + // be freed up. The assumption is that this will be done later. // The locked parameter indicates if the caller has already taken // care of proper synchronization. This may allow some optimizations. void free_region(HeapRegion* hr, FreeRegionList* free_list, - bool par, + bool skip_remset, + bool skip_hot_card_cache = false, bool locked = false); // It dirties the cards that cover the block so that the post @@ -662,11 +665,11 @@ public: // will be added to the free list that's passed as a parameter (this // is usually a local list which will be appended to the master free // list later). The used bytes of freed regions are accumulated in - // pre_used. If par is true, the region's RSet will not be freed + // pre_used. If skip_remset is true, the region's RSet will not be freed // up. The assumption is that this will be done later. void free_humongous_region(HeapRegion* hr, FreeRegionList* free_list, - bool par); + bool skip_remset); // Facility for allocating in 'archive' regions in high heap memory and // recording the allocated ranges. These should all be called from the diff --git a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp index 29909fa40c4..612ea93e6d7 100644 --- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp +++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp @@ -1159,10 +1159,10 @@ public: hr->set_containing_set(NULL); if (hr->is_humongous()) { _humongous_regions_removed++; - _g1->free_humongous_region(hr, _local_cleanup_list, true); + _g1->free_humongous_region(hr, _local_cleanup_list, true /* skip_remset */); } else { _old_regions_removed++; - _g1->free_region(hr, _local_cleanup_list, true); + _g1->free_region(hr, _local_cleanup_list, true /* skip_remset */); } } else { hr->rem_set()->do_cleanup_work(_hrrs_cleanup_task); diff --git a/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp index c15a3823f8a..98c3f989387 100644 --- a/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp +++ b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp @@ -501,13 +501,12 @@ double G1DefaultPolicy::average_time_ms(G1GCPhaseTimes::GCParPhases phase) const double G1DefaultPolicy::young_other_time_ms() const { return phase_times()->young_cset_choice_time_ms() + - phase_times()->young_free_cset_time_ms(); + phase_times()->average_time_ms(G1GCPhaseTimes::YoungFreeCSet); } double G1DefaultPolicy::non_young_other_time_ms() const { return phase_times()->non_young_cset_choice_time_ms() + - phase_times()->non_young_free_cset_time_ms(); - + phase_times()->average_time_ms(G1GCPhaseTimes::NonYoungFreeCSet); } double G1DefaultPolicy::other_time_ms(double pause_time_ms) const { @@ -515,7 +514,7 @@ double G1DefaultPolicy::other_time_ms(double pause_time_ms) const { } double G1DefaultPolicy::constant_other_time_ms(double pause_time_ms) const { - return other_time_ms(pause_time_ms) - young_other_time_ms() - non_young_other_time_ms(); + return other_time_ms(pause_time_ms) - phase_times()->total_free_cset_time_ms(); } CollectionSetChooser* G1DefaultPolicy::cset_chooser() const { diff --git a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp index f7e8b1db586..a5dac2a150f 100644 --- a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp +++ b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp @@ -91,6 +91,9 @@ G1GCPhaseTimes::G1GCPhaseTimes(uint max_gc_threads) : _redirtied_cards = new WorkerDataArray(max_gc_threads, "Redirtied Cards:"); _gc_par_phases[RedirtyCards]->link_thread_work_items(_redirtied_cards); + _gc_par_phases[YoungFreeCSet] = new WorkerDataArray(max_gc_threads, "Young Free Collection Set (ms):"); + _gc_par_phases[NonYoungFreeCSet] = new WorkerDataArray(max_gc_threads, "Non-Young Free Collection Set (ms):"); + _gc_par_phases[PreserveCMReferents] = new WorkerDataArray(max_gc_threads, "Parallel Preserve CM Refs (ms):"); } @@ -278,10 +281,11 @@ void G1GCPhaseTimes::print() { info_line_and_account("Clear Card Table", _cur_clear_ct_time_ms); info_line_and_account("Expand Heap After Collection", _cur_expand_heap_time_ms); - double free_cset_time = _recorded_young_free_cset_time_ms + _recorded_non_young_free_cset_time_ms; - info_line_and_account("Free Collection Set", free_cset_time); - debug_line("Young Free Collection Set", _recorded_young_free_cset_time_ms); - debug_line("Non-Young Free Collection Set", _recorded_non_young_free_cset_time_ms); + info_line_and_account("Free Collection Set", _recorded_total_free_cset_time_ms); + debug_line("Free Collection Set Serial", _recorded_serial_free_cset_time_ms); + debug_phase(_gc_par_phases[YoungFreeCSet]); + debug_phase(_gc_par_phases[NonYoungFreeCSet]); + info_line_and_account("Merge Per-Thread State", _recorded_merge_pss_time_ms); info_line("Other", _gc_pause_time_ms - accounted_time_ms); diff --git a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp index 88deb79d367..87fed3ffef8 100644 --- a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp +++ b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp @@ -67,6 +67,8 @@ class G1GCPhaseTimes : public CHeapObj { StringDedupTableFixup, RedirtyCards, PreserveCMReferents, + YoungFreeCSet, + NonYoungFreeCSet, GCParPhasesSentinel }; @@ -110,8 +112,9 @@ class G1GCPhaseTimes : public CHeapObj { double _recorded_merge_pss_time_ms; - double _recorded_young_free_cset_time_ms; - double _recorded_non_young_free_cset_time_ms; + double _recorded_total_free_cset_time_ms; + + double _recorded_serial_free_cset_time_ms; double _cur_fast_reclaim_humongous_time_ms; double _cur_fast_reclaim_humongous_register_time_ms; @@ -199,12 +202,12 @@ class G1GCPhaseTimes : public CHeapObj { _root_region_scan_wait_time_ms = time_ms; } - void record_young_free_cset_time_ms(double time_ms) { - _recorded_young_free_cset_time_ms = time_ms; + void record_total_free_cset_time_ms(double time_ms) { + _recorded_total_free_cset_time_ms = time_ms; } - void record_non_young_free_cset_time_ms(double time_ms) { - _recorded_non_young_free_cset_time_ms = time_ms; + void record_serial_free_cset_time_ms(double time_ms) { + _recorded_serial_free_cset_time_ms = time_ms; } void record_fast_reclaim_humongous_stats(double time_ms, size_t total, size_t candidates) { @@ -278,18 +281,14 @@ class G1GCPhaseTimes : public CHeapObj { return _recorded_young_cset_choice_time_ms; } - double young_free_cset_time_ms() { - return _recorded_young_free_cset_time_ms; + double total_free_cset_time_ms() { + return _recorded_total_free_cset_time_ms; } double non_young_cset_choice_time_ms() { return _recorded_non_young_cset_choice_time_ms; } - double non_young_free_cset_time_ms() { - return _recorded_non_young_free_cset_time_ms; - } - double fast_reclaim_humongous_time_ms() { return _cur_fast_reclaim_humongous_time_ms; } diff --git a/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp b/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp index 80aaad3c79b..3d8866de817 100644 --- a/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp +++ b/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp @@ -340,7 +340,7 @@ void G1PrepareCompactClosure::free_humongous_region(HeapRegion* hr) { hr->set_containing_set(NULL); _humongous_regions_removed++; - _g1h->free_humongous_region(hr, &dummy_free_list, false /* par */); + _g1h->free_humongous_region(hr, &dummy_free_list, false /* skip_remset */); prepare_for_compaction(hr, end); dummy_free_list.remove_all(); } diff --git a/hotspot/src/share/vm/gc/g1/heapRegion.cpp b/hotspot/src/share/vm/gc/g1/heapRegion.cpp index 52ad443ea67..13143a32afe 100644 --- a/hotspot/src/share/vm/gc/g1/heapRegion.cpp +++ b/hotspot/src/share/vm/gc/g1/heapRegion.cpp @@ -167,7 +167,7 @@ void HeapRegion::reset_after_compaction() { init_top_at_mark_start(); } -void HeapRegion::hr_clear(bool par, bool clear_space, bool locked) { +void HeapRegion::hr_clear(bool keep_remset, bool clear_space, bool locked) { assert(_humongous_start_region == NULL, "we should have already filtered out humongous regions"); assert(!in_collection_set(), @@ -179,15 +179,14 @@ void HeapRegion::hr_clear(bool par, bool clear_space, bool locked) { set_free(); reset_pre_dummy_top(); - if (!par) { - // If this is parallel, this will be done later. - HeapRegionRemSet* hrrs = rem_set(); + if (!keep_remset) { if (locked) { - hrrs->clear_locked(); + rem_set()->clear_locked(); } else { - hrrs->clear(); + rem_set()->clear(); } } + zero_marked_bytes(); init_top_at_mark_start(); diff --git a/hotspot/src/share/vm/gc/g1/heapRegion.hpp b/hotspot/src/share/vm/gc/g1/heapRegion.hpp index a020792d6fa..f4bf95e055b 100644 --- a/hotspot/src/share/vm/gc/g1/heapRegion.hpp +++ b/hotspot/src/share/vm/gc/g1/heapRegion.hpp @@ -512,8 +512,11 @@ class HeapRegion: public G1ContiguousSpace { #endif // ASSERT - // Reset HR stuff to default values. - void hr_clear(bool par, bool clear_space, bool locked = false); + // Reset the HeapRegion to default values. + // If skip_remset is true, do not clear the remembered set. + void hr_clear(bool skip_remset, bool clear_space, bool locked = false); + // Clear the parts skipped by skip_remset in hr_clear() in the HeapRegion during + // a concurrent phase. void par_clear(); // Get the start of the unmarked area in this region. diff --git a/hotspot/test/gc/g1/TestGCLogMessages.java b/hotspot/test/gc/g1/TestGCLogMessages.java index 90e4b71d8ed..ec9250c14fa 100644 --- a/hotspot/test/gc/g1/TestGCLogMessages.java +++ b/hotspot/test/gc/g1/TestGCLogMessages.java @@ -95,6 +95,8 @@ public class TestGCLogMessages { new LogMessageWithLevel("String Dedup Fixup", Level.INFO), new LogMessageWithLevel("Expand Heap After Collection", Level.INFO), // Free CSet + new LogMessageWithLevel("Free Collection Set", Level.INFO), + new LogMessageWithLevel("Free Collection Set Serial", Level.DEBUG), new LogMessageWithLevel("Young Free Collection Set", Level.DEBUG), new LogMessageWithLevel("Non-Young Free Collection Set", Level.DEBUG), // Humongous Eager Reclaim From 5075c7b9a0fd89f59285e9e6ea375028f5a8ca12 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Tue, 19 Jul 2016 09:30:30 +0200 Subject: [PATCH 071/108] 8157459: G1 IHOP JFR event attribute with incorrect content type Use PERCENTAGE instead of BYTES64 data type for the affected attributes. Reviewed-by: ehelin, sangheki --- hotspot/src/share/vm/gc/shared/gcTraceSend.cpp | 4 ++-- hotspot/src/share/vm/trace/traceevents.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp b/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp index db538eb4f41..e51e8fe8f54 100644 --- a/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp +++ b/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp @@ -278,7 +278,7 @@ void G1NewTracer::send_basic_ihop_statistics(size_t threshold, evt.set_gcId(GCId::current()); evt.set_threshold(threshold); evt.set_targetOccupancy(target_occupancy); - evt.set_thresholdPercentage(target_occupancy > 0 ? (threshold * 100 / target_occupancy) : 0); + evt.set_thresholdPercentage(target_occupancy > 0 ? ((double)threshold / target_occupancy) : 0.0); evt.set_currentOccupancy(current_occupancy); evt.set_lastAllocationSize(last_allocation_size); evt.set_lastAllocationDuration(last_allocation_duration); @@ -299,7 +299,7 @@ void G1NewTracer::send_adaptive_ihop_statistics(size_t threshold, if (evt.should_commit()) { evt.set_gcId(GCId::current()); evt.set_threshold(threshold); - evt.set_thresholdPercentage(internal_target_occupancy > 0 ? (threshold * 100 / internal_target_occupancy) : 0); + evt.set_thresholdPercentage(internal_target_occupancy > 0 ? ((double)threshold / internal_target_occupancy) : 0.0); evt.set_internalTargetOccupancy(internal_target_occupancy); evt.set_currentOccupancy(current_occupancy); evt.set_additionalBufferSize(additional_buffer_size); diff --git a/hotspot/src/share/vm/trace/traceevents.xml b/hotspot/src/share/vm/trace/traceevents.xml index 83bb051b6f2..45b566f8c4b 100644 --- a/hotspot/src/share/vm/trace/traceevents.xml +++ b/hotspot/src/share/vm/trace/traceevents.xml @@ -374,7 +374,7 @@ Declares a structure type that can be used in other events. description="Basic statistics related to current IHOP calculation"> - + @@ -387,7 +387,7 @@ Declares a structure type that can be used in other events. description="Statistics related to current adaptive IHOP calculation"> - + From c6f30feaecef81e0faea4020e9af8df3dd6dae3e Mon Sep 17 00:00:00 2001 From: Michail Chernov Date: Tue, 19 Jul 2016 18:15:46 +0300 Subject: [PATCH 072/108] 8160827: gc/stress/TestStressG1Humongous.java fails with OOME Reviewed-by: tschatzl --- hotspot/test/gc/stress/TestStressG1Humongous.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hotspot/test/gc/stress/TestStressG1Humongous.java b/hotspot/test/gc/stress/TestStressG1Humongous.java index da98fcdf496..501f64672f5 100644 --- a/hotspot/test/gc/stress/TestStressG1Humongous.java +++ b/hotspot/test/gc/stress/TestStressG1Humongous.java @@ -26,9 +26,6 @@ * @key gc * @key stress * @summary Stress G1 by humongous allocations in situation near OOM - * Fails intermittently on 32-bit VMs due to 8160827 so quarantine - * it on those platforms: - * @requires vm.bits != "32" * @requires vm.gc.G1 * @requires !vm.flightRecorder * @run main/othervm/timeout=200 -Xlog:gc=debug -Xmx1g -XX:+UseG1GC -XX:G1HeapRegionSize=4m @@ -56,6 +53,7 @@ public class TestStressG1Humongous { private static final int THREAD_COUNT = Integer.getInteger("threads", 2); private static final int REGION_SIZE = Integer.getInteger("regionsize", 1) * 1024 * 1024; private static final int HUMONGOUS_SIZE = (int) (REGION_SIZE * Double.parseDouble(System.getProperty("humongoussize", "1.5"))); + private static final int NUMBER_OF_FREE_REGIONS = 2; private volatile boolean isRunning; private final ExecutorService threadExecutor; @@ -95,8 +93,12 @@ public class TestStressG1Humongous { private int getExpectedAmountOfObjects() { long maxMem = Runtime.getRuntime().maxMemory(); int expectedHObjects = (int) (maxMem / HUMONGOUS_SIZE); - // Will allocate 1 region less to give some free space for VM. - int checkedAmountOfHObjects = checkHeapCapacity(expectedHObjects) - 1; + // Will allocate NUMBER_OF_FREE_REGIONS region less to give some free space for VM. + int checkedAmountOfHObjects = checkHeapCapacity(expectedHObjects) - NUMBER_OF_FREE_REGIONS; + if (checkedAmountOfHObjects <= 0) { + throw new RuntimeException("Cannot start testing because selected maximum heap " + + "is not large enough to contain more than " + NUMBER_OF_FREE_REGIONS + " regions"); + } return checkedAmountOfHObjects; } From f6975a2f6507bdc8009744686b6f39a2e6a65c94 Mon Sep 17 00:00:00 2001 From: Gerard Ziemski Date: Tue, 19 Jul 2016 11:00:45 -0500 Subject: [PATCH 073/108] 8138760: [JVMCI] VM warning: Performance bug: SystemDictionary lookup_count=21831450 lookup_length=1275207287 average=58.411479 load=5.572844 Added debug details to the warning message. Reviewed-by: dholmes, iklam, twisti --- hotspot/src/share/vm/classfile/dictionary.cpp | 80 +++++++++++++++++-- hotspot/src/share/vm/utilities/hashtable.cpp | 11 ++- hotspot/src/share/vm/utilities/hashtable.hpp | 23 +++++- .../share/vm/utilities/hashtable.inline.hpp | 1 + 4 files changed, 104 insertions(+), 11 deletions(-) diff --git a/hotspot/src/share/vm/classfile/dictionary.cpp b/hotspot/src/share/vm/classfile/dictionary.cpp index c7ea145c3d2..56d59d23afc 100644 --- a/hotspot/src/share/vm/classfile/dictionary.cpp +++ b/hotspot/src/share/vm/classfile/dictionary.cpp @@ -396,14 +396,15 @@ void Dictionary::add_klass(Symbol* class_name, ClassLoaderData* loader_data, DictionaryEntry* Dictionary::get_entry(int index, unsigned int hash, Symbol* class_name, ClassLoaderData* loader_data) { - debug_only(_lookup_count++); + DEBUG_ONLY(_lookup_count++); for (DictionaryEntry* entry = bucket(index); entry != NULL; entry = entry->next()) { if (entry->hash() == hash && entry->equals(class_name, loader_data)) { + DEBUG_ONLY(bucket_count_hit(index)); return entry; } - debug_only(_lookup_length++); + DEBUG_ONLY(_lookup_length++); } return NULL; } @@ -596,7 +597,7 @@ void ProtectionDomainCacheTable::verify() { } guarantee(number_of_entries() == element_count, "Verify of protection domain cache table failed"); - debug_only(verify_lookup_length((double)number_of_entries() / table_size())); + DEBUG_ONLY(verify_lookup_length((double)number_of_entries() / table_size())); } void ProtectionDomainCacheEntry::verify() { @@ -737,19 +738,65 @@ void Dictionary::print(bool details) { table_size(), number_of_entries()); tty->print_cr("^ indicates that initiating loader is different from " "defining loader"); + tty->print_cr("1st number: th bucket index"); + tty->print_cr("2nd number: the entry's index within this bucket"); +#ifdef ASSERT + tty->print_cr("3rd number: the hit percentage of this entry"); + tty->print_cr("4th number: the hash index of this entry"); +#endif } +#ifdef ASSERT + // find top buckets with highest lookup count + #define TOP_COUNT 16 + int topItemsIndicies[TOP_COUNT]; + for (int i = 0; i < TOP_COUNT; i++) { + topItemsIndicies[i] = i; + } + double total = 0.0; + for (int i = 0; i < table_size(); i++) { + // find the total count number, so later on we can + // express bucket lookup count as a percentage of all lookups + unsigned value = bucket_hits(i); + total += value; + + // find the entry with min value + int index = 0; + unsigned min = bucket_hits(topItemsIndicies[index]); + for (int j = 1; j < TOP_COUNT; j++) { + if (bucket_hits(topItemsIndicies[j]) < min) { + min = bucket_hits(topItemsIndicies[j]); + index = j; + } + } + // if the bucket loookup value is bigger than the current min + // move that bucket index into the top list + if (value > min) { + topItemsIndicies[index] = i; + } + } +#endif + for (int index = 0; index < table_size(); index++) { +#ifdef ASSERT + double percentage = 100.0 * (double)bucket_hits(index)/total; +#endif + int chain = 0; for (DictionaryEntry* probe = bucket(index); probe != NULL; probe = probe->next()) { - if (Verbose) tty->print("%4d: ", index); Klass* e = probe->klass(); ClassLoaderData* loader_data = probe->loader_data(); bool is_defining_class = (loader_data == e->class_loader_data()); + if (details) { + tty->print("%4d: %3d: ", index, chain); +#ifdef ASSERT + tty->print("%5.2f%%: %10u:", percentage, probe->hash()); +#endif + } tty->print("%s%s", ((!details) || is_defining_class) ? " " : "^", - e->external_name()); + e->external_name()); if (details) { tty->print(", loader "); @@ -760,9 +807,30 @@ void Dictionary::print(bool details) { } } tty->cr(); + + chain++; + } + if (details && (chain == 0)) { + tty->print("%4d:", index); + tty->cr(); } } +#ifdef ASSERT + // print out the TOP_COUNT of buckets with highest lookup count (unsorted) + if (details) { + tty->cr(); + tty->print("Top %d buckets:", TOP_COUNT); + tty->cr(); + for (int i = 0; i < TOP_COUNT; i++) { + tty->print("%4d: hits %5.2f%%", + topItemsIndicies[i], + 100.0*(double)bucket_hits(topItemsIndicies[i])/total); + tty->cr(); + } + } +#endif + if (details) { tty->cr(); _pd_cache_table->print(); @@ -795,7 +863,7 @@ void Dictionary::verify() { } guarantee(number_of_entries() == element_count, "Verify of system dictionary failed"); - debug_only(verify_lookup_length((double)number_of_entries() / table_size())); + DEBUG_ONLY(if (!verify_lookup_length((double)number_of_entries() / table_size())) this->print(true)); _pd_cache_table->verify(); } diff --git a/hotspot/src/share/vm/utilities/hashtable.cpp b/hotspot/src/share/vm/utilities/hashtable.cpp index 2d4bd0b83e4..da3cfde6239 100644 --- a/hotspot/src/share/vm/utilities/hashtable.cpp +++ b/hotspot/src/share/vm/utilities/hashtable.cpp @@ -342,13 +342,18 @@ template void BasicHashtable::verify() { #ifdef ASSERT -template void BasicHashtable::verify_lookup_length(double load) { - if ((double)_lookup_length / (double)_lookup_count > load * 2.0) { +template bool BasicHashtable::verify_lookup_length(double load) { + if ((!_lookup_warning) && (_lookup_count != 0) + && ((double)_lookup_length / (double)_lookup_count > load * 2.0)) { warning("Performance bug: SystemDictionary lookup_count=%d " "lookup_length=%d average=%lf load=%f", _lookup_count, _lookup_length, - (double) _lookup_length / _lookup_count, load); + (double)_lookup_length / _lookup_count, load); + _lookup_warning = true; + + return false; } + return true; } #endif diff --git a/hotspot/src/share/vm/utilities/hashtable.hpp b/hotspot/src/share/vm/utilities/hashtable.hpp index 09c5d58fc87..be8203c70c4 100644 --- a/hotspot/src/share/vm/utilities/hashtable.hpp +++ b/hotspot/src/share/vm/utilities/hashtable.hpp @@ -124,9 +124,17 @@ private: // Instance variable BasicHashtableEntry* _entry; +#ifdef ASSERT +private: + unsigned _hits; +public: + unsigned hits() { return _hits; } + void count_hit() { _hits++; } +#endif + public: // Accessing - void clear() { _entry = NULL; } + void clear() { _entry = NULL; DEBUG_ONLY(_hits = 0); } // The following methods use order access methods to avoid race // conditions in multiprocessor systems. @@ -135,6 +143,7 @@ public: // The following method is not MT-safe and must be done under lock. BasicHashtableEntry** entry_addr() { return &_entry; } + }; @@ -173,9 +182,10 @@ private: protected: #ifdef ASSERT + bool _lookup_warning; mutable int _lookup_count; mutable int _lookup_length; - void verify_lookup_length(double load); + bool verify_lookup_length(double load); #endif void initialize(int table_size, int entry_size, int number_of_entries); @@ -226,6 +236,15 @@ public: int number_of_entries() { return _number_of_entries; } void verify() PRODUCT_RETURN; + +#ifdef ASSERT + void bucket_count_hit(int i) const { + _buckets[i].count_hit(); + } + unsigned bucket_hits(int i) const { + return _buckets[i].hits(); + } +#endif }; diff --git a/hotspot/src/share/vm/utilities/hashtable.inline.hpp b/hotspot/src/share/vm/utilities/hashtable.inline.hpp index ee22ba83510..8497193bdc4 100644 --- a/hotspot/src/share/vm/utilities/hashtable.inline.hpp +++ b/hotspot/src/share/vm/utilities/hashtable.inline.hpp @@ -65,6 +65,7 @@ template inline void BasicHashtable::initialize(int table_size, _end_block = NULL; _number_of_entries = number_of_entries; #ifdef ASSERT + _lookup_warning = false; _lookup_count = 0; _lookup_length = 0; #endif From 6ed3f07f487233718d1f5e08b9609f2be12f1e59 Mon Sep 17 00:00:00 2001 From: Jiangli Zhou Date: Tue, 19 Jul 2016 13:52:14 -0400 Subject: [PATCH 074/108] 8141341: CDS should be disabled if JvmtiExport::should_post_class_file_load_hook() is true Disable loading shared class if JvmtiExport::should_post_class_file_load_hook is true. Reviewed-by: iklam, acorn, sspitsyn --- .../share/vm/classfile/systemDictionary.cpp | 24 ++++--- hotspot/src/share/vm/memory/metaspace.cpp | 62 +++++++++++-------- 2 files changed, 52 insertions(+), 34 deletions(-) diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index b747fae54f2..f9167b98d38 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -1246,12 +1246,16 @@ Klass* SystemDictionary::find_shared_class(Symbol* class_name) { instanceKlassHandle SystemDictionary::load_shared_class( Symbol* class_name, Handle class_loader, TRAPS) { - instanceKlassHandle ik (THREAD, find_shared_class(class_name)); - // Make sure we only return the boot class for the NULL classloader. - if (ik.not_null() && - ik->is_shared_boot_class() && class_loader.is_null()) { - Handle protection_domain; - return load_shared_class(ik, class_loader, protection_domain, THREAD); + // Don't load shared class when JvmtiExport::should_post_class_file_load_hook() + // is enabled since posting CFLH is not supported when loading shared class. + if (!JvmtiExport::should_post_class_file_load_hook()) { + instanceKlassHandle ik (THREAD, find_shared_class(class_name)); + // Make sure we only return the boot class for the NULL classloader. + if (ik.not_null() && + ik->is_shared_boot_class() && class_loader.is_null()) { + Handle protection_domain; + return load_shared_class(ik, class_loader, protection_domain, THREAD); + } } return instanceKlassHandle(); } @@ -1334,8 +1338,14 @@ bool SystemDictionary::is_shared_class_visible(Symbol* class_name, instanceKlassHandle SystemDictionary::load_shared_class(instanceKlassHandle ik, Handle class_loader, Handle protection_domain, TRAPS) { + instanceKlassHandle nh = instanceKlassHandle(); // null Handle + if (JvmtiExport::should_post_class_file_load_hook()) { + // Don't load shared class when JvmtiExport::should_post_class_file_load_hook() + // is enabled since posting CFLH is not supported when loading shared class. + return nh; + } + if (ik.not_null()) { - instanceKlassHandle nh = instanceKlassHandle(); // null Handle Symbol* class_name = ik->name(); bool visible = is_shared_class_visible( diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index 5dce2678527..ac7d0f838a3 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -3164,39 +3164,47 @@ void Metaspace::global_initialize() { #endif // _LP64 #endif // INCLUDE_CDS } else { - // If using shared space, open the file that contains the shared space - // and map in the memory before initializing the rest of metaspace (so - // the addresses don't conflict) - address cds_address = NULL; - if (UseSharedSpaces) { #if INCLUDE_CDS + if (UseSharedSpaces) { + // If using shared space, open the file that contains the shared space + // and map in the memory before initializing the rest of metaspace (so + // the addresses don't conflict) + address cds_address = NULL; FileMapInfo* mapinfo = new FileMapInfo(); - // Open the shared archive file, read and validate the header. If - // initialization fails, shared spaces [UseSharedSpaces] are - // disabled and the file is closed. - // Map in spaces now also - if (mapinfo->initialize() && MetaspaceShared::map_shared_spaces(mapinfo)) { - cds_total = FileMapInfo::shared_spaces_size(); - cds_address = (address)mapinfo->header()->region_addr(0); -#ifdef _LP64 - if (using_class_space()) { - char* cds_end = (char*)(cds_address + cds_total); - cds_end = (char *)align_ptr_up(cds_end, _reserve_alignment); - // If UseCompressedClassPointers is set then allocate the metaspace area - // above the heap and above the CDS area (if it exists). - allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address); - // Map the shared string space after compressed pointers - // because it relies on compressed class pointers setting to work - mapinfo->map_string_regions(); - } -#endif // _LP64 + if (JvmtiExport::should_post_class_file_load_hook()) { + // Currently CDS does not support JVMTI CFLH when loading shared class. + // If JvmtiExport::should_post_class_file_load_hook is already enabled, + // just disable UseSharedSpaces. + FileMapInfo::fail_continue("Tool agent requires sharing to be disabled."); + delete mapinfo; } else { - assert(!mapinfo->is_open() && !UseSharedSpaces, - "archive file not closed or shared spaces not disabled."); + // Open the shared archive file, read and validate the header. If + // initialization fails, shared spaces [UseSharedSpaces] are + // disabled and the file is closed. + // Map in spaces now also + if (mapinfo->initialize() && MetaspaceShared::map_shared_spaces(mapinfo)) { + cds_total = FileMapInfo::shared_spaces_size(); + cds_address = (address)mapinfo->header()->region_addr(0); +#ifdef _LP64 + if (using_class_space()) { + char* cds_end = (char*)(cds_address + cds_total); + cds_end = (char *)align_ptr_up(cds_end, _reserve_alignment); + // If UseCompressedClassPointers is set then allocate the metaspace area + // above the heap and above the CDS area (if it exists). + allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address); + // Map the shared string space after compressed pointers + // because it relies on compressed class pointers setting to work + mapinfo->map_string_regions(); + } +#endif // _LP64 + } else { + assert(!mapinfo->is_open() && !UseSharedSpaces, + "archive file not closed or shared spaces not disabled."); + } } -#endif // INCLUDE_CDS } +#endif // INCLUDE_CDS #ifdef _LP64 if (!UseSharedSpaces && using_class_space()) { From 8663231fb498fd6a509b27f11551bd1976e8311f Mon Sep 17 00:00:00 2001 From: Boris Molodenkov Date: Wed, 20 Jul 2016 14:47:53 +0300 Subject: [PATCH 075/108] 8160119: Utils.tryFindJvmPid sometimes find incorrect pid Fixed pattern Reviewed-by: iignatyev, dholmes --- hotspot/test/testlibrary/jdk/test/lib/Utils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hotspot/test/testlibrary/jdk/test/lib/Utils.java b/hotspot/test/testlibrary/jdk/test/lib/Utils.java index 8ad11fdcbb5..6925f73d0e4 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/Utils.java +++ b/hotspot/test/testlibrary/jdk/test/lib/Utils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -317,8 +317,8 @@ public final class Utils { output = ProcessTools.executeProcess(jcmdLauncher.getCommand()); output.shouldHaveExitValue(0); - // Search for a line starting with numbers (pid), follwed by the key. - Pattern pattern = Pattern.compile("([0-9]+)\\s.*(" + key + ").*\\r?\\n"); + // Search for a line starting with numbers (pid), followed by the key. + Pattern pattern = Pattern.compile("^([0-9]+)\\s.*(" + key + ")", Pattern.MULTILINE); Matcher matcher = pattern.matcher(output.getStdout()); int pid = -1; From 4f554660a01b2a9a27b812c35be98567c6745387 Mon Sep 17 00:00:00 2001 From: Mikael Gerdin Date: Thu, 21 Jul 2016 14:06:22 +0200 Subject: [PATCH 076/108] 8161915: Linking gtestLauncher may end up linking with non-gtest libjvm Reviewed-by: dholmes, ehelin --- hotspot/make/lib/CompileGtest.gmk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/make/lib/CompileGtest.gmk b/hotspot/make/lib/CompileGtest.gmk index 2a052a10743..803413b8402 100644 --- a/hotspot/make/lib/CompileGtest.gmk +++ b/hotspot/make/lib/CompileGtest.gmk @@ -104,7 +104,7 @@ $(eval $(call SetupNativeCompilation, BUILD_GTEST_LAUNCHER, \ -I$(GTEST_FRAMEWORK_SRC)/include, \ CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \ CXXFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \ - LDFLAGS := $(LDFLAGS_TESTEXE), \ + LDFLAGS := $(LDFLAGS_JDKEXE), \ LDFLAGS_unix := -L$(JVM_OUTPUTDIR)/gtest $(call SET_SHARED_LIBRARY_ORIGIN), \ LDFLAGS_solaris := -library=stlport4, \ LIBS_unix := -ljvm, \ From 92110548e8e099f079834e1c997944e651818bca Mon Sep 17 00:00:00 2001 From: Dmitry Fazunenko Date: Thu, 21 Jul 2016 17:12:35 +0400 Subject: [PATCH 077/108] 8161552: Test issue: VM init failed: GC triggered before VM initialization completed. Try increasing NewSize, current value 768K Reviewed-by: tschatzl, jmasa, zmajo --- hotspot/test/gc/TestSmallHeap.java | 16 +++++++++++----- .../test/gc/arguments/TestMaxHeapSizeTools.java | 2 -- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/hotspot/test/gc/TestSmallHeap.java b/hotspot/test/gc/TestSmallHeap.java index a58fa8c4e28..9b791a54eb6 100644 --- a/hotspot/test/gc/TestSmallHeap.java +++ b/hotspot/test/gc/TestSmallHeap.java @@ -34,7 +34,7 @@ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestSmallHeap */ -/* Note: It would be nice to verify the minimal supported heap size (2m) here, +/* Note: It would be nice to verify the minimal supported heap size here, * but we align the heap size based on the card table size. And the card table * size is aligned based on the minimal pages size provided by the os. This * means that on most platforms, where the minimal page size is 4k, we get a @@ -43,14 +43,18 @@ * we get a minimal heap size of 32m. We never use large pages for the card table. * * There is also no check in the VM for verifying that the maximum heap size - * is larger than the supported minimal heap size. This means that specifying - * -Xmx1m on the command line is fine but will give a heap of 2m (or 4m or 32m). + * is larger than the supported minimal heap size. * - * To work around these rather strange behaviors this test uses -Xmx2m but then + * To work around these behaviors this test uses -Xmx4m but then * calculates what the expected heap size should be. The calculation is a * simplified version of the code in the VM. We assume that the card table will * use one page. Each byte in the card table corresponds to 512 bytes on the heap. * So, the expected heap size is page_size * 512. + * + * There is no formal requirement for the minimal value of the maximum heap size + * the VM should support. In most cases the VM could start with -Xmx2m. + * But with 2m limit GC could be triggered before VM initialization completed. + * Therefore we start the VM with 4M heap. */ import jdk.test.lib.Asserts; @@ -79,9 +83,10 @@ public class TestSmallHeap { } private static void verifySmallHeapSize(String gc, long expectedMaxHeap) throws Exception { + long minMaxHeap = 4 * 1024 * 1024; LinkedList vmOptions = new LinkedList<>(); vmOptions.add(gc); - vmOptions.add("-Xmx2m"); + vmOptions.add("-Xmx" + minMaxHeap); vmOptions.add("-XX:+PrintFlagsFinal"); vmOptions.add(VerifyHeapSize.class.getName()); @@ -89,6 +94,7 @@ public class TestSmallHeap { OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); analyzer.shouldHaveExitValue(0); + expectedMaxHeap = Math.max(expectedMaxHeap, minMaxHeap); long maxHeapSize = Long.parseLong(analyzer.firstMatch("MaxHeapSize.+=\\s+(\\d+)",1)); long actualHeapSize = Long.parseLong(analyzer.firstMatch(VerifyHeapSize.actualMsg + "(\\d+)",1)); Asserts.assertEQ(maxHeapSize, expectedMaxHeap); diff --git a/hotspot/test/gc/arguments/TestMaxHeapSizeTools.java b/hotspot/test/gc/arguments/TestMaxHeapSizeTools.java index 46bd3334c42..69bb75d00fe 100644 --- a/hotspot/test/gc/arguments/TestMaxHeapSizeTools.java +++ b/hotspot/test/gc/arguments/TestMaxHeapSizeTools.java @@ -106,7 +106,6 @@ class TestMaxHeapSizeTools { } public static void checkGenMaxHeapErgo(String gcflag) throws Exception { - TestMaxHeapSizeTools.checkGenMaxHeapSize(gcflag, 3); TestMaxHeapSizeTools.checkGenMaxHeapSize(gcflag, 4); TestMaxHeapSizeTools.checkGenMaxHeapSize(gcflag, 5); } @@ -132,7 +131,6 @@ class TestMaxHeapSizeTools { } private static void checkValidInitialMaxHeapCombinations(String gcflag) throws Exception { - expectValid(new String[] { gcflag, "-XX:MaxHeapSize=2048K", "-version" }); expectValid(new String[] { gcflag, "-XX:InitialHeapSize=4M", "-XX:MaxHeapSize=8M", "-version" }); expectValid(new String[] { gcflag, "-XX:MaxHeapSize=8M", "-XX:InitialHeapSize=4M", "-version" }); expectValid(new String[] { gcflag, "-XX:MaxHeapSize=4M", "-XX:InitialHeapSize=4M", "-version" }); From 44d9cb476f77df887d5d87e866181e0926a40d48 Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Thu, 21 Jul 2016 16:29:21 +0200 Subject: [PATCH 078/108] 8161947: runtime/Unsafe/GetUnsafe.java is failing on jdk9/dev Reviewed-by: alanb, dholmes --- hotspot/test/runtime/Unsafe/GetUnsafe.java | 45 ---------------------- 1 file changed, 45 deletions(-) delete mode 100644 hotspot/test/runtime/Unsafe/GetUnsafe.java diff --git a/hotspot/test/runtime/Unsafe/GetUnsafe.java b/hotspot/test/runtime/Unsafe/GetUnsafe.java deleted file mode 100644 index 64ad19d8bdd..00000000000 --- a/hotspot/test/runtime/Unsafe/GetUnsafe.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2015, 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 - * @summary Verifies that getUnsafe() actually throws SecurityException when unsafeAccess is prohibited. - * @library /testlibrary - * @modules java.base/jdk.internal.misc - * @run main GetUnsafe - */ - -import jdk.internal.misc.Unsafe; -import static jdk.test.lib.Asserts.*; - -public class GetUnsafe { - public static void main(String args[]) throws Exception { - try { - Unsafe unsafe = Unsafe.getUnsafe(); - } catch (SecurityException e) { - // Expected - return; - } - throw new RuntimeException("Did not get expected SecurityException"); - } -} From 0bcdf4f15487e83b787bf6865a00f3c7d4018fd6 Mon Sep 17 00:00:00 2001 From: Calvin Cheung Date: Thu, 21 Jul 2016 19:29:33 -0700 Subject: [PATCH 079/108] 8161539: 8159666 breaks minimal VM Replaces the shouldNotReachHere() with an assert Reviewed-by: coleenp, dholmes, cjplummer, gziemski --- hotspot/src/share/vm/oops/instanceKlass.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp index 9a690392908..cdcc18eabac 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp @@ -786,7 +786,9 @@ public: static void purge_previous_versions(InstanceKlass* ik) { return; }; static bool has_previous_versions() { return false; } - void set_cached_class_file(JvmtiCachedClassFileData *data) { ShouldNotReachHere(); } + void set_cached_class_file(JvmtiCachedClassFileData *data) { + assert(data == NULL, "unexpected call with JVMTI disabled"); + } JvmtiCachedClassFileData * get_cached_class_file() { return (JvmtiCachedClassFileData *)NULL; } #endif // INCLUDE_JVMTI From 73a516d68e155f890c9fc3883e9cb1ba9cd8ccca Mon Sep 17 00:00:00 2001 From: Jini George Date: Fri, 22 Jul 2016 02:36:39 -0700 Subject: [PATCH 080/108] 8145627: sun.jvm.hotspot.oops.InstanceKlass::getSize() returns the incorrect size and has no test Fix the size and add a test Reviewed-by: sspitsyn --- .../sun/jvm/hotspot/oops/InstanceKlass.java | 10 +- .../sa/TestInstanceKlassSize.java | 198 ++++++++++++++++++ .../sa/TestInstanceKlassSizeForInterface.java | 185 ++++++++++++++++ 3 files changed, 392 insertions(+), 1 deletion(-) create mode 100644 hotspot/test/serviceability/sa/TestInstanceKlassSize.java create mode 100644 hotspot/test/serviceability/sa/TestInstanceKlassSizeForInterface.java diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java index de1221628ad..79ae9497496 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java @@ -242,7 +242,15 @@ public class InstanceKlass extends Klass { } public long getSize() { - return alignSize(getHeaderSize() + getVtableLen() + getItableLen() + getNonstaticOopMapSize()); + long wordLength = VM.getVM().getBytesPerWord(); + long size = getHeaderSize() + + (getVtableLen() + + getItableLen() + + getNonstaticOopMapSize()) * wordLength; + if (isInterface()) { + size += wordLength; + } + return alignSize(size); } public static long getHeaderSize() { return headerSize; } diff --git a/hotspot/test/serviceability/sa/TestInstanceKlassSize.java b/hotspot/test/serviceability/sa/TestInstanceKlassSize.java new file mode 100644 index 00000000000..5d13df401df --- /dev/null +++ b/hotspot/test/serviceability/sa/TestInstanceKlassSize.java @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2015, 2016, 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. + */ + +import sun.jvm.hotspot.HotSpotAgent; +import sun.jvm.hotspot.utilities.SystemDictionaryHelper; +import sun.jvm.hotspot.debugger.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import jdk.test.lib.JDKToolLauncher; +import jdk.test.lib.Platform; +import jdk.test.lib.ProcessTools; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.Utils; +import jdk.test.lib.apps.LingeredApp; +import jdk.test.lib.Asserts; + +import java.io.*; +import java.util.*; + +/* + * @test + * @library /test/lib/share/classes + * @library /testlibrary + * @build jdk.test.lib.* + * @build jdk.test.lib.apps.* + * @modules java.base/jdk.internal.misc + * @modules jdk.hotspot.agent + * @modules jdk.hotspot.agent/sun.jvm.hotspot + * @modules jdk.hotspot.agent/sun.jvm.hotspot.utilities + * @modules jdk.hotspot.agent/sun.jvm.hotspot.oops + * @compile -XDignore.symbol.file=true -Xmodule:jdk.hotspot.agent TestInstanceKlassSize.java + * @run main/othervm TestInstanceKlassSize + */ + +public class TestInstanceKlassSize { + + private static String getJcmdInstanceKlassSize(OutputAnalyzer output, + String instanceKlassName) { + for (String s : output.asLines()) { + if (s.contains(instanceKlassName)) { + String tokens[]; + System.out.println(s); + tokens = s.split("\\s+"); + return tokens[3]; + } + } + return null; + } + + private static OutputAnalyzer jcmd(Long pid, + String... toolArgs) throws Exception { + ProcessBuilder processBuilder = new ProcessBuilder(); + JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jcmd"); + launcher.addToolArg(Long.toString(pid)); + if (toolArgs != null) { + for (String toolArg : toolArgs) { + launcher.addToolArg(toolArg); + } + } + + processBuilder.command(launcher.getCommand()); + System.out.println( + processBuilder.command().stream().collect(Collectors.joining(" "))); + return ProcessTools.executeProcess(processBuilder); + } + + private static void startMeWithArgs() throws Exception { + + LingeredApp app = null; + OutputAnalyzer output = null; + try { + List vmArgs = new ArrayList(); + vmArgs.add("-XX:+UnlockDiagnosticVMOptions"); + vmArgs.add("-XX:+UsePerfData"); + vmArgs.addAll(Utils.getVmOptions()); + app = LingeredApp.startApp(vmArgs); + System.out.println ("Started LingeredApp with pid " + app.getPid()); + } catch (Exception ex) { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + try { + String[] instanceKlassNames = new String[] { + " java.lang.Object", + " java.util.Vector", + " sun.util.PreHashedMap", + " java.lang.String", + " java.lang.Thread", + " java.lang.Byte", + }; + String[] toolArgs = { + "-XX:+UnlockDiagnosticVMOptions", + "-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED", + "-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED", + "-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED", + "TestInstanceKlassSize", + Long.toString(app.getPid()) + }; + + OutputAnalyzer jcmdOutput = jcmd( + app.getPid(), + "GC.class_stats", "VTab,ITab,OopMap,KlassBytes"); + ProcessBuilder processBuilder = ProcessTools + .createJavaProcessBuilder(toolArgs); + output = ProcessTools.executeProcess(processBuilder); + System.out.println(output.getOutput()); + output.shouldHaveExitValue(0); + + // Check whether the size matches that which jcmd outputs + for (String instanceKlassName : instanceKlassNames) { + System.out.println ("Trying to match for" + instanceKlassName); + String jcmdInstanceKlassSize = getJcmdInstanceKlassSize( + jcmdOutput, + instanceKlassName); + for (String s : output.asLines()) { + if (s.contains(instanceKlassName)) { + Asserts.assertTrue( + s.contains(jcmdInstanceKlassSize), + "The size computed by SA for" + + instanceKlassName + " does not match."); + } + } + } + } finally { + LingeredApp.stopApp(app); + } + } + + private static void SAInstanceKlassSize(int pid, + String[] SAInstanceKlassNames) { + HotSpotAgent agent = new HotSpotAgent(); + try { + agent.attach(pid); + } + catch (DebuggerException e) { + System.out.println(e.getMessage()); + System.err.println("Unable to connect to process ID: " + pid); + + agent.detach(); + e.printStackTrace(); + } + + for (String SAInstanceKlassName : SAInstanceKlassNames) { + Long size = SystemDictionaryHelper.findInstanceKlass( + SAInstanceKlassName).getSize(); + System.out.println("SA: The size of " + SAInstanceKlassName + + " is " + size); + } + agent.detach(); + } + + public static void main(String[] args) throws Exception { + + if (!Platform.shouldSAAttach()) { + System.out.println("SA attach not expected to work - test skipped."); + return; + } + + if (args == null || args.length == 0) { + System.out.println ("No args run. Starting with args now."); + startMeWithArgs(); + } else { + String[] SAInstanceKlassNames = new String[] { + "java.lang.Object", + "java.util.Vector", + "sun.util.PreHashedMap", + "java.lang.String", + "java.lang.Thread", + "java.lang.Byte" + }; + SAInstanceKlassSize(Integer.parseInt(args[0]), SAInstanceKlassNames); + } + } +} + diff --git a/hotspot/test/serviceability/sa/TestInstanceKlassSizeForInterface.java b/hotspot/test/serviceability/sa/TestInstanceKlassSizeForInterface.java new file mode 100644 index 00000000000..085ac246664 --- /dev/null +++ b/hotspot/test/serviceability/sa/TestInstanceKlassSizeForInterface.java @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2015, 2016, 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. + */ + +import sun.jvm.hotspot.HotSpotAgent; +import sun.jvm.hotspot.utilities.SystemDictionaryHelper; +import sun.jvm.hotspot.oops.InstanceKlass; +import sun.jvm.hotspot.debugger.*; + +import jdk.test.lib.JDKToolLauncher; +import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.Platform; +import jdk.test.lib.ProcessTools; +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.Utils; +import jdk.test.lib.Asserts; + +/* + * @test + * @library /test/lib/share/classes + * @library /testlibrary + * @build jdk.test.lib.* + * @build jdk.test.lib.apps.* + * @modules java.base/jdk.internal.misc + * @modules jdk.hotspot.agent + * @modules jdk.hotspot.agent/sun.jvm.hotspot + * @modules jdk.hotspot.agent/sun.jvm.hotspot.utilities + * @modules jdk.hotspot.agent/sun.jvm.hotspot.oops + * @compile -XDignore.symbol.file=true -Xmodule:jdk.hotspot.agent TestInstanceKlassSizeForInterface.java + * @run main/othervm TestInstanceKlassSizeForInterface + */ + +interface Language { + static final long nbrOfWords = 99999; + public abstract long getNbrOfWords(); +} + +class ParselTongue implements Language { + public long getNbrOfWords() { + return nbrOfWords * 4; + } +} + +public class TestInstanceKlassSizeForInterface { + + private static void SAInstanceKlassSize(int pid, + String[] instanceKlassNames) { + + HotSpotAgent agent = new HotSpotAgent(); + try { + agent.attach((int)pid); + } + catch (DebuggerException e) { + System.out.println(e.getMessage()); + System.err.println("Unable to connect to process ID: " + pid); + + agent.detach(); + e.printStackTrace(); + } + + for (String instanceKlassName : instanceKlassNames) { + InstanceKlass iKlass = SystemDictionaryHelper.findInstanceKlass( + instanceKlassName); + System.out.println("SA: The size of " + instanceKlassName + + " is " + iKlass.getSize()); + } + agent.detach(); + } + + private static String getJcmdInstanceKlassSize(OutputAnalyzer output, + String instanceKlassName) { + for (String s : output.asLines()) { + if (s.contains(instanceKlassName)) { + String tokens[]; + System.out.println(s); + tokens = s.split("\\s+"); + return tokens[3]; + } + } + return null; + } + + private static void createAnotherToAttach( + String[] instanceKlassNames) throws Exception { + + ProcessBuilder pb = new ProcessBuilder(); + + // Grab the pid from the current java process and pass it + String[] toolArgs = { + "-XX:+UnlockDiagnosticVMOptions", + "-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED", + "-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED", + "-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED", + "TestInstanceKlassSizeForInterface", + Long.toString(ProcessTools.getProcessId()) + }; + + pb.command(new String[] { + JDKToolFinder.getJDKTool("jcmd"), + Long.toString(ProcessTools.getProcessId()), + "GC.class_stats", + "VTab,ITab,OopMap,KlassBytes" + } + ); + + // Start a new process to attach to the current process + ProcessBuilder processBuilder = ProcessTools + .createJavaProcessBuilder(toolArgs); + OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder); + System.out.println(SAOutput.getOutput()); + + OutputAnalyzer jcmdOutput = new OutputAnalyzer(pb.start()); + System.out.println(jcmdOutput.getOutput()); + + // Match the sizes from both the output streams + for (String instanceKlassName : instanceKlassNames) { + System.out.println ("Trying to match for " + instanceKlassName); + String jcmdInstanceKlassSize = getJcmdInstanceKlassSize( + jcmdOutput, + instanceKlassName); + for (String s : SAOutput.asLines()) { + if (s.contains(instanceKlassName)) { + Asserts.assertTrue( + s.contains(jcmdInstanceKlassSize), + "The size computed by SA for " + + instanceKlassName + " does not match."); + } + } + } + } + + public static void main (String... args) throws Exception { + String[] instanceKlassNames = new String[] { + "Language", + "ParselTongue", + "TestInstanceKlassSizeForInterface$1" + }; + + if (!Platform.shouldSAAttach()) { + System.out.println( + "SA attach not expected to work - test skipped."); + return; + } + + if ( args == null || args.length == 0 ) { + ParselTongue lang = new ParselTongue(); + + Language ventro = new Language() { + public long getNbrOfWords() { + return nbrOfWords * 8; + } + }; + + // Not tested at this point. The test needs to be enhanced + // later to test for the sizes of the Lambda MetaFactory + // generated anonymous classes too. (After JDK-8160228 gets + // fixed.) + Runnable r2 = () -> System.out.println("Hello world!"); + r2.run(); + + createAnotherToAttach(instanceKlassNames); + } else { + SAInstanceKlassSize(Integer.parseInt(args[0]), instanceKlassNames); + } + } +} From b630a3ff477b894ed333ce143bb6db1bb60bf731 Mon Sep 17 00:00:00 2001 From: Erik Helin Date: Thu, 21 Jul 2016 14:55:54 +0200 Subject: [PATCH 081/108] 8159464: DumpHeap.java hits assert in G1 code Reviewed-by: mgerdin, tschatzl --- .../src/share/vm/gc/g1/g1DefaultPolicy.cpp | 137 ++++++++++-------- 1 file changed, 76 insertions(+), 61 deletions(-) diff --git a/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp index 98c3f989387..454f73bc0c6 100644 --- a/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp +++ b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp @@ -97,47 +97,64 @@ void G1DefaultPolicy::note_gc_start() { phase_times()->note_gc_start(); } -bool G1DefaultPolicy::predict_will_fit(uint young_length, - double base_time_ms, - uint base_free_regions, - double target_pause_time_ms) const { - if (young_length >= base_free_regions) { - // end condition 1: not enough space for the young regions - return false; +class G1YoungLengthPredictor VALUE_OBJ_CLASS_SPEC { + const bool _during_cm; + const double _base_time_ms; + const double _base_free_regions; + const double _target_pause_time_ms; + const G1DefaultPolicy* const _policy; + + public: + G1YoungLengthPredictor(bool during_cm, + double base_time_ms, + double base_free_regions, + double target_pause_time_ms, + const G1DefaultPolicy* policy) : + _during_cm(during_cm), + _base_time_ms(base_time_ms), + _base_free_regions(base_free_regions), + _target_pause_time_ms(target_pause_time_ms), + _policy(policy) {} + + bool will_fit(uint young_length) const { + if (young_length >= _base_free_regions) { + // end condition 1: not enough space for the young regions + return false; + } + + const double accum_surv_rate = _policy->accum_yg_surv_rate_pred((int) young_length - 1); + const size_t bytes_to_copy = + (size_t) (accum_surv_rate * (double) HeapRegion::GrainBytes); + const double copy_time_ms = + _policy->analytics()->predict_object_copy_time_ms(bytes_to_copy, _during_cm); + const double young_other_time_ms = _policy->analytics()->predict_young_other_time_ms(young_length); + const double pause_time_ms = _base_time_ms + copy_time_ms + young_other_time_ms; + if (pause_time_ms > _target_pause_time_ms) { + // end condition 2: prediction is over the target pause time + return false; + } + + const size_t free_bytes = (_base_free_regions - young_length) * HeapRegion::GrainBytes; + + // When copying, we will likely need more bytes free than is live in the region. + // Add some safety margin to factor in the confidence of our guess, and the + // natural expected waste. + // (100.0 / G1ConfidencePercent) is a scale factor that expresses the uncertainty + // of the calculation: the lower the confidence, the more headroom. + // (100 + TargetPLABWastePct) represents the increase in expected bytes during + // copying due to anticipated waste in the PLABs. + const double safety_factor = (100.0 / G1ConfidencePercent) * (100 + TargetPLABWastePct) / 100.0; + const size_t expected_bytes_to_copy = (size_t)(safety_factor * bytes_to_copy); + + if (expected_bytes_to_copy > free_bytes) { + // end condition 3: out-of-space + return false; + } + + // success! + return true; } - - double accum_surv_rate = accum_yg_surv_rate_pred((int) young_length - 1); - size_t bytes_to_copy = - (size_t) (accum_surv_rate * (double) HeapRegion::GrainBytes); - double copy_time_ms = _analytics->predict_object_copy_time_ms(bytes_to_copy, - collector_state()->during_concurrent_mark()); - double young_other_time_ms = _analytics->predict_young_other_time_ms(young_length); - double pause_time_ms = base_time_ms + copy_time_ms + young_other_time_ms; - if (pause_time_ms > target_pause_time_ms) { - // end condition 2: prediction is over the target pause time - return false; - } - - size_t free_bytes = (base_free_regions - young_length) * HeapRegion::GrainBytes; - - // When copying, we will likely need more bytes free than is live in the region. - // Add some safety margin to factor in the confidence of our guess, and the - // natural expected waste. - // (100.0 / G1ConfidencePercent) is a scale factor that expresses the uncertainty - // of the calculation: the lower the confidence, the more headroom. - // (100 + TargetPLABWastePct) represents the increase in expected bytes during - // copying due to anticipated waste in the PLABs. - double safety_factor = (100.0 / G1ConfidencePercent) * (100 + TargetPLABWastePct) / 100.0; - size_t expected_bytes_to_copy = (size_t)(safety_factor * bytes_to_copy); - - if (expected_bytes_to_copy > free_bytes) { - // end condition 3: out-of-space - return false; - } - - // success! - return true; -} +}; void G1DefaultPolicy::record_new_heap_size(uint new_number_of_regions) { // re-calculate the necessary reserve @@ -279,31 +296,32 @@ G1DefaultPolicy::calculate_young_list_target_length(size_t rs_lengths, assert(desired_max_length > base_min_length, "invariant"); uint max_young_length = desired_max_length - base_min_length; - double target_pause_time_ms = _mmu_tracker->max_gc_time() * 1000.0; - double survivor_regions_evac_time = predict_survivor_regions_evac_time(); - size_t pending_cards = _analytics->predict_pending_cards(); - size_t adj_rs_lengths = rs_lengths + _analytics->predict_rs_length_diff(); - size_t scanned_cards = _analytics->predict_card_num(adj_rs_lengths, /* gcs_are_young */ true); - double base_time_ms = + const double target_pause_time_ms = _mmu_tracker->max_gc_time() * 1000.0; + const double survivor_regions_evac_time = predict_survivor_regions_evac_time(); + const size_t pending_cards = _analytics->predict_pending_cards(); + const size_t adj_rs_lengths = rs_lengths + _analytics->predict_rs_length_diff(); + const size_t scanned_cards = _analytics->predict_card_num(adj_rs_lengths, /* gcs_are_young */ true); + const double base_time_ms = predict_base_elapsed_time_ms(pending_cards, scanned_cards) + survivor_regions_evac_time; - uint available_free_regions = _free_regions_at_end_of_collection; - uint base_free_regions = 0; - if (available_free_regions > _reserve_regions) { - base_free_regions = available_free_regions - _reserve_regions; - } + const uint available_free_regions = _free_regions_at_end_of_collection; + const uint base_free_regions = + available_free_regions > _reserve_regions ? available_free_regions - _reserve_regions : 0; // Here, we will make sure that the shortest young length that // makes sense fits within the target pause time. - if (predict_will_fit(min_young_length, base_time_ms, - base_free_regions, target_pause_time_ms)) { + G1YoungLengthPredictor p(collector_state()->during_concurrent_mark(), + base_time_ms, + base_free_regions, + target_pause_time_ms, + this); + if (p.will_fit(min_young_length)) { // The shortest young length will fit into the target pause time; // we'll now check whether the absolute maximum number of young // regions will fit in the target pause time. If not, we'll do // a binary search between min_young_length and max_young_length. - if (predict_will_fit(max_young_length, base_time_ms, - base_free_regions, target_pause_time_ms)) { + if (p.will_fit(max_young_length)) { // The maximum young length will fit into the target pause time. // We are done so set min young length to the maximum length (as // the result is assumed to be returned in min_young_length). @@ -328,8 +346,7 @@ G1DefaultPolicy::calculate_young_list_target_length(size_t rs_lengths, uint diff = (max_young_length - min_young_length) / 2; while (diff > 0) { uint young_length = min_young_length + diff; - if (predict_will_fit(young_length, base_time_ms, - base_free_regions, target_pause_time_ms)) { + if (p.will_fit(young_length)) { min_young_length = young_length; } else { max_young_length = young_length; @@ -344,12 +361,10 @@ G1DefaultPolicy::calculate_young_list_target_length(size_t rs_lengths, assert(min_young_length < max_young_length, "otherwise we should have discovered that max_young_length " "fits into the pause target and not done the binary search"); - assert(predict_will_fit(min_young_length, base_time_ms, - base_free_regions, target_pause_time_ms), + assert(p.will_fit(min_young_length), "min_young_length, the result of the binary search, should " "fit into the pause target"); - assert(!predict_will_fit(min_young_length + 1, base_time_ms, - base_free_regions, target_pause_time_ms), + assert(!p.will_fit(min_young_length + 1), "min_young_length, the result of the binary search, should be " "optimal, so no larger length should fit into the pause target"); } From 1a81918931a065de37c1ff389ca2fc1d1dae3f50 Mon Sep 17 00:00:00 2001 From: Alexander Kulyakhtin Date: Fri, 22 Jul 2016 16:55:55 +0300 Subject: [PATCH 082/108] 8153978: New test to verify the modules info as returned by the JVMTI A new JVMTI test Reviewed-by: ctornqvi, sspitsyn --- hotspot/make/test/JtregNative.gmk | 1 + .../JvmtiGetAllModulesTest.java | 130 ++++++++++++++++++ .../libJvmtiGetAllModulesTest.c | 67 +++++++++ 3 files changed, 198 insertions(+) create mode 100644 hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java create mode 100644 hotspot/test/serviceability/jvmti/GetModulesInfo/libJvmtiGetAllModulesTest.c diff --git a/hotspot/make/test/JtregNative.gmk b/hotspot/make/test/JtregNative.gmk index 18972ee8a90..6af71c9d3de 100644 --- a/hotspot/make/test/JtregNative.gmk +++ b/hotspot/make/test/JtregNative.gmk @@ -53,6 +53,7 @@ BUILD_HOTSPOT_JTREG_NATIVE_SRC := \ $(HOTSPOT_TOPDIR)/test/compiler/native \ $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/GetNamedModule \ $(HOTSPOT_TOPDIR)/test/testlibrary/jvmti \ + $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/GetModulesInfo \ # # Add conditional directories here when needed. diff --git a/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java b/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java new file mode 100644 index 00000000000..90855ba9f01 --- /dev/null +++ b/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2016, 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 + * @summary Verifies the JVMTI GetAllModules API + * @library /testlibrary + * @run main/othervm -agentlib:JvmtiGetAllModulesTest JvmtiGetAllModulesTest + * + */ +import java.lang.reflect.Layer; +import java.lang.reflect.Module; +import java.lang.module.ModuleReference; +import java.lang.module.ModuleFinder; +import java.lang.module.ModuleReader; +import java.lang.module.ModuleDescriptor; +import java.lang.module.Configuration; +import java.util.Arrays; +import java.util.Set; +import java.util.Map; +import java.util.function.Supplier; +import java.util.Objects; +import java.util.Optional; +import java.net.URI; +import java.util.HashSet; +import java.util.HashMap; +import java.util.stream.Collectors; +import jdk.test.lib.Asserts; + +public class JvmtiGetAllModulesTest { + + private static native Module[] getModulesNative(); + + private static Set getModulesJVMTI() { + + Set modules = Arrays.stream(getModulesNative()).collect(Collectors.toSet()); + + // JVMTI reports unnamed modules, Java API does not + // remove the unnamed modules here, so the resulting report can be expected + // to be equal to what Java reports + modules.removeIf(mod -> !mod.isNamed()); + + return modules; + } + + public static void main(String[] args) throws Exception { + + final String MY_MODULE_NAME = "myModule"; + + // Verify that JVMTI reports exactly the same info as Java regarding the named modules + Asserts.assertEquals(Layer.boot().modules(), getModulesJVMTI()); + + // Load a new named module + ModuleDescriptor descriptor + = new ModuleDescriptor.Builder(MY_MODULE_NAME) + .build(); + ModuleFinder finder = finderOf(descriptor); + ClassLoader loader = new ClassLoader() {}; + Configuration parent = Layer.boot().configuration(); + Configuration cf = parent.resolveRequires(finder, ModuleFinder.of(), Set.of(MY_MODULE_NAME)); + Layer my = Layer.boot().defineModules(cf, m -> loader); + + // Verify that the loaded module is indeed reported by JVMTI + Set jvmtiModules = getModulesJVMTI(); + for (Module mod : my.modules()) { + if (!jvmtiModules.contains(mod)) { + throw new RuntimeException("JVMTI did not report the loaded named module: " + mod.getName()); + } + } + + } + + /** + * Returns a ModuleFinder that finds modules with the given module + * descriptors. + */ + static ModuleFinder finderOf(ModuleDescriptor... descriptors) { + + // Create a ModuleReference for each module + Map namesToReference = new HashMap<>(); + + for (ModuleDescriptor descriptor : descriptors) { + String name = descriptor.name(); + + URI uri = URI.create("module:/" + name); + + Supplier supplier = () -> { + throw new UnsupportedOperationException(); + }; + + ModuleReference mref = new ModuleReference(descriptor, uri, supplier); + + namesToReference.put(name, mref); + } + + return new ModuleFinder() { + @Override + public Optional find(String name) { + Objects.requireNonNull(name); + return Optional.ofNullable(namesToReference.get(name)); + } + + @Override + public Set findAll() { + return new HashSet<>(namesToReference.values()); + } + }; + } + +} diff --git a/hotspot/test/serviceability/jvmti/GetModulesInfo/libJvmtiGetAllModulesTest.c b/hotspot/test/serviceability/jvmti/GetModulesInfo/libJvmtiGetAllModulesTest.c new file mode 100644 index 00000000000..ed83d19784c --- /dev/null +++ b/hotspot/test/serviceability/jvmti/GetModulesInfo/libJvmtiGetAllModulesTest.c @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2016, 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. + */ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + static jvmtiEnv *jvmti = NULL; + + JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { + int err = (*jvm)->GetEnv(jvm, (void**) &jvmti, JVMTI_VERSION_9); + if (err != JNI_OK) { + return JNI_ERR; + } + return JNI_OK; + } + + JNIEXPORT jobjectArray JNICALL + Java_JvmtiGetAllModulesTest_getModulesNative(JNIEnv *env, jclass cls) { + + jvmtiError err; + jint modules_count = -1; + jobject* modules_ptr; + jobjectArray array = NULL; + int i = 0; + + err = (*jvmti)->GetAllModules(jvmti, &modules_count, &modules_ptr); + if (err != JVMTI_ERROR_NONE) { + return NULL; + } + + array = (*env)->NewObjectArray(env, modules_count, (*env)->FindClass(env, "java/lang/reflect/Module"), NULL); + + for (i = 0; i < modules_count; ++i) { + (*env)->SetObjectArrayElement(env, array, i, modules_ptr[i]); + } + + return array; + } + +#ifdef __cplusplus +} +#endif From c076e4284c332d26ca6bfa78d281127ed6cf16c1 Mon Sep 17 00:00:00 2001 From: Brent Christian Date: Fri, 22 Jul 2016 10:15:42 -0700 Subject: [PATCH 083/108] 8161028: GPL header missing comma after year Reviewed-by: dcubed --- hotspot/src/share/vm/prims/stackwalk.cpp | 2 +- hotspot/src/share/vm/prims/stackwalk.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/prims/stackwalk.cpp b/hotspot/src/share/vm/prims/stackwalk.cpp index 70f46f747d2..3cce63b69bd 100644 --- a/hotspot/src/share/vm/prims/stackwalk.cpp +++ b/hotspot/src/share/vm/prims/stackwalk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 diff --git a/hotspot/src/share/vm/prims/stackwalk.hpp b/hotspot/src/share/vm/prims/stackwalk.hpp index e222e623f6d..cbc4405df81 100644 --- a/hotspot/src/share/vm/prims/stackwalk.hpp +++ b/hotspot/src/share/vm/prims/stackwalk.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 From 4945fbd45909b6aa15f3239c895ce122dfcd5387 Mon Sep 17 00:00:00 2001 From: Max Ockner Date: Mon, 25 Jul 2016 09:40:31 -0400 Subject: [PATCH 084/108] 8038332: The trace event vm/class/load is not always being sent Added trace event vm/class/define Reviewed-by: coleenp, egahlin, acorn --- .../share/vm/classfile/systemDictionary.cpp | 18 ++++++++++++++++-- hotspot/src/share/vm/trace/traceevents.xml | 6 ++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index f9167b98d38..af777b2d9d8 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -655,6 +655,21 @@ static void post_class_load_event(const Ticks& start_time, #endif // INCLUDE_TRACE } +// utility function for class define event +static void class_define_event(instanceKlassHandle k) { +#if INCLUDE_TRACE + EventClassDefine event(UNTIMED); + if (event.should_commit()) { + event.set_definedClass(k()); + oop defining_class_loader = k->class_loader(); + event.set_definingClassLoader(defining_class_loader != NULL ? + defining_class_loader->klass() : (Klass*)NULL); + event.commit(); + } +#endif // INCLUDE_TRACE +} + + Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle class_loader, Handle protection_domain, @@ -1675,9 +1690,8 @@ void SystemDictionary::define_instance_class(instanceKlassHandle k, TRAPS) { JvmtiExport::post_class_load((JavaThread *) THREAD, k()); } - TRACE_KLASS_DEFINITION(k, THREAD); - + class_define_event(k); } // Support parallel classloading diff --git a/hotspot/src/share/vm/trace/traceevents.xml b/hotspot/src/share/vm/trace/traceevents.xml index 45b566f8c4b..10671cfc136 100644 --- a/hotspot/src/share/vm/trace/traceevents.xml +++ b/hotspot/src/share/vm/trace/traceevents.xml @@ -116,6 +116,12 @@ Declares a structure type that can be used in other events. + + + + + From da3339948e308d86b1d330c5aea42051e13a782c Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 13 Jul 2016 12:23:05 +0200 Subject: [PATCH 085/108] 8161258: Simplify including platform files Include patform files with macros cpu_header() etc. Do various cleanups of macro usages. Remove _64/_32 from adlc generated files and platform .hpp files. Merge stubRoutines_x86*.hpp. Remove empty mutex_* files. Reviewed-by: dholmes, coleenp, kbarrett --- hotspot/make/gensrc/GensrcAdlc.gmk | 30 ++-- hotspot/make/lib/CompileJvm.gmk | 11 +- hotspot/src/cpu/aarch64/vm/bytes_aarch64.hpp | 7 +- hotspot/src/cpu/aarch64/vm/copy_aarch64.hpp | 6 +- .../src/cpu/aarch64/vm/vm_version_aarch64.cpp | 8 +- hotspot/src/cpu/ppc/vm/bytes_ppc.hpp | 8 +- .../src/cpu/ppc/vm/globalDefinitions_ppc.hpp | 2 +- ...rp_masm_ppc_64.hpp => interp_masm_ppc.hpp} | 6 +- hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp | 2 +- hotspot/src/cpu/ppc/vm/ppc_64.ad | 24 --- hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp | 2 +- ...utines_ppc_64.hpp => stubRoutines_ppc.hpp} | 10 +- ...Table_ppc_64.hpp => templateTable_ppc.hpp} | 10 +- hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp | 2 +- hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp | 4 +- hotspot/src/cpu/x86/vm/bytes_x86.hpp | 18 +-- hotspot/src/cpu/x86/vm/copy_x86.hpp | 16 +- .../x86/vm/macroAssembler_x86.inline.hpp} | 15 +- .../cpu/x86/vm/register_definitions_x86.cpp | 4 +- hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp | 83 ++++++++++- .../src/cpu/x86/vm/stubRoutines_x86_32.hpp | 53 ------- .../src/cpu/x86/vm/stubRoutines_x86_64.hpp | 112 -------------- hotspot/src/cpu/zero/vm/bytes_zero.hpp | 10 +- .../zero/vm/macroAssembler_zero.hpp} | 15 +- .../zero/vm/macroAssembler_zero.inline.hpp} | 15 +- hotspot/src/os/aix/vm/mutex_aix.inline.hpp | 33 ----- hotspot/src/os/aix/vm/os_aix.cpp | 1 - hotspot/src/os/bsd/vm/mutex_bsd.inline.hpp | 37 ----- hotspot/src/os/bsd/vm/os_bsd.cpp | 1 - .../src/os/linux/vm/mutex_linux.inline.hpp | 37 ----- hotspot/src/os/linux/vm/os_linux.cpp | 1 - hotspot/src/os/posix/vm/os_posix.cpp | 27 ++-- hotspot/src/os/posix/vm/vmError_posix.cpp | 10 +- hotspot/src/os/solaris/vm/mutex_solaris.cpp | 36 ----- hotspot/src/os/solaris/vm/os_solaris.cpp | 1 - .../os/windows/vm/mutex_windows.inline.hpp | 32 ---- hotspot/src/os/windows/vm/os_windows.cpp | 1 - .../aix_ppc/vm/bytes_aix_ppc.inline.hpp} | 14 +- hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp | 1 - hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp | 1 - .../src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp | 1 - .../linux_aarch64/vm/os_linux_aarch64.cpp | 1 - .../src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp | 1 - .../os_cpu/linux_sparc/vm/os_linux_sparc.cpp | 1 - .../src/os_cpu/linux_x86/vm/os_linux_x86.cpp | 1 - .../os_cpu/linux_zero/vm/os_linux_zero.cpp | 1 - .../solaris_sparc/vm/os_solaris_sparc.cpp | 1 - .../os_cpu/solaris_x86/vm/os_solaris_x86.cpp | 1 - .../os_cpu/windows_x86/vm/os_windows_x86.cpp | 1 - hotspot/src/share/vm/asm/assembler.hpp | 23 +-- hotspot/src/share/vm/asm/assembler.inline.hpp | 21 +-- hotspot/src/share/vm/asm/codeBuffer.hpp | 20 +-- hotspot/src/share/vm/asm/macroAssembler.hpp | 22 +-- .../share/vm/asm/macroAssembler.inline.hpp | 22 +-- hotspot/src/share/vm/asm/register.hpp | 23 +-- hotspot/src/share/vm/c1/c1_Defs.hpp | 23 +-- hotspot/src/share/vm/c1/c1_FpuStackSim.hpp | 20 +-- hotspot/src/share/vm/c1/c1_FrameMap.hpp | 18 +-- hotspot/src/share/vm/c1/c1_LIRAssembler.hpp | 19 +-- hotspot/src/share/vm/c1/c1_LinearScan.hpp | 19 +-- hotspot/src/share/vm/c1/c1_MacroAssembler.hpp | 19 +-- hotspot/src/share/vm/c1/c1_globals.hpp | 34 +---- hotspot/src/share/vm/code/nativeInst.hpp | 23 +-- hotspot/src/share/vm/code/nmethod.cpp | 15 -- hotspot/src/share/vm/code/relocInfo.hpp | 20 +-- hotspot/src/share/vm/code/vmreg.hpp | 23 +-- hotspot/src/share/vm/code/vmreg.inline.hpp | 21 +-- .../src/share/vm/compiler/disassembler.cpp | 19 +-- .../src/share/vm/compiler/disassembler.hpp | 23 +-- .../vm/gc/g1/g1PageBasedVirtualSpace.cpp | 18 +-- .../shared/memset_with_concurrent_readers.hpp | 9 +- .../vm/interpreter/bytecodeInterpreter.hpp | 3 +- .../bytecodeInterpreter.inline.hpp | 5 +- .../share/vm/interpreter/cppInterpreter.hpp | 6 +- .../src/share/vm/interpreter/interp_masm.hpp | 17 +-- .../vm/interpreter/interpreterRuntime.hpp | 20 +-- .../templateInterpreterGenerator.cpp | 4 +- .../share/vm/interpreter/templateTable.hpp | 15 +- .../src/share/vm/jvmci/jvmciCodeInstaller.cpp | 29 +--- hotspot/src/share/vm/jvmci/jvmciRuntime.cpp | 7 +- .../src/share/vm/jvmci/vmStructs_jvmci.cpp | 20 +-- hotspot/src/share/vm/opto/ad.hpp | 21 +-- hotspot/src/share/vm/opto/c2_globals.hpp | 34 +---- hotspot/src/share/vm/opto/library_call.cpp | 4 +- hotspot/src/share/vm/opto/optoreg.hpp | 20 +-- hotspot/src/share/vm/prims/jni_md.h | 24 +-- hotspot/src/share/vm/prims/jvm.cpp | 15 -- hotspot/src/share/vm/prims/jvm.h | 18 +-- hotspot/src/share/vm/prims/methodHandles.hpp | 24 +-- .../src/share/vm/runtime/atomic.inline.hpp | 49 +----- hotspot/src/share/vm/runtime/frame.hpp | 22 +-- hotspot/src/share/vm/runtime/frame.inline.hpp | 29 +--- hotspot/src/share/vm/runtime/globals.hpp | 140 ++---------------- hotspot/src/share/vm/runtime/icache.hpp | 24 +-- .../src/share/vm/runtime/interfaceSupport.hpp | 18 +-- hotspot/src/share/vm/runtime/javaCalls.hpp | 23 +-- .../src/share/vm/runtime/javaFrameAnchor.hpp | 25 +--- hotspot/src/share/vm/runtime/mutex.cpp | 13 +- .../share/vm/runtime/orderAccess.inline.hpp | 51 +------ hotspot/src/share/vm/runtime/os.cpp | 2 +- hotspot/src/share/vm/runtime/os.hpp | 84 ++--------- hotspot/src/share/vm/runtime/os.inline.hpp | 18 +-- hotspot/src/share/vm/runtime/osThread.hpp | 19 +-- .../src/share/vm/runtime/prefetch.inline.hpp | 50 +------ hotspot/src/share/vm/runtime/registerMap.hpp | 22 +-- hotspot/src/share/vm/runtime/semaphore.hpp | 8 +- hotspot/src/share/vm/runtime/stubRoutines.hpp | 18 +-- hotspot/src/share/vm/runtime/thread.hpp | 40 +---- hotspot/src/share/vm/runtime/vmStructs.cpp | 74 +-------- hotspot/src/share/vm/runtime/vm_version.hpp | 17 +-- hotspot/src/share/vm/shark/sharkRuntime.cpp | 5 +- hotspot/src/share/vm/shark/shark_globals.hpp | 3 +- hotspot/src/share/vm/utilities/bytes.hpp | 23 +-- hotspot/src/share/vm/utilities/copy.hpp | 20 +-- .../share/vm/utilities/globalDefinitions.hpp | 20 +-- hotspot/src/share/vm/utilities/macros.hpp | 31 ++++ 116 files changed, 427 insertions(+), 1876 deletions(-) rename hotspot/src/cpu/ppc/vm/{interp_masm_ppc_64.hpp => interp_masm_ppc.hpp} (99%) delete mode 100644 hotspot/src/cpu/ppc/vm/ppc_64.ad rename hotspot/src/cpu/ppc/vm/{stubRoutines_ppc_64.hpp => stubRoutines_ppc.hpp} (88%) rename hotspot/src/cpu/ppc/vm/{templateTable_ppc_64.hpp => templateTable_ppc.hpp} (87%) rename hotspot/src/{os/bsd/vm/mutex_bsd.cpp => cpu/x86/vm/macroAssembler_x86.inline.hpp} (75%) delete mode 100644 hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp delete mode 100644 hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp rename hotspot/src/{os/linux/vm/mutex_linux.cpp => cpu/zero/vm/macroAssembler_zero.hpp} (75%) rename hotspot/src/{os/windows/vm/mutex_windows.cpp => cpu/zero/vm/macroAssembler_zero.inline.hpp} (75%) delete mode 100644 hotspot/src/os/aix/vm/mutex_aix.inline.hpp delete mode 100644 hotspot/src/os/bsd/vm/mutex_bsd.inline.hpp delete mode 100644 hotspot/src/os/linux/vm/mutex_linux.inline.hpp delete mode 100644 hotspot/src/os/solaris/vm/mutex_solaris.cpp delete mode 100644 hotspot/src/os/windows/vm/mutex_windows.inline.hpp rename hotspot/src/{os/solaris/vm/mutex_solaris.inline.hpp => os_cpu/aix_ppc/vm/bytes_aix_ppc.inline.hpp} (74%) diff --git a/hotspot/make/gensrc/GensrcAdlc.gmk b/hotspot/make/gensrc/GensrcAdlc.gmk index 16c1b671503..abe6fd44f57 100644 --- a/hotspot/make/gensrc/GensrcAdlc.gmk +++ b/hotspot/make/gensrc/GensrcAdlc.gmk @@ -156,10 +156,10 @@ ifeq ($(call check-jvm-feature, compiler2), true) $(call MakeDir, $(@D)) $(call ExecuteWithLog, $(ADLC_SUPPORT_DIR)/adlc_run, \ $(FIXPATH) $(ADLC_TOOL) $(ADLCFLAGS) $(SINGLE_AD_SRCFILE) \ - -c$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU).cpp \ - -h$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU).hpp \ - -a$(ADLC_SUPPORT_DIR)/dfa_$(HOTSPOT_TARGET_CPU).cpp \ - -v$(ADLC_SUPPORT_DIR)/adGlobals_$(HOTSPOT_TARGET_CPU).hpp) + -c$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU_ARCH).cpp \ + -h$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU_ARCH).hpp \ + -a$(ADLC_SUPPORT_DIR)/dfa_$(HOTSPOT_TARGET_CPU_ARCH).cpp \ + -v$(ADLC_SUPPORT_DIR)/adGlobals_$(HOTSPOT_TARGET_CPU_ARCH).hpp) $(TOUCH) $@ ############################################################################## @@ -167,17 +167,17 @@ ifeq ($(call check-jvm-feature, compiler2), true) # and postprocess them by fixing dummy #line directives. ADLC_GENERATED_FILES := $(addprefix $(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles/, \ - ad_$(HOTSPOT_TARGET_CPU).cpp \ - ad_$(HOTSPOT_TARGET_CPU).hpp \ - ad_$(HOTSPOT_TARGET_CPU)_clone.cpp \ - ad_$(HOTSPOT_TARGET_CPU)_expand.cpp \ - ad_$(HOTSPOT_TARGET_CPU)_format.cpp \ - ad_$(HOTSPOT_TARGET_CPU)_gen.cpp \ - ad_$(HOTSPOT_TARGET_CPU)_misc.cpp \ - ad_$(HOTSPOT_TARGET_CPU)_peephole.cpp \ - ad_$(HOTSPOT_TARGET_CPU)_pipeline.cpp \ - adGlobals_$(HOTSPOT_TARGET_CPU).hpp \ - dfa_$(HOTSPOT_TARGET_CPU).cpp \ + ad_$(HOTSPOT_TARGET_CPU_ARCH).cpp \ + ad_$(HOTSPOT_TARGET_CPU_ARCH).hpp \ + ad_$(HOTSPOT_TARGET_CPU_ARCH)_clone.cpp \ + ad_$(HOTSPOT_TARGET_CPU_ARCH)_expand.cpp \ + ad_$(HOTSPOT_TARGET_CPU_ARCH)_format.cpp \ + ad_$(HOTSPOT_TARGET_CPU_ARCH)_gen.cpp \ + ad_$(HOTSPOT_TARGET_CPU_ARCH)_misc.cpp \ + ad_$(HOTSPOT_TARGET_CPU_ARCH)_peephole.cpp \ + ad_$(HOTSPOT_TARGET_CPU_ARCH)_pipeline.cpp \ + adGlobals_$(HOTSPOT_TARGET_CPU_ARCH).hpp \ + dfa_$(HOTSPOT_TARGET_CPU_ARCH).cpp \ ) $(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles/%: $(ADLC_RUN_MARKER) diff --git a/hotspot/make/lib/CompileJvm.gmk b/hotspot/make/lib/CompileJvm.gmk index b6404cf74b1..65d58e40e93 100644 --- a/hotspot/make/lib/CompileJvm.gmk +++ b/hotspot/make/lib/CompileJvm.gmk @@ -60,12 +60,15 @@ JVM_CFLAGS_INCLUDES += \ -I$(HOTSPOT_TOPDIR)/src/share/vm/prims \ # +# INCLUDE_SUFFIX_* is only meant for including the proper +# platform files. Don't use it to guard code. Use the value of +# HOTSPOT_TARGET_CPU_DEFINE etc. instead. +# Remaining TARGET_ARCH_* is needed to distinguish closed and open +# 64-bit ARM ports (also called AARCH64). JVM_CFLAGS_TARGET_DEFINES += \ - -DTARGET_OS_FAMILY_$(HOTSPOT_TARGET_OS) \ - -DTARGET_ARCH_MODEL_$(HOTSPOT_TARGET_CPU) \ -DTARGET_ARCH_$(HOTSPOT_TARGET_CPU_ARCH) \ - -DTARGET_OS_ARCH_MODEL_$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU) \ - -DTARGET_OS_ARCH_$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU_ARCH) \ + -DINCLUDE_SUFFIX_OS=_$(HOTSPOT_TARGET_OS) \ + -DINCLUDE_SUFFIX_CPU=_$(HOTSPOT_TARGET_CPU_ARCH) \ -DTARGET_COMPILER_$(HOTSPOT_TOOLCHAIN_TYPE) \ -D$(HOTSPOT_TARGET_CPU_DEFINE) \ -DHOTSPOT_LIB_ARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' \ diff --git a/hotspot/src/cpu/aarch64/vm/bytes_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/bytes_aarch64.hpp index e2a4965c5d3..fc7890e945b 100644 --- a/hotspot/src/cpu/aarch64/vm/bytes_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/bytes_aarch64.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -67,9 +67,6 @@ class Bytes: AllStatic { // The following header contains the implementations of swap_u2, swap_u4, and swap_u8[_base] - -#ifdef TARGET_OS_ARCH_linux_aarch64 -# include "bytes_linux_aarch64.inline.hpp" -#endif +#include OS_CPU_HEADER_INLINE(bytes) #endif // CPU_AARCH64_VM_BYTES_AARCH64_HPP diff --git a/hotspot/src/cpu/aarch64/vm/copy_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/copy_aarch64.hpp index 7977b6e597c..2b7a36a2768 100644 --- a/hotspot/src/cpu/aarch64/vm/copy_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/copy_aarch64.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -29,9 +29,7 @@ // Inline functions for memory copy and fill. // Contains inline asm implementations -#ifdef TARGET_OS_ARCH_linux_aarch64 -# include "copy_linux_aarch64.inline.hpp" -#endif +#include OS_CPU_HEADER_INLINE(copy) static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) { diff --git a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp index 070fcbd219c..68a8e24168a 100644 --- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -29,10 +29,10 @@ #include "memory/resourceArea.hpp" #include "runtime/java.hpp" #include "runtime/stubCodeGenerator.hpp" +#include "utilities/macros.hpp" #include "vm_version_aarch64.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "os_linux.inline.hpp" -#endif + +#include OS_HEADER_INLINE(os) #ifndef BUILTIN_SIM #include diff --git a/hotspot/src/cpu/ppc/vm/bytes_ppc.hpp b/hotspot/src/cpu/ppc/vm/bytes_ppc.hpp index be005cbbfba..b75b0f0fa5d 100644 --- a/hotspot/src/cpu/ppc/vm/bytes_ppc.hpp +++ b/hotspot/src/cpu/ppc/vm/bytes_ppc.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2013 SAP SE. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016 SAP SE. 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 @@ -274,8 +274,6 @@ class Bytes: AllStatic { #endif // VM_LITTLE_ENDIAN }; -#if defined(TARGET_OS_ARCH_linux_ppc) -#include "bytes_linux_ppc.inline.hpp" -#endif +#include OS_CPU_HEADER_INLINE(bytes) #endif // CPU_PPC_VM_BYTES_PPC_HPP diff --git a/hotspot/src/cpu/ppc/vm/globalDefinitions_ppc.hpp b/hotspot/src/cpu/ppc/vm/globalDefinitions_ppc.hpp index 941a65fa041..5e3665439bf 100644 --- a/hotspot/src/cpu/ppc/vm/globalDefinitions_ppc.hpp +++ b/hotspot/src/cpu/ppc/vm/globalDefinitions_ppc.hpp @@ -47,7 +47,7 @@ const bool CCallingConventionRequiresIntsAsLongs = true; // The expected size in bytes of a cache line, used to pad data structures. #define DEFAULT_CACHE_LINE_SIZE 128 -#if defined(COMPILER2) && (defined(AIX) || defined(linux)) +#if defined(COMPILER2) && (defined(AIX) || defined(LINUX)) // Include Transactional Memory lock eliding optimization #define INCLUDE_RTM_OPT 1 #endif diff --git a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.hpp b/hotspot/src/cpu/ppc/vm/interp_masm_ppc.hpp similarity index 99% rename from hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.hpp rename to hotspot/src/cpu/ppc/vm/interp_masm_ppc.hpp index 3da602dd93e..d2085ea4e78 100644 --- a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.hpp +++ b/hotspot/src/cpu/ppc/vm/interp_masm_ppc.hpp @@ -23,8 +23,8 @@ * */ -#ifndef CPU_PPC_VM_INTERP_MASM_PPC_64_HPP -#define CPU_PPC_VM_INTERP_MASM_PPC_64_HPP +#ifndef CPU_PPC_VM_INTERP_MASM_PPC_HPP +#define CPU_PPC_VM_INTERP_MASM_PPC_HPP #include "asm/macroAssembler.hpp" #include "interpreter/invocationCounter.hpp" @@ -263,4 +263,4 @@ class InterpreterMacroAssembler: public MacroAssembler { NotifyMethodExitMode mode, bool check_exceptions); }; -#endif // CPU_PPC_VM_INTERP_MASM_PPC_64_HPP +#endif // CPU_PPC_VM_INTERP_MASM_PPC_HPP diff --git a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp index 2a8eddf18ad..70544e9366a 100644 --- a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp +++ b/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp @@ -26,7 +26,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" -#include "interp_masm_ppc_64.hpp" +#include "interp_masm_ppc.hpp" #include "interpreter/interpreterRuntime.hpp" #include "prims/jvmtiThreadState.hpp" #include "runtime/sharedRuntime.hpp" diff --git a/hotspot/src/cpu/ppc/vm/ppc_64.ad b/hotspot/src/cpu/ppc/vm/ppc_64.ad deleted file mode 100644 index 712f18fe969..00000000000 --- a/hotspot/src/cpu/ppc/vm/ppc_64.ad +++ /dev/null @@ -1,24 +0,0 @@ -// -// Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. -// Copyright (c) 2012, 2013 SAP SE. 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. -// -// diff --git a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp index 38c83d39e65..609420a675b 100644 --- a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp @@ -40,7 +40,7 @@ #include "c1/c1_Runtime1.hpp" #endif #ifdef COMPILER2 -#include "adfiles/ad_ppc_64.hpp" +#include "opto/ad.hpp" #include "opto/runtime.hpp" #endif diff --git a/hotspot/src/cpu/ppc/vm/stubRoutines_ppc_64.hpp b/hotspot/src/cpu/ppc/vm/stubRoutines_ppc.hpp similarity index 88% rename from hotspot/src/cpu/ppc/vm/stubRoutines_ppc_64.hpp rename to hotspot/src/cpu/ppc/vm/stubRoutines_ppc.hpp index a005677ffa0..b04c99cf64e 100644 --- a/hotspot/src/cpu/ppc/vm/stubRoutines_ppc_64.hpp +++ b/hotspot/src/cpu/ppc/vm/stubRoutines_ppc.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 SAP SE. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016 SAP SE. 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 @@ -23,8 +23,8 @@ * */ -#ifndef CPU_PPC_VM_STUBROUTINES_PPC_64_HPP -#define CPU_PPC_VM_STUBROUTINES_PPC_64_HPP +#ifndef CPU_PPC_VM_STUBROUTINES_PPC_HPP +#define CPU_PPC_VM_STUBROUTINES_PPC_HPP // This file holds the platform specific parts of the StubRoutines // definition. See stubRoutines.hpp for a description on how to @@ -61,4 +61,4 @@ class ppc64 { }; -#endif // CPU_PPC_VM_STUBROUTINES_PPC_64_HPP +#endif // CPU_PPC_VM_STUBROUTINES_PPC_HPP diff --git a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.hpp b/hotspot/src/cpu/ppc/vm/templateTable_ppc.hpp similarity index 87% rename from hotspot/src/cpu/ppc/vm/templateTable_ppc_64.hpp rename to hotspot/src/cpu/ppc/vm/templateTable_ppc.hpp index 943f12abb0f..05ce69093b3 100644 --- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.hpp +++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013, 2014 SAP SE. All rights reserved. + * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016 SAP SE. 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 @@ -23,8 +23,8 @@ * */ -#ifndef CPU_PPC_VM_TEMPLATETABLE_PPC_64_HPP -#define CPU_PPC_VM_TEMPLATETABLE_PPC_64_HPP +#ifndef CPU_PPC_VM_TEMPLATETABLE_PPC_HPP +#define CPU_PPC_VM_TEMPLATETABLE_PPC_HPP static void prepare_invoke(int byte_no, Register Rmethod, Register Rret_addr, Register Rindex, Register Rrecv, Register Rflags, Register Rscratch); static void invokevfinal_helper(Register Rmethod, Register Rflags, Register Rscratch1, Register Rscratch2); @@ -35,4 +35,4 @@ static void branch_conditional(ConditionRegister crx, TemplateTable::Condition cc, Label& L, bool invert = false); static void if_cmp_common(Register Rfirst, Register Rsecond, Register Rscratch1, Register Rscratch2, Condition cc, bool is_jint, bool cmp0); -#endif // CPU_PPC_VM_TEMPLATETABLE_PPC_64_HPP +#endif // CPU_PPC_VM_TEMPLATETABLE_PPC_HPP diff --git a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp index 3b0800d6e5f..d83c3cd3b73 100644 --- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp @@ -278,7 +278,7 @@ void VM_Version::initialize() { os_too_old = false; } #endif -#ifdef linux +#ifdef LINUX // At least Linux kernel 4.2, as the problematic behavior of syscalls // being called in the middle of a transaction has been addressed. // Please, refer to commit b4b56f9ecab40f3b4ef53e130c9f6663be491894 diff --git a/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp index 9345db639e4..4ddfc3e489e 100644 --- a/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp +++ b/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 SAP SE. All rights reserved. + * Copyright (c) 2012, 2016 SAP SE. 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 @@ -26,7 +26,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/vtableStubs.hpp" -#include "interp_masm_ppc_64.hpp" +#include "interp_masm_ppc.hpp" #include "memory/resourceArea.hpp" #include "oops/instanceKlass.hpp" #include "oops/klassVtable.hpp" diff --git a/hotspot/src/cpu/x86/vm/bytes_x86.hpp b/hotspot/src/cpu/x86/vm/bytes_x86.hpp index 9f939a389f6..eb5ab17ca08 100644 --- a/hotspot/src/cpu/x86/vm/bytes_x86.hpp +++ b/hotspot/src/cpu/x86/vm/bytes_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -26,6 +26,7 @@ #define CPU_X86_VM_BYTES_X86_HPP #include "memory/allocation.hpp" +#include "utilities/macros.hpp" class Bytes: AllStatic { private: @@ -70,20 +71,7 @@ class Bytes: AllStatic { static inline u8 swap_u8(u8 x); }; - // The following header contains the implementations of swap_u2, swap_u4, and swap_u8[_base] -#ifdef TARGET_OS_ARCH_linux_x86 -# include "bytes_linux_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_solaris_x86 -# include "bytes_solaris_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_windows_x86 -# include "bytes_windows_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_bsd_x86 -# include "bytes_bsd_x86.inline.hpp" -#endif - +#include OS_CPU_HEADER_INLINE(bytes) #endif // CPU_X86_VM_BYTES_X86_HPP diff --git a/hotspot/src/cpu/x86/vm/copy_x86.hpp b/hotspot/src/cpu/x86/vm/copy_x86.hpp index d5c6d5efa21..e07b64e5310 100644 --- a/hotspot/src/cpu/x86/vm/copy_x86.hpp +++ b/hotspot/src/cpu/x86/vm/copy_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -28,19 +28,7 @@ // Inline functions for memory copy and fill. // Contains inline asm implementations -#ifdef TARGET_OS_ARCH_linux_x86 -# include "copy_linux_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_solaris_x86 -# include "copy_solaris_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_windows_x86 -# include "copy_windows_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_bsd_x86 -# include "copy_bsd_x86.inline.hpp" -#endif - +#include OS_CPU_HEADER_INLINE(copy) static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) { #ifdef AMD64 diff --git a/hotspot/src/os/bsd/vm/mutex_bsd.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.inline.hpp similarity index 75% rename from hotspot/src/os/bsd/vm/mutex_bsd.cpp rename to hotspot/src/cpu/x86/vm/macroAssembler_x86.inline.hpp index 3a1b5ebc013..d23bdb40231 100644 --- a/hotspot/src/os/bsd/vm/mutex_bsd.cpp +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -22,12 +22,9 @@ * */ -#include "precompiled.hpp" -#include "mutex_bsd.inline.hpp" -#include "runtime/interfaceSupport.hpp" -#include "runtime/mutex.hpp" -#include "runtime/thread.inline.hpp" -#include "utilities/events.hpp" +#ifndef CPU_X86_VM_MACROASSEMBLER_X86_INLINE_HPP +#define CPU_X86_VM_MACROASSEMBLER_X86_INLINE_HPP -// put OS-includes here -# include +// Still empty. + +#endif // CPU_X86_VM_MACROASSEMBLER_X86_INLINE_HPP diff --git a/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp b/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp index 6c0ca8e9b48..e0e968875dc 100644 --- a/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp +++ b/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp @@ -26,9 +26,7 @@ #include "asm/assembler.hpp" #include "asm/register.hpp" #include "register_x86.hpp" -#ifdef TARGET_ARCH_x86 -# include "interp_masm_x86.hpp" -#endif +#include "interp_masm_x86.hpp" REGISTER_DEFINITION(Register, noreg); REGISTER_DEFINITION(Register, rax); diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp index eeceb0169ee..3caac41393e 100644 --- a/hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp +++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -29,6 +29,83 @@ // definition. See stubRoutines.hpp for a description on how to // extend it. +static bool returns_to_call_stub(address return_pc) { return return_pc == _call_stub_return_address; } + +enum platform_dependent_constants { + code_size1 = 20000 LP64_ONLY(+10000), // simply increase if too small (assembler will crash if too small) + code_size2 = 33800 LP64_ONLY(+1200) // simply increase if too small (assembler will crash if too small) +}; + +class x86 { + friend class StubGenerator; + friend class VMStructs; + +#ifdef _LP64 + private: + static address _get_previous_fp_entry; + static address _get_previous_sp_entry; + + static address _f2i_fixup; + static address _f2l_fixup; + static address _d2i_fixup; + static address _d2l_fixup; + + static address _float_sign_mask; + static address _float_sign_flip; + static address _double_sign_mask; + static address _double_sign_flip; + + public: + + static address get_previous_fp_entry() { + return _get_previous_fp_entry; + } + + static address get_previous_sp_entry() { + return _get_previous_sp_entry; + } + + static address f2i_fixup() { + return _f2i_fixup; + } + + static address f2l_fixup() { + return _f2l_fixup; + } + + static address d2i_fixup() { + return _d2i_fixup; + } + + static address d2l_fixup() { + return _d2l_fixup; + } + + static address float_sign_mask() { + return _float_sign_mask; + } + + static address float_sign_flip() { + return _float_sign_flip; + } + + static address double_sign_mask() { + return _double_sign_mask; + } + + static address double_sign_flip() { + return _double_sign_flip; + } +#else // !LP64 + + private: + static address _verify_fpu_cntrl_wrd_entry; + + public: + static address verify_fpu_cntrl_wrd_entry() { return _verify_fpu_cntrl_wrd_entry; } + +#endif // !LP64 + private: static address _verify_mxcsr_entry; // shuffle mask for fixing up 128-bit words consisting of big-endian 32-bit integers @@ -138,4 +215,6 @@ static address _Pi4x4_addr() { return _Pi4x4_adr; } static address _ones_addr() { return _ones_adr; } -#endif // CPU_X86_VM_STUBROUTINES_X86_32_HPP +}; + +#endif // CPU_X86_VM_STUBROUTINES_X86_HPP diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp deleted file mode 100644 index 17f76e8f876..00000000000 --- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1997, 2013, 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. - * - */ - -#ifndef CPU_X86_VM_STUBROUTINES_X86_32_HPP -#define CPU_X86_VM_STUBROUTINES_X86_32_HPP - -// This file holds the platform specific parts of the StubRoutines -// definition. See stubRoutines.hpp for a description on how to -// extend it. - -enum platform_dependent_constants { - code_size1 = 20000, // simply increase if too small (assembler will crash if too small) - code_size2 = 33800 // simply increase if too small (assembler will crash if too small) -}; - -class x86 { - friend class StubGenerator; - friend class VMStructs; - - private: - static address _verify_fpu_cntrl_wrd_entry; - - public: - static address verify_fpu_cntrl_wrd_entry() { return _verify_fpu_cntrl_wrd_entry; } - -# include "stubRoutines_x86.hpp" - -}; - - static bool returns_to_call_stub(address return_pc) { return return_pc == _call_stub_return_address; } - -#endif // CPU_X86_VM_STUBROUTINES_X86_32_HPP diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp deleted file mode 100644 index b4750ff4f90..00000000000 --- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2003, 2013, 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. - * - */ - -#ifndef CPU_X86_VM_STUBROUTINES_X86_64_HPP -#define CPU_X86_VM_STUBROUTINES_X86_64_HPP - -// This file holds the platform specific parts of the StubRoutines -// definition. See stubRoutines.hpp for a description on how to -// extend it. - -static bool returns_to_call_stub(address return_pc) { return return_pc == _call_stub_return_address; } - -enum platform_dependent_constants { - code_size1 = 30000, // simply increase if too small (assembler will crash if too small) - code_size2 = 35000 // simply increase if too small (assembler will crash if too small) -}; - -class x86 { - friend class StubGenerator; - - private: - static address _get_previous_fp_entry; - static address _get_previous_sp_entry; - - static address _f2i_fixup; - static address _f2l_fixup; - static address _d2i_fixup; - static address _d2l_fixup; - - static address _float_sign_mask; - static address _float_sign_flip; - static address _double_sign_mask; - static address _double_sign_flip; - - public: - - static address get_previous_fp_entry() - { - return _get_previous_fp_entry; - } - - static address get_previous_sp_entry() - { - return _get_previous_sp_entry; - } - - static address f2i_fixup() - { - return _f2i_fixup; - } - - static address f2l_fixup() - { - return _f2l_fixup; - } - - static address d2i_fixup() - { - return _d2i_fixup; - } - - static address d2l_fixup() - { - return _d2l_fixup; - } - - static address float_sign_mask() - { - return _float_sign_mask; - } - - static address float_sign_flip() - { - return _float_sign_flip; - } - - static address double_sign_mask() - { - return _double_sign_mask; - } - - static address double_sign_flip() - { - return _double_sign_flip; - } - -# include "stubRoutines_x86.hpp" - -}; - -#endif // CPU_X86_VM_STUBROUTINES_X86_64_HPP diff --git a/hotspot/src/cpu/zero/vm/bytes_zero.hpp b/hotspot/src/cpu/zero/vm/bytes_zero.hpp index be2e09adf1c..186f09d6937 100644 --- a/hotspot/src/cpu/zero/vm/bytes_zero.hpp +++ b/hotspot/src/cpu/zero/vm/bytes_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -165,12 +165,8 @@ class Bytes: AllStatic { #ifdef VM_LITTLE_ENDIAN // The following header contains the implementations of swap_u2, // swap_u4, and swap_u8 -#ifdef TARGET_OS_ARCH_linux_zero -# include "bytes_linux_zero.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_bsd_zero -# include "bytes_bsd_zero.inline.hpp" -#endif + +#include OS_CPU_HEADER_INLINE(bytes) #endif // VM_LITTLE_ENDIAN diff --git a/hotspot/src/os/linux/vm/mutex_linux.cpp b/hotspot/src/cpu/zero/vm/macroAssembler_zero.hpp similarity index 75% rename from hotspot/src/os/linux/vm/mutex_linux.cpp rename to hotspot/src/cpu/zero/vm/macroAssembler_zero.hpp index a54ec992f38..3477989faab 100644 --- a/hotspot/src/os/linux/vm/mutex_linux.cpp +++ b/hotspot/src/cpu/zero/vm/macroAssembler_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -22,12 +22,9 @@ * */ -#include "precompiled.hpp" -#include "mutex_linux.inline.hpp" -#include "runtime/interfaceSupport.hpp" -#include "runtime/mutex.hpp" -#include "runtime/thread.inline.hpp" -#include "utilities/events.hpp" +#ifndef CPU_ZERO_VM_MACROASSEMBLER_ZERO_HPP +#define CPU_ZERO_VM_MACROASSEMBLER_ZERO_HPP -// put OS-includes here -# include +// Needed for includes in shared files. + +#endif // CPU_ZERO_VM_MACROASSEMBLER_ZERO_HPP diff --git a/hotspot/src/os/windows/vm/mutex_windows.cpp b/hotspot/src/cpu/zero/vm/macroAssembler_zero.inline.hpp similarity index 75% rename from hotspot/src/os/windows/vm/mutex_windows.cpp rename to hotspot/src/cpu/zero/vm/macroAssembler_zero.inline.hpp index f8e06332ce9..47ce5e5d558 100644 --- a/hotspot/src/os/windows/vm/mutex_windows.cpp +++ b/hotspot/src/cpu/zero/vm/macroAssembler_zero.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -22,12 +22,9 @@ * */ -#include "precompiled.hpp" -#include "mutex_windows.inline.hpp" -#include "runtime/interfaceSupport.hpp" -#include "runtime/mutex.hpp" -#include "runtime/thread.inline.hpp" -#include "utilities/events.hpp" +#ifndef CPU_ZERO_VM_MACROASSEMBLER_ZERO_INLINE_HPP +#define CPU_ZERO_VM_MACROASSEMBLER_ZERO_INLINE_HPP -// put OS-includes here -# include +// Needed for includes in shared files. + +#endif // CPU_ZERO_VM_MACROASSEMBLER_ZERO_INLINE_HPP diff --git a/hotspot/src/os/aix/vm/mutex_aix.inline.hpp b/hotspot/src/os/aix/vm/mutex_aix.inline.hpp deleted file mode 100644 index ee59295dcba..00000000000 --- a/hotspot/src/os/aix/vm/mutex_aix.inline.hpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2014 SAP SE. 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. - * - */ - -#ifndef OS_AIX_VM_MUTEX_AIX_INLINE_HPP -#define OS_AIX_VM_MUTEX_AIX_INLINE_HPP - -#include "os_aix.inline.hpp" -#include "runtime/interfaceSupport.hpp" -#include "runtime/thread.inline.hpp" - -#endif // OS_AIX_VM_MUTEX_AIX_INLINE_HPP diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp index 6b676df416c..42aa1a635a9 100644 --- a/hotspot/src/os/aix/vm/os_aix.cpp +++ b/hotspot/src/os/aix/vm/os_aix.cpp @@ -44,7 +44,6 @@ #include "memory/allocation.inline.hpp" #include "memory/filemap.hpp" #include "misc_aix.hpp" -#include "mutex_aix.inline.hpp" #include "oops/oop.inline.hpp" #include "os_aix.inline.hpp" #include "os_share_aix.hpp" diff --git a/hotspot/src/os/bsd/vm/mutex_bsd.inline.hpp b/hotspot/src/os/bsd/vm/mutex_bsd.inline.hpp deleted file mode 100644 index 63c63f0e529..00000000000 --- a/hotspot/src/os/bsd/vm/mutex_bsd.inline.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 1999, 2010, 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. - * - */ - -#ifndef OS_BSD_VM_MUTEX_BSD_INLINE_HPP -#define OS_BSD_VM_MUTEX_BSD_INLINE_HPP - -#include "os_bsd.inline.hpp" -#include "runtime/interfaceSupport.hpp" -#include "runtime/thread.inline.hpp" - - -// Reconciliation History -// mutex_solaris.inline.hpp 1.5 99/06/22 16:38:49 -// End - -#endif // OS_BSD_VM_MUTEX_BSD_INLINE_HPP diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp index b8c40f60a00..738144baf3b 100644 --- a/hotspot/src/os/bsd/vm/os_bsd.cpp +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp @@ -35,7 +35,6 @@ #include "logging/log.hpp" #include "memory/allocation.inline.hpp" #include "memory/filemap.hpp" -#include "mutex_bsd.inline.hpp" #include "oops/oop.inline.hpp" #include "os_bsd.inline.hpp" #include "os_share_bsd.hpp" diff --git a/hotspot/src/os/linux/vm/mutex_linux.inline.hpp b/hotspot/src/os/linux/vm/mutex_linux.inline.hpp deleted file mode 100644 index ff3ac285e8e..00000000000 --- a/hotspot/src/os/linux/vm/mutex_linux.inline.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 1999, 2010, 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. - * - */ - -#ifndef OS_LINUX_VM_MUTEX_LINUX_INLINE_HPP -#define OS_LINUX_VM_MUTEX_LINUX_INLINE_HPP - -#include "os_linux.inline.hpp" -#include "runtime/interfaceSupport.hpp" -#include "runtime/thread.inline.hpp" - - -// Reconciliation History -// mutex_solaris.inline.hpp 1.5 99/06/22 16:38:49 -// End - -#endif // OS_LINUX_VM_MUTEX_LINUX_INLINE_HPP diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index 2407381d431..b8c1a72ae4a 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -35,7 +35,6 @@ #include "logging/log.hpp" #include "memory/allocation.inline.hpp" #include "memory/filemap.hpp" -#include "mutex_linux.inline.hpp" #include "oops/oop.inline.hpp" #include "os_linux.inline.hpp" #include "os_share_linux.hpp" diff --git a/hotspot/src/os/posix/vm/os_posix.cpp b/hotspot/src/os/posix/vm/os_posix.cpp index ad10c82a5b2..6ed034c3bf5 100644 --- a/hotspot/src/os/posix/vm/os_posix.cpp +++ b/hotspot/src/os/posix/vm/os_posix.cpp @@ -28,6 +28,7 @@ #include "runtime/frame.inline.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/os.hpp" +#include "utilities/macros.hpp" #include "utilities/vmError.hpp" #include @@ -214,7 +215,7 @@ void os::Posix::print_rlimit_info(outputStream* st) { else st->print("%luk", rlim.rlim_cur >> 10); // Isn't there on solaris -#if !defined(TARGET_OS_FAMILY_solaris) && !defined(TARGET_OS_FAMILY_aix) +#if !defined(SOLARIS) && !defined(AIX) st->print(", NPROC "); getrlimit(RLIMIT_NPROC, &rlim); if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); @@ -1062,28 +1063,28 @@ int os::Posix::unblock_thread_signal_mask(const sigset_t *set) { } address os::Posix::ucontext_get_pc(const ucontext_t* ctx) { -#ifdef TARGET_OS_FAMILY_linux - return Linux::ucontext_get_pc(ctx); -#elif defined(TARGET_OS_FAMILY_solaris) - return Solaris::ucontext_get_pc(ctx); -#elif defined(TARGET_OS_FAMILY_aix) +#if defined(AIX) return Aix::ucontext_get_pc(ctx); -#elif defined(TARGET_OS_FAMILY_bsd) +#elif defined(BSD) return Bsd::ucontext_get_pc(ctx); +#elif defined(LINUX) + return Linux::ucontext_get_pc(ctx); +#elif defined(SOLARIS) + return Solaris::ucontext_get_pc(ctx); #else VMError::report_and_die("unimplemented ucontext_get_pc"); #endif } void os::Posix::ucontext_set_pc(ucontext_t* ctx, address pc) { -#ifdef TARGET_OS_FAMILY_linux - Linux::ucontext_set_pc(ctx, pc); -#elif defined(TARGET_OS_FAMILY_solaris) - Solaris::ucontext_set_pc(ctx, pc); -#elif defined(TARGET_OS_FAMILY_aix) +#if defined(AIX) Aix::ucontext_set_pc(ctx, pc); -#elif defined(TARGET_OS_FAMILY_bsd) +#elif defined(BSD) Bsd::ucontext_set_pc(ctx, pc); +#elif defined(LINUX) + Linux::ucontext_set_pc(ctx, pc); +#elif defined(SOLARIS) + Solaris::ucontext_set_pc(ctx, pc); #else VMError::report_and_die("unimplemented ucontext_get_pc"); #endif diff --git a/hotspot/src/os/posix/vm/vmError_posix.cpp b/hotspot/src/os/posix/vm/vmError_posix.cpp index 23cafc4aeeb..3c61a8b41ea 100644 --- a/hotspot/src/os/posix/vm/vmError_posix.cpp +++ b/hotspot/src/os/posix/vm/vmError_posix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -33,17 +33,17 @@ #include #include -#ifdef TARGET_OS_FAMILY_linux +#ifdef LINUX #include #include #endif -#ifdef TARGET_OS_FAMILY_solaris +#ifdef SOLARIS #include #endif -#ifdef TARGET_OS_FAMILY_aix +#ifdef AIX #include #endif -#ifdef TARGET_OS_FAMILY_bsd +#ifdef BSD #include #include #endif diff --git a/hotspot/src/os/solaris/vm/mutex_solaris.cpp b/hotspot/src/os/solaris/vm/mutex_solaris.cpp deleted file mode 100644 index 4d8166f65cf..00000000000 --- a/hotspot/src/os/solaris/vm/mutex_solaris.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2007, 2010, 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. - * - */ - -#include "precompiled.hpp" -#include "mutex_solaris.inline.hpp" -#include "runtime/interfaceSupport.hpp" -#include "runtime/mutex.hpp" -#include "runtime/thread.inline.hpp" -#include "utilities/events.hpp" - -// Solaris-specific include, therefore not in includeDB_* -# include "os_share_solaris.hpp" - -// put OS-includes here -# include diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index 11d20a3dc2c..3b9a3793a61 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -35,7 +35,6 @@ #include "logging/log.hpp" #include "memory/allocation.inline.hpp" #include "memory/filemap.hpp" -#include "mutex_solaris.inline.hpp" #include "oops/oop.inline.hpp" #include "os_share_solaris.hpp" #include "os_solaris.inline.hpp" diff --git a/hotspot/src/os/windows/vm/mutex_windows.inline.hpp b/hotspot/src/os/windows/vm/mutex_windows.inline.hpp deleted file mode 100644 index fbfe7ac8451..00000000000 --- a/hotspot/src/os/windows/vm/mutex_windows.inline.hpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 1998, 2010, 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. - * - */ - -#ifndef OS_WINDOWS_VM_MUTEX_WINDOWS_INLINE_HPP -#define OS_WINDOWS_VM_MUTEX_WINDOWS_INLINE_HPP - -#include "os_windows.inline.hpp" -#include "runtime/interfaceSupport.hpp" -#include "runtime/thread.inline.hpp" - -#endif // OS_WINDOWS_VM_MUTEX_WINDOWS_INLINE_HPP diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index 53e7ecb8a7d..bd85cf01e61 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -38,7 +38,6 @@ #include "logging/log.hpp" #include "memory/allocation.inline.hpp" #include "memory/filemap.hpp" -#include "mutex_windows.inline.hpp" #include "oops/oop.inline.hpp" #include "os_share_windows.hpp" #include "os_windows.inline.hpp" diff --git a/hotspot/src/os/solaris/vm/mutex_solaris.inline.hpp b/hotspot/src/os_cpu/aix_ppc/vm/bytes_aix_ppc.inline.hpp similarity index 74% rename from hotspot/src/os/solaris/vm/mutex_solaris.inline.hpp rename to hotspot/src/os_cpu/aix_ppc/vm/bytes_aix_ppc.inline.hpp index b683a3be980..2e6ec996b4f 100644 --- a/hotspot/src/os/solaris/vm/mutex_solaris.inline.hpp +++ b/hotspot/src/os_cpu/aix_ppc/vm/bytes_aix_ppc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -22,11 +22,11 @@ * */ -#ifndef OS_SOLARIS_VM_MUTEX_SOLARIS_INLINE_HPP -#define OS_SOLARIS_VM_MUTEX_SOLARIS_INLINE_HPP +#ifndef OS_CPU_AIX_PPC_VM_BYTES_AIX_PPC_INLINE_HPP +#define OS_CPU_AIX_PPC_VM_BYTES_AIX_PPC_INLINE_HPP -#include "os_solaris.inline.hpp" -#include "runtime/interfaceSupport.hpp" -#include "runtime/thread.inline.hpp" +#if defined(VM_LITTLE_ENDIAN) +// Aix is not little endian. +#endif // VM_LITTLE_ENDIAN -#endif // OS_SOLARIS_VM_MUTEX_SOLARIS_INLINE_HPP +#endif // OS_CPU_AIX_PPC_VM_BYTES_AIX_PPC_INLINE_HPP diff --git a/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp b/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp index 84ae1ab1dc5..e5c986743ff 100644 --- a/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp +++ b/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp @@ -34,7 +34,6 @@ #include "interpreter/interpreter.hpp" #include "jvm_aix.h" #include "memory/allocation.inline.hpp" -#include "mutex_aix.inline.hpp" #include "nativeInst_ppc.hpp" #include "os_share_aix.hpp" #include "prims/jniFastGetField.hpp" diff --git a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp index 9fe34fc1770..5f7d479726c 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp +++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp @@ -33,7 +33,6 @@ #include "interpreter/interpreter.hpp" #include "jvm_bsd.h" #include "memory/allocation.inline.hpp" -#include "mutex_bsd.inline.hpp" #include "os_share_bsd.hpp" #include "prims/jniFastGetField.hpp" #include "prims/jvm.h" diff --git a/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp b/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp index 72d57858e09..f7ff3e51b96 100644 --- a/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp +++ b/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp @@ -38,7 +38,6 @@ #include "interpreter/interpreter.hpp" #include "jvm_bsd.h" #include "memory/allocation.inline.hpp" -#include "mutex_bsd.inline.hpp" #include "nativeInst_zero.hpp" #include "os_share_bsd.hpp" #include "prims/jniFastGetField.hpp" diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp b/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp index 04179925e67..b4bc43a81c6 100644 --- a/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp +++ b/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp @@ -35,7 +35,6 @@ #include "interpreter/interpreter.hpp" #include "jvm_linux.h" #include "memory/allocation.inline.hpp" -#include "mutex_linux.inline.hpp" #include "os_share_linux.hpp" #include "prims/jniFastGetField.hpp" #include "prims/jvm.h" diff --git a/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp b/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp index 18cd557741d..0003988860c 100644 --- a/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp +++ b/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp @@ -34,7 +34,6 @@ #include "interpreter/interpreter.hpp" #include "jvm_linux.h" #include "memory/allocation.inline.hpp" -#include "mutex_linux.inline.hpp" #include "nativeInst_ppc.hpp" #include "os_share_linux.hpp" #include "prims/jniFastGetField.hpp" diff --git a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp index 4a0da12c498..7cf5edb70b0 100644 --- a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp +++ b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp @@ -33,7 +33,6 @@ #include "interpreter/interpreter.hpp" #include "jvm_linux.h" #include "memory/allocation.inline.hpp" -#include "mutex_linux.inline.hpp" #include "nativeInst_sparc.hpp" #include "os_share_linux.hpp" #include "prims/jniFastGetField.hpp" diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp index 8bc9e6a7024..06a8a6eb5f1 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp @@ -33,7 +33,6 @@ #include "interpreter/interpreter.hpp" #include "jvm_linux.h" #include "memory/allocation.inline.hpp" -#include "mutex_linux.inline.hpp" #include "os_share_linux.hpp" #include "prims/jniFastGetField.hpp" #include "prims/jvm.h" diff --git a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp index abd52961976..b43499ec772 100644 --- a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp +++ b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp @@ -33,7 +33,6 @@ #include "interpreter/interpreter.hpp" #include "jvm_linux.h" #include "memory/allocation.inline.hpp" -#include "mutex_linux.inline.hpp" #include "nativeInst_zero.hpp" #include "os_share_linux.hpp" #include "prims/jniFastGetField.hpp" diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp index 77db98f1989..59784825635 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp +++ b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp @@ -34,7 +34,6 @@ #include "interpreter/interpreter.hpp" #include "jvm_solaris.h" #include "memory/allocation.inline.hpp" -#include "mutex_solaris.inline.hpp" #include "nativeInst_sparc.hpp" #include "os_share_solaris.hpp" #include "prims/jniFastGetField.hpp" diff --git a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp index 8e8edf4b842..328ac2ebc7a 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp @@ -33,7 +33,6 @@ #include "interpreter/interpreter.hpp" #include "jvm_solaris.h" #include "memory/allocation.inline.hpp" -#include "mutex_solaris.inline.hpp" #include "os_share_solaris.hpp" #include "prims/jniFastGetField.hpp" #include "prims/jvm.h" diff --git a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp index d71b9a760df..efb1b3b0851 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp +++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp @@ -34,7 +34,6 @@ #include "jvm_windows.h" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" -#include "mutex_windows.inline.hpp" #include "nativeInst_x86.hpp" #include "os_share_windows.hpp" #include "prims/jniFastGetField.hpp" diff --git a/hotspot/src/share/vm/asm/assembler.hpp b/hotspot/src/share/vm/asm/assembler.hpp index 2ef9d993721..cb49b4f99c9 100644 --- a/hotspot/src/share/vm/asm/assembler.hpp +++ b/hotspot/src/share/vm/asm/assembler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -33,6 +33,7 @@ #include "runtime/vm_version.hpp" #include "utilities/debug.hpp" #include "utilities/growableArray.hpp" +#include "utilities/macros.hpp" // This file contains platform-independent assembler declarations. @@ -417,24 +418,6 @@ class AbstractAssembler : public ResourceObj { }; -#ifdef TARGET_ARCH_x86 -# include "assembler_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "assembler_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "assembler_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "assembler_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "assembler_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "assembler_aarch64.hpp" -#endif - +#include CPU_HEADER(assembler) #endif // SHARE_VM_ASM_ASSEMBLER_HPP diff --git a/hotspot/src/share/vm/asm/assembler.inline.hpp b/hotspot/src/share/vm/asm/assembler.inline.hpp index 1a48cb3171d..8b35e12724d 100644 --- a/hotspot/src/share/vm/asm/assembler.inline.hpp +++ b/hotspot/src/share/vm/asm/assembler.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -27,23 +27,6 @@ #include "asm/assembler.hpp" -#ifdef TARGET_ARCH_x86 -# include "assembler_x86.inline.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "assembler_sparc.inline.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "assembler_zero.inline.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "assembler_arm.inline.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "assembler_ppc.inline.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "assembler_aarch64.inline.hpp" -#endif +#include CPU_HEADER_INLINE(assembler) #endif // SHARE_VM_ASM_ASSEMBLER_INLINE_HPP diff --git a/hotspot/src/share/vm/asm/codeBuffer.hpp b/hotspot/src/share/vm/asm/codeBuffer.hpp index aefcbab1174..a6c0e848216 100644 --- a/hotspot/src/share/vm/asm/codeBuffer.hpp +++ b/hotspot/src/share/vm/asm/codeBuffer.hpp @@ -28,6 +28,7 @@ #include "code/oopRecorder.hpp" #include "code/relocInfo.hpp" #include "utilities/debug.hpp" +#include "utilities/macros.hpp" class CodeStrings; class PhaseCFG; @@ -633,24 +634,7 @@ class CodeBuffer: public StackObj { // The following header contains architecture-specific implementations -#ifdef TARGET_ARCH_x86 -# include "codeBuffer_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "codeBuffer_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "codeBuffer_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "codeBuffer_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "codeBuffer_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "codeBuffer_aarch64.hpp" -#endif +#include CPU_HEADER(codeBuffer) }; diff --git a/hotspot/src/share/vm/asm/macroAssembler.hpp b/hotspot/src/share/vm/asm/macroAssembler.hpp index 1482eb630b1..84289ff1b81 100644 --- a/hotspot/src/share/vm/asm/macroAssembler.hpp +++ b/hotspot/src/share/vm/asm/macroAssembler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, 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 @@ -26,24 +26,8 @@ #define SHARE_VM_ASM_MACROASSEMBLER_HPP #include "asm/assembler.hpp" +#include "utilities/macros.hpp" -#ifdef TARGET_ARCH_x86 -# include "macroAssembler_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "macroAssembler_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "assembler_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "macroAssembler_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "macroAssembler_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "macroAssembler_aarch64.hpp" -#endif +#include CPU_HEADER(macroAssembler) #endif // SHARE_VM_ASM_MACROASSEMBLER_HPP diff --git a/hotspot/src/share/vm/asm/macroAssembler.inline.hpp b/hotspot/src/share/vm/asm/macroAssembler.inline.hpp index db3daa52e9a..51a1f72e1f3 100644 --- a/hotspot/src/share/vm/asm/macroAssembler.inline.hpp +++ b/hotspot/src/share/vm/asm/macroAssembler.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, 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 @@ -26,24 +26,6 @@ #define SHARE_VM_ASM_MACROASSEMBLER_INLINE_HPP #include "asm/macroAssembler.hpp" - -#ifdef TARGET_ARCH_x86 -// no macroAssembler_x86.inline.hpp -#endif -#ifdef TARGET_ARCH_sparc -# include "macroAssembler_sparc.inline.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "assembler_zero.inline.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "macroAssembler_arm.inline.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "macroAssembler_ppc.inline.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "macroAssembler_aarch64.inline.hpp" -#endif +#include CPU_HEADER_INLINE(macroAssembler) #endif // SHARE_VM_ASM_MACROASSEMBLER_INLINE_HPP diff --git a/hotspot/src/share/vm/asm/register.hpp b/hotspot/src/share/vm/asm/register.hpp index e258e867c1d..3c71d94cc63 100644 --- a/hotspot/src/share/vm/asm/register.hpp +++ b/hotspot/src/share/vm/asm/register.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, 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 @@ -27,6 +27,7 @@ #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" // Use AbstractRegister as shortcut class AbstractRegisterImpl; @@ -94,25 +95,7 @@ enum { name##_##type##EnumValue = value##_##type##EnumValue } #define REGISTER_DEFINITION(type, name) \ const type name = ((type)name##_##type##EnumValue) -#ifdef TARGET_ARCH_x86 -# include "register_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "register_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "register_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "register_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "register_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "register_aarch64.hpp" -#endif - +#include CPU_HEADER(register) // Debugging support diff --git a/hotspot/src/share/vm/c1/c1_Defs.hpp b/hotspot/src/share/vm/c1/c1_Defs.hpp index 79320b8212a..9cd61c46e57 100644 --- a/hotspot/src/share/vm/c1/c1_Defs.hpp +++ b/hotspot/src/share/vm/c1/c1_Defs.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, 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 @@ -25,8 +25,9 @@ #ifndef SHARE_VM_C1_C1_DEFS_HPP #define SHARE_VM_C1_C1_DEFS_HPP -#include "utilities/globalDefinitions.hpp" #include "asm/register.hpp" +#include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" // set frame size and return address offset to these values in blobs // (if the compiled frame uses ebp as link pointer on IA; otherwise, @@ -35,23 +36,7 @@ enum { no_frame_size = -1 }; - -#ifdef TARGET_ARCH_x86 -# include "c1_Defs_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "c1_Defs_sparc.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "c1_Defs_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "c1_Defs_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "c1_Defs_aarch64.hpp" -#endif - +#include CPU_HEADER(c1_Defs) // native word offsets from memory address enum { diff --git a/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp b/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp index 491b064e764..3094bbe786e 100644 --- a/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp +++ b/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, 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 @@ -27,26 +27,12 @@ #include "c1/c1_FrameMap.hpp" #include "memory/allocation.hpp" +#include "utilities/macros.hpp" // Provides location for forward declaration of this class, which is // only implemented on Intel class FpuStackSim; -#ifdef TARGET_ARCH_x86 -# include "c1_FpuStackSim_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "c1_FpuStackSim_sparc.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "c1_FpuStackSim_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "c1_FpuStackSim_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "c1_FpuStackSim_aarch64.hpp" -#endif - +#include CPU_HEADER(c1_FpuStackSim) #endif // SHARE_VM_C1_C1_FPUSTACKSIM_HPP diff --git a/hotspot/src/share/vm/c1/c1_FrameMap.hpp b/hotspot/src/share/vm/c1/c1_FrameMap.hpp index 5e29ca33aec..33aa9a307a1 100644 --- a/hotspot/src/share/vm/c1/c1_FrameMap.hpp +++ b/hotspot/src/share/vm/c1/c1_FrameMap.hpp @@ -33,6 +33,7 @@ #include "runtime/frame.hpp" #include "runtime/synchronizer.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" class ciMethod; class CallingConvention; @@ -80,22 +81,7 @@ class FrameMap : public CompilationResourceObj { spill_slot_size_in_bytes = 4 }; -#ifdef TARGET_ARCH_x86 -# include "c1_FrameMap_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "c1_FrameMap_sparc.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "c1_FrameMap_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "c1_FrameMap_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "c1_FrameMap_aarch64.hpp" -#endif - +#include CPU_HEADER(c1_FrameMap) friend class LIR_OprDesc; diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp index c7d317051ca..c0d39d6b6d3 100644 --- a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp +++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, 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 @@ -28,6 +28,7 @@ #include "c1/c1_CodeStubs.hpp" #include "ci/ciMethodData.hpp" #include "oops/methodData.hpp" +#include "utilities/macros.hpp" class Compilation; class ScopeValue; @@ -257,21 +258,7 @@ class LIR_Assembler: public CompilationResourceObj { void atomic_op(LIR_Code code, LIR_Opr src, LIR_Opr data, LIR_Opr dest, LIR_Opr tmp); -#ifdef TARGET_ARCH_x86 -# include "c1_LIRAssembler_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "c1_LIRAssembler_sparc.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "c1_LIRAssembler_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "c1_LIRAssembler_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "c1_LIRAssembler_aarch64.hpp" -#endif +#include CPU_HEADER(c1_LIRAssembler) }; diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.hpp b/hotspot/src/share/vm/c1/c1_LinearScan.hpp index 00ed78f632a..54ce364c33f 100644 --- a/hotspot/src/share/vm/c1/c1_LinearScan.hpp +++ b/hotspot/src/share/vm/c1/c1_LinearScan.hpp @@ -31,6 +31,7 @@ #include "c1/c1_Instruction.hpp" #include "c1/c1_LIR.hpp" #include "c1/c1_LIRGenerator.hpp" +#include "utilities/macros.hpp" class DebugInfoCache; class FpuStackAllocator; @@ -959,23 +960,7 @@ class LinearScanTimers : public StackObj { #endif // ifndef PRODUCT - // Pick up platform-dependent implementation details -#ifdef TARGET_ARCH_x86 -# include "c1_LinearScan_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "c1_LinearScan_sparc.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "c1_LinearScan_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "c1_LinearScan_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "c1_LinearScan_aarch64.hpp" -#endif - +#include CPU_HEADER(c1_LinearScan) #endif // SHARE_VM_C1_C1_LINEARSCAN_HPP diff --git a/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp b/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp index 74937660ecb..7607a08c520 100644 --- a/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp +++ b/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, 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 @@ -27,6 +27,7 @@ #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" +#include "utilities/macros.hpp" class CodeEmitInfo; @@ -47,21 +48,7 @@ class C1_MacroAssembler: public MacroAssembler { void verify_stack_oop(int offset) PRODUCT_RETURN; void verify_not_null_oop(Register r) PRODUCT_RETURN; -#ifdef TARGET_ARCH_x86 -# include "c1_MacroAssembler_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "c1_MacroAssembler_sparc.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "c1_MacroAssembler_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "c1_MacroAssembler_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "c1_MacroAssembler_aarch64.hpp" -#endif +#include CPU_HEADER(c1_MacroAssembler) }; diff --git a/hotspot/src/share/vm/c1/c1_globals.hpp b/hotspot/src/share/vm/c1/c1_globals.hpp index a7a0f2eb33d..a07f8443584 100644 --- a/hotspot/src/share/vm/c1/c1_globals.hpp +++ b/hotspot/src/share/vm/c1/c1_globals.hpp @@ -26,36 +26,10 @@ #define SHARE_VM_C1_C1_GLOBALS_HPP #include "runtime/globals.hpp" -#ifdef TARGET_ARCH_x86 -# include "c1_globals_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "c1_globals_sparc.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "c1_globals_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "c1_globals_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "c1_globals_aarch64.hpp" -#endif -#ifdef TARGET_OS_FAMILY_linux -# include "c1_globals_linux.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "c1_globals_solaris.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "c1_globals_windows.hpp" -#endif -#ifdef TARGET_OS_FAMILY_aix -# include "c1_globals_aix.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "c1_globals_bsd.hpp" -#endif +#include "utilities/macros.hpp" + +#include CPU_HEADER(c1_globals) +#include OS_HEADER(c1_globals) // // Defines all global flags used by the client compiler. diff --git a/hotspot/src/share/vm/code/nativeInst.hpp b/hotspot/src/share/vm/code/nativeInst.hpp index 7917a64d103..dd8f7ee2739 100644 --- a/hotspot/src/share/vm/code/nativeInst.hpp +++ b/hotspot/src/share/vm/code/nativeInst.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -25,23 +25,8 @@ #ifndef SHARE_VM_CODE_NATIVEINST_HPP #define SHARE_VM_CODE_NATIVEINST_HPP -#ifdef TARGET_ARCH_x86 -# include "nativeInst_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "nativeInst_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "nativeInst_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "nativeInst_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "nativeInst_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "nativeInst_aarch64.hpp" -#endif +#include "utilities/macros.hpp" + +#include CPU_HEADER(nativeInst) #endif // SHARE_VM_CODE_NATIVEINST_HPP diff --git a/hotspot/src/share/vm/code/nmethod.cpp b/hotspot/src/share/vm/code/nmethod.cpp index e15e7324cf9..d09518c011f 100644 --- a/hotspot/src/share/vm/code/nmethod.cpp +++ b/hotspot/src/share/vm/code/nmethod.cpp @@ -51,21 +51,6 @@ #include "utilities/events.hpp" #include "utilities/xmlstream.hpp" #include "logging/log.hpp" -#ifdef TARGET_ARCH_x86 -# include "nativeInst_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "nativeInst_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "nativeInst_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "nativeInst_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "nativeInst_ppc.hpp" -#endif #ifdef SHARK #include "shark/sharkCompiler.hpp" #endif diff --git a/hotspot/src/share/vm/code/relocInfo.hpp b/hotspot/src/share/vm/code/relocInfo.hpp index deaa38c2c1c..de22f48574a 100644 --- a/hotspot/src/share/vm/code/relocInfo.hpp +++ b/hotspot/src/share/vm/code/relocInfo.hpp @@ -27,6 +27,7 @@ #include "memory/allocation.hpp" #include "runtime/os.hpp" +#include "utilities/macros.hpp" class nmethod; class CompiledMethod; @@ -423,24 +424,7 @@ class relocInfo VALUE_OBJ_CLASS_SPEC { static void remove_reloc_info_for_address(RelocIterator *itr, address pc, relocType old_type); // Machine dependent stuff -#ifdef TARGET_ARCH_x86 -# include "relocInfo_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "relocInfo_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "relocInfo_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "relocInfo_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "relocInfo_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "relocInfo_aarch64.hpp" -#endif +#include CPU_HEADER(relocInfo) protected: // Derived constant, based on format_width which is PD: diff --git a/hotspot/src/share/vm/code/vmreg.hpp b/hotspot/src/share/vm/code/vmreg.hpp index e6bc343c07d..5ff46566fab 100644 --- a/hotspot/src/share/vm/code/vmreg.hpp +++ b/hotspot/src/share/vm/code/vmreg.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, 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 @@ -28,6 +28,7 @@ #include "asm/register.hpp" #include "memory/allocation.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" #include "utilities/ostream.hpp" #ifdef COMPILER2 #include "opto/adlcVMDeps.hpp" @@ -139,25 +140,7 @@ public: static void set_regName(); -#ifdef TARGET_ARCH_x86 -# include "vmreg_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "vmreg_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "vmreg_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "vmreg_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "vmreg_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "vmreg_aarch64.hpp" -#endif - +#include CPU_HEADER(vmreg) }; diff --git a/hotspot/src/share/vm/code/vmreg.inline.hpp b/hotspot/src/share/vm/code/vmreg.inline.hpp index 314e14a0160..1124e66ea8a 100644 --- a/hotspot/src/share/vm/code/vmreg.inline.hpp +++ b/hotspot/src/share/vm/code/vmreg.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,23 +27,6 @@ #include "asm/register.hpp" #include "code/vmreg.hpp" -#ifdef TARGET_ARCH_x86 -# include "vmreg_x86.inline.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "vmreg_sparc.inline.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "vmreg_zero.inline.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "vmreg_arm.inline.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "vmreg_ppc.inline.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "vmreg_aarch64.inline.hpp" -#endif +#include CPU_HEADER_INLINE(vmreg) #endif // SHARE_VM_CODE_VMREG_INLINE_HPP diff --git a/hotspot/src/share/vm/compiler/disassembler.cpp b/hotspot/src/share/vm/compiler/disassembler.cpp index 8d443b70a03..4cc15c619a3 100644 --- a/hotspot/src/share/vm/compiler/disassembler.cpp +++ b/hotspot/src/share/vm/compiler/disassembler.cpp @@ -35,24 +35,7 @@ #include "runtime/os.hpp" #include "runtime/stubCodeGenerator.hpp" #include "runtime/stubRoutines.hpp" -#ifdef TARGET_ARCH_x86 -# include "depChecker_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "depChecker_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "depChecker_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "depChecker_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "depChecker_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "depChecker_aarch64.hpp" -#endif +#include CPU_HEADER(depChecker) #ifdef SHARK #include "shark/sharkEntry.hpp" #endif diff --git a/hotspot/src/share/vm/compiler/disassembler.hpp b/hotspot/src/share/vm/compiler/disassembler.hpp index eca47a798f8..4755ce7c8a4 100644 --- a/hotspot/src/share/vm/compiler/disassembler.hpp +++ b/hotspot/src/share/vm/compiler/disassembler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, 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 @@ -27,6 +27,7 @@ #include "asm/codeBuffer.hpp" #include "runtime/globals.hpp" +#include "utilities/macros.hpp" class decode_env; @@ -63,25 +64,7 @@ class Disassembler { static bool load_library(); // Machine dependent stuff -#ifdef TARGET_ARCH_x86 -# include "disassembler_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "disassembler_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "disassembler_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "disassembler_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "disassembler_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "disassembler_aarch64.hpp" -#endif - +#include CPU_HEADER(disassembler) public: static bool can_decode() { diff --git a/hotspot/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp b/hotspot/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp index 46cd63fb576..7f419bd409f 100644 --- a/hotspot/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp +++ b/hotspot/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -26,22 +26,8 @@ #include "gc/g1/g1PageBasedVirtualSpace.hpp" #include "oops/markOop.hpp" #include "oops/oop.inline.hpp" +#include "runtime/os.inline.hpp" #include "services/memTracker.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "os_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "os_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "os_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_aix -# include "os_aix.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "os_bsd.inline.hpp" -#endif #include "utilities/bitMap.inline.hpp" G1PageBasedVirtualSpace::G1PageBasedVirtualSpace(ReservedSpace rs, size_t used_size, size_t page_size) : diff --git a/hotspot/src/share/vm/gc/shared/memset_with_concurrent_readers.hpp b/hotspot/src/share/vm/gc/shared/memset_with_concurrent_readers.hpp index 43deac77236..4d7dc2b276f 100644 --- a/hotspot/src/share/vm/gc/shared/memset_with_concurrent_readers.hpp +++ b/hotspot/src/share/vm/gc/shared/memset_with_concurrent_readers.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -25,9 +25,10 @@ #ifndef SRC_SHARE_VM_GC_SHARED_MEMSETWITHCONCURRENTREADERS_HPP #define SRC_SHARE_VM_GC_SHARED_MEMSETWITHCONCURRENTREADERS_HPP +#include "utilities/macros.hpp" + #include #include -#include "utilities/macros.hpp" // Only used by concurrent collectors. #if INCLUDE_ALL_GCS @@ -36,7 +37,7 @@ // understanding that there may be concurrent readers of that memory. void memset_with_concurrent_readers(void* to, int value, size_t size); -#ifdef TARGET_ARCH_sparc +#ifdef SPARC // SPARC requires special handling. See SPARC-specific definition. @@ -51,4 +52,4 @@ inline void memset_with_concurrent_readers(void* to, int value, size_t size) { #endif // INCLUDE_ALL_GCS -#endif // include guard +#endif // SRC_SHARE_VM_GC_SHARED_MEMSETWITHCONCURRENTREADERS_HPP diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp index 5adbe465271..93f22ccbfbb 100644 --- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp +++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp @@ -32,6 +32,7 @@ #include "runtime/frame.hpp" #include "runtime/globals.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" #ifdef CC_INTERP @@ -572,7 +573,7 @@ static const char* C_msg(BytecodeInterpreter::messages msg); void print(); #endif // PRODUCT -#ifdef TARGET_ARCH_zero +#ifdef ZERO # include "bytecodeInterpreter_zero.hpp" #else #error "Only Zero Bytecode Interpreter is supported" diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp index fcc8f5e976f..6ec8f11cb8c 100644 --- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp +++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, 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 @@ -27,6 +27,7 @@ #include "interpreter/bytecodeInterpreter.hpp" #include "runtime/stubRoutines.hpp" +#include "utilities/macros.hpp" // This file holds platform-independent bodies of inline functions for the C++ based interpreter @@ -42,7 +43,7 @@ #define VERIFY_OOP(o) #endif -#ifdef TARGET_ARCH_zero +#ifdef ZERO # include "bytecodeInterpreter_zero.inline.hpp" #else #error "Only Zero Bytecode Interpreter is supported" diff --git a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp index 3d90155bd9c..98970b58bb3 100644 --- a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp +++ b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -26,6 +26,8 @@ #define SHARE_VM_INTERPRETER_CPPINTERPRETER_HPP #include "interpreter/abstractInterpreter.hpp" +#include "utilities/macros.hpp" + #ifdef CC_INTERP class InterpreterCodelet; @@ -60,7 +62,7 @@ class CppInterpreter: public AbstractInterpreter { address entry_point, address osr_buf, TRAPS); -#ifdef TARGET_ARCH_zero +#ifdef ZERO # include "cppInterpreter_zero.hpp" #endif diff --git a/hotspot/src/share/vm/interpreter/interp_masm.hpp b/hotspot/src/share/vm/interpreter/interp_masm.hpp index dddbbe5d6ac..1705e348904 100644 --- a/hotspot/src/share/vm/interpreter/interp_masm.hpp +++ b/hotspot/src/share/vm/interpreter/interp_masm.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -26,19 +26,8 @@ #define SHARE_VM_INTERPRETER_INTERP_MASM_HPP #include "asm/macroAssembler.hpp" +#include "utilities/macros.hpp" -#if defined INTERP_MASM_MD_HPP -# include INTERP_MASM_MD_HPP -#elif defined TARGET_ARCH_x86 -# include "interp_masm_x86.hpp" -#elif defined TARGET_ARCH_MODEL_sparc -# include "interp_masm_sparc.hpp" -#elif defined TARGET_ARCH_MODEL_zero -# include "interp_masm_zero.hpp" -#elif defined TARGET_ARCH_MODEL_ppc_64 -# include "interp_masm_ppc_64.hpp" -#elif defined TARGET_ARCH_MODEL_aarch64 -# include "interp_masm_aarch64.hpp" -#endif +#include CPU_HEADER(interp_masm) #endif // SHARE_VM_INTERPRETER_INTERP_MASM_HPP diff --git a/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp b/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp index d8ef297e21d..b70ab5e08c9 100644 --- a/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp +++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp @@ -32,6 +32,7 @@ #include "runtime/frame.inline.hpp" #include "runtime/signature.hpp" #include "runtime/thread.hpp" +#include "utilities/macros.hpp" // The InterpreterRuntime is called by the interpreter for everything // that cannot/should not be dealt with in assembly and needs C support. @@ -167,24 +168,7 @@ class InterpreterRuntime: AllStatic { static intptr_t trace_bytecode(JavaThread* thread, intptr_t preserve_this_value, intptr_t tos, intptr_t tos2) PRODUCT_RETURN0; // Platform dependent stuff -#ifdef TARGET_ARCH_x86 -# include "interpreterRT_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "interpreterRT_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "interpreterRT_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "interpreterRT_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "interpreterRT_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "interpreterRT_aarch64.hpp" -#endif +#include CPU_HEADER(interpreterRT) // optional normalization of fingerprints to reduce the number of adapters static uint64_t normalize_fast_native_fingerprint(uint64_t fingerprint); diff --git a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.cpp b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.cpp index a2c427f4aa8..d57eb46cbf1 100644 --- a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.cpp +++ b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -476,7 +476,7 @@ address TemplateInterpreterGenerator::generate_method_entry( case Interpreter::java_lang_Double_doubleToRawLongBits: native = true; break; -#endif // defined(TARGET_ARCH_x86) && !defined(_LP64) +#endif // !IA32 default: fatal("unexpected method kind: %d", kind); break; diff --git a/hotspot/src/share/vm/interpreter/templateTable.hpp b/hotspot/src/share/vm/interpreter/templateTable.hpp index e32b37afe6c..5ffe249420e 100644 --- a/hotspot/src/share/vm/interpreter/templateTable.hpp +++ b/hotspot/src/share/vm/interpreter/templateTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -28,6 +28,7 @@ #include "interpreter/bytecodes.hpp" #include "memory/allocation.hpp" #include "runtime/frame.hpp" +#include "utilities/macros.hpp" #ifndef CC_INTERP // All the necessary definitions used for (bytecode) template generation. Instead of @@ -349,17 +350,7 @@ class TemplateTable: AllStatic { static Template* template_for_wide(Bytecodes::Code code) { Bytecodes::wide_check(code); return &_template_table_wide[code]; } // Platform specifics -#if defined TEMPLATETABLE_MD_HPP -# include TEMPLATETABLE_MD_HPP -#elif defined (TARGET_ARCH_MODEL_x86_32) || defined (TARGET_ARCH_MODEL_x86_64) -# include "templateTable_x86.hpp" -#elif defined TARGET_ARCH_MODEL_sparc -# include "templateTable_sparc.hpp" -#elif defined TARGET_ARCH_MODEL_ppc_64 -# include "templateTable_ppc_64.hpp" -#elif defined TARGET_ARCH_MODEL_aarch64 -# include "templateTable_aarch64.hpp" -#endif +#include CPU_HEADER(templateTable) }; #endif /* !CC_INTERP */ diff --git a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp index 979be2a66e6..d2ac004043e 100644 --- a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp +++ b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp @@ -22,38 +22,21 @@ */ #include "precompiled.hpp" +#include "asm/register.hpp" +#include "classfile/vmSymbols.hpp" #include "code/compiledIC.hpp" +#include "code/vmreg.inline.hpp" #include "compiler/compileBroker.hpp" #include "compiler/disassembler.hpp" -#include "oops/oop.inline.hpp" -#include "oops/objArrayOop.inline.hpp" -#include "runtime/javaCalls.hpp" #include "jvmci/jvmciEnv.hpp" #include "jvmci/jvmciCompiler.hpp" #include "jvmci/jvmciCodeInstaller.hpp" #include "jvmci/jvmciJavaClasses.hpp" #include "jvmci/jvmciCompilerToVM.hpp" #include "jvmci/jvmciRuntime.hpp" -#include "asm/register.hpp" -#include "classfile/vmSymbols.hpp" -#include "code/vmreg.hpp" - -#ifdef TARGET_ARCH_x86 -# include "vmreg_x86.inline.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "vmreg_sparc.inline.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "vmreg_zero.inline.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "vmreg_arm.inline.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "vmreg_ppc.inline.hpp" -#endif - +#include "oops/oop.inline.hpp" +#include "oops/objArrayOop.inline.hpp" +#include "runtime/javaCalls.hpp" // frequently used constants // Allocate them with new so they are never destroyed (otherwise, a diff --git a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp index 6bb862ecf24..fd36b36215c 100644 --- a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp +++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp @@ -44,6 +44,7 @@ #include "runtime/sharedRuntime.hpp" #include "utilities/debug.hpp" #include "utilities/defaultStream.hpp" +#include "utilities/macros.hpp" #if defined(_MSC_VER) #define strtoll _strtoi64 @@ -770,14 +771,14 @@ JVM_ENTRY(void, JVM_RegisterJVMCINatives(JNIEnv *env, jclass c2vmClass)) } #ifdef _LP64 -#ifndef TARGET_ARCH_sparc +#ifndef SPARC uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end(); uintptr_t allocation_end = heap_end + ((uintptr_t)16) * 1024 * 1024 * 1024; guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)"); -#endif // TARGET_ARCH_sparc +#endif // !SPARC #else fatal("check TLAB allocation code for address space conflicts"); -#endif +#endif // _LP64 JVMCIRuntime::initialize_well_known_classes(CHECK); diff --git a/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp b/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp index 9244cd46cda..8d8f280720f 100644 --- a/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp +++ b/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp @@ -591,31 +591,31 @@ #endif // INCLUDE_ALL_GCS -#ifdef TARGET_OS_FAMILY_linux +#ifdef LINUX #define VM_ADDRESSES_OS(declare_address, declare_preprocessor_address, declare_function) \ declare_preprocessor_address("RTLD_DEFAULT", RTLD_DEFAULT) -#endif // TARGET_OS_FAMILY_linux +#endif -#ifdef TARGET_OS_FAMILY_bsd +#ifdef BSD #define VM_ADDRESSES_OS(declare_address, declare_preprocessor_address, declare_function) \ declare_preprocessor_address("RTLD_DEFAULT", RTLD_DEFAULT) -#endif // TARGET_OS_FAMILY_bsd - +#endif +// AARCH64 is defined in closed port, too. TARGET_ARCH_aarch64 is not. #ifdef TARGET_ARCH_aarch64 #define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \ volatile_nonstatic_field(JavaFrameAnchor, _last_Java_fp, intptr_t*) -#endif // TARGET_ARCH_aarch64 +#endif -#ifdef TARGET_ARCH_x86 +#ifdef X86 #define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \ volatile_nonstatic_field(JavaFrameAnchor, _last_Java_fp, intptr_t*) @@ -661,10 +661,10 @@ declare_preprocessor_constant("VM_Version::CPU_AVX512VL", CPU_AVX512VL) \ declare_preprocessor_constant("VM_Version::CPU_SHA", CPU_SHA) -#endif // TARGET_ARCH_x86 +#endif -#ifdef TARGET_ARCH_sparc +#ifdef SPARC #define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \ volatile_nonstatic_field(JavaFrameAnchor, _flags, int) @@ -694,7 +694,7 @@ declare_constant(VM_Version::sha256_instruction_m) \ declare_constant(VM_Version::sha512_instruction_m) -#endif // TARGET_ARCH_sparc +#endif /* diff --git a/hotspot/src/share/vm/opto/ad.hpp b/hotspot/src/share/vm/opto/ad.hpp index 7bd84ebeb1c..b2bf4d5d8aa 100644 --- a/hotspot/src/share/vm/opto/ad.hpp +++ b/hotspot/src/share/vm/opto/ad.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -25,20 +25,9 @@ #ifndef SHARE_VM_OPTO_AD_HPP #define SHARE_VM_OPTO_AD_HPP -#if defined AD_MD_HPP -# include AD_MD_HPP -#elif defined TARGET_ARCH_MODEL_x86_32 -# include "adfiles/ad_x86_32.hpp" -#elif defined TARGET_ARCH_MODEL_x86_64 -# include "adfiles/ad_x86_64.hpp" -#elif defined TARGET_ARCH_MODEL_sparc -# include "adfiles/ad_sparc.hpp" -#elif defined TARGET_ARCH_MODEL_zero -# include "adfiles/ad_zero.hpp" -#elif defined TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/ad_ppc_64.hpp" -#elif defined TARGET_ARCH_MODEL_aarch64 -# include "adfiles/ad_aarch64.hpp" -#endif + +#include "utilities/macros.hpp" + +#include CPU_HEADER(adfiles/ad) #endif // SHARE_VM_OPTO_AD_HPP diff --git a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp index 686615a6396..3ba603dd979 100644 --- a/hotspot/src/share/vm/opto/c2_globals.hpp +++ b/hotspot/src/share/vm/opto/c2_globals.hpp @@ -26,36 +26,10 @@ #define SHARE_VM_OPTO_C2_GLOBALS_HPP #include "runtime/globals.hpp" -#ifdef TARGET_ARCH_x86 -# include "c2_globals_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "c2_globals_sparc.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "c2_globals_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "c2_globals_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "c2_globals_aarch64.hpp" -#endif -#ifdef TARGET_OS_FAMILY_linux -# include "c2_globals_linux.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "c2_globals_solaris.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "c2_globals_windows.hpp" -#endif -#ifdef TARGET_OS_FAMILY_aix -# include "c2_globals_aix.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "c2_globals_bsd.hpp" -#endif +#include "utilities/macros.hpp" + +#include CPU_HEADER(c2_globals) +#include OS_HEADER(c2_globals) // // Defines all globals flags used by the server compiler. diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index af27b917b65..efe5ee37350 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -3304,7 +3304,7 @@ bool LibraryCallKit::inline_native_isInterrupted() { // drop through to next case set_control( _gvn.transform(new IfTrueNode(iff_bit))); -#ifndef TARGET_OS_FAMILY_windows +#ifndef _WINDOWS // (c) Or, if interrupt bit is set and clear_int is false, use 2nd fast path. Node* clr_arg = argument(1); Node* cmp_arg = _gvn.transform(new CmpINode(clr_arg, intcon(0))); @@ -3321,7 +3321,7 @@ bool LibraryCallKit::inline_native_isInterrupted() { #else // To return true on Windows you must read the _interrupted field // and check the event state i.e. take the slow path. -#endif // TARGET_OS_FAMILY_windows +#endif // _WINDOWS // (d) Otherwise, go to the slow path. slow_region->add_req(control()); diff --git a/hotspot/src/share/vm/opto/optoreg.hpp b/hotspot/src/share/vm/opto/optoreg.hpp index 53f5afeb868..3ec88f085b3 100644 --- a/hotspot/src/share/vm/opto/optoreg.hpp +++ b/hotspot/src/share/vm/opto/optoreg.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2016, 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 @@ -25,23 +25,11 @@ #ifndef SHARE_VM_OPTO_OPTOREG_HPP #define SHARE_VM_OPTO_OPTOREG_HPP +#include "utilities/macros.hpp" + // AdGlobals contains c2 specific register handling code as specified // in the .ad files. -#if defined ADGLOBALS_MD_HPP -# include ADGLOBALS_MD_HPP -#elif defined TARGET_ARCH_MODEL_x86_32 -# include "adfiles/adGlobals_x86_32.hpp" -#elif defined TARGET_ARCH_MODEL_x86_64 -# include "adfiles/adGlobals_x86_64.hpp" -#elif defined TARGET_ARCH_MODEL_sparc -# include "adfiles/adGlobals_sparc.hpp" -#elif defined TARGET_ARCH_MODEL_zero -# include "adfiles/adGlobals_zero.hpp" -#elif defined TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/adGlobals_ppc_64.hpp" -#elif defined TARGET_ARCH_MODEL_aarch64 -# include "adfiles/adGlobals_aarch64.hpp" -#endif +#include CPU_HEADER(adfiles/adGlobals) //------------------------------OptoReg---------------------------------------- // We eventually need Registers for the Real World. Registers are essentially diff --git a/hotspot/src/share/vm/prims/jni_md.h b/hotspot/src/share/vm/prims/jni_md.h index 3bd4e310245..6a078ed51c8 100644 --- a/hotspot/src/share/vm/prims/jni_md.h +++ b/hotspot/src/share/vm/prims/jni_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -23,26 +23,10 @@ * questions. */ -/* Switch to the correct jni_md.h file without reliance on -I options. */ -#ifdef TARGET_ARCH_x86 -# include "jni_x86.h" -#endif -#ifdef TARGET_ARCH_sparc -# include "jni_sparc.h" -#endif -#ifdef TARGET_ARCH_zero -# include "jni_zero.h" -#endif -#ifdef TARGET_ARCH_arm -# include "jni_arm.h" -#endif -#ifdef TARGET_ARCH_ppc -# include "jni_ppc.h" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "jni_aarch64.h" -#endif +#include "utilities/macros.hpp" +/* Switch to the correct jni_md.h file without reliance on -I options. */ +#include CPU_HEADER_H(jni) /* The local copies of JNI header files may be refreshed diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index 4da3a6492e5..0a2f1baf532 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -84,21 +84,6 @@ #include "classfile/sharedClassUtil.hpp" #include "classfile/systemDictionaryShared.hpp" #endif -#ifdef TARGET_OS_FAMILY_linux -# include "jvm_linux.h" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "jvm_solaris.h" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "jvm_windows.h" -#endif -#ifdef TARGET_OS_FAMILY_aix -# include "jvm_aix.h" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "jvm_bsd.h" -#endif #include diff --git a/hotspot/src/share/vm/prims/jvm.h b/hotspot/src/share/vm/prims/jvm.h index 5a055995d1c..58a8fbfeb75 100644 --- a/hotspot/src/share/vm/prims/jvm.h +++ b/hotspot/src/share/vm/prims/jvm.h @@ -26,21 +26,9 @@ #define SHARE_VM_PRIMS_JVM_H #include "prims/jni.h" -#ifdef TARGET_OS_FAMILY_linux -# include "jvm_linux.h" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "jvm_solaris.h" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "jvm_windows.h" -#endif -#ifdef TARGET_OS_FAMILY_aix -# include "jvm_aix.h" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "jvm_bsd.h" -#endif +#include "utilities/macros.hpp" + +#include OS_HEADER_H(jvm) #ifndef _JAVASOFT_JVM_H_ #define _JAVASOFT_JVM_H_ diff --git a/hotspot/src/share/vm/prims/methodHandles.hpp b/hotspot/src/share/vm/prims/methodHandles.hpp index b6bc97ea94d..8b20c869b30 100644 --- a/hotspot/src/share/vm/prims/methodHandles.hpp +++ b/hotspot/src/share/vm/prims/methodHandles.hpp @@ -30,13 +30,13 @@ #include "runtime/frame.inline.hpp" #include "runtime/globals.hpp" #include "runtime/interfaceSupport.hpp" +#include "utilities/macros.hpp" -#ifdef TARGET_ARCH_zero +#ifdef ZERO # include "entry_zero.hpp" #endif - class MacroAssembler; class Label; @@ -192,25 +192,7 @@ public: ref_kind == JVM_REF_invokeInterface); } - -#ifdef TARGET_ARCH_x86 -# include "methodHandles_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "methodHandles_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "methodHandles_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "methodHandles_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "methodHandles_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "methodHandles_aarch64.hpp" -#endif +#include CPU_HEADER(methodHandles) // Tracing static void trace_method_handle(MacroAssembler* _masm, const char* adaptername) PRODUCT_RETURN; diff --git a/hotspot/src/share/vm/runtime/atomic.inline.hpp b/hotspot/src/share/vm/runtime/atomic.inline.hpp index 8abc7293b24..690be7daaf1 100644 --- a/hotspot/src/share/vm/runtime/atomic.inline.hpp +++ b/hotspot/src/share/vm/runtime/atomic.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, 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 @@ -26,52 +26,9 @@ #define SHARE_VM_RUNTIME_ATOMIC_INLINE_HPP #include "runtime/atomic.hpp" +#include "utilities/macros.hpp" -// Linux -#ifdef TARGET_OS_ARCH_linux_x86 -# include "atomic_linux_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_sparc -# include "atomic_linux_sparc.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_zero -# include "atomic_linux_zero.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_arm -# include "atomic_linux_arm.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_ppc -# include "atomic_linux_ppc.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_aarch64 -# include "atomic_linux_aarch64.inline.hpp" -#endif - -// Solaris -#ifdef TARGET_OS_ARCH_solaris_x86 -# include "atomic_solaris_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_solaris_sparc -# include "atomic_solaris_sparc.inline.hpp" -#endif - -// Windows -#ifdef TARGET_OS_ARCH_windows_x86 -# include "atomic_windows_x86.inline.hpp" -#endif - -// AIX -#ifdef TARGET_OS_ARCH_aix_ppc -# include "atomic_aix_ppc.inline.hpp" -#endif - -// BSD -#ifdef TARGET_OS_ARCH_bsd_x86 -# include "atomic_bsd_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_bsd_zero -# include "atomic_bsd_zero.inline.hpp" -#endif +#include OS_CPU_HEADER_INLINE(atomic) // size_t casts... #if (SIZE_MAX != UINTPTR_MAX) diff --git a/hotspot/src/share/vm/runtime/frame.hpp b/hotspot/src/share/vm/runtime/frame.hpp index b71585a5049..d3974d713b2 100644 --- a/hotspot/src/share/vm/runtime/frame.hpp +++ b/hotspot/src/share/vm/runtime/frame.hpp @@ -29,7 +29,8 @@ #include "runtime/basicLock.hpp" #include "runtime/monitorChunk.hpp" #include "runtime/registerMap.hpp" -#ifdef TARGET_ARCH_zero +#include "utilities/macros.hpp" +#ifdef ZERO # include "stack_zero.hpp" #endif @@ -415,24 +416,7 @@ class frame VALUE_OBJ_CLASS_SPEC { int pd_oop_map_offset_adjustment() const; -#ifdef TARGET_ARCH_x86 -# include "frame_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "frame_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "frame_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "frame_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "frame_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "frame_aarch64.hpp" -#endif +#include CPU_HEADER(frame) }; diff --git a/hotspot/src/share/vm/runtime/frame.inline.hpp b/hotspot/src/share/vm/runtime/frame.inline.hpp index 79ba0f98850..1ac630250d6 100644 --- a/hotspot/src/share/vm/runtime/frame.inline.hpp +++ b/hotspot/src/share/vm/runtime/frame.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -31,13 +31,16 @@ #include "oops/method.hpp" #include "runtime/frame.hpp" #include "runtime/signature.hpp" -#ifdef TARGET_ARCH_zero +#include "utilities/macros.hpp" +#ifdef ZERO # include "entryFrame_zero.hpp" # include "fakeStubFrame_zero.hpp" # include "interpreterFrame_zero.hpp" # include "sharkFrame_zero.hpp" #endif +#include CPU_HEADER_INLINE(frame) + inline bool frame::is_entry_frame() const { return StubRoutines::returns_to_call_stub(pc()); } @@ -50,26 +53,4 @@ inline bool frame::is_first_frame() const { return is_entry_frame() && entry_frame_is_first(); } -// here are the platform-dependent bodies: - -#ifdef TARGET_ARCH_x86 -# include "frame_x86.inline.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "frame_sparc.inline.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "frame_zero.inline.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "frame_arm.inline.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "frame_ppc.inline.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "frame_aarch64.inline.hpp" -#endif - - #endif // SHARE_VM_RUNTIME_FRAME_INLINE_HPP diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 4a39173f0cf..92eaf8ef5e9 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -26,6 +26,8 @@ #define SHARE_VM_RUNTIME_GLOBALS_HPP #include "utilities/debug.hpp" +#include "utilities/macros.hpp" + #include // for DBL_MAX // use this for flags that are true per default in the tiered build @@ -38,141 +40,19 @@ #define falseInTiered true #endif -#ifdef TARGET_ARCH_x86 -# include "globals_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "globals_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "globals_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "globals_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "globals_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "globals_aarch64.hpp" -#endif -#ifdef TARGET_OS_FAMILY_linux -# include "globals_linux.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "globals_solaris.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "globals_windows.hpp" -#endif -#ifdef TARGET_OS_FAMILY_aix -# include "globals_aix.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "globals_bsd.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_x86 -# include "globals_linux_x86.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_sparc -# include "globals_linux_sparc.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_zero -# include "globals_linux_zero.hpp" -#endif -#ifdef TARGET_OS_ARCH_solaris_x86 -# include "globals_solaris_x86.hpp" -#endif -#ifdef TARGET_OS_ARCH_solaris_sparc -# include "globals_solaris_sparc.hpp" -#endif -#ifdef TARGET_OS_ARCH_windows_x86 -# include "globals_windows_x86.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_arm -# include "globals_linux_arm.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_ppc -# include "globals_linux_ppc.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_aarch64 -# include "globals_linux_aarch64.hpp" -#endif -#ifdef TARGET_OS_ARCH_aix_ppc -# include "globals_aix_ppc.hpp" -#endif -#ifdef TARGET_OS_ARCH_bsd_x86 -# include "globals_bsd_x86.hpp" -#endif -#ifdef TARGET_OS_ARCH_bsd_zero -# include "globals_bsd_zero.hpp" -#endif +#include CPU_HEADER(globals) +#include OS_HEADER(globals) +#include OS_CPU_HEADER(globals) #ifdef COMPILER1 -#ifdef TARGET_ARCH_x86 -# include "c1_globals_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "c1_globals_sparc.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "c1_globals_arm.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "c1_globals_aarch64.hpp" -#endif -#ifdef TARGET_OS_FAMILY_linux -# include "c1_globals_linux.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "c1_globals_solaris.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "c1_globals_windows.hpp" -#endif -#ifdef TARGET_OS_FAMILY_aix -# include "c1_globals_aix.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "c1_globals_bsd.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "c1_globals_ppc.hpp" -#endif +#include CPU_HEADER(c1_globals) +#include OS_HEADER(c1_globals) #endif #ifdef COMPILER2 -#ifdef TARGET_ARCH_x86 -# include "c2_globals_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "c2_globals_sparc.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "c2_globals_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "c2_globals_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "c2_globals_aarch64.hpp" -#endif -#ifdef TARGET_OS_FAMILY_linux -# include "c2_globals_linux.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "c2_globals_solaris.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "c2_globals_windows.hpp" -#endif -#ifdef TARGET_OS_FAMILY_aix -# include "c2_globals_aix.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "c2_globals_bsd.hpp" -#endif +#include CPU_HEADER(c2_globals) +#include OS_HEADER(c2_globals) #endif #ifdef SHARK -#ifdef TARGET_ARCH_zero +#ifdef ZERO # include "shark_globals_zero.hpp" #endif #endif diff --git a/hotspot/src/share/vm/runtime/icache.hpp b/hotspot/src/share/vm/runtime/icache.hpp index 9a3b9c8000d..637ea13c8bc 100644 --- a/hotspot/src/share/vm/runtime/icache.hpp +++ b/hotspot/src/share/vm/runtime/icache.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -27,6 +27,7 @@ #include "memory/allocation.hpp" #include "runtime/stubCodeGenerator.hpp" +#include "utilities/macros.hpp" // Interface for updating the instruction cache. Whenever the VM modifies // code, part of the processor instruction cache potentially has to be flushed. @@ -68,26 +69,7 @@ class AbstractICache : AllStatic { // Must be included before the definition of ICacheStubGenerator // because ICacheStubGenerator uses ICache definitions. -#ifdef TARGET_ARCH_x86 -# include "icache_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "icache_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "icache_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "icache_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "icache_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "icache_aarch64.hpp" -#endif - - +#include CPU_HEADER(icache) class ICacheStubGenerator : public StubCodeGenerator { public: diff --git a/hotspot/src/share/vm/runtime/interfaceSupport.hpp b/hotspot/src/share/vm/runtime/interfaceSupport.hpp index de3ef8f648b..4d4d51b26a0 100644 --- a/hotspot/src/share/vm/runtime/interfaceSupport.hpp +++ b/hotspot/src/share/vm/runtime/interfaceSupport.hpp @@ -34,6 +34,7 @@ #include "runtime/thread.inline.hpp" #include "runtime/vmThread.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" #include "utilities/preserveException.hpp" // Wrapper for all entry points to the virtual machine. @@ -90,21 +91,8 @@ class InterfaceSupport: AllStatic { public: // OS dependent stuff -#ifdef TARGET_OS_FAMILY_linux -# include "interfaceSupport_linux.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "interfaceSupport_solaris.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "interfaceSupport_windows.hpp" -#endif -#ifdef TARGET_OS_FAMILY_aix -# include "interfaceSupport_aix.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "interfaceSupport_bsd.hpp" -#endif + +#include OS_HEADER(interfaceSupport) }; diff --git a/hotspot/src/share/vm/runtime/javaCalls.hpp b/hotspot/src/share/vm/runtime/javaCalls.hpp index 0d885686de8..dd67b7e6bc5 100644 --- a/hotspot/src/share/vm/runtime/javaCalls.hpp +++ b/hotspot/src/share/vm/runtime/javaCalls.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -31,24 +31,9 @@ #include "runtime/javaFrameAnchor.hpp" #include "runtime/thread.hpp" #include "runtime/vmThread.hpp" -#ifdef TARGET_ARCH_x86 -# include "jniTypes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "jniTypes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "jniTypes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "jniTypes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "jniTypes_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "jniTypes_aarch64.hpp" -#endif +#include "utilities/macros.hpp" + +#include CPU_HEADER(jniTypes) // A JavaCallWrapper is constructed before each JavaCall and destructed after the call. // Its purpose is to allocate/deallocate a new handle block and to save/restore the last diff --git a/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp b/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp index 777698c3825..64565a2fa39 100644 --- a/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp +++ b/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, 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 @@ -25,8 +25,9 @@ #ifndef SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP #define SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP -#include "utilities/globalDefinitions.hpp" #include "runtime/orderAccess.inline.hpp" +#include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" // // An object for encapsulating the machine/os dependent part of a JavaThread frame state @@ -77,25 +78,7 @@ friend class JavaCallWrapper; // and no one should look at the other fields. void zap(void) { _last_Java_sp = NULL; } -#ifdef TARGET_ARCH_x86 -# include "javaFrameAnchor_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "javaFrameAnchor_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "javaFrameAnchor_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "javaFrameAnchor_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "javaFrameAnchor_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "javaFrameAnchor_aarch64.hpp" -#endif - +#include CPU_HEADER(javaFrameAnchor) public: JavaFrameAnchor() { clear(); } diff --git a/hotspot/src/share/vm/runtime/mutex.cpp b/hotspot/src/share/vm/runtime/mutex.cpp index a065fb13db2..f24e2a034db 100644 --- a/hotspot/src/share/vm/runtime/mutex.cpp +++ b/hotspot/src/share/vm/runtime/mutex.cpp @@ -30,18 +30,7 @@ #include "runtime/osThread.hpp" #include "runtime/thread.inline.hpp" #include "utilities/events.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "mutex_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "mutex_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "mutex_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "mutex_bsd.inline.hpp" -#endif +#include "utilities/macros.hpp" // o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o // diff --git a/hotspot/src/share/vm/runtime/orderAccess.inline.hpp b/hotspot/src/share/vm/runtime/orderAccess.inline.hpp index bc3237351ea..0907a43d71a 100644 --- a/hotspot/src/share/vm/runtime/orderAccess.inline.hpp +++ b/hotspot/src/share/vm/runtime/orderAccess.inline.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2014 SAP SE. All rights reserved. + * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016 SAP SE. 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 @@ -28,52 +28,9 @@ #include "runtime/atomic.inline.hpp" #include "runtime/orderAccess.hpp" +#include "utilities/macros.hpp" -// Linux -#ifdef TARGET_OS_ARCH_linux_x86 -# include "orderAccess_linux_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_sparc -# include "orderAccess_linux_sparc.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_zero -# include "orderAccess_linux_zero.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_arm -# include "orderAccess_linux_arm.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_aarch64 -# include "orderAccess_linux_aarch64.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_ppc -# include "orderAccess_linux_ppc.inline.hpp" -#endif - -// Solaris -#ifdef TARGET_OS_ARCH_solaris_x86 -# include "orderAccess_solaris_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_solaris_sparc -# include "orderAccess_solaris_sparc.inline.hpp" -#endif - -// Windows -#ifdef TARGET_OS_ARCH_windows_x86 -# include "orderAccess_windows_x86.inline.hpp" -#endif - -// AIX -#ifdef TARGET_OS_ARCH_aix_ppc -# include "orderAccess_aix_ppc.inline.hpp" -#endif - -// BSD -#ifdef TARGET_OS_ARCH_bsd_x86 -# include "orderAccess_bsd_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_bsd_zero -# include "orderAccess_bsd_zero.inline.hpp" -#endif +#include OS_CPU_HEADER_INLINE(orderAccess) #ifdef VM_HAS_GENERALIZED_ORDER_ACCESS diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp index 554a183857e..f8d674d91cb 100644 --- a/hotspot/src/share/vm/runtime/os.cpp +++ b/hotspot/src/share/vm/runtime/os.cpp @@ -1742,7 +1742,7 @@ void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) { pd_realign_memory(addr, bytes, alignment_hint); } -#ifndef TARGET_OS_FAMILY_windows +#ifndef _WINDOWS /* try to switch state from state "from" to state "to" * returns the state set after the method is complete */ diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp index f99088bd999..f22b508f4cd 100644 --- a/hotspot/src/share/vm/runtime/os.hpp +++ b/hotspot/src/share/vm/runtime/os.hpp @@ -26,29 +26,15 @@ #define SHARE_VM_RUNTIME_OS_HPP #include "jvmtifiles/jvmti.h" +#include "prims/jvm.h" #include "runtime/extendedPC.hpp" #include "runtime/handles.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "jvm_linux.h" +#include "utilities/macros.hpp" +#ifndef _WINDOWS # include #endif -#ifdef TARGET_OS_FAMILY_solaris -# include "jvm_solaris.h" -# include -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "jvm_windows.h" -#endif -#ifdef TARGET_OS_FAMILY_aix -# include "jvm_aix.h" -# include -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "jvm_bsd.h" -# include -# ifdef __APPLE__ -# include -# endif +#ifdef __APPLE__ +# include #endif class AgentLibrary; @@ -816,61 +802,11 @@ class os: AllStatic { }; // Platform dependent stuff -#ifdef TARGET_OS_FAMILY_linux -# include "os_linux.hpp" +#ifndef _WINDOWS # include "os_posix.hpp" #endif -#ifdef TARGET_OS_FAMILY_solaris -# include "os_solaris.hpp" -# include "os_posix.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "os_windows.hpp" -#endif -#ifdef TARGET_OS_FAMILY_aix -# include "os_aix.hpp" -# include "os_posix.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "os_posix.hpp" -# include "os_bsd.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_x86 -# include "os_linux_x86.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_sparc -# include "os_linux_sparc.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_zero -# include "os_linux_zero.hpp" -#endif -#ifdef TARGET_OS_ARCH_solaris_x86 -# include "os_solaris_x86.hpp" -#endif -#ifdef TARGET_OS_ARCH_solaris_sparc -# include "os_solaris_sparc.hpp" -#endif -#ifdef TARGET_OS_ARCH_windows_x86 -# include "os_windows_x86.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_arm -# include "os_linux_arm.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_ppc -# include "os_linux_ppc.hpp" -#endif -#ifdef TARGET_OS_ARCH_aix_ppc -# include "os_aix_ppc.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_aarch64 -# include "os_linux_aarch64.hpp" -#endif -#ifdef TARGET_OS_ARCH_bsd_x86 -# include "os_bsd_x86.hpp" -#endif -#ifdef TARGET_OS_ARCH_bsd_zero -# include "os_bsd_zero.hpp" -#endif +#include OS_CPU_HEADER(os) +#include OS_HEADER(os) #ifndef OS_NATIVE_THREAD_CREATION_FAILED_MSG #define OS_NATIVE_THREAD_CREATION_FAILED_MSG "unable to create native thread: possibly out of memory or process/resource limits reached" @@ -937,7 +873,7 @@ class os: AllStatic { bool _done; }; -#ifndef TARGET_OS_FAMILY_windows +#ifndef _WINDOWS // Suspend/resume support // Protocol: // @@ -1008,7 +944,7 @@ class os: AllStatic { return _state == SR_SUSPENDED; } }; -#endif +#endif // !WINDOWS protected: diff --git a/hotspot/src/share/vm/runtime/os.inline.hpp b/hotspot/src/share/vm/runtime/os.inline.hpp index 392e44d0f6a..3814b56daee 100644 --- a/hotspot/src/share/vm/runtime/os.inline.hpp +++ b/hotspot/src/share/vm/runtime/os.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,20 +27,6 @@ #include "runtime/os.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "os_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "os_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "os_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_aix -# include "os_aix.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "os_bsd.inline.hpp" -#endif +#include OS_HEADER_INLINE(os) #endif // SHARE_VM_RUNTIME_OS_INLINE_HPP diff --git a/hotspot/src/share/vm/runtime/osThread.hpp b/hotspot/src/share/vm/runtime/osThread.hpp index 16cc2e8055e..1e8bcf0df8a 100644 --- a/hotspot/src/share/vm/runtime/osThread.hpp +++ b/hotspot/src/share/vm/runtime/osThread.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -29,6 +29,7 @@ #include "runtime/handles.hpp" #include "runtime/javaFrameAnchor.hpp" #include "runtime/objectMonitor.hpp" +#include "utilities/macros.hpp" // The OSThread class holds OS-specific thread information. It is equivalent // to the sys_thread_t structure of the classic JVM implementation. @@ -96,21 +97,7 @@ class OSThread: public CHeapObj { static ByteSize interrupted_offset() { return byte_offset_of(OSThread, _interrupted); } // Platform dependent stuff -#ifdef TARGET_OS_FAMILY_linux -# include "osThread_linux.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "osThread_solaris.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "osThread_windows.hpp" -#endif -#ifdef TARGET_OS_FAMILY_aix -# include "osThread_aix.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "osThread_bsd.hpp" -#endif +#include OS_HEADER(osThread) public: static ByteSize thread_id_offset() { return byte_offset_of(OSThread, _thread_id); } diff --git a/hotspot/src/share/vm/runtime/prefetch.inline.hpp b/hotspot/src/share/vm/runtime/prefetch.inline.hpp index f4e30de34d9..1ff16716651 100644 --- a/hotspot/src/share/vm/runtime/prefetch.inline.hpp +++ b/hotspot/src/share/vm/runtime/prefetch.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -26,51 +26,7 @@ #define SHARE_VM_RUNTIME_PREFETCH_INLINE_HPP #include "runtime/prefetch.hpp" - -// Linux -#ifdef TARGET_OS_ARCH_linux_x86 -# include "prefetch_linux_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_sparc -# include "prefetch_linux_sparc.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_zero -# include "prefetch_linux_zero.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_arm -# include "prefetch_linux_arm.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_aarch64 -# include "prefetch_linux_aarch64.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_ppc -# include "prefetch_linux_ppc.inline.hpp" -#endif - -// Solaris -#ifdef TARGET_OS_ARCH_solaris_x86 -# include "prefetch_solaris_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_solaris_sparc -# include "prefetch_solaris_sparc.inline.hpp" -#endif - -// Windows -#ifdef TARGET_OS_ARCH_windows_x86 -# include "prefetch_windows_x86.inline.hpp" -#endif - -// AIX -#ifdef TARGET_OS_ARCH_aix_ppc -# include "prefetch_aix_ppc.inline.hpp" -#endif - -// BSD -#ifdef TARGET_OS_ARCH_bsd_x86 -# include "prefetch_bsd_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_bsd_zero -# include "prefetch_bsd_zero.inline.hpp" -#endif +#include "utilities/macros.hpp" +#include OS_CPU_HEADER_INLINE(prefetch) #endif // SHARE_VM_RUNTIME_PREFETCH_INLINE_HPP diff --git a/hotspot/src/share/vm/runtime/registerMap.hpp b/hotspot/src/share/vm/runtime/registerMap.hpp index 0b2d410e71b..046e9fe39e3 100644 --- a/hotspot/src/share/vm/runtime/registerMap.hpp +++ b/hotspot/src/share/vm/runtime/registerMap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, 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 @@ -27,6 +27,7 @@ #include "code/vmreg.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" class JavaThread; @@ -120,24 +121,7 @@ class RegisterMap : public StackObj { void print() const; // the following contains the definition of pd_xxx methods -#ifdef TARGET_ARCH_x86 -# include "registerMap_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "registerMap_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "registerMap_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "registerMap_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "registerMap_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "registerMap_aarch64.hpp" -#endif +#include CPU_HEADER(registerMap) }; diff --git a/hotspot/src/share/vm/runtime/semaphore.hpp b/hotspot/src/share/vm/runtime/semaphore.hpp index 8a282d4a9ed..ecf8e8ae001 100644 --- a/hotspot/src/share/vm/runtime/semaphore.hpp +++ b/hotspot/src/share/vm/runtime/semaphore.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -27,11 +27,11 @@ #include "memory/allocation.hpp" -#if defined(TARGET_OS_FAMILY_linux) || defined(TARGET_OS_FAMILY_solaris) || defined(TARGET_OS_FAMILY_aix) +#if defined(LINUX) || defined(SOLARIS) || defined(AIX) # include "semaphore_posix.hpp" -#elif defined(TARGET_OS_FAMILY_bsd) +#elif defined(BSD) # include "semaphore_bsd.hpp" -#elif defined(TARGET_OS_FAMILY_windows) +#elif defined(_WINDOWS) # include "semaphore_windows.hpp" #else # error "No semaphore implementation provided for this OS" diff --git a/hotspot/src/share/vm/runtime/stubRoutines.hpp b/hotspot/src/share/vm/runtime/stubRoutines.hpp index 729886f04fd..0ec3219fc52 100644 --- a/hotspot/src/share/vm/runtime/stubRoutines.hpp +++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp @@ -30,6 +30,7 @@ #include "runtime/frame.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/stubCodeGenerator.hpp" +#include "utilities/macros.hpp" // StubRoutines provides entry points to assembly routines used by // compiled code and the run-time system. Platform-specific entry @@ -83,21 +84,8 @@ class StubRoutines: AllStatic { // Dependencies friend class StubGenerator; -#if defined STUBROUTINES_MD_HPP -# include STUBROUTINES_MD_HPP -#elif defined TARGET_ARCH_MODEL_x86_32 -# include "stubRoutines_x86_32.hpp" -#elif defined TARGET_ARCH_MODEL_x86_64 -# include "stubRoutines_x86_64.hpp" -#elif defined TARGET_ARCH_MODEL_sparc -# include "stubRoutines_sparc.hpp" -#elif defined TARGET_ARCH_MODEL_zero -# include "stubRoutines_zero.hpp" -#elif defined TARGET_ARCH_MODEL_ppc_64 -# include "stubRoutines_ppc_64.hpp" -#elif defined TARGET_ARCH_MODEL_aarch64 -# include "stubRoutines_aarch64.hpp" -#endif + +#include CPU_HEADER(stubRoutines) static jint _verify_oop_count; static address _verify_oop_subroutine_entry; diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp index 46828d4cab2..37e6ed310c0 100644 --- a/hotspot/src/share/vm/runtime/thread.hpp +++ b/hotspot/src/share/vm/runtime/thread.hpp @@ -50,7 +50,7 @@ #include "gc/g1/dirtyCardQueue.hpp" #include "gc/g1/satbMarkQueue.hpp" #endif // INCLUDE_ALL_GCS -#ifdef TARGET_ARCH_zero +#ifdef ZERO # include "stack_zero.hpp" #endif @@ -1905,43 +1905,7 @@ class JavaThread: public Thread { #endif // INCLUDE_ALL_GCS // Machine dependent stuff -#ifdef TARGET_OS_ARCH_linux_x86 -# include "thread_linux_x86.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_sparc -# include "thread_linux_sparc.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_zero -# include "thread_linux_zero.hpp" -#endif -#ifdef TARGET_OS_ARCH_solaris_x86 -# include "thread_solaris_x86.hpp" -#endif -#ifdef TARGET_OS_ARCH_solaris_sparc -# include "thread_solaris_sparc.hpp" -#endif -#ifdef TARGET_OS_ARCH_windows_x86 -# include "thread_windows_x86.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_arm -# include "thread_linux_arm.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_ppc -# include "thread_linux_ppc.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_aarch64 -# include "thread_linux_aarch64.hpp" -#endif -#ifdef TARGET_OS_ARCH_aix_ppc -# include "thread_aix_ppc.hpp" -#endif -#ifdef TARGET_OS_ARCH_bsd_x86 -# include "thread_bsd_x86.hpp" -#endif -#ifdef TARGET_OS_ARCH_bsd_zero -# include "thread_bsd_zero.hpp" -#endif - +#include OS_CPU_HEADER(thread) public: void set_blocked_on_compilation(bool value) { diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index 610dc13c227..a0687534eb3 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -107,77 +107,9 @@ #include "utilities/hashtable.hpp" #include "utilities/macros.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "vmStructs_linux.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "vmStructs_solaris.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "vmStructs_windows.hpp" -#endif -#ifdef TARGET_OS_FAMILY_aix -# include "vmStructs_aix.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "vmStructs_bsd.hpp" -#endif - -#ifdef TARGET_ARCH_x86 -# include "vmStructs_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "vmStructs_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "vmStructs_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "vmStructs_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "vmStructs_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "vmStructs_aarch64.hpp" -#endif - -#ifdef TARGET_OS_ARCH_linux_x86 -# include "vmStructs_linux_x86.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_sparc -# include "vmStructs_linux_sparc.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_zero -# include "vmStructs_linux_zero.hpp" -#endif -#ifdef TARGET_OS_ARCH_solaris_x86 -# include "vmStructs_solaris_x86.hpp" -#endif -#ifdef TARGET_OS_ARCH_solaris_sparc -# include "vmStructs_solaris_sparc.hpp" -#endif -#ifdef TARGET_OS_ARCH_windows_x86 -# include "vmStructs_windows_x86.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_arm -# include "vmStructs_linux_arm.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_ppc -# include "vmStructs_linux_ppc.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_aarch64 -# include "vmStructs_linux_aarch64.hpp" -#endif -#ifdef TARGET_OS_ARCH_aix_ppc -# include "vmStructs_aix_ppc.hpp" -#endif -#ifdef TARGET_OS_ARCH_bsd_x86 -# include "vmStructs_bsd_x86.hpp" -#endif -#ifdef TARGET_OS_ARCH_bsd_zero -# include "vmStructs_bsd_zero.hpp" -#endif +#include CPU_HEADER(vmStructs) +#include OS_HEADER(vmStructs) +#include OS_CPU_HEADER(vmStructs) #if INCLUDE_ALL_GCS #include "gc/cms/compactibleFreeListSpace.hpp" diff --git a/hotspot/src/share/vm/runtime/vm_version.hpp b/hotspot/src/share/vm/runtime/vm_version.hpp index a9e57338af5..e0f89ea958c 100644 --- a/hotspot/src/share/vm/runtime/vm_version.hpp +++ b/hotspot/src/share/vm/runtime/vm_version.hpp @@ -27,6 +27,7 @@ #include "memory/allocation.hpp" #include "utilities/ostream.hpp" +#include "utilities/macros.hpp" // VM_Version provides information about the VM. @@ -160,20 +161,6 @@ class Abstract_VM_Version: AllStatic { static bool supports_on_spin_wait() { return false; } }; -#ifdef TARGET_ARCH_x86 -# include "vm_version_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "vm_version_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "vm_version_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "vm_version_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "vm_version_ppc.hpp" -#endif +#include CPU_HEADER(vm_version) #endif // SHARE_VM_RUNTIME_VM_VERSION_HPP diff --git a/hotspot/src/share/vm/shark/sharkRuntime.cpp b/hotspot/src/share/vm/shark/sharkRuntime.cpp index c6fd028479b..454c87f657e 100644 --- a/hotspot/src/share/vm/shark/sharkRuntime.cpp +++ b/hotspot/src/share/vm/shark/sharkRuntime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -30,7 +30,8 @@ #include "runtime/thread.hpp" #include "shark/llvmHeaders.hpp" #include "shark/sharkRuntime.hpp" -#ifdef TARGET_ARCH_zero +#include "utilities/macros.hpp" +#ifdef ZERO # include "stack_zero.inline.hpp" #endif diff --git a/hotspot/src/share/vm/shark/shark_globals.hpp b/hotspot/src/share/vm/shark/shark_globals.hpp index 1c33fd31384..3ee0b9a1dce 100644 --- a/hotspot/src/share/vm/shark/shark_globals.hpp +++ b/hotspot/src/share/vm/shark/shark_globals.hpp @@ -27,7 +27,8 @@ #define SHARE_VM_SHARK_SHARK_GLOBALS_HPP #include "runtime/globals.hpp" -#ifdef TARGET_ARCH_zero +#include "utilities/macros.hpp" +#ifdef ZERO # include "shark_globals_zero.hpp" #endif diff --git a/hotspot/src/share/vm/utilities/bytes.hpp b/hotspot/src/share/vm/utilities/bytes.hpp index 8b5aa9b14e4..9ea1782ff8a 100644 --- a/hotspot/src/share/vm/utilities/bytes.hpp +++ b/hotspot/src/share/vm/utilities/bytes.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -25,23 +25,8 @@ #ifndef SHARE_VM_UTILITIES_BYTES_HPP #define SHARE_VM_UTILITIES_BYTES_HPP -#ifdef TARGET_ARCH_x86 -# include "bytes_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "bytes_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "bytes_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "bytes_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "bytes_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "bytes_aarch64.hpp" -#endif +#include "utilities/macros.hpp" + +#include CPU_HEADER(bytes) #endif // SHARE_VM_UTILITIES_BYTES_HPP diff --git a/hotspot/src/share/vm/utilities/copy.hpp b/hotspot/src/share/vm/utilities/copy.hpp index 242867e0b28..e8d733b91b0 100644 --- a/hotspot/src/share/vm/utilities/copy.hpp +++ b/hotspot/src/share/vm/utilities/copy.hpp @@ -26,6 +26,7 @@ #define SHARE_VM_UTILITIES_COPY_HPP #include "runtime/stubRoutines.hpp" +#include "utilities/macros.hpp" // Assembly code for platforms that need it. extern "C" { @@ -332,24 +333,7 @@ class Copy : AllStatic { } // Platform dependent implementations of the above methods. -#ifdef TARGET_ARCH_x86 -# include "copy_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "copy_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "copy_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "copy_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "copy_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "copy_aarch64.hpp" -#endif +#include CPU_HEADER(copy) }; diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp index 4c9e513c65a..d75b51b3b15 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp @@ -73,7 +73,6 @@ #define ATTRIBUTE_SCANF(fmt, vargs) #endif - #include "utilities/macros.hpp" // This file holds all globally used constants & types, class (forward) @@ -456,24 +455,7 @@ enum RTMState { // Allow targets to reduce the default size of the code cache. #define CODE_CACHE_DEFAULT_LIMIT CODE_CACHE_SIZE_LIMIT -#ifdef TARGET_ARCH_x86 -# include "globalDefinitions_x86.hpp" -#endif -#ifdef TARGET_ARCH_sparc -# include "globalDefinitions_sparc.hpp" -#endif -#ifdef TARGET_ARCH_zero -# include "globalDefinitions_zero.hpp" -#endif -#ifdef TARGET_ARCH_arm -# include "globalDefinitions_arm.hpp" -#endif -#ifdef TARGET_ARCH_ppc -# include "globalDefinitions_ppc.hpp" -#endif -#ifdef TARGET_ARCH_aarch64 -# include "globalDefinitions_aarch64.hpp" -#endif +#include CPU_HEADER(globalDefinitions) #ifndef INCLUDE_RTM_OPT #define INCLUDE_RTM_OPT 0 diff --git a/hotspot/src/share/vm/utilities/macros.hpp b/hotspot/src/share/vm/utilities/macros.hpp index 62b117e944d..029352e4791 100644 --- a/hotspot/src/share/vm/utilities/macros.hpp +++ b/hotspot/src/share/vm/utilities/macros.hpp @@ -316,6 +316,7 @@ #endif #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) +#define BSD #define BSD_ONLY(code) code #define NOT_BSD(code) #else @@ -429,6 +430,10 @@ #define NOT_E500V2(code) code #endif +// Note: There are three ARM ports. They set the following in the makefiles: +// 1. Closed 32-bit port: -DARM -DARM32 -DTARGET_ARCH_arm +// 2. Closed 64-bit port: -DARM -DAARCH64 -D_LP64 -DTARGET_ARCH_arm +// 3. Open 64-bit port: -DAARCH64 -D_LP64 -DTARGET_ARCH_aaarch64 #ifdef ARM #define ARM_ONLY(code) code #define NOT_ARM(code) @@ -463,4 +468,30 @@ #define define_pd_global(type, name, value) const type pd_##name = value; +// Helper macros for constructing file names for includes. +#define CPU_HEADER_STEM(basename) PASTE_TOKENS(basename, INCLUDE_SUFFIX_CPU) +#define OS_HEADER_STEM(basename) PASTE_TOKENS(basename, INCLUDE_SUFFIX_OS) +#define OS_CPU_HEADER_STEM(basename) PASTE_TOKENS(basename, PASTE_TOKENS(INCLUDE_SUFFIX_OS, INCLUDE_SUFFIX_CPU)) + +// Include platform dependent files. +// +// This macro constructs from basename and INCLUDE_SUFFIX_OS / +// INCLUDE_SUFFIX_CPU, which are set on the command line, the name of +// platform dependent files to be included. +// Example: INCLUDE_SUFFIX_OS=_linux / INCLUDE_SUFFIX_CPU=_sparc +// CPU_HEADER_INLINE(macroAssembler) --> macroAssembler_sparc.inline.hpp +// OS_CPU_HEADER(vmStructs) --> vmStructs_linux_sparc.hpp +// +// basename.hpp / basename.inline.hpp +#define CPU_HEADER_H(basename) XSTR(CPU_HEADER_STEM(basename).h) +#define CPU_HEADER(basename) XSTR(CPU_HEADER_STEM(basename).hpp) +#define CPU_HEADER_INLINE(basename) XSTR(CPU_HEADER_STEM(basename).inline.hpp) +// basename.hpp / basename.inline.hpp +#define OS_HEADER_H(basename) XSTR(OS_HEADER_STEM(basename).h) +#define OS_HEADER(basename) XSTR(OS_HEADER_STEM(basename).hpp) +#define OS_HEADER_INLINE(basename) XSTR(OS_HEADER_STEM(basename).inline.hpp) +// basename.hpp / basename.inline.hpp +#define OS_CPU_HEADER(basename) XSTR(OS_CPU_HEADER_STEM(basename).hpp) +#define OS_CPU_HEADER_INLINE(basename) XSTR(OS_CPU_HEADER_STEM(basename).inline.hpp) + #endif // SHARE_VM_UTILITIES_MACROS_HPP From 3636d8f3d5f312d53fc8a347d82bb96e8119ca75 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Mon, 25 Jul 2016 14:31:42 -0700 Subject: [PATCH 086/108] 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled Don't convert loop with safepoint on the backedge to Counted loop Reviewed-by: kvn --- hotspot/src/share/vm/opto/loopnode.cpp | 10 +++- .../TestCountedLoopSafepointBackedge.java | 52 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java diff --git a/hotspot/src/share/vm/opto/loopnode.cpp b/hotspot/src/share/vm/opto/loopnode.cpp index 7862a71a164..727e0b920cc 100644 --- a/hotspot/src/share/vm/opto/loopnode.cpp +++ b/hotspot/src/share/vm/opto/loopnode.cpp @@ -279,8 +279,16 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) { return false; // Allow funny placement of Safepoint - if (back_control->Opcode() == Op_SafePoint) + if (back_control->Opcode() == Op_SafePoint) { + if (UseCountedLoopSafepoints) { + // Leaving the safepoint on the backedge and creating a + // CountedLoop will confuse optimizations. We can't move the + // safepoint around because its jvm state wouldn't match a new + // location. Give up on that loop. + return false; + } back_control = back_control->in(TypeFunc::Control); + } // Controlling test for loop Node *iftrue = back_control; diff --git a/hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java b/hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java new file mode 100644 index 00000000000..d5709675aa9 --- /dev/null +++ b/hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2016, Red Hat, Inc. 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 8161147 + * @summary Safepoint on backedge breaks UseCountedLoopSafepoints + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+UseCountedLoopSafepoints TestCountedLoopSafepointBackedge + * + */ + +public class TestCountedLoopSafepointBackedge { + static void test(int[] arr, int inc) { + int i = 0; + for (;;) { + for (int j = 0; j < 10; j++); + arr[i] = i; + i++; + if (i >= 100) { + break; + } + for (int j = 0; j < 10; j++); + } + } + + static public void main(String[] args) { + int[] arr = new int[100]; + for (int i = 0; i < 20000; i++) { + test(arr, 1); + } + } +} From ad6ab858405bd20d82cf33cb2a23a87ac95a4713 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 20 Jul 2016 12:34:11 +0200 Subject: [PATCH 087/108] 8161907: adlc: Fix crash in cisc_spill_match if _rChild == NULL Reviewed-by: kvn --- hotspot/src/share/vm/adlc/formssel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/adlc/formssel.cpp b/hotspot/src/share/vm/adlc/formssel.cpp index 42aefeb2575..7f720b1b708 100644 --- a/hotspot/src/share/vm/adlc/formssel.cpp +++ b/hotspot/src/share/vm/adlc/formssel.cpp @@ -3647,14 +3647,14 @@ int MatchNode::cisc_spill_match(FormDict& globals, RegisterForm* registers, Matc // Check left operands if( (_lChild == NULL) && (mRule2->_lChild == NULL) ) { left_spillable = Maybe_cisc_spillable; - } else { + } else if (_lChild != NULL) { left_spillable = _lChild->cisc_spill_match(globals, registers, mRule2->_lChild, operand, reg_type); } // Check right operands if( (_rChild == NULL) && (mRule2->_rChild == NULL) ) { right_spillable = Maybe_cisc_spillable; - } else { + } else if (_rChild != NULL) { right_spillable = _rChild->cisc_spill_match(globals, registers, mRule2->_rChild, operand, reg_type); } From 7c454046848557a6f84b2127b26eaa29102a0a9d Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Tue, 26 Jul 2016 11:04:20 +0200 Subject: [PATCH 088/108] 8147910: Cache initial active_processor_count Introduce and initialize active_processor_count variable in VM. Reviewed-by: dholmes, jprovino --- hotspot/src/share/vm/runtime/os.cpp | 14 +++++++++++++- hotspot/src/share/vm/runtime/os.hpp | 13 +++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp index f8d674d91cb..f0fa94ea884 100644 --- a/hotspot/src/share/vm/runtime/os.cpp +++ b/hotspot/src/share/vm/runtime/os.cpp @@ -71,6 +71,7 @@ volatile int32_t* os::_mem_serialize_page = NULL; uintptr_t os::_serialize_page_mask = 0; long os::_rand_seed = 1; int os::_processor_count = 0; +int os::_initial_active_processor_count = 0; size_t os::_page_sizes[os::page_sizes_max]; #ifndef PRODUCT @@ -315,6 +316,7 @@ static void signal_thread_entry(JavaThread* thread, TRAPS) { } void os::init_before_ergo() { + initialize_initial_active_processor_count(); // We need to initialize large page support here because ergonomics takes some // decisions depending on large page support and the calculated large page size. large_page_init(); @@ -829,7 +831,11 @@ void os::print_cpu_info(outputStream* st, char* buf, size_t buflen) { st->print("CPU:"); st->print("total %d", os::processor_count()); // It's not safe to query number of active processors after crash - // st->print("(active %d)", os::active_processor_count()); + // st->print("(active %d)", os::active_processor_count()); but we can + // print the initial number of active processors. + // We access the raw value here because the assert in the accessor will + // fail if the crash occurs before initialization of this value. + st->print(" (initial active %d)", _initial_active_processor_count); st->print(" %s", VM_Version::features_string()); st->cr(); pd_print_cpu_info(st, buf, buflen); @@ -1597,6 +1603,12 @@ bool os::is_server_class_machine() { return result; } +void os::initialize_initial_active_processor_count() { + assert(_initial_active_processor_count == 0, "Initial active processor count already set."); + _initial_active_processor_count = active_processor_count(); + log_debug(os)("Initial active processor count set to %d" , _initial_active_processor_count); +} + void os::SuspendedThreadTask::run() { assert(Threads_lock->owned_by_self() || (_thread == VMThread::vm_thread()), "must have threads lock to call this"); internal_do_task(); diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp index f22b508f4cd..0cf1bd6e068 100644 --- a/hotspot/src/share/vm/runtime/os.hpp +++ b/hotspot/src/share/vm/runtime/os.hpp @@ -140,6 +140,7 @@ class os: AllStatic { static void get_summary_cpu_info(char* buf, size_t buflen); static void get_summary_os_info(char* buf, size_t buflen); + static void initialize_initial_active_processor_count(); public: static void init(void); // Called before command line parsing static void init_before_ergo(void); // Called after command line parsing @@ -227,6 +228,13 @@ class os: AllStatic { // Note that on some OSes this can change dynamically. static int active_processor_count(); + // At startup the number of active CPUs this process is allowed to run on. + // This value does not change dynamically. May be different from active_processor_count(). + static int initial_active_processor_count() { + assert(_initial_active_processor_count > 0, "Initial active processor count not set yet."); + return _initial_active_processor_count; + } + // Bind processes to processors. // This is a two step procedure: // first you generate a distribution of processes to processors, @@ -948,8 +956,9 @@ class os: AllStatic { protected: - static long _rand_seed; // seed for random number generator - static int _processor_count; // number of processors + static long _rand_seed; // seed for random number generator + static int _processor_count; // number of processors + static int _initial_active_processor_count; // number of active processors during initialization. static char* format_boot_path(const char* format_string, const char* home, From 2313844e20e614cab39802cc022ae854e4e861e0 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Tue, 26 Jul 2016 11:04:20 +0200 Subject: [PATCH 089/108] 8161993: G1 crashes if active_processor_count changes during startup Use the initial active processor count for memory initialization instead of the current active one. Reviewed-by: dholmes, mgerdin --- hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp | 2 +- hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp | 5 ++--- hotspot/src/share/vm/runtime/vm_version.cpp | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp b/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp index f95c29a039e..b16ccc6fed0 100644 --- a/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp +++ b/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp @@ -122,7 +122,7 @@ DirtyCardQueueSet::DirtyCardQueueSet(bool notify_when_complete) : // Determines how many mutator threads can process the buffers in parallel. uint DirtyCardQueueSet::num_par_ids() { - return (uint)os::processor_count(); + return (uint)os::initial_active_processor_count(); } void DirtyCardQueueSet::initialize(CardTableEntryClosure* cl, diff --git a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp index 612ea93e6d7..93ee1fbbbb7 100644 --- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp +++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp @@ -416,11 +416,10 @@ G1ConcurrentMark::G1ConcurrentMark(G1CollectedHeap* g1h, G1RegionToSpaceMapper* double overall_cm_overhead = (double) MaxGCPauseMillis * marking_overhead / (double) GCPauseIntervalMillis; - double cpu_ratio = 1.0 / (double) os::processor_count(); + double cpu_ratio = 1.0 / os::initial_active_processor_count(); double marking_thread_num = ceil(overall_cm_overhead / cpu_ratio); double marking_task_overhead = - overall_cm_overhead / marking_thread_num * - (double) os::processor_count(); + overall_cm_overhead / marking_thread_num * os::initial_active_processor_count(); double sleep_factor = (1.0 - marking_task_overhead) / marking_task_overhead; diff --git a/hotspot/src/share/vm/runtime/vm_version.cpp b/hotspot/src/share/vm/runtime/vm_version.cpp index 98e90d5ecb2..17ecaa8a05e 100644 --- a/hotspot/src/share/vm/runtime/vm_version.cpp +++ b/hotspot/src/share/vm/runtime/vm_version.cpp @@ -295,7 +295,7 @@ unsigned int Abstract_VM_Version::nof_parallel_worker_threads( // processor after the first 8. For example, on a 72 cpu machine // and a chosen fraction of 5/8 // use 8 + (72 - 8) * (5/8) == 48 worker threads. - unsigned int ncpus = (unsigned int) os::active_processor_count(); + unsigned int ncpus = (unsigned int) os::initial_active_processor_count(); threads = (ncpus <= switch_pt) ? ncpus : (switch_pt + ((ncpus - switch_pt) * num) / den); From 64f4953141761d3352363b6e69db3454f75d798e Mon Sep 17 00:00:00 2001 From: Lois Foltan Date: Tue, 26 Jul 2016 10:29:27 -0400 Subject: [PATCH 090/108] 8154239: -Xbootclasspath/a breaks exploded build Correct exploded modules build system class path search for the boot loader Reviewed-by: acorn, ccheung, hseigel, jiangli --- .../src/share/vm/classfile/classLoader.cpp | 404 ++++++++++-------- .../src/share/vm/classfile/classLoader.hpp | 85 ++-- .../src/share/vm/classfile/classLoaderExt.hpp | 15 +- hotspot/src/share/vm/classfile/modules.cpp | 34 +- .../vm/classfile/sharedPathsMiscInfo.hpp | 4 +- .../share/vm/classfile/systemDictionary.cpp | 2 +- hotspot/src/share/vm/memory/filemap.cpp | 49 ++- hotspot/src/share/vm/runtime/arguments.cpp | 22 +- hotspot/src/share/vm/runtime/arguments.hpp | 29 +- hotspot/src/share/vm/runtime/init.cpp | 2 - hotspot/src/share/vm/runtime/os.cpp | 4 +- 11 files changed, 338 insertions(+), 312 deletions(-) diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp index 1186067c242..843bc6657f5 100644 --- a/hotspot/src/share/vm/classfile/classLoader.cpp +++ b/hotspot/src/share/vm/classfile/classLoader.cpp @@ -141,11 +141,11 @@ PerfCounter* ClassLoader::_isUnsyncloadClass = NULL; PerfCounter* ClassLoader::_load_instance_class_failCounter = NULL; GrowableArray* ClassLoader::_xpatch_entries = NULL; -ClassPathEntry* ClassLoader::_first_entry = NULL; -ClassPathEntry* ClassLoader::_last_entry = NULL; -int ClassLoader::_num_entries = 0; +GrowableArray* ClassLoader::_exploded_entries = NULL; +ClassPathEntry* ClassLoader::_jrt_entry = NULL; ClassPathEntry* ClassLoader::_first_append_entry = NULL; -bool ClassLoader::_has_jimage = false; +ClassPathEntry* ClassLoader::_last_append_entry = NULL; +int ClassLoader::_num_entries = 0; #if INCLUDE_CDS GrowableArray* ClassLoader::_boot_modules_array = NULL; GrowableArray* ClassLoader::_platform_modules_array = NULL; @@ -508,7 +508,7 @@ ClassFileStream* ClassPathImageEntry::open_stream(const char* name, TRAPS) { #endif } else { - PackageEntry* package_entry = get_package_entry(name, ClassLoaderData::the_null_class_loader_data(), THREAD); + PackageEntry* package_entry = get_package_entry(name, ClassLoaderData::the_null_class_loader_data(), CHECK_NULL); if (package_entry != NULL) { ResourceMark rm; // Get the module name @@ -651,7 +651,6 @@ void ClassLoader::check_shared_classpath(const char *path) { #endif void ClassLoader::setup_bootstrap_search_path() { - assert(_first_entry == NULL, "should not setup bootstrap class search path twice"); const char* sys_class_path = Arguments::get_sysclasspath(); const char* java_class_path = Arguments::get_appclasspath(); if (PrintSharedArchiveAndExit) { @@ -694,7 +693,10 @@ void ClassLoader::setup_xpatch_entries() { GrowableArray* xpatch_args = Arguments::get_xpatchprefix(); int num_of_entries = xpatch_args->length(); - // Set up the boot loader's xpatch_entries list + assert(!DumpSharedSpaces, "DumpSharedSpaces not supported with -Xpatch"); + assert(!UseSharedSpaces, "UseSharedSpaces not supported with -Xpatch"); + + // Set up the boot loader's _xpatch_entries list _xpatch_entries = new (ResourceObj::C_HEAP, mtModule) GrowableArray(num_of_entries, true); for (int i = 0; i < num_of_entries; i++) { @@ -742,10 +744,9 @@ void ClassLoader::setup_xpatch_entries() { } void ClassLoader::setup_search_path(const char *class_path, bool bootstrap_search) { - int offset = 0; int len = (int)strlen(class_path); int end = 0; - bool mark_append_entry = false; + bool set_base_piece = bootstrap_search; // Iterate over class path entries for (int start = 0; start < len; start = end) { @@ -754,21 +755,45 @@ void ClassLoader::setup_search_path(const char *class_path, bool bootstrap_searc } EXCEPTION_MARK; ResourceMark rm(THREAD); - mark_append_entry = (mark_append_entry || - (bootstrap_search && (start == Arguments::bootclassloader_append_index()))); char* path = NEW_RESOURCE_ARRAY(char, end - start + 1); strncpy(path, &class_path[start], end - start); path[end - start] = '\0'; - update_class_path_entry_list(path, false, mark_append_entry, false, bootstrap_search); - // Check on the state of the boot loader's append path - if (mark_append_entry && (_first_append_entry == NULL)) { - // Failure to mark the first append entry, most likely - // due to a non-existent path. Record the next entry - // as the first boot loader append entry. - mark_append_entry = true; + // The first time through the bootstrap_search setup, it must be determined + // what the base or core piece of the boot loader search is. Either a java runtime + // image is present or this is an exploded module build situation. + if (set_base_piece) { + assert(string_ends_with(path, MODULES_IMAGE_NAME) || string_ends_with(path, "java.base"), + "Incorrect boot loader search path, no java runtime image or java.base exploded build"); + struct stat st; + if (os::stat(path, &st) == 0) { + // Directory found + Thread* THREAD = Thread::current(); + ClassPathEntry* new_entry = create_class_path_entry(path, &st, false, false, CHECK); + + // Check for a jimage + if (Arguments::has_jimage()) { + assert(_jrt_entry == NULL, "should not setup bootstrap class search path twice"); + assert(new_entry != NULL && new_entry->is_jrt(), "No java runtime image present"); + _jrt_entry = new_entry; + ++_num_entries; +#if INCLUDE_CDS + if (DumpSharedSpaces) { + JImageFile *jimage = _jrt_entry->jimage(); + assert(jimage != NULL, "No java runtime image file present"); + ClassLoader::initialize_module_loader_map(jimage); + } +#endif + } + } else { + // If path does not exist, exit + vm_exit_during_initialization("Unable to establish the boot loader search path", path); + } + set_base_piece = false; } else { - mark_append_entry = false; + // Every entry on the system boot class path after the initial base piece, + // which is set by os::set_boot_path(), is considered an appended entry. + update_class_path_entry_list(path, false, bootstrap_search); } #if INCLUDE_CDS @@ -782,6 +807,45 @@ void ClassLoader::setup_search_path(const char *class_path, bool bootstrap_searc } } +// During an exploded modules build, each module defined to the boot loader +// will be added to the ClassLoader::_exploded_entries array. +void ClassLoader::add_to_exploded_build_list(Symbol* module_sym, TRAPS) { + assert(!ClassLoader::has_jrt_entry(), "Exploded build not applicable"); + + // Set up the boot loader's _exploded_entries list + if (_exploded_entries == NULL) { + _exploded_entries = new (ResourceObj::C_HEAP, mtModule) GrowableArray(EXPLODED_ENTRY_SIZE, true); + } + + // Find the module's symbol + ResourceMark rm(THREAD); + const char *module_name = module_sym->as_C_string(); + const char *home = Arguments::get_java_home(); + const char file_sep = os::file_separator()[0]; + // 10 represents the length of "modules" + 2 file separators + \0 + size_t len = strlen(home) + strlen(module_name) + 10; + char *path = NEW_C_HEAP_ARRAY(char, len, mtModule); + jio_snprintf(path, len, "%s%cmodules%c%s", home, file_sep, file_sep, module_name); + + struct stat st; + if (os::stat(path, &st) == 0) { + // Directory found + ClassPathEntry* new_entry = create_class_path_entry(path, &st, false, false, CHECK); + + // If the path specification is valid, enter it into this module's list. + // There is no need to check for duplicate modules in the exploded entry list, + // since no two modules with the same name can be defined to the boot loader. + // This is checked at module definition time in Modules::define_module. + if (new_entry != NULL) { + ModuleClassPathList* module_cpl = new ModuleClassPathList(module_sym); + module_cpl->add_to_list(new_entry); + _exploded_entries->push(module_cpl); + log_info(class, load)("path: %s", path); + } + } + FREE_C_HEAP_ARRAY(char, path); +} + ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const struct stat* st, bool throw_exception, bool is_boot_append, TRAPS) { @@ -872,21 +936,9 @@ ClassPathZipEntry* ClassLoader::create_class_path_zip_entry(const char *path, bo return NULL; } -// The boot class loader must adhere to specfic visibility rules. -// Prior to loading a class in a named package, the package is checked -// to see if it is in a module defined to the boot loader. If the -// package is not in a module defined to the boot loader, the class -// must be loaded only in the boot loader's append path, which -// consists of [-Xbootclasspath/a]; [jvmti appended entries] -void ClassLoader::set_first_append_entry(ClassPathEntry *new_entry) { - if (_first_append_entry == NULL) { - _first_append_entry = new_entry; - } -} - // returns true if entry already on class path bool ClassLoader::contains_entry(ClassPathEntry *entry) { - ClassPathEntry* e = _first_entry; + ClassPathEntry* e = _first_append_entry; while (e != NULL) { // assume zip entries have been canonicalized if (strcmp(entry->name(), e->name()) == 0) { @@ -899,41 +951,24 @@ bool ClassLoader::contains_entry(ClassPathEntry *entry) { void ClassLoader::add_to_list(ClassPathEntry *new_entry) { if (new_entry != NULL) { - if (_last_entry == NULL) { - _first_entry = _last_entry = new_entry; + if (_last_append_entry == NULL) { + assert(_first_append_entry == NULL, "boot loader's append class path entry list not empty"); + _first_append_entry = _last_append_entry = new_entry; } else { - _last_entry->set_next(new_entry); - _last_entry = new_entry; + _last_append_entry->set_next(new_entry); + _last_append_entry = new_entry; } } - _num_entries ++; -} - -void ClassLoader::prepend_to_list(ClassPathEntry *new_entry) { - if (new_entry != NULL) { - if (_last_entry == NULL) { - _first_entry = _last_entry = new_entry; - } else { - new_entry->set_next(_first_entry); - _first_entry = new_entry; - } - } - _num_entries ++; + _num_entries++; } void ClassLoader::add_to_list(const char *apath) { - update_class_path_entry_list((char*)apath, false, false, false, false); -} - -void ClassLoader::prepend_to_list(const char *apath) { - update_class_path_entry_list((char*)apath, false, false, true, false); + update_class_path_entry_list((char*)apath, false, false); } // Returns true IFF the file/dir exists and the entry was successfully created. bool ClassLoader::update_class_path_entry_list(const char *path, bool check_for_duplicates, - bool mark_append_entry, - bool prepend_entry, bool is_boot_append, bool throw_exception) { struct stat st; @@ -946,19 +981,10 @@ bool ClassLoader::update_class_path_entry_list(const char *path, return false; } - // Ensure that the first boot loader append entry will always be set correctly. - assert((!mark_append_entry || - (mark_append_entry && (!check_for_duplicates || !contains_entry(new_entry)))), - "failed to mark boot loader's first append boundary"); - // Do not reorder the bootclasspath which would break get_system_package(). // Add new entry to linked list - if (!check_for_duplicates || !contains_entry(new_entry)) { - ClassLoaderExt::add_class_path_entry(path, check_for_duplicates, new_entry, prepend_entry); - if (mark_append_entry) { - set_first_append_entry(new_entry); - } + ClassLoaderExt::add_class_path_entry(path, check_for_duplicates, new_entry); } return true; } else { @@ -971,30 +997,47 @@ bool ClassLoader::update_class_path_entry_list(const char *path, } } +static void print_module_entry_table(const GrowableArray* const module_list) { + ResourceMark rm; + int num_of_entries = module_list->length(); + for (int i = 0; i < num_of_entries; i++) { + ClassPathEntry* e; + ModuleClassPathList* mpl = module_list->at(i); + tty->print("%s=", mpl->module_name()->as_C_string()); + e = mpl->module_first_entry(); + while (e != NULL) { + tty->print("%s", e->name()); + e = e->next(); + if (e != NULL) { + tty->print("%s", os::path_separator()); + } + } + tty->print(" ;"); + } +} + void ClassLoader::print_bootclasspath() { ClassPathEntry* e; tty->print("[bootclasspath= "); // Print -Xpatch module/path specifications first if (_xpatch_entries != NULL) { - ResourceMark rm; - int num_of_entries = _xpatch_entries->length(); - for (int i = 0; i < num_of_entries; i++) { - ModuleClassPathList* mpl = _xpatch_entries->at(i); - tty->print("%s=", mpl->module_name()->as_C_string()); - e = mpl->module_first_entry(); - while (e != NULL) { - tty->print("%s", e->name()); - e = e->next(); - if (e != NULL) { - tty->print("%s", os::path_separator()); - } - } - tty->print(" ;"); + print_module_entry_table(_xpatch_entries); + } + + // [jimage | exploded modules build] + if (has_jrt_entry()) { + // Print the location of the java runtime image + tty->print("%s ;", _jrt_entry->name()); + } else { + // Print exploded module build path specifications + if (_exploded_entries != NULL) { + print_module_entry_table(_exploded_entries); } } - e = _first_entry; + // appended entries + e = _first_append_entry; while (e != NULL) { tty->print("%s ;", e->name()); e = e->next(); @@ -1298,6 +1341,60 @@ const char* ClassLoader::file_name_for_class_name(const char* class_name, return file_name; } +// Search either the xpatch or exploded build entries for class +ClassFileStream* ClassLoader::search_module_entries(const GrowableArray* const module_list, + const char* const class_name, const char* const file_name, TRAPS) { + ClassFileStream* stream = NULL; + + // Find the class' defining module in the boot loader's module entry table + PackageEntry* pkg_entry = get_package_entry(class_name, ClassLoaderData::the_null_class_loader_data(), CHECK_NULL); + ModuleEntry* mod_entry = (pkg_entry != NULL) ? pkg_entry->module() : NULL; + + // If the module system has not defined java.base yet, then + // classes loaded are assumed to be defined to java.base. + // When java.base is eventually defined by the module system, + // all packages of classes that have been previously loaded + // are verified in ModuleEntryTable::verify_javabase_packages(). + if (!Universe::is_module_initialized() && + !ModuleEntryTable::javabase_defined() && + mod_entry == NULL) { + mod_entry = ModuleEntryTable::javabase_module(); + } + + // The module must be a named module + if (mod_entry != NULL && mod_entry->is_named()) { + int num_of_entries = module_list->length(); + const Symbol* class_module_name = mod_entry->name(); + + // Loop through all the modules in either the xpatch or exploded entries looking for module + for (int i = 0; i < num_of_entries; i++) { + ModuleClassPathList* module_cpl = module_list->at(i); + Symbol* module_cpl_name = module_cpl->module_name(); + + if (module_cpl_name->fast_compare(class_module_name) == 0) { + // Class' module has been located, attempt to load + // the class from the module's ClassPathEntry list. + ClassPathEntry* e = module_cpl->module_first_entry(); + while (e != NULL) { + stream = e->open_stream(file_name, CHECK_NULL); + // No context.check is required since CDS is not supported + // for an exploded modules build or if -Xpatch is specified. + if (NULL != stream) { + return stream; + } + e = e->next(); + } + // If the module was located, break out even if the class was not + // located successfully from that module's ClassPathEntry list. + // There will not be another valid entry for that module. + return NULL; + } + } + } + + return NULL; +} + instanceKlassHandle ClassLoader::load_class(Symbol* name, bool search_append_only, TRAPS) { assert(name != NULL, "invariant"); assert(THREAD->is_Java_thread(), "must be a JavaThread"); @@ -1321,18 +1418,19 @@ instanceKlassHandle ClassLoader::load_class(Symbol* name, bool search_append_onl s2 classpath_index = 0; ClassPathEntry* e = NULL; - // If DumpSharedSpaces is true, boot loader visibility boundaries are set - // to be _first_entry to the end (all path entries). No -Xpatch entries are - // included since CDS and AppCDS are not supported if -Xpatch is specified. + // If DumpSharedSpaces is true boot loader visibility boundaries are set to: + // - [jimage] + [_first_append_entry to _last_append_entry] (all path entries). + // No -Xpatch entries or exploded module builds are included since CDS + // is not supported if -Xpatch or exploded module builds are used. // // If search_append_only is true, boot loader visibility boundaries are // set to be _first_append_entry to the end. This includes: // [-Xbootclasspath/a]; [jvmti appended entries] // // If both DumpSharedSpaces and search_append_only are false, boot loader - // visibility boundaries are set to be _first_entry to the entry before - // the _first_append_entry. This would include: - // [-Xpatch:=()*]; [exploded build | jimage] + // visibility boundaries are set to be the -Xpatch entries plus the base piece. + // This would include: + // [-Xpatch:=()*]; [jimage | exploded module build] // // DumpSharedSpaces and search_append_only are mutually exclusive and cannot // be true at the same time. @@ -1341,85 +1439,37 @@ instanceKlassHandle ClassLoader::load_class(Symbol* name, bool search_append_onl // Load Attempt #1: -Xpatch // Determine the class' defining module. If it appears in the _xpatch_entries, // attempt to load the class from those locations specific to the module. + // Specifications to -Xpatch can contain a partial number of classes + // that are part of the overall module definition. So if a particular class is not + // found within its module specification, the search should continue to Load Attempt #2. // Note: The -Xpatch entries are never searched if the boot loader's // visibility boundary is limited to only searching the append entries. if (_xpatch_entries != NULL && !search_append_only && !DumpSharedSpaces) { - // Find the module in the boot loader's module entry table - PackageEntry* pkg_entry = get_package_entry(class_name, ClassLoaderData::the_null_class_loader_data(), THREAD); - ModuleEntry* mod_entry = (pkg_entry != NULL) ? pkg_entry->module() : NULL; - - // If the module system has not defined java.base yet, then - // classes loaded are assumed to be defined to java.base. - // When java.base is eventually defined by the module system, - // all packages of classes that have been previously loaded - // are verified in ModuleEntryTable::verify_javabase_packages(). - if (!Universe::is_module_initialized() && - !ModuleEntryTable::javabase_defined() && - mod_entry == NULL) { - mod_entry = ModuleEntryTable::javabase_module(); - } - - // The module must be a named module - if (mod_entry != NULL && mod_entry->is_named()) { - int num_of_entries = _xpatch_entries->length(); - const Symbol* class_module_name = mod_entry->name(); - - // Loop through all the xpatch entries looking for module - for (int i = 0; i < num_of_entries; i++) { - ModuleClassPathList* module_cpl = _xpatch_entries->at(i); - Symbol* module_cpl_name = module_cpl->module_name(); - - if (module_cpl_name->fast_compare(class_module_name) == 0) { - // Class' module has been located, attempt to load - // the class from the module's ClassPathEntry list. - e = module_cpl->module_first_entry(); - while (e != NULL) { - stream = e->open_stream(file_name, CHECK_NULL); - // No context.check is required since both CDS - // and AppCDS are turned off if -Xpatch is specified. - if (NULL != stream) { - break; - } - e = e->next(); - } - // If the module was located in the xpatch entries, break out - // even if the class was not located successfully from that module's - // ClassPathEntry list. There will not be another valid entry for - // that module in the _xpatch_entries array. - break; - } - } - } + stream = search_module_entries(_xpatch_entries, class_name, file_name, CHECK_NULL); } - // Load Attempt #2: [exploded build | jimage] + // Load Attempt #2: [jimage | exploded build] if (!search_append_only && (NULL == stream)) { - e = _first_entry; - while ((e != NULL) && (e != _first_append_entry)) { - stream = e->open_stream(file_name, CHECK_NULL); + if (has_jrt_entry()) { + e = _jrt_entry; + stream = _jrt_entry->open_stream(file_name, CHECK_NULL); if (!context.check(stream, classpath_index)) { return NULL; } - if (NULL != stream) { - break; - } - e = e->next(); - ++classpath_index; + } else { + // Exploded build - attempt to locate class in its defining module's location. + assert(_exploded_entries != NULL, "No exploded build entries present"); + stream = search_module_entries(_exploded_entries, class_name, file_name, CHECK_NULL); } } // Load Attempt #3: [-Xbootclasspath/a]; [jvmti appended entries] if ((search_append_only || DumpSharedSpaces) && (NULL == stream)) { - // For the boot loader append path search, must calculate - // the starting classpath_index prior to attempting to - // load the classfile. - if (search_append_only) { - ClassPathEntry *tmp_e = _first_entry; - while ((tmp_e != NULL) && (tmp_e != _first_append_entry)) { - tmp_e = tmp_e->next(); - ++classpath_index; - } - } + // For the boot loader append path search, the starting classpath_index + // for the appended piece is always 1 to account for either the + // _jrt_entry or the _exploded_entries. + assert(classpath_index == 0, "The classpath_index has been incremented incorrectly"); + classpath_index = 1; e = _first_append_entry; while (e != NULL) { @@ -1597,16 +1647,25 @@ void classLoader_init1() { } // Complete the ClassPathEntry setup for the boot loader -void classLoader_init2() { +void ClassLoader::classLoader_init2(TRAPS) { + // Create the moduleEntry for java.base + create_javabase(); + // Setup the list of module/path pairs for -Xpatch processing // This must be done after the SymbolTable is created in order // to use fast_compare on module names instead of a string compare. if (Arguments::get_xpatchprefix() != NULL) { - ClassLoader::setup_xpatch_entries(); + setup_xpatch_entries(); } - // Determine if this is an exploded build - ClassLoader::set_has_jimage(); + // Setup the initial java.base/path pair for the exploded build entries. + // As more modules are defined during module system initialization, more + // entries will be added to the exploded build array. + if (!has_jrt_entry()) { + assert(!DumpSharedSpaces, "DumpSharedSpaces not supported with exploded module builds"); + assert(!UseSharedSpaces, "UsedSharedSpaces not supported with exploded module builds"); + add_to_exploded_build_list(vmSymbols::java_base(), CHECK); + } } @@ -1654,26 +1713,6 @@ void ClassLoader::create_javabase() { } } -void ClassLoader::set_has_jimage() { - // Determine if this is an exploded build. When looking for - // the jimage file, only search the piece of the boot - // loader's boot class path which contains [exploded build | jimage]. - // Do not search the boot loader's xpatch entries or append path. - ClassPathEntry* e = _first_entry; - ClassPathEntry* last_e = _first_append_entry; - while ((e != NULL) && (e != last_e)) { - JImageFile *jimage = e->jimage(); - if (jimage != NULL && e->is_jrt()) { - _has_jimage = true; -#if INCLUDE_CDS - ClassLoader::initialize_module_loader_map(jimage); -#endif - return; - } - e = e->next(); - } -} - #ifndef PRODUCT // CompileTheWorld @@ -1762,14 +1801,19 @@ void ClassLoader::compile_the_world() { HandleMark hm(THREAD); ResourceMark rm(THREAD); + assert(has_jrt_entry(), "Compile The World not supported with exploded module build"); + // Find bootstrap loader Handle system_class_loader (THREAD, SystemDictionary::java_system_loader()); - // Iterate over all bootstrap class path entries - ClassPathEntry* e = _first_entry; jlong start = os::javaTimeMillis(); + + // Compile the world for the modular java runtime image + _jrt_entry->compile_the_world(system_class_loader, CATCH); + + // Iterate over all bootstrap class path appended entries + ClassPathEntry* e = _first_append_entry; while (e != NULL) { - // We stop at "modules" jimage, unless it is the first bootstrap path entry - if (e->is_jrt() && e != _first_entry) break; + assert(!e->is_jrt(), "A modular java runtime image is present on the list of appended entries"); e->compile_the_world(system_class_loader, CATCH); e = e->next(); } diff --git a/hotspot/src/share/vm/classfile/classLoader.hpp b/hotspot/src/share/vm/classfile/classLoader.hpp index c59697c52cd..045bfab715c 100644 --- a/hotspot/src/share/vm/classfile/classLoader.hpp +++ b/hotspot/src/share/vm/classfile/classLoader.hpp @@ -216,33 +216,34 @@ class ClassLoader: AllStatic { // 1. the module/path pairs specified to -Xpatch // -Xpatch:=()* // 2. the base piece - // [exploded build | jimage] + // [jimage | build with exploded modules] // 3. boot loader append path // [-Xbootclasspath/a]; [jvmti appended entries] // // The boot loader must obey this order when attempting // to load a class. - // Contains the module/path pairs specified to -Xpatch + // 1. Contains the module/path pairs specified to -Xpatch static GrowableArray* _xpatch_entries; - // Contains the ClassPathEntry instances that include - // both the base piece and the boot loader append path. - static ClassPathEntry* _first_entry; - // Last entry in linked list of ClassPathEntry instances - static ClassPathEntry* _last_entry; - static int _num_entries; + // 2. the base piece + // Contains the ClassPathEntry of the modular java runtime image. + // If no java runtime image is present, this indicates a + // build with exploded modules is being used instead. + static ClassPathEntry* _jrt_entry; + static GrowableArray* _exploded_entries; + enum { EXPLODED_ENTRY_SIZE = 80 }; // Initial number of exploded modules - // Marks the start of: - // - the boot loader's append path - // [-Xbootclasspath/a]; [jvmti appended entries] - // within the linked list of ClassPathEntry instances. + // 3. the boot loader's append path + // [-Xbootclasspath/a]; [jvmti appended entries] + // Note: boot loader append path does not support named modules. static ClassPathEntry* _first_append_entry; + // Last entry in linked list of appended ClassPathEntry instances + static ClassPathEntry* _last_append_entry; - static const char* _shared_archive; - - // True if the boot path has a "modules" jimage - static bool _has_jimage; + // Note: _num_entries includes the java runtime image and all + // the entries on the _first_append_entry linked list. + static int _num_entries; // Array of module names associated with the boot class loader CDS_ONLY(static GrowableArray* _boot_modules_array;) @@ -253,9 +254,14 @@ class ClassLoader: AllStatic { // Info used by CDS CDS_ONLY(static SharedPathsMiscInfo * _shared_paths_misc_info;) - // Initialization + // Initialization: + // - setup the boot loader's system class path + // - setup the boot loader's xpatch entries, if present + // - create the ModuleEntry for java.base static void setup_bootstrap_search_path(); static void setup_search_path(const char *class_path, bool setting_bootstrap); + static void setup_xpatch_entries(); + static void create_javabase(); static void load_zip_library(); static void load_jimage_library(); @@ -285,8 +291,6 @@ class ClassLoader: AllStatic { static int crc32(int crc, const char* buf, int len); static bool update_class_path_entry_list(const char *path, bool check_for_duplicates, - bool mark_append_entry, - bool prepend_entry, bool is_boot_append, bool throw_exception=true); static void print_bootclasspath(); @@ -352,15 +356,17 @@ class ClassLoader: AllStatic { return _load_instance_class_failCounter; } - // Set up the module/path pairs as specified to -Xpatch - static void setup_xpatch_entries(); + // Modular java runtime image is present vs. a build with exploded modules + static bool has_jrt_entry() { return (_jrt_entry != NULL); } + static ClassPathEntry* get_jrt_entry() { return _jrt_entry; } - // Sets _has_jimage to TRUE if "modules" jimage file exists - static void set_has_jimage(); - static bool has_jimage() { return _has_jimage; } + // Add a module's exploded directory to the boot loader's exploded module build list + static void add_to_exploded_build_list(Symbol* module_name, TRAPS); - // Create the ModuleEntry for java.base - static void create_javabase(); + // Attempt load of individual class from either the xpatch or exploded modules build lists + static ClassFileStream* search_module_entries(const GrowableArray* const module_list, + const char* const class_name, + const char* const file_name, TRAPS); // Load individual .class file static instanceKlassHandle load_class(Symbol* class_name, bool search_append_only, TRAPS); @@ -381,17 +387,28 @@ class ClassLoader: AllStatic { // Initialization static void initialize(); + static void classLoader_init2(TRAPS); CDS_ONLY(static void initialize_shared_path();) static int compute_Object_vtable(); static ClassPathEntry* classpath_entry(int n) { - ClassPathEntry* e = ClassLoader::_first_entry; - while (--n >= 0) { - assert(e != NULL, "Not that many classpath entries."); - e = e->next(); + if (n == 0) { + assert(has_jrt_entry(), "No class path entry at 0 for exploded module builds"); + return ClassLoader::_jrt_entry; + } else { + // The java runtime image is always the first entry + // in the FileMapInfo::_classpath_entry_table. Even though + // the _jrt_entry is not included in the _first_append_entry + // linked list, it must be accounted for when comparing the + // class path vs. the shared archive class path. + ClassPathEntry* e = ClassLoader::_first_append_entry; + while (--n >= 1) { + assert(e != NULL, "Not that many classpath entries."); + e = e->next(); + } + return e; } - return e; } #if INCLUDE_CDS @@ -429,18 +446,12 @@ class ClassLoader: AllStatic { // adds a class path list static void add_to_list(ClassPathEntry* new_entry); - // prepends a class path list - static void prepend_to_list(ClassPathEntry* new_entry); - // creates a class path zip entry (returns NULL if JAR file cannot be opened) static ClassPathZipEntry* create_class_path_zip_entry(const char *apath, bool is_boot_append); // add a path to class path list static void add_to_list(const char* apath); - // prepend a path to class path list - static void prepend_to_list(const char* apath); - static bool string_ends_with(const char* str, const char* str_to_find); // obtain package name from a fully qualified class name diff --git a/hotspot/src/share/vm/classfile/classLoaderExt.hpp b/hotspot/src/share/vm/classfile/classLoaderExt.hpp index 6ce2275cc3b..1f0b1b6128d 100644 --- a/hotspot/src/share/vm/classfile/classLoaderExt.hpp +++ b/hotspot/src/share/vm/classfile/classLoaderExt.hpp @@ -71,22 +71,11 @@ public: static void add_class_path_entry(const char* path, bool check_for_duplicates, - ClassPathEntry* new_entry, bool prepend_entry) { - if (prepend_entry) { - ClassLoader::prepend_to_list(new_entry); - } else { - ClassLoader::add_to_list(new_entry); - } + ClassPathEntry* new_entry) { + ClassLoader::add_to_list(new_entry); } static void append_boot_classpath(ClassPathEntry* new_entry) { ClassLoader::add_to_list(new_entry); - // During jvmti live phase an entry can be appended to the boot - // loader's ClassPathEntry instances. Need to mark the start - // of the boot loader's append path in case there was no reason - // to mark it initially in setup_bootstrap_search_path. - if (ClassLoader::_first_append_entry == NULL) { - ClassLoader::set_first_append_entry(new_entry); - } } static void setup_search_paths() {} static bool is_boot_classpath(int classpath_index) { diff --git a/hotspot/src/share/vm/classfile/modules.cpp b/hotspot/src/share/vm/classfile/modules.cpp index d9d086a3123..58b4bd71163 100644 --- a/hotspot/src/share/vm/classfile/modules.cpp +++ b/hotspot/src/share/vm/classfile/modules.cpp @@ -133,36 +133,6 @@ static PackageEntry* get_package_entry_by_name(Symbol* package, return NULL; } -// If using exploded build, append /modules/module_name, if it exists, -// to the system boot class path in order for the boot loader to locate class files. -static void add_to_exploded_build_list(char *module_name, TRAPS) { - assert(!ClassLoader::has_jimage(), "Exploded build not applicable"); - // java.base is handled by os::set_boot_path - assert(strcmp(module_name, "java.base") != 0, "Unexpected java.base module name"); - - char file_sep = os::file_separator()[0]; - size_t module_len = strlen(module_name); - - const char* home = Arguments::get_java_home(); - size_t len = strlen(home) + module_len + 32; - char* path = NEW_C_HEAP_ARRAY(char, len, mtModule); - jio_snprintf(path, len, "%s%cmodules%c%s", home, file_sep, file_sep, module_name); - struct stat st; - // See if exploded module path exists - if ((os::stat(path, &st) != 0)) { - FREE_C_HEAP_ARRAY(char, path); - path = NULL; - } - - if (path != NULL) { - HandleMark hm; - Handle loader_lock = Handle(THREAD, SystemDictionary::system_loader_lock()); - ObjectLocker ol(loader_lock, THREAD); - log_info(class, load)("opened: %s", path); - ClassLoader::add_to_list(path); - } -} - bool Modules::is_package_defined(Symbol* package, Handle h_loader, TRAPS) { PackageEntry* res = get_package_entry_by_name(package, h_loader, CHECK_false); return res != NULL; @@ -470,8 +440,8 @@ void Modules::define_module(jobject module, jstring version, // used, prepend /modules/modules_name, if it exists, to the system boot class path. if (loader == NULL && !Universe::is_module_initialized() && - !ClassLoader::has_jimage()) { - add_to_exploded_build_list(module_name, CHECK); + !ClassLoader::has_jrt_entry()) { + ClassLoader::add_to_exploded_build_list(module_symbol, CHECK); } } diff --git a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp index 435630febac..77de03b0a33 100644 --- a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp +++ b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -29,7 +29,7 @@ #include "runtime/os.hpp" // During dumping time, when processing class paths, we build up the dump-time -// classpath. The JAR files that exist are stored in the list ClassLoader::_first_entry. +// classpath. The JAR files that exist are stored in the list ClassLoader::_first_append_entry. // However, we need to store other "misc" information for run-time checking, such as // // + The values of Arguments::get_sysclasspath() used during dumping. diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index af777b2d9d8..0e2a6120c7b 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -2149,7 +2149,7 @@ void SystemDictionary::initialize_preloaded_classes(TRAPS) { // Create the ModuleEntry for java.base. This call needs to be done here, // after vmSymbols::initialize() is called but before any classes are pre-loaded. - ClassLoader::create_javabase(); + ClassLoader::classLoader_init2(CHECK); // Preload commonly used klasses WKID scan = FIRST_WKID; diff --git a/hotspot/src/share/vm/memory/filemap.cpp b/hotspot/src/share/vm/memory/filemap.cpp index b442f4c70e1..e4ec1c1a155 100644 --- a/hotspot/src/share/vm/memory/filemap.cpp +++ b/hotspot/src/share/vm/memory/filemap.cpp @@ -199,11 +199,45 @@ void FileMapInfo::allocate_classpath_entry_table() { size_t entry_size = SharedClassUtil::shared_class_path_entry_size(); for (int pass=0; pass<2; pass++) { - ClassPathEntry *cpe = ClassLoader::classpath_entry(0); - for (int cur_entry = 0 ; cpe != NULL; cpe = cpe->next(), cur_entry++) { + // Process the modular java runtime image first + ClassPathEntry* jrt_entry = ClassLoader::get_jrt_entry(); + assert(jrt_entry != NULL, + "No modular java runtime image present when allocating the CDS classpath entry table"); + const char *name = jrt_entry->name(); + int name_bytes = (int)(strlen(name) + 1); + if (pass == 0) { + count++; + bytes += (int)entry_size; + bytes += name_bytes; + log_info(class, path)("add main shared path for modular java runtime image %s", name); + } else { + // The java runtime image is always in slot 0 on the shared class path. + SharedClassPathEntry* ent = shared_classpath(0); + struct stat st; + if (os::stat(name, &st) == 0) { + ent->_timestamp = st.st_mtime; + ent->_filesize = st.st_size; + } + if (ent->_filesize == 0) { + // unknown + ent->_filesize = -2; + } + ent->_name = strptr; + assert(strptr + name_bytes <= strptr_max, "miscalculated buffer size"); + strncpy(strptr, name, (size_t)name_bytes); // name_bytes includes trailing 0. + strptr += name_bytes; + } + + // Walk the appended entries, which includes the entries added for the classpath. + ClassPathEntry *cpe = ClassLoader::classpath_entry(1); + + // Since the java runtime image is always in slot 0 on the shared class path, the + // appended entries are started at slot 1 immediately after. + for (int cur_entry = 1 ; cpe != NULL; cpe = cpe->next(), cur_entry++) { const char *name = cpe->name(); int name_bytes = (int)(strlen(name) + 1); + assert(!cpe->is_jrt(), "A modular java runtime image is present on the list of appended entries"); if (pass == 0) { count ++; @@ -228,11 +262,7 @@ void FileMapInfo::allocate_classpath_entry_table() { } else { struct stat st; if (os::stat(name, &st) == 0) { - if (cpe->is_jrt()) { - // it's the "modules" jimage - ent->_timestamp = st.st_mtime; - ent->_filesize = st.st_size; - } else if ((st.st_mode & S_IFDIR) == S_IFDIR) { + if ((st.st_mode & S_IFDIR) == S_IFDIR) { if (!os::dir_is_empty(name)) { ClassLoader::exit_with_path_failure( "Cannot have non-empty directory in archived classpaths", name); @@ -886,6 +916,11 @@ bool FileMapInfo::FileMapHeader::validate() { return false; } + if (!Arguments::has_jimage()) { + FileMapInfo::fail_continue("The shared archive file cannot be used with an exploded module build."); + return false; + } + if (_version != current_version()) { FileMapInfo::fail_continue("The shared archive file is the wrong version."); return false; diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index a9e944e4f7f..c5ff0aeaf61 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -85,7 +85,6 @@ const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG; const char* Arguments::_sun_java_launcher = DEFAULT_JAVA_LAUNCHER; int Arguments::_sun_java_launcher_pid = -1; bool Arguments::_sun_java_launcher_is_altjvm = false; -int Arguments::_bootclassloader_append_index = -1; // These parameters are reset in method parse_vm_init_args() bool Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods; @@ -113,6 +112,7 @@ SystemProperty *Arguments::_jdk_boot_class_path_append = NULL; GrowableArray *Arguments::_xpatchprefix = NULL; PathString *Arguments::_system_boot_class_path = NULL; +bool Arguments::_has_jimage = false; char* Arguments::_ext_dirs = NULL; @@ -1305,6 +1305,11 @@ void Arguments::check_unsupported_dumping_properties() { } sp = sp->next(); } + + // Check for an exploded module build in use with -Xshare:dump. + if (!has_jimage()) { + vm_exit_during_initialization("Dumping the shared archive is not supported with an exploded module build"); + } } #endif @@ -2676,7 +2681,6 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* xpatch_ return JNI_EINVAL; // -bootclasspath/a: } else if (match_option(option, "-Xbootclasspath/a:", &tail)) { - Arguments::set_bootclassloader_append_index((int)strlen(Arguments::get_sysclasspath())+1); Arguments::append_sysclasspath(tail); // -bootclasspath/p: } else if (match_option(option, "-Xbootclasspath/p:", &tail)) { @@ -3323,18 +3327,6 @@ void Arguments::add_xpatchprefix(const char* module_name, const char* path, bool _xpatchprefix->push(new ModuleXPatchPath(module_name, path)); } -// Set property jdk.boot.class.path.append to the contents of the bootclasspath -// that follows either the jimage file or exploded module directories. The -// property will contain -Xbootclasspath/a and/or jvmti appended additions. -void Arguments::set_jdkbootclasspath_append() { - char *sysclasspath = get_sysclasspath(); - assert(sysclasspath != NULL, "NULL sysclasspath"); - int bcp_a_idx = bootclassloader_append_index(); - if (bcp_a_idx != -1 && bcp_a_idx < (int)strlen(sysclasspath)) { - _jdk_boot_class_path_append->set_value(sysclasspath + bcp_a_idx); - } -} - // Remove all empty paths from the app classpath (if IgnoreEmptyClassPaths is enabled) // // This is necessary because some apps like to specify classpath like -cp foo.jar:${XYZ}:bar.jar @@ -3457,8 +3449,6 @@ jint Arguments::finalize_vm_init_args() { return JNI_ERR; } - Arguments::set_bootclassloader_append_index(((int)strlen(Arguments::get_sysclasspath()))+1); - // This must be done after all arguments have been processed. // java_compiler() true means set to "NONE" or empty. if (java_compiler() && !xdebug_mode()) { diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp index 8c8399d56ea..e72c492e0b1 100644 --- a/hotspot/src/share/vm/runtime/arguments.hpp +++ b/hotspot/src/share/vm/runtime/arguments.hpp @@ -363,6 +363,9 @@ class Arguments : AllStatic { // -Xbootclasspath/p was supported. static PathString *_system_boot_class_path; + // Set if a modular java runtime image is present vs. a build with exploded modules + static bool _has_jimage; + // temporary: to emit warning if the default ext dirs are not empty. // remove this variable when the warning is no longer needed. static char* _ext_dirs; @@ -411,11 +414,6 @@ class Arguments : AllStatic { static void set_java_compiler(bool arg) { _java_compiler = arg; } static bool java_compiler() { return _java_compiler; } - // Capture the index location of -Xbootclasspath\a within sysclasspath. - // Used when setting up the bootstrap search path in order to - // mark the boot loader's append path observability boundary. - static int _bootclassloader_append_index; - // -Xdebug flag static bool _xdebug_mode; static void set_xdebug_mode(bool arg) { _xdebug_mode = arg; } @@ -669,17 +667,6 @@ class Arguments : AllStatic { static size_t min_heap_size() { return _min_heap_size; } static void set_min_heap_size(size_t v) { _min_heap_size = v; } - // -Xbootclasspath/a - static int bootclassloader_append_index() { - return _bootclassloader_append_index; - } - static void set_bootclassloader_append_index(int value) { - // Set only if the index has not been set yet - if (_bootclassloader_append_index == -1) { - _bootclassloader_append_index = value; - } - } - // -Xrun static AgentLibrary* libraries() { return _libraryList.first(); } static bool init_libraries_at_startup() { return !_libraryList.is_empty(); } @@ -739,19 +726,21 @@ class Arguments : AllStatic { // Set up the underlying pieces of the system boot class path static void add_xpatchprefix(const char *module_name, const char *path, bool* xpatch_javabase); - static void set_sysclasspath(const char *value) { + static void set_sysclasspath(const char *value, bool has_jimage) { + // During start up, set by os::set_boot_path() + assert(get_sysclasspath() == NULL, "System boot class path previously set"); _system_boot_class_path->set_value(value); - set_jdkbootclasspath_append(); + _has_jimage = has_jimage; } static void append_sysclasspath(const char *value) { _system_boot_class_path->append_value(value); - set_jdkbootclasspath_append(); + _jdk_boot_class_path_append->append_value(value); } - static void set_jdkbootclasspath_append(); static GrowableArray* get_xpatchprefix() { return _xpatchprefix; } static char* get_sysclasspath() { return _system_boot_class_path->value(); } static char* get_jdk_boot_class_path_append() { return _jdk_boot_class_path_append->value(); } + static bool has_jimage() { return _has_jimage; } static char* get_java_home() { return _java_home->value(); } static char* get_dll_dir() { return _sun_boot_library_path->value(); } diff --git a/hotspot/src/share/vm/runtime/init.cpp b/hotspot/src/share/vm/runtime/init.cpp index b74a3daf040..939dae7079c 100644 --- a/hotspot/src/share/vm/runtime/init.cpp +++ b/hotspot/src/share/vm/runtime/init.cpp @@ -53,7 +53,6 @@ void SuspendibleThreadSet_init() NOT_ALL_GCS_RETURN; void management_init(); void bytecodes_init(); void classLoader_init1(); -void classLoader_init2(); // note: ClassLoader need 2-phase init void compilationPolicy_init(); void codeCache_init(); void VM_Version_init(); @@ -117,7 +116,6 @@ jint init_globals() { if (status != JNI_OK) return status; - classLoader_init2(); // after SymbolTable creation, set up -Xpatch entries CodeCacheExtensions::complete_step(CodeCacheExtensionsSteps::Universe); interpreter_init(); // before any methods loaded CodeCacheExtensions::complete_step(CodeCacheExtensionsSteps::Interpreter); diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp index f0fa94ea884..e9ff778760c 100644 --- a/hotspot/src/share/vm/runtime/os.cpp +++ b/hotspot/src/share/vm/runtime/os.cpp @@ -1213,7 +1213,7 @@ bool os::set_boot_path(char fileSep, char pathSep) { if (jimage == NULL) return false; bool has_jimage = (os::stat(jimage, &st) == 0); if (has_jimage) { - Arguments::set_sysclasspath(jimage); + Arguments::set_sysclasspath(jimage, true); FREE_C_HEAP_ARRAY(char, jimage); return true; } @@ -1223,7 +1223,7 @@ bool os::set_boot_path(char fileSep, char pathSep) { char* base_classes = format_boot_path("%/modules/java.base", home, home_len, fileSep, pathSep); if (base_classes == NULL) return false; if (os::stat(base_classes, &st) == 0) { - Arguments::set_sysclasspath(base_classes); + Arguments::set_sysclasspath(base_classes, false); FREE_C_HEAP_ARRAY(char, base_classes); return true; } From 5599ff526184741ef1c4099aec485a34a5760e59 Mon Sep 17 00:00:00 2001 From: Jiangli Zhou Date: Tue, 26 Jul 2016 17:25:58 -0400 Subject: [PATCH 091/108] 8156959: compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java fails with exit 134 Remove invalid assert in SensorInfo::process_pending_requests. Reviewed-by: dholmes, coleenp --- hotspot/src/share/vm/services/lowMemoryDetector.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/hotspot/src/share/vm/services/lowMemoryDetector.cpp b/hotspot/src/share/vm/services/lowMemoryDetector.cpp index 6fbfc9a713d..33e1f45957b 100644 --- a/hotspot/src/share/vm/services/lowMemoryDetector.cpp +++ b/hotspot/src/share/vm/services/lowMemoryDetector.cpp @@ -281,8 +281,6 @@ void SensorInfo::oops_do(OopClosure* f) { } void SensorInfo::process_pending_requests(TRAPS) { - assert(has_pending_requests(), "Must have pending request"); - int pending_count = pending_trigger_count(); if (pending_clear_count() > 0) { clear(pending_count, CHECK); From 5c9019c64ab68c26e9d3cf584ed630c68dc25f61 Mon Sep 17 00:00:00 2001 From: David Holmes Date: Tue, 26 Jul 2016 23:52:25 -0400 Subject: [PATCH 092/108] 8140723: Remove source code conditionalized on JAVASE_EMBEDDED Reviewed-by: twisti, fparain, cjplummer --- .../src/cpu/x86/vm/globalDefinitions_x86.hpp | 4 +-- hotspot/src/share/vm/runtime/arguments.cpp | 4 --- hotspot/src/share/vm/runtime/globals.hpp | 21 ++++--------- hotspot/src/share/vm/runtime/vm_version.cpp | 2 +- hotspot/src/share/vm/utilities/macros.hpp | 8 ----- .../cli/RTMGenericCommandLineOptionTest.java | 4 +-- .../rtm/predicate/SupportedVM.java | 4 +-- .../gc/arguments/TestSelectDefaultGC.java | 8 ++--- .../runtime/logging/MonitorMismatchTest.java | 30 +++++++++---------- .../testlibrary/jdk/test/lib/Platform.java | 4 --- ...stMutuallyExclusivePlatformPredicates.java | 4 +-- 11 files changed, 30 insertions(+), 63 deletions(-) diff --git a/hotspot/src/cpu/x86/vm/globalDefinitions_x86.hpp b/hotspot/src/cpu/x86/vm/globalDefinitions_x86.hpp index 40f3d2fd69c..681dcc8a56b 100644 --- a/hotspot/src/cpu/x86/vm/globalDefinitions_x86.hpp +++ b/hotspot/src/cpu/x86/vm/globalDefinitions_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -56,7 +56,7 @@ const bool CCallingConventionRequiresIntsAsLongs = false; #endif #endif -#if defined(COMPILER2) && !defined(JAVASE_EMBEDDED) +#if defined(COMPILER2) // Include Restricted Transactional Memory lock eliding optimization #define INCLUDE_RTM_OPT 1 #endif diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index c5ff0aeaf61..fd10731d1ea 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -1784,11 +1784,7 @@ void Arguments::select_gc_ergonomically() { if (should_auto_select_low_pause_collector()) { FLAG_SET_ERGO_IF_DEFAULT(bool, UseConcMarkSweepGC, true); } else { -#if defined(JAVASE_EMBEDDED) - FLAG_SET_ERGO_IF_DEFAULT(bool, UseParallelGC, true); -#else FLAG_SET_ERGO_IF_DEFAULT(bool, UseG1GC, true); -#endif } } else { FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true); diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 92eaf8ef5e9..4c4110185d0 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -458,12 +458,6 @@ public: #define falseInProduct true #endif -#ifdef JAVASE_EMBEDDED -#define falseInEmbedded false -#else -#define falseInEmbedded true -#endif - // develop flags are settable / visible only during development and are constant in the PRODUCT version // product flags are always settable / visible // notproduct flags are settable / visible only during development and are not declared in the PRODUCT version @@ -592,7 +586,7 @@ public: product_pd(bool, UseMembar, \ "(Unstable) Issues membars on thread state transitions") \ \ - develop(bool, CleanChunkPoolAsync, falseInEmbedded, \ + develop(bool, CleanChunkPoolAsync, true, \ "Clean the chunk pool asynchronously") \ \ experimental(bool, AlwaysSafeConstructors, false, \ @@ -2890,15 +2884,10 @@ public: \ /* notice: the max range value here is max_jint, not max_intx */ \ /* because of overflow issue */ \ - NOT_EMBEDDED(diagnostic(intx, GuaranteedSafepointInterval, 1000, \ + diagnostic(intx, GuaranteedSafepointInterval, 1000, \ "Guarantee a safepoint (at least) every so many milliseconds " \ - "(0 means none)")) \ - NOT_EMBEDDED(range(0, max_jint)) \ - \ - EMBEDDED_ONLY(product(intx, GuaranteedSafepointInterval, 0, \ - "Guarantee a safepoint (at least) every so many milliseconds " \ - "(0 means none)")) \ - EMBEDDED_ONLY(range(0, max_jint)) \ + "(0 means none)") \ + range(0, max_jint) \ \ product(intx, SafepointTimeoutDelay, 10000, \ "Delay in milliseconds for option SafepointTimeout") \ @@ -3800,7 +3789,7 @@ public: \ /* flags for performance data collection */ \ \ - product(bool, UsePerfData, falseInEmbedded, \ + product(bool, UsePerfData, true, \ "Flag to disable jvmstat instrumentation for performance testing "\ "and problem isolation purposes") \ \ diff --git a/hotspot/src/share/vm/runtime/vm_version.cpp b/hotspot/src/share/vm/runtime/vm_version.cpp index 17ecaa8a05e..942feb10c3e 100644 --- a/hotspot/src/share/vm/runtime/vm_version.cpp +++ b/hotspot/src/share/vm/runtime/vm_version.cpp @@ -110,7 +110,7 @@ bool Abstract_VM_Version::_parallel_worker_threads_initialized = false; #ifndef HOTSPOT_VM_DISTRO #error HOTSPOT_VM_DISTRO must be defined #endif -#define VMNAME HOTSPOT_VM_DISTRO " " VMLP EMBEDDED_ONLY("Embedded ") VMTYPE " VM" +#define VMNAME HOTSPOT_VM_DISTRO " " VMLP VMTYPE " VM" const char* Abstract_VM_Version::vm_name() { return VMNAME; diff --git a/hotspot/src/share/vm/utilities/macros.hpp b/hotspot/src/share/vm/utilities/macros.hpp index 029352e4791..ebcaaee043d 100644 --- a/hotspot/src/share/vm/utilities/macros.hpp +++ b/hotspot/src/share/vm/utilities/macros.hpp @@ -458,14 +458,6 @@ #define NOT_AARCH64(code) code #endif -#ifdef JAVASE_EMBEDDED -#define EMBEDDED_ONLY(code) code -#define NOT_EMBEDDED(code) -#else -#define EMBEDDED_ONLY(code) -#define NOT_EMBEDDED(code) code -#endif - #define define_pd_global(type, name, value) const type pd_##name = value; // Helper macros for constructing file names for includes. diff --git a/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java b/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java index cc2ad98facd..ecd56cd2eb6 100644 --- a/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java +++ b/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -89,7 +89,7 @@ public abstract class RTMGenericCommandLineOptionTest @Override public void runTestCases() throws Throwable { if (Platform.isX86() || Platform.isX64() || Platform.isPPC()) { - if (Platform.isServer() && !Platform.isEmbedded()) { + if (Platform.isServer()) { runX86SupportedVMTestCases(); } else { runX86UnsupportedVMTestCases(); diff --git a/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedVM.java b/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedVM.java index 352b4e9f9c2..5f2c0028c54 100644 --- a/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedVM.java +++ b/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedVM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,6 +31,6 @@ import java.util.function.BooleanSupplier; public class SupportedVM implements BooleanSupplier { @Override public boolean getAsBoolean() { - return Platform.isServer() && !Platform.isEmbedded(); + return Platform.isServer(); } } diff --git a/hotspot/test/gc/arguments/TestSelectDefaultGC.java b/hotspot/test/gc/arguments/TestSelectDefaultGC.java index 8dc1435271b..0c39a6ba874 100644 --- a/hotspot/test/gc/arguments/TestSelectDefaultGC.java +++ b/hotspot/test/gc/arguments/TestSelectDefaultGC.java @@ -55,14 +55,10 @@ public class TestSelectDefaultGC { output.shouldHaveExitValue(0); final boolean isServer = actAsServer; - final boolean isEmbedded = Platform.isEmbedded(); // Verify GC selection - // G1 is default for non-embedded server class machines - assertVMOption(output, "UseG1GC", isServer && !isEmbedded); - // Parallel is default for embedded server class machines - assertVMOption(output, "UseParallelGC", isServer && isEmbedded); - assertVMOption(output, "UseParallelOldGC", isServer && isEmbedded); + // G1 is default for server class machines + assertVMOption(output, "UseG1GC", isServer); // Serial is default for non-server class machines assertVMOption(output, "UseSerialGC", !isServer); // CMS is never default diff --git a/hotspot/test/runtime/logging/MonitorMismatchTest.java b/hotspot/test/runtime/logging/MonitorMismatchTest.java index 82d464c49c0..0d7c76f0ce1 100644 --- a/hotspot/test/runtime/logging/MonitorMismatchTest.java +++ b/hotspot/test/runtime/logging/MonitorMismatchTest.java @@ -39,23 +39,21 @@ import jdk.test.lib.Platform; public class MonitorMismatchTest { public static void main(String... args) throws Exception { - if (!Platform.isEmbedded()){ - // monitormismatch should turn on. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xcomp", - "-XX:+TieredCompilation", - "-Xlog:monitormismatch=info", - "MonitorMismatchHelper"); - OutputAnalyzer o = new OutputAnalyzer(pb.start()); - o.shouldContain("[monitormismatch] Monitor mismatch in method"); + // monitormismatch should turn on. + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xcomp", + "-XX:+TieredCompilation", + "-Xlog:monitormismatch=info", + "MonitorMismatchHelper"); + OutputAnalyzer o = new OutputAnalyzer(pb.start()); + o.shouldContain("[monitormismatch] Monitor mismatch in method"); - // monitormismatch should turn off. - pb = ProcessTools.createJavaProcessBuilder("-Xcomp", - "-XX:+TieredCompilation", - "-Xlog:monitormismatch=off", - "MonitorMismatchHelper"); - o = new OutputAnalyzer(pb.start()); - o.shouldNotContain("[monitormismatch]"); - } + // monitormismatch should turn off. + pb = ProcessTools.createJavaProcessBuilder("-Xcomp", + "-XX:+TieredCompilation", + "-Xlog:monitormismatch=off", + "MonitorMismatchHelper"); + o = new OutputAnalyzer(pb.start()); + o.shouldNotContain("[monitormismatch]"); }; } diff --git a/hotspot/test/testlibrary/jdk/test/lib/Platform.java b/hotspot/test/testlibrary/jdk/test/lib/Platform.java index 64773223556..22c08aa4197 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/Platform.java +++ b/hotspot/test/testlibrary/jdk/test/lib/Platform.java @@ -60,10 +60,6 @@ public class Platform { return vmName.endsWith(" Minimal VM"); } - public static boolean isEmbedded() { - return vmName.contains("Embedded"); - } - public static boolean isTieredSupported() { return compiler.contains("Tiered Compilers"); } diff --git a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java index 4f20576be77..172fe107bc8 100644 --- a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java +++ b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -49,7 +49,7 @@ public class TestMutuallyExclusivePlatformPredicates { BITNESS("is32bit", "is64bit"), OS("isAix", "isLinux", "isOSX", "isSolaris", "isWindows"), VM_TYPE("isClient", "isServer", "isGraal", "isMinimal", "isZero"), - IGNORED("isEmbedded", "isDebugBuild", "shouldSAAttach", + IGNORED("isDebugBuild", "shouldSAAttach", "canPtraceAttachLinux", "canAttachOSX", "isTieredSupported"); public final List methodNames; From 8d9c39fa52e5fd6f41d028cce803954d61cf6641 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Wed, 27 Jul 2016 12:33:33 +0200 Subject: [PATCH 093/108] 8162384: Performance regression: bimorphic inlining may be bypassed by type speculation When speculation fails at a call fallback to profile data at the call site Reviewed-by: kvn --- hotspot/src/share/vm/opto/doCall.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp index ce7e6d1df5d..97af80e61b0 100644 --- a/hotspot/src/share/vm/opto/doCall.cpp +++ b/hotspot/src/share/vm/opto/doCall.cpp @@ -209,16 +209,22 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool int morphism = profile.morphism(); if (speculative_receiver_type != NULL) { - // We have a speculative type, we should be able to resolve - // the call. We do that before looking at the profiling at - // this invoke because it may lead to bimorphic inlining which - // a speculative type should help us avoid. - receiver_method = callee->resolve_invoke(jvms->method()->holder(), - speculative_receiver_type); - if (receiver_method == NULL) { - speculative_receiver_type = NULL; + if (!too_many_traps(caller, bci, Deoptimization::Reason_speculate_class_check)) { + // We have a speculative type, we should be able to resolve + // the call. We do that before looking at the profiling at + // this invoke because it may lead to bimorphic inlining which + // a speculative type should help us avoid. + receiver_method = callee->resolve_invoke(jvms->method()->holder(), + speculative_receiver_type); + if (receiver_method == NULL) { + speculative_receiver_type = NULL; + } else { + morphism = 1; + } } else { - morphism = 1; + // speculation failed before. Use profiling at the call + // (could allow bimorphic inlining for instance). + speculative_receiver_type = NULL; } } if (receiver_method == NULL && @@ -255,7 +261,7 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool Deoptimization::DeoptReason reason = morphism == 2 ? Deoptimization::Reason_bimorphic : Deoptimization::reason_class_check(speculative_receiver_type != NULL); if ((morphism == 1 || (morphism == 2 && next_hit_cg != NULL)) && - !too_many_traps(jvms->method(), jvms->bci(), reason) + !too_many_traps(caller, bci, reason) ) { // Generate uncommon trap for class check failure path // in case of monomorphic or bimorphic virtual call site. From 9c928767baddb4b2581a3125187eb5d7cd528d8d Mon Sep 17 00:00:00 2001 From: Karen Kinnear Date: Wed, 27 Jul 2016 08:31:48 -0400 Subject: [PATCH 094/108] 8162340: Better class stream parsing Check platform and boot loader for java/* packages Reviewed-by: lfoltan, coleenp, dholmes --- .../share/vm/classfile/classFileParser.cpp | 32 +++-- .../share/vm/classfile/classFileParser.hpp | 7 +- .../src/share/vm/classfile/classLoader.cpp | 1 - .../src/share/vm/classfile/klassFactory.cpp | 2 - .../src/share/vm/classfile/klassFactory.hpp | 3 +- .../share/vm/classfile/systemDictionary.cpp | 113 ++++++------------ .../share/vm/classfile/systemDictionary.hpp | 5 +- hotspot/src/share/vm/oops/instanceKlass.cpp | 31 +++++ hotspot/src/share/vm/oops/instanceKlass.hpp | 6 + hotspot/src/share/vm/oops/symbol.hpp | 6 - 10 files changed, 99 insertions(+), 107 deletions(-) diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp index c6155dd6560..0028f1ae37d 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.cpp +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp @@ -5406,7 +5406,6 @@ ClassFileParser::ClassFileParser(ClassFileStream* stream, Symbol* name, ClassLoaderData* loader_data, Handle protection_domain, - TempNewSymbol* parsed_name, const Klass* host_klass, GrowableArray* cp_patches, Publicity pub_level, @@ -5416,7 +5415,6 @@ ClassFileParser::ClassFileParser(ClassFileStream* stream, _loader_data(loader_data), _host_klass(host_klass), _cp_patches(cp_patches), - _parsed_name(parsed_name), _super_klass(), _cp(NULL), _fields(NULL), @@ -5657,15 +5655,6 @@ void ClassFileParser::parse_stream(const ClassFileStream* const stream, Symbol* const class_name_in_cp = cp->klass_name_at(_this_class_index); assert(class_name_in_cp != NULL, "class_name can't be null"); - if (_parsed_name != NULL) { - // It's important to set parsed_name *before* resolving the super class. - // (it's used for cleanup by the caller if parsing fails) - *_parsed_name = class_name_in_cp; - // parsed_name is returned and can be used if there's an error, so add to - // its reference count. Caller will decrement the refcount. - (*_parsed_name)->increment_refcount(); - } - // Update _class_name which could be null previously // to reflect the name in the constant pool _class_name = class_name_in_cp; @@ -5692,6 +5681,10 @@ void ClassFileParser::parse_stream(const ClassFileStream* const stream, return; } + // Verification prevents us from creating names with dots in them, this + // asserts that that's the case. + assert(is_internal_format(_class_name), "external class name format used internally"); + if (!is_internal()) { if (log_is_enabled(Debug, class, preorder)){ ResourceMark rm(THREAD); @@ -5900,3 +5893,20 @@ const ClassFileStream* ClassFileParser::clone_stream() const { return _stream->clone(); } +// ---------------------------------------------------------------------------- +// debugging + +#ifdef ASSERT + +// return true if class_name contains no '.' (internal format is '/') +bool ClassFileParser::is_internal_format(Symbol* class_name) { + if (class_name != NULL) { + ResourceMark rm; + char* name = class_name->as_C_string(); + return strchr(name, '.') == NULL; + } else { + return true; + } +} + +#endif diff --git a/hotspot/src/share/vm/classfile/classFileParser.hpp b/hotspot/src/share/vm/classfile/classFileParser.hpp index 47ec53940b2..4b6287588c3 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.hpp +++ b/hotspot/src/share/vm/classfile/classFileParser.hpp @@ -81,7 +81,6 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC { mutable ClassLoaderData* _loader_data; const Klass* _host_klass; GrowableArray* _cp_patches; // overrides for CP entries - TempNewSymbol* _parsed_name; // Metadata created before the instance klass is created. Must be deallocated // if not transferred to the InstanceKlass upon successful class loading @@ -475,7 +474,6 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC { Symbol* name, ClassLoaderData* loader_data, Handle protection_domain, - TempNewSymbol* parsed_name, const Klass* host_klass, GrowableArray* cp_patches, Publicity pub_level, @@ -514,6 +512,11 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC { bool is_internal() const { return INTERNAL == _pub_level; } static bool verify_unqualified_name(const char* name, unsigned int length, int type); + +#ifdef ASSERT + static bool is_internal_format(Symbol* class_name); +#endif + }; #endif // SHARE_VM_CLASSFILE_CLASSFILEPARSER_HPP diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp index 843bc6657f5..92bf8fe4856 100644 --- a/hotspot/src/share/vm/classfile/classLoader.cpp +++ b/hotspot/src/share/vm/classfile/classLoader.cpp @@ -1503,7 +1503,6 @@ instanceKlassHandle ClassLoader::load_class(Symbol* name, bool search_append_onl protection_domain, NULL, // host_klass NULL, // cp_patches - NULL, // parsed_name THREAD); if (HAS_PENDING_EXCEPTION) { if (DumpSharedSpaces) { diff --git a/hotspot/src/share/vm/classfile/klassFactory.cpp b/hotspot/src/share/vm/classfile/klassFactory.cpp index 11b07f6b24a..6eb6ccc9405 100644 --- a/hotspot/src/share/vm/classfile/klassFactory.cpp +++ b/hotspot/src/share/vm/classfile/klassFactory.cpp @@ -96,7 +96,6 @@ instanceKlassHandle KlassFactory::create_from_stream(ClassFileStream* stream, Handle protection_domain, const Klass* host_klass, GrowableArray* cp_patches, - TempNewSymbol* parsed_name, TRAPS) { assert(stream != NULL, "invariant"); @@ -123,7 +122,6 @@ instanceKlassHandle KlassFactory::create_from_stream(ClassFileStream* stream, name, loader_data, protection_domain, - parsed_name, host_klass, cp_patches, ClassFileParser::BROADCAST, // publicity level diff --git a/hotspot/src/share/vm/classfile/klassFactory.hpp b/hotspot/src/share/vm/classfile/klassFactory.hpp index 107c8d3576d..6783f2753a3 100644 --- a/hotspot/src/share/vm/classfile/klassFactory.hpp +++ b/hotspot/src/share/vm/classfile/klassFactory.hpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2015, 2016, 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 @@ -74,7 +74,6 @@ class KlassFactory : AllStatic { Handle protection_domain, const Klass* host_klass, GrowableArray* cp_patches, - TempNewSymbol* parsed_name, TRAPS); }; diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index 0e2a6120c7b..033980e3d78 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -70,7 +70,6 @@ #include "services/threadService.hpp" #include "trace/traceMacros.hpp" #include "utilities/macros.hpp" -#include "utilities/stringUtils.hpp" #include "utilities/ticks.hpp" #if INCLUDE_CDS #include "classfile/sharedClassUtil.hpp" @@ -139,24 +138,6 @@ ClassLoaderData* SystemDictionary::register_loader(Handle class_loader, TRAPS) { return ClassLoaderDataGraph::find_or_create(class_loader, THREAD); } -// ---------------------------------------------------------------------------- -// debugging - -#ifdef ASSERT - -// return true if class_name contains no '.' (internal format is '/') -bool SystemDictionary::is_internal_format(Symbol* class_name) { - if (class_name != NULL) { - ResourceMark rm; - char* name = class_name->as_C_string(); - return strchr(name, '.') == NULL; - } else { - return true; - } -} - -#endif - // ---------------------------------------------------------------------------- // Parallel class loading check @@ -335,6 +316,10 @@ Klass* SystemDictionary::resolve_array_class_or_null(Symbol* class_name, // Must be called, even if superclass is null, since this is // where the placeholder entry is created which claims this // thread is loading this class/classloader. +// Be careful when modifying this code: once you have run +// placeholders()->find_and_add(PlaceholderTable::LOAD_SUPER), +// you need to find_and_remove it before returning. +// So be careful to not exit with a CHECK_ macro betweeen these calls. Klass* SystemDictionary::resolve_super_or_fail(Symbol* child_name, Symbol* class_name, Handle class_loader, @@ -399,6 +384,7 @@ Klass* SystemDictionary::resolve_super_or_fail(Symbol* child_name, } } if (!throw_circularity_error) { + // Be careful not to exit resolve_super PlaceholderEntry* newprobe = placeholders()->find_and_add(p_index, p_hash, child_name, loader_data, PlaceholderTable::LOAD_SUPER, class_name, THREAD); } } @@ -669,7 +655,10 @@ static void class_define_event(instanceKlassHandle k) { #endif // INCLUDE_TRACE } - +// Be careful when modifying this code: once you have run +// placeholders()->find_and_add(PlaceholderTable::LOAD_INSTANCE), +// you need to find_and_remove it before returning. +// So be careful to not exit with a CHECK_ macro betweeen these calls. Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle class_loader, Handle protection_domain, @@ -1031,8 +1020,9 @@ Klass* SystemDictionary::find_instance_or_array_klass(Symbol* class_name, } // Note: this method is much like resolve_from_stream, but -// updates no supplemental data structures. -// TODO consolidate the two methods with a helper routine? +// does not publish the classes via the SystemDictionary. +// Handles unsafe_DefineAnonymousClass and redefineclasses +// RedefinedClasses do not add to the class hierarchy Klass* SystemDictionary::parse_stream(Symbol* class_name, Handle class_loader, Handle protection_domain, @@ -1069,8 +1059,7 @@ Klass* SystemDictionary::parse_stream(Symbol* class_name, protection_domain, host_klass, cp_patches, - NULL, // parsed_name - THREAD); + CHECK_NULL); if (host_klass != NULL && k.not_null()) { // If it's anonymous, initialize it now, since nobody else will. @@ -1141,8 +1130,6 @@ Klass* SystemDictionary::resolve_from_stream(Symbol* class_name, // already be present in the SystemDictionary, otherwise we would not // throw potential ClassFormatErrors. // - // Note: "parsed_name" is updated. - TempNewSymbol parsed_name = NULL; instanceKlassHandle k; @@ -1154,9 +1141,7 @@ Klass* SystemDictionary::resolve_from_stream(Symbol* class_name, CHECK_NULL); #endif - if (k.not_null()) { - parsed_name = k->name(); - } else { + if (k.is_null()) { if (st->buffer() == NULL) { return NULL; } @@ -1166,64 +1151,28 @@ Klass* SystemDictionary::resolve_from_stream(Symbol* class_name, protection_domain, NULL, // host_klass NULL, // cp_patches - &parsed_name, - THREAD); + CHECK_NULL); } - const char* pkg = "java/"; - if (!HAS_PENDING_EXCEPTION && - !class_loader.is_null() && - !SystemDictionary::is_platform_class_loader(class_loader) && - parsed_name != NULL && - !strncmp((const char*)parsed_name->bytes(), pkg, strlen(pkg))) { - // It is illegal to define classes in the "java." package from - // JVM_DefineClass or jni_DefineClass unless you're the bootclassloader - ResourceMark rm(THREAD); - TempNewSymbol pkg_name = InstanceKlass::package_from_name(parsed_name, CHECK_NULL); - assert(pkg_name != NULL, "Error in parsing package name starting with 'java/'"); - char* name = pkg_name->as_C_string(); - StringUtils::replace_no_expand(name, "/", "."); - const char* msg_text = "Prohibited package name: "; - size_t len = strlen(msg_text) + strlen(name) + 1; - char* message = NEW_RESOURCE_ARRAY(char, len); - jio_snprintf(message, len, "%s%s", msg_text, name); - Exceptions::_throw_msg(THREAD_AND_LOCATION, - vmSymbols::java_lang_SecurityException(), message); - } + assert(k.not_null(), "no klass created"); + Symbol* h_name = k->name(); + assert(class_name == NULL || class_name == h_name, "name mismatch"); - if (!HAS_PENDING_EXCEPTION) { - assert(parsed_name != NULL, "Sanity"); - assert(class_name == NULL || class_name == parsed_name, "name mismatch"); - // Verification prevents us from creating names with dots in them, this - // asserts that that's the case. - assert(is_internal_format(parsed_name), - "external class name format used internally"); - - // Add class just loaded - // If a class loader supports parallel classloading handle parallel define requests - // find_or_define_instance_class may return a different InstanceKlass - if (is_parallelCapable(class_loader)) { - k = find_or_define_instance_class(class_name, class_loader, k, THREAD); - } else { - define_instance_class(k, THREAD); - } + // Add class just loaded + // If a class loader supports parallel classloading handle parallel define requests + // find_or_define_instance_class may return a different InstanceKlass + if (is_parallelCapable(class_loader)) { + k = find_or_define_instance_class(h_name, class_loader, k, CHECK_NULL); + } else { + define_instance_class(k, CHECK_NULL); } // Make sure we have an entry in the SystemDictionary on success debug_only( { - if (!HAS_PENDING_EXCEPTION) { - assert(parsed_name != NULL, "parsed_name is still null?"); - Symbol* h_name = k->name(); - ClassLoaderData *defining_loader_data = k->class_loader_data(); + MutexLocker mu(SystemDictionary_lock, THREAD); - MutexLocker mu(SystemDictionary_lock, THREAD); - - Klass* check = find_class(parsed_name, loader_data); - assert(check == k(), "should be present in the dictionary"); - - Klass* check2 = find_class(h_name, defining_loader_data); - assert(check == check2, "name inconsistancy in SystemDictionary"); - } + Klass* check = find_class(h_name, k->class_loader_data()); + assert(check == k(), "should be present in the dictionary"); } ); return k(); @@ -1425,6 +1374,8 @@ instanceKlassHandle SystemDictionary::load_shared_class(instanceKlassHandle ik, Handle lockObject = compute_loader_lock_object(class_loader, THREAD); check_loader_lock_contention(lockObject, THREAD); ObjectLocker ol(lockObject, THREAD, true); + // prohibited package check assumes all classes loaded from archive call + // restore_unshareable_info which calls ik->set_package() ik->restore_unshareable_info(loader_data, protection_domain, CHECK_(nh)); } @@ -1710,6 +1661,10 @@ void SystemDictionary::define_instance_class(instanceKlassHandle k, TRAPS) { // findClass(), i.e. FindLoadedClass/DefineClassIfAbsent or they // potentially waste time reading and parsing the bytestream. // Note: VM callers should ensure consistency of k/class_name,class_loader +// Be careful when modifying this code: once you have run +// placeholders()->find_and_add(PlaceholderTable::DEFINE_CLASS), +// you need to find_and_remove it before returning. +// So be careful to not exit with a CHECK_ macro betweeen these calls. instanceKlassHandle SystemDictionary::find_or_define_instance_class(Symbol* class_name, Handle class_loader, instanceKlassHandle k, TRAPS) { instanceKlassHandle nh = instanceKlassHandle(); // null Handle diff --git a/hotspot/src/share/vm/classfile/systemDictionary.hpp b/hotspot/src/share/vm/classfile/systemDictionary.hpp index 76a0b0772e9..6dd7d20e456 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.hpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp @@ -281,6 +281,7 @@ public: // Parse new stream. This won't update the system dictionary or // class hierarchy, simply parse the stream. Used by JVMTI RedefineClasses. + // Also used by Unsafe_DefineAnonymousClass static Klass* parse_stream(Symbol* class_name, Handle class_loader, Handle protection_domain, @@ -413,10 +414,6 @@ public: // Verification static void verify(); -#ifdef ASSERT - static bool is_internal_format(Symbol* class_name); -#endif - // Initialization static void initialize(TRAPS); diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index 0310d28c411..149c951f7e7 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -67,6 +67,7 @@ #include "services/threadService.hpp" #include "utilities/dtrace.hpp" #include "utilities/macros.hpp" +#include "utilities/stringUtils.hpp" #include "logging/log.hpp" #ifdef COMPILER1 #include "c1/c1_Compiler.hpp" @@ -2225,9 +2226,14 @@ ModuleEntry* InstanceKlass::module() const { } void InstanceKlass::set_package(ClassLoaderData* loader_data, TRAPS) { + + // ensure java/ packages only loaded by boot or platform builtin loaders + check_prohibited_package(name(), loader_data->class_loader(), CHECK); + TempNewSymbol pkg_name = package_from_name(name(), CHECK); if (pkg_name != NULL && loader_data != NULL) { + // Find in class loader's package entry table. _package_entry = loader_data->packages()->lookup_only(pkg_name); @@ -2376,6 +2382,31 @@ Klass* InstanceKlass::compute_enclosing_class_impl(instanceKlassHandle self, } */ +// Only boot and platform class loaders can define classes in "java/" packages. +void InstanceKlass::check_prohibited_package(Symbol* class_name, + Handle class_loader, + TRAPS) { + const char* javapkg = "java/"; + ResourceMark rm(THREAD); + if (!class_loader.is_null() && + !SystemDictionary::is_platform_class_loader(class_loader) && + class_name != NULL && + strncmp(class_name->as_C_string(), javapkg, strlen(javapkg)) == 0) { + TempNewSymbol pkg_name = InstanceKlass::package_from_name(class_name, CHECK); + assert(pkg_name != NULL, "Error in parsing package name starting with 'java/'"); + char* name = pkg_name->as_C_string(); + const char* class_loader_name = InstanceKlass::cast(class_loader()->klass())->name()->as_C_string(); + StringUtils::replace_no_expand(name, "/", "."); + const char* msg_text1 = "Class loader (instance of): "; + const char* msg_text2 = " tried to load prohibited package name: "; + size_t len = strlen(msg_text1) + strlen(class_loader_name) + strlen(msg_text2) + strlen(name) + 1; + char* message = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, len); + jio_snprintf(message, len, "%s%s%s%s", msg_text1, class_loader_name, msg_text2, name); + THROW_MSG(vmSymbols::java_lang_SecurityException(), message); + } + return; +} + // tell if two classes have the same enclosing class (at package level) bool InstanceKlass::is_same_package_member_impl(const InstanceKlass* class1, const Klass* class2, diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp index cdcc18eabac..d6bd6fe1fa1 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp @@ -470,6 +470,12 @@ class InstanceKlass: public Klass { static bool find_inner_classes_attr(instanceKlassHandle k, int* ooff, int* noff, TRAPS); + private: + // Check prohibited package ("java/" only loadable by boot or platform loaders) + static void check_prohibited_package(Symbol* class_name, + Handle class_loader, + TRAPS); + public: // tell if two classes have the same enclosing class (at package level) bool is_same_package_member(const Klass* class2, TRAPS) const { return is_same_package_member_impl(this, class2, THREAD); diff --git a/hotspot/src/share/vm/oops/symbol.hpp b/hotspot/src/share/vm/oops/symbol.hpp index b2d71d51335..b6801f03f9c 100644 --- a/hotspot/src/share/vm/oops/symbol.hpp +++ b/hotspot/src/share/vm/oops/symbol.hpp @@ -91,12 +91,6 @@ // The allocation (or lookup) of K increments the reference count for K // and the destructor decrements the reference count. // -// Another example of TempNewSymbol usage is parsed_name used in -// ClassFileParser::parseClassFile() where parsed_name is used in the cleanup -// after a failed attempt to load a class. Here parsed_name is a -// TempNewSymbol (passed in as a parameter) so the reference count on its symbol -// will be decremented when it goes out of scope. - // This cannot be inherited from ResourceObj because it cannot have a vtable. // Since sometimes this is allocated from Metadata, pick a base allocation // type without virtual functions. From b83116713804ee4aa3da14449010d74d94bc0222 Mon Sep 17 00:00:00 2001 From: Dmitry Fazunenko Date: Wed, 27 Jul 2016 21:16:38 +0400 Subject: [PATCH 095/108] 8161990: Un-quarantine TestParallelHeapSizeFlags.java and TestSmallHeap.java Reviewed-by: tschatzl --- hotspot/test/gc/TestSmallHeap.java | 1 - hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java | 1 - 2 files changed, 2 deletions(-) diff --git a/hotspot/test/gc/TestSmallHeap.java b/hotspot/test/gc/TestSmallHeap.java index cf786210f33..9b791a54eb6 100644 --- a/hotspot/test/gc/TestSmallHeap.java +++ b/hotspot/test/gc/TestSmallHeap.java @@ -27,7 +27,6 @@ * @requires vm.gc=="null" * @summary Verify that starting the VM with a small heap works * @library /testlibrary /test/lib /test/lib/share/classes - * @ignore 8161552 * @modules java.base/jdk.internal.misc * @modules java.management/sun.management * @build TestSmallHeap diff --git a/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java b/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java index d393a75323b..af0b2a7922c 100644 --- a/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java +++ b/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java @@ -29,7 +29,6 @@ * parallel collectors. * @requires vm.gc=="null" * @library /testlibrary /test/lib - * @ignore 8161552 * @modules java.base/jdk.internal.misc * java.management * @build TestParallelHeapSizeFlags TestMaxHeapSizeTools From f47008ae1085603c20c7447a0e3afe39dadf4a77 Mon Sep 17 00:00:00 2001 From: Michail Chernov Date: Wed, 27 Jul 2016 18:43:52 +0300 Subject: [PATCH 096/108] 8159606: gc/g1/TestShrinkAuxiliaryData* tests fail because GC triggered before VM initialization completed Reviewed-by: tschatzl --- hotspot/test/gc/g1/TestShrinkAuxiliaryData.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java index 1600989394e..83ef798f0bb 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -44,6 +44,7 @@ public class TestShrinkAuxiliaryData { private static final int REGION_SIZE = 1024 * 1024; private final static String[] initialOpts = new String[]{ + "-XX:NewSize=16m", "-XX:MinHeapFreeRatio=10", "-XX:MaxHeapFreeRatio=11", "-XX:+UseG1GC", From 6376361bc92e7a485ede2287b153d729d023f679 Mon Sep 17 00:00:00 2001 From: Dean Long Date: Wed, 27 Jul 2016 10:56:01 -0700 Subject: [PATCH 097/108] 8160742: Node::operator new invokes undefined behavior Remove obsolete asserts Reviewed-by: kvn --- hotspot/src/share/vm/opto/node.cpp | 19 ------------------- hotspot/src/share/vm/opto/node.hpp | 3 --- 2 files changed, 22 deletions(-) diff --git a/hotspot/src/share/vm/opto/node.cpp b/hotspot/src/share/vm/opto/node.cpp index 6d8b13a59bc..833b7600d3e 100644 --- a/hotspot/src/share/vm/opto/node.cpp +++ b/hotspot/src/share/vm/opto/node.cpp @@ -295,9 +295,6 @@ inline int Node::Init(int req) { if (req > 0) { // Allocate space for _in array to have double alignment. _in = (Node **) ((char *) (C->node_arena()->Amalloc_D(req * sizeof(void*)))); -#ifdef ASSERT - _in[req-1] = this; // magic cookie for assertion check -#endif } // If there are default notes floating around, capture them: Node_Notes* nn = C->default_node_notes(); @@ -326,10 +323,8 @@ Node::Node(uint req) debug_only( verify_construction() ); NOT_PRODUCT(nodes_created++); if (req == 0) { - assert( _in == (Node**)this, "Must not pass arg count to 'new'" ); _in = NULL; } else { - assert( _in[req-1] == this, "Must pass arg count to 'new'" ); Node** to = _in; for(uint i = 0; i < req; i++) { to[i] = NULL; @@ -346,8 +341,6 @@ Node::Node(Node *n0) { debug_only( verify_construction() ); NOT_PRODUCT(nodes_created++); - // Assert we allocated space for input array already - assert( _in[0] == this, "Must pass arg count to 'new'" ); assert( is_not_dead(n0), "can not use dead node"); _in[0] = n0; if (n0 != NULL) n0->add_out((Node *)this); } @@ -361,8 +354,6 @@ Node::Node(Node *n0, Node *n1) { debug_only( verify_construction() ); NOT_PRODUCT(nodes_created++); - // Assert we allocated space for input array already - assert( _in[1] == this, "Must pass arg count to 'new'" ); assert( is_not_dead(n0), "can not use dead node"); assert( is_not_dead(n1), "can not use dead node"); _in[0] = n0; if (n0 != NULL) n0->add_out((Node *)this); @@ -378,8 +369,6 @@ Node::Node(Node *n0, Node *n1, Node *n2) { debug_only( verify_construction() ); NOT_PRODUCT(nodes_created++); - // Assert we allocated space for input array already - assert( _in[2] == this, "Must pass arg count to 'new'" ); assert( is_not_dead(n0), "can not use dead node"); assert( is_not_dead(n1), "can not use dead node"); assert( is_not_dead(n2), "can not use dead node"); @@ -397,8 +386,6 @@ Node::Node(Node *n0, Node *n1, Node *n2, Node *n3) { debug_only( verify_construction() ); NOT_PRODUCT(nodes_created++); - // Assert we allocated space for input array already - assert( _in[3] == this, "Must pass arg count to 'new'" ); assert( is_not_dead(n0), "can not use dead node"); assert( is_not_dead(n1), "can not use dead node"); assert( is_not_dead(n2), "can not use dead node"); @@ -418,8 +405,6 @@ Node::Node(Node *n0, Node *n1, Node *n2, Node *n3, Node *n4) { debug_only( verify_construction() ); NOT_PRODUCT(nodes_created++); - // Assert we allocated space for input array already - assert( _in[4] == this, "Must pass arg count to 'new'" ); assert( is_not_dead(n0), "can not use dead node"); assert( is_not_dead(n1), "can not use dead node"); assert( is_not_dead(n2), "can not use dead node"); @@ -442,8 +427,6 @@ Node::Node(Node *n0, Node *n1, Node *n2, Node *n3, { debug_only( verify_construction() ); NOT_PRODUCT(nodes_created++); - // Assert we allocated space for input array already - assert( _in[5] == this, "Must pass arg count to 'new'" ); assert( is_not_dead(n0), "can not use dead node"); assert( is_not_dead(n1), "can not use dead node"); assert( is_not_dead(n2), "can not use dead node"); @@ -468,8 +451,6 @@ Node::Node(Node *n0, Node *n1, Node *n2, Node *n3, { debug_only( verify_construction() ); NOT_PRODUCT(nodes_created++); - // Assert we allocated space for input array already - assert( _in[6] == this, "Must pass arg count to 'new'" ); assert( is_not_dead(n0), "can not use dead node"); assert( is_not_dead(n1), "can not use dead node"); assert( is_not_dead(n2), "can not use dead node"); diff --git a/hotspot/src/share/vm/opto/node.hpp b/hotspot/src/share/vm/opto/node.hpp index e368e628e6b..658b54fd358 100644 --- a/hotspot/src/share/vm/opto/node.hpp +++ b/hotspot/src/share/vm/opto/node.hpp @@ -217,9 +217,6 @@ public: inline void* operator new(size_t x) throw() { Compile* C = Compile::current(); Node* n = (Node*)C->node_arena()->Amalloc_D(x); -#ifdef ASSERT - n->_in = (Node**)n; // magic cookie for assertion check -#endif return (void*)n; } From 757db81501e6859946f7139d36346460bfcd16e3 Mon Sep 17 00:00:00 2001 From: Dmitrij Pochepko Date: Thu, 28 Jul 2016 16:09:31 +0300 Subject: [PATCH 098/108] 8162603: Unrecognized VM option 'UseCountedLoopSafepoints' Reviewed-by: kvn --- .../test/compiler/loopopts/TestCountedLoopSafepointBackedge.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java b/hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java index d5709675aa9..31c32f2cd2a 100644 --- a/hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java +++ b/hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java @@ -24,6 +24,7 @@ /** * @test * @bug 8161147 + * @requires vm.flavor == "server" * @summary Safepoint on backedge breaks UseCountedLoopSafepoints * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+UseCountedLoopSafepoints TestCountedLoopSafepointBackedge * From 6066d30e17831493c24b328ab52e640607347c62 Mon Sep 17 00:00:00 2001 From: Lois Foltan Date: Thu, 28 Jul 2016 09:57:49 -0400 Subject: [PATCH 099/108] 8160487: JVM should validate a module by checking for an instance of java.lang.reflect.Module Correct the checking of an instance of java.lang.reflect.Module to validate a module Reviewed-by: alanb, coleenp, redestad --- hotspot/src/share/vm/classfile/javaClasses.hpp | 3 --- .../src/share/vm/classfile/javaClasses.inline.hpp | 5 +---- hotspot/src/share/vm/classfile/modules.cpp | 13 +++++++------ hotspot/test/runtime/modules/JVMDefineModule.java | 2 +- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp index fbf68e6dc52..31adeddcacf 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.hpp +++ b/hotspot/src/share/vm/classfile/javaClasses.hpp @@ -777,9 +777,6 @@ class java_lang_reflect_Module { static Handle create(Handle loader, Handle module_name, TRAPS); // Testers - static bool is_subclass(Klass* klass) { - return klass->is_subclass_of(SystemDictionary::reflect_Module_klass()); - } static bool is_instance(oop obj); // Accessors diff --git a/hotspot/src/share/vm/classfile/javaClasses.inline.hpp b/hotspot/src/share/vm/classfile/javaClasses.inline.hpp index 180bc5b40a4..b1c4a3f9224 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.inline.hpp +++ b/hotspot/src/share/vm/classfile/javaClasses.inline.hpp @@ -168,11 +168,8 @@ inline bool java_lang_invoke_DirectMethodHandle::is_instance(oop obj) { return obj != NULL && is_subclass(obj->klass()); } - - - inline bool java_lang_reflect_Module::is_instance(oop obj) { - return obj != NULL && is_subclass(obj->klass()); + return obj != NULL && obj->klass() == SystemDictionary::reflect_Module_klass(); } inline int Backtrace::merge_bci_and_version(int bci, int version) { diff --git a/hotspot/src/share/vm/classfile/modules.cpp b/hotspot/src/share/vm/classfile/modules.cpp index 58b4bd71163..8986eb64e96 100644 --- a/hotspot/src/share/vm/classfile/modules.cpp +++ b/hotspot/src/share/vm/classfile/modules.cpp @@ -102,7 +102,8 @@ static PackageEntryTable* get_package_entry_table(Handle h_loader, TRAPS) { static ModuleEntry* get_module_entry(jobject module, TRAPS) { Handle module_h(THREAD, JNIHandles::resolve(module)); if (!java_lang_reflect_Module::is_instance(module_h())) { - THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(), "Bad module object"); + THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(), + "module is not an instance of type java.lang.reflect.Module"); } return java_lang_reflect_Module::module_entry(module_h(), CHECK_NULL); } @@ -267,9 +268,9 @@ void Modules::define_module(jobject module, jstring version, THROW_MSG(vmSymbols::java_lang_NullPointerException(), "Null module object"); } Handle module_handle(THREAD, JNIHandles::resolve(module)); - if (!java_lang_reflect_Module::is_subclass(module_handle->klass())) { + if (!java_lang_reflect_Module::is_instance(module_handle())) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), - "module is not a subclass of java.lang.reflect.Module"); + "module is not an instance of type java.lang.reflect.Module"); } char* module_name = get_module_name(module_handle(), CHECK); @@ -452,9 +453,9 @@ void Modules::set_bootloader_unnamed_module(jobject module, TRAPS) { THROW_MSG(vmSymbols::java_lang_NullPointerException(), "Null module object"); } Handle module_handle(THREAD, JNIHandles::resolve(module)); - if (!java_lang_reflect_Module::is_subclass(module_handle->klass())) { + if (!java_lang_reflect_Module::is_instance(module_handle())) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), - "module is not a subclass of java.lang.reflect.Module"); + "module is not an instance of type java.lang.reflect.Module"); } // Ensure that this is an unnamed module @@ -728,7 +729,7 @@ jobject Modules::get_module(jclass clazz, TRAPS) { oop module = java_lang_Class::module(mirror); assert(module != NULL, "java.lang.Class module field not set"); - assert(java_lang_reflect_Module::is_subclass(module->klass()), "Module is not a java.lang.reflect.Module"); + assert(java_lang_reflect_Module::is_instance(module), "module is not an instance of type java.lang.reflect.Module"); if (log_is_enabled(Debug, modules)) { ResourceMark rm(THREAD); diff --git a/hotspot/test/runtime/modules/JVMDefineModule.java b/hotspot/test/runtime/modules/JVMDefineModule.java index 602c5fdc0bc..82f50650dfc 100644 --- a/hotspot/test/runtime/modules/JVMDefineModule.java +++ b/hotspot/test/runtime/modules/JVMDefineModule.java @@ -77,7 +77,7 @@ public class JVMDefineModule { ModuleHelper.DefineModule(new Object(), "9.0", "mymodule/here", new String[] { "mypackage1" }); throw new RuntimeException("Failed to get expected IAE or NPE for bad module"); } catch(IllegalArgumentException e) { - if (!e.getMessage().contains("module is not a subclass")) { + if (!e.getMessage().contains("module is not an instance of type java.lang.reflect.Module")) { throw new RuntimeException("Failed to get expected IAE message for bad module: " + e.getMessage()); } } From d50a3f5680c4df9f25d964313854b71628c2c597 Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Fri, 29 Jul 2016 08:36:13 +0200 Subject: [PATCH 100/108] 8162540: Crash in C2 escape analysis with assert: "node should be registered" GetAndSet, CompareAndExchange and CompareAndSwap intrinsics emit unsafe accesses to oop fields. Reviewed-by: kvn --- hotspot/src/share/vm/opto/escape.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/opto/escape.cpp b/hotspot/src/share/vm/opto/escape.cpp index 892a0d3defa..90e38fb38f3 100644 --- a/hotspot/src/share/vm/opto/escape.cpp +++ b/hotspot/src/share/vm/opto/escape.cpp @@ -2067,7 +2067,9 @@ bool ConnectionGraph::is_oop_field(Node* n, int offset, bool* unsafe) { bt = field->layout_type(); } else { // Check for unsafe oop field access - if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN)) { + if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN) || + n->has_out_with(Op_GetAndSetP, Op_GetAndSetN, Op_CompareAndExchangeP, Op_CompareAndExchangeN) || + n->has_out_with(Op_CompareAndSwapP, Op_CompareAndSwapN, Op_WeakCompareAndSwapP, Op_WeakCompareAndSwapN)) { bt = T_OBJECT; (*unsafe) = true; } @@ -2083,7 +2085,9 @@ bool ConnectionGraph::is_oop_field(Node* n, int offset, bool* unsafe) { } } else if (adr_type->isa_rawptr() || adr_type->isa_klassptr()) { // Allocation initialization, ThreadLocal field access, unsafe access - if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN)) { + if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN) || + n->has_out_with(Op_GetAndSetP, Op_GetAndSetN, Op_CompareAndExchangeP, Op_CompareAndExchangeN) || + n->has_out_with(Op_CompareAndSwapP, Op_CompareAndSwapN, Op_WeakCompareAndSwapP, Op_WeakCompareAndSwapN)) { bt = T_OBJECT; } } From a4383337fe368d459b36b9c50b320eb44ce5fb03 Mon Sep 17 00:00:00 2001 From: Tatiana Pivovarova Date: Fri, 29 Jul 2016 17:41:14 +0300 Subject: [PATCH 101/108] 8161138: testlibrary_tests/ctw/* failed with "Failed. Unexpected exit from test [exit code: 0]" Reviewed-by: kvn --- .../src/sun/hotspot/tools/ctw/CompileTheWorld.java | 9 +++------ .../ctw/src/sun/hotspot/tools/ctw/PathHandler.java | 12 +++++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java index f9703223cbd..88a94f66cdf 100644 --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java @@ -35,8 +35,8 @@ import java.util.concurrent.*; public class CompileTheWorld { // in case when a static constructor changes System::out and System::err // we hold these values of output streams - public static final PrintStream OUT = System.out; - public static final PrintStream ERR = System.err; + static PrintStream OUT = System.out; + static final PrintStream ERR = System.err; /** * Entry point. Compiles classes in {@code paths} * @@ -56,7 +56,7 @@ public class CompileTheWorld { } } if (os != null) { - System.setOut(os); + OUT = os; } try { @@ -89,9 +89,6 @@ public class CompileTheWorld { os.close(); } } - // in case when a static constructor creates and runs a new thread - // we force it to exit - System.exit(0); } private static ExecutorService createExecutor() { diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java index 07e71b94042..a8e149161f4 100644 --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java @@ -28,12 +28,11 @@ import jdk.internal.misc.Unsafe; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; - import java.util.Objects; -import java.util.concurrent.atomic.AtomicLong; -import java.util.regex.Pattern; -import java.util.regex.Matcher; import java.util.concurrent.Executor; +import java.util.concurrent.atomic.AtomicLong; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Abstract handler for path. @@ -152,7 +151,10 @@ public abstract class PathHandler { if (id >= Utils.COMPILE_THE_WORLD_START_AT) { try { Class aClass = loader.loadClass(name); - UNSAFE.ensureClassInitialized(aClass); + if (name != "sun.reflect.misc.Trampoline" + && name != "sun.tools.jconsole.OutputViewer") { // workaround for JDK-8159155 + UNSAFE.ensureClassInitialized(aClass); + } CompileTheWorld.OUT.printf("[%d]\t%s%n", id, name); Compiler.compileClass(aClass, id, executor); } catch (ClassNotFoundException e) { From 196895fafa6312a0686adbeafae05b8c0d427d23 Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Fri, 29 Jul 2016 11:38:07 -0700 Subject: [PATCH 102/108] 8161601: Solaris: __USE_LEGACY_PROTOTYPES__ is redundant and should be removed Reviewed-by: redestad, dcubed, gthornbr, dholmes --- hotspot/src/os/solaris/vm/jvm_solaris.h | 4 +--- hotspot/src/os/solaris/vm/perfMemory_solaris.cpp | 4 ++-- .../src/share/vm/utilities/globalDefinitions_sparcWorks.hpp | 3 --- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/hotspot/src/os/solaris/vm/jvm_solaris.h b/hotspot/src/os/solaris/vm/jvm_solaris.h index e961d36035b..7398e0bd899 100644 --- a/hotspot/src/os/solaris/vm/jvm_solaris.h +++ b/hotspot/src/os/solaris/vm/jvm_solaris.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, 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 @@ -41,9 +41,7 @@ * JNI conversion, which should be sorted out later. */ -#define __USE_LEGACY_PROTOTYPES__ #include /* For DIR */ -#undef __USE_LEGACY_PROTOTYPES__ #include /* For MAXPATHLEN */ #include /* For socklen_t */ #include /* For F_OK, R_OK, W_OK */ diff --git a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp index dcf88d6c862..9e90b0f08ce 100644 --- a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp +++ b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp @@ -336,7 +336,7 @@ static DIR *open_directory_secure(const char* dirname) { } // Check to make sure fd and dirp are referencing the same file system object. - if (!is_same_fsobject(fd, dirp->dd_fd)) { + if (!is_same_fsobject(fd, dirp->d_fd)) { // The directory is not secure. os::close(fd); os::closedir(dirp); @@ -368,7 +368,7 @@ static DIR *open_directory_secure_cwd(const char* dirname, int *saved_cwd_fd) { // Directory doesn't exist or is insecure, so there is nothing to cleanup. return dirp; } - int fd = dirp->dd_fd; + int fd = dirp->d_fd; // Open a fd to the cwd and save it off. int result; diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp index 755eba01c07..22f8b4e7276 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp @@ -33,9 +33,6 @@ # include -#define __USE_LEGACY_PROTOTYPES__ -# include -#undef __USE_LEGACY_PROTOTYPES__ # include # include // for bsd'isms # include From 3baf6b1f72802e9e0d8f95f58733975b655c01ba Mon Sep 17 00:00:00 2001 From: Sharath Ballal Date: Mon, 1 Aug 2016 10:51:22 +0300 Subject: [PATCH 103/108] 8158050: Remove SA-JDI Remove SA-JDI Reviewed-by: alanb, dsamersoff --- .../doc/ReadMe-JavaScript.text | 38 - .../share/classes/module-info.java | 6 +- .../jvm/hotspot/jdi/ArrayReferenceImpl.java | 171 --- .../sun/jvm/hotspot/jdi/ArrayTypeImpl.java | 222 --- .../sun/jvm/hotspot/jdi/BaseLineInfo.java | 56 - .../sun/jvm/hotspot/jdi/BooleanTypeImpl.java | 41 - .../sun/jvm/hotspot/jdi/BooleanValueImpl.java | 98 -- .../sun/jvm/hotspot/jdi/ByteTypeImpl.java | 42 - .../sun/jvm/hotspot/jdi/ByteValueImpl.java | 110 -- .../sun/jvm/hotspot/jdi/CharTypeImpl.java | 43 - .../sun/jvm/hotspot/jdi/CharValueImpl.java | 120 -- .../hotspot/jdi/ClassLoaderReferenceImpl.java | 134 -- .../hotspot/jdi/ClassObjectReferenceImpl.java | 53 - .../sun/jvm/hotspot/jdi/ClassTypeImpl.java | 263 ---- .../jvm/hotspot/jdi/ConcreteMethodImpl.java | 467 ------- .../sun/jvm/hotspot/jdi/ConnectorImpl.java | 631 --------- .../sun/jvm/hotspot/jdi/DoubleTypeImpl.java | 43 - .../sun/jvm/hotspot/jdi/DoubleValueImpl.java | 159 --- .../sun/jvm/hotspot/jdi/FieldImpl.java | 216 --- .../sun/jvm/hotspot/jdi/FloatTypeImpl.java | 43 - .../sun/jvm/hotspot/jdi/FloatValueImpl.java | 151 -- .../sun/jvm/hotspot/jdi/IntegerTypeImpl.java | 42 - .../sun/jvm/hotspot/jdi/IntegerValueImpl.java | 126 -- .../jvm/hotspot/jdi/InterfaceTypeImpl.java | 215 --- .../sun/jvm/hotspot/jdi/JNITypeParser.java | 240 ---- .../sun/jvm/hotspot/jdi/JVMTIThreadState.java | 42 - .../classes/sun/jvm/hotspot/jdi/LineInfo.java | 38 - .../jvm/hotspot/jdi/LocalVariableImpl.java | 169 --- .../sun/jvm/hotspot/jdi/LocationImpl.java | 224 --- .../sun/jvm/hotspot/jdi/LongTypeImpl.java | 43 - .../sun/jvm/hotspot/jdi/LongValueImpl.java | 141 -- .../sun/jvm/hotspot/jdi/MethodImpl.java | 272 ---- .../sun/jvm/hotspot/jdi/MirrorImpl.java | 57 - .../sun/jvm/hotspot/jdi/MonitorInfoImpl.java | 71 - .../hotspot/jdi/NonConcreteMethodImpl.java | 117 -- .../jvm/hotspot/jdi/ObjectReferenceImpl.java | 367 ----- .../jvm/hotspot/jdi/PrimitiveTypeImpl.java | 43 - .../jvm/hotspot/jdi/PrimitiveValueImpl.java | 93 -- .../jvm/hotspot/jdi/ReferenceTypeImpl.java | 1008 -------------- .../hotspot/jdi/SACoreAttachingConnector.java | 156 --- .../sun/jvm/hotspot/jdi/SADebugServer.java | 64 - .../jdi/SADebugServerAttachingConnector.java | 123 -- .../sun/jvm/hotspot/jdi/SAJDIClassLoader.java | 154 --- .../hotspot/jdi/SAPIDAttachingConnector.java | 143 -- .../classes/sun/jvm/hotspot/jdi/SDE.java | 685 --------- .../sun/jvm/hotspot/jdi/ShortTypeImpl.java | 43 - .../sun/jvm/hotspot/jdi/ShortValueImpl.java | 118 -- .../sun/jvm/hotspot/jdi/StackFrameImpl.java | 314 ----- .../sun/jvm/hotspot/jdi/StratumLineInfo.java | 66 - .../jvm/hotspot/jdi/StringReferenceImpl.java | 48 - .../hotspot/jdi/ThreadGroupReferenceImpl.java | 95 -- .../jvm/hotspot/jdi/ThreadReferenceImpl.java | 400 ------ .../jvm/hotspot/jdi/TypeComponentImpl.java | 67 - .../classes/sun/jvm/hotspot/jdi/TypeImpl.java | 60 - .../sun/jvm/hotspot/jdi/VMModifiers.java | 46 - .../sun/jvm/hotspot/jdi/ValueContainer.java | 40 - .../sun/jvm/hotspot/jdi/ValueImpl.java | 35 - .../jvm/hotspot/jdi/VirtualMachineImpl.java | 1224 ----------------- .../sun/jvm/hotspot/jdi/VoidTypeImpl.java | 41 - .../sun/jvm/hotspot/jdi/VoidValueImpl.java | 56 - .../sun/jvm/hotspot/oops/OopUtilities.java | 7 +- .../sun/jvm/hotspot/oops/java_lang_Class.java | 3 +- .../src/jdk.hotspot.agent/test/jdi/README.jjh | 39 - .../test/jdi/SASanityChecker.java | 134 -- .../src/jdk.hotspot.agent/test/jdi/TEST.ROOT | 30 - .../test/jdi/TargetAdapter.java | 58 - .../test/jdi/TargetListener.java | 50 - .../test/jdi/TestScaffold.java | 758 ---------- .../test/jdi/VMConnection.java | 378 ----- .../src/jdk.hotspot.agent/test/jdi/jstack.sh | 26 - .../jdk.hotspot.agent/test/jdi/jstack64.sh | 26 - .../jdk.hotspot.agent/test/jdi/multivm.java | 133 -- .../src/jdk.hotspot.agent/test/jdi/multivm.sh | 58 - .../src/jdk.hotspot.agent/test/jdi/runjdb.sh | 108 -- .../src/jdk.hotspot.agent/test/jdi/runjpda.sh | 133 -- .../src/jdk.hotspot.agent/test/jdi/runsa.sh | 183 --- .../jdk.hotspot.agent/test/jdi/sagclient.java | 167 --- .../jdk.hotspot.agent/test/jdi/sagdoit.java | 329 ----- .../jdk.hotspot.agent/test/jdi/sagtarg.java | 57 - .../jdk.hotspot.agent/test/jdi/sagtest.java | 89 -- .../jdk.hotspot.agent/test/jdi/sasanity.sh | 76 - .../jdk.hotspot.agent/test/jdi/serialvm.java | 137 -- .../jdk.hotspot.agent/test/jdi/serialvm.sh | 58 - .../sa/TestClassLoaderStats.java | 79 -- .../serviceability/sa/TestStackTrace.java | 77 -- 85 files changed, 6 insertions(+), 13580 deletions(-) delete mode 100644 hotspot/src/jdk.hotspot.agent/doc/ReadMe-JavaScript.text delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ArrayReferenceImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BaseLineInfo.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BooleanTypeImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BooleanValueImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ByteTypeImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ByteValueImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/CharTypeImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/CharValueImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassLoaderReferenceImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ConcreteMethodImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/DoubleTypeImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/DoubleValueImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FieldImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FloatTypeImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FloatValueImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/IntegerTypeImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/IntegerValueImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/JNITypeParser.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LineInfo.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LocalVariableImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LocationImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LongTypeImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LongValueImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MethodImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MirrorImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MonitorInfoImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/NonConcreteMethodImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ObjectReferenceImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/PrimitiveTypeImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/PrimitiveValueImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SACoreAttachingConnector.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SADebugServer.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SADebugServerAttachingConnector.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SAJDIClassLoader.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SAPIDAttachingConnector.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SDE.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ShortTypeImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ShortValueImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/StackFrameImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/StratumLineInfo.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/StringReferenceImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ThreadGroupReferenceImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ThreadReferenceImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/TypeComponentImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/TypeImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VMModifiers.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ValueContainer.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ValueImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VirtualMachineImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VoidTypeImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VoidValueImpl.java delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/README.jjh delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/SASanityChecker.java delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/TEST.ROOT delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/TargetAdapter.java delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/TargetListener.java delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/TestScaffold.java delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/VMConnection.java delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/jstack.sh delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/jstack64.sh delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/multivm.java delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/multivm.sh delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/runjdb.sh delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/runjpda.sh delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/runsa.sh delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/sagclient.java delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/sagdoit.java delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/sagtarg.java delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/sagtest.java delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/sasanity.sh delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/serialvm.java delete mode 100644 hotspot/src/jdk.hotspot.agent/test/jdi/serialvm.sh delete mode 100644 hotspot/test/serviceability/sa/TestClassLoaderStats.java delete mode 100644 hotspot/test/serviceability/sa/TestStackTrace.java diff --git a/hotspot/src/jdk.hotspot.agent/doc/ReadMe-JavaScript.text b/hotspot/src/jdk.hotspot.agent/doc/ReadMe-JavaScript.text deleted file mode 100644 index 432aaa45aa0..00000000000 --- a/hotspot/src/jdk.hotspot.agent/doc/ReadMe-JavaScript.text +++ /dev/null @@ -1,38 +0,0 @@ -The HotSpot Serviceability Agent (SA) is a debugger for hotspot core -dumps and hung processes. There is a read-only JDI (Java Debugger -Interface) implementation on top of SA. This is part of JDK product and -the classes are in $JDK/tools/sa-jdi.jar. - -In addition, there are few serviceability tools in $JDK/bin, namely, -jstack (java stack trace tool), jmap (heap tool), jinfo (Java config -tool) and jsadebugd. The classes for these are also in sa-jdi.jar -file. sa-jdi.jar file is built along with hotspot (libjvm.so) on Solaris -and Linux platforms. On Windows platform, SA-JDI is not included and -serviceability tools do not use SA. - -Apart from these, HotSpot SA consists of a number of tools that are -*not* included in JDK product bits. - -The sources and makefile for all-of-SA (including non-productized stuff) -are under $HOTSPOT_WS/agent directory. The makefile $HOTSPOT/agent/make -directory and shell scripts (and batch files) are used to build and run -SA non-product tools. There is also documentation of SA under -$HOTSPOT/agent/doc directory. - -To build complete SA, you need to have Rhino Mozilla jar (js.jar) -version 1.5R5 under $HOTSPOT/agent/src/share/lib directory. Rhino is -JavaScript interpreter written in Java. Rhino is used to implement SA -features such as - -* SA command line debugger's JavaScript interface - - refer to $HOTSPOT/agent/doc/clhsdb.html - - refer to $HOTSPOT/agent/doc/jsdb.html -* SA simple object query language (SOQL) - - language to query Java heap. - -Rhino's "js.jar" is not included in hotspot source bundles. You need to -download it from http://www.mozilla.org/rhino/download.html. - -Without js.jar, $HOTSPOT/agent/make/Makefile will fail to build. But, -note that sa-jdi.jar containing the productized portions of SA will -still be built when you build hotspot JVM. diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java b/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java index 65b804d0857..dbf9587b307 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -28,12 +28,8 @@ module jdk.hotspot.agent { requires java.desktop; requires java.rmi; requires java.scripting; - requires jdk.jdi; // RMI needs to serialize types in this package exports sun.jvm.hotspot.debugger.remote to java.rmi; - provides com.sun.jdi.connect.Connector with sun.jvm.hotspot.jdi.SACoreAttachingConnector; - provides com.sun.jdi.connect.Connector with sun.jvm.hotspot.jdi.SADebugServerAttachingConnector; - provides com.sun.jdi.connect.Connector with sun.jvm.hotspot.jdi.SAPIDAttachingConnector; } diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ArrayReferenceImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ArrayReferenceImpl.java deleted file mode 100644 index a3a46e98c0b..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ArrayReferenceImpl.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -import java.util.List; -import java.util.ArrayList; -import java.util.Iterator; - -import sun.jvm.hotspot.oops.Instance; -import sun.jvm.hotspot.oops.Array; -import sun.jvm.hotspot.runtime.BasicType; -import sun.jvm.hotspot.utilities.Assert; - -public class ArrayReferenceImpl extends ObjectReferenceImpl - implements ArrayReference -{ - private int length; - ArrayReferenceImpl(VirtualMachine aVm, sun.jvm.hotspot.oops.Array aRef) { - super(aVm, aRef); - length = (int) aRef.getLength(); - } - - ArrayTypeImpl arrayType() { - return (ArrayTypeImpl)type(); - } - - /** - * Return array length. - */ - public int length() { - return length; - } - - public Value getValue(int index) { - List list = getValues(index, 1); - return (Value)list.get(0); - } - - public List getValues() { - return getValues(0, -1); - } - - /** - * Validate that the range to set/get is valid. - * length of -1 (meaning rest of array) has been converted - * before entry. - */ - private void validateArrayAccess(int index, int len) { - // because length can be computed from index, - // index must be tested first for correct error message - if ((index < 0) || (index > length())) { - throw new IndexOutOfBoundsException( - "Invalid array index: " + index); - } - if (len < 0) { - throw new IndexOutOfBoundsException( - "Invalid array range length: " + len); - } - if (index + len > length()) { - throw new IndexOutOfBoundsException( - "Invalid array range: " + - index + " to " + (index + len - 1)); - } - } - - public List getValues(int index, int len) { - if (len == -1) { // -1 means the rest of the array - len = length() - index; - } - validateArrayAccess(index, len); - List vals = new ArrayList(); - if (len == 0) { - return vals; - } - - sun.jvm.hotspot.oops.TypeArray typeArray = null; - sun.jvm.hotspot.oops.ObjArray objArray = null; - if (ref() instanceof sun.jvm.hotspot.oops.TypeArray) { - typeArray = (sun.jvm.hotspot.oops.TypeArray)ref(); - } else if (ref() instanceof sun.jvm.hotspot.oops.ObjArray) { - objArray = (sun.jvm.hotspot.oops.ObjArray)ref(); - } else { - throw new RuntimeException("should not reach here"); - } - - char c = arrayType().componentSignature().charAt(0); - BasicType variableType = BasicType.charToBasicType(c); - - final int limit = index + len; - for (int ii = index; ii < limit; ii++) { - ValueImpl valueImpl; - if (variableType == BasicType.T_BOOLEAN) { - valueImpl = (BooleanValueImpl) vm.mirrorOf(typeArray.getBooleanAt(ii)); - } else if (variableType == BasicType.T_CHAR) { - valueImpl = (CharValueImpl) vm.mirrorOf(typeArray.getCharAt(ii)); - } else if (variableType == BasicType.T_FLOAT) { - valueImpl = (FloatValueImpl) vm.mirrorOf(typeArray.getFloatAt(ii)); - } else if (variableType == BasicType.T_DOUBLE) { - valueImpl = (DoubleValueImpl) vm.mirrorOf(typeArray.getDoubleAt(ii)); - } else if (variableType == BasicType.T_BYTE) { - valueImpl = (ByteValueImpl) vm.mirrorOf(typeArray.getByteAt(ii)); - } else if (variableType == BasicType.T_SHORT) { - valueImpl = (ShortValueImpl) vm.mirrorOf(typeArray.getShortAt(ii)); - } else if (variableType == BasicType.T_INT) { - valueImpl = (IntegerValueImpl) vm.mirrorOf(typeArray.getIntAt(ii)); - } else if (variableType == BasicType.T_LONG) { - valueImpl = (LongValueImpl) vm.mirrorOf(typeArray.getLongAt(ii)); - } else if (variableType == BasicType.T_OBJECT) { - // we may have an [Ljava/lang/Object; - i.e., Object[] with the - // elements themselves may be arrays because every array is an Object. - valueImpl = (ObjectReferenceImpl) vm.objectMirror(objArray.getObjAt(ii)); - } else if (variableType == BasicType.T_ARRAY) { - valueImpl = (ArrayReferenceImpl) vm.arrayMirror((Array) objArray.getObjAt(ii)); - } else { - throw new RuntimeException("should not reach here"); - } - vals.add (valueImpl); - } - return vals; - } - - public void setValue(int index, Value value) - throws InvalidTypeException, - ClassNotLoadedException { - vm.throwNotReadOnlyException("ArrayReference.setValue(...)"); - } - - public void setValues(List values) - throws InvalidTypeException, - ClassNotLoadedException { - setValues(0, values, 0, -1); - } - - public void setValues(int index, List values, - int srcIndex, int length) - throws InvalidTypeException, - ClassNotLoadedException { - - vm.throwNotReadOnlyException("ArrayReference.setValue(...)"); - - } - - public String toString() { - return "instance of " + arrayType().componentTypeName() + - "[" + length() + "] (id=" + uniqueID() + ")"; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java deleted file mode 100644 index 102cc79c2c4..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import sun.jvm.hotspot.oops.ArrayKlass; -import sun.jvm.hotspot.oops.Instance; -import sun.jvm.hotspot.oops.InstanceKlass; -import sun.jvm.hotspot.oops.Klass; -import sun.jvm.hotspot.oops.ObjArrayKlass; -import sun.jvm.hotspot.oops.Symbol; -import sun.jvm.hotspot.oops.TypeArrayKlass; - -import com.sun.jdi.ArrayReference; -import com.sun.jdi.ArrayType; -import com.sun.jdi.ClassLoaderReference; -import com.sun.jdi.ClassNotLoadedException; -import com.sun.jdi.InterfaceType; -import com.sun.jdi.Method; -import com.sun.jdi.PrimitiveType; -import com.sun.jdi.ReferenceType; -import com.sun.jdi.Type; -import com.sun.jdi.VirtualMachine; - -public class ArrayTypeImpl extends ReferenceTypeImpl implements ArrayType { - protected ArrayTypeImpl(VirtualMachine aVm, ArrayKlass aRef) { - super(aVm, aRef); - } - - public ArrayReference newInstance(int length) { - vm.throwNotReadOnlyException("ArrayType.newInstance(int)"); - return null; - } - - public String componentSignature() { - return signature().substring(1); // Just skip the leading '[' - } - - public String componentTypeName() { - JNITypeParser parser = new JNITypeParser(componentSignature()); - return parser.typeName(); - } - - public ClassLoaderReference classLoader() { - if (ref() instanceof TypeArrayKlass) { - // primitive array klasses are loaded by bootstrap loader - return null; - } else { - Klass bottomKlass = ((ObjArrayKlass)ref()).getBottomKlass(); - if (bottomKlass instanceof TypeArrayKlass) { - // multidimensional primitive array klasses are loaded by bootstrap loader - return null; - } else { - // class loader of any other obj array klass is same as the loader - // that loaded the bottom InstanceKlass - Instance xx = (Instance)(((InstanceKlass) bottomKlass).getClassLoader()); - return vm.classLoaderMirror(xx); - } - } - } - - @Override - void addVisibleMethods(Map methodMap, Set handledInterfaces) { - // arrays don't have methods - } - - List getAllMethods() { - // arrays don't have methods - // JLS says arrays have methods of java.lang.Object. But - // JVMDI-JDI returns zero size list. We do the same here - // for consistency. - return new ArrayList(0); - } - - /* - * Find the type object, if any, of a component type of this array. - * The component type does not have to be immediate; e.g. this method - * can be used to find the component Foo of Foo[][]. - */ - public Type componentType() throws ClassNotLoadedException { - ArrayKlass k = (ArrayKlass) ref(); - if (k instanceof ObjArrayKlass) { - Klass elementKlass = ((ObjArrayKlass)k).getElementKlass(); - if (elementKlass == null) { - throw new ClassNotLoadedException(componentSignature()); - } else { - return vm.referenceType(elementKlass); - } - } else { - // It's a primitive type - return vm.primitiveTypeMirror(signature().charAt(1)); - } - } - - static boolean isComponentAssignable(Type destination, Type source) { - if (source instanceof PrimitiveType) { - // Assignment of primitive arrays requires identical - // component types. - return source.equals(destination); - } else { - if (destination instanceof PrimitiveType) { - return false; - } - - ReferenceTypeImpl refSource = (ReferenceTypeImpl)source; - ReferenceTypeImpl refDestination = (ReferenceTypeImpl)destination; - // Assignment of object arrays requires availability - // of widening conversion of component types - return refSource.isAssignableTo(refDestination); - } - } - - - /* - * Return true if an instance of the given reference type - * can be assigned to a variable of this type - */ - boolean isAssignableTo(ReferenceType destType) { - if (destType instanceof ArrayType) { - try { - Type destComponentType = ((ArrayType)destType).componentType(); - return isComponentAssignable(destComponentType, componentType()); - } catch (ClassNotLoadedException e) { - // One or both component types has not yet been - // loaded => can't assign - return false; - } - } else { - Symbol typeName = ((ReferenceTypeImpl)destType).typeNameAsSymbol(); - if (destType instanceof InterfaceType) { - // Every array type implements java.io.Serializable and - // java.lang.Cloneable. fixme in JVMDI-JDI, includes only - // Cloneable but not Serializable. - return typeName.equals(vm.javaLangCloneable()) || - typeName.equals(vm.javaIoSerializable()); - } else { - // Only valid ClassType assignee is Object - return typeName.equals(vm.javaLangObject()); - } - } - } - - List inheritedTypes() { - // arrays are derived from java.lang.Object and - // B[] is derived from A[] if B is derived from A. - // But JVMDI-JDI returns zero sized list and we do the - // same for consistency. - return new ArrayList(0); - } - - int getModifiers() { - /* - * For object arrays, the return values for Interface - * Accessible.isPrivate(), Accessible.isProtected(), - * etc... are the same as would be returned for the - * component type. Fetch the modifier bits from the - * component type and use those. - * - * For primitive arrays, the modifiers are always - * VMModifiers.FINAL | VMModifiers.PUBLIC - * - * Reference com.sun.jdi.Accessible.java. - */ - try { - Type t = componentType(); - if (t instanceof PrimitiveType) { - return VMModifiers.FINAL | VMModifiers.PUBLIC; - } else { - ReferenceType rt = (ReferenceType)t; - return rt.modifiers(); - } - } catch (ClassNotLoadedException cnle) { - cnle.printStackTrace(); - } - return -1; - } - - public String toString() { - return "array class " + name() + " (" + loaderString() + ")"; - } - - /* - * Save a pointless trip over the wire for these methods - * which have undefined results for arrays. - */ - public boolean isPrepared() { return true; } - public boolean isVerified() { return true; } - public boolean isInitialized() { return true; } - public boolean failedToInitialize() { return false; } - public boolean isAbstract() { return false; } - - /* - * Defined always to be true for arrays - */ - public boolean isFinal() { return true; } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BaseLineInfo.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BaseLineInfo.java deleted file mode 100644 index a7834a9e571..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BaseLineInfo.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -class BaseLineInfo implements LineInfo { - private final int lineNumber; - private final ReferenceTypeImpl declaringType; - - BaseLineInfo(int lineNumber, - ReferenceTypeImpl declaringType) { - this.lineNumber = lineNumber; - this.declaringType = declaringType; - } - - public String liStratum() { - return SDE.BASE_STRATUM_NAME; - } - - public int liLineNumber() { - return lineNumber; - } - - public String liSourceName() - throws AbsentInformationException { - return declaringType.baseSourceName(); - } - - public String liSourcePath() - throws AbsentInformationException { - return declaringType.baseSourcePath(); - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BooleanTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BooleanTypeImpl.java deleted file mode 100644 index 1ea8bda9c45..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BooleanTypeImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class BooleanTypeImpl extends PrimitiveTypeImpl implements BooleanType { - BooleanTypeImpl(VirtualMachine vm) { - super(vm); - } - - public String signature() { - return "Z"; - } - - PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException { - return vm.mirrorOf(((PrimitiveValueImpl)value).checkedBooleanValue()); - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BooleanValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BooleanValueImpl.java deleted file mode 100644 index d61b5e75137..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/BooleanValueImpl.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class BooleanValueImpl extends PrimitiveValueImpl - implements BooleanValue { - private boolean value; - - BooleanValueImpl(VirtualMachine aVm,boolean aValue) { - super(aVm); - - value = aValue; - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof BooleanValue)) { - return (value == ((BooleanValue)obj).value()) - && super.equals(obj); - } else { - return false; - } - } - - public int hashCode() { - /* - * TO DO: Better hash code - */ - return intValue(); - } - - public Type type() { - return vm.theBooleanType(); - } - - public boolean value() { - return value; - } - - public boolean booleanValue() { - return value; - } - - public byte byteValue() { - return(byte)((value)?1:0); - } - - public char charValue() { - return(char)((value)?1:0); - } - - public short shortValue() { - return(short)((value)?1:0); - } - - public int intValue() { - return(int)((value)?1:0); - } - - public long longValue() { - return(long)((value)?1:0); - } - - public float floatValue() { - return(float)((value)?1.0:0.0); - } - - public double doubleValue() { - return(double)((value)?1.0:0.0); - } - - public String toString() { - return "" + value; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ByteTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ByteTypeImpl.java deleted file mode 100644 index 6ac45f3ac59..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ByteTypeImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class ByteTypeImpl extends PrimitiveTypeImpl implements ByteType { - ByteTypeImpl(VirtualMachine vm) { - super(vm); - } - - - public String signature() { - return "B"; - } - - PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException { - return vm.mirrorOf(((PrimitiveValueImpl)value).checkedByteValue()); - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ByteValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ByteValueImpl.java deleted file mode 100644 index e34933ef602..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ByteValueImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class ByteValueImpl extends PrimitiveValueImpl - implements ByteValue { - private byte value; - - ByteValueImpl(VirtualMachine aVm,byte aValue) { - super(aVm); - - value = aValue; - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof ByteValue)) { - return (value == ((ByteValue)obj).value()) - && super.equals(obj); - } else { - return false; - } - } - - public int hashCode() { - /* - * TO DO: Better hash code - */ - return intValue(); - } - - public int compareTo(ByteValue byteVal) { - return value() - byteVal.value(); - } - - public Type type() { - return vm.theByteType(); - } - - public byte value() { - return value; - } - - public boolean booleanValue() { - return(value == 0)?false:true; - } - - public byte byteValue() { - return value; - } - - public char charValue() { - return(char)value; - } - - public short shortValue() { - return(short)value; - } - - public int intValue() { - return(int)value; - } - - public long longValue() { - return(long)value; - } - - public float floatValue() { - return(float)value; - } - - public double doubleValue() { - return(double)value; - } - - char checkedCharValue() throws InvalidTypeException { - if ((value > Character.MAX_VALUE) || (value < Character.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to char"); - } else { - return super.checkedCharValue(); - } - } - - public String toString() { - return "" + value; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/CharTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/CharTypeImpl.java deleted file mode 100644 index aa86a06b0a5..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/CharTypeImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class CharTypeImpl extends PrimitiveTypeImpl implements CharType { - CharTypeImpl(VirtualMachine vm) { - super(vm); - } - - - public String signature() { - return "C"; - } - - PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException { - return vm.mirrorOf(((PrimitiveValueImpl)value).checkedCharValue()); - } - -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/CharValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/CharValueImpl.java deleted file mode 100644 index 588b63f74f0..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/CharValueImpl.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class CharValueImpl extends PrimitiveValueImpl - implements CharValue { - private char value; - - CharValueImpl(VirtualMachine aVm,char aValue) { - super(aVm); - - value = aValue; - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof CharValue)) { - return (value == ((CharValue)obj).value()) && - super.equals(obj); - } else { - return false; - } - } - - public int hashCode() { - /* - * TO DO: Better hash code - */ - return intValue(); - } - - public int compareTo(CharValue charVal) { - return value() - charVal.value(); - } - - public Type type() { - return vm.theCharType(); - } - - public char value() { - return value; - } - - public boolean booleanValue() { - return(value == 0)?false:true; - } - - public byte byteValue() { - return(byte)value; - } - - public char charValue() { - return(char)value; - } - - public short shortValue() { - return(short)value; - } - - public int intValue() { - return(int)value; - } - - public long longValue() { - return(long)value; - } - - public float floatValue() { - return(float)value; - } - - public double doubleValue() { - return(double)value; - } - - public String toString() { - return "" + value; - } - - byte checkedByteValue() throws InvalidTypeException { - // Note: since char is unsigned, don't check against MIN_VALUE - if (value > Byte.MAX_VALUE) { - throw new InvalidTypeException("Can't convert " + value + " to byte"); - } else { - return super.checkedByteValue(); - } - } - - short checkedShortValue() throws InvalidTypeException { - // Note: since char is unsigned, don't check against MIN_VALUE - if (value > Short.MAX_VALUE) { - throw new InvalidTypeException("Can't convert " + value + " to short"); - } else { - return super.checkedShortValue(); - } - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassLoaderReferenceImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassLoaderReferenceImpl.java deleted file mode 100644 index ff9627a3274..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassLoaderReferenceImpl.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import sun.jvm.hotspot.oops.Oop; -import sun.jvm.hotspot.oops.Instance; -import sun.jvm.hotspot.oops.Klass; -import sun.jvm.hotspot.memory.SystemDictionary; -import sun.jvm.hotspot.memory.Universe; -import sun.jvm.hotspot.runtime.VM; - -import com.sun.jdi.*; -import java.util.*; - -public class ClassLoaderReferenceImpl - extends ObjectReferenceImpl - implements ClassLoaderReference -{ - // because we work on process snapshot or core we can - // cache visibleClasses & definedClasses always (i.e., no suspension) - private List visibleClassesCache; - private List definedClassesCache; - - ClassLoaderReferenceImpl(VirtualMachine aVm, Instance oRef) { - super(aVm, oRef); - } - - protected String description() { - return "ClassLoaderReference " + uniqueID(); - } - - public List definedClasses() { - if (definedClassesCache == null) { - definedClassesCache = new ArrayList(); - Iterator iter = vm.allClasses().iterator(); - while (iter.hasNext()) { - ReferenceType type = (ReferenceType)iter.next(); - if (equals(type.classLoader())) { /* thanks OTI */ - definedClassesCache.add(type); - } - } - } - return definedClassesCache; - } - - private SystemDictionary getSystemDictionary() { - return vm.saSystemDictionary(); - } - - private Universe getUniverse() { - return vm.saUniverse(); - } - - public List visibleClasses() { - if (visibleClassesCache != null) - return visibleClassesCache; - - visibleClassesCache = new ArrayList(); - - // refer to getClassLoaderClasses in jvmtiGetLoadedClasses.cpp - // a. SystemDictionary::classes_do doesn't include arrays of primitive types (any dimensions) - SystemDictionary sysDict = getSystemDictionary(); - sysDict.classesDo( - new SystemDictionary.ClassAndLoaderVisitor() { - public void visit(Klass k, Oop loader) { - if (ref().equals(loader)) { - for (Klass l = k; l != null; l = l.arrayKlassOrNull()) { - visibleClassesCache.add(vm.referenceType(l)); - } - } - } - } - ); - - // b. multi dimensional arrays of primitive types - sysDict.primArrayClassesDo( - new SystemDictionary.ClassAndLoaderVisitor() { - public void visit(Klass k, Oop loader) { - if (ref().equals(loader)) { - visibleClassesCache.add(vm.referenceType(k)); - } - } - } - ); - - // c. single dimensional primitive array klasses from Universe - // these are not added to SystemDictionary - getUniverse().basicTypeClassesDo( - new SystemDictionary.ClassVisitor() { - public void visit(Klass k) { - visibleClassesCache.add(vm.referenceType(k)); - } - } - ); - - return visibleClassesCache; - } - - Type findType(String signature) throws ClassNotLoadedException { - List types = visibleClasses(); - Iterator iter = types.iterator(); - while (iter.hasNext()) { - ReferenceType type = (ReferenceType)iter.next(); - if (type.signature().equals(signature)) { - return type; - } - } - JNITypeParser parser = new JNITypeParser(signature); - throw new ClassNotLoadedException(parser.typeName(), - "Class " + parser.typeName() + " not loaded"); - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java deleted file mode 100644 index 41d926aec77..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; -import sun.jvm.hotspot.oops.Instance; -import sun.jvm.hotspot.oops.Klass; -import sun.jvm.hotspot.oops.java_lang_Class; - -public class ClassObjectReferenceImpl extends ObjectReferenceImpl - implements ClassObjectReference { - private ReferenceType reflectedType; - - ClassObjectReferenceImpl(VirtualMachine vm, Instance oRef) { - super(vm, oRef); - } - - public ReferenceType reflectedType() { - if (reflectedType == null) { - Klass k = java_lang_Class.asKlass(ref()); - reflectedType = vm.referenceType(k); - } - return reflectedType; - } - - public String toString() { - return "instance of " + referenceType().name() + - "(reflected class=" + reflectedType().name() + ", " + "id=" + - uniqueID() + ")"; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java deleted file mode 100644 index 50a710e9122..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2002, 2007, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import java.lang.ref.SoftReference; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import sun.jvm.hotspot.oops.InstanceKlass; - -import com.sun.jdi.ClassNotLoadedException; -import com.sun.jdi.ClassType; -import com.sun.jdi.Field; -import com.sun.jdi.IncompatibleThreadStateException; -import com.sun.jdi.InterfaceType; -import com.sun.jdi.InvalidTypeException; -import com.sun.jdi.InvocationException; -import com.sun.jdi.Method; -import com.sun.jdi.ObjectReference; -import com.sun.jdi.ReferenceType; -import com.sun.jdi.ThreadReference; -import com.sun.jdi.Value; -import com.sun.jdi.VirtualMachine; - -public class ClassTypeImpl extends ReferenceTypeImpl - implements ClassType -{ - private SoftReference interfacesCache = null; - private SoftReference allInterfacesCache = null; - private SoftReference subclassesCache = null; - - protected ClassTypeImpl(VirtualMachine aVm, InstanceKlass aRef) { - super(aVm, aRef); - } - - public ClassType superclass() { - InstanceKlass kk = (InstanceKlass)ref().getSuper(); - if (kk == null) { - return null; - } - return (ClassType) vm.referenceType(kk); - } - - public List interfaces() { - List interfaces = (interfacesCache != null)? (List) interfacesCache.get() : null; - if (interfaces == null) { - checkPrepared(); - interfaces = Collections.unmodifiableList(getInterfaces()); - interfacesCache = new SoftReference(interfaces); - } - return interfaces; - } - - void addInterfaces(List list) { - List immediate = interfaces(); - - HashSet hashList = new HashSet(list); - hashList.addAll(immediate); - list.clear(); - list.addAll(hashList); - - Iterator iter = immediate.iterator(); - while (iter.hasNext()) { - InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); - interfaze.addSuperinterfaces(list); - } - - ClassTypeImpl superclass = (ClassTypeImpl)superclass(); - if (superclass != null) { - superclass.addInterfaces(list); - } - } - - public List allInterfaces() { - List allinterfaces = (allInterfacesCache != null)? (List) allInterfacesCache.get() : null; - if (allinterfaces == null) { - checkPrepared(); - allinterfaces = new ArrayList(); - addInterfaces(allinterfaces); - allinterfaces = Collections.unmodifiableList(allinterfaces); - allInterfacesCache = new SoftReference(allinterfaces); - } - return allinterfaces; - } - - public List subclasses() { - List subclasses = (subclassesCache != null)? (List) subclassesCache.get() : null; - if (subclasses == null) { - List all = vm.allClasses(); - subclasses = new ArrayList(0); - Iterator iter = all.iterator(); - while (iter.hasNext()) { - ReferenceType refType = (ReferenceType)iter.next(); - if (refType instanceof ClassType) { - ClassType clazz = (ClassType)refType; - ClassType superclass = clazz.superclass(); - if ((superclass != null) && superclass.equals(this)) { - subclasses.add(refType); - } - } - } - subclasses = Collections.unmodifiableList(subclasses); - subclassesCache = new SoftReference(subclasses); - } - return subclasses; - } - - public Method concreteMethodByName(String name, String signature) { - checkPrepared(); - List methods = visibleMethods(); - Method method = null; - Iterator iter = methods.iterator(); - while (iter.hasNext()) { - Method candidate = (Method)iter.next(); - if (candidate.name().equals(name) && - candidate.signature().equals(signature) && - !candidate.isAbstract()) { - - method = candidate; - break; - } - } - return method; - } - - List getAllMethods() { - ArrayList list = new ArrayList(methods()); - ClassType clazz = superclass(); - while (clazz != null) { - list.addAll(clazz.methods()); - clazz = clazz.superclass(); - } - /* - * Avoid duplicate checking on each method by iterating through - * duplicate-free allInterfaces() rather than recursing - */ - Iterator iter = allInterfaces().iterator(); - while (iter.hasNext()) { - InterfaceType interfaze = (InterfaceType)iter.next(); - list.addAll(interfaze.methods()); - } - return list; - } - - List inheritedTypes() { - List inherited = new ArrayList(interfaces()); - if (superclass() != null) { - inherited.add(0, superclass()); /* insert at front */ - } - return inherited; - } - - public boolean isEnum() { - ClassTypeImpl superclass = (ClassTypeImpl) superclass(); - if (superclass != null) { - return superclass.typeNameAsSymbol().equals(vm.javaLangEnum()); - } else { - return false; - } - } - - public void setValue(Field field, Value value) - throws InvalidTypeException, ClassNotLoadedException { - vm.throwNotReadOnlyException("ClassType.setValue(...)"); - } - - - public Value invokeMethod(ThreadReference threadIntf, Method methodIntf, - List arguments, int options) - throws InvalidTypeException, - ClassNotLoadedException, - IncompatibleThreadStateException, - InvocationException { - vm.throwNotReadOnlyException("ClassType.invokeMethod(...)"); - return null; - } - - public ObjectReference newInstance(ThreadReference threadIntf, - Method methodIntf, - List arguments, int options) - throws InvalidTypeException, - ClassNotLoadedException, - IncompatibleThreadStateException, - InvocationException { - vm.throwNotReadOnlyException("ClassType.newInstance(...)"); - return null; - } - - @Override - void addVisibleMethods(Map methodMap, Set seenInterfaces) { - /* - * Add methods from - * parent types first, so that the methods in this class will - * overwrite them in the hash table - */ - - Iterator iter = interfaces().iterator(); - while (iter.hasNext()) { - InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); - if (!seenInterfaces.contains(interfaze)) { - interfaze.addVisibleMethods(methodMap, seenInterfaces); - seenInterfaces.add(interfaze); - } - } - - ClassTypeImpl clazz = (ClassTypeImpl)superclass(); - if (clazz != null) { - clazz.addVisibleMethods(methodMap, seenInterfaces); - } - - addToMethodMap(methodMap, methods()); - } - - boolean isAssignableTo(ReferenceType type) { - ClassTypeImpl superclazz = (ClassTypeImpl)superclass(); - if (this.equals(type)) { - return true; - } else if ((superclazz != null) && superclazz.isAssignableTo(type)) { - return true; - } else { - List interfaces = interfaces(); - Iterator iter = interfaces.iterator(); - while (iter.hasNext()) { - InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); - if (interfaze.isAssignableTo(type)) { - return true; - } - } - return false; - } - } - - public String toString() { - return "class " + name() + "(" + loaderString() + ")"; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ConcreteMethodImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ConcreteMethodImpl.java deleted file mode 100644 index d4288f44eef..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ConcreteMethodImpl.java +++ /dev/null @@ -1,467 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; -import sun.jvm.hotspot.oops.Symbol; -import sun.jvm.hotspot.oops.LocalVariableTableElement; -import sun.jvm.hotspot.oops.LineNumberTableElement; -import java.util.List; -import java.util.Iterator; -import java.util.Map; -import java.util.HashMap; -import java.util.ArrayList; -import java.util.Comparator; -import java.lang.ref.SoftReference; -import java.util.Collections; - -public class ConcreteMethodImpl extends MethodImpl { - - /* - * A subset of the line number info that is softly cached - */ - static private class SoftLocationXRefs { - final String stratumID; // The stratum of this information - final Map lineMapper; // Maps line number to location(s) - final List lineLocations; // List of locations ordered by code index - - /* - * Note: these do not necessarily correspond to - * the line numbers of the first and last elements - * in the lineLocations list. Use these only for bounds - * checking and with lineMapper. - */ - final int lowestLine; - final int highestLine; - - SoftLocationXRefs(String stratumID, Map lineMapper, List lineLocations, - int lowestLine, int highestLine) { - this.stratumID = stratumID; - this.lineMapper = Collections.unmodifiableMap(lineMapper); - this.lineLocations = - Collections.unmodifiableList(lineLocations); - this.lowestLine = lowestLine; - this.highestLine = highestLine; - } - } - - private SoftReference softBaseLocationXRefsRef; - private SoftReference softOtherLocationXRefsRef; - private SoftReference variablesRef = null; - private int firstIndex = -1; - private int lastIndex = -1; - private Location location; - private SoftReference bytecodesRef = null; - - ConcreteMethodImpl(VirtualMachine vm, ReferenceTypeImpl declaringType, - sun.jvm.hotspot.oops.Method saMethod ) { - super(vm, declaringType, saMethod); - } - - int argSlotCount() throws AbsentInformationException { - return (int) saMethod.getSizeOfParameters(); - } - - private SoftLocationXRefs getLocations(SDE.Stratum stratum) { - if (stratum.isJava()) { - return getBaseLocations(); - } - String stratumID = stratum.id(); - SoftLocationXRefs info = - (softOtherLocationXRefsRef == null) ? null : - (SoftLocationXRefs)softOtherLocationXRefsRef.get(); - if (info != null && info.stratumID.equals(stratumID)) { - return info; - } - - List lineLocations = new ArrayList(); - Map lineMapper = new HashMap(); - int lowestLine = -1; - int highestLine = -1; - SDE.LineStratum lastLineStratum = null; - SDE.Stratum baseStratum = - declaringType.stratum(SDE.BASE_STRATUM_NAME); - Iterator it = getBaseLocations().lineLocations.iterator(); - while(it.hasNext()) { - LocationImpl loc = (LocationImpl)it.next(); - int baseLineNumber = loc.lineNumber(baseStratum); - SDE.LineStratum lineStratum = - stratum.lineStratum(declaringType, - baseLineNumber); - - if (lineStratum == null) { - // location not mapped in this stratum - continue; - } - - int lineNumber = lineStratum.lineNumber(); - - // remove unmapped and dup lines - if ((lineNumber != -1) && - (!lineStratum.equals(lastLineStratum))) { - lastLineStratum = lineStratum; - // Remember the largest/smallest line number - if (lineNumber > highestLine) { - highestLine = lineNumber; - } - if ((lineNumber < lowestLine) || (lowestLine == -1)) { - lowestLine = lineNumber; - } - - loc.addStratumLineInfo( - new StratumLineInfo(stratumID, - lineNumber, - lineStratum.sourceName(), - lineStratum.sourcePath())); - - // Add to the location list - lineLocations.add(loc); - - // Add to the line -> locations map - Integer key = new Integer(lineNumber); - List mappedLocs = (List)lineMapper.get(key); - if (mappedLocs == null) { - mappedLocs = new ArrayList(1); - lineMapper.put(key, mappedLocs); - } - mappedLocs.add(loc); - } - } - - info = new SoftLocationXRefs(stratumID, - lineMapper, lineLocations, - lowestLine, highestLine); - softOtherLocationXRefsRef = new SoftReference(info); - return info; - } - - private SoftLocationXRefs getBaseLocations() { - SoftLocationXRefs info = (softBaseLocationXRefsRef == null) ? null : - (SoftLocationXRefs)softBaseLocationXRefsRef.get(); - if (info != null) { - return info; - } - - byte[] codeBuf = bytecodes(); - firstIndex = 0; - lastIndex = codeBuf.length - 1; - // This is odd; what is the Location of a Method? - // A StackFrame can have a location, but a Method? - // I guess it must be the Location for bci 0. - location = new LocationImpl(virtualMachine(), this, 0); - - boolean hasLineInfo = saMethod.hasLineNumberTable(); - LineNumberTableElement[] lntab = null; - int count; - - if (hasLineInfo) { - lntab = saMethod.getLineNumberTable(); - count = lntab.length; - } else { - count = 0; - } - - List lineLocations = new ArrayList(count); - Map lineMapper = new HashMap(); - int lowestLine = -1; - int highestLine = -1; - for (int i = 0; i < count; i++) { - long bci = lntab[i].getStartBCI(); - int lineNumber = lntab[i].getLineNumber(); - - /* - * Some compilers will point multiple consecutive - * lines at the same location. We need to choose - * one of them so that we can consistently map back - * and forth between line and location. So we choose - * to record only the last line entry at a particular - * location. - */ - if ((i + 1 == count) || (bci != lntab[i+1].getStartBCI())) { - // Remember the largest/smallest line number - if (lineNumber > highestLine) { - highestLine = lineNumber; - } - if ((lineNumber < lowestLine) || (lowestLine == -1)) { - lowestLine = lineNumber; - } - LocationImpl loc = - new LocationImpl(virtualMachine(), this, bci); - loc.addBaseLineInfo( - new BaseLineInfo(lineNumber, declaringType)); - - // Add to the location list - lineLocations.add(loc); - - // Add to the line -> locations map - Integer key = new Integer(lineNumber); - List mappedLocs = (List)lineMapper.get(key); - if (mappedLocs == null) { - mappedLocs = new ArrayList(1); - lineMapper.put(key, mappedLocs); - } - mappedLocs.add(loc); - } - } - - info = new SoftLocationXRefs(SDE.BASE_STRATUM_NAME, - lineMapper, lineLocations, - lowestLine, highestLine); - softBaseLocationXRefsRef = new SoftReference(info); - return info; - } - - List sourceNameFilter(List list, - SDE.Stratum stratum, - String sourceName) - throws AbsentInformationException { - if (sourceName == null) { - return list; - } else { - /* needs sourceName filteration */ - List locs = new ArrayList(); - Iterator it = list.iterator(); - while (it.hasNext()) { - LocationImpl loc = (LocationImpl)it.next(); - if (loc.sourceName(stratum).equals(sourceName)) { - locs.add(loc); - } - } - return locs; - } - } - - public List allLineLocations(SDE.Stratum stratum, String sourceName) - throws AbsentInformationException { - List lineLocations = getLocations(stratum).lineLocations; - - if (lineLocations.size() == 0) { - throw new AbsentInformationException(); - } - - return Collections.unmodifiableList( - sourceNameFilter(lineLocations, stratum, sourceName)); - } - - public List locationsOfLine(SDE.Stratum stratum, String sourceName, - int lineNumber) throws AbsentInformationException { - SoftLocationXRefs info = getLocations(stratum); - - if (info.lineLocations.size() == 0) { - throw new AbsentInformationException(); - } - - /* - * Find the locations which match the line number - * passed in. - */ - List list = (List)info.lineMapper.get( - new Integer(lineNumber)); - - if (list == null) { - list = new ArrayList(0); - } - return Collections.unmodifiableList( - sourceNameFilter(list, stratum, sourceName)); - } - - LineInfo codeIndexToLineInfo(SDE.Stratum stratum, - long codeIndex) { - if (firstIndex == -1) { - getBaseLocations(); - } - - /* - * Check for invalid code index. - */ - if (codeIndex < firstIndex || codeIndex > lastIndex) { - throw new InternalError( - "Location with invalid code index"); - } - - List lineLocations = getLocations(stratum).lineLocations; - - /* - * Check for absent line numbers. - */ - if (lineLocations.size() == 0) { - return super.codeIndexToLineInfo(stratum, codeIndex); - } - - Iterator iter = lineLocations.iterator(); - /* - * Treat code before the beginning of the first line table - * entry as part of the first line. javac will generate - * code like this for some local classes. This "prolog" - * code contains assignments from locals in the enclosing - * scope to synthetic fields in the local class. Same for - * other language prolog code. - */ - LocationImpl bestMatch = (LocationImpl)iter.next(); - while (iter.hasNext()) { - LocationImpl current = (LocationImpl)iter.next(); - if (current.codeIndex() > codeIndex) { - break; - } - bestMatch = current; - } - return bestMatch.getLineInfo(stratum); - } - - public Location locationOfCodeIndex(long codeIndex) { - if (firstIndex == -1) { - getBaseLocations(); - } - - /* - * Check for invalid code index. - */ - if (codeIndex < firstIndex || codeIndex > lastIndex) { - return null; - } - - return new LocationImpl(virtualMachine(), this, codeIndex); - } - - public List variables() throws AbsentInformationException { - return getVariables(); - } - - public List variablesByName(String name) throws AbsentInformationException { - List variables = getVariables(); - - List retList = new ArrayList(2); - Iterator iter = variables.iterator(); - while(iter.hasNext()) { - LocalVariable variable = (LocalVariable)iter.next(); - if (variable.name().equals(name)) { - retList.add(variable); - } - } - return retList; - } - - public List arguments() throws AbsentInformationException { - if (argumentTypeNames().size() == 0) { - return new ArrayList(0); - } - List variables = getVariables(); - List retList = new ArrayList(variables.size()); - Iterator iter = variables.iterator(); - while(iter.hasNext()) { - LocalVariable variable = (LocalVariable)iter.next(); - if (variable.isArgument()) { - retList.add(variable); - } - } - return retList; - } - - public byte[] bytecodes() { - byte[] bytecodes = (bytecodesRef == null) ? null : - (byte[])bytecodesRef.get(); - if (bytecodes == null) { - bytecodes = saMethod.getByteCode(); - bytecodesRef = new SoftReference(bytecodes); - } - /* - * Arrays are always modifiable, so it is a little unsafe - * to return the cached bytecodes directly; instead, we - * make a clone at the cost of using more memory. - */ - return (byte[])bytecodes.clone(); - } - - public Location location() { - if (location == null) { - getBaseLocations(); - } - return location; - } - - private List getVariables() throws AbsentInformationException { - List variables = (variablesRef == null) ? null : - (List)variablesRef.get(); - if (variables != null) { - return variables; - } - - // if there are no locals, there won't be a LVT - if (saMethod.getMaxLocals() == 0) { - variables = Collections.unmodifiableList(new ArrayList(0)); - variablesRef = new SoftReference(variables); - return variables; - } - - if (! saMethod.hasLocalVariableTable()) { - throw new AbsentInformationException(); - } - //Build up the JDI view of local variable table. - LocalVariableTableElement[] locals = saMethod.getLocalVariableTable(); - int localCount = locals.length; - variables = new ArrayList(localCount); - for (int ii = 0; ii < localCount; ii++) { - String name = - saMethod.getConstants().getSymbolAt(locals[ii].getNameCPIndex()).asString(); - /* - * Skip "this$*", "this+*", "this" entries because they are never real - * variables from the JLS perspective. "this+*" is new with 1.5. - * Instead of using '+', we check for java letter or digit to avoid - * depending on javac's current choice of '+'. - */ - boolean isInternalName = name.startsWith("this") && - (name.length() == 4 || name.charAt(4)=='$' || !Character.isJavaIdentifierPart(name.charAt(4))); - if (! isInternalName) { - int slot = locals[ii].getSlot(); - long codeIndex = locals[ii].getStartBCI(); - int length = locals[ii].getLength(); - Location scopeStart = new LocationImpl(virtualMachine(), - this, codeIndex); - Location scopeEnd = - new LocationImpl(virtualMachine(), this, - codeIndex + length - 1); - String signature = - saMethod.getConstants().getSymbolAt(locals[ii].getDescriptorCPIndex()).asString(); - - int genericSigIndex = locals[ii].getSignatureCPIndex(); - String genericSignature = null; - if (genericSigIndex != 0) { - genericSignature = saMethod.getConstants().getSymbolAt(genericSigIndex).asString(); - } - - LocalVariable variable = - new LocalVariableImpl(virtualMachine(), this, - slot, scopeStart, scopeEnd, - name, signature, genericSignature); - // Add to the variable list - variables.add(variable); - } - } - - variables = Collections.unmodifiableList(variables); - variablesRef = new SoftReference(variables); - return variables; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java deleted file mode 100644 index 0cffde9de33..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java +++ /dev/null @@ -1,631 +0,0 @@ -/* - * Copyright (c) 2002, 2012, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.connect.*; -import com.sun.jdi.InternalException; - -import java.io.*; -import java.lang.ref.*; -import java.lang.reflect.*; -import java.util.*; - -abstract class ConnectorImpl implements Connector { - Map defaultArguments = new LinkedHashMap(); - - // Used by BooleanArgument - static String trueString = null; - static String falseString; - - - /** This is not public in VirtualMachineManagerImpl - ThreadGroup mainGroupForJDI() { - return ((VirtualMachineManagerImpl)manager).mainGroupForJDI(); - } - ***/ - - // multiple debuggee support for SA/JDI - private static List freeVMClasses; // List> - private static ClassLoader myLoader; - // debug mode for SA/JDI connectors - static final protected boolean DEBUG; - static { - myLoader = ConnectorImpl.class.getClassLoader(); - freeVMClasses = new ArrayList(0); - DEBUG = System.getProperty("sun.jvm.hotspot.jdi.ConnectorImpl.DEBUG") != null; - } - - // add a new free VirtualMachineImpl class - private static synchronized void addFreeVMImplClass(Class clazz) { - if (DEBUG) { - System.out.println("adding free VirtualMachineImpl class"); - } - freeVMClasses.add(new SoftReference(clazz)); - } - - // returns null if we don't have anything free - private static synchronized Class getFreeVMImplClass() { - while (!freeVMClasses.isEmpty()) { - SoftReference ref = (SoftReference) freeVMClasses.remove(0); - Object o = ref.get(); - if (o != null) { - if (DEBUG) { - System.out.println("re-using loaded VirtualMachineImpl"); - } - return (Class) o; - } - } - return null; - } - - private static Class getVMImplClassFrom(ClassLoader cl) - throws ClassNotFoundException { - return Class.forName("sun.jvm.hotspot.jdi.VirtualMachineImpl", true, cl); - } - - /* SA has not been designed to support multiple debuggee VMs - * at-a-time. But, JDI supports multiple debuggee VMs. We - * support multiple debuggee VMs in SA/JDI, by creating a new - * class loader instance (refer to comment in SAJDIClassLoader - * for details). But, to avoid excessive class loading (and - * thereby resulting in larger footprint), we re-use 'dispose'd - * VirtualMachineImpl classes. - */ - protected static Class loadVirtualMachineImplClass() - throws ClassNotFoundException { - Class vmImplClass = getFreeVMImplClass(); - if (vmImplClass == null) { - ClassLoader cl = new SAJDIClassLoader(myLoader); - vmImplClass = getVMImplClassFrom(cl); - } - return vmImplClass; - } - - /* We look for System property sun.jvm.hotspot.jdi.. - * This property should have the value of JDK HOME directory for - * the given . - */ - private static String getSAClassPathForVM(String vmVersion) { - final String prefix = "sun.jvm.hotspot.jdi."; - // look for exact match of VM version - String jvmHome = System.getProperty(prefix + vmVersion); - if (DEBUG) { - System.out.println("looking for System property " + prefix + vmVersion); - } - - if (jvmHome == null) { - // omit chars after first '-' in VM version and try - // for example, in '1.5.0-b55' we take '1.5.0' - int index = vmVersion.indexOf('-'); - if (index != -1) { - vmVersion = vmVersion.substring(0, index); - if (DEBUG) { - System.out.println("looking for System property " + prefix + vmVersion); - } - jvmHome = System.getProperty(prefix + vmVersion); - } - - if (jvmHome == null) { - // System property is not set - if (DEBUG) { - System.out.println("can't locate JDK home for " + vmVersion); - } - return null; - } - } - - if (DEBUG) { - System.out.println("JDK home for " + vmVersion + " is " + jvmHome); - } - - // sa-jdi is in $JDK_HOME/lib directory - StringBuffer buf = new StringBuffer(); - buf.append(jvmHome); - buf.append(File.separatorChar); - buf.append("lib"); - buf.append(File.separatorChar); - buf.append("sa-jdi.jar"); - return buf.toString(); - } - - /* This method loads VirtualMachineImpl class by a ClassLoader - * configured with sa-jdi.jar path of given 'vmVersion'. This is - * used for cross VM version debugging. Refer to comments in - * SAJDIClassLoader as well. - */ - protected static Class loadVirtualMachineImplClass(String vmVersion) - throws ClassNotFoundException { - if (DEBUG) { - System.out.println("attemping to load sa-jdi.jar for version " + vmVersion); - } - String classPath = getSAClassPathForVM(vmVersion); - if (classPath != null) { - ClassLoader cl = new SAJDIClassLoader(myLoader, classPath); - return getVMImplClassFrom(cl); - } else { - return null; - } - } - - /* Is the given throwable an instanceof VMVersionMismatchException? - * Note that we can't do instanceof check because the exception - * class might have been loaded by a different class loader. - */ - private static boolean isVMVersionMismatch(Throwable throwable) { - String className = throwable.getClass().getName(); - return className.equals("sun.jvm.hotspot.runtime.VMVersionMismatchException"); - } - - /* gets target VM version from the given VMVersionMismatchException. - * Note that we need to reflectively call the method because of we may - * have got this from different classloader's namespace */ - private static String getVMVersion(Throwable throwable) - throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { - // assert isVMVersionMismatch(throwable), "not a VMVersionMismatch" - Class expClass = throwable.getClass(); - Method targetVersionMethod = expClass.getMethod("getTargetVersion", new Class[0]); - return (String) targetVersionMethod.invoke(throwable); - } - - /** If the causal chain has a sun.jvm.hotspot.runtime.VMVersionMismatchException, - attempt to load VirtualMachineImpl class for target VM version. */ - protected static Class handleVMVersionMismatch(InvocationTargetException ite) { - Throwable cause = ite.getCause(); - if (DEBUG) { - System.out.println("checking for version mismatch..."); - } - while (cause != null) { - try { - if (isVMVersionMismatch(cause)) { - if (DEBUG) { - System.out.println("Triggering cross VM version support..."); - } - return loadVirtualMachineImplClass(getVMVersion(cause)); - } - } catch (Exception exp) { - if (DEBUG) { - System.out.println("failed to load VirtualMachineImpl class"); - exp.printStackTrace(); - } - return null; - } - cause = cause.getCause(); - } - return null; - } - - protected void checkNativeLink(SecurityManager sm, String os) { - if (os.equals("SunOS") || os.equals("Linux") || os.contains("OS X")) { - // link "saproc" - SA native library on SunOS, Linux, and Mac OS X - sm.checkLink("saproc"); - } else if (os.startsWith("Windows")) { - // link "sawindbg" - SA native library on Windows. - sm.checkLink("sawindbg"); - } else { - throw new RuntimeException(os + " is not yet supported"); - } - } - - // we set an observer to detect VirtualMachineImpl.dispose call - // and on dispose we add corresponding VirtualMachineImpl.class to - // free VirtualMachimeImpl Class list. - protected static void setVMDisposeObserver(final Object vm) { - try { - Method setDisposeObserverMethod = vm.getClass().getDeclaredMethod("setDisposeObserver", - new Class[] { java.util.Observer.class }); - setDisposeObserverMethod.setAccessible(true); - setDisposeObserverMethod.invoke(vm, - new Object[] { - new Observer() { - public void update(Observable o, Object data) { - if (DEBUG) { - System.out.println("got VM.dispose notification"); - } - addFreeVMImplClass(vm.getClass()); - } - } - }); - } catch (Exception exp) { - if (DEBUG) { - System.out.println("setVMDisposeObserver() got an exception:"); - exp.printStackTrace(); - } - } - } - - public Map defaultArguments() { - Map defaults = new LinkedHashMap(); - Collection values = defaultArguments.values(); - - Iterator iter = values.iterator(); - while (iter.hasNext()) { - ArgumentImpl argument = (ArgumentImpl)iter.next(); - defaults.put(argument.name(), argument.clone()); - } - return defaults; - } - - void addStringArgument(String name, String label, String description, - String defaultValue, boolean mustSpecify) { - defaultArguments.put(name, - new StringArgumentImpl(name, label, - description, - defaultValue, - mustSpecify)); - } - - void addBooleanArgument(String name, String label, String description, - boolean defaultValue, boolean mustSpecify) { - defaultArguments.put(name, - new BooleanArgumentImpl(name, label, - description, - defaultValue, - mustSpecify)); - } - - void addIntegerArgument(String name, String label, String description, - String defaultValue, boolean mustSpecify, - int min, int max) { - defaultArguments.put(name, - new IntegerArgumentImpl(name, label, - description, - defaultValue, - mustSpecify, - min, max)); - } - - void addSelectedArgument(String name, String label, String description, - String defaultValue, boolean mustSpecify, - List list) { - defaultArguments.put(name, - new SelectedArgumentImpl(name, label, - description, - defaultValue, - mustSpecify, list)); - } - - ArgumentImpl argument(String name, Map arguments) - throws IllegalConnectorArgumentsException { - - ArgumentImpl argument = (ArgumentImpl)arguments.get(name); - if (argument == null) { - throw new IllegalConnectorArgumentsException( - "Argument missing", name); - } - String value = argument.value(); - if (value == null || value.length() == 0) { - if (argument.mustSpecify()) { - throw new IllegalConnectorArgumentsException( - "Argument unspecified", name); - } - } else if(!argument.isValid(value)) { - throw new IllegalConnectorArgumentsException( - "Argument invalid", name); - } - - return argument; - } - - String getString(String key) { - //fixme jjh; needs i18n - // this is not public return ((VirtualMachineManagerImpl)manager).getString(key); - return key; - } - - public String toString() { - String string = name() + " (defaults: "; - Iterator iter = defaultArguments().values().iterator(); - boolean first = true; - while (iter.hasNext()) { - ArgumentImpl argument = (ArgumentImpl)iter.next(); - if (!first) { - string += ", "; - } - string += argument.toString(); - first = false; - } - return string + ")"; - } - - abstract class ArgumentImpl implements Connector.Argument, Cloneable, Serializable { - private String name; - private String label; - private String description; - private String value; - private boolean mustSpecify; - - ArgumentImpl(String name, String label, String description, - String value, - boolean mustSpecify) { - this.name = name; - this.label = label; - this.description = description; - this.value = value; - this.mustSpecify = mustSpecify; - } - - public abstract boolean isValid(String value); - - public String name() { - return name; - } - - public String label() { - return label; - } - - public String description() { - return description; - } - - public String value() { - return value; - } - - public void setValue(String value) { - if (value == null) { - throw new NullPointerException("Can't set null value"); - } - this.value = value; - } - - public boolean mustSpecify() { - return mustSpecify; - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof Connector.Argument)) { - Connector.Argument other = (Connector.Argument)obj; - return (name().equals(other.name())) && - (description().equals(other.description())) && - (mustSpecify() == other.mustSpecify()) && - (value().equals(other.value())); - } else { - return false; - } - } - - public int hashCode() { - return description().hashCode(); - } - - public Object clone() { - try { - return super.clone(); - } catch (CloneNotSupportedException e) { - // Object should always support clone - throw (InternalException) new InternalException().initCause(e); - } - } - - public String toString() { - return name() + "=" + value(); - } - } - - class BooleanArgumentImpl extends ConnectorImpl.ArgumentImpl - implements Connector.BooleanArgument { - - BooleanArgumentImpl(String name, String label, String description, - boolean value, - boolean mustSpecify) { - super(name, label, description, null, mustSpecify); - if(trueString == null) { - trueString = getString("true"); - falseString = getString("false"); - } - setValue(value); - } - - /** - * Sets the value of the argument. - */ - public void setValue(boolean value) { - setValue(stringValueOf(value)); - } - - /** - * Performs basic sanity check of argument. - * @return true if value is a string - * representation of a boolean value. - * @see #stringValueOf(boolean) - */ - public boolean isValid(String value) { - return value.equals(trueString) || value.equals(falseString); - } - - /** - * Return the string representation of the value - * parameter. - * Does not set or examine the value or the argument. - * @return the localized String representation of the - * boolean value. - */ - public String stringValueOf(boolean value) { - return value? trueString : falseString; - } - - /** - * Return the value of the argument as a boolean. Since - * the argument may not have been set or may have an invalid - * value {@link #isValid(String)} should be called on - * {@link #value()} to check its validity. If it is invalid - * the boolean returned by this method is undefined. - * @return the value of the argument as a boolean. - */ - public boolean booleanValue() { - return value().equals(trueString); - } - } - - class IntegerArgumentImpl extends ConnectorImpl.ArgumentImpl - implements Connector.IntegerArgument { - - private final int min; - private final int max; - - IntegerArgumentImpl(String name, String label, String description, - String value, - boolean mustSpecify, int min, int max) { - super(name, label, description, value, mustSpecify); - this.min = min; - this.max = max; - } - - /** - * Sets the value of the argument. - * The value should be checked with {@link #isValid(int)} - * before setting it; invalid values will throw an exception - * when the connection is established - for example, - * on {@link LaunchingConnector#launch} - */ - public void setValue(int value) { - setValue(stringValueOf(value)); - } - - /** - * Performs basic sanity check of argument. - * @return true if value represents an int that is - * {@link #min()} <= value <= {@link #max()} - */ - public boolean isValid(String value) { - if (value == null) { - return false; - } - try { - return isValid(Integer.decode(value).intValue()); - } catch(NumberFormatException exc) { - return false; - } - } - - /** - * Performs basic sanity check of argument. - * @return true if - * {@link #min()} <= value <= {@link #max()} - */ - public boolean isValid(int value) { - return min <= value && value <= max; - } - - /** - * Return the string representation of the value - * parameter. - * Does not set or examine the value or the argument. - * @return the String representation of the - * int value. - */ - public String stringValueOf(int value) { - // *** Should this be internationalized???? - // *** Even Brian Beck was unsure if an Arabic programmer - // *** would expect port numbers in Arabic numerals, - // *** so punt for now. - return ""+value; - } - - /** - * Return the value of the argument as a int. Since - * the argument may not have been set or may have an invalid - * value {@link #isValid(String)} should be called on - * {@link #value()} to check its validity. If it is invalid - * the int returned by this method is undefined. - * @return the value of the argument as a int. - */ - public int intValue() { - if (value() == null) { - return 0; - } - try { - return Integer.decode(value()).intValue(); - } catch(NumberFormatException exc) { - return 0; - } - } - - /** - * The upper bound for the value. - * @return the maximum allowed value for this argument. - */ - public int max() { - return max; - } - - /** - * The lower bound for the value. - * @return the minimum allowed value for this argument. - */ - public int min() { - return min; - } - } - - class StringArgumentImpl extends ConnectorImpl.ArgumentImpl - implements Connector.StringArgument { - - StringArgumentImpl(String name, String label, String description, - String value, - boolean mustSpecify) { - super(name, label, description, value, mustSpecify); - } - - /** - * Performs basic sanity check of argument. - * @return true always - */ - public boolean isValid(String value) { - return true; - } - } - - class SelectedArgumentImpl extends ConnectorImpl.ArgumentImpl - implements Connector.SelectedArgument { - - private final List choices; - - SelectedArgumentImpl(String name, String label, String description, - String value, - boolean mustSpecify, List choices) { - super(name, label, description, value, mustSpecify); - this.choices = Collections.unmodifiableList( - new ArrayList(choices)); - } - - /** - * Return the possible values for the argument - * @return {@link List} of {@link String} - */ - public List choices() { - return choices; - } - - /** - * Performs basic sanity check of argument. - * @return true if value is one of {@link #choices()}. - */ - public boolean isValid(String value) { - return choices.contains(value); - } - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/DoubleTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/DoubleTypeImpl.java deleted file mode 100644 index dfe72a41d95..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/DoubleTypeImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class DoubleTypeImpl extends PrimitiveTypeImpl implements DoubleType { - DoubleTypeImpl(VirtualMachine vm) { - super(vm); - } - - - public String signature() { - return "D"; - } - - PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException { - return vm.mirrorOf(((PrimitiveValueImpl)value).checkedDoubleValue()); - } - -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/DoubleValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/DoubleValueImpl.java deleted file mode 100644 index d9f914b111c..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/DoubleValueImpl.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class DoubleValueImpl extends PrimitiveValueImpl - implements DoubleValue { - private double value; - - DoubleValueImpl(VirtualMachine aVm,double aValue) { - super(aVm); - - value = aValue; - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof DoubleValue)) { - return (value == ((DoubleValue)obj).value()) && - super.equals(obj); - } else { - return false; - } - } - - public int compareTo(DoubleValue doubleVal) { - double other = doubleVal.value(); - if (value() < other) { - return -1; - } else if (value() == other) { - return 0; - } else { - return 1; - } - } - - public int hashCode() { - /* - * TO DO: Better hash code - */ - return intValue(); - } - - public Type type() { - return vm.theDoubleType(); - } - - public double value() { - return value; - } - - public boolean booleanValue() { - return(value == 0.0)?false:true; - } - - public byte byteValue() { - return(byte)value; - } - - public char charValue() { - return(char)value; - } - - public short shortValue() { - return(short)value; - } - - public int intValue() { - return(int)value; - } - - public long longValue() { - return(long)value; - } - - public float floatValue() { - return(float)value; - } - - public double doubleValue() { - return(double)value; - } - - byte checkedByteValue() throws InvalidTypeException { - if ((value > Byte.MAX_VALUE) || (value < Byte.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to byte"); - } else { - return super.checkedByteValue(); - } - } - - char checkedCharValue() throws InvalidTypeException { - if ((value > Character.MAX_VALUE) || (value < Character.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to char"); - } else { - return super.checkedCharValue(); - } - } - - short checkedShortValue() throws InvalidTypeException { - if ((value > Short.MAX_VALUE) || (value < Short.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to short"); - } else { - return super.checkedShortValue(); - } - } - - int checkedIntValue() throws InvalidTypeException { - if ((value > Integer.MAX_VALUE) || (value < Integer.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to int"); - } else { - return super.checkedIntValue(); - } - } - - long checkedLongValue() throws InvalidTypeException { - long longValue = (long)value; - if (longValue != value) { - throw new InvalidTypeException("Can't convert " + value + " to long"); - } else { - return super.checkedLongValue(); - } - } - - float checkedFloatValue() throws InvalidTypeException { - float floatValue = (float)value; - if (floatValue != value) { - throw new InvalidTypeException("Can't convert " + value + " to float"); - } else { - return super.checkedFloatValue(); - } - } - - public String toString() { - return "" + value; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FieldImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FieldImpl.java deleted file mode 100644 index 2721f6032c1..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FieldImpl.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; -import sun.jvm.hotspot.oops.Oop; -import sun.jvm.hotspot.oops.Instance; -import sun.jvm.hotspot.oops.Array; -import sun.jvm.hotspot.oops.InstanceKlass; -import sun.jvm.hotspot.oops.Symbol; -import sun.jvm.hotspot.oops.FieldIdentifier; - -import java.util.List; -import java.util.Iterator; -import java.util.ArrayList; -import java.util.Comparator; - -public class FieldImpl extends TypeComponentImpl implements Field { - private JNITypeParser signatureParser; - private sun.jvm.hotspot.oops.Field saField; - - FieldImpl( VirtualMachine vm, ReferenceTypeImpl declaringType, - sun.jvm.hotspot.oops.Field saField) { - super(vm, declaringType); - this.saField = saField; - getParser(); - } - - private void getParser() { - if (signatureParser == null) { - Symbol sig1 = saField.getSignature(); - signature = sig1.asString(); - signatureParser = new JNITypeParser(signature); - } - } - - sun.jvm.hotspot.oops.Field ref() { - return saField; - } - - // get the value of static field - ValueImpl getValue() { - return getValue(saField.getFieldHolder().getJavaMirror()); - } - - // get the value of this Field from a specific Oop - ValueImpl getValue(Oop target) { - ValueImpl valueImpl; - sun.jvm.hotspot.oops.Field saField = (sun.jvm.hotspot.oops.Field) ref(); - sun.jvm.hotspot.oops.FieldType ft = saField.getFieldType(); - if (ft.isArray()) { - sun.jvm.hotspot.oops.OopField of = (sun.jvm.hotspot.oops.OopField)saField; - valueImpl = (ArrayReferenceImpl) vm.arrayMirror((Array)of.getValue(target)); - } else if (ft.isObject()) { - sun.jvm.hotspot.oops.OopField of = (sun.jvm.hotspot.oops.OopField)saField; - valueImpl = (ObjectReferenceImpl) vm.objectMirror(of.getValue(target)); - } else if (ft.isByte()) { - sun.jvm.hotspot.oops.ByteField bf = (sun.jvm.hotspot.oops.ByteField)saField; - valueImpl = (ByteValueImpl) vm.mirrorOf(bf.getValue(target)); - } else if (ft.isChar()) { - sun.jvm.hotspot.oops.CharField cf = (sun.jvm.hotspot.oops.CharField)saField; - valueImpl = (CharValueImpl) vm.mirrorOf(cf.getValue(target)); - } else if (ft.isDouble()) { - sun.jvm.hotspot.oops.DoubleField df = (sun.jvm.hotspot.oops.DoubleField)saField; - valueImpl = (DoubleValueImpl) vm.mirrorOf(df.getValue(target)); - } else if (ft.isFloat()) { - sun.jvm.hotspot.oops.FloatField ff = (sun.jvm.hotspot.oops.FloatField)saField; - valueImpl = (FloatValueImpl) vm.mirrorOf(ff.getValue(target)); - } else if (ft.isInt()) { - sun.jvm.hotspot.oops.IntField iif = (sun.jvm.hotspot.oops.IntField)saField; - valueImpl = (IntegerValueImpl) vm.mirrorOf(iif.getValue(target)); - } else if (ft.isLong()) { - sun.jvm.hotspot.oops.LongField lf = (sun.jvm.hotspot.oops.LongField)saField; - valueImpl = (LongValueImpl) vm.mirrorOf(lf.getValue(target)); - } else if (ft.isShort()) { - sun.jvm.hotspot.oops.ShortField sf = (sun.jvm.hotspot.oops.ShortField)saField; - valueImpl = (ShortValueImpl) vm.mirrorOf(sf.getValue(target)); - } else if (ft.isBoolean()) { - sun.jvm.hotspot.oops.BooleanField bf = (sun.jvm.hotspot.oops.BooleanField)saField; - valueImpl = (BooleanValueImpl) vm.mirrorOf(bf.getValue(target)); - } else { - throw new RuntimeException("Should not reach here"); - } - return valueImpl; - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof FieldImpl)) { - FieldImpl other = (FieldImpl)obj; - return (declaringType().equals(other.declaringType())) && - (ref().equals(other.ref())) && - super.equals(obj); - } else { - return false; - } - } - - public boolean isTransient() { - return saField.isTransient(); - } - - public boolean isVolatile() { - return saField.isVolatile(); - } - - public boolean isEnumConstant() { - return saField.isEnumConstant(); - } - - public Type type() throws ClassNotLoadedException { - // So, we do it just like JDI does by searching the enclosing type. - return findType(signature()); - } - - public String typeName() { //fixme jjh: jpda version creates redundant JNITypeParsers - getParser(); - return signatureParser.typeName(); - } - - public String genericSignature() { - Symbol genSig = saField.getGenericSignature(); - return (genSig != null)? genSig.asString() : null; - } - - // From interface Comparable - public int compareTo(Field field) { - ReferenceTypeImpl declaringType = (ReferenceTypeImpl)declaringType(); - int rc = declaringType.compareTo(field.declaringType()); - if (rc == 0) { - rc = declaringType.indexOf(this) - - declaringType.indexOf(field); - } - return rc; - } - - // from interface Mirror - public String toString() { - StringBuffer buf = new StringBuffer(); - - buf.append(declaringType().name()); - buf.append('.'); - buf.append(name()); - return buf.toString(); - } - - public String name() { - FieldIdentifier myName = saField.getID(); - return myName.getName(); - } - - // From interface Accessible - public int modifiers() { - return saField.getAccessFlagsObj().getStandardFlags(); - } - - public boolean isPackagePrivate() { - return saField.isPackagePrivate(); - } - - public boolean isPrivate() { - return saField.isPrivate(); - } - - public boolean isProtected() { - return saField.isProtected(); - } - - public boolean isPublic() { - return saField.isPublic(); - } - - public boolean isStatic() { - return saField.isStatic(); - } - - public boolean isFinal() { - return saField.isFinal(); - } - - public boolean isSynthetic() { - return saField.isSynthetic(); - } - - public int hashCode() { - return saField.hashCode(); - } - - - private Type findType(String signature) throws ClassNotLoadedException { - ReferenceTypeImpl enclosing = (ReferenceTypeImpl)declaringType(); - return enclosing.findType(signature); - } - -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FloatTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FloatTypeImpl.java deleted file mode 100644 index bf1b33e9ba9..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FloatTypeImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class FloatTypeImpl extends PrimitiveTypeImpl implements FloatType { - FloatTypeImpl(VirtualMachine vm) { - super(vm); - } - - - public String signature() { - return "F"; - } - - PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException { - return vm.mirrorOf(((PrimitiveValueImpl)value).checkedFloatValue()); - } - -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FloatValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FloatValueImpl.java deleted file mode 100644 index e7bec5be546..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/FloatValueImpl.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class FloatValueImpl extends PrimitiveValueImpl - implements FloatValue { - private float value; - - FloatValueImpl(VirtualMachine aVm,float aValue) { - super(aVm); - - value = aValue; - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof FloatValue)) { - return (value == ((FloatValue)obj).value()) && - super.equals(obj); - } else { - return false; - } - } - - public int hashCode() { - /* - * TO DO: Better hash code - */ - return intValue(); - } - - public int compareTo(FloatValue floatVal) { - float other = floatVal.value(); - if (value() < other) { - return -1; - } else if (value() == other) { - return 0; - } else { - return 1; - } - } - - public Type type() { - return vm.theFloatType(); - } - - public float value() { - return value; - } - - public boolean booleanValue() { - return(value == 0.0)?false:true; - } - - public byte byteValue() { - return(byte)value; - } - - public char charValue() { - return(char)value; - } - - public short shortValue() { - return(short)value; - } - - public int intValue() { - return(int)value; - } - - public long longValue() { - return(long)value; - } - - public float floatValue() { - return(float)value; - } - - public double doubleValue() { - return(double)value; - } - - byte checkedByteValue() throws InvalidTypeException { - if ((value > Byte.MAX_VALUE) || (value < Byte.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to byte"); - } else { - return super.checkedByteValue(); - } - } - - char checkedCharValue() throws InvalidTypeException { - if ((value > Character.MAX_VALUE) || (value < Character.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to char"); - } else { - return super.checkedCharValue(); - } - } - - short checkedShortValue() throws InvalidTypeException { - if ((value > Short.MAX_VALUE) || (value < Short.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to short"); - } else { - return super.checkedShortValue(); - } - } - - int checkedIntValue() throws InvalidTypeException { - int intValue = (int)value; - if (intValue != value) { - throw new InvalidTypeException("Can't convert " + value + " to int"); - } else { - return super.checkedIntValue(); - } - } - - long checkedLongValue() throws InvalidTypeException { - long longValue = (long)value; - if (longValue != value) { - throw new InvalidTypeException("Can't convert " + value + " to long"); - } else { - return super.checkedLongValue(); - } - } - - public String toString() { - return "" + value; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/IntegerTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/IntegerTypeImpl.java deleted file mode 100644 index 60344b7be72..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/IntegerTypeImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class IntegerTypeImpl extends PrimitiveTypeImpl implements IntegerType { - IntegerTypeImpl(VirtualMachine vm) { - super(vm); - } - - public String signature() { - return "I"; - } - - PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException { - return vm.mirrorOf(((PrimitiveValueImpl)value).checkedIntValue()); - } - -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/IntegerValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/IntegerValueImpl.java deleted file mode 100644 index 461686e6cb5..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/IntegerValueImpl.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class IntegerValueImpl extends PrimitiveValueImpl - implements IntegerValue { - private int value; - - IntegerValueImpl(VirtualMachine aVm,int aValue) { - super(aVm); - - value = aValue; - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof IntegerValue)) { - return (value == ((IntegerValue)obj).value()) && - super.equals(obj); - } else { - return false; - } - } - - public int hashCode() { - /* - * TO DO: Better hash code - */ - return intValue(); - } - - public int compareTo(IntegerValue integerVal) { - return value() - integerVal.value(); - } - - public Type type() { - return vm.theIntegerType(); - } - - public int value() { - return value; - } - - public boolean booleanValue() { - return(value == 0)?false:true; - } - - public byte byteValue() { - return(byte)value; - } - - public char charValue() { - return(char)value; - } - - public short shortValue() { - return(short)value; - } - - public int intValue() { - return(int)value; - } - - public long longValue() { - return(long)value; - } - - public float floatValue() { - return(float)value; - } - - public double doubleValue() { - return(double)value; - } - - byte checkedByteValue() throws InvalidTypeException { - if ((value > Byte.MAX_VALUE) || (value < Byte.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to byte"); - } else { - return super.checkedByteValue(); - } - } - - char checkedCharValue() throws InvalidTypeException { - if ((value > Character.MAX_VALUE) || (value < Character.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to char"); - } else { - return super.checkedCharValue(); - } - } - - short checkedShortValue() throws InvalidTypeException { - if ((value > Short.MAX_VALUE) || (value < Short.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to short"); - } else { - return super.checkedShortValue(); - } - } - - public String toString() { - return "" + value; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java deleted file mode 100644 index 4bc4201ef8a..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import java.lang.ref.SoftReference; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import sun.jvm.hotspot.oops.InstanceKlass; - -import com.sun.jdi.ClassNotPreparedException; -import com.sun.jdi.ClassType; -import com.sun.jdi.InterfaceType; -import com.sun.jdi.Method; -import com.sun.jdi.ReferenceType; -import com.sun.jdi.VirtualMachine; - -public class InterfaceTypeImpl extends ReferenceTypeImpl - implements InterfaceType { - private SoftReference superInterfacesCache = null; - private SoftReference subInterfacesCache = null; - private SoftReference implementorsCache = null; - - protected InterfaceTypeImpl(VirtualMachine aVm, InstanceKlass aRef) { - super(aVm, aRef); - } - - public List superinterfaces() throws ClassNotPreparedException { - List superinterfaces = (superInterfacesCache != null)? (List) superInterfacesCache.get() : null; - if (superinterfaces == null) { - checkPrepared(); - superinterfaces = Collections.unmodifiableList(getInterfaces()); - superInterfacesCache = new SoftReference(superinterfaces); - } - return superinterfaces; - } - - public List subinterfaces() { - List subinterfaces = (subInterfacesCache != null)? (List) subInterfacesCache.get() : null; - if (subinterfaces == null) { - List all = vm.allClasses(); - subinterfaces = new ArrayList(); - Iterator iter = all.iterator(); - while (iter.hasNext()) { - ReferenceType refType = (ReferenceType)iter.next(); - if (refType instanceof InterfaceType) { - InterfaceType interfaze = (InterfaceType)refType; - if (interfaze.isPrepared() && interfaze.superinterfaces().contains(this)) { - subinterfaces.add(interfaze); - } - } - } - subinterfaces = Collections.unmodifiableList(subinterfaces); - subInterfacesCache = new SoftReference(subinterfaces); - } - return subinterfaces; - } - - public List implementors() { - List implementors = (implementorsCache != null)? (List) implementorsCache.get() : null; - if (implementors == null) { - List all = vm.allClasses(); - implementors = new ArrayList(); - Iterator iter = all.iterator(); - while (iter.hasNext()) { - ReferenceType refType = (ReferenceType)iter.next(); - if (refType instanceof ClassType) { - ClassType clazz = (ClassType)refType; - if (clazz.isPrepared() && clazz.interfaces().contains(this)) { - implementors.add(clazz); - } - } - } - implementors = Collections.unmodifiableList(implementors); - implementorsCache = new SoftReference(implementors); - } - return implementors; - } - - @Override - void addVisibleMethods(Map methodMap, Set seenInterfaces) { - /* - * Add methods from - * parent types first, so that the methods in this class will - * overwrite them in the hash table - */ - Iterator iter = superinterfaces().iterator(); - while (iter.hasNext()) { - InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); - if (!seenInterfaces.contains(interfaze)) { - interfaze.addVisibleMethods(methodMap, seenInterfaces); - seenInterfaces.add(interfaze); - } - } - - addToMethodMap(methodMap, methods()); - } - - List getAllMethods() { - ArrayList list = new ArrayList(methods()); - /* - * It's more efficient if don't do this - * recursively. - */ - List interfaces = allSuperinterfaces(); - Iterator iter = interfaces.iterator(); - while (iter.hasNext()) { - InterfaceType interfaze = (InterfaceType)iter.next(); - list.addAll(interfaze.methods()); - } - - return list; - } - - List allSuperinterfaces() { - ArrayList list = new ArrayList(); - addSuperinterfaces(list); - return list; - } - - void addSuperinterfaces(List list) { - /* - * This code is a little strange because it - * builds the list with a more suitable order than the - * depth-first approach a normal recursive solution would - * take. Instead, all direct superinterfaces precede all - * indirect ones. - */ - - /* - * Get a list of direct superinterfaces that's not already in the - * list being built. - */ - List immediate = new ArrayList(superinterfaces()); - Iterator iter = immediate.iterator(); - while (iter.hasNext()) { - InterfaceType interfaze = (InterfaceType)iter.next(); - if (list.contains(interfaze)) { - iter.remove(); - } - } - - /* - * Add all new direct superinterfaces - */ - list.addAll(immediate); - - /* - * Recurse for all new direct superinterfaces. - */ - iter = immediate.iterator(); - while (iter.hasNext()) { - InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); - interfaze.addSuperinterfaces(list); - } - } - - boolean isAssignableTo(ReferenceType type) { - - // Exact match? - if (this.equals(type)) { - return true; - } else { - // Try superinterfaces. - List supers = superinterfaces(); - Iterator iter = supers.iterator(); - while (iter.hasNext()) { - InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); - if (interfaze.isAssignableTo(type)) { - return true; - } - } - - return false; - } - } - - List inheritedTypes() { - return superinterfaces(); - } - - public boolean isInitialized() { - return isPrepared(); - } - - public String toString() { - return "interface " + name() + " (" + loaderString() + ")"; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/JNITypeParser.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/JNITypeParser.java deleted file mode 100644 index 031734ce74c..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/JNITypeParser.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import java.util.List; -import java.util.ArrayList; - -public class JNITypeParser { - - static final char SIGNATURE_ENDCLASS = ';'; - static final char SIGNATURE_FUNC = '('; - static final char SIGNATURE_ENDFUNC = ')'; - - private String signature; - private List typeNameList; - private List signatureList; - private int currentIndex; - - JNITypeParser(String signature) { - this.signature = signature; - } - - static String typeNameToSignature(String signature) { - StringBuffer buffer = new StringBuffer(); - int firstIndex = signature.indexOf('['); - int index = firstIndex; - while (index != -1) { - buffer.append('['); - index = signature.indexOf('[', index + 1); - } - - if (firstIndex != -1) { - signature = signature.substring(0, firstIndex); - } - - if (signature.equals("boolean")) { - buffer.append('Z'); - } else if (signature.equals("byte")) { - buffer.append('B'); - } else if (signature.equals("char")) { - buffer.append('C'); - } else if (signature.equals("short")) { - buffer.append('S'); - } else if (signature.equals("int")) { - buffer.append('I'); - } else if (signature.equals("long")) { - buffer.append('J'); - } else if (signature.equals("float")) { - buffer.append('F'); - } else if (signature.equals("double")) { - buffer.append('D'); - } else { - buffer.append('L'); - buffer.append(signature.replace('.', '/')); - buffer.append(';'); - } - - return buffer.toString(); - } - - String typeName() { - return (String)typeNameList().get(typeNameList().size()-1); - } - - List argumentTypeNames() { - return typeNameList().subList(0, typeNameList().size() - 1); - } - - String signature() { - return (String)signatureList().get(signatureList().size()-1); - } - - List argumentSignatures() { - return signatureList().subList(0, signatureList().size() - 1); - } - - int dimensionCount() { - int count = 0; - String signature = signature(); - while (signature.charAt(count) == '[') { - count++; - } - return count; - } - - String componentSignature(int level) { - return signature().substring(level); - } - - private synchronized List signatureList() { - if (signatureList == null) { - signatureList = new ArrayList(10); - String elem; - - currentIndex = 0; - - while(currentIndex < signature.length()) { - elem = nextSignature(); - signatureList.add(elem); - } - if (signatureList.size() == 0) { - throw new IllegalArgumentException("Invalid JNI signature '" + - signature + "'"); - } - } - return signatureList; - } - - private synchronized List typeNameList() { - if (typeNameList == null) { - typeNameList = new ArrayList(10); - String elem; - - currentIndex = 0; - - while(currentIndex < signature.length()) { - elem = nextTypeName(); - typeNameList.add(elem); - } - if (typeNameList.size() == 0) { - throw new IllegalArgumentException("Invalid JNI signature '" + - signature + "'"); - } - } - return typeNameList; - } - - private String nextSignature() { - char key = signature.charAt(currentIndex++); - - switch(key) { - case '[': - return key + nextSignature(); - - case 'L': - int endClass = signature.indexOf(SIGNATURE_ENDCLASS, - currentIndex); - String retVal = signature.substring(currentIndex - 1, - endClass + 1); - currentIndex = endClass + 1; - return retVal; - - case 'V': - case 'Z': - case 'B': - case 'C': - case 'S': - case 'I': - case 'J': - case 'F': - case 'D': - return String.valueOf(key); - - case SIGNATURE_FUNC: - case SIGNATURE_ENDFUNC: - return nextSignature(); - - default: - throw new IllegalArgumentException( - "Invalid JNI signature character '" + key + "'"); - - } - } - - private String nextTypeName() { - char key = signature.charAt(currentIndex++); - - switch(key) { - case '[': - return nextTypeName() + "[]"; - - case 'B': - return "byte"; - - case 'C': - return "char"; - - case 'L': - int endClass = signature.indexOf(SIGNATURE_ENDCLASS, - currentIndex); - String retVal = signature.substring(currentIndex, - endClass); - retVal = retVal.replace('/','.'); - currentIndex = endClass + 1; - return retVal; - - case 'F': - return "float"; - - case 'D': - return "double"; - - case 'I': - return "int"; - - case 'J': - return "long"; - - case 'S': - return "short"; - - case 'V': - return "void"; - - case 'Z': - return "boolean"; - - case SIGNATURE_ENDFUNC: - case SIGNATURE_FUNC: - return nextTypeName(); - - default: - throw new IllegalArgumentException( - "Invalid JNI signature character '" + key + "'"); - - } - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java deleted file mode 100644 index 0dcb772f913..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2004, 2013, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -// from JVMTI specification - refer to jvmti.xml -public interface JVMTIThreadState { - public static final int JVMTI_THREAD_STATE_ALIVE = 0x0001; - public static final int JVMTI_THREAD_STATE_TERMINATED = 0x0002; - public static final int JVMTI_THREAD_STATE_RUNNABLE = 0x0004; - public static final int JVMTI_THREAD_STATE_WAITING = 0x0080; - public static final int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010; - public static final int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020; - public static final int JVMTI_THREAD_STATE_SLEEPING = 0x0040; - public static final int JVMTI_THREAD_STATE_IN_OBJECT_WAIT = 0x0100; - public static final int JVMTI_THREAD_STATE_PARKED = 0x0200; - public static final int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400; - public static final int JVMTI_THREAD_STATE_SUSPENDED = 0x100000; - public static final int JVMTI_THREAD_STATE_INTERRUPTED = 0x200000; - public static final int JVMTI_THREAD_STATE_IN_NATIVE = 0x400000; -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LineInfo.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LineInfo.java deleted file mode 100644 index 840c07757f6..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LineInfo.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -interface LineInfo { - - String liStratum(); - - int liLineNumber(); - - String liSourceName() throws AbsentInformationException; - - String liSourcePath() throws AbsentInformationException; -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LocalVariableImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LocalVariableImpl.java deleted file mode 100644 index da3ed8c4f0e..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LocalVariableImpl.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -package sun.jvm.hotspot.jdi; -import com.sun.jdi.*; - -public class LocalVariableImpl extends MirrorImpl - implements LocalVariable, ValueContainer -{ - private final Method method; - private final int slot; - private final Location scopeStart; - private final Location scopeEnd; - private final String name; - private final String signature; - private final String genericSignature; - - LocalVariableImpl(VirtualMachine vm, Method method, - int slot, Location scopeStart, Location scopeEnd, - String name, String signature, String genericSignature) { - super(vm); - this.method = method; - this.slot = slot; - this.scopeStart = scopeStart; - this.scopeEnd = scopeEnd; - this.name = name; - this.signature = signature; - this.genericSignature = genericSignature; - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof LocalVariableImpl)) { - LocalVariableImpl other = (LocalVariableImpl)obj; - return (method.equals(other.method) && - slot() == other.slot() && - super.equals(obj)); - } else { - return false; - } - } - - public int hashCode() { - /* - * TO DO: Better hash code - */ - return (int)method.hashCode() + slot(); - } - - public int compareTo(LocalVariable localVar) { - LocalVariableImpl other = (LocalVariableImpl) localVar; - int rc = method.compareTo(other.method); - if (rc == 0) { - rc = slot() - other.slot(); - } - return rc; - } - - public String name() { - return name; - } - - /** - * @return a text representation of the declared type - * of this variable. - */ - public String typeName() { - JNITypeParser parser = new JNITypeParser(signature); - return parser.typeName(); - } - - public Type type() throws ClassNotLoadedException { - return findType(signature()); - } - - public Type findType(String signature) throws ClassNotLoadedException { - ReferenceTypeImpl enclosing = (ReferenceTypeImpl)method.declaringType(); - return enclosing.findType(signature); - } - - public String signature() { - return signature; - } - - public String genericSignature() { - return genericSignature; - } - - public boolean isVisible(StackFrame frame) { - //validateMirror(frame); - Method frameMethod = frame.location().method(); - - if (!frameMethod.equals(method)) { - throw new IllegalArgumentException( - "frame method different than variable's method"); - } - - // this is here to cover the possibility that we will - // allow LocalVariables for native methods. If we do - // so we will have to re-examinine this. - if (frameMethod.isNative()) { - return false; - } - - return ((scopeStart.compareTo(frame.location()) <= 0) - && (scopeEnd.compareTo(frame.location()) >= 0)); - } - - public boolean isArgument() { - try { - MethodImpl method = (MethodImpl)scopeStart.method(); - return (slot < method.argSlotCount()); - } catch (AbsentInformationException e) { - // If this variable object exists, there shouldn't be absent info - throw (InternalException) new InternalException().initCause(e); - } - } - - int slot() { - return slot; - } - - /* - * Compilers/VMs can have byte code ranges for variables of the - * same names that overlap. This is because the byte code ranges - * aren't necessarily scopes; they may have more to do with the - * lifetime of the variable's slot, depending on implementation. - * - * This method determines whether this variable hides an - * identically named variable; ie, their byte code ranges overlap - * this one starts after the given one. If it returns true this - * variable should be preferred when looking for a single variable - * with its name when both variables are visible. - */ - boolean hides(LocalVariable other) { - LocalVariableImpl otherImpl = (LocalVariableImpl)other; - if (!method.equals(otherImpl.method) || - !name.equals(otherImpl.name)) { - return false; - } else { - return (scopeStart.compareTo(otherImpl.scopeStart) > 0); - } - } - - public String toString() { - return name() + " in " + method.toString() + - "@" + scopeStart.toString(); - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LocationImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LocationImpl.java deleted file mode 100644 index ab686ace53c..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LocationImpl.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -import java.util.*; - -public class LocationImpl extends MirrorImpl implements Location { - private final ReferenceTypeImpl declaringType; - private Method method; - private sun.jvm.hotspot.oops.Method methodRef; - private long codeIndex; - private LineInfo baseLineInfo = null; - private LineInfo otherLineInfo = null; - - LocationImpl(VirtualMachine vm, - Method method, long codeIndex) { - super(vm); - - this.method = method; - this.codeIndex = method.isNative()? -1 : codeIndex; - this.declaringType = (ReferenceTypeImpl)method.declaringType(); - } - - /* - * This constructor allows lazy creation of the method mirror. This - * can be a performance savings if the method mirror does not yet - * exist. - */ - LocationImpl(VirtualMachine vm, ReferenceType declaringType, - sun.jvm.hotspot.oops.Method methodRef, long codeIndex) { - super(vm); - - this.method = null; - this.codeIndex = codeIndex; - this.declaringType = (ReferenceTypeImpl)declaringType; - this.methodRef = methodRef; - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof Location)) { - Location other = (Location)obj; - return (method().equals(other.method())) && - (codeIndex() == other.codeIndex()) && - super.equals(obj); - } else { - return false; - } - } - - public int hashCode() { - /* - * TO DO: better hash code? - */ - return method().hashCode() + (int)codeIndex(); - } - - public int compareTo(Location other) { - int rc = method().compareTo(other.method()); - if (rc == 0) { - long diff = codeIndex() - other.codeIndex(); - if (diff < 0) - return -1; - else if (diff > 0) - return 1; - else - return 0; - } - return rc; - } - - public ReferenceType declaringType() { - return declaringType; - } - - public Method method() { - if (method == null) { - method = declaringType.getMethodMirror(methodRef); - if (method.isNative()) { - codeIndex = -1; - } - } - return method; - } - - public long codeIndex() { - method(); // be sure information is up-to-date - return codeIndex; - } - - LineInfo getBaseLineInfo(SDE.Stratum stratum) { - LineInfo lineInfo; - - /* check if there is cached info to use */ - if (baseLineInfo != null) { - return baseLineInfo; - } - - /* compute the line info */ - MethodImpl methodImpl = (MethodImpl)method(); - lineInfo = methodImpl.codeIndexToLineInfo(stratum, - codeIndex()); - - /* cache it */ - addBaseLineInfo(lineInfo); - - return lineInfo; - } - - LineInfo getLineInfo(SDE.Stratum stratum) { - LineInfo lineInfo; - - /* base stratum is done slighly differently */ - if (stratum.isJava()) { - return getBaseLineInfo(stratum); - } - - /* check if there is cached info to use */ - lineInfo = otherLineInfo; // copy because of concurrency - if (lineInfo != null && - stratum.id().equals(lineInfo.liStratum())) { - return lineInfo; - } - int baseLineNumber = lineNumber(SDE.BASE_STRATUM_NAME); - SDE.LineStratum lineStratum = - stratum.lineStratum(declaringType, baseLineNumber); - - if (lineStratum != null && lineStratum.lineNumber() != -1) { - lineInfo = new StratumLineInfo(stratum.id(), - lineStratum.lineNumber(), - lineStratum.sourceName(), - lineStratum.sourcePath()); - } else { - /* find best match */ - MethodImpl methodImpl = (MethodImpl)method(); - lineInfo = methodImpl.codeIndexToLineInfo(stratum, - codeIndex()); - } - - /* cache it */ - addStratumLineInfo(lineInfo); - - return lineInfo; - } - - void addStratumLineInfo(LineInfo lineInfo) { - otherLineInfo = lineInfo; - } - - void addBaseLineInfo(LineInfo lineInfo) { - baseLineInfo = lineInfo; - } - - public String sourceName() throws AbsentInformationException { - return sourceName(vm.getDefaultStratum()); - } - - public String sourceName(String stratumID) - throws AbsentInformationException { - return sourceName(declaringType.stratum(stratumID)); - } - - String sourceName(SDE.Stratum stratum) - throws AbsentInformationException { - return getLineInfo(stratum).liSourceName(); - } - - public String sourcePath() throws AbsentInformationException { - return sourcePath(vm.getDefaultStratum()); - } - - public String sourcePath(String stratumID) - throws AbsentInformationException { - return sourcePath(declaringType.stratum(stratumID)); - } - - String sourcePath(SDE.Stratum stratum) - throws AbsentInformationException { - return getLineInfo(stratum).liSourcePath(); - } - - public int lineNumber() { - return lineNumber(vm.getDefaultStratum()); - } - - public int lineNumber(String stratumID) { - return lineNumber(declaringType.stratum(stratumID)); - } - - int lineNumber(SDE.Stratum stratum) { - return getLineInfo(stratum).liLineNumber(); - } - - public String toString() { - if (lineNumber() == -1) { - return method().toString() + "+" + codeIndex(); - } else { - return declaringType().name() + ":" + lineNumber(); - } - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LongTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LongTypeImpl.java deleted file mode 100644 index e941cd668b6..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LongTypeImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class LongTypeImpl extends PrimitiveTypeImpl implements LongType { - LongTypeImpl(VirtualMachine vm) { - super(vm); - } - - - public String signature() { - return "J"; - } - - PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException { - return vm.mirrorOf(((PrimitiveValueImpl)value).checkedLongValue()); - } - -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LongValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LongValueImpl.java deleted file mode 100644 index da418441c23..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/LongValueImpl.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class LongValueImpl extends PrimitiveValueImpl - implements LongValue { - private long value; - - LongValueImpl(VirtualMachine aVm,long aValue) { - super(aVm); - - value = aValue; - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof LongValue)) { - return (value == ((LongValue)obj).value()) && - super.equals(obj); - } else { - return false; - } - } - - public int hashCode() { - /* - * TO DO: Better hash code - */ - return intValue(); - } - - public int compareTo(LongValue longVal) { - long other = longVal.value(); - if (value() < other) { - return -1; - } else if (value() == other) { - return 0; - } else { - return 1; - } - } - - public Type type() { - return vm.theLongType(); - } - - public long value() { - return value; - } - - public boolean booleanValue() { - return(value == 0)?false:true; - } - - public byte byteValue() { - return(byte)value; - } - - public char charValue() { - return(char)value; - } - - public short shortValue() { - return(short)value; - } - - public int intValue() { - return(int)value; - } - - public long longValue() { - return(long)value; - } - - public float floatValue() { - return(float)value; - } - - public double doubleValue() { - return(double)value; - } - - byte checkedByteValue() throws InvalidTypeException { - if ((value > Byte.MAX_VALUE) || (value < Byte.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to byte"); - } else { - return super.checkedByteValue(); - } - } - - char checkedCharValue() throws InvalidTypeException { - if ((value > Character.MAX_VALUE) || (value < Character.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to char"); - } else { - return super.checkedCharValue(); - } - } - - short checkedShortValue() throws InvalidTypeException { - if ((value > Short.MAX_VALUE) || (value < Short.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to short"); - } else { - return super.checkedShortValue(); - } - } - - int checkedIntValue() throws InvalidTypeException { - if ((value > Integer.MAX_VALUE) || (value < Integer.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to int"); - } else { - return super.checkedIntValue(); - } - } - - public String toString() { - return "" + value; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MethodImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MethodImpl.java deleted file mode 100644 index 5853a91bd58..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MethodImpl.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; -import sun.jvm.hotspot.oops.Symbol; -import sun.jvm.hotspot.oops.LocalVariableTableElement; -import java.util.List; -import java.util.Iterator; -import java.util.ArrayList; -import java.util.Comparator; -import java.lang.ref.SoftReference; -import java.util.Collections; - -public abstract class MethodImpl extends TypeComponentImpl implements Method { - private JNITypeParser signatureParser; - protected sun.jvm.hotspot.oops.Method saMethod; - - abstract int argSlotCount() throws AbsentInformationException; - abstract List allLineLocations(SDE.Stratum stratum, - String sourceName) - throws AbsentInformationException; - abstract List locationsOfLine(SDE.Stratum stratum, - String sourceName, - int lineNumber) - throws AbsentInformationException; - - static MethodImpl createMethodImpl(VirtualMachine vm, ReferenceTypeImpl declaringType, - sun.jvm.hotspot.oops.Method saMethod) { - // Someday might have to add concrete and non-concrete subclasses. - if (saMethod.isNative() || saMethod.isAbstract()) { - return new NonConcreteMethodImpl(vm, declaringType, saMethod); - } else { - return new ConcreteMethodImpl(vm, declaringType, saMethod); - } - } - - MethodImpl(VirtualMachine vm, ReferenceTypeImpl declaringType, - sun.jvm.hotspot.oops.Method saMethod ) { - super(vm, declaringType); - this.saMethod = saMethod; - getParser(); - } - - private JNITypeParser getParser() { - if (signatureParser == null) { - Symbol sig1 = saMethod.getSignature(); - signature = sig1.asString(); - signatureParser = new JNITypeParser(signature); - } - return signatureParser; - } - - // Object ref() { - sun.jvm.hotspot.oops.Method ref() { - return saMethod; - } - - public String genericSignature() { - Symbol genSig = saMethod.getGenericSignature(); - return (genSig != null)? genSig.asString() : null; - } - - public String returnTypeName() { - return getParser().typeName(); - } - - public Type returnType() throws ClassNotLoadedException { - return findType(getParser().signature()); - } - - private Type findType(String signature) throws ClassNotLoadedException { - ReferenceTypeImpl enclosing = (ReferenceTypeImpl)declaringType(); - return enclosing.findType(signature); - } - - public List argumentTypeNames() { - return getParser().argumentTypeNames(); - } - - List argumentSignatures() { - return getParser().argumentSignatures(); - } - - Type argumentType(int index) throws ClassNotLoadedException { - ReferenceTypeImpl enclosing = (ReferenceTypeImpl)declaringType(); - String signature = (String)argumentSignatures().get(index); - return enclosing.findType(signature); - } - - public List argumentTypes() throws ClassNotLoadedException { - int size = argumentSignatures().size(); - ArrayList types = new ArrayList(size); - for (int i = 0; i < size; i++) { - Type type = argumentType(i); - types.add(type); - } - return types; - } - - public boolean isAbstract() { - return saMethod.isAbstract(); - } - - public boolean isBridge() { - return saMethod.isBridge(); - } - - public boolean isSynchronized() { - return saMethod.isSynchronized(); - } - - public boolean isNative() { - return saMethod.isNative(); - } - - public boolean isVarArgs() { - return saMethod.isVarArgs(); - } - - public boolean isConstructor() { - return saMethod.isConstructor(); - } - - public boolean isStaticInitializer() { - return saMethod.isStaticInitializer(); - } - - public boolean isObsolete() { - return saMethod.isObsolete(); - } - - public final List allLineLocations() - throws AbsentInformationException { - return allLineLocations(vm.getDefaultStratum(), null); - } - - public List allLineLocations(String stratumID, - String sourceName) - throws AbsentInformationException { - return allLineLocations(declaringType.stratum(stratumID), - sourceName); - } - - public final List locationsOfLine(int lineNumber) - throws AbsentInformationException { - return locationsOfLine(vm.getDefaultStratum(), - null, lineNumber); - } - - public List locationsOfLine(String stratumID, - String sourceName, - int lineNumber) - throws AbsentInformationException { - return locationsOfLine(declaringType.stratum(stratumID), - sourceName, lineNumber); - } - - LineInfo codeIndexToLineInfo(SDE.Stratum stratum, - long codeIndex) { - if (stratum.isJava()) { - return new BaseLineInfo(-1, declaringType); - } else { - return new StratumLineInfo(stratum.id(), -1, - null, null); - } - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof MethodImpl)) { - MethodImpl other = (MethodImpl)obj; - return (declaringType().equals(other.declaringType())) && - (ref().equals(other.ref())) && - super.equals(obj); - } else { - return false; - } - } - - // From interface Comparable - public int compareTo(Method method) { - ReferenceTypeImpl declaringType = (ReferenceTypeImpl)declaringType(); - int rc = declaringType.compareTo(method.declaringType()); - if (rc == 0) { - rc = declaringType.indexOf(this) - - declaringType.indexOf(method); - } - return rc; - } - - // from interface Mirror - public String toString() { - StringBuffer sb = new StringBuffer(); - sb.append(declaringType().name()); - sb.append("."); - sb.append(name()); - sb.append("("); - boolean first = true; - for (Iterator it = argumentTypeNames().iterator(); it.hasNext();) { - if (!first) { - sb.append(", "); - } - sb.append((String)it.next()); - first = false; - } - sb.append(")"); - return sb.toString(); - } - - public String name() { - Symbol myName = saMethod.getName(); - return myName.asString(); - } - - public int modifiers() { - return saMethod.getAccessFlagsObj().getStandardFlags(); - } - - public boolean isPackagePrivate() { - return saMethod.isPackagePrivate(); - } - - public boolean isPrivate() { - return saMethod.isPrivate(); - } - - public boolean isProtected() { - return saMethod.isProtected(); - } - - public boolean isPublic() { - return saMethod.isPublic(); - } - - public boolean isStatic() { - return saMethod.isStatic(); - } - - public boolean isSynthetic() { - return saMethod.isSynthetic(); - } - - public boolean isFinal() { - return saMethod.isFinal(); - } - - public int hashCode() { - return saMethod.hashCode(); - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MirrorImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MirrorImpl.java deleted file mode 100644 index cf61c1f17d2..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MirrorImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -abstract class MirrorImpl extends Object implements Mirror { - protected VirtualMachineImpl vm; - - MirrorImpl(VirtualMachine aVm) { - super(); - - // Yes, its a bit of a hack. But by doing it this - // way, this is the only place we have to change - // typing to substitute a new impl. - vm = (VirtualMachineImpl)aVm; - } - - public VirtualMachine virtualMachine() { - return vm; - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof Mirror)) { - Mirror other = (Mirror)obj; - return vm.equals(other.virtualMachine()); - } else { - return false; - } - } - - public int hashCode() { - return vm.hashCode(); - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MonitorInfoImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MonitorInfoImpl.java deleted file mode 100644 index 3df6ef538ae..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/MonitorInfoImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -// FIXME: This class should implement com.sun.jdi.MonitorInfo. -// So fix this when hotspot is started to build with -// jdk1.6. -public class MonitorInfoImpl extends MirrorImpl { - - /* Once false, monitorInfo should not be used. - * access synchronized on (vm.state()) - */ - private boolean isValid = true; - - ObjectReference monitor; - ThreadReference thread; - int stack_depth; - - MonitorInfoImpl(VirtualMachine vm, ObjectReference mon, - ThreadReference thread, int dpth) { - super(vm); - this.monitor = mon; - this.thread = thread; - this.stack_depth = dpth; - } - - private void validateMonitorInfo() { - if (!isValid) { - throw new InvalidStackFrameException("Thread has been resumed"); - } - } - - public ObjectReference monitor() { - validateMonitorInfo(); - return monitor; - } - - public int stackDepth() { - validateMonitorInfo(); - return stack_depth; - } - - public ThreadReference thread() { - validateMonitorInfo(); - return thread; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/NonConcreteMethodImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/NonConcreteMethodImpl.java deleted file mode 100644 index 45c4ba29e61..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/NonConcreteMethodImpl.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -import java.util.List; -import java.util.Map; -import java.util.Iterator; -import java.util.ListIterator; -import java.util.HashMap; -import java.util.ArrayList; -import java.util.Collections; - -/** - * Represents non-concrete (that is, native or abstract) methods. - * Private to MethodImpl. - */ -public class NonConcreteMethodImpl extends MethodImpl { - - private Location location = null; - - NonConcreteMethodImpl(VirtualMachine vm, - ReferenceTypeImpl declaringType, - sun.jvm.hotspot.oops.Method saMethod) { - super(vm, declaringType, saMethod); - } - - public Location location() { - if (isAbstract()) { - return null; - } - if (location == null) { - location = new LocationImpl(vm, this, -1); - } - return location; - } - - public List allLineLocations(String stratumID, - String sourceName) { - return new ArrayList(0); - } - - public List allLineLocations(SDE.Stratum stratum, - String sourceName) { - return new ArrayList(0); - } - - public List locationsOfLine(String stratumID, - String sourceName, - int lineNumber) { - return new ArrayList(0); - } - - public List locationsOfLine(SDE.Stratum stratum, - String sourceName, - int lineNumber) { - return new ArrayList(0); - } - - public Location locationOfCodeIndex(long codeIndex) { - return null; - } - - LineInfo codeIndexToLineInfo(SDE.Stratum stratum, - long codeIndex) { - - if (stratum.isJava()) { - return new BaseLineInfo(-1, declaringType); - } else { - return new StratumLineInfo(stratum.id(), -1, - null, null); - } - } - - public List variables() throws AbsentInformationException { - throw new AbsentInformationException(); - } - - public List variablesByName(String name) throws AbsentInformationException { - throw new AbsentInformationException(); - } - - public List arguments() throws AbsentInformationException { - throw new AbsentInformationException(); - } - - public byte[] bytecodes() { - return new byte[0]; - } - - int argSlotCount() throws AbsentInformationException { - throw new InternalException("should not get here"); - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ObjectReferenceImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ObjectReferenceImpl.java deleted file mode 100644 index c2b13f16363..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ObjectReferenceImpl.java +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Copyright (c) 2002, 2009, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import java.io.*; -import com.sun.jdi.*; - -import sun.jvm.hotspot.debugger.Address; -import sun.jvm.hotspot.debugger.OopHandle; -import sun.jvm.hotspot.oops.Oop; -import sun.jvm.hotspot.oops.Mark; -import sun.jvm.hotspot.oops.Instance; -import sun.jvm.hotspot.oops.Array; -import sun.jvm.hotspot.oops.OopUtilities; -import sun.jvm.hotspot.oops.Klass; -import sun.jvm.hotspot.oops.DefaultHeapVisitor; -import sun.jvm.hotspot.runtime.JavaThread; -import sun.jvm.hotspot.runtime.JavaVFrame; -import sun.jvm.hotspot.runtime.MonitorInfo; -import sun.jvm.hotspot.runtime.ObjectMonitor; -import sun.jvm.hotspot.runtime.Threads; -import sun.jvm.hotspot.utilities.Assert; - -import java.util.*; - -public class ObjectReferenceImpl extends ValueImpl implements ObjectReference { - private Oop saObject; - private long myID; - private boolean monitorInfoCached = false; - private ThreadReferenceImpl owningThread = null; - private List waitingThreads = null; // List - private int entryCount = 0; - - private static long nextID = 0L; - private static synchronized long nextID() { - return nextID++; - } - - ObjectReferenceImpl(VirtualMachine aVm, sun.jvm.hotspot.oops.Oop oRef) { - super(aVm); - saObject = oRef; - myID = nextID(); - } - - protected Oop ref() { - return saObject; - } - - public Type type() { - return referenceType(); - } - - public ReferenceType referenceType() { - Klass myKlass = ref().getKlass(); - return vm.referenceType(myKlass); - } - - public Value getValue(Field sig) { - List list = new ArrayList(1); - list.add(sig); - Map map = getValues(list); - return(Value)map.get(sig); - } - - public Map getValues(List theFields) { - //validateMirrors(theFields); - - List staticFields = new ArrayList(0); - int size = theFields.size(); - List instanceFields = new ArrayList(size); - - for (int i=0; i 0) { - map = referenceType().getValues(staticFields); - } else { - map = new HashMap(size); - } - - // Then get instance field(s) - size = instanceFields.size(); - for (int ii=0; ii 0 && refCount >= max) { - return true; - } - } catch (RuntimeException x) { - // Ignore RuntimeException thrown from vm.objectMirror(oop) - // for bad oop. It is possible to see some bad oop - // because heap might be iterating at no safepoint. - } - return false; - - } - }); - return objects; - } - - // refer to JvmtiEnvBase::count_locked_objects. - // Count the number of objects for a lightweight monitor. The obj - // parameter is object that owns the monitor so this routine will - // count the number of times the same object was locked by frames - // in JavaThread. i.e., we count total number of times the same - // object is (lightweight) locked by given thread. - private int countLockedObjects(JavaThread jt, Oop obj) { - int res = 0; - JavaVFrame frame = jt.getLastJavaVFrameDbg(); - while (frame != null) { - List monitors = frame.getMonitors(); - OopHandle givenHandle = obj.getHandle(); - for (Iterator itr = monitors.iterator(); itr.hasNext();) { - MonitorInfo mi = (MonitorInfo) itr.next(); - if (mi.eliminated() && frame.isCompiledFrame()) continue; // skip eliminated monitor - if (givenHandle.equals(mi.owner())) { - res++; - } - } - frame = (JavaVFrame) frame.javaSender(); - } - return res; - } - - // wrappers on same named method of Threads class - // returns List - private List getPendingThreads(ObjectMonitor mon) { - return vm.saVM().getThreads().getPendingThreads(mon); - } - - // returns List - private List getWaitingThreads(ObjectMonitor mon) { - return vm.saVM().getThreads().getWaitingThreads(mon); - } - - private JavaThread owningThreadFromMonitor(Address addr) { - return vm.saVM().getThreads().owningThreadFromMonitor(addr); - } - - // refer to JvmtiEnv::GetObjectMonitorUsage - private void computeMonitorInfo() { - monitorInfoCached = true; - Mark mark = saObject.getMark(); - ObjectMonitor mon = null; - Address owner = null; - // check for heavyweight monitor - if (! mark.hasMonitor()) { - // check for lightweight monitor - if (mark.hasLocker()) { - owner = mark.locker().getAddress(); // save the address of the Lock word - } - // implied else: no owner - } else { - // this object has a heavyweight monitor - mon = mark.monitor(); - - // The owner field of a heavyweight monitor may be NULL for no - // owner, a JavaThread * or it may still be the address of the - // Lock word in a JavaThread's stack. A monitor can be inflated - // by a non-owning JavaThread, but only the owning JavaThread - // can change the owner field from the Lock word to the - // JavaThread * and it may not have done that yet. - owner = mon.owner(); - } - - // find the owning thread - if (owner != null) { - owningThread = vm.threadMirror(owningThreadFromMonitor(owner)); - } - - // compute entryCount - if (owningThread != null) { - if (owningThread.getJavaThread().getAddress().equals(owner)) { - // the owner field is the JavaThread * - if (Assert.ASSERTS_ENABLED) { - Assert.that(false, "must have heavyweight monitor with JavaThread * owner"); - } - entryCount = (int) mark.monitor().recursions() + 1; - } else { - // The owner field is the Lock word on the JavaThread's stack - // so the recursions field is not valid. We have to count the - // number of recursive monitor entries the hard way. - entryCount = countLockedObjects(owningThread.getJavaThread(), saObject); - } - } - - // find the contenders & waiters - waitingThreads = new ArrayList(); - if (mon != null) { - // this object has a heavyweight monitor. threads could - // be contenders or waiters - // add all contenders - List pendingThreads = getPendingThreads(mon); - // convert the JavaThreads to ThreadReferenceImpls - for (Iterator itrPend = pendingThreads.iterator(); itrPend.hasNext();) { - waitingThreads.add(vm.threadMirror((JavaThread) itrPend.next())); - } - - // add all waiters (threads in Object.wait()) - // note that we don't do this JVMTI way. To do it JVMTI way, - // we would need to access ObjectWaiter list maintained in - // ObjectMonitor::_queue. But we don't have this struct exposed - // in vmStructs. We do waiters list in a way similar to getting - // pending threads list - List objWaitingThreads = getWaitingThreads(mon); - // convert the JavaThreads to ThreadReferenceImpls - for (Iterator itrWait = objWaitingThreads.iterator(); itrWait.hasNext();) { - waitingThreads.add(vm.threadMirror((JavaThread) itrWait.next())); - } - } - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof ObjectReferenceImpl)) { - ObjectReferenceImpl other = (ObjectReferenceImpl)obj; - return (ref().equals(other.ref())) && - super.equals(obj); - } else { - return false; - } - } - - public int hashCode() { - return saObject.hashCode(); - } - - public String toString() { - return "instance of " + referenceType().name() + "(id=" + uniqueID() + ")"; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/PrimitiveTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/PrimitiveTypeImpl.java deleted file mode 100644 index 7ee330378c7..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/PrimitiveTypeImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -abstract class PrimitiveTypeImpl extends TypeImpl implements PrimitiveType { - - PrimitiveTypeImpl(VirtualMachine vm) { - super(vm); - } - - /* - * Converts the given primitive value to a value of this type. - */ - abstract PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException; - - public String toString() { - return name(); - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/PrimitiveValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/PrimitiveValueImpl.java deleted file mode 100644 index 464fb1dd834..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/PrimitiveValueImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public abstract class PrimitiveValueImpl extends ValueImpl - implements PrimitiveValue { - - PrimitiveValueImpl(VirtualMachine aVm) { - super(aVm); - } - - abstract public boolean booleanValue(); - abstract public byte byteValue(); - abstract public char charValue(); - abstract public short shortValue(); - abstract public int intValue(); - abstract public long longValue(); - abstract public float floatValue(); - abstract public double doubleValue(); - - /* - * The checked versions of the value accessors throw - * InvalidTypeException if the required conversion is - * narrowing and would result in the loss of information - * (either magnitude or precision). - * - * Default implementations here do no checking; subclasses - * override as necessary to do the proper checking. - */ - byte checkedByteValue() throws InvalidTypeException { - return byteValue(); - } - char checkedCharValue() throws InvalidTypeException { - return charValue(); - } - short checkedShortValue() throws InvalidTypeException { - return shortValue(); - } - int checkedIntValue() throws InvalidTypeException { - return intValue(); - } - long checkedLongValue() throws InvalidTypeException { - return longValue(); - } - float checkedFloatValue() throws InvalidTypeException { - return floatValue(); - } - - final boolean checkedBooleanValue() throws InvalidTypeException { - /* - * Always disallow a conversion to boolean from any other - * primitive - */ - if (this instanceof BooleanValue) { - return booleanValue(); - } else { - throw new InvalidTypeException("Can't convert non-boolean value to boolean"); - } - } - - final double checkedDoubleValue() throws InvalidTypeException { - /* - * Can't overflow by converting to double, so this method - * is never overridden - */ - return doubleValue(); - } - -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java deleted file mode 100644 index dd235f9ffef..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java +++ /dev/null @@ -1,1008 +0,0 @@ -/* - * Copyright (c) 2002, 2012, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.lang.ref.SoftReference; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import sun.jvm.hotspot.memory.SystemDictionary; -import sun.jvm.hotspot.oops.ArrayKlass; -import sun.jvm.hotspot.oops.DefaultHeapVisitor; -import sun.jvm.hotspot.oops.Instance; -import sun.jvm.hotspot.oops.InstanceKlass; -import sun.jvm.hotspot.oops.JVMDIClassStatus; -import sun.jvm.hotspot.oops.Klass; -import sun.jvm.hotspot.oops.Oop; -import sun.jvm.hotspot.oops.Symbol; -import sun.jvm.hotspot.utilities.Assert; - -import com.sun.jdi.AbsentInformationException; -import com.sun.jdi.ArrayType; -import com.sun.jdi.ClassLoaderReference; -import com.sun.jdi.ClassNotLoadedException; -import com.sun.jdi.ClassNotPreparedException; -import com.sun.jdi.ClassObjectReference; -import com.sun.jdi.Field; -import com.sun.jdi.InterfaceType; -import com.sun.jdi.Method; -import com.sun.jdi.ObjectReference; -import com.sun.jdi.PrimitiveType; -import com.sun.jdi.ReferenceType; -import com.sun.jdi.Type; -import com.sun.jdi.Value; -import com.sun.jdi.VirtualMachine; - -public abstract class ReferenceTypeImpl extends TypeImpl -implements ReferenceType { - protected Klass saKlass; // This can be an InstanceKlass or an ArrayKlass - protected Symbol typeNameSymbol; // This is used in vm.classesByName to speedup search - private int modifiers = -1; - private String signature = null; - private SoftReference sdeRef = null; - private SoftReference fieldsCache; - private SoftReference allFieldsCache; - private SoftReference methodsCache; - private SoftReference allMethodsCache; - private SoftReference nestedTypesCache; - private SoftReference methodInvokesCache; - - /* to mark when no info available */ - static final SDE NO_SDE_INFO_MARK = new SDE(); - - protected ReferenceTypeImpl(VirtualMachine aVm, sun.jvm.hotspot.oops.Klass klass) { - super(aVm); - saKlass = klass; - typeNameSymbol = saKlass.getName(); - if (Assert.ASSERTS_ENABLED) { - Assert.that(typeNameSymbol != null, "null type name for a Klass"); - } - } - - Symbol typeNameAsSymbol() { - return typeNameSymbol; - } - - Method getMethodMirror(sun.jvm.hotspot.oops.Method ref) { - // SA creates new Method objects when they are referenced which means - // that the incoming object might not be the same object as on our - // even though it is the same method. So do an address compare by - // calling equals rather than just reference compare. - Iterator it = methods().iterator(); - while (it.hasNext()) { - MethodImpl method = (MethodImpl)it.next(); - if (ref.equals(method.ref())) { - return method; - } - } - if (ref.getMethodHolder().equals(SystemDictionary.getMethodHandleKlass())) { - // invoke methods are generated as needed, so make mirrors as needed - List mis = null; - if (methodInvokesCache == null) { - mis = new ArrayList(); - methodInvokesCache = new SoftReference(mis); - } else { - mis = (List)methodInvokesCache.get(); - } - it = mis.iterator(); - while (it.hasNext()) { - MethodImpl method = (MethodImpl)it.next(); - if (ref.equals(method.ref())) { - return method; - } - } - - MethodImpl method = MethodImpl.createMethodImpl(vm, this, ref); - mis.add(method); - return method; - } - throw new IllegalArgumentException("Invalid method id: " + ref); - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof ReferenceTypeImpl)) { - ReferenceTypeImpl other = (ReferenceTypeImpl)obj; - return (ref().equals(other.ref())) && - (vm.equals(other.virtualMachine())); - } else { - return false; - } - } - - public int hashCode() { - return saKlass.hashCode(); - } - - public int compareTo(ReferenceType refType) { - /* - * Note that it is critical that compareTo() == 0 - * implies that equals() == true. Otherwise, TreeSet - * will collapse classes. - * - * (Classes of the same name loaded by different class loaders - * or in different VMs must not return 0). - */ - ReferenceTypeImpl other = (ReferenceTypeImpl)refType; - int comp = name().compareTo(other.name()); - if (comp == 0) { - Klass rf1 = ref(); - Klass rf2 = other.ref(); - // optimize for typical case: refs equal and VMs equal - if (rf1.equals(rf2)) { - // sequenceNumbers are always positive - comp = vm.sequenceNumber - - ((VirtualMachineImpl)(other.virtualMachine())).sequenceNumber; - } else { - comp = rf1.getAddress().minus(rf2.getAddress()) < 0? -1 : 1; - } - } - return comp; - } - - public String signature() { - if (signature == null) { - signature = saKlass.signature(); - } - return signature; - } - - // refer to JvmtiEnv::GetClassSignature. - // null is returned for array klasses. - public String genericSignature() { - if (saKlass instanceof ArrayKlass) { - return null; - } else { - Symbol genSig = ((InstanceKlass)saKlass).getGenericSignature(); - return (genSig != null)? genSig.asString() : null; - } - } - - public ClassLoaderReference classLoader() { - Instance xx = (Instance)(((InstanceKlass)saKlass).getClassLoader()); - return (ClassLoaderReferenceImpl)vm.classLoaderMirror(xx); - } - - public boolean isPublic() { - return((modifiers() & VMModifiers.PUBLIC) != 0); - } - - public boolean isProtected() { - return((modifiers() & VMModifiers.PROTECTED) != 0); - } - - public boolean isPrivate() { - return((modifiers() & VMModifiers.PRIVATE) != 0); - } - - public boolean isPackagePrivate() { - return !isPublic() && !isPrivate() && !isProtected(); - } - - public boolean isAbstract() { - return((modifiers() & VMModifiers.ABSTRACT) != 0); - } - - public boolean isFinal() { - return((modifiers() & VMModifiers.FINAL) != 0); - } - - public boolean isStatic() { - return((modifiers() & VMModifiers.STATIC) != 0); - } - - public boolean isPrepared() { - return (saKlass.getClassStatus() & JVMDIClassStatus.PREPARED) != 0; - } - - final void checkPrepared() throws ClassNotPreparedException { - if (! isPrepared()) { - throw new ClassNotPreparedException(); - } - } - - public boolean isVerified() { - return (saKlass.getClassStatus() & JVMDIClassStatus.VERIFIED) != 0; - } - - public boolean isInitialized() { - return (saKlass.getClassStatus() & JVMDIClassStatus.INITIALIZED) != 0; - } - - public boolean failedToInitialize() { - return (saKlass.getClassStatus() & JVMDIClassStatus.ERROR) != 0; - } - - private boolean isThrowableBacktraceField(sun.jvm.hotspot.oops.Field fld) { - // refer to JvmtiEnv::GetClassFields in jvmtiEnv.cpp. - // We want to filter out java.lang.Throwable.backtrace (see 4446677). - // It contains some Method*s that aren't quite real Objects. - if (fld.getFieldHolder().getName().equals(vm.javaLangThrowable()) && - fld.getID().getName().equals("backtrace")) { - return true; - } else { - return false; - } - } - - public final List fields() throws ClassNotPreparedException { - List fields = (fieldsCache != null)? (List) fieldsCache.get() : null; - if (fields == null) { - checkPrepared(); - if (saKlass instanceof ArrayKlass) { - fields = new ArrayList(0); - } else { - // Get a list of the sa Field types - List saFields = ((InstanceKlass)saKlass).getImmediateFields(); - - // Create a list of our Field types - int len = saFields.size(); - fields = new ArrayList(len); - for (int ii = 0; ii < len; ii++) { - sun.jvm.hotspot.oops.Field curField = (sun.jvm.hotspot.oops.Field)saFields.get(ii); - if (! isThrowableBacktraceField(curField)) { - fields.add(new FieldImpl(vm, this, curField)); - } - } - } - fields = Collections.unmodifiableList(fields); - fieldsCache = new SoftReference(fields); - } - return fields; - } - - public final List allFields() throws ClassNotPreparedException { - List allFields = (allFieldsCache != null)? (List) allFieldsCache.get() : null; - if (allFields == null) { - checkPrepared(); - if (saKlass instanceof ArrayKlass) { - // is 'length' a field of array klasses? To maintain - // consistency with JVMDI-JDI we return 0 size. - allFields = new ArrayList(0); - } else { - List saFields; - - // Get a list of the sa Field types - saFields = ((InstanceKlass)saKlass).getAllFields(); - - // Create a list of our Field types - int len = saFields.size(); - allFields = new ArrayList(len); - for (int ii = 0; ii < len; ii++) { - sun.jvm.hotspot.oops.Field curField = (sun.jvm.hotspot.oops.Field)saFields.get(ii); - if (! isThrowableBacktraceField(curField)) { - allFields.add(new FieldImpl(vm, vm.referenceType(curField.getFieldHolder()), curField)); - } - } - } - allFields = Collections.unmodifiableList(allFields); - allFieldsCache = new SoftReference(allFields); - } - return allFields; - } - - abstract List inheritedTypes(); - - void addVisibleFields(List visibleList, Map visibleTable, List ambiguousNames) { - List list = visibleFields(); - Iterator iter = list.iterator(); - while (iter.hasNext()) { - Field field = (Field)iter.next(); - String name = field.name(); - if (!ambiguousNames.contains(name)) { - Field duplicate = (Field)visibleTable.get(name); - if (duplicate == null) { - visibleList.add(field); - visibleTable.put(name, field); - } else if (!field.equals(duplicate)) { - ambiguousNames.add(name); - visibleTable.remove(name); - visibleList.remove(duplicate); - } else { - // identical field from two branches; do nothing - } - } - } - } - - public final List visibleFields() throws ClassNotPreparedException { - checkPrepared(); - /* - * Maintain two different collections of visible fields. The - * list maintains a reasonable order for return. The - * hash map provides an efficient way to lookup visible fields - * by name, important for finding hidden or ambiguous fields. - */ - List visibleList = new ArrayList(); - Map visibleTable = new HashMap(); - - /* Track fields removed from above collection due to ambiguity */ - List ambiguousNames = new ArrayList(); - - /* Add inherited, visible fields */ - List types = inheritedTypes(); - Iterator iter = types.iterator(); - while (iter.hasNext()) { - /* - * TO DO: Be defensive and check for cyclic interface inheritance - */ - ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next(); - type.addVisibleFields(visibleList, visibleTable, ambiguousNames); - } - - /* - * Insert fields from this type, removing any inherited fields they - * hide. - */ - List retList = new ArrayList(fields()); - iter = retList.iterator(); - while (iter.hasNext()) { - Field field = (Field)iter.next(); - Field hidden = (Field)visibleTable.get(field.name()); - if (hidden != null) { - visibleList.remove(hidden); - } - } - retList.addAll(visibleList); - return retList; - } - - public final Field fieldByName(String fieldName) throws ClassNotPreparedException { - java.util.List searchList; - Field f; - - // visibleFields calls checkPrepared - searchList = visibleFields(); - - for (int i=0; i methodMap, Set seenInterfaces); - - public final List visibleMethods() throws ClassNotPreparedException { - checkPrepared(); - /* - * Build a collection of all visible methods. The hash - * map allows us to do this efficiently by keying on the - * concatenation of name and signature. - */ - //System.out.println("jj: RTI: Calling addVisibleMethods for:" + this); - Map map = new HashMap(); - addVisibleMethods(map, new HashSet()); - - /* - * ... but the hash map destroys order. Methods should be - * returned in a sensible order, as they are in allMethods(). - * So, start over with allMethods() and use the hash map - * to filter that ordered collection. - */ - //System.out.println("jj: RTI: Calling allMethods for:" + this); - - List list = new ArrayList(allMethods()); - //System.out.println("jj: allMethods = " + jjstr(list)); - //System.out.println("jj: map = " + map.toString()); - //System.out.println("jj: map = " + jjstr(map.values())); - list.retainAll(map.values()); - //System.out.println("jj: map = " + jjstr(list)); - //System.exit(0); - return list; - } - - static Object prev; - - static public String jjstr(Collection cc) { - StringBuffer buf = new StringBuffer(); - buf.append("["); - Iterator i = cc.iterator(); - boolean hasNext = i.hasNext(); - while (hasNext) { - Object o = i.next(); - if (prev == null) { - prev = o; - } else { - System.out.println("prev == curr?" + prev.equals(o)); - System.out.println("prev == curr?" + (prev == o)); - } - buf.append( o + "@" + o.hashCode()); - //buf.append( ((Object)o).toString()); - hasNext = i.hasNext(); - if (hasNext) - buf.append(", "); - } - - buf.append("]"); - return buf.toString(); - } - - public final List methodsByName(String name) throws ClassNotPreparedException { - // visibleMethods calls checkPrepared - List methods = visibleMethods(); - ArrayList retList = new ArrayList(methods.size()); - Iterator iter = methods.iterator(); - while (iter.hasNext()) { - Method candidate = (Method)iter.next(); - if (candidate.name().equals(name)) { - retList.add(candidate); - } - } - retList.trimToSize(); - return retList; - } - - public final List methodsByName(String name, String signature) throws ClassNotPreparedException { - // visibleMethods calls checkPrepared - List methods = visibleMethods(); - ArrayList retList = new ArrayList(methods.size()); - Iterator iter = methods.iterator(); - while (iter.hasNext()) { - Method candidate = (Method)iter.next(); - if (candidate.name().equals(name) && - candidate.signature().equals(signature)) { - retList.add(candidate); - } - } - retList.trimToSize(); - return retList; - } - - - List getInterfaces() { - List myInterfaces; - if (saKlass instanceof ArrayKlass) { - // Actually, JLS says arrays implement Cloneable and Serializable - // But, JVMDI-JDI just returns 0 interfaces for arrays. We follow - // the same for consistency. - myInterfaces = new ArrayList(0); - } else { - // Get a list of the sa InstanceKlass types - List saInterfaces = ((InstanceKlass)saKlass).getDirectImplementedInterfaces(); - - // Create a list of our InterfaceTypes - int len = saInterfaces.size(); - myInterfaces = new ArrayList(len); - for (int ii = 0; ii < len; ii++) { - myInterfaces.add(new InterfaceTypeImpl(vm, (InstanceKlass)saInterfaces.get(ii))); - } - } - return myInterfaces; - } - - public final List nestedTypes() { - List nestedTypes = (nestedTypesCache != null)? (List) nestedTypesCache.get() : null; - if (nestedTypes == null) { - if (saKlass instanceof ArrayKlass) { - nestedTypes = new ArrayList(0); - } else { - ClassLoaderReference cl = classLoader(); - List classes = null; - if (cl != null) { - classes = cl.visibleClasses(); - } else { - classes = vm.bootstrapClasses(); - } - nestedTypes = new ArrayList(); - Iterator iter = classes.iterator(); - while (iter.hasNext()) { - ReferenceTypeImpl refType = (ReferenceTypeImpl)iter.next(); - Symbol candidateName = refType.ref().getName(); - if (((InstanceKlass)saKlass).isInnerOrLocalClassName(candidateName)) { - nestedTypes.add(refType); - } - } - } - nestedTypes = Collections.unmodifiableList(nestedTypes); - nestedTypesCache = new SoftReference(nestedTypes); - } - return nestedTypes; - } - - public Value getValue(Field sig) { - List list = new ArrayList(1); - list.add(sig); - Map map = getValues(list); - return(Value)map.get(sig); - } - - /** - * Returns a map of field values - */ - public Map getValues(List theFields) { - //validateMirrors(); - int size = theFields.size(); - Map map = new HashMap(size); - for (int ii=0; ii 0) { - sb.append(typeName.substring(index, nextIndex)); - sb.append(java.io.File.separatorChar); - index = nextIndex + 1; - } - return sb.toString(); - } - - public String sourceDebugExtension() - throws AbsentInformationException { - if (!vm.canGetSourceDebugExtension()) { - throw new UnsupportedOperationException(); - } - SDE sde = sourceDebugExtensionInfo(); - if (sde == NO_SDE_INFO_MARK) { - throw new AbsentInformationException(); - } - return sde.sourceDebugExtension; - } - - private SDE sourceDebugExtensionInfo() { - if (!vm.canGetSourceDebugExtension()) { - return NO_SDE_INFO_MARK; - } - SDE sde = null; - sde = (sdeRef == null) ? null : (SDE)sdeRef.get(); - if (sde == null) { - String extension = null; - if (saKlass instanceof InstanceKlass) { - extension = ((InstanceKlass)saKlass).getSourceDebugExtension(); - } - if (extension == null) { - sde = NO_SDE_INFO_MARK; - } else { - sde = new SDE(extension); - } - sdeRef = new SoftReference(sde); - } - return sde; - } - - public List availableStrata() { - SDE sde = sourceDebugExtensionInfo(); - if (sde.isValid()) { - return sde.availableStrata(); - } else { - List strata = new ArrayList(); - strata.add(SDE.BASE_STRATUM_NAME); - return strata; - } - } - - /** - * Always returns non-null stratumID - */ - public String defaultStratum() { - SDE sdei = sourceDebugExtensionInfo(); - if (sdei.isValid()) { - return sdei.defaultStratumId; - } else { - return SDE.BASE_STRATUM_NAME; - } - } - - public final int modifiers() { - if (modifiers == -1) { - modifiers = getModifiers(); - } - return modifiers; - } - - // new method since 1.6. - // Real body will be supplied later. - public List instances(long maxInstances) { - if (!vm.canGetInstanceInfo()) { - throw new UnsupportedOperationException( - "target does not support getting instances"); - } - - if (maxInstances < 0) { - throw new IllegalArgumentException("maxInstances is less than zero: " - + maxInstances); - } - - final List objects = new ArrayList(0); - if (isAbstract() || (this instanceof InterfaceType)) { - return objects; - } - - final Klass givenKls = this.ref(); - final long max = maxInstances; - vm.saObjectHeap().iterate(new DefaultHeapVisitor() { - private long instCount=0; - public boolean doObj(Oop oop) { - if (givenKls.equals(oop.getKlass())) { - objects.add(vm.objectMirror(oop)); - instCount++; - } - if (max > 0 && instCount >= max) { - return true; - } - return false; - } - }); - return objects; - } - - int getModifiers() { - return (int) saKlass.getClassModifiers(); - } - - public List allLineLocations() - throws AbsentInformationException { - return allLineLocations(vm.getDefaultStratum(), null); - } - - public List allLineLocations(String stratumID, String sourceName) - throws AbsentInformationException { - checkPrepared(); - boolean someAbsent = false; // A method that should have info, didn't - SDE.Stratum stratum = stratum(stratumID); - List list = new ArrayList(); // location list - - for (Iterator iter = methods().iterator(); iter.hasNext(); ) { - MethodImpl method = (MethodImpl)iter.next(); - try { - list.addAll( - method.allLineLocations(stratum.id(), sourceName)); - } catch(AbsentInformationException exc) { - someAbsent = true; - } - } - - // If we retrieved no line info, and at least one of the methods - // should have had some (as determined by an - // AbsentInformationException being thrown) then we rethrow - // the AbsentInformationException. - if (someAbsent && list.size() == 0) { - throw new AbsentInformationException(); - } - return list; - } - - public List locationsOfLine(int lineNumber) - throws AbsentInformationException { - return locationsOfLine(vm.getDefaultStratum(), - null, - lineNumber); - } - - public List locationsOfLine(String stratumID, - String sourceName, - int lineNumber) - throws AbsentInformationException { - checkPrepared(); - // A method that should have info, didn't - boolean someAbsent = false; - // A method that should have info, did - boolean somePresent = false; - List methods = methods(); - SDE.Stratum stratum = stratum(stratumID); - - List list = new ArrayList(); - - Iterator iter = methods.iterator(); - while(iter.hasNext()) { - MethodImpl method = (MethodImpl)iter.next(); - // eliminate native and abstract to eliminate - // false positives - if (!method.isAbstract() && - !method.isNative()) { - try { - list.addAll( - method.locationsOfLine(stratum.id(), - sourceName, - lineNumber)); - somePresent = true; - } catch(AbsentInformationException exc) { - someAbsent = true; - } - } - } - if (someAbsent && !somePresent) { - throw new AbsentInformationException(); - } - return list; - } - - Klass ref() { - return saKlass; - } - - - /* - * Return true if an instance of this type - * can be assigned to a variable of the given type - */ - abstract boolean isAssignableTo(ReferenceType type); - - boolean isAssignableFrom(ReferenceType type) { - return ((ReferenceTypeImpl)type).isAssignableTo(this); - } - - boolean isAssignableFrom(ObjectReference object) { - return object == null || - isAssignableFrom(object.referenceType()); - } - - int indexOf(Method method) { - // Make sure they're all here - the obsolete method - // won't be found and so will have index -1 - return methods().indexOf(method); - } - - int indexOf(Field field) { - // Make sure they're all here - return fields().indexOf(field); - } - - private static boolean isPrimitiveArray(String signature) { - int i = signature.lastIndexOf('['); - /* - * TO DO: Centralize JNI signature knowledge. - * - * Ref: - * jdk1.4/doc/guide/jpda/jdi/com/sun/jdi/doc-files/signature.html - */ - boolean isPA; - if (i < 0) { - isPA = false; - } else { - char c = signature.charAt(i + 1); - isPA = (c != 'L'); - } - return isPA; - } - - Type findType(String signature) throws ClassNotLoadedException { - Type type; - if (signature.length() == 1) { - /* OTI FIX: Must be a primitive type or the void type */ - char sig = signature.charAt(0); - if (sig == 'V') { - type = vm.theVoidType(); - } else { - type = vm.primitiveTypeMirror(sig); - } - } else { - // Must be a reference type. - ClassLoaderReferenceImpl loader = - (ClassLoaderReferenceImpl)classLoader(); - if ((loader == null) || - (isPrimitiveArray(signature)) //Work around 4450091 - ) { - // Caller wants type of boot class field - type = vm.findBootType(signature); - } else { - // Caller wants type of non-boot class field - type = loader.findType(signature); - } - } - return type; - } - - String loaderString() { - if (classLoader() != null) { - return "loaded by " + classLoader().toString(); - } else { - return "loaded by bootstrap loader"; - } - } - - long uniqueID() { - return vm.getAddressValue(ref().getJavaMirror()); - } - - // new method since 1.6 - public int majorVersion() { - if (!vm.canGetClassFileVersion()) { - throw new UnsupportedOperationException("Cannot get class file version"); - } - return (int)((InstanceKlass)saKlass).majorVersion(); - } - - // new method since 1.6 - public int minorVersion() { - if (!vm.canGetClassFileVersion()) { - throw new UnsupportedOperationException("Cannot get class file version"); - } - return (int)((InstanceKlass)saKlass).minorVersion(); - } - - // new method since 1.6 - public int constantPoolCount() { - if (!vm.canGetConstantPool()) { - throw new UnsupportedOperationException("Cannot get constant pool"); - } - if (saKlass instanceof ArrayKlass) { - return 0; - } else { - return (int)((InstanceKlass)saKlass).getConstants().getLength(); - } - } - - // new method since 1.6 - public byte[] constantPool() { - if (!vm.canGetConstantPool()) { - throw new UnsupportedOperationException("Cannot get constant pool"); - } - if (this instanceof ArrayType || this instanceof PrimitiveType) { - byte bytes[] = new byte[0]; - return bytes; - } else { - ByteArrayOutputStream bs = new ByteArrayOutputStream(); - try { - ((InstanceKlass)saKlass).getConstants().writeBytes(bs); - } catch (IOException ex) { - ex.printStackTrace(); - byte bytes[] = new byte[0]; - return bytes; - } - return bs.toByteArray(); - } - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SACoreAttachingConnector.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SACoreAttachingConnector.java deleted file mode 100644 index 3db35d4acf5..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SACoreAttachingConnector.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.connect.*; -import com.sun.jdi.Bootstrap; -import com.sun.jdi.VirtualMachine; -import com.sun.jdi.VirtualMachineManager; - -import java.io.*; -import java.lang.reflect.*; -import java.net.*; -import java.util.*; - -public class SACoreAttachingConnector extends ConnectorImpl implements AttachingConnector { - - static final String ARG_COREFILE = "core"; - static final String ARG_JAVA_EXECUTABLE = "javaExecutable"; - private Transport transport; - - public SACoreAttachingConnector(com.sun.tools.jdi.VirtualMachineManagerService ignored) { - this(); - } - - public SACoreAttachingConnector() { - super(); - //fixme jjh Must create resources for these strings - addStringArgument( - ARG_JAVA_EXECUTABLE, - "Java Executable", //getString("sa.javaExecutable.label"), - "Pathname of Java Executable", //getString("sa.javaExecutable.description"); - "", - true); - - addStringArgument( - ARG_COREFILE, - "Corefile", // getString("sa.CoreFile.label"), - "Pathname of a corefile from a Java Process", //getString("sa.CoreFile.description"), - "core", - false); - - transport = new Transport() { - public String name() { - return "filesystem"; - } - }; - } - - // security check to see whether the caller can perform attach - private void checkCoreAttach(String corefile) { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - try { - // whether the caller can link against SA native library? - checkNativeLink(sm, System.getProperty("os.name")); - // check whether the caller can read the core file? - sm.checkRead(corefile); - } catch (SecurityException se) { - throw new SecurityException("permission denied to attach to " + corefile); - } - } - } - - private VirtualMachine createVirtualMachine(Class vmImplClass, - String javaExec, String corefile) - throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { - java.lang.reflect.Method connectByCoreMethod = vmImplClass.getMethod( - "createVirtualMachineForCorefile", - new Class[] { - VirtualMachineManager.class, - String.class, String.class, - Integer.TYPE - }); - return (VirtualMachine) connectByCoreMethod.invoke(null, - new Object[] { - Bootstrap.virtualMachineManager(), - javaExec, - corefile, - new Integer(0) - }); - } - - public VirtualMachine attach(Map arguments) throws IOException, - IllegalConnectorArgumentsException { - String javaExec = argument(ARG_JAVA_EXECUTABLE, arguments).value(); - if (javaExec == null || javaExec.equals("")) { - throw new IllegalConnectorArgumentsException("javaExec should be non-null and non-empty", - ARG_JAVA_EXECUTABLE); - } - String corefile = argument(ARG_COREFILE, arguments).value(); - if (corefile == null || corefile.equals("")) { - throw new IllegalConnectorArgumentsException("corefile should be non-null and non-empty", - ARG_COREFILE); - } - - checkCoreAttach(corefile); - - VirtualMachine myVM = null; - try { - try { - Class vmImplClass = loadVirtualMachineImplClass(); - myVM = createVirtualMachine(vmImplClass, javaExec, corefile); - } catch (InvocationTargetException ite) { - Class vmImplClass = handleVMVersionMismatch(ite); - if (vmImplClass != null) { - return createVirtualMachine(vmImplClass, javaExec, corefile); - } else { - throw ite; - } - } - } catch (Exception ee) { - if (DEBUG) { - System.out.println("VirtualMachineImpl() got an exception:"); - ee.printStackTrace(); - System.out.println("coreFile = " + corefile + ", javaExec = " + javaExec); - } - throw (IOException) new IOException().initCause(ee); - } - setVMDisposeObserver(myVM); - return myVM; - } - - public String name() { - return "sun.jvm.hotspot.jdi.SACoreAttachingConnector"; - } - - public String description() { - return getString("This connector allows you to attach to a core file using the Serviceability Agent"); - } - - public Transport transport() { - return transport; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SADebugServer.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SADebugServer.java deleted file mode 100644 index 19c41dfa84b..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SADebugServer.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2003, 2012, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -public final class SADebugServer { - // do not allow instance creation - private SADebugServer() {} - - private static void usage() { - java.io.PrintStream out = System.out; - out.println("Usage: jsadebugd [options] [server-id]"); - out.println("\t\t(to connect to a live java process)"); - out.println(" or jsadebugd [options] [server-id]"); - out.println("\t\t(to connect to a core file produced by )"); - out.println("\t\tserver-id is an optional unique id for this debug server, needed "); - out.println("\t\tif multiple debug servers are run on the same machine"); - out.println("where options include:"); - out.println(" -h | -help\tto print this help message"); - System.exit(1); - } - - public static void main(String[] args) { - if ((args.length < 1) || (args.length > 3)) { - usage(); - } - - // Attempt to handle "-h" or "-help" - if (args[0].startsWith("-")) { - usage(); - } - - // By default SA agent classes prefer Windows process debugger - // to windbg debugger. SA expects special properties to be set - // to choose other debuggers. We will set those here before - // attaching to SA agent. - - System.setProperty("sun.jvm.hotspot.debugger.useWindbgDebugger", "true"); - - // delegate to the actual SA debug server. - sun.jvm.hotspot.DebugServer.main(args); - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SADebugServerAttachingConnector.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SADebugServerAttachingConnector.java deleted file mode 100644 index d34f1168f16..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SADebugServerAttachingConnector.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.connect.*; -import com.sun.jdi.Bootstrap; -import com.sun.jdi.VirtualMachine; -import com.sun.jdi.VirtualMachineManager; - -import java.io.*; -import java.lang.reflect.*; -import java.net.*; -import java.util.*; - -public class SADebugServerAttachingConnector extends ConnectorImpl implements AttachingConnector { - - static final String ARG_DEBUG_SERVER_NAME = "debugServerName"; - private Transport transport; - - public SADebugServerAttachingConnector(com.sun.tools.jdi.VirtualMachineManagerService ignored) { - this(); - } - - public SADebugServerAttachingConnector() { - // fixme jjh create resources for the these strings, - addStringArgument( - ARG_DEBUG_SERVER_NAME, - "Debug Server", //getString("sa.debugServer.label"), - "Name of a remote SA Debug Server", //getString("sa.debugServer.description"); - "", - true); - transport = new Transport() { - public String name() { - return "RMI"; - } - }; - } - - private VirtualMachine createVirtualMachine(Class vmImplClass, - String debugServerName) - throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { - java.lang.reflect.Method connectByServerMethod = - vmImplClass.getMethod( - "createVirtualMachineForServer", - new Class[] { - VirtualMachineManager.class, - String.class, - Integer.TYPE - }); - return (VirtualMachine) connectByServerMethod.invoke(null, - new Object[] { - Bootstrap.virtualMachineManager(), - debugServerName, - new Integer(0) - }); - } - - public VirtualMachine attach(Map arguments) throws IOException, - IllegalConnectorArgumentsException { - String debugServerName = argument(ARG_DEBUG_SERVER_NAME, arguments).value(); - if (debugServerName == null || debugServerName.equals("")) { - throw new IllegalConnectorArgumentsException("debugServerName should be non-null and non-empty", - ARG_DEBUG_SERVER_NAME); - } - VirtualMachine myVM; - try { - try { - Class vmImplClass = loadVirtualMachineImplClass(); - myVM = createVirtualMachine(vmImplClass, debugServerName); - } catch (InvocationTargetException ite) { - Class vmImplClass = handleVMVersionMismatch(ite); - if (vmImplClass != null) { - return createVirtualMachine(vmImplClass, debugServerName); - } else { - throw ite; - } - } - } catch (Exception ee) { - if (DEBUG) { - System.out.println("VirtualMachineImpl() got an exception:"); - ee.printStackTrace(); - System.out.println("debug server name = " + debugServerName); - } - throw (IOException) new IOException().initCause(ee); - } - setVMDisposeObserver(myVM); - return myVM; - } - - public String name() { - return "sun.jvm.hotspot.jdi.SADebugServerAttachingConnector"; - } - - public String description() { - return getString("This connector allows you to attach to a Java Process via a debug server with the Serviceability Agent"); - } - - public Transport transport() { - return transport; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SAJDIClassLoader.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SAJDIClassLoader.java deleted file mode 100644 index b2e5dae85cb..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SAJDIClassLoader.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2003, 2008, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import java.io.*; -import java.net.*; - -/* - * This class loader is used for two different reasons: - * - * 1) To support multiple simultaneous debuggees. - * - * SA's architecture does not allow us to use multiple simultaneous - * debuggees. This is because of lots of static fields caching - * vmStruct fields and singleton assumption in classes such as - * 'sun.jvm.hotspot.runtime.VM'. Hence, we use instances of this - * class loader to create a separate namespace for each debuggee VM. - * - * 2) To support cross VM version debugging. - * - * SA has very close dependency on VM data structures. Due to this, a - * version of SA can only support debuggees running a same dot-dot release and - * update releases only. For eg. this version of SA supports only 1.4.2 and - * 1.4.2_xx releases only. But, users may want to debug debuggees running - * a different version of VM. To support this, we use an instance of this - * class loader to load classes from corresponding sa-jdi.jar. - * - * Note that JDI classes would still be loaded from the debugger's tools.jar - * and not from debuggee's tools.jar. This means that if JDI interface evolved - * b/w debuggee and debugger VM versions, user may still get problems. This is - * the case when debugger runs on 1.5.0 and debuggee runs on 1.4.2. Because JDI - * evolved b/w these versions (generics, enum, varargs etc.), 1.4.2 sa-jdi.jar - * won't implement 1.5.0 JDI properly and user would get verifier errors. This - * class loader solution is suited for different dot-dot release where JDI will - * not evolve but VM data structures might change and SA implementation might - * have to change. For example, a debuggee running 1.5.1 VM can be debugged - * with debugger running on 1.5.0 VM. Here, JDI is same but VM data structures - * could still change. - */ - -class SAJDIClassLoader extends URLClassLoader { - private static final boolean DEBUG; - static { - DEBUG = System.getProperty("sun.jvm.hotspot.jdi.SAJDIClassLoader.DEBUG") != null; - } - - private ClassLoader parent; - private boolean classPathSet; - - SAJDIClassLoader(ClassLoader parent) { - super(new URL[0], parent); - this.parent = parent; - } - - SAJDIClassLoader(ClassLoader parent, String classPath) { - this(parent); - this.classPathSet = true; - try { - addURL(new File(classPath).toURI().toURL()); - } catch(MalformedURLException mue) { - throw new RuntimeException(mue); - } - } - - public synchronized Class loadClass(String name) - throws ClassNotFoundException { - // First, check if the class has already been loaded - Class c = findLoadedClass(name); - if (c == null) { - /* If we are loading any class in 'sun.jvm.hotspot.' or any of the - * sub-packages (except for 'debugger' sub-pkg. please refer below), - * we load it by 'this' loader. Or else, we forward the request to - * 'parent' loader, system loader etc. (rest of the code follows - * the patten in java.lang.ClassLoader.loadClass). - * - * 'sun.jvm.hotspot.debugger.' and sub-package classes are - * also loaded by parent loader. This is done for two reasons: - * - * 1. to avoid code bloat by too many classes. - * 2. to avoid loading same native library multiple times - * from multiple class loaders (which results in getting a - * UnsatisifiedLinkageError from System.loadLibrary). - */ - - if (name.startsWith("sun.jvm.hotspot.") && - !name.startsWith("sun.jvm.hotspot.debugger.")) { - return findClass(name); - } - if (parent != null) { - c = parent.loadClass(name); - } else { - c = findSystemClass(name); - } - } - return c; - } - - protected Class findClass(String name) throws ClassNotFoundException { - if (DEBUG) { - System.out.println("SA/JDI loader: about to load " + name); - } - if (classPathSet) { - return super.findClass(name); - } else { - byte[] b = null; - try { - InputStream in = getResourceAsStream(name.replace('.', '/') + ".class"); - // Read until end of stream is reached - b = new byte[1024]; - int total = 0; - int len = 0; - while ((len = in.read(b, total, b.length - total)) != -1) { - total += len; - if (total >= b.length) { - byte[] tmp = new byte[total * 2]; - System.arraycopy(b, 0, tmp, 0, total); - b = tmp; - } - } - // Trim array to correct size, if necessary - if (total != b.length) { - byte[] tmp = new byte[total]; - System.arraycopy(b, 0, tmp, 0, total); - b = tmp; - } - } catch (Exception exp) { - throw (ClassNotFoundException) new ClassNotFoundException().initCause(exp); - } - return defineClass(name, b, 0, b.length); - } - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SAPIDAttachingConnector.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SAPIDAttachingConnector.java deleted file mode 100644 index fbba6b05d8b..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SAPIDAttachingConnector.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.connect.*; -import com.sun.jdi.Bootstrap; -import com.sun.jdi.VirtualMachine; -import com.sun.jdi.VirtualMachineManager; - -import java.io.*; -import java.lang.reflect.*; -import java.net.*; -import java.util.*; - -public class SAPIDAttachingConnector extends ConnectorImpl implements AttachingConnector { - static final String ARG_PID = "pid"; - private Transport transport; - - public SAPIDAttachingConnector(com.sun.tools.jdi.VirtualMachineManagerService ignored) { - this(); - } - - public SAPIDAttachingConnector() { - super(); - // fixme jjh: create resources for the these strings, - addStringArgument( - ARG_PID, - "PID", //getString("sa.pid.label"), - "PID of a Java process", //getString("sa.pid.description"); - "", - true); - transport = new Transport() { - public String name() { - return "local process"; - } - }; - } - - // security check to see whether the caller can perform attach - private void checkProcessAttach(int pid) { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - String os = System.getProperty("os.name"); - try { - // Whether the caller can perform link against SA native library? - checkNativeLink(sm, os); - if (os.equals("SunOS") || os.equals("Linux")) { - // Whether the caller can read /proc/ file? - sm.checkRead("/proc/" + pid); - } - } catch (SecurityException se) { - throw new SecurityException("permission denied to attach to " + pid); - } - } - } - - private VirtualMachine createVirtualMachine(Class virtualMachineImplClass, int pid) - throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { - java.lang.reflect.Method createByPIDMethod - = virtualMachineImplClass.getMethod("createVirtualMachineForPID", - new Class[] { - VirtualMachineManager.class, - Integer.TYPE, Integer.TYPE - }); - return (VirtualMachine) createByPIDMethod.invoke(null, - new Object[] { - Bootstrap.virtualMachineManager(), - new Integer(pid), - new Integer(0) - }); - } - - public VirtualMachine attach(Map arguments) throws IOException, - IllegalConnectorArgumentsException { - int pid = 0; - try { - pid = Integer.parseInt(argument(ARG_PID, arguments).value()); - } catch (NumberFormatException nfe) { - throw (IllegalConnectorArgumentsException) new IllegalConnectorArgumentsException - (nfe.getMessage(), ARG_PID).initCause(nfe); - } - - checkProcessAttach(pid); - - VirtualMachine myVM = null; - try { - try { - Class vmImplClass = loadVirtualMachineImplClass(); - myVM = createVirtualMachine(vmImplClass, pid); - } catch (InvocationTargetException ite) { - Class vmImplClass = handleVMVersionMismatch(ite); - if (vmImplClass != null) { - return createVirtualMachine(vmImplClass, pid); - } else { - throw ite; - } - } - } catch (Exception ee) { - if (DEBUG) { - System.out.println("VirtualMachineImpl() got an exception:"); - ee.printStackTrace(); - System.out.println("pid = " + pid); - } - throw (IOException) new IOException().initCause(ee); - } - setVMDisposeObserver(myVM); - return myVM; - } - - public String name() { - return "sun.jvm.hotspot.jdi.SAPIDAttachingConnector"; - } - - public String description() { - return getString("This connector allows you to attach to a Java process using the Serviceability Agent"); - } - - public Transport transport() { - return transport; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SDE.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SDE.java deleted file mode 100644 index 0e90f2b8927..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/SDE.java +++ /dev/null @@ -1,685 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -import java.util.*; -import java.io.File; - -class SDE { - private static final int INIT_SIZE_FILE = 3; - private static final int INIT_SIZE_LINE = 100; - private static final int INIT_SIZE_STRATUM = 3; - - static final String BASE_STRATUM_NAME = "Java"; - - /* for C capatibility */ - static final String NullString = null; - - private class FileTableRecord { - int fileId; - String sourceName; - String sourcePath; // do not read - use accessor - boolean isConverted = false; - - /** - * Return the sourcePath, computing it if not set. - * If set, convert '/' in the sourcePath to the - * local file separator. - */ - String getSourcePath(ReferenceTypeImpl refType) { - if (!isConverted) { - if (sourcePath == null) { - sourcePath = refType.baseSourceDir() + sourceName; - } else { - StringBuffer buf = new StringBuffer(); - for (int i = 0; i < sourcePath.length(); ++i) { - char ch = sourcePath.charAt(i); - if (ch == '/') { - buf.append(File.separatorChar); - } else { - buf.append(ch); - } - } - sourcePath = buf.toString(); - } - isConverted = true; - } - return sourcePath; - } - } - - private class LineTableRecord { - int jplsStart; - int jplsEnd; - int jplsLineInc; - int njplsStart; - int njplsEnd; - int fileId; - } - - private class StratumTableRecord { - String id; - int fileIndex; - int lineIndex; - } - - class Stratum { - private final int sti; /* stratum index */ - - private Stratum(int sti) { - this.sti = sti; - } - - String id() { - return stratumTable[sti].id; - } - - boolean isJava() { - return sti == baseStratumIndex; - } - - /** - * Return all the sourceNames for this stratum. - * Look from our starting fileIndex upto the starting - * fileIndex of next stratum - can do this since there - * is always a terminator stratum. - * Default sourceName (the first one) must be first. - */ - List sourceNames(ReferenceTypeImpl refType) { - int i; - int fileIndexStart = stratumTable[sti].fileIndex; - /* one past end */ - int fileIndexEnd = stratumTable[sti+1].fileIndex; - List result = new ArrayList(fileIndexEnd - fileIndexStart); - for (i = fileIndexStart; i < fileIndexEnd; ++i) { - result.add(fileTable[i].sourceName); - } - return result; - } - - /** - * Return all the sourcePaths for this stratum. - * Look from our starting fileIndex upto the starting - * fileIndex of next stratum - can do this since there - * is always a terminator stratum. - * Default sourcePath (the first one) must be first. - */ - List sourcePaths(ReferenceTypeImpl refType) { - int i; - int fileIndexStart = stratumTable[sti].fileIndex; - /* one past end */ - int fileIndexEnd = stratumTable[sti+1].fileIndex; - List result = new ArrayList(fileIndexEnd - fileIndexStart); - for (i = fileIndexStart; i < fileIndexEnd; ++i) { - result.add(fileTable[i].getSourcePath(refType)); - } - return result; - } - - LineStratum lineStratum(ReferenceTypeImpl refType, - int jplsLine) { - int lti = stiLineTableIndex(sti, jplsLine); - if (lti < 0) { - return null; - } else { - return new LineStratum(sti, lti, refType, - jplsLine); - } - } - } - - class LineStratum { - private final int sti; /* stratum index */ - private final int lti; /* line table index */ - private final ReferenceTypeImpl refType; - private final int jplsLine; - private String sourceName = null; - private String sourcePath = null; - - private LineStratum(int sti, int lti, - ReferenceTypeImpl refType, - int jplsLine) { - this.sti = sti; - this.lti = lti; - this.refType = refType; - this.jplsLine = jplsLine; - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof LineStratum)) { - LineStratum other = (LineStratum)obj; - return (lti == other.lti) && - (sti == other.sti) && - (lineNumber() == other.lineNumber()) && - (refType.equals(other.refType)); - } else { - return false; - } - } - - int lineNumber() { - return stiLineNumber(sti, lti, jplsLine); - } - - /** - * Fetch the source name and source path for - * this line, converting or constructing - * the source path if needed. - */ - void getSourceInfo() { - if (sourceName != null) { - // already done - return; - } - int fti = stiFileTableIndex(sti, lti); - if (fti == -1) { - throw new InternalError( - "Bad SourceDebugExtension, no matching source id " + - lineTable[lti].fileId + " jplsLine: " + jplsLine); - } - FileTableRecord ftr = fileTable[fti]; - sourceName = ftr.sourceName; - sourcePath = ftr.getSourcePath(refType); - } - - String sourceName() { - getSourceInfo(); - return sourceName; - } - - String sourcePath() { - getSourceInfo(); - return sourcePath; - } - } - - private FileTableRecord[] fileTable = null; - private LineTableRecord[] lineTable = null; - private StratumTableRecord[] stratumTable = null; - - private int fileIndex = 0; - private int lineIndex = 0; - private int stratumIndex = 0; - private int currentFileId = 0; - - private int defaultStratumIndex = -1; - private int baseStratumIndex = -2; /* so as not to match -1 above */ - private int sdePos = 0; - - final String sourceDebugExtension; - String jplsFilename = null; - String defaultStratumId = null; - boolean isValid = false; - - SDE(String sourceDebugExtension) { - this.sourceDebugExtension = sourceDebugExtension; - decode(); - } - - SDE() { - this.sourceDebugExtension = null; - createProxyForAbsentSDE(); - } - - char sdePeek() { - if (sdePos >= sourceDebugExtension.length()) { - syntax(); - } - return sourceDebugExtension.charAt(sdePos); - } - - char sdeRead() { - if (sdePos >= sourceDebugExtension.length()) { - syntax(); - } - return sourceDebugExtension.charAt(sdePos++); - } - - void sdeAdvance() { - sdePos++; - } - - void syntax() { - throw new InternalError("bad SourceDebugExtension syntax - position " + - sdePos); - } - - void syntax(String msg) { - throw new InternalError("bad SourceDebugExtension syntax: " + msg); - } - - void assureLineTableSize() { - int len = lineTable == null? 0 : lineTable.length; - if (lineIndex >= len) { - int i; - int newLen = len == 0? INIT_SIZE_LINE : len * 2; - LineTableRecord[] newTable = new LineTableRecord[newLen]; - for (i = 0; i < len; ++i) { - newTable[i] = lineTable[i]; - } - for (; i < newLen; ++i) { - newTable[i] = new LineTableRecord(); - } - lineTable = newTable; - } - } - - void assureFileTableSize() { - int len = fileTable == null? 0 : fileTable.length; - if (fileIndex >= len) { - int i; - int newLen = len == 0? INIT_SIZE_FILE : len * 2; - FileTableRecord[] newTable = new FileTableRecord[newLen]; - for (i = 0; i < len; ++i) { - newTable[i] = fileTable[i]; - } - for (; i < newLen; ++i) { - newTable[i] = new FileTableRecord(); - } - fileTable = newTable; - } - } - - void assureStratumTableSize() { - int len = stratumTable == null? 0 : stratumTable.length; - if (stratumIndex >= len) { - int i; - int newLen = len == 0? INIT_SIZE_STRATUM : len * 2; - StratumTableRecord[] newTable = new StratumTableRecord[newLen]; - for (i = 0; i < len; ++i) { - newTable[i] = stratumTable[i]; - } - for (; i < newLen; ++i) { - newTable[i] = new StratumTableRecord(); - } - stratumTable = newTable; - } - } - - String readLine() { - StringBuffer sb = new StringBuffer(); - char ch; - - ignoreWhite(); - while (((ch = sdeRead()) != '\n') && (ch != '\r')) { - sb.append((char)ch); - } - // check for CR LF - if ((ch == '\r') && (sdePeek() == '\n')) { - sdeRead(); - } - ignoreWhite(); // leading white - return sb.toString(); - } - - private int defaultStratumTableIndex() { - if ((defaultStratumIndex == -1) && (defaultStratumId != null)) { - defaultStratumIndex = - stratumTableIndex(defaultStratumId); - } - return defaultStratumIndex; - } - - int stratumTableIndex(String stratumId) { - int i; - - if (stratumId == null) { - return defaultStratumTableIndex(); - } - for (i = 0; i < (stratumIndex-1); ++i) { - if (stratumTable[i].id.equals(stratumId)) { - return i; - } - } - return defaultStratumTableIndex(); - } - - Stratum stratum(String stratumID) { - int sti = stratumTableIndex(stratumID); - return new Stratum(sti); - } - - List availableStrata() { - List strata = new ArrayList(); - - for (int i = 0; i < (stratumIndex-1); ++i) { - StratumTableRecord rec = stratumTable[i]; - strata.add(rec.id); - } - return strata; - } - -/***************************** - * below functions/methods are written to compile under either Java or C - * - * Needed support functions: - * sdePeek() - * sdeRead() - * sdeAdvance() - * readLine() - * assureLineTableSize() - * assureFileTableSize() - * assureStratumTableSize() - * syntax() - * - * stratumTableIndex(String) - * - * Needed support variables: - * lineTable - * lineIndex - * fileTable - * fileIndex - * currentFileId - * - * Needed types: - * String - * - * Needed constants: - * NullString - */ - - void ignoreWhite() { - char ch; - - while (((ch = sdePeek()) == ' ') || (ch == '\t')) { - sdeAdvance(); - } - } - - void ignoreLine() { - char ch; - - while (((ch = sdeRead()) != '\n') && (ch != '\r')) { - } - /* check for CR LF */ - if ((ch == '\r') && (sdePeek() == '\n')) { - sdeAdvance(); - } - ignoreWhite(); /* leading white */ - } - - int readNumber() { - int value = 0; - char ch; - - ignoreWhite(); - while (((ch = sdePeek()) >= '0') && (ch <= '9')) { - sdeAdvance(); - value = (value * 10) + ch - '0'; - } - ignoreWhite(); - return value; - } - - void storeFile(int fileId, String sourceName, String sourcePath) { - assureFileTableSize(); - fileTable[fileIndex].fileId = fileId; - fileTable[fileIndex].sourceName = sourceName; - fileTable[fileIndex].sourcePath = sourcePath; - ++fileIndex; - } - - void fileLine() { - int hasAbsolute = 0; /* acts as boolean */ - int fileId; - String sourceName; - String sourcePath = null; - - /* is there an absolute filename? */ - if (sdePeek() == '+') { - sdeAdvance(); - hasAbsolute = 1; - } - fileId = readNumber(); - sourceName = readLine(); - if (hasAbsolute == 1) { - sourcePath = readLine(); - } - - storeFile(fileId, sourceName, sourcePath); - } - - void storeLine(int jplsStart, int jplsEnd, int jplsLineInc, - int njplsStart, int njplsEnd, int fileId) { - assureLineTableSize(); - lineTable[lineIndex].jplsStart = jplsStart; - lineTable[lineIndex].jplsEnd = jplsEnd; - lineTable[lineIndex].jplsLineInc = jplsLineInc; - lineTable[lineIndex].njplsStart = njplsStart; - lineTable[lineIndex].njplsEnd = njplsEnd; - lineTable[lineIndex].fileId = fileId; - ++lineIndex; - } - - /** - * Parse line translation info. Syntax is - * [ # ] [ , ] : - * [ , ] CR - */ - void lineLine() { - int lineCount = 1; - int lineIncrement = 1; - int njplsStart; - int jplsStart; - - njplsStart = readNumber(); - - /* is there a fileID? */ - if (sdePeek() == '#') { - sdeAdvance(); - currentFileId = readNumber(); - } - - /* is there a line count? */ - if (sdePeek() == ',') { - sdeAdvance(); - lineCount = readNumber(); - } - - if (sdeRead() != ':') { - syntax(); - } - jplsStart = readNumber(); - if (sdePeek() == ',') { - sdeAdvance(); - lineIncrement = readNumber(); - } - ignoreLine(); /* flush the rest */ - - storeLine(jplsStart, - jplsStart + (lineCount * lineIncrement) -1, - lineIncrement, - njplsStart, - njplsStart + lineCount -1, - currentFileId); - } - - /** - * Until the next stratum section, everything after this - * is in stratumId - so, store the current indicies. - */ - void storeStratum(String stratumId) { - /* remove redundant strata */ - if (stratumIndex > 0) { - if ((stratumTable[stratumIndex-1].fileIndex - == fileIndex) && - (stratumTable[stratumIndex-1].lineIndex - == lineIndex)) { - /* nothing changed overwrite it */ - --stratumIndex; - } - } - /* store the results */ - assureStratumTableSize(); - stratumTable[stratumIndex].id = stratumId; - stratumTable[stratumIndex].fileIndex = fileIndex; - stratumTable[stratumIndex].lineIndex = lineIndex; - ++stratumIndex; - currentFileId = 0; - } - - /** - * The beginning of a stratum's info - */ - void stratumSection() { - storeStratum(readLine()); - } - - void fileSection() { - ignoreLine(); - while (sdePeek() != '*') { - fileLine(); - } - } - - void lineSection() { - ignoreLine(); - while (sdePeek() != '*') { - lineLine(); - } - } - - /** - * Ignore a section we don't know about. - */ - void ignoreSection() { - ignoreLine(); - while (sdePeek() != '*') { - ignoreLine(); - } - } - - /** - * A base "Java" stratum is always available, though - * it is not in the SourceDebugExtension. - * Create the base stratum. - */ - void createJavaStratum() { - baseStratumIndex = stratumIndex; - storeStratum(BASE_STRATUM_NAME); - storeFile(1, jplsFilename, NullString); - /* JPL line numbers cannot exceed 65535 */ - storeLine(1, 65536, 1, 1, 65536, 1); - storeStratum("Aux"); /* in case they don't declare */ - } - - /** - * Decode a SourceDebugExtension which is in SourceMap format. - * This is the entry point into the recursive descent parser. - */ - void decode() { - /* check for "SMAP" - allow EOF if not ours */ - if ((sourceDebugExtension.length() < 4) || - (sdeRead() != 'S') || - (sdeRead() != 'M') || - (sdeRead() != 'A') || - (sdeRead() != 'P')) { - return; /* not our info */ - } - ignoreLine(); /* flush the rest */ - jplsFilename = readLine(); - defaultStratumId = readLine(); - createJavaStratum(); - while (true) { - if (sdeRead() != '*') { - syntax(); - } - switch (sdeRead()) { - case 'S': - stratumSection(); - break; - case 'F': - fileSection(); - break; - case 'L': - lineSection(); - break; - case 'E': - /* set end points */ - storeStratum("*terminator*"); - isValid = true; - return; - default: - ignoreSection(); - } - } - } - - void createProxyForAbsentSDE() { - jplsFilename = null; - defaultStratumId = BASE_STRATUM_NAME; - defaultStratumIndex = stratumIndex; - createJavaStratum(); - storeStratum("*terminator*"); - } - - /***************** query functions ***********************/ - - private int stiLineTableIndex(int sti, int jplsLine) { - int i; - int lineIndexStart; - int lineIndexEnd; - - lineIndexStart = stratumTable[sti].lineIndex; - /* one past end */ - lineIndexEnd = stratumTable[sti+1].lineIndex; - for (i = lineIndexStart; i < lineIndexEnd; ++i) { - if ((jplsLine >= lineTable[i].jplsStart) && - (jplsLine <= lineTable[i].jplsEnd)) { - return i; - } - } - return -1; - } - - private int stiLineNumber(int sti, int lti, int jplsLine) { - return lineTable[lti].njplsStart + - (((jplsLine - lineTable[lti].jplsStart) / - lineTable[lti].jplsLineInc)); - } - - private int fileTableIndex(int sti, int fileId) { - int i; - int fileIndexStart = stratumTable[sti].fileIndex; - /* one past end */ - int fileIndexEnd = stratumTable[sti+1].fileIndex; - for (i = fileIndexStart; i < fileIndexEnd; ++i) { - if (fileTable[i].fileId == fileId) { - return i; - } - } - return -1; - } - - private int stiFileTableIndex(int sti, int lti) { - return fileTableIndex(sti, lineTable[lti].fileId); - } - - boolean isValid() { - return isValid; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ShortTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ShortTypeImpl.java deleted file mode 100644 index 03c19597a11..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ShortTypeImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class ShortTypeImpl extends PrimitiveTypeImpl implements ShortType { - ShortTypeImpl(VirtualMachine vm) { - super(vm); - } - - - public String signature() { - return "S"; - } - - PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException { - return vm.mirrorOf(((PrimitiveValueImpl)value).checkedShortValue()); - } - -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ShortValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ShortValueImpl.java deleted file mode 100644 index afbbcda18a6..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ShortValueImpl.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class ShortValueImpl extends PrimitiveValueImpl - implements ShortValue { - private short value; - - ShortValueImpl(VirtualMachine aVm,short aValue) { - super(aVm); - - value = aValue; - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof ShortValue)) { - return (value == ((ShortValue)obj).value()) && - super.equals(obj); - } else { - return false; - } - } - - public int hashCode() { - /* - * TO DO: Better hash code - */ - return intValue(); - } - - public int compareTo(ShortValue shortVal) { - return value() - shortVal.value(); - } - - public Type type() { - return vm.theShortType(); - } - - public short value() { - return value; - } - - public boolean booleanValue() { - return(value == 0)?false:true; - } - - public byte byteValue() { - return(byte)value; - } - - public char charValue() { - return(char)value; - } - - public short shortValue() { - return(short)value; - } - - public int intValue() { - return(int)value; - } - - public long longValue() { - return(long)value; - } - - public float floatValue() { - return(float)value; - } - - public double doubleValue() { - return(double)value; - } - - byte checkedByteValue() throws InvalidTypeException { - if ((value > Byte.MAX_VALUE) || (value < Byte.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to byte"); - } else { - return super.checkedByteValue(); - } - } - - char checkedCharValue() throws InvalidTypeException { - if ((value > Character.MAX_VALUE) || (value < Character.MIN_VALUE)) { - throw new InvalidTypeException("Can't convert " + value + " to char"); - } else { - return super.checkedCharValue(); - } - } - - public String toString() { - return "" + value; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/StackFrameImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/StackFrameImpl.java deleted file mode 100644 index 69461d3712a..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/StackFrameImpl.java +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright (c) 2002, 2005, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; -import sun.jvm.hotspot.oops.ObjectHeap; -import sun.jvm.hotspot.debugger.OopHandle; -import sun.jvm.hotspot.oops.Array; -import sun.jvm.hotspot.oops.ObjArray; -import sun.jvm.hotspot.oops.TypeArray; -import sun.jvm.hotspot.oops.Instance; -import sun.jvm.hotspot.runtime.BasicType; -import sun.jvm.hotspot.runtime.JavaVFrame; -import sun.jvm.hotspot.runtime.StackValue; -import sun.jvm.hotspot.runtime.StackValueCollection; -import sun.jvm.hotspot.utilities.Assert; -import java.util.List; -import java.util.Map; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Collections; - -public class StackFrameImpl extends MirrorImpl - implements StackFrame -{ - /* Once false, frame should not be used. - * access synchronized on (vm.state()) - */ - private boolean isValid = true; - - private final ThreadReferenceImpl thread; - private final JavaVFrame saFrame; - private final Location location; - private Map visibleVariables = null; - private ObjectReference thisObject = null; - - StackFrameImpl(VirtualMachine vm, ThreadReferenceImpl thread, - JavaVFrame jvf) { - super(vm); - this.thread = thread; - this.saFrame = jvf; - - sun.jvm.hotspot.oops.Method SAMethod = jvf.getMethod(); - - ReferenceType rt = ((VirtualMachineImpl)vm).referenceType(SAMethod.getMethodHolder()); - - this.location = new LocationImpl(vm, rt, SAMethod, (long)jvf.getBCI()); - } - - private void validateStackFrame() { - if (!isValid) { - throw new InvalidStackFrameException("Thread has been resumed"); - } - } - - JavaVFrame getJavaVFrame() { - return saFrame; - } - - /** - * Return the frame location. - * Need not be synchronized since it cannot be provably stale. - */ - public Location location() { - validateStackFrame(); - return location; - } - - /** - * Return the thread holding the frame. - * Need not be synchronized since it cannot be provably stale. - */ - public ThreadReference thread() { - validateStackFrame(); - return thread; - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof StackFrameImpl)) { - StackFrameImpl other = (StackFrameImpl)obj; - return (saFrame.equals(other.saFrame)); - } else { - return false; - } - } - - public int hashCode() { - return saFrame.hashCode(); - } - - public ObjectReference thisObject() { - validateStackFrame(); - MethodImpl currentMethod = (MethodImpl)location.method(); - if (currentMethod.isStatic() || currentMethod.isNative()) { - return null; - } - if (thisObject == null) { - StackValueCollection values = saFrame.getLocals(); - if (Assert.ASSERTS_ENABLED) { - Assert.that(values.size() > 0, "this is missing"); - } - // 'this' at index 0. - if (values.get(0).getType() == BasicType.getTConflict()) { - return null; - } - OopHandle handle = values.oopHandleAt(0); - ObjectHeap heap = vm.saObjectHeap(); - thisObject = vm.objectMirror(heap.newOop(handle)); - } - return thisObject; - } - - /** - * Build the visible variable map. - * Need not be synchronized since it cannot be provably stale. - */ - private void createVisibleVariables() throws AbsentInformationException { - if (visibleVariables == null) { - List allVariables = location.method().variables(); - Map map = new HashMap(allVariables.size()); - - Iterator iter = allVariables.iterator(); - while (iter.hasNext()) { - LocalVariableImpl variable = (LocalVariableImpl)iter.next(); - String name = variable.name(); - if (variable.isVisible(this)) { - LocalVariable existing = (LocalVariable)map.get(name); - if ((existing == null) || - variable.hides(existing)) { - map.put(name, variable); - } - } - } - visibleVariables = map; - } - } - - /** - * Return the list of visible variable in the frame. - * Need not be synchronized since it cannot be provably stale. - */ - public List visibleVariables() throws AbsentInformationException { - validateStackFrame(); - createVisibleVariables(); - List mapAsList = new ArrayList(visibleVariables.values()); - Collections.sort(mapAsList); - return mapAsList; - } - - /** - * Return a particular variable in the frame. - * Need not be synchronized since it cannot be provably stale. - */ - public LocalVariable visibleVariableByName(String name) throws AbsentInformationException { - validateStackFrame(); - createVisibleVariables(); - return (LocalVariable)visibleVariables.get(name); - } - - public Value getValue(LocalVariable variable) { - List list = new ArrayList(1); - list.add(variable); - Map map = getValues(list); - return (Value)map.get(variable); - } - - public Map getValues(List variables) { - validateStackFrame(); - StackValueCollection values = saFrame.getLocals(); - - int count = variables.size(); - Map map = new HashMap(count); - for (int ii=0; ii - private List ownedMonitorsInfo; // List - private ObjectReferenceImpl currentContendingMonitor; - - ThreadReferenceImpl(VirtualMachine aVm, sun.jvm.hotspot.runtime.JavaThread aRef) { - // We are given a JavaThread and save it in our myJavaThread field. - // But, our parent class is an ObjectReferenceImpl so we need an Oop - // for it. JavaThread is a wrapper around a Thread Oop so we get - // that Oop and give it to our super. - // We can get it back again by calling ref(). - super(aVm, (Instance)aRef.getThreadObj()); - myJavaThread = aRef; - } - - ThreadReferenceImpl(VirtualMachine vm, Instance oRef) { - // Instance must be of type java.lang.Thread - super(vm, oRef); - - // JavaThread retrieved from java.lang.Thread instance may be null. - // This is the case for threads not-started and for zombies. Wherever - // appropriate, check for null instead of resulting in NullPointerException. - myJavaThread = OopUtilities.threadOopGetJavaThread(oRef); - } - - // return value may be null. refer to the comment in constructor. - JavaThread getJavaThread() { - return myJavaThread; - } - - protected String description() { - return "ThreadReference " + uniqueID(); - } - - /** - * Note that we only cache the name string while suspended because - * it can change via Thread.setName arbitrarily - */ - public String name() { - return OopUtilities.threadOopGetName(ref()); - } - - public void suspend() { - vm.throwNotReadOnlyException("ThreadReference.suspend()"); - } - - public void resume() { - vm.throwNotReadOnlyException("ThreadReference.resume()"); - } - - public int suspendCount() { - // all threads are "suspended" when we attach to process or core. - // we interpret this as one suspend. - return 1; - } - - public void stop(ObjectReference throwable) throws InvalidTypeException { - vm.throwNotReadOnlyException("ThreadReference.stop()"); - } - - public void interrupt() { - vm.throwNotReadOnlyException("ThreadReference.interrupt()"); - } - - // refer to jvmtiEnv::GetThreadState - private int jvmtiGetThreadState() { - // get most state bits - int state = OopUtilities.threadOopGetThreadStatus(ref()); - // add more state bits - if (myJavaThread != null) { - JavaThreadState jts = myJavaThread.getThreadState(); - if (myJavaThread.isBeingExtSuspended()) { - state |= JVMTI_THREAD_STATE_SUSPENDED; - } - if (jts == JavaThreadState.IN_NATIVE) { - state |= JVMTI_THREAD_STATE_IN_NATIVE; - } - OSThread osThread = myJavaThread.getOSThread(); - if (osThread != null && osThread.interrupted()) { - state |= JVMTI_THREAD_STATE_INTERRUPTED; - } - } - return state; - } - - public int status() { - int state = jvmtiGetThreadState(); - int status = THREAD_STATUS_UNKNOWN; - // refer to map2jdwpThreadStatus in util.c (back-end) - if (! ((state & JVMTI_THREAD_STATE_ALIVE) != 0) ) { - if ((state & JVMTI_THREAD_STATE_TERMINATED) != 0) { - status = THREAD_STATUS_ZOMBIE; - } else { - status = THREAD_STATUS_NOT_STARTED; - } - } else { - if ((state & JVMTI_THREAD_STATE_SLEEPING) != 0) { - status = THREAD_STATUS_SLEEPING; - } else if ((state & JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER) != 0) { - status = THREAD_STATUS_MONITOR; - } else if ((state & JVMTI_THREAD_STATE_WAITING) != 0) { - status = THREAD_STATUS_WAIT; - } else if ((state & JVMTI_THREAD_STATE_RUNNABLE) != 0) { - status = THREAD_STATUS_RUNNING; - } - } - return status; - } - - public boolean isSuspended() { //fixme jjh - // If we want to support doing this for a VM which was being - // debugged, then we need to fix this. - // In the meantime, we will say all threads are suspended, - // otherwise, some things won't work, like the jdb 'up' cmd. - return true; - } - - public boolean isAtBreakpoint() { //fixme jjh - // If we want to support doing this for a VM which was being - // debugged, then we need to fix this. - return false; - } - - public ThreadGroupReference threadGroup() { - return (ThreadGroupReferenceImpl)vm.threadGroupMirror( - (Instance)OopUtilities.threadOopGetThreadGroup(ref())); - } - - public int frameCount() throws IncompatibleThreadStateException { //fixme jjh - privateFrames(0, -1); - return frames.size(); - } - - public List frames() throws IncompatibleThreadStateException { - return privateFrames(0, -1); - } - - public StackFrame frame(int index) throws IncompatibleThreadStateException { - List list = privateFrames(index, 1); - return (StackFrame)list.get(0); - } - - public List frames(int start, int length) - throws IncompatibleThreadStateException { - if (length < 0) { - throw new IndexOutOfBoundsException( - "length must be greater than or equal to zero"); - } - return privateFrames(start, length); - } - - /** - * Private version of frames() allows "-1" to specify all - * remaining frames. - */ - - private List privateFrames(int start, int length) - throws IncompatibleThreadStateException { - if (myJavaThread == null) { - // for zombies and yet-to-be-started threads we need to throw exception - throw new IncompatibleThreadStateException(); - } - if (frames == null) { - frames = new ArrayList(10); - JavaVFrame myvf = myJavaThread.getLastJavaVFrameDbg(); - while (myvf != null) { - StackFrame myFrame = new StackFrameImpl(vm, this, myvf); - //fixme jjh null should be a Location - frames.add(myFrame); - myvf = (JavaVFrame)myvf.javaSender(); - } - } - - List retVal; - if (frames.size() == 0) { - retVal = new ArrayList(0); - } else { - int toIndex = start + length; - if (length == -1) { - toIndex = frames.size(); - } - retVal = frames.subList(start, toIndex); - } - return Collections.unmodifiableList(retVal); - } - - // refer to JvmtiEnvBase::get_owned_monitors - public List ownedMonitors() throws IncompatibleThreadStateException { - if (vm.canGetOwnedMonitorInfo() == false) { - throw new UnsupportedOperationException(); - } - - if (myJavaThread == null) { - throw new IncompatibleThreadStateException(); - } - - if (ownedMonitors != null) { - return ownedMonitors; - } - - ownedMonitorsWithStackDepth(); - - for (Iterator omi = ownedMonitorsInfo.iterator(); omi.hasNext(); ) { - //FIXME : Change the MonitorInfoImpl cast to com.sun.jdi.MonitorInfo - // when hotspot start building with jdk1.6. - ownedMonitors.add(((MonitorInfoImpl)omi.next()).monitor()); - } - - return ownedMonitors; - } - - // new method since 1.6. - // Real body will be supplied later. - public List ownedMonitorsAndFrames() throws IncompatibleThreadStateException { - if (!vm.canGetMonitorFrameInfo()) { - throw new UnsupportedOperationException( - "target does not support getting Monitor Frame Info"); - } - - if (myJavaThread == null) { - throw new IncompatibleThreadStateException(); - } - - if (ownedMonitorsInfo != null) { - return ownedMonitorsInfo; - } - - ownedMonitorsWithStackDepth(); - return ownedMonitorsInfo; - } - - private void ownedMonitorsWithStackDepth() { - - ownedMonitorsInfo = new ArrayList(); - List lockedObjects = new ArrayList(); // List - List stackDepth = new ArrayList(); // List - ObjectMonitor waitingMonitor = myJavaThread.getCurrentWaitingMonitor(); - ObjectMonitor pendingMonitor = myJavaThread.getCurrentPendingMonitor(); - OopHandle waitingObj = null; - if (waitingMonitor != null) { - // save object of current wait() call (if any) for later comparison - waitingObj = waitingMonitor.object(); - } - OopHandle pendingObj = null; - if (pendingMonitor != null) { - // save object of current enter() call (if any) for later comparison - pendingObj = pendingMonitor.object(); - } - - JavaVFrame frame = myJavaThread.getLastJavaVFrameDbg(); - int depth=0; - while (frame != null) { - List frameMonitors = frame.getMonitors(); // List - for (Iterator miItr = frameMonitors.iterator(); miItr.hasNext(); ) { - sun.jvm.hotspot.runtime.MonitorInfo mi = (sun.jvm.hotspot.runtime.MonitorInfo) miItr.next(); - if (mi.eliminated() && frame.isCompiledFrame()) { - continue; // skip eliminated monitor - } - OopHandle obj = mi.owner(); - if (obj == null) { - // this monitor doesn't have an owning object so skip it - continue; - } - - if (obj.equals(waitingObj)) { - // the thread is waiting on this monitor so it isn't really owned - continue; - } - - if (obj.equals(pendingObj)) { - // the thread is pending on this monitor so it isn't really owned - continue; - } - - boolean found = false; - for (Iterator loItr = lockedObjects.iterator(); loItr.hasNext(); ) { - // check for recursive locks - if (obj.equals(loItr.next())) { - found = true; - break; - } - } - if (found) { - // already have this object so don't include it - continue; - } - // add the owning object to our list - lockedObjects.add(obj); - stackDepth.add(new Integer(depth)); - } - frame = (JavaVFrame) frame.javaSender(); - depth++; - } - - // now convert List to List - ObjectHeap heap = vm.saObjectHeap(); - Iterator stk = stackDepth.iterator(); - for (Iterator loItr = lockedObjects.iterator(); loItr.hasNext(); ) { - Oop obj = heap.newOop((OopHandle)loItr.next()); - ownedMonitorsInfo.add(new MonitorInfoImpl(vm, vm.objectMirror(obj), this, - ((Integer)stk.next()).intValue())); - } - } - - // refer to JvmtiEnvBase::get_current_contended_monitor - public ObjectReference currentContendedMonitor() - throws IncompatibleThreadStateException { - if (vm.canGetCurrentContendedMonitor() == false) { - throw new UnsupportedOperationException(); - } - - if (myJavaThread == null) { - throw new IncompatibleThreadStateException(); - } - ObjectMonitor mon = myJavaThread.getCurrentWaitingMonitor(); - if (mon == null) { - // thread is not doing an Object.wait() call - mon = myJavaThread.getCurrentPendingMonitor(); - if (mon != null) { - OopHandle handle = mon.object(); - // If obj == NULL, then ObjectMonitor is raw which doesn't count - // as contended for this API - return vm.objectMirror(vm.saObjectHeap().newOop(handle)); - } else { - // no contended ObjectMonitor - return null; - } - } else { - // thread is doing an Object.wait() call - OopHandle handle = mon.object(); - if (Assert.ASSERTS_ENABLED) { - Assert.that(handle != null, "Object.wait() should have an object"); - } - Oop obj = vm.saObjectHeap().newOop(handle); - return vm.objectMirror(obj); - } - } - - - public void popFrames(StackFrame frame) throws IncompatibleThreadStateException { - vm.throwNotReadOnlyException("ThreadReference.popFrames()"); - } - - public void forceEarlyReturn(Value returnValue) throws IncompatibleThreadStateException { - vm.throwNotReadOnlyException("ThreadReference.forceEarlyReturn()"); - } - - public String toString() { - return "instance of " + referenceType().name() + - "(name='" + name() + "', " + "id=" + uniqueID() + ")"; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/TypeComponentImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/TypeComponentImpl.java deleted file mode 100644 index 3a748430fc8..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/TypeComponentImpl.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; -import sun.jvm.hotspot.oops.Symbol; -import sun.jvm.hotspot.oops.Oop; -import sun.jvm.hotspot.oops.InstanceKlass; - -import java.util.List; - -/** - * There is no SA class that corresponds to this. Therefore, - * all the methods in this class which involve the SA mirror class - * have to be implemented in the subclasses. - */ -abstract public class TypeComponentImpl extends MirrorImpl - implements TypeComponent { - - protected final ReferenceTypeImpl declaringType; - protected String signature; - - TypeComponentImpl(VirtualMachine vm, ReferenceTypeImpl declaringType) { - super(vm); - this.declaringType = declaringType; - } - - public ReferenceType declaringType() { - return declaringType; - } - - public String signature() { - return signature; - } - - abstract public String name(); - abstract public int modifiers(); - abstract public boolean isPackagePrivate(); - abstract public boolean isPrivate(); - abstract public boolean isProtected(); - abstract public boolean isPublic(); - abstract public boolean isStatic(); - abstract public boolean isFinal(); - abstract public int hashCode(); -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/TypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/TypeImpl.java deleted file mode 100644 index c2e0091c69f..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/TypeImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public abstract class TypeImpl extends MirrorImpl implements Type -{ - private String typeName; - - TypeImpl(VirtualMachine aVm) { - super(aVm); - } - - public abstract String signature(); - - public String name() { - if (typeName == null) { - JNITypeParser parser = new JNITypeParser(signature()); - typeName = parser.typeName(); - } - return typeName; - } - - public boolean equals(Object obj) { - if ((obj != null) && (obj instanceof Type)) { - Type other = (Type)obj; - return signature().equals(other.signature()) && - super.equals(obj); - } else { - return false; - } - } - - public int hashCode() { - return signature().hashCode(); - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VMModifiers.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VMModifiers.java deleted file mode 100644 index a6adb7341fe..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VMModifiers.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import sun.jvm.hotspot.runtime.ClassConstants; -import com.sun.jdi.*; - -public interface VMModifiers extends ClassConstants { - int PUBLIC = (int) JVM_ACC_PUBLIC; /* visible to everyone */ - int PRIVATE = (int) JVM_ACC_PRIVATE; /* visible only to the defining class */ - int PROTECTED = (int) JVM_ACC_PROTECTED; /* visible to subclasses */ - int STATIC = (int) JVM_ACC_STATIC; /* instance variable is static */ - int FINAL = (int) JVM_ACC_FINAL; /* no further subclassing, overriding */ - int SYNCHRONIZED = (int) JVM_ACC_SYNCHRONIZED; /* wrap method call in monitor lock */ - int VOLATILE = (int) JVM_ACC_VOLATILE; /* can cache in registers */ - int BRIDGE = (int) JVM_ACC_BRIDGE; /* bridge method generated by compiler */ - int TRANSIENT = (int) JVM_ACC_TRANSIENT; /* not persistant */ - int VARARGS = (int) JVM_ACC_VARARGS; /* method declared with variable number of args */ - int IS_ENUM_CONSTANT = (int) JVM_ACC_ENUM; /* field is declared as element of enum */ - int NATIVE = (int) JVM_ACC_NATIVE; /* implemented in C */ - int INTERFACE = (int) JVM_ACC_INTERFACE; /* class is an interface */ - int ABSTRACT = (int) JVM_ACC_ABSTRACT; /* no definition provided */ - int SYNTHETIC = (int) JVM_ACC_SYNTHETIC; /* not in source code */ -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ValueContainer.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ValueContainer.java deleted file mode 100644 index 22ba42f8600..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ValueContainer.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -/* - * This interface allows us to pass fields, variables, and - * array components through the same interfaces. This currently allows - * more common code for type checking. In the future we could use it for - * more. - */ -interface ValueContainer { - Type type() throws ClassNotLoadedException; - Type findType(String signature) throws ClassNotLoadedException; - String typeName(); - String signature(); -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ValueImpl.java deleted file mode 100644 index b046ae5d71a..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/ValueImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -abstract class ValueImpl extends MirrorImpl implements Value { - ValueImpl(VirtualMachine aVm) { - super(aVm); - } - - // type() is in the subclasses -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VirtualMachineImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VirtualMachineImpl.java deleted file mode 100644 index be256c24659..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VirtualMachineImpl.java +++ /dev/null @@ -1,1224 +0,0 @@ -/* - * Copyright (c) 2002, 2012, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; -import com.sun.jdi.event.EventQueue; -import com.sun.jdi.request.EventRequestManager; - -import sun.jvm.hotspot.HotSpotAgent; -import sun.jvm.hotspot.types.TypeDataBase; -import sun.jvm.hotspot.oops.Klass; -import sun.jvm.hotspot.oops.InstanceKlass; -import sun.jvm.hotspot.oops.ArrayKlass; -import sun.jvm.hotspot.oops.ObjArrayKlass; -import sun.jvm.hotspot.oops.TypeArrayKlass; -import sun.jvm.hotspot.oops.Oop; -import sun.jvm.hotspot.oops.Instance; -import sun.jvm.hotspot.oops.Array; -import sun.jvm.hotspot.oops.ObjArray; -import sun.jvm.hotspot.oops.TypeArray; -import sun.jvm.hotspot.oops.Symbol; -import sun.jvm.hotspot.oops.ObjectHeap; -import sun.jvm.hotspot.oops.DefaultHeapVisitor; -import sun.jvm.hotspot.oops.JVMDIClassStatus; -import sun.jvm.hotspot.runtime.VM; -import sun.jvm.hotspot.runtime.JavaThread; -import sun.jvm.hotspot.memory.SystemDictionary; -import sun.jvm.hotspot.memory.SymbolTable; -import sun.jvm.hotspot.memory.Universe; -import sun.jvm.hotspot.utilities.Assert; - -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.Iterator; -import java.util.Collections; -import java.util.HashMap; -import java.util.Observer; -import java.util.StringTokenizer; -import java.lang.ref.SoftReference; -import java.lang.ref.ReferenceQueue; -import java.lang.ref.Reference; - -public class VirtualMachineImpl extends MirrorImpl implements PathSearchingVirtualMachine { - - private HotSpotAgent saAgent = new HotSpotAgent(); - private VM saVM; - private Universe saUniverse; - private SystemDictionary saSystemDictionary; - private SymbolTable saSymbolTable; - private ObjectHeap saObjectHeap; - - VM saVM() { - return saVM; - } - - SystemDictionary saSystemDictionary() { - return saSystemDictionary; - } - - SymbolTable saSymbolTable() { - return saSymbolTable; - } - - Universe saUniverse() { - return saUniverse; - } - - ObjectHeap saObjectHeap() { - return saObjectHeap; - } - - com.sun.jdi.VirtualMachineManager vmmgr; - - private final ThreadGroup threadGroupForJDI; - - // Per-vm singletons for primitive types and for void. - // singleton-ness protected by "synchronized(this)". - private BooleanType theBooleanType; - private ByteType theByteType; - private CharType theCharType; - private ShortType theShortType; - private IntegerType theIntegerType; - private LongType theLongType; - private FloatType theFloatType; - private DoubleType theDoubleType; - - private VoidType theVoidType; - - private VoidValue voidVal; - private Map typesByID; // Map - private List typesBySignature; // List - used in signature search - private boolean retrievedAllTypes = false; - private List bootstrapClasses; // all bootstrap classes - private ArrayList allThreads; - private ArrayList topLevelGroups; - final int sequenceNumber; - - // ObjectReference cache - // "objectsByID" protected by "synchronized(this)". - private final Map objectsByID = new HashMap(); - private final ReferenceQueue referenceQueue = new ReferenceQueue(); - - // names of some well-known classes to jdi - private Symbol javaLangString; - private Symbol javaLangThread; - private Symbol javaLangThreadGroup; - private Symbol javaLangClass; - private Symbol javaLangClassLoader; - - // used in ReferenceTypeImpl.isThrowableBacktraceField - private Symbol javaLangThrowable; - - // names of classes used in array assignment check - // refer to ArrayTypeImpl.isAssignableTo - private Symbol javaLangObject; - private Symbol javaLangCloneable; - private Symbol javaIoSerializable; - - // symbol used in ClassTypeImpl.isEnum check - private Symbol javaLangEnum; - - Symbol javaLangObject() { - return javaLangObject; - } - - Symbol javaLangCloneable() { - return javaLangCloneable; - } - - Symbol javaIoSerializable() { - return javaIoSerializable; - } - - Symbol javaLangEnum() { - return javaLangEnum; - } - - Symbol javaLangThrowable() { - return javaLangThrowable; - } - - // name of the current default stratum - private String defaultStratum; - - // initialize known class name symbols - private void initClassNameSymbols() { - SymbolTable st = saSymbolTable(); - javaLangString = st.probe("java/lang/String"); - javaLangThread = st.probe("java/lang/Thread"); - javaLangThreadGroup = st.probe("java/lang/ThreadGroup"); - javaLangClass = st.probe("java/lang/Class"); - javaLangClassLoader = st.probe("java/lang/ClassLoader"); - javaLangThrowable = st.probe("java/lang/Throwable"); - javaLangObject = st.probe("java/lang/Object"); - javaLangCloneable = st.probe("java/lang/Cloneable"); - javaIoSerializable = st.probe("java/io/Serializable"); - javaLangEnum = st.probe("java/lang/Enum"); - } - - private void init() { - saVM = VM.getVM(); - saUniverse = saVM.getUniverse(); - saSystemDictionary = saVM.getSystemDictionary(); - saSymbolTable = saVM.getSymbolTable(); - saObjectHeap = saVM.getObjectHeap(); - initClassNameSymbols(); - } - - static public VirtualMachineImpl createVirtualMachineForCorefile(VirtualMachineManager mgr, - String javaExecutableName, - String coreFileName, - int sequenceNumber) - throws Exception { - if (Assert.ASSERTS_ENABLED) { - Assert.that(coreFileName != null, "SA VirtualMachineImpl: core filename = null is not yet implemented"); - } - if (Assert.ASSERTS_ENABLED) { - Assert.that(javaExecutableName != null, "SA VirtualMachineImpl: java executable = null is not yet implemented"); - } - - VirtualMachineImpl myvm = new VirtualMachineImpl(mgr, sequenceNumber); - try { - myvm.saAgent.attach(javaExecutableName, coreFileName); - myvm.init(); - } catch (Exception ee) { - myvm.saAgent.detach(); - throw ee; - } - return myvm; - } - - static public VirtualMachineImpl createVirtualMachineForPID(VirtualMachineManager mgr, - int pid, - int sequenceNumber) - throws Exception { - - VirtualMachineImpl myvm = new VirtualMachineImpl(mgr, sequenceNumber); - try { - myvm.saAgent.attach(pid); - myvm.init(); - } catch (Exception ee) { - myvm.saAgent.detach(); - throw ee; - } - return myvm; - } - - static public VirtualMachineImpl createVirtualMachineForServer(VirtualMachineManager mgr, - String server, - int sequenceNumber) - throws Exception { - if (Assert.ASSERTS_ENABLED) { - Assert.that(server != null, "SA VirtualMachineImpl: DebugServer = null is not yet implemented"); - } - - VirtualMachineImpl myvm = new VirtualMachineImpl(mgr, sequenceNumber); - try { - myvm.saAgent.attach(server); - myvm.init(); - } catch (Exception ee) { - myvm.saAgent.detach(); - throw ee; - } - return myvm; - } - - - VirtualMachineImpl(VirtualMachineManager mgr, int sequenceNumber) - throws Exception { - super(null); // Can't use super(this) - vm = this; - - this.sequenceNumber = sequenceNumber; - this.vmmgr = mgr; - - /* Create ThreadGroup to be used by all threads servicing - * this VM. - */ - threadGroupForJDI = new ThreadGroup("JDI [" + - this.hashCode() + "]"); - - ((com.sun.tools.jdi.VirtualMachineManagerImpl)mgr).addVirtualMachine(this); - - // By default SA agent classes prefer Windows process debugger - // to windbg debugger. SA expects special properties to be set - // to choose other debuggers. We will set those here before - // attaching to SA agent. - - System.setProperty("sun.jvm.hotspot.debugger.useWindbgDebugger", "true"); - } - - // we reflectively use newly spec'ed class because our ALT_BOOTDIR - // is 1.4.2 and not 1.5. - private static Class vmCannotBeModifiedExceptionClass = null; - void throwNotReadOnlyException(String operation) { - RuntimeException re = null; - if (vmCannotBeModifiedExceptionClass == null) { - try { - vmCannotBeModifiedExceptionClass = Class.forName("com.sun.jdi.VMCannotBeModifiedException"); - } catch (ClassNotFoundException cnfe) { - vmCannotBeModifiedExceptionClass = UnsupportedOperationException.class; - } - } - try { - re = (RuntimeException) vmCannotBeModifiedExceptionClass.newInstance(); - } catch (Exception exp) { - re = new RuntimeException(exp.getMessage()); - } - throw re; - } - - public boolean equals(Object obj) { - // Oh boy; big recursion troubles if we don't have this! - // See MirrorImpl.equals - return this == obj; - } - - public int hashCode() { - // big recursion if we don't have this. See MirrorImpl.hashCode - return System.identityHashCode(this); - } - - public List classesByName(String className) { - String signature = JNITypeParser.typeNameToSignature(className); - List list; - if (!retrievedAllTypes) { - retrieveAllClasses(); - } - list = findReferenceTypes(signature); - return Collections.unmodifiableList(list); - } - - public List allClasses() { - if (!retrievedAllTypes) { - retrieveAllClasses(); - } - ArrayList a; - synchronized (this) { - a = new ArrayList(typesBySignature); - } - return Collections.unmodifiableList(a); - } - - // classes loaded by bootstrap loader - List bootstrapClasses() { - if (bootstrapClasses == null) { - bootstrapClasses = new ArrayList(); - List all = allClasses(); - for (Iterator itr = all.iterator(); itr.hasNext();) { - ReferenceType type = (ReferenceType) itr.next(); - if (type.classLoader() == null) { - bootstrapClasses.add(type); - } - } - } - return bootstrapClasses; - } - - private synchronized List findReferenceTypes(String signature) { - if (typesByID == null) { - return new ArrayList(0); - } - - // we haven't sorted types by signatures. But we can take - // advantage of comparing symbols instead of name. In the worst - // case, we will be comparing N addresses rather than N strings - // where N being total no. of classes in allClasses() list. - - // The signature could be Lx/y/z; or [.... - // If it is Lx/y/z; the internal type name is x/y/x - // for array klasses internal type name is same as - // signature - String typeName = null; - if (signature.charAt(0) == 'L') { - typeName = signature.substring(1, signature.length() - 1); - } else { - typeName = signature; - } - - Symbol typeNameSym = saSymbolTable().probe(typeName); - // if there is no symbol in VM, then we wouldn't have that type - if (typeNameSym == null) { - return new ArrayList(0); - } - - Iterator iter = typesBySignature.iterator(); - List list = new ArrayList(); - while (iter.hasNext()) { - // We have cached type name as symbol in reference type - ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next(); - if (typeNameSym.equals(type.typeNameAsSymbol())) { - list.add(type); - } - } - return list; - } - - private void retrieveAllClasses() { - final List saKlasses = new ArrayList(); - SystemDictionary.ClassVisitor visitor = new SystemDictionary.ClassVisitor() { - public void visit(Klass k) { - for (Klass l = k; l != null; l = l.arrayKlassOrNull()) { - // for non-array classes filter out un-prepared classes - // refer to 'allClasses' in share/back/VirtualMachineImpl.c - if (l instanceof ArrayKlass) { - saKlasses.add(l); - } else { - int status = l.getClassStatus(); - if ((status & JVMDIClassStatus.PREPARED) != 0) { - saKlasses.add(l); - } - } - } - } - }; - - // refer to jvmtiGetLoadedClasses.cpp - getLoadedClasses in VM code. - - // classes from SystemDictionary - saSystemDictionary.classesDo(visitor); - - // From SystemDictionary we do not get primitive single - // dimensional array classes. add primitive single dimensional array - // klasses from Universe. - saVM.getUniverse().basicTypeClassesDo(visitor); - - // Hold lock during processing to improve performance - // and to have safe check/set of retrievedAllTypes - synchronized (this) { - if (!retrievedAllTypes) { - // Number of classes - int count = saKlasses.size(); - for (int ii = 0; ii < count; ii++) { - Klass kk = (Klass)saKlasses.get(ii); - ReferenceTypeImpl type = referenceType(kk); - } - retrievedAllTypes = true; - } - } - } - - ReferenceTypeImpl referenceType(Klass kk) { - ReferenceTypeImpl retType = null; - synchronized (this) { - if (typesByID != null) { - retType = (ReferenceTypeImpl)typesByID.get(kk); - } - if (retType == null) { - retType = addReferenceType(kk); - } - } - return retType; - } - - private void initReferenceTypes() { - typesByID = new HashMap(); - typesBySignature = new ArrayList(); - } - - private synchronized ReferenceTypeImpl addReferenceType(Klass kk) { - if (typesByID == null) { - initReferenceTypes(); - } - ReferenceTypeImpl newRefType = null; - if (kk instanceof ObjArrayKlass || kk instanceof TypeArrayKlass) { - newRefType = new ArrayTypeImpl(this, (ArrayKlass)kk); - } else if (kk instanceof InstanceKlass) { - if (kk.isInterface()) { - newRefType = new InterfaceTypeImpl(this, (InstanceKlass)kk); - } else { - newRefType = new ClassTypeImpl(this, (InstanceKlass)kk); - } - } else { - throw new RuntimeException("should not reach here:" + kk); - } - - typesByID.put(kk, newRefType); - typesBySignature.add(newRefType); - return newRefType; - } - - ThreadGroup threadGroupForJDI() { - return threadGroupForJDI; - } - - public void redefineClasses(Map classToBytes) { - throwNotReadOnlyException("VirtualMachineImpl.redefineClasses()"); - } - - private List getAllThreads() { - if (allThreads == null) { - allThreads = new ArrayList(10); // Might be enough, might not be - for (sun.jvm.hotspot.runtime.JavaThread thread = - saVM.getThreads().first(); thread != null; - thread = thread.next()) { - // refer to JvmtiEnv::GetAllThreads in jvmtiEnv.cpp. - // filter out the hidden-from-external-view threads. - if (thread.isHiddenFromExternalView() == false) { - ThreadReferenceImpl myThread = threadMirror(thread); - allThreads.add(myThread); - } - } - } - return allThreads; - } - - public List allThreads() { //fixme jjh - return Collections.unmodifiableList(getAllThreads()); - } - - public void suspend() { - throwNotReadOnlyException("VirtualMachineImpl.suspend()"); - } - - public void resume() { - throwNotReadOnlyException("VirtualMachineImpl.resume()"); - } - - public List topLevelThreadGroups() { //fixme jjh - // The doc for ThreadGroup says that The top-level thread group - // is the only thread group whose parent is null. This means there is - // only one top level thread group. There will be a thread in this - // group so we will just find a thread whose threadgroup has no parent - // and that will be it. - - if (topLevelGroups == null) { - topLevelGroups = new ArrayList(1); - Iterator myIt = getAllThreads().iterator(); - while (myIt.hasNext()) { - ThreadReferenceImpl myThread = (ThreadReferenceImpl)myIt.next(); - ThreadGroupReference myGroup = myThread.threadGroup(); - ThreadGroupReference myParent = myGroup.parent(); - if (myGroup.parent() == null) { - topLevelGroups.add(myGroup); - break; - } - } - } - return Collections.unmodifiableList(topLevelGroups); - } - - public EventQueue eventQueue() { - throwNotReadOnlyException("VirtualMachine.eventQueue()"); - return null; - } - - public EventRequestManager eventRequestManager() { - throwNotReadOnlyException("VirtualMachineImpl.eventRequestManager()"); - return null; - } - - public BooleanValue mirrorOf(boolean value) { - return new BooleanValueImpl(this,value); - } - - public ByteValue mirrorOf(byte value) { - return new ByteValueImpl(this,value); - } - - public CharValue mirrorOf(char value) { - return new CharValueImpl(this,value); - } - - public ShortValue mirrorOf(short value) { - return new ShortValueImpl(this,value); - } - - public IntegerValue mirrorOf(int value) { - return new IntegerValueImpl(this,value); - } - - public LongValue mirrorOf(long value) { - return new LongValueImpl(this,value); - } - - public FloatValue mirrorOf(float value) { - return new FloatValueImpl(this,value); - } - - public DoubleValue mirrorOf(double value) { - return new DoubleValueImpl(this,value); - } - - public StringReference mirrorOf(String value) { - throwNotReadOnlyException("VirtualMachinestop.mirrorOf(String)"); - return null; - } - - public VoidValue mirrorOfVoid() { - if (voidVal == null) { - voidVal = new VoidValueImpl(this); - } - return voidVal; - } - - - public Process process() { - throwNotReadOnlyException("VirtualMachine.process"); - return null; - } - - // dispose observer for Class re-use. refer to ConnectorImpl. - private Observer disposeObserver; - - // ConnectorImpl loaded by a different class loader can not access it. - // i.e., runtime package of is not the same that of - // when L1 != L2. So, package private method - // can be called reflectively after using setAccessible(true). - - void setDisposeObserver(Observer observer) { - disposeObserver = observer; - } - - private void notifyDispose() { - if (Assert.ASSERTS_ENABLED) { - Assert.that(disposeObserver != null, "null VM.dispose observer"); - } - disposeObserver.update(null, null); - } - - public void dispose() { - saAgent.detach(); - notifyDispose(); - } - - public void exit(int exitCode) { - throwNotReadOnlyException("VirtualMachine.exit(int)"); - } - - public boolean canBeModified() { - return false; - } - - public boolean canWatchFieldModification() { - return false; - } - - public boolean canWatchFieldAccess() { - return false; - } - - public boolean canGetBytecodes() { - return true; - } - - public boolean canGetSyntheticAttribute() { - return true; - } - - // FIXME: For now, all monitor capabilities are disabled - public boolean canGetOwnedMonitorInfo() { - return false; - } - - public boolean canGetCurrentContendedMonitor() { - return false; - } - - public boolean canGetMonitorInfo() { - return false; - } - - // because this SA works only with 1.5 and update releases - // this should always succeed unlike JVMDI/JDI. - public boolean canGet1_5LanguageFeatures() { - return true; - } - - public boolean canUseInstanceFilters() { - return false; - } - - public boolean canRedefineClasses() { - return false; - } - - public boolean canAddMethod() { - return false; - } - - public boolean canUnrestrictedlyRedefineClasses() { - return false; - } - - public boolean canPopFrames() { - return false; - } - - public boolean canGetSourceDebugExtension() { - // We can use InstanceKlass.getSourceDebugExtension only if - // ClassFileParser parsed the info. But, ClassFileParser parses - // SourceDebugExtension attribute only if corresponding JVMDI/TI - // capability is set to true. Currently, vmStructs does not expose - // JVMDI/TI capabilities and hence we conservatively assume false. - return false; - } - - public boolean canRequestVMDeathEvent() { - return false; - } - - // new method since 1.6 - public boolean canForceEarlyReturn() { - return false; - } - - // new method since 1.6 - public boolean canGetConstantPool() { - return true; - } - - // new method since 1.6 - public boolean canGetClassFileVersion() { - return true; - } - - // new method since 1.6. - public boolean canGetMethodReturnValues() { - return false; - } - - // new method since 1.6 - // Real body will be supplied later. - public boolean canGetInstanceInfo() { - return true; - } - - // new method since 1.6 - public boolean canUseSourceNameFilters() { - return false; - } - - // new method since 1.6. - public boolean canRequestMonitorEvents() { - return false; - } - - // new method since 1.6. - public boolean canGetMonitorFrameInfo() { - return true; - } - - // new method since 1.6 - // Real body will be supplied later. - public long[] instanceCounts(List classes) { - if (!canGetInstanceInfo()) { - throw new UnsupportedOperationException( - "target does not support getting instances"); - } - - final long[] retValue = new long[classes.size()] ; - - final Klass [] klassArray = new Klass[classes.size()]; - - boolean allAbstractClasses = true; - for (int i=0; i < classes.size(); i++) { - ReferenceTypeImpl rti = (ReferenceTypeImpl)classes.get(i); - klassArray[i] = rti.ref(); - retValue[i]=0; - if (!(rti.isAbstract() || ((ReferenceType)rti instanceof InterfaceType))) { - allAbstractClasses = false; - } - } - - if (allAbstractClasses) { - return retValue; - } - final int size = classes.size(); - saObjectHeap.iterate(new DefaultHeapVisitor() { - public boolean doObj(Oop oop) { - for (int i=0; i < size; i++) { - if (klassArray[i].equals(oop.getKlass())) { - retValue[i]++; - break; - } - } - return false; - } - }); - - return retValue; - } - - private List getPath (String pathName) { - String cp = saVM.getSystemProperty(pathName); - String pathSep = saVM.getSystemProperty("path.separator"); - ArrayList al = new ArrayList(); - StringTokenizer st = new StringTokenizer(cp, pathSep); - while (st.hasMoreTokens()) { - al.add(st.nextToken()); - } - al.trimToSize(); - return al; - } - - public List classPath() { - return getPath("java.class.path"); - } - - public List bootClassPath() { - return Collections.emptyList(); - } - - public String baseDirectory() { - return saVM.getSystemProperty("user.dir"); - } - - public void setDefaultStratum(String stratum) { - defaultStratum = stratum; - } - - public String getDefaultStratum() { - return defaultStratum; - } - - public String description() { - return java.text.MessageFormat.format(java.util.ResourceBundle. - getBundle("com.sun.tools.jdi.resources.jdi").getString("version_format"), - "" + vmmgr.majorInterfaceVersion(), - "" + vmmgr.minorInterfaceVersion(), - name()); - } - - public String version() { - return saVM.getSystemProperty("java.version"); - } - - public String name() { - StringBuffer sb = new StringBuffer(); - sb.append("JVM version "); - sb.append(version()); - sb.append(" ("); - sb.append(saVM.getSystemProperty("java.vm.name")); - sb.append(", "); - sb.append(saVM.getSystemProperty("java.vm.info")); - sb.append(")"); - return sb.toString(); - } - - // from interface Mirror - public VirtualMachine virtualMachine() { - return this; - } - - public String toString() { - return name(); - } - - public void setDebugTraceMode(int traceFlags) { - // spec. says output is implementation dependent - // and trace mode may be ignored. we ignore it :-) - } - - // heap walking API - - // capability check - public boolean canWalkHeap() { - return true; - } - - // return a list of all objects in heap - public List/**/ allObjects() { - final List objects = new ArrayList(0); - saObjectHeap.iterate( - new DefaultHeapVisitor() { - public boolean doObj(Oop oop) { - objects.add(objectMirror(oop)); - return false; - } - }); - return objects; - } - - // equivalent to objectsByType(type, true) - public List/**/ objectsByType(ReferenceType type) { - return objectsByType(type, true); - } - - // returns objects of type exactly equal to given type - private List/**/ objectsByExactType(ReferenceType type) { - final List objects = new ArrayList(0); - final Klass givenKls = ((ReferenceTypeImpl)type).ref(); - saObjectHeap.iterate(new DefaultHeapVisitor() { - public boolean doObj(Oop oop) { - if (givenKls.equals(oop.getKlass())) { - objects.add(objectMirror(oop)); - } - return false; - } - }); - return objects; - } - - // returns objects of given type as well as it's subtypes - private List/**/ objectsBySubType(ReferenceType type) { - final List objects = new ArrayList(0); - final ReferenceType givenType = type; - saObjectHeap.iterate(new DefaultHeapVisitor() { - public boolean doObj(Oop oop) { - ReferenceTypeImpl curType = (ReferenceTypeImpl) referenceType(oop.getKlass()); - if (curType.isAssignableTo(givenType)) { - objects.add(objectMirror(oop)); - } - return false; - } - }); - return objects; - } - - // includeSubtypes - do you want to include subclass/subtype instances of given - // ReferenceType or do we want objects of exact type only? - public List/**/ objectsByType(ReferenceType type, boolean includeSubtypes) { - Klass kls = ((ReferenceTypeImpl)type).ref(); - if (kls instanceof InstanceKlass) { - InstanceKlass ik = (InstanceKlass) kls; - // if the Klass is final or if there are no subklasses loaded yet - if (ik.getAccessFlagsObj().isFinal() || ik.getSubklassKlass() == null) { - includeSubtypes = false; - } - } else { - // no subtypes for primitive array types - ArrayTypeImpl arrayType = (ArrayTypeImpl) type; - try { - Type componentType = arrayType.componentType(); - if (componentType instanceof PrimitiveType) { - includeSubtypes = false; - } - } catch (ClassNotLoadedException cnle) { - // ignore. component type not yet loaded - } - } - - if (includeSubtypes) { - return objectsBySubType(type); - } else { - return objectsByExactType(type); - } - } - - Type findBootType(String signature) throws ClassNotLoadedException { - List types = allClasses(); - Iterator iter = types.iterator(); - while (iter.hasNext()) { - ReferenceType type = (ReferenceType)iter.next(); - if ((type.classLoader() == null) && - (type.signature().equals(signature))) { - return type; - } - } - JNITypeParser parser = new JNITypeParser(signature); - throw new ClassNotLoadedException(parser.typeName(), - "Type " + parser.typeName() + " not loaded"); - } - - BooleanType theBooleanType() { - if (theBooleanType == null) { - synchronized(this) { - if (theBooleanType == null) { - theBooleanType = new BooleanTypeImpl(this); - } - } - } - return theBooleanType; - } - - ByteType theByteType() { - if (theByteType == null) { - synchronized(this) { - if (theByteType == null) { - theByteType = new ByteTypeImpl(this); - } - } - } - return theByteType; - } - - CharType theCharType() { - if (theCharType == null) { - synchronized(this) { - if (theCharType == null) { - theCharType = new CharTypeImpl(this); - } - } - } - return theCharType; - } - - ShortType theShortType() { - if (theShortType == null) { - synchronized(this) { - if (theShortType == null) { - theShortType = new ShortTypeImpl(this); - } - } - } - return theShortType; - } - - IntegerType theIntegerType() { - if (theIntegerType == null) { - synchronized(this) { - if (theIntegerType == null) { - theIntegerType = new IntegerTypeImpl(this); - } - } - } - return theIntegerType; - } - - LongType theLongType() { - if (theLongType == null) { - synchronized(this) { - if (theLongType == null) { - theLongType = new LongTypeImpl(this); - } - } - } - return theLongType; - } - - FloatType theFloatType() { - if (theFloatType == null) { - synchronized(this) { - if (theFloatType == null) { - theFloatType = new FloatTypeImpl(this); - } - } - } - return theFloatType; - } - - DoubleType theDoubleType() { - if (theDoubleType == null) { - synchronized(this) { - if (theDoubleType == null) { - theDoubleType = new DoubleTypeImpl(this); - } - } - } - return theDoubleType; - } - - VoidType theVoidType() { - if (theVoidType == null) { - synchronized(this) { - if (theVoidType == null) { - theVoidType = new VoidTypeImpl(this); - } - } - } - return theVoidType; - } - - PrimitiveType primitiveTypeMirror(char tag) { - switch (tag) { - case 'Z': - return theBooleanType(); - case 'B': - return theByteType(); - case 'C': - return theCharType(); - case 'S': - return theShortType(); - case 'I': - return theIntegerType(); - case 'J': - return theLongType(); - case 'F': - return theFloatType(); - case 'D': - return theDoubleType(); - default: - throw new IllegalArgumentException("Unrecognized primitive tag " + tag); - } - } - - private void processQueue() { - Reference ref; - while ((ref = referenceQueue.poll()) != null) { - SoftObjectReference softRef = (SoftObjectReference)ref; - removeObjectMirror(softRef); - } - } - - // Address value is used as uniqueID by ObjectReferenceImpl - long getAddressValue(Oop obj) { - return vm.saVM.getDebugger().getAddressValue(obj.getHandle()); - } - - synchronized ObjectReferenceImpl objectMirror(Oop key) { - - // Handle any queue elements that are not strongly reachable - processQueue(); - - if (key == null) { - return null; - } - ObjectReferenceImpl object = null; - - /* - * Attempt to retrieve an existing object object reference - */ - SoftObjectReference ref = (SoftObjectReference)objectsByID.get(key); - if (ref != null) { - object = ref.object(); - } - - /* - * If the object wasn't in the table, or it's soft reference was - * cleared, create a new instance. - */ - if (object == null) { - if (key instanceof Instance) { - // look for well-known classes - Symbol className = key.getKlass().getName(); - if (Assert.ASSERTS_ENABLED) { - Assert.that(className != null, "Null class name"); - } - Instance inst = (Instance) key; - if (className.equals(javaLangString)) { - object = new StringReferenceImpl(this, inst); - } else if (className.equals(javaLangThread)) { - object = new ThreadReferenceImpl(this, inst); - } else if (className.equals(javaLangThreadGroup)) { - object = new ThreadGroupReferenceImpl(this, inst); - } else if (className.equals(javaLangClass)) { - object = new ClassObjectReferenceImpl(this, inst); - } else if (className.equals(javaLangClassLoader)) { - object = new ClassLoaderReferenceImpl(this, inst); - } else { - // not a well-known class. But the base class may be - // one of the known classes. - Klass kls = key.getKlass().getSuper(); - while (kls != null) { - className = kls.getName(); - // java.lang.Class and java.lang.String are final classes - if (className.equals(javaLangThread)) { - object = new ThreadReferenceImpl(this, inst); - break; - } else if(className.equals(javaLangThreadGroup)) { - object = new ThreadGroupReferenceImpl(this, inst); - break; - } else if (className.equals(javaLangClassLoader)) { - object = new ClassLoaderReferenceImpl(this, inst); - break; - } - kls = kls.getSuper(); - } - - if (object == null) { - // create generic object reference - object = new ObjectReferenceImpl(this, inst); - } - } - } else if (key instanceof TypeArray) { - object = new ArrayReferenceImpl(this, (Array) key); - } else if (key instanceof ObjArray) { - object = new ArrayReferenceImpl(this, (Array) key); - } else { - throw new RuntimeException("unexpected object type " + key); - } - ref = new SoftObjectReference(key, object, referenceQueue); - - /* - * If there was no previous entry in the table, we add one here - * If the previous entry was cleared, we replace it here. - */ - objectsByID.put(key, ref); - } else { - ref.incrementCount(); - } - - return object; - } - - synchronized void removeObjectMirror(SoftObjectReference ref) { - /* - * This will remove the soft reference if it has not been - * replaced in the cache. - */ - objectsByID.remove(ref.key()); - } - - StringReferenceImpl stringMirror(Instance id) { - return (StringReferenceImpl) objectMirror(id); - } - - ArrayReferenceImpl arrayMirror(Array id) { - return (ArrayReferenceImpl) objectMirror(id); - } - - ThreadReferenceImpl threadMirror(Instance id) { - return (ThreadReferenceImpl) objectMirror(id); - } - - ThreadReferenceImpl threadMirror(JavaThread jt) { - return (ThreadReferenceImpl) objectMirror(jt.getThreadObj()); - } - - ThreadGroupReferenceImpl threadGroupMirror(Instance id) { - return (ThreadGroupReferenceImpl) objectMirror(id); - } - - ClassLoaderReferenceImpl classLoaderMirror(Instance id) { - return (ClassLoaderReferenceImpl) objectMirror(id); - } - - ClassObjectReferenceImpl classObjectMirror(Instance id) { - return (ClassObjectReferenceImpl) objectMirror(id); - } - - // Use of soft refs and caching stuff here has to be re-examined. - // It might not make sense for JDI - SA. - static private class SoftObjectReference extends SoftReference { - int count; - Object key; - - SoftObjectReference(Object key, ObjectReferenceImpl mirror, - ReferenceQueue queue) { - super(mirror, queue); - this.count = 1; - this.key = key; - } - - int count() { - return count; - } - - void incrementCount() { - count++; - } - - Object key() { - return key; - } - - ObjectReferenceImpl object() { - return (ObjectReferenceImpl)get(); - } - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VoidTypeImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VoidTypeImpl.java deleted file mode 100644 index b8333047506..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VoidTypeImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class VoidTypeImpl extends TypeImpl implements VoidType { - VoidTypeImpl(VirtualMachine vm) { - super(vm); - } - - public String signature() { - return "V"; - } - - public String toString() { - return name(); - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VoidValueImpl.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VoidValueImpl.java deleted file mode 100644 index 922c9ac3fc0..00000000000 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/jdi/VoidValueImpl.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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. - * - */ - -package sun.jvm.hotspot.jdi; - -import com.sun.jdi.*; - -public class VoidValueImpl extends ValueImpl implements VoidValue { - - VoidValueImpl(VirtualMachine aVm) { - super(aVm); - } - - public boolean equals(Object obj) { - return (obj != null) && (obj instanceof VoidValue) && super.equals(obj); - } - - public int hashCode() { - return type().hashCode(); - } - - public Type type() { - return vm.theVoidType(); - } - - ValueImpl prepareForAssignmentTo(ValueContainer destination) - throws InvalidTypeException { - - throw new InvalidTypeException(); - } - - public String toString() { - return ""; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/OopUtilities.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/OopUtilities.java index 3afdab8a761..8a52e4efed4 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/OopUtilities.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/OopUtilities.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, 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 @@ -31,11 +31,10 @@ import sun.jvm.hotspot.memory.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.types.TypeDataBase; import sun.jvm.hotspot.utilities.*; -import sun.jvm.hotspot.jdi.JVMTIThreadState; /** A utility class encapsulating useful oop operations */ -public class OopUtilities implements /* imports */ JVMTIThreadState { +public class OopUtilities { // FIXME: access should be synchronized and cleared when VM is // resumed @@ -78,6 +77,8 @@ public class OopUtilities implements /* imports */ JVMTIThreadState { // java.util.concurrent.locks.AbstractOwnableSynchronizer fields private static OopField absOwnSyncOwnerThreadField; + private static final int JVMTI_THREAD_STATE_ALIVE = 0x0001; + static { VM.registerVMInitializedObserver(new Observer() { public void update(Observable o, Object data) { diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java index e82d80789f4..4eab2fe6c91 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -33,7 +33,6 @@ import sun.jvm.hotspot.types.AddressField; import sun.jvm.hotspot.types.Type; import sun.jvm.hotspot.types.TypeDataBase; import sun.jvm.hotspot.utilities.*; -import sun.jvm.hotspot.jdi.JVMTIThreadState; /** A utility class encapsulating useful oop operations */ diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/README.jjh b/hotspot/src/jdk.hotspot.agent/test/jdi/README.jjh deleted file mode 100644 index 33b284fc6c0..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/README.jjh +++ /dev/null @@ -1,39 +0,0 @@ - -This dir contains a test for the JDI-SA implementation. - -sagtest.java, sagtarg.java are a normal JDI regression test -that uses TargetAdapter.java, TargetListener.java, TestScaffold.java, -and VMConnection.java. - -This test starts the debuggee, sagtarg.java, which just does a wait. -The test then calls sagdoit.java which calls all the JDJI interface -functions. Well, it doesn't call them all yet, but that is the plan. -At least all that are interesting to the JDI-SA client. The result of -each call is sent to stdout - -The script runjpda.sh runs this test. It then runs the targ part of -the test and calls gcore on it to get a core dump into file sagcore. -Do - runjpda.sh >& kk - -to run this. - - NOTE that this produces 1000s of lines of output - so be sure to redirect to a file. - -File sagclient.java is a test program that uses the JDI-SA -client to connect to a core file or pid and then calls sagdoit -which calls the JDI methods. - -The script runsa.sh can be used to run sagclient on sagcore: - runsa.sh sagcore >& kk1 - -You can then look at the differences between the runjpda.sh -and the runsa.sh run to see if there are bugs. Note that the -order of things might be different. - - ------------------------------------------ - -runjdb.sh contains a script that will run jdb on a core file -using the JDI-sa binding. diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/SASanityChecker.java b/hotspot/src/jdk.hotspot.agent/test/jdi/SASanityChecker.java deleted file mode 100644 index 61dbff387bb..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/SASanityChecker.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2003, 2005, 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. - * - */ - -import sun.jvm.hotspot.tools.*; -import sun.jvm.hotspot.runtime.*; -import java.io.*; -import java.util.*; -import java.util.jar.*; - -/** -This is a sanity checking tool for Serviceability Agent. To use this class, -refer to sasanity.sh script in the current directory. -*/ - -public class SASanityChecker extends Tool { - private static final String saJarName; - private static final Map c2types; - - static { - saJarName = System.getProperty("SASanityChecker.SAJarName", "sa-jdi.jar"); - c2types = new HashMap(); - Object value = new Object(); - c2types.put("sun.jvm.hotspot.code.ExceptionBlob", value); - c2types.put("sun.jvm.hotspot.code.DeoptimizationBlob", value); - c2types.put("sun.jvm.hotspot.code.UncommonTrapBlob", value); - - } - - public void run() { - String classPath = System.getProperty("java.class.path"); - StringTokenizer st = new StringTokenizer(classPath, File.pathSeparator); - String saJarPath = null; - while (st.hasMoreTokens()) { - saJarPath = st.nextToken(); - if (saJarPath.endsWith(saJarName)) { - break; - } - } - - if (saJarPath == null) { - throw new RuntimeException(saJarName + " is not the CLASSPATH"); - } - - String cpuDot = "." + VM.getVM().getCPU() + "."; - String platformDot = "." + VM.getVM().getOS() + "_" + VM.getVM().getCPU() + "."; - boolean isClient = VM.getVM().isClientCompiler(); - - try { - FileInputStream fis = new FileInputStream(saJarPath); - JarInputStream jis = new JarInputStream(fis); - JarEntry je = null; - while ( (je = jis.getNextJarEntry()) != null) { - String entryName = je.getName(); - int dotClassIndex = entryName.indexOf(".class"); - if (dotClassIndex == -1) { - // skip non-.class stuff - continue; - } - - entryName = entryName.substring(0, dotClassIndex).replace('/', '.'); - - // skip debugger, asm classes, type classes and jdi binding classes - if (entryName.startsWith("sun.jvm.hotspot.debugger.") || - entryName.startsWith("sun.jvm.hotspot.asm.") || - entryName.startsWith("sun.jvm.hotspot.type.") || - entryName.startsWith("sun.jvm.hotspot.jdi.") ) { - continue; - } - - String runtimePkgPrefix = "sun.jvm.hotspot.runtime."; - int runtimeIndex = entryName.indexOf(runtimePkgPrefix); - if (runtimeIndex != -1) { - // look for further dot. if there, it has to be sub-package. - // in runtime sub-packages include only current platform classes. - if (entryName.substring(runtimePkgPrefix.length() + 1, entryName.length()).indexOf('.') != -1) { - if (entryName.indexOf(cpuDot) == -1 && - entryName.indexOf(platformDot) == -1) { - continue; - } - } - } - - if (isClient) { - if (c2types.get(entryName) != null) { - continue; - } - } else { - if (entryName.equals("sun.jvm.hotspot.c1.Runtime1")) { - continue; - } - } - - System.out.println("checking " + entryName + " .."); - // force init of the class to uncover any vmStructs mismatch - Class.forName(entryName); - } - } catch (Exception exp) { - System.out.println(); - System.out.println("FAILED"); - System.out.println(); - throw new RuntimeException(exp.getMessage()); - } - System.out.println(); - System.out.println("PASSED"); - System.out.println(); - } - - public static void main(String[] args) { - SASanityChecker checker = new SASanityChecker(); - checker.start(args); - checker.stop(); - } -} diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/TEST.ROOT b/hotspot/src/jdk.hotspot.agent/test/jdi/TEST.ROOT deleted file mode 100644 index 7d760f64beb..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/TEST.ROOT +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright (c) 2002, 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. -# -# - -# This file identifies the root of the test-suite hierarchy. -# It also contains test-suite configuration information. -# DO NOT EDIT without first contacting jdk-regtest@eng. - -# The list of keywords supported in this test suite -keys=2d dnd i18n diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/TargetAdapter.java b/hotspot/src/jdk.hotspot.agent/test/jdi/TargetAdapter.java deleted file mode 100644 index 76bd16f9a9b..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/TargetAdapter.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -import com.sun.jdi.event.*; - -/** - * Base TargetListener implementation - */ -public class TargetAdapter implements TargetListener { - boolean shouldRemoveListener = false; - - public void removeThisListener() { - shouldRemoveListener = true; - } - - public boolean shouldRemoveListener() { - return shouldRemoveListener; - } - - public void eventSetReceived(EventSet set) {} - public void eventSetComplete(EventSet set) {} - public void eventReceived(Event event) {} - public void breakpointReached(BreakpointEvent event) {} - public void exceptionThrown(ExceptionEvent event) {} - public void stepCompleted(StepEvent event) {} - public void classPrepared(ClassPrepareEvent event) {} - public void classUnloaded(ClassUnloadEvent event) {} - public void methodEntered(MethodEntryEvent event) {} - public void methodExited(MethodExitEvent event) {} - public void fieldAccessed(AccessWatchpointEvent event) {} - public void fieldModified(ModificationWatchpointEvent event) {} - public void threadStarted(ThreadStartEvent event) {} - public void threadDied(ThreadDeathEvent event) {} - public void vmStarted(VMStartEvent event) {} - public void vmDied(VMDeathEvent event) {} - public void vmDisconnected(VMDisconnectEvent event) {} -} diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/TargetListener.java b/hotspot/src/jdk.hotspot.agent/test/jdi/TargetListener.java deleted file mode 100644 index ee7fe4f3507..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/TargetListener.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -import com.sun.jdi.event.*; - -/** - * Event listener framework - */ -public interface TargetListener { - boolean shouldRemoveListener(); - - void eventSetReceived(EventSet set); - void eventSetComplete(EventSet set); - void eventReceived(Event event); - void breakpointReached(BreakpointEvent event); - void exceptionThrown(ExceptionEvent event); - void stepCompleted(StepEvent event); - void classPrepared(ClassPrepareEvent event); - void classUnloaded(ClassUnloadEvent event); - void methodEntered(MethodEntryEvent event); - void methodExited(MethodExitEvent event); - void fieldAccessed(AccessWatchpointEvent event); - void fieldModified(ModificationWatchpointEvent event); - void threadStarted(ThreadStartEvent event); - void threadDied(ThreadDeathEvent event); - void vmStarted(VMStartEvent event); - void vmDied(VMDeathEvent event); - void vmDisconnected(VMDisconnectEvent event); -} diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/TestScaffold.java b/hotspot/src/jdk.hotspot.agent/test/jdi/TestScaffold.java deleted file mode 100644 index ce96b3a4751..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/TestScaffold.java +++ /dev/null @@ -1,758 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -import com.sun.jdi.*; -import com.sun.jdi.request.*; -import com.sun.jdi.event.*; -import java.util.*; -import java.io.*; - -/** - * Framework used by all JDI regression tests - */ -abstract public class TestScaffold extends TargetAdapter { - private boolean shouldTrace = false; - private VMConnection connection; - private VirtualMachine vm; - private EventRequestManager requestManager; - private List listeners = Collections.synchronizedList(new LinkedList()); - - /** - * We create a VMDeathRequest, SUSPEND_ALL, to sync the BE and FE. - */ - //private VMDeathRequest ourVMDeathRequest = null; - Object ourVMDeathRequest = null; - - /** - * We create an ExceptionRequest, SUSPEND_NONE so that we can - * catch it and output a msg if an exception occurs in the - * debuggee. - */ - private ExceptionRequest ourExceptionRequest = null; - - /** - * If we do catch an uncaught exception, we set this true - * so the testcase can find out if it wants to. - */ - private boolean exceptionCaught = false; - ThreadReference vmStartThread = null; - boolean vmDied = false; - boolean vmDisconnected = false; - final String[] args; - protected boolean testFailed = false; - - static private class ArgInfo { - String targetVMArgs = ""; - String targetAppCommandLine = ""; - String connectorSpec = "com.sun.jdi.CommandLineLaunch:"; - int traceFlags = 0; - } - - /** - * An easy way to sleep for awhile - */ - public void mySleep(int millis) { - try { - Thread.sleep(millis); - } catch (InterruptedException ee) { - } - } - - boolean getExceptionCaught() { - return exceptionCaught; - } - - void setExceptionCaught(boolean value) { - exceptionCaught = value; - } - - /** - * Return true if eventSet contains the VMDeathEvent for the request in - * the ourVMDeathRequest ivar. - */ - private boolean containsOurVMDeathRequest(EventSet eventSet) { - if (ourVMDeathRequest != null) { - Iterator myIter = eventSet.iterator(); - while (myIter.hasNext()) { - Event myEvent = (Event)myIter.next(); - if (!(myEvent instanceof VMDeathEvent)) { - // We assume that an EventSet contains only VMDeathEvents - // or no VMDeathEvents. - break; - } - if (ourVMDeathRequest.equals(myEvent.request())) { - return true; - } - } - } - return false; - } - - /************************************************************************ - * The following methods override those in our base class, TargetAdapter. - *************************************************************************/ - - /** - * Events handled directly by scaffold always resume (well, almost always) - */ - public void eventSetComplete(EventSet set) { - // The listener in connect(..) resumes after receiving our - // special VMDeathEvent. We can't also do the resume - // here or we will probably get a VMDisconnectedException - if (!containsOurVMDeathRequest(set)) { - traceln("TS: set.resume() called"); - set.resume(); - } - } - - /** - * This method sets up default requests. - * Testcases can override this to change default behavior. - */ - protected void createDefaultEventRequests() { - createDefaultVMDeathRequest(); - createDefaultExceptionRequest(); - } - - /** - * We want the BE to stop when it issues a VMDeathEvent in order to - * give the FE time to complete handling events that occured before - * the VMDeath. When we get the VMDeathEvent for this request in - * the listener in connect(), we will do a resume. - * If a testcase wants to do something special with VMDeathEvent's, - * then it should override this method with an empty method or - * whatever in order to suppress the automatic resume. The testcase - * will then be responsible for the handling of VMDeathEvents. It - * has to be sure that it does a resume if it gets a VMDeathEvent - * with SUSPEND_ALL, and it has to be sure that it doesn't do a - * resume after getting a VMDeath with SUSPEND_NONE (the automatically - * generated VMDeathEvent.) - */ - protected void createDefaultVMDeathRequest() { -// ourVMDeathRequest = requestManager.createVMDeathRequest(); -// ourVMDeathRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); -// ourVMDeathRequest.enable(); - } - - /** - * This will allow us to print a warning if a debuggee gets an - * unexpected exception. The unexpected exception will be handled in - * the exceptionThrown method in the listener created in the connect() - * method. - * If a testcase does not want an uncaught exception to cause a - * msg, it must override this method. - */ - protected void createDefaultExceptionRequest() { - ourExceptionRequest = requestManager.createExceptionRequest(null, - false, true); - - // We can't afford to make this be other than SUSPEND_NONE. Otherwise, - // it would have to be resumed. If our connect() listener resumes it, - // what about the case where the EventSet contains other events with - // SUSPEND_ALL and there are other listeners who expect the BE to still - // be suspended when their handlers get called? - ourExceptionRequest.setSuspendPolicy(EventRequest.SUSPEND_NONE); - ourExceptionRequest.enable(); - } - - private class EventHandler implements Runnable { - EventHandler() { - Thread thread = new Thread(this); - thread.setDaemon(true); - thread.start(); - } - - private void notifyEvent(TargetListener listener, Event event) { - if (event instanceof BreakpointEvent) { - listener.breakpointReached((BreakpointEvent)event); - } else if (event instanceof ExceptionEvent) { - listener.exceptionThrown((ExceptionEvent)event); - } else if (event instanceof StepEvent) { - listener.stepCompleted((StepEvent)event); - } else if (event instanceof ClassPrepareEvent) { - listener.classPrepared((ClassPrepareEvent)event); - } else if (event instanceof ClassUnloadEvent) { - listener.classUnloaded((ClassUnloadEvent)event); - } else if (event instanceof MethodEntryEvent) { - listener.methodEntered((MethodEntryEvent)event); - } else if (event instanceof MethodExitEvent) { - listener.methodExited((MethodExitEvent)event); - } else if (event instanceof AccessWatchpointEvent) { - listener.fieldAccessed((AccessWatchpointEvent)event); - } else if (event instanceof ModificationWatchpointEvent) { - listener.fieldModified((ModificationWatchpointEvent)event); - } else if (event instanceof ThreadStartEvent) { - listener.threadStarted((ThreadStartEvent)event); - } else if (event instanceof ThreadDeathEvent) { - listener.threadDied((ThreadDeathEvent)event); - } else if (event instanceof VMStartEvent) { - listener.vmStarted((VMStartEvent)event); - } else if (event instanceof VMDeathEvent) { - listener.vmDied((VMDeathEvent)event); - } else if (event instanceof VMDisconnectEvent) { - listener.vmDisconnected((VMDisconnectEvent)event); - } else { - throw new InternalError("Unknown event type: " + event.getClass()); - } - } - - private void traceSuspendPolicy(int policy) { - if (shouldTrace) { - switch (policy) { - case EventRequest.SUSPEND_NONE: - traceln("TS: eventHandler: suspend = SUSPEND_NONE"); - break; - case EventRequest.SUSPEND_ALL: - traceln("TS: eventHandler: suspend = SUSPEND_ALL"); - break; - case EventRequest.SUSPEND_EVENT_THREAD: - traceln("TS: eventHandler: suspend = SUSPEND_EVENT_THREAD"); - break; - } - } - } - - public void run() { - boolean connected = true; - do { - try { - EventSet set = vm.eventQueue().remove(); - traceSuspendPolicy(set.suspendPolicy()); - synchronized (listeners) { - ListIterator iter = listeners.listIterator(); - while (iter.hasNext()) { - TargetListener listener = (TargetListener)iter.next(); - traceln("TS: eventHandler: listener = " + listener); - listener.eventSetReceived(set); - if (listener.shouldRemoveListener()) { - iter.remove(); - } else { - Iterator jter = set.iterator(); - while (jter.hasNext()) { - Event event = (Event)jter.next(); - traceln("TS: eventHandler: event = " + event.getClass()); - - if (event instanceof VMDisconnectEvent) { - connected = false; - } - listener.eventReceived(event); - if (listener.shouldRemoveListener()) { - iter.remove(); - break; - } - notifyEvent(listener, event); - if (listener.shouldRemoveListener()) { - iter.remove(); - break; - } - } - traceln("TS: eventHandler: end of events loop"); - if (!listener.shouldRemoveListener()) { - traceln("TS: eventHandler: calling ESC"); - listener.eventSetComplete(set); - if (listener.shouldRemoveListener()) { - iter.remove(); - } - } - } - traceln("TS: eventHandler: end of listeners loop"); - } - } - } catch (InterruptedException e) { - traceln("TS: eventHandler: InterruptedException"); - } catch (Exception e) { - failure("FAILED: Exception occured in eventHandler: " + e); - e.printStackTrace(); - connected = false; - synchronized(TestScaffold.this) { - // This will make the waiters such as waitForVMDisconnect - // exit their wait loops. - vmDisconnected = true; - TestScaffold.this.notifyAll(); - } - } - traceln("TS: eventHandler: End of outerloop"); - } while (connected); - traceln("TS: eventHandler: finished"); - } - } - - /** - * Constructor - */ - public TestScaffold(String[] args) { - this.args = args; - } - - public void enableScaffoldTrace() { - this.shouldTrace = true; - } - - public void disableScaffoldTrace() { - this.shouldTrace = false; - } - - - protected void startUp(String targetName) { - List argList = new ArrayList(Arrays.asList(args)); - argList.add(targetName); - println("run args: " + argList); - connect((String[]) argList.toArray(args)); - waitForVMStart(); - } - - protected BreakpointEvent startToMain(String targetName) { - startUp(targetName); - traceln("TS: back from startUp"); - BreakpointEvent bpr = resumeTo(targetName, "main", "([Ljava/lang/String;)V"); - waitForInput(); - return bpr; - } - - protected void waitForInput() { - if (System.getProperty("jpda.wait") != null) { - try { - System.err.println("Press to continue"); - System.in.read(); - System.err.println("running..."); - - } catch(Exception e) { - } - } - } - - /* - * Test cases should implement tests in runTests and should - * initiate testing by calling run(). - */ - abstract protected void runTests() throws Exception; - - final public void startTests() throws Exception { - try { - runTests(); - } finally { - shutdown(); - } - } - - protected void println(String str) { - System.err.println(str); - } - - protected void print(String str) { - System.err.print(str); - } - - protected void traceln(String str) { - if (shouldTrace) { - println(str); - } - } - - protected void failure(String str) { - println(str); - testFailed = true; - } - - private ArgInfo parseArgs(String args[]) { - ArgInfo argInfo = new ArgInfo(); - for (int i = 0; i < args.length; i++) { - if (args[i].equals("-connect")) { - i++; - argInfo.connectorSpec = args[i]; - } else if (args[i].equals("-trace")) { - i++; - argInfo.traceFlags = Integer.decode(args[i]).intValue(); - } else if (args[i].startsWith("-J")) { - argInfo.targetVMArgs += (args[i].substring(2) + ' '); - - /* - * classpath can span two arguments so we need to handle - * it specially. - */ - if (args[i].equals("-J-classpath")) { - i++; - argInfo.targetVMArgs += (args[i] + ' '); - } - } else { - argInfo.targetAppCommandLine += (args[i] + ' '); - } - } - return argInfo; - } - - /** - * This is called to connect to a debuggee VM. It starts the VM and - * installs a listener to catch VMStartEvent, our default events, and - * VMDisconnectedEvent. When these events appear, that is remembered - * and waiters are notified. - * This is normally called in the main thread of the test case. - * It starts up an EventHandler thread that gets events coming in - * from the debuggee and distributes them to listeners. That thread - * keeps running until a VMDisconnectedEvent occurs or some exception - * occurs during its processing. - * - * The 'listenUntilVMDisconnect' method adds 'this' as a listener. - * This means that 'this's vmDied method will get called. This has a - * default impl in TargetAdapter.java which can be overridden in the - * testcase. - * - * waitForRequestedEvent also adds an adaptor listener that listens - * for the particular event it is supposed to wait for (and it also - * catches VMDisconnectEvents.) This listener is removed once - * its eventReceived method is called. - * waitForRequestedEvent is called by most of the methods to do bkpts, - * etc. - */ - public void connect(String args[]) { - ArgInfo argInfo = parseArgs(args); - - argInfo.targetVMArgs += VMConnection.getDebuggeeVMOptions(); - connection = new VMConnection(argInfo.connectorSpec, - argInfo.traceFlags); - - addListener(new TargetAdapter() { - public void eventSetComplete(EventSet set) { - if (TestScaffold.this.containsOurVMDeathRequest(set)) { - traceln("TS: connect: set.resume() called"); - set.resume(); - - // Note that we want to do the above resume before - // waking up any sleepers. - synchronized(TestScaffold.this) { - TestScaffold.this.notifyAll(); - } - } - } - - public void vmStarted(VMStartEvent event) { - synchronized(TestScaffold.this) { - vmStartThread = event.thread(); - TestScaffold.this.notifyAll(); - } - } - /** - * By default, we catch uncaught exceptions and print a msg. - * The testcase must override the createDefaultExceptionRequest - * method if it doesn't want this behavior. - */ - public void exceptionThrown(ExceptionEvent event) { - if (TestScaffold.this.ourExceptionRequest != null && - TestScaffold.this.ourExceptionRequest.equals( - event.request())) { - println("Note: Unexpected Debuggee Exception: " + - event.exception().referenceType().name() + - " at line " + event.location().lineNumber()); - TestScaffold.this.exceptionCaught = true; - } - } - - public void vmDied(VMDeathEvent event) { - vmDied = true; - traceln("TS: vmDied called"); - } - - public void vmDisconnected(VMDisconnectEvent event) { - synchronized(TestScaffold.this) { - vmDisconnected = true; - TestScaffold.this.notifyAll(); - } - } - }); - if (connection.connector().name().equals("com.sun.jdi.CommandLineLaunch")) { - if (argInfo.targetVMArgs.length() > 0) { - if (connection.connectorArg("options").length() > 0) { - throw new IllegalArgumentException("VM options in two places"); - } - connection.setConnectorArg("options", argInfo.targetVMArgs); - } - if (argInfo.targetAppCommandLine.length() > 0) { - if (connection.connectorArg("main").length() > 0) { - throw new IllegalArgumentException("Command line in two places"); - } - connection.setConnectorArg("main", argInfo.targetAppCommandLine); - } - } - - vm = connection.open(); - requestManager = vm.eventRequestManager(); - createDefaultEventRequests(); - new EventHandler(); - } - - - public VirtualMachine vm() { - return vm; - } - - public EventRequestManager eventRequestManager() { - return requestManager; - } - - public void addListener(TargetListener listener) { - traceln("TS: Adding listener " + listener); - listeners.add(listener); - } - - public void removeListener(TargetListener listener) { - traceln("TS: Removing listener " + listener); - listeners.remove(listener); - } - - - protected void listenUntilVMDisconnect() { - try { - addListener (this); - } catch (Exception ex){ - ex.printStackTrace(); - testFailed = true; - } finally { - // Allow application to complete and shut down - resumeToVMDisconnect(); - } - } - - public synchronized ThreadReference waitForVMStart() { - while ((vmStartThread == null) && !vmDisconnected) { - try { - wait(); - } catch (InterruptedException e) { - } - } - - if (vmStartThread == null) { - throw new VMDisconnectedException(); - } - - return vmStartThread; - } - - public synchronized void waitForVMDisconnect() { - traceln("TS: waitForVMDisconnect"); - while (!vmDisconnected) { - try { - wait(); - } catch (InterruptedException e) { - } - } - traceln("TS: waitForVMDisconnect: done"); - } - - public Event waitForRequestedEvent(final EventRequest request) { - class EventNotification { - Event event; - boolean disconnected = false; - } - final EventNotification en = new EventNotification(); - - TargetAdapter adapter = new TargetAdapter() { - public void eventReceived(Event event) { - if (request.equals(event.request())) { - traceln("TS:Listener2: got requested event"); - synchronized (en) { - en.event = event; - en.notifyAll(); - } - removeThisListener(); - } else if (event instanceof VMDisconnectEvent) { - traceln("TS:Listener2: got VMDisconnectEvent"); - synchronized (en) { - en.disconnected = true; - en.notifyAll(); - } - removeThisListener(); - } - } - }; - - addListener(adapter); - - try { - synchronized (en) { - traceln("TS: waitForRequestedEvent: vm.resume called"); - vm.resume(); - - while (!en.disconnected && (en.event == null)) { - en.wait(); - } - } - } catch (InterruptedException e) { - return null; - } - - if (en.disconnected) { - throw new RuntimeException("VM Disconnected before requested event occurred"); - } - return en.event; - } - - private StepEvent doStep(ThreadReference thread, int gran, int depth) { - final StepRequest sr = - requestManager.createStepRequest(thread, gran, depth); - - sr.addClassExclusionFilter("java.*"); - sr.addClassExclusionFilter("sun.*"); - sr.addClassExclusionFilter("com.sun.*"); - sr.addCountFilter(1); - sr.enable(); - StepEvent retEvent = (StepEvent)waitForRequestedEvent(sr); - requestManager.deleteEventRequest(sr); - return retEvent; - } - - public StepEvent stepIntoInstruction(ThreadReference thread) { - return doStep(thread, StepRequest.STEP_MIN, StepRequest.STEP_INTO); - } - - public StepEvent stepIntoLine(ThreadReference thread) { - return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO); - } - - public StepEvent stepOverInstruction(ThreadReference thread) { - return doStep(thread, StepRequest.STEP_MIN, StepRequest.STEP_OVER); - } - - public StepEvent stepOverLine(ThreadReference thread) { - return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_OVER); - } - - public StepEvent stepOut(ThreadReference thread) { - return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_OUT); - } - - public BreakpointEvent resumeTo(Location loc) { - final BreakpointRequest request = - requestManager.createBreakpointRequest(loc); - request.addCountFilter(1); - request.enable(); - return (BreakpointEvent)waitForRequestedEvent(request); - } - - public ReferenceType findReferenceType(String name) { - List rts = vm.classesByName(name); - Iterator iter = rts.iterator(); - while (iter.hasNext()) { - ReferenceType rt = (ReferenceType)iter.next(); - if (rt.name().equals(name)) { - return rt; - } - } - return null; - } - - public Method findMethod(ReferenceType rt, String name, String signature) { - List methods = rt.methods(); - Iterator iter = methods.iterator(); - while (iter.hasNext()) { - Method method = (Method)iter.next(); - if (method.name().equals(name) && - method.signature().equals(signature)) { - return method; - } - } - return null; - } - - public Location findLocation(ReferenceType rt, int lineNumber) - throws AbsentInformationException { - List locs = rt.locationsOfLine(lineNumber); - if (locs.size() == 0) { - throw new IllegalArgumentException("Bad line number"); - } else if (locs.size() > 1) { - throw new IllegalArgumentException("Line number has multiple locations"); - } - - return (Location)locs.get(0); - } - - public BreakpointEvent resumeTo(String clsName, String methodName, - String methodSignature) { - ReferenceType rt = findReferenceType(clsName); - if (rt == null) { - rt = resumeToPrepareOf(clsName).referenceType(); - } - - Method method = findMethod(rt, methodName, methodSignature); - if (method == null) { - throw new IllegalArgumentException("Bad method name/signature"); - } - - return resumeTo(method.location()); - } - - public BreakpointEvent resumeTo(String clsName, int lineNumber) throws AbsentInformationException { - ReferenceType rt = findReferenceType(clsName); - if (rt == null) { - rt = resumeToPrepareOf(clsName).referenceType(); - } - - return resumeTo(findLocation(rt, lineNumber)); - } - - public ClassPrepareEvent resumeToPrepareOf(String className) { - final ClassPrepareRequest request = - requestManager.createClassPrepareRequest(); - request.addClassFilter(className); - request.addCountFilter(1); - request.enable(); - return (ClassPrepareEvent)waitForRequestedEvent(request); - } - - public void resumeToVMDisconnect() { - try { - traceln("TS: resumeToVMDisconnect: vm.resume called"); - vm.resume(); - } catch (VMDisconnectedException e) { - // clean up below - } - waitForVMDisconnect(); - } - - public void shutdown() { - shutdown(null); - } - - public void shutdown(String message) { - traceln("TS: shutdown: vmDied= " + vmDied + - ", vmDisconnected= " + vmDisconnected + - ", connection = " + connection); - - if ((connection != null)) { - try { - connection.disposeVM(); - } catch (VMDisconnectedException e) { - // Shutting down after the VM has gone away. This is - // not an error, and we just ignore it. - } - } else { - traceln("TS: shutdown: disposeVM not called"); - } - if (message != null) { - println(message); - } - - vmDied = true; - vmDisconnected = true; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/VMConnection.java b/hotspot/src/jdk.hotspot.agent/test/jdi/VMConnection.java deleted file mode 100644 index 8c42174537c..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/VMConnection.java +++ /dev/null @@ -1,378 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -import com.sun.jdi.*; -import com.sun.jdi.connect.*; -import com.sun.jdi.request.EventRequestManager; - -import java.util.*; -import java.io.*; - - -/** - * Manages a VM conection for the JDI test framework. - */ -class VMConnection { - private VirtualMachine vm; - private Process process = null; - private int outputCompleteCount = 0; - - private final Connector connector; - private final Map connectorArgs; - private final int traceFlags; - - /** - * Return a String containing VM Options to pass to the debugee - * or an empty string if there are none. - * These are read from the first non-comment line - * in file test/com/sun/jdi/@debuggeeVMOptions. - */ - static public String getDebuggeeVMOptions() { - - // When we run under jtreg, test.src contains the pathname of - // the test/com/sun/jdi dir. - BufferedReader reader; - final String filename = "@debuggeeVMOptions"; - String srcDir = System.getProperty("test.src"); - - if (srcDir == null) { - srcDir = System.getProperty("user.dir"); - } - srcDir = srcDir + File.separator; - - File myDir = new File(srcDir); - - File myFile = new File(myDir, filename); - if (!myFile.canRead()) { - try { - // We have some subdirs of test/com/sun/jdi so in case we - // are in one of them, look in our parent dir for the file. - myFile = new File(myDir.getCanonicalFile().getParent(), - filename); - if (!myFile.canRead()) { - return ""; - } - } catch (IOException ee) { - System.out.println("-- Error 1 trying to access file " + - myFile.getPath() + ": " + ee); - return ""; - } - } - String wholePath = myFile.getPath(); - try { - reader = new BufferedReader(new FileReader(myFile)); - } catch (FileNotFoundException ee) { - System.out.println("-- Error 2 trying to access file " + - wholePath + ": " + ee); - return ""; - } - - String line; - String retVal = ""; - while (true) { - try { - line = reader.readLine(); - } catch (IOException ee) { - System.out.println("-- Error reading options from file " + - wholePath + ": " + ee); - break; - } - if (line == null) { - System.out.println("-- No debuggee VM options found in file " + - wholePath); - break; - } - line = line.trim(); - if (line.length() != 0 && !line.startsWith("#")) { - System.out.println("-- Added debuggeeVM options from file " + - wholePath + ": " + line); - retVal = line; - break; - } - // Else, read he next line. - } - try { - reader.close(); - } catch (IOException ee) { - } - return retVal; - } - - private Connector findConnector(String name) { - List connectors = Bootstrap.virtualMachineManager().allConnectors(); - Iterator iter = connectors.iterator(); - while (iter.hasNext()) { - Connector connector = (Connector)iter.next(); - if (connector.name().equals(name)) { - return connector; - } - } - return null; - } - - private Map parseConnectorArgs(Connector connector, String argString) { - StringTokenizer tokenizer = new StringTokenizer(argString, ","); - Map arguments = connector.defaultArguments(); - - while (tokenizer.hasMoreTokens()) { - String token = tokenizer.nextToken(); - int index = token.indexOf('='); - if (index == -1) { - throw new IllegalArgumentException("Illegal connector argument: " + - token); - } - String name = token.substring(0, index); - String value = token.substring(index + 1); - Connector.Argument argument = (Connector.Argument)arguments.get(name); - if (argument == null) { - throw new IllegalArgumentException("Argument " + name + - "is not defined for connector: " + - connector.name()); - } - argument.setValue(value); - } - return arguments; - } - - VMConnection(String connectSpec, int traceFlags) { - String nameString; - String argString; - int index = connectSpec.indexOf(':'); - if (index == -1) { - nameString = connectSpec; - argString = ""; - } else { - nameString = connectSpec.substring(0, index); - argString = connectSpec.substring(index + 1); - } - - connector = findConnector(nameString); - if (connector == null) { - throw new IllegalArgumentException("No connector named: " + - nameString); - } - - connectorArgs = parseConnectorArgs(connector, argString); - this.traceFlags = traceFlags; - } - - synchronized VirtualMachine open() { - if (connector instanceof LaunchingConnector) { - vm = launchTarget(); - } else if (connector instanceof AttachingConnector) { - vm = attachTarget(); - } else if (connector instanceof ListeningConnector) { - vm = listenTarget(); - } else { - throw new InternalError("Invalid connect type"); - } - vm.setDebugTraceMode(traceFlags); - System.out.println("JVM version:" + vm.version()); - System.out.println("JDI version: " + Bootstrap.virtualMachineManager().majorInterfaceVersion() + - "." + Bootstrap.virtualMachineManager().minorInterfaceVersion()); - System.out.println("JVM description: " + vm.description()); - - return vm; - } - - boolean setConnectorArg(String name, String value) { - /* - * Too late if the connection already made - */ - if (vm != null) { - return false; - } - - Connector.Argument argument = (Connector.Argument)connectorArgs.get(name); - if (argument == null) { - return false; - } - argument.setValue(value); - return true; - } - - String connectorArg(String name) { - Connector.Argument argument = (Connector.Argument)connectorArgs.get(name); - if (argument == null) { - return ""; - } - return argument.value(); - } - - public synchronized VirtualMachine vm() { - if (vm == null) { - throw new InternalError("VM not connected"); - } else { - return vm; - } - } - - boolean isOpen() { - return (vm != null); - } - - boolean isLaunch() { - return (connector instanceof LaunchingConnector); - } - - Connector connector() { - return connector; - } - - boolean isListen() { - return (connector instanceof ListeningConnector); - } - - boolean isAttach() { - return (connector instanceof AttachingConnector); - } - - private synchronized void notifyOutputComplete() { - outputCompleteCount++; - notifyAll(); - } - - private synchronized void waitOutputComplete() { - // Wait for stderr and stdout - if (process != null) { - while (outputCompleteCount < 2) { - try {wait();} catch (InterruptedException e) {} - } - } - } - - public void disposeVM() { - try { - if (vm != null) { - vm.dispose(); - vm = null; - } - } finally { - if (process != null) { - process.destroy(); - process = null; - } - waitOutputComplete(); - } - } - - private void dumpStream(InputStream stream) throws IOException { - PrintStream outStream = System.out; - BufferedReader in = - new BufferedReader(new InputStreamReader(stream)); - String line; - while ((line = in.readLine()) != null) { - outStream.println(line); - } - } - - /** - * Create a Thread that will retrieve and display any output. - * Needs to be high priority, else debugger may exit before - * it can be displayed. - */ - private void displayRemoteOutput(final InputStream stream) { - Thread thr = new Thread("output reader") { - public void run() { - try { - dumpStream(stream); - } catch (IOException ex) { - System.err.println("IOException reading output of child java interpreter:" - + ex.getMessage()); - } finally { - notifyOutputComplete(); - } - } - }; - thr.setPriority(Thread.MAX_PRIORITY-1); - thr.start(); - } - - private void dumpFailedLaunchInfo(Process process) { - try { - dumpStream(process.getErrorStream()); - dumpStream(process.getInputStream()); - } catch (IOException e) { - System.err.println("Unable to display process output: " + - e.getMessage()); - } - } - - /* launch child target vm */ - private VirtualMachine launchTarget() { - LaunchingConnector launcher = (LaunchingConnector)connector; - try { - VirtualMachine vm = launcher.launch(connectorArgs); - process = vm.process(); - displayRemoteOutput(process.getErrorStream()); - displayRemoteOutput(process.getInputStream()); - return vm; - } catch (IOException ioe) { - ioe.printStackTrace(); - System.err.println("\n Unable to launch target VM."); - } catch (IllegalConnectorArgumentsException icae) { - icae.printStackTrace(); - System.err.println("\n Internal debugger error."); - } catch (VMStartException vmse) { - System.err.println(vmse.getMessage() + "\n"); - dumpFailedLaunchInfo(vmse.process()); - System.err.println("\n Target VM failed to initialize."); - } - return null; // Shuts up the compiler - } - - /* attach to running target vm */ - private VirtualMachine attachTarget() { - AttachingConnector attacher = (AttachingConnector)connector; - try { - return attacher.attach(connectorArgs); - } catch (IOException ioe) { - ioe.printStackTrace(); - System.err.println("\n Unable to attach to target VM."); - } catch (IllegalConnectorArgumentsException icae) { - icae.printStackTrace(); - System.err.println("\n Internal debugger error."); - } - return null; // Shuts up the compiler - } - - /* listen for connection from target vm */ - private VirtualMachine listenTarget() { - ListeningConnector listener = (ListeningConnector)connector; - try { - String retAddress = listener.startListening(connectorArgs); - System.out.println("Listening at address: " + retAddress); - vm = listener.accept(connectorArgs); - listener.stopListening(connectorArgs); - return vm; - } catch (IOException ioe) { - ioe.printStackTrace(); - System.err.println("\n Unable to attach to target VM."); - } catch (IllegalConnectorArgumentsException icae) { - icae.printStackTrace(); - System.err.println("\n Internal debugger error."); - } - return null; // Shuts up the compiler - } -} diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/jstack.sh b/hotspot/src/jdk.hotspot.agent/test/jdi/jstack.sh deleted file mode 100644 index 67f7770e092..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/jstack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2003, 2012, 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. -# -# - -$JAVA_HOME/bin/java -showversion ${OPTIONS} -classpath $JAVA_HOME/lib/sa-jdi.jar sun.jvm.hotspot.tools.StackTrace $* diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/jstack64.sh b/hotspot/src/jdk.hotspot.agent/test/jdi/jstack64.sh deleted file mode 100644 index cd2a422546b..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/jstack64.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2003, 2012, 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. -# -# - -$JAVA_HOME/bin/java -d64 -showversion ${OPTIONS} -classpath $JAVA_HOME/lib/sa-jdi.jar sun.jvm.hotspot.tools.StackTrace $* diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/multivm.java b/hotspot/src/jdk.hotspot.agent/test/jdi/multivm.java deleted file mode 100644 index 8ba06e7fea0..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/multivm.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2003, 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. - * - */ - -import com.sun.jdi.*; -import com.sun.jdi.connect.*; - -import java.util.Map; -import java.util.List; -import java.util.Iterator; -import java.io.IOException; - -/* This class is used to test multi VM connectivity feature of - * SA/JDI. Accepts two PIDs as arguments. Connects to first VM - *, Connects to second VM and disposes them in that order. - */ - -public class multivm { - static AttachingConnector myPIDConn; - static VirtualMachine vm1; - static VirtualMachine vm2; - static VirtualMachineManager vmmgr; - - public static void println(String msg) { - System.out.println(msg); - } - - private static void usage() { - System.err.println("Usage: java multivm "); - System.exit(1); - } - - public static void main(String args[]) { - vmmgr = Bootstrap.virtualMachineManager(); - List attachingConnectors = vmmgr.attachingConnectors(); - if (attachingConnectors.isEmpty()) { - System.err.println( "ERROR: No attaching connectors"); - return; - } - Iterator myIt = attachingConnectors.iterator(); - while (myIt.hasNext()) { - AttachingConnector tmpCon = (AttachingConnector)myIt.next(); - if (tmpCon.name().equals( - "sun.jvm.hotspot.jdi.SAPIDAttachingConnector")) { - myPIDConn = tmpCon; - break; - } - } - - int pid1 = 0, pid2 = 0; - String pidText = null; - switch (args.length) { - case (2): - try { - pidText = args[0]; - pid1 = Integer.parseInt(pidText); - System.out.println( "pid1: " + pid1); - vm1 = attachPID(pid1); - pidText = args[1]; - pid2 = Integer.parseInt(pidText); - System.out.println( "pid2: " + pid2); - vm2 = attachPID(pid2); - } catch (NumberFormatException e) { - println(e.getMessage()); - usage(); - } - break; - default: - usage(); - } - - if (vm1 != null) { - System.out.println("vm1: attached ok!"); - System.out.println(vm1.version()); - sagdoit mine = new sagdoit(vm1); - mine.doAll(); - } - - if (vm2 != null) { - System.out.println("vm2: attached ok!"); - System.out.println(vm2.version()); - sagdoit mine = new sagdoit(vm2); - mine.doAll(); - } - - if (vm1 != null) { - vm1.dispose(); - } - - if (vm2 != null) { - vm2.dispose(); - } - } - - private static VirtualMachine attachPID(int pid) { - Map connArgs = myPIDConn.defaultArguments(); - System.out.println("connArgs = " + connArgs); - VirtualMachine vm; - Connector.StringArgument connArg = (Connector.StringArgument)connArgs.get("pid"); - connArg.setValue(Integer.toString(pid)); - - try { - vm = myPIDConn.attach(connArgs); - } catch (IOException ee) { - System.err.println("ERROR: myPIDConn.attach got IO Exception:" + ee); - vm = null; - } catch (IllegalConnectorArgumentsException ee) { - System.err.println("ERROR: myPIDConn.attach got illegal args exception:" + ee); - vm = null; - } - return vm; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/multivm.sh b/hotspot/src/jdk.hotspot.agent/test/jdi/multivm.sh deleted file mode 100644 index 5d114c04d57..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/multivm.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/ksh -# -# Copyright (c) 2003, 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. -# -# - -doUsage() -{ - cat < - -EOF -} - -if [ $# = 4 ] ; then - doUsage - exit 1 -fi - -jdk=$1 -javacp="$jdk/lib/sa-jdi.jar:$classesDir:$jdk/lib/tools.jar:$jdk/classes:./workdir" - -mkdir -p workdir -if [ sagdoit.java -nt ./workdir/sagdoit.class ] ; then - $jdk/bin/javac -d ./workdir -classpath $javacp sagdoit.java - if [ $? != 0 ] ; then - exit 1 - fi -fi -if [ multivm.java -nt ./workdir/multivm.class ] ; then - $jdk/bin/javac -d ./workdir -classpath $javacp multivm.java - if [ $? != 0 ] ; then - exit 1 - fi -fi - -$jdk/bin/java -Dsun.jvm.hotspot.jdi.ConnectorImpl.DEBUG -Dsun.jvm.hotspot.jdi.SAJDIClassLoader.DEBUG -Djava.class.path=$javacp multivm $2 $3 diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/runjdb.sh b/hotspot/src/jdk.hotspot.agent/test/jdi/runjdb.sh deleted file mode 100644 index cd1b10fce9b..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/runjdb.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2002, 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. -# -# - -# jdb is a .c file that seems to discard the setting of CLASSPATH. -# So, we have to run jdb by calling java directly :-( - -# License file for development version of dbx -LM_LICENSE_FILE=7588@extend.eng:/usr/dist/local/config/sparcworks/license.dat:7588@setlicense -export LM_LICENSE_FILE - -doUsage() -{ - cat < /dev/null - if [ $? = 0 ] ; then - # it is a pid - args="$args $1" - echo "Error: A pid is not yet allowed" - exit 1 - else - # It is a core. - # We have to pass the name of the program that produced the - # core, and the core file itself. - args="$1" - fi - ;; - esac - shift -done - -if [ -z "$jdk" ] ; then - echo "Error: -jdk jdk-pathname is required" - exit 1 -fi -if [ -z "$sa" ] ; then - echo "Error: -sa sa-pathname is required" - exit 1 -fi - -if [ -z "$args" ] ; then - echo "Error: a core file or pid must be specified" - exit 1 -fi - -set -x -$jdk/bin/jdb -J-Xbootclasspath/a:$sa -connect \ - sun.jvm.hotspot.jdi.SACoreAttachingConnector:core=$args,javaExecutable=$jdk/bin/java - - -#$jdk/bin/java -Xbootclasspath/a:$mmm/ws/merlin-sa/build/agent \ -# com.sun.tools.example.debug.tty.TTY -connect \ -# sun.jvm.hotspot.jdi.SACoreAttachingConnector:core=sagcore,javaExecutable=$jdk/bin/java diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/runjpda.sh b/hotspot/src/jdk.hotspot.agent/test/jdi/runjpda.sh deleted file mode 100644 index a24594687cb..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/runjpda.sh +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/ksh -# -# Copyright (c) 2002, 2004, 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. -# -# - -# This script runs the test program, sagtest.java, with the regular -# JPDA jdi. -# It then starts up the debuggee part of the test, sagtarg.java, -# and calls gcore to create file sagcore for use in running -# the SA JDI client. - -set -x -# jdk is a jdk with the vm from the sa workspace -while [ $# != 0 ] ; do - case $1 in - -vv) - set -x - ;; - -gui) - theClass=sun.jvm.hotspot.HSDB - ;; - -jdk) - jdk=$2 - shift - ;; - -jdbx) - do=jdbx - ;; - -jdb) - do=jdb - ;; - -help | help) - doUsage - exit - ;; - -dontkill) - dontkill=true - ;; - -d64) - d64=-d64 - ;; - -*) - javaArgs="$javaArgs $1" - ;; - *) - echo "$1" | grep -s '^[0-9]*$' > /dev/null - if [ $? = 0 ] ; then - # it is a pid - args="$args $1" - else - # It is a core. - # We have to pass the name of the program that produced the - # core, and the core file itself. - args="$jdk/bin/java $1" - fi - ;; - esac - shift -done - -# First, run the sagtest.java with the regular JPDA jdi -workdir=./workdir -mkdir -p $workdir -CLASSPATH=$jdk/classes:$jdk/lib/tools.jar:$workdir -export CLASSPATH - -$jdk/bin/javac -g -source 1.5 -classpath $jdk/classes:$jdk/lib/tools.jar:$workdir -J-Xms40m -d $workdir \ - TestScaffold.java \ - VMConnection.java \ - TargetListener.java \ - TargetAdapter.java \ - sagdoit.java \ - sagtarg.java \ - sagtest.java - -if [ $? != 0 ] ; then - exit 1 -fi - -$jdk/bin/java $javaArgs -Dtest.classes=$workdir sagtest - -# Now run create a core file for use in running sa-jdi - -if [ ! core.satest -nt sagtarg.class ] ; then - tmp=/tmp/sagsetup - rm -f $tmp - $jdk/bin/java $d64 sagtarg > $tmp & - pid=$! - while [ ! -s $tmp ] ; do - # Kludge alert! - sleep 2 - done - #rm -f $tmp - - # force core dump of the debuggee - OS=`uname` - if [ "$OS" = "Linux" ]; then - # Linux does not have gcore command. Instead, we use 'gdb's - # gcore command. Note that only some versions of gdb support - # gdb command. - echo "gcore" > gdbscript - gdb -batch -p $pid -x gdbscript - rm -f gdbscript - else - gcore $* $pid - fi - mv core.$pid sagcore - - if [ "$dontkill" != "true" ]; then - kill -9 $pid - fi -fi - diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/runsa.sh b/hotspot/src/jdk.hotspot.agent/test/jdi/runsa.sh deleted file mode 100644 index aa4d7786326..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/runsa.sh +++ /dev/null @@ -1,183 +0,0 @@ -#!/bin/ksh -# -# Copyright (c) 2002, 2012, 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. -# -# - - -# This jdk must be hopper or better; it must have the -# SA connectors in VirtualMachineManagerImpl. -jdk=/java/re/jdk/1.4.1/promoted/latest/binaries/solaris-sparc -#jdk=/net/mmm/export/mmm/jdk1.4fcs.sa - -doUsage() -{ - cat <] [-jdb] [ -jdbx ] [ -d64 ] [ -remote ] [ pid | corefile | debugserver ] - - -jdk means to use that jdk. Default is 1.4.1/latest. - -jdbx means to run it under jdbx - -jdb means to connect using jdb instead of the sagclient program. - -remote debugserver means you want to connect to a remote debug server - - The corefile must have been produced by the same java as is running SA. - -EOF -} - -if [ $# = 0 ] ; then - doUsage - exit 1 -fi - -# License file for development version of dbx -#LM_LICENSE_FILE=7588@extend.eng:/usr/dist/local/config/sparcworks/license.dat:7588@setlicense -#export LM_LICENSE_FILE - -do= -args= -theClass=sagclient -javaArgs= - -while [ $# != 0 ] ; do - case $1 in - -vv) - set -x - ;; - -jdk) - jdk=$2 - shift - ;; - -jdbx) - do=jdbx - ;; - -jdb) - do=jdb - ;; - -help | help) - doUsage - exit - ;; - -d64) - d64=-d64 - ;; - -remote) - shift - args="$1" - do=remote - ;; - -*) - javaArgs="$javaArgs $1" - ;; - *) - echo "$1" | grep -s '^[0-9]*$' > /dev/null - if [ $? = 0 ] ; then - # it is a pid - args="$args $1" - else - # It is a core. - # We have to pass the name of the program that produced the - # core, and the core file itself. - args="$jdk/bin/java $1" - fi - ;; - esac - shift -done - -if [ -z "$jdk" ] ; then - error "--Error: runsa.sh: Must specify -jdk ." - error " Do runsa.sh -help for more info" - exit 1 -fi - -set -x - -# If jjh makes this, then the classes are in .../build/agent. -# if someone else does, they are in . -classesDir=../../../../../../build/agent -if [ ! -r $classesDir ] ; then - classesDir=. - if [ ! -r $classesDir ] ; then - echo "-- Error: runsa.sh can't find the SA classes" - exit 1 - fi -fi -#javacp="/net/mmm/export/mmm/ws/sabaseline/build/solaris/solaris_sparc_compiler1/generated/sa-jdi.jar:$classesDir:$jdk/lib/tools.jar:$jdk/classes:./workdir" - -javacp="$jdk/lib/sa-jdi.jar:$classesDir:$jdk/lib/tools.jar:$jdk/classes:./workdir" - - -extraArgs="-showversion $javaArgs" -#extraArgs="-DdbxSvcAgentDSOPathName=/net/mmm/export/mmm/ws/m/b2/sa/src/os/solaris/agent/64bit/libsvc_agent_dbx.so $extraArgs" -#extraArgs="-DdbxSvcAgentDSOPathName=/net/jano.eng/export/disk05/hotspot/sa/solaris/sparcv9/lib/libsvc_agent_dbx.so $extraArgs" - -mkdir -p workdir -if [ sagclient.java -nt ./workdir/sagclient.class ] ; then - $jdk/bin/javac -d ./workdir -classpath $javacp sagclient.java - if [ $? != 0 ] ; then - exit 1 - fi -fi -if [ sagdoit.java -nt ./workdir/sagdoit.class ] ; then - $jdk/bin/javac -d ./workdir -classpath $javacp sagdoit.java - if [ $? != 0 ] ; then - exit 1 - fi -fi - -if [ "$do" = jdbx ] ; then - set -x - dbx=/net/sparcworks.eng/export/set/sparcworks2/dbx_70_nightly/dev/buildbin/Derived-sparc-S2-opt/bin/dbx - - # Have to do this export for jdbx to work. -cp and -classpath don't work. - CLASSPATH=$javacp - export CLASSPATH - #extraArgs="-Djava.class.path=$mhs/../sa/build/agent sun.jvm.hotspot.HSDB $*" - jvm_invocation="$jdk/bin/java -Xdebug \ - -Dsun.boot.class.path=$jdk/classes \ - $extraArgs" - #export jvm_invocation - - JAVASRCPATH=$mhs/../sa/src/share/vm/agent - export JAVASRCPATH - - #operand is pathname of .class file, eg ./jj.class. - echo run $args - clss=`echo $theClass | sed -e 's@\.@/@'` - if [ -r ./workdir/$clss.class ] ; then - # kludge for running sagclient - $dbx ./workdir/$clss.class - else - # kludge for running HSDB - $dbx $mhs/../sa/build/agent/$clss.class - fi -elif [ "$do" = jdb ] ; then - # This hasn't been tested. - $jdk/bin/jdb -J-Xbootclasspath/a:$classesDir -connect sun.jvm.hotspot.jdi.SACoreAttachingConnector:core=sagcore -elif [ "$do" = remote ] ; then - $jdk/bin/java $d64 -Djava.class.path=$javacp $extraArgs $theClass $args -else - $jdk/bin/java $d64 -Djava.class.path=$javacp $extraArgs $theClass $args - -fi diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/sagclient.java b/hotspot/src/jdk.hotspot.agent/test/jdi/sagclient.java deleted file mode 100644 index 8160b7681b2..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/sagclient.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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. - * - */ - -import com.sun.jdi.*; -import com.sun.jdi.connect.*; - -import java.util.Map; -import java.util.List; -import java.util.Iterator; -import java.io.IOException; - -public class sagclient { - static AttachingConnector myCoreConn; - static AttachingConnector myPIDConn; - static AttachingConnector myDbgSvrConn; - static VirtualMachine vm; - static VirtualMachineManager vmmgr; - - public static void println(String msg) { - System.out.println("jj: " + msg); - } - - - public static void main(String args[]) { - vmmgr = Bootstrap.virtualMachineManager(); - List attachingConnectors = vmmgr.attachingConnectors(); - if (attachingConnectors.isEmpty()) { - System.err.println( "ERROR: No attaching connectors"); - return; - } - Iterator myIt = attachingConnectors.iterator(); - while (myIt.hasNext()) { - AttachingConnector tmpCon = (AttachingConnector)myIt.next(); - if (tmpCon.name().equals( - "sun.jvm.hotspot.jdi.SACoreAttachingConnector")) { - myCoreConn = tmpCon; - } else if (tmpCon.name().equals( - "sun.jvm.hotspot.jdi.SAPIDAttachingConnector")) { - myPIDConn = tmpCon; - } else if (tmpCon.name().equals( - "sun.jvm.hotspot.jdi.SADebugServerAttachingConnector")) { - myDbgSvrConn = tmpCon; - } - } - String execPath = null; - String pidText = null; - String coreFilename = null; - String debugServer = null; - int pid = 0; - switch (args.length) { - case (0): - break; - case (1): - // If all numbers, it is a PID to attach to - // Else, it is a pathname to a .../bin/java for a core file. - try { - pidText = args[0]; - pid = Integer.parseInt(pidText); - System.out.println( "pid: " + pid); - vm = attachPID(pid); - } catch (NumberFormatException e) { - System.out.println("trying remote server .."); - debugServer = args[0]; - System.out.println( "remote server: " + debugServer); - vm = attachDebugServer(debugServer); - } - break; - - case (2): - execPath = args[0]; - coreFilename = args[1]; - System.out.println( "jdk: " + execPath); - System.out.println( "core: " + coreFilename); - vm = attachCore(coreFilename, execPath); - break; - } - - - if (vm != null) { - System.out.println("sagclient: attached ok!"); - sagdoit mine = new sagdoit(vm); - mine.doAll(); - vm.dispose(); - } - } - - private static VirtualMachine attachCore(String coreFilename, String execPath) { - Map connArgs = myCoreConn.defaultArguments(); - System.out.println("connArgs = " + connArgs); - VirtualMachine vm; - Connector.StringArgument connArg = (Connector.StringArgument)connArgs.get("core"); - connArg.setValue(coreFilename); - - connArg = (Connector.StringArgument)connArgs.get("javaExecutable"); - connArg.setValue(execPath); - try { - vm = myCoreConn.attach(connArgs); - } catch (IOException ee) { - System.err.println("ERROR: myCoreConn.attach got IO Exception:" + ee); - vm = null; - } catch (IllegalConnectorArgumentsException ee) { - System.err.println("ERROR: myCoreConn.attach got illegal args exception:" + ee); - vm = null; - } - return vm; - } - - private static VirtualMachine attachPID(int pid) { - Map connArgs = myPIDConn.defaultArguments(); - System.out.println("connArgs = " + connArgs); - VirtualMachine vm; - Connector.StringArgument connArg = (Connector.StringArgument)connArgs.get("pid"); - connArg.setValue(Integer.toString(pid)); - - try { - vm = myPIDConn.attach(connArgs); - } catch (IOException ee) { - System.err.println("ERROR: myPIDConn.attach got IO Exception:" + ee); - vm = null; - } catch (IllegalConnectorArgumentsException ee) { - System.err.println("ERROR: myPIDConn.attach got illegal args exception:" + ee); - vm = null; - } - return vm; - } - - - private static VirtualMachine attachDebugServer(String debugServer) { - Map connArgs = myDbgSvrConn.defaultArguments(); - System.out.println("connArgs = " + connArgs); - VirtualMachine vm; - Connector.StringArgument connArg = (Connector.StringArgument)connArgs.get("debugServerName"); - connArg.setValue(debugServer); - - try { - vm = myDbgSvrConn.attach(connArgs); - } catch (IOException ee) { - System.err.println("ERROR: myDbgSvrConn.attach got IO Exception:" + ee); - vm = null; - } catch (IllegalConnectorArgumentsException ee) { - System.err.println("ERROR: myDbgSvrConn.attach got illegal args exception:" + ee); - vm = null; - } - return vm; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/sagdoit.java b/hotspot/src/jdk.hotspot.agent/test/jdi/sagdoit.java deleted file mode 100644 index 27c693138cb..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/sagdoit.java +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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. - * - */ - -import com.sun.jdi.*; -import java.util.*; - - -// This just contains a bunch of methods that call various JDI methods. -// It is called from the sagtest.java jtreg test to get this info for the standard -// JDI and from the sagclient.java test to get this info for the SA JDI. - -class comparator implements Comparator { - - public int compare(Object o1, Object o2) { - ReferenceType rt1 = (ReferenceType)o1; - ReferenceType rt2 = (ReferenceType)o2; - return rt1.signature().compareTo(rt2.signature()); - } - - public boolean equals(Object oo) { - return false; - } -} - -public class sagdoit { - - VirtualMachine myVm; - int margin = 0; - static String blanks = " "; - static int nblanks = blanks.length(); - - sagdoit(VirtualMachine vm) { - super(); - myVm = vm; - } - - void indent(int count) { - margin += count; - } - - void pp(String msg) { - System.out.println(blanks.substring(nblanks - margin) + msg); - } - - public void doAll() { - doThreadGroups(); - //System.out.println("NOTE: dumping of class info is disabled in sagdoit.java"); - //System.out.println(" just to keep the output small while working on objects"); - doClasses(); //fixme jj: uncomment this to see all class info - - } - public void doThreadGroups() { - doThreadGroupList(myVm.topLevelThreadGroups()); - } - - private void doThreadGroupList(List groups) { - // sort; need a comparator - if (groups == null) { - return; - } - - Iterator myIter = groups.iterator(); - while(myIter.hasNext()) { - ThreadGroupReference aGroup = (ThreadGroupReference)myIter.next(); - doOneThreadGroup(aGroup); - } - - } - - public void doOneThreadGroup(ThreadGroupReference xx) { - pp("threadGroup:" + xx.name()); - indent(4); - pp("parent() = " + xx.parent()); - pp("threads:"); - indent(4); - doThreadList(xx.threads()); - indent(-4); - pp("threadGroups:"); - indent(4); - doThreadGroupList(xx.threadGroups()); - indent(-4); - indent(-4); - } - - public void doThreads() { - doThreadList(myVm.allThreads()); - } - - public void doThreadList(List threads) { - if (threads == null) { - return; - } - Iterator myIter = threads.iterator(); - while(myIter.hasNext()) { - ThreadReference aThread = (ThreadReference)myIter.next(); - doOneThread(aThread); - } - } - - public void doOneThread(ThreadReference xx) { - pp("Thread: " + xx.name()); - indent(4); - pp("suspendCount() = " + xx.suspendCount()); - - //void stop(ObjectReference throwable) throws InvalidTypeException; - //void interrupt(); - pp("status() = " + xx.status()); - pp("isSuspended() = " + xx.isSuspended()); - pp("isAtBreakpoint() = " + xx.isAtBreakpoint()); - - pp("threadGroup() = " + xx.threadGroup()); - indent(-4); - - indent(4); - try { - List allFrames = xx.frames(); - for (int ii = 0; ii < xx.frameCount(); ii++) { - StackFrame oneFrame = xx.frame(ii); - pp("frame(" + ii + ") = " + oneFrame); - doOneFrame(oneFrame); - } - //List frames(int start, int length) throws IncompatibleThreadStateException; - // unsupported List allMonitors = xx.ownedMonitors(); - // unsupported pp("currentContendedMonitor() = " + xx.currentContendedMonitor()); - } catch (IncompatibleThreadStateException ee) { - pp("GOT IncompatibleThreadStateException: " + ee); - } - indent(-4); - } - - public void doOneFrame(StackFrame frame) { - - List localVars = null; - try { - localVars = frame.visibleVariables(); - } catch (AbsentInformationException ee) { - // we compile with -g so this shouldn't happen - return; - } - indent(4); - for (Iterator it = localVars.iterator(); it.hasNext();) { - LocalVariable lv = (LocalVariable) it.next(); - pp("lv name = " + lv.name() + - ", type = " + lv.typeName() + - ", sig = " + lv.signature() + - ", gsig = " + lv.genericSignature() + - ", isVis = " + lv.isVisible(frame) + - ", isArg = " + lv.isArgument()); - } - indent(-4); - } - - public void doClasses() { - List myClasses = myVm.allClasses(); - myClasses = new ArrayList(myClasses); - Collections.sort(myClasses, new comparator()); - for (int ii = 0; ii < myClasses.size(); ii++) { - // Spec says each is a ReferenceType - //System.out.println("class " + (ii + 1) + " is " + myClasses.get(ii)); - ReferenceType aClass = (ReferenceType)myClasses.get(ii); - System.out.println("class " + (ii + 1) + " is " + aClass.signature()); - doOneClass(aClass); - // Uncomment this to just do a few classes. - //if ( ii > 4) break; - } - } - - public void doOneClass(ReferenceType xx) { - indent(5); - // inherited from Mirror - pp("toString() = " + xx.toString()); - pp("virtualMachine() = " + xx.virtualMachine()); - - // inherited from Type - pp("name() = " + xx.name()); - pp("signature() = " + xx.signature()); - - // ReferenceType fields - doReferenceTypeFields(xx); - - - - - - String className = xx.getClass().getName(); - pp("subclass = " + className); - - Class referenceType = null; - Class arrayType = null; - Class classType = null; - Class interfaceType = null; - - try { - referenceType = Class.forName("com.sun.jdi.ReferenceType"); - arrayType = Class.forName("com.sun.jdi.ArrayType"); - interfaceType = Class.forName("com.sun.jdi.InterfaceType"); - classType = Class.forName("com.sun.jdi.ClassType"); - } catch (ClassNotFoundException ee) { - } - - - if (referenceType.isInstance(xx)) { - pp("ReferenceType fields"); - ReferenceType rr = (ReferenceType)xx; - - if (arrayType.isInstance(xx)) { - pp("ArrayType fields"); - } - - if (classType.isInstance(xx)) { - pp("ClassType fields"); - } - - if (interfaceType.isInstance(xx)) { - pp("InterfaceType fields"); - } - } - indent(-5); - - } - - - public void doReferenceTypeFields(ReferenceType xx) { - Object zz; - pp("classLoader() = " + xx.classLoader()); - try {zz =xx.sourceName();} catch(AbsentInformationException ee) { zz = ee;} pp("sourceName() = " + zz); - try {zz =xx.sourceNames("stratum");} catch(AbsentInformationException ee) { zz = ee;} pp("sourceNames() = " + zz); - try {zz =xx.sourcePaths("stratum");} catch(AbsentInformationException ee) { zz = ee;} pp("sourcePaths() = " + zz); - //try {zz =xx.sourceDebugExtension();} catch(AbsentInformationException ee) { zz = ee;} pp("sourceDebugExtension() = " + zz); - //fixme: jj; should sourceDebugExtension throw UnsupportedOperationException? - try {zz =xx.sourceDebugExtension();} catch(Exception ee) { zz = ee;} pp("sourceDebugExtension() = " + zz); - // If xx is an array, this can cause a ClassNotLoadedException on the - // component type. Is that a JDI bug? - pp("isStatic() = " + xx.isStatic()); - pp("isAbstract() = " + xx.isAbstract()); - pp("isFinal() = " + xx.isFinal()); - pp("isPrepared() = " + xx.isPrepared()); - pp("isVerified() = " + xx.isVerified()); - pp("isInitialized() = " + xx.isInitialized()); - pp("failedToInitialize() = " + xx.failedToInitialize()); - pp("fields() = " + xx.fields()); - pp("visibleFields() = " + xx.visibleFields()); - pp("allFields() = " + xx.allFields()); - pp("fieldByName(String fieldName) = " + xx.fieldByName("fieldName")); - pp("methods() = " + xx.methods()); - - - List meths = xx.methods(); - Iterator iter = meths.iterator(); - while (iter.hasNext()) { - Method mm = (Method)iter.next(); - pp(" name/sig:" + mm.name() + "/" + mm.signature()); - } - - pp(" visibleMethods() = " + xx.visibleMethods()); - - //if (1 == 1) return; - - pp("allMethods() = " + xx.allMethods()); - - - pp("methodsByName(String name) = " + xx.methodsByName("name")); - pp("methodsByName(String name, String signature) = " + xx.methodsByName("name", "signature")); - pp("nestedTypes() = " + xx.nestedTypes()); - //pp("getValue(Field field) = " + xx.getValue("field")); - pp("getValue(Field field) = " + "fixme: jjh"); - //pp("getValues(List fields) = " + xx.getValues(new List[] = {"fields"})); - pp("getValues(List fields) = " + "fixme: jjh"); - pp("classObject() = " + xx.classObject()); - //x pp("allLineLocations() = " + xx.allLineLocations()); - //x pp("allLineLocations(String stratum, String sourceName) = " + xx.allLineLocations("stratum", "sourceName")); - //x pp("locationsOfLine(int lineNumber) = " + xx.locationsOfLine(89)); - //x pp("locationsOfLine(String stratum, String sourceName, int lineNumber) = " + xx.locationsOfLine("stratum", "sourceName", 89)); - pp("availableStrata() = " + xx.availableStrata()); - pp("defaultStratum() = " + xx.defaultStratum()); - pp("equals(Object obj) = " + xx.equals(xx)); - pp("hashCode() = " + xx.hashCode()); - } - -} - -// try { -// ReferenceType rr = (ReferenceType)xx; -// pp("ReferenceType fields"); - -// try { -// ArrayType ff = (ArrayType)xx; -// pp("ArrayType fields"); - -// } catch(ClassCastException ee) { -// } - -// try { -// ClassType ff = (ClassType)xx; -// pp("ClassType fields"); - -// } catch(ClassCastException ee) { -// } - -// try { -// InterfaceType ff = (InterfaceType)xx; -// pp("InterfaceType fields"); - -// } catch(ClassCastException ee) { -// } - -// } catch(ClassCastException ee) { -// } diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/sagtarg.java b/hotspot/src/jdk.hotspot.agent/test/jdi/sagtarg.java deleted file mode 100644 index 6e7c2c0fa6a..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/sagtarg.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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. - * - */ - -// This is the target debuggee for sagtest.java. -// It just waits which lets the test call all the JDI -// methods on it. - -import java.util.List; - -interface MyInterface { - public void myMethod(); -} - - -abstract class MySuper implements MyInterface { -} - -class sagtarg extends MySuper { - public static void main(String[] args){ - String stringVar = "localVar1"; - int intVar = 89; - List genVar = null; - System.out.println("Howdy!"); - String myStr = ""; - synchronized(myStr) { - try { - myStr.wait(); - } catch (InterruptedException ee) { - } - } - System.out.println("Goodbye from sagtarg!"); - } - - public void myMethod() { - } -} diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/sagtest.java b/hotspot/src/jdk.hotspot.agent/test/jdi/sagtest.java deleted file mode 100644 index 09327a3699c..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/sagtest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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 0000000 - * @summary This is just an exercise of various JDI elements for use in - * testing the SA/JDI client - * - * @author jjh - * - * @run build TestScaffold VMConnection TargetListener TargetAdapter sagdoit - * @run compile -g -source 1.5 sagtarg.java - * @run main sagtest - */ -import com.sun.jdi.*; -import com.sun.jdi.event.*; -import com.sun.jdi.request.*; - -import java.util.*; - - /********** target program **********/ - -// The target program is sagtarg.java - - /********** test program **********/ - -public class sagtest extends TestScaffold { - ReferenceType targetClass; - ThreadReference mainThread; - - sagtest (String args[]) { - super(args); - } - - public static void main(String[] args) throws Exception { - new sagtest(args).startTests(); - } - - /********** event handlers **********/ - - - /********** test core **********/ - - protected void runTests() throws Exception { - /* - * Get to the top of main() - * to determine targetClass and mainThread - */ - BreakpointEvent bpe = startToMain("sagtarg"); - targetClass = bpe.location().declaringType(); - mainThread = bpe.thread(); - EventRequestManager erm = vm().eventRequestManager(); - stepOverLine(mainThread); //stop on 18 - stepOverLine(mainThread); //stop on 19 - stepOverLine(mainThread); //stop on 20 - stepOverLine(mainThread); //stop on 21 - stepOverLine(mainThread); //stop on 22 - - sagdoit mine = new sagdoit(vm()); - mine.doAll(); - - if (!testFailed) { - println("sagtest: passed"); - } else { - throw new Exception("sagtest: failed"); - } - } -} diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/sasanity.sh b/hotspot/src/jdk.hotspot.agent/test/jdi/sasanity.sh deleted file mode 100644 index 0e155526dd8..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/sasanity.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/ksh -# -# Copyright (c) 2003, 2012, 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. -# -# - -# This script is used to run sanity check on vmStructs. -# Each SA class is checked against a given VM. "PASSED" is -# printed if vmStructs are consistent. Else, "FAILED" is -# printed and an exception stack trace follows. - -usage() { - echo "usage: ./sasanity.sh " - echo " is the 1.5 j2se directory against which you want to run sanity check" - exit 1 -} - -if [ "$1" == "" ]; then - usage -fi - -if [ "$1" == "-help" ]; then - usage -fi - -jdk=$1 -shift -OS=`uname` - -javacp=$jdk/lib/sa-jdi.jar:./workdir - -mkdir -p workdir -if [ SASanityChecker.java -nt ./workdir/SASanityChecker.class ] ; then - $jdk/bin/javac -d ./workdir -classpath $javacp SASanityChecker.java - if [ $? != 0 ] ; then - exit 1 - fi -fi - -if [ sagtarg.java -nt ./workdir/sagtarg.class ]; then - $jdk/bin/javac -g -classpath -d $workdir sagtarg.java - if [ $? != 0 ] ; then - exit 1 - fi -fi - -tmp=/tmp/sagsetup -rm -f $tmp -$jdk/bin/java $* sagtarg > $tmp & -pid=$! -while [ ! -s $tmp ] ; do - # Kludge alert! - sleep 2 -done - -$jdk/bin/java -showversion ${OPTIONS} -classpath $javacp $* SASanityChecker $pid -kill -9 $pid diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/serialvm.java b/hotspot/src/jdk.hotspot.agent/test/jdi/serialvm.java deleted file mode 100644 index 7cee578136e..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/serialvm.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2003, 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. - * - */ - -import com.sun.jdi.*; -import com.sun.jdi.connect.*; - -import java.util.Map; -import java.util.List; -import java.util.Iterator; -import java.io.IOException; - - -/* This class is used to test multi VM connectivity feature of - * SA/JDI. Accepts two PIDs as arguments. Connects to first VM - *, disposes it, connects to second VM, disposes second VM. - */ - - -public class serialvm { - static AttachingConnector myPIDConn; - static VirtualMachine vm1; - static VirtualMachine vm2; - static VirtualMachineManager vmmgr; - - public static void println(String msg) { - System.out.println(msg); - } - - private static void usage() { - System.err.println("Usage: java serialvm "); - System.exit(1); - } - - public static void main(String args[]) { - vmmgr = Bootstrap.virtualMachineManager(); - List attachingConnectors = vmmgr.attachingConnectors(); - if (attachingConnectors.isEmpty()) { - System.err.println( "ERROR: No attaching connectors"); - return; - } - Iterator myIt = attachingConnectors.iterator(); - while (myIt.hasNext()) { - AttachingConnector tmpCon = (AttachingConnector)myIt.next(); - if (tmpCon.name().equals( - "sun.jvm.hotspot.jdi.SAPIDAttachingConnector")) { - myPIDConn = tmpCon; - break; - } - } - - int pid1 = 0, pid2 = 0; - String pidText = null; - switch (args.length) { - case (2): - try { - pidText = args[0]; - pid1 = Integer.parseInt(pidText); - System.out.println( "pid1: " + pid1); - pidText = args[1]; - pid2 = Integer.parseInt(pidText); - System.out.println( "pid2: " + pid2); - } catch (NumberFormatException e) { - println(e.getMessage()); - usage(); - } - break; - default: - usage(); - } - - // attach, dispose, attach2, dispose2 pattern - // as opposed to attach1, attach2, dispose1, dispose2 - vm1 = attachPID(pid1); - if (vm1 != null) { - System.out.println("vm1: attached ok!"); - System.out.println(vm1.version()); - sagdoit mine = new sagdoit(vm1); - mine.doAll(); - } - if (vm1 != null) { - vm1.dispose(); - } - - vm2 = attachPID(pid2); - if (vm2 != null) { - System.out.println("vm2: attached ok!"); - System.out.println(vm2.version()); - sagdoit mine = new sagdoit(vm2); - mine.doAll(); - } - - - if (vm2 != null) { - vm2.dispose(); - } - } - - private static VirtualMachine attachPID(int pid) { - Map connArgs = myPIDConn.defaultArguments(); - System.out.println("connArgs = " + connArgs); - VirtualMachine vm; - Connector.StringArgument connArg = (Connector.StringArgument)connArgs.get("pid"); - connArg.setValue(Integer.toString(pid)); - - try { - vm = myPIDConn.attach(connArgs); - } catch (IOException ee) { - System.err.println("ERROR: myPIDConn.attach got IO Exception:" + ee); - vm = null; - } catch (IllegalConnectorArgumentsException ee) { - System.err.println("ERROR: myPIDConn.attach got illegal args exception:" + ee); - vm = null; - } - return vm; - } -} diff --git a/hotspot/src/jdk.hotspot.agent/test/jdi/serialvm.sh b/hotspot/src/jdk.hotspot.agent/test/jdi/serialvm.sh deleted file mode 100644 index e2839aeb2f5..00000000000 --- a/hotspot/src/jdk.hotspot.agent/test/jdi/serialvm.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/ksh -# -# Copyright (c) 2003, 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. -# -# - -doUsage() -{ - cat < - -EOF -} - -if [ $# = 4 ] ; then - doUsage - exit 1 -fi - -jdk=$1 -javacp="$jdk/lib/sa-jdi.jar:$classesDir:$jdk/lib/tools.jar:$jdk/classes:./workdir" - -mkdir -p workdir -if [ sagdoit.java -nt ./workdir/sagdoit.class ] ; then - $jdk/bin/javac -d ./workdir -classpath $javacp sagdoit.java - if [ $? != 0 ] ; then - exit 1 - fi -fi -if [ serialvm.java -nt ./workdir/serialvm.class ] ; then - $jdk/bin/javac -d ./workdir -classpath $javacp serialvm.java - if [ $? != 0 ] ; then - exit 1 - fi -fi - -$jdk/bin/java -Dsun.jvm.hotspot.jdi.ConnectorImpl.DEBUG -Dsun.jvm.hotspot.jdi.SAJDIClassLoader.DEBUG -Djava.class.path=$javacp serialvm $2 $3 diff --git a/hotspot/test/serviceability/sa/TestClassLoaderStats.java b/hotspot/test/serviceability/sa/TestClassLoaderStats.java deleted file mode 100644 index 6cbd9ee42d6..00000000000 --- a/hotspot/test/serviceability/sa/TestClassLoaderStats.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2015, 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. - */ - -import java.util.ArrayList; -import java.util.List; - -import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.Utils; -import jdk.test.lib.apps.LingeredApp; - -/* - * @test - * @summary Started failing on 2016.06.24 due to 8160376 on MacOS X so - * quarantine it on that platform: - * @requires os.family != "mac" - * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes - * @library /testlibrary - * @build jdk.test.lib.* - * @build jdk.test.lib.apps.* - * @run main TestClassLoaderStats - */ -public class TestClassLoaderStats { - - public static void main(String[] args) throws Exception { - if (!Platform.shouldSAAttach()) { - System.out.println("SA attach not expected to work - test skipped."); - return; - } - - LingeredApp app = null; - try { - List vmArgs = new ArrayList(); - vmArgs.add("-XX:+UsePerfData"); - vmArgs.addAll(Utils.getVmOptions()); - app = LingeredApp.startApp(vmArgs); - - System.out.println("Attaching sun.jvm.hotspot.tools.ClassLoaderStats to " + app.getPid()); - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( - "-XX:+UsePerfData", - "sun.jvm.hotspot.tools.ClassLoaderStats", - Long.toString(app.getPid())); - OutputAnalyzer output = ProcessTools.executeProcess(processBuilder); - System.out.println(output.getOutput()); - - output.shouldHaveExitValue(0); - output.shouldContain("Debugger attached successfully."); - // The class loader stats header needs to be presented in the output: - output.shouldMatch("class_loader\\W+classes\\W+bytes\\W+parent_loader\\W+alive?\\W+type"); - output.stderrShouldNotMatch("[E|e]xception"); - output.stderrShouldNotMatch("[E|e]rror"); - } finally { - LingeredApp.stopApp(app); - } - } - -} diff --git a/hotspot/test/serviceability/sa/TestStackTrace.java b/hotspot/test/serviceability/sa/TestStackTrace.java deleted file mode 100644 index de6c9708dbb..00000000000 --- a/hotspot/test/serviceability/sa/TestStackTrace.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2015, 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. - */ - -import java.util.ArrayList; -import java.util.List; - -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; -import jdk.test.lib.Utils; -import jdk.test.lib.apps.LingeredApp; - -/* - * @test - * @summary Started failing on 2016.06.24 due to 8160376 on MacOS X so - * quarantine it on that platform: - * @requires os.family != "mac" - * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes - * @library /testlibrary - * @build jdk.test.lib.* - * @build jdk.test.lib.apps.* - * @run main TestStackTrace - */ -public class TestStackTrace { - - public static void main(String[] args) throws Exception { - if (!Platform.shouldSAAttach()) { - System.out.println("SA attach not expected to work - test skipped."); - return; - } - - LingeredApp app = null; - try { - List vmArgs = new ArrayList(); - vmArgs.add("-XX:+UsePerfData"); - vmArgs.addAll(Utils.getVmOptions()); - app = LingeredApp.startApp(vmArgs); - - System.out.println("Attaching sun.jvm.hotspot.tools.StackTrace to " + app.getPid()); - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( - "-XX:+UsePerfData", - "sun.jvm.hotspot.tools.StackTrace", - Long.toString(app.getPid())); - OutputAnalyzer output = ProcessTools.executeProcess(processBuilder); - System.out.println(output.getOutput()); - - output.shouldHaveExitValue(0); - output.shouldContain("Debugger attached successfully."); - output.stderrShouldNotMatch("[E|e]xception"); - output.stderrShouldNotMatch("[E|e]rror"); - } finally { - LingeredApp.stopApp(app); - } - } - -} From f4338a53f470a3c4c3b360b95424f7b1db6a323f Mon Sep 17 00:00:00 2001 From: Sharath Ballal Date: Mon, 1 Aug 2016 15:38:58 +0300 Subject: [PATCH 104/108] 8160817: Add jsadebugd functionality to jhsdb Add jsadebugd functionality to jhsdb Reviewed-by: dsamersoff --- .../classes/sun/jvm/hotspot/SALauncher.java | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java index 83c86051ba9..8513c109bb6 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -36,6 +36,7 @@ public class SALauncher { private static boolean launcherHelp() { System.out.println(" clhsdb \tcommand line debugger"); + System.out.println(" debugd \tdebug server"); System.out.println(" hsdb \tui debugger"); System.out.println(" jstack --help\tto get more information"); System.out.println(" jmap --help\tto get more information"); @@ -54,6 +55,21 @@ public class SALauncher { return false; } + private static boolean debugdHelp() { + // [options] [server-id] + // [options] [server-id] + java.io.PrintStream out = System.out; + out.print(" [option] [server-id]"); + out.println("\t\t(to connect to a live java process)"); + out.print(" or [option] [server-id]"); + out.println("\t\t(to connect to a core file produced by )"); + out.print("\t\tserver-id is an optional unique id for this debug server, needed "); + out.println("\t\tif multiple debug servers are run on the same machine"); + out.println("where option includes:"); + out.println(" -h | -help\tto print this help message"); + return false; + } + private static boolean jinfoHelp() { // --flags -> -flags // --sysprops -> -sysprops @@ -106,6 +122,9 @@ public class SALauncher { if (toolName.equals("jsnap")) { return jsnapHelp(); } + if (toolName.equals("debugd")) { + return debugdHelp(); + } if (toolName.equals("hsdb") || toolName.equals("clhsdb")) { return commonHelp(); } @@ -377,13 +396,28 @@ public class SALauncher { JSnap.main(newArgs.toArray(new String[newArgs.size()])); } + private static void runDEBUGD(String[] oldArgs) { + if ((oldArgs.length < 1) || (oldArgs.length > 3)) { + debugdHelp(); + } + + // By default SA agent classes prefer Windows process debugger + // to windbg debugger. SA expects special properties to be set + // to choose other debuggers. We will set those here before + // attaching to SA agent. + System.setProperty("sun.jvm.hotspot.debugger.useWindbgDebugger", "true"); + + // delegate to the actual SA debug server. + sun.jvm.hotspot.DebugServer.main(oldArgs); + } + public static void main(String[] args) { // Provide a help if (args.length == 0) { launcherHelp(); return; } - // No arguments imply help for jstack, jmap, jinfo but launch clhsdb and hsdb + // No arguments imply help for debugd, jstack, jmap, jinfo but launch clhsdb and hsdb if (args.length == 1 && !args[0].equals("clhsdb") && !args[0].equals("hsdb")) { toolHelp(args[0]); return; @@ -431,6 +465,11 @@ public class SALauncher { return; } + if (args[0].equals("debugd")) { + runDEBUGD(oldArgs); + return; + } + throw new SAGetoptException("Unknown tool: " + args[0]); } catch (SAGetoptException e) { System.err.println(e.getMessage()); From 8f37b6e451bc2aaf982a8fe0399ee11335d34cb8 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Mon, 1 Aug 2016 16:28:23 -0400 Subject: [PATCH 105/108] 8161445: [BACKOUT] MemberNameTable doesn't purge stale entries Original change caused performance regression in microbenchmarks after GC Reviewed-by: dholmes, ecaspole --- .../src/share/vm/classfile/javaClasses.cpp | 9 ---- .../src/share/vm/classfile/javaClasses.hpp | 2 - hotspot/src/share/vm/oops/instanceKlass.cpp | 11 ++--- hotspot/src/share/vm/oops/instanceKlass.hpp | 2 +- hotspot/src/share/vm/prims/jvm.cpp | 2 +- hotspot/src/share/vm/prims/methodHandles.cpp | 41 +++++-------------- hotspot/src/share/vm/prims/methodHandles.hpp | 5 +-- 7 files changed, 18 insertions(+), 54 deletions(-) diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index d6cdf2e6cb9..6df74ae4244 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -3243,15 +3243,6 @@ void java_lang_invoke_MemberName::set_vmindex(oop mname, intptr_t index) { mname->address_field_put(_vmindex_offset, (address) index); } -bool java_lang_invoke_MemberName::equals(oop mn1, oop mn2) { - if (mn1 == mn2) { - return true; - } - return (vmtarget(mn1) == vmtarget(mn2) && flags(mn1) == flags(mn2) && - vmindex(mn1) == vmindex(mn2) && - clazz(mn1) == clazz(mn2)); -} - oop java_lang_invoke_LambdaForm::vmentry(oop lform) { assert(is_instance(lform), "wrong type"); return lform->obj_field(_vmentry_offset); diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp index 31adeddcacf..7d101b88ea6 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.hpp +++ b/hotspot/src/share/vm/classfile/javaClasses.hpp @@ -1107,8 +1107,6 @@ class java_lang_invoke_MemberName: AllStatic { static int flags_offset_in_bytes() { return _flags_offset; } static int vmtarget_offset_in_bytes() { return _vmtarget_offset; } static int vmindex_offset_in_bytes() { return _vmindex_offset; } - - static bool equals(oop mt1, oop mt2); }; diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index 149c951f7e7..1e7b1b1bb3d 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -2737,7 +2737,7 @@ nmethod* InstanceKlass::lookup_osr_nmethod(const Method* m, int bci, int comp_le return NULL; } -oop InstanceKlass::add_member_name(Handle mem_name, bool intern) { +bool InstanceKlass::add_member_name(Handle mem_name) { jweak mem_name_wref = JNIHandles::make_weak_global(mem_name); MutexLocker ml(MemberNameTable_lock); DEBUG_ONLY(NoSafepointVerifier nsv); @@ -2747,7 +2747,7 @@ oop InstanceKlass::add_member_name(Handle mem_name, bool intern) { // is called! Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mem_name()); if (method->is_obsolete()) { - return NULL; + return false; } else if (method->is_old()) { // Replace method with redefined version java_lang_invoke_MemberName::set_vmtarget(mem_name(), method_with_idnum(method->method_idnum())); @@ -2756,11 +2756,8 @@ oop InstanceKlass::add_member_name(Handle mem_name, bool intern) { if (_member_names == NULL) { _member_names = new (ResourceObj::C_HEAP, mtClass) MemberNameTable(idnum_allocated_count()); } - if (intern) { - return _member_names->find_or_add_member_name(mem_name_wref); - } else { - return _member_names->add_member_name(mem_name_wref); - } + _member_names->add_member_name(mem_name_wref); + return true; } // ----------------------------------------------------------------------------------------------------- diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp index d6bd6fe1fa1..24da1868237 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp @@ -1306,7 +1306,7 @@ public: // JSR-292 support MemberNameTable* member_names() { return _member_names; } void set_member_names(MemberNameTable* member_names) { _member_names = member_names; } - oop add_member_name(Handle member_name, bool intern); + bool add_member_name(Handle member_name); public: // JVMTI support diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index 0a2f1baf532..79c450b002d 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -680,7 +680,7 @@ JVM_ENTRY(jobject, JVM_Clone(JNIEnv* env, jobject handle)) // This can safepoint and redefine method, so need both new_obj and method // in a handle, for two different reasons. new_obj can move, method can be // deleted if nothing is using it on the stack. - m->method_holder()->add_member_name(new_obj(), false); + m->method_holder()->add_member_name(new_obj()); } } diff --git a/hotspot/src/share/vm/prims/methodHandles.cpp b/hotspot/src/share/vm/prims/methodHandles.cpp index f91cf0dd4d3..d21c0fa30e4 100644 --- a/hotspot/src/share/vm/prims/methodHandles.cpp +++ b/hotspot/src/share/vm/prims/methodHandles.cpp @@ -178,7 +178,7 @@ oop MethodHandles::init_MemberName(Handle mname, Handle target) { return NULL; } -oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info, bool intern) { +oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info) { assert(info.resolved_appendix().is_null(), "only normal methods here"); methodHandle m = info.resolved_method(); assert(m.not_null(), "null method handle"); @@ -279,7 +279,13 @@ oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info, bool int // If relevant, the vtable or itable value is stored as vmindex. // This is done eagerly, since it is readily available without // constructing any new objects. - return m->method_holder()->add_member_name(mname, intern); + // TO DO: maybe intern mname_oop + if (m->method_holder()->add_member_name(mname)) { + return mname(); + } else { + // Redefinition caused this to fail. Return NULL (and an exception?) + return NULL; + } } oop MethodHandles::init_field_MemberName(Handle mname, fieldDescriptor& fd, bool is_setter) { @@ -969,9 +975,7 @@ int MethodHandles::find_MemberNames(KlassHandle k, if (!java_lang_invoke_MemberName::is_instance(result())) return -99; // caller bug! CallInfo info(m); - // Since this is going through the methods to create MemberNames, don't search - // for matching methods already in the table - oop saved = MethodHandles::init_method_MemberName(result, info, /*intern*/false); + oop saved = MethodHandles::init_method_MemberName(result, info); if (saved != result()) results->obj_at_put(rfill-1, saved); // show saved instance to user } else if (++overflow >= overflow_limit) { @@ -1052,34 +1056,9 @@ MemberNameTable::~MemberNameTable() { } } -oop MemberNameTable::add_member_name(jweak mem_name_wref) { +void MemberNameTable::add_member_name(jweak mem_name_wref) { assert_locked_or_safepoint(MemberNameTable_lock); this->push(mem_name_wref); - return JNIHandles::resolve(mem_name_wref); -} - -oop MemberNameTable::find_or_add_member_name(jweak mem_name_wref) { - assert_locked_or_safepoint(MemberNameTable_lock); - oop new_mem_name = JNIHandles::resolve(mem_name_wref); - - // Find matching member name in the list. - // This is linear because these because these are short lists. - int len = this->length(); - int new_index = len; - for (int idx = 0; idx < len; idx++) { - oop mname = JNIHandles::resolve(this->at(idx)); - if (mname == NULL) { - new_index = idx; - continue; - } - if (java_lang_invoke_MemberName::equals(new_mem_name, mname)) { - JNIHandles::destroy_weak_global(mem_name_wref); - return mname; - } - } - // Not found, push the new one, or reuse empty slot - this->at_put_grow(new_index, mem_name_wref); - return new_mem_name; } #if INCLUDE_JVMTI diff --git a/hotspot/src/share/vm/prims/methodHandles.hpp b/hotspot/src/share/vm/prims/methodHandles.hpp index 8b20c869b30..4a825464fb8 100644 --- a/hotspot/src/share/vm/prims/methodHandles.hpp +++ b/hotspot/src/share/vm/prims/methodHandles.hpp @@ -66,7 +66,7 @@ class MethodHandles: AllStatic { static Handle new_MemberName(TRAPS); // must be followed by init_MemberName static oop init_MemberName(Handle mname_h, Handle target_h); // compute vmtarget/vmindex from target static oop init_field_MemberName(Handle mname_h, fieldDescriptor& fd, bool is_setter = false); - static oop init_method_MemberName(Handle mname_h, CallInfo& info, bool intern = true); + static oop init_method_MemberName(Handle mname_h, CallInfo& info); static int method_ref_kind(Method* m, bool do_dispatch_if_possible = true); static int find_MemberNames(KlassHandle k, Symbol* name, Symbol* sig, int mflags, KlassHandle caller, @@ -235,8 +235,7 @@ class MemberNameTable : public GrowableArray { public: MemberNameTable(int methods_cnt); ~MemberNameTable(); - oop add_member_name(jweak mem_name_ref); - oop find_or_add_member_name(jweak mem_name_ref); + void add_member_name(jweak mem_name_ref); #if INCLUDE_JVMTI // RedefineClasses() API support: From b0c36d35ed1f1ea462c155e5f66d4f6642c4a46b Mon Sep 17 00:00:00 2001 From: Christoph Langer Date: Mon, 1 Aug 2016 20:41:15 -0400 Subject: [PATCH 106/108] 8162869: Small fixes for AIX perf memory and attach listener Reviewed-by: dsamersoff, dholmes --- hotspot/src/os/aix/vm/attachListener_aix.cpp | 7 ++----- hotspot/src/os/aix/vm/perfMemory_aix.cpp | 18 +++++++++--------- hotspot/src/os/bsd/vm/perfMemory_bsd.cpp | 9 +++++---- hotspot/src/os/linux/vm/perfMemory_linux.cpp | 10 ++++++---- .../src/os/solaris/vm/perfMemory_solaris.cpp | 9 +++++---- 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/hotspot/src/os/aix/vm/attachListener_aix.cpp b/hotspot/src/os/aix/vm/attachListener_aix.cpp index 4e69822008a..06225616bb6 100644 --- a/hotspot/src/os/aix/vm/attachListener_aix.cpp +++ b/hotspot/src/os/aix/vm/attachListener_aix.cpp @@ -383,23 +383,20 @@ AixAttachOperation* AixAttachListener::dequeue() { struct peercred_struct cred_info; socklen_t optlen = sizeof(cred_info); if (::getsockopt(s, SOL_SOCKET, SO_PEERID, (void*)&cred_info, &optlen) == -1) { - int res; - RESTARTABLE(::close(s), res); + ::close(s); continue; } uid_t euid = geteuid(); gid_t egid = getegid(); if (cred_info.euid != euid || cred_info.egid != egid) { - int res; - RESTARTABLE(::close(s), res); + ::close(s); continue; } // peer credential look okay so we read the request AixAttachOperation* op = read_request(s); if (op == NULL) { - int res; ::close(s); continue; } else { diff --git a/hotspot/src/os/aix/vm/perfMemory_aix.cpp b/hotspot/src/os/aix/vm/perfMemory_aix.cpp index 62212be7175..71bf015007b 100644 --- a/hotspot/src/os/aix/vm/perfMemory_aix.cpp +++ b/hotspot/src/os/aix/vm/perfMemory_aix.cpp @@ -951,25 +951,24 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) { // open the file int result; - // No O_NOFOLLOW defined at buildtime, and it is not documented for open; - // so provide a workaround in this case + // provide a workaround in case no O_NOFOLLOW is defined at buildtime #ifdef O_NOFOLLOW RESTARTABLE(::open(filename, oflags), result); #else result = open_o_nofollow(filename, oflags); #endif - if (result == OS_ERR) { if (errno == ENOENT) { - THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), - "Process not found"); + THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), + "Process not found", OS_ERR); } else if (errno == EACCES) { - THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), - "Permission denied"); + THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), + "Permission denied", OS_ERR); } else { - THROW_MSG_0(vmSymbols::java_io_IOException(), os::strerror(errno)); + THROW_MSG_(vmSymbols::java_io_IOException(), + os::strerror(errno), OS_ERR); } } int fd = result; @@ -987,7 +986,7 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) { // memory region on success or NULL on failure. A return value of // NULL will ultimately disable the shared memory feature. // -// On AIX, Solaris and Linux, the name space for shared memory objects +// On AIX, the name space for shared memory objects // is the file system name space. // // A monitoring application attaching to a JVM does not need to know @@ -1011,6 +1010,7 @@ static char* mmap_create_shared(size_t size) { char* dirname = get_user_tmp_dir(user_name); char* filename = get_sharedmem_filename(dirname, vmid); + // get the short filename. char* short_filename = strrchr(filename, '/'); if (short_filename == NULL) { diff --git a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp index f87f81dcabe..2cb2d5915e5 100644 --- a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp +++ b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp @@ -881,14 +881,15 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) { if (result == OS_ERR) { if (errno == ENOENT) { THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), - "Process not found", OS_ERR); + "Process not found", OS_ERR); } else if (errno == EACCES) { THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), - "Permission denied", OS_ERR); + "Permission denied", OS_ERR); } else { - THROW_MSG_(vmSymbols::java_io_IOException(), os::strerror(errno), OS_ERR); + THROW_MSG_(vmSymbols::java_io_IOException(), + os::strerror(errno), OS_ERR); } } int fd = result; @@ -906,7 +907,7 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) { // memory region on success or NULL on failure. A return value of // NULL will ultimately disable the shared memory feature. // -// On Solaris and Bsd, the name space for shared memory objects +// On BSD, the name space for shared memory objects // is the file system name space. // // A monitoring application attaching to a JVM does not need to know diff --git a/hotspot/src/os/linux/vm/perfMemory_linux.cpp b/hotspot/src/os/linux/vm/perfMemory_linux.cpp index 610a1a0263e..da8c572705f 100644 --- a/hotspot/src/os/linux/vm/perfMemory_linux.cpp +++ b/hotspot/src/os/linux/vm/perfMemory_linux.cpp @@ -891,14 +891,15 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) { if (result == OS_ERR) { if (errno == ENOENT) { THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), - "Process not found", OS_ERR); + "Process not found", OS_ERR); } else if (errno == EACCES) { THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), - "Permission denied", OS_ERR); + "Permission denied", OS_ERR); } else { - THROW_MSG_(vmSymbols::java_io_IOException(), os::strerror(errno), OS_ERR); + THROW_MSG_(vmSymbols::java_io_IOException(), + os::strerror(errno), OS_ERR); } } int fd = result; @@ -916,7 +917,7 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) { // memory region on success or NULL on failure. A return value of // NULL will ultimately disable the shared memory feature. // -// On Solaris and Linux, the name space for shared memory objects +// On Linux, the name space for shared memory objects // is the file system name space. // // A monitoring application attaching to a JVM does not need to know @@ -940,6 +941,7 @@ static char* mmap_create_shared(size_t size) { char* dirname = get_user_tmp_dir(user_name); char* filename = get_sharedmem_filename(dirname, vmid); + // get the short filename char* short_filename = strrchr(filename, '/'); if (short_filename == NULL) { diff --git a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp index 9e90b0f08ce..2b80a4feb3e 100644 --- a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp +++ b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp @@ -907,14 +907,15 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) { if (result == OS_ERR) { if (errno == ENOENT) { THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), - "Process not found", OS_ERR); + "Process not found", OS_ERR); } else if (errno == EACCES) { THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), - "Permission denied", OS_ERR); + "Permission denied", OS_ERR); } else { - THROW_MSG_(vmSymbols::java_io_IOException(), os::strerror(errno), OS_ERR); + THROW_MSG_(vmSymbols::java_io_IOException(), + os::strerror(errno), OS_ERR); } } int fd = result; @@ -932,7 +933,7 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) { // memory region on success or NULL on failure. A return value of // NULL will ultimately disable the shared memory feature. // -// On Solaris and Linux, the name space for shared memory objects +// On Solaris, the name space for shared memory objects // is the file system name space. // // A monitoring application attaching to a JVM does not need to know From 18a908de4a1027ef8dd257911de780c1a2e8f7b0 Mon Sep 17 00:00:00 2001 From: Michail Chernov Date: Tue, 2 Aug 2016 15:22:41 +0300 Subject: [PATCH 107/108] 8161604: TestNewSizeFlags fails with RuntimeException: max new size != MaxNewSize value Reviewed-by: sangheki, tschatzl --- hotspot/src/share/vm/prims/whitebox.cpp | 23 +++- .../test/gc/arguments/TestNewSizeFlags.java | 129 +++++++++++------- 2 files changed, 98 insertions(+), 54 deletions(-) diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp index e1a83af6739..6a6389da9ff 100644 --- a/hotspot/src/share/vm/prims/whitebox.cpp +++ b/hotspot/src/share/vm/prims/whitebox.cpp @@ -350,6 +350,11 @@ WB_ENTRY(jlong, WB_GetHeapSpaceAlignment(JNIEnv* env, jobject o)) return (jlong)alignment; WB_END +WB_ENTRY(jlong, WB_GetHeapAlignment(JNIEnv* env, jobject o)) + size_t alignment = Universe::heap()->collector_policy()->heap_alignment(); + return (jlong)alignment; +WB_END + #if INCLUDE_ALL_GCS WB_ENTRY(jboolean, WB_G1IsHumongous(JNIEnv* env, jobject o, jobject obj)) G1CollectedHeap* g1 = G1CollectedHeap::heap(); @@ -401,14 +406,21 @@ WB_ENTRY(jint, WB_G1RegionSize(JNIEnv* env, jobject o)) WB_END WB_ENTRY(jlong, WB_PSVirtualSpaceAlignment(JNIEnv* env, jobject o)) - ParallelScavengeHeap* ps = ParallelScavengeHeap::heap(); - size_t alignment = ps->gens()->virtual_spaces()->alignment(); - return (jlong)alignment; +#if INCLUDE_ALL_GCS + if (UseParallelGC) { + return ParallelScavengeHeap::heap()->gens()->virtual_spaces()->alignment(); + } +#endif // INCLUDE_ALL_GCS + THROW_MSG_0(vmSymbols::java_lang_RuntimeException(), "WB_PSVirtualSpaceAlignment: Parallel GC is not enabled"); WB_END WB_ENTRY(jlong, WB_PSHeapGenerationAlignment(JNIEnv* env, jobject o)) - size_t alignment = ParallelScavengeHeap::heap()->generation_alignment(); - return (jlong)alignment; +#if INCLUDE_ALL_GCS + if (UseParallelGC) { + return ParallelScavengeHeap::heap()->generation_alignment(); + } +#endif // INCLUDE_ALL_GCS + THROW_MSG_0(vmSymbols::java_lang_RuntimeException(), "WB_PSHeapGenerationAlignment: Parallel GC is not enabled"); WB_END WB_ENTRY(jobject, WB_G1AuxiliaryMemoryUsage(JNIEnv* env)) @@ -1693,6 +1705,7 @@ static JNINativeMethod methods[] = { {CC"getVMAllocationGranularity", CC"()J", (void*)&WB_GetVMAllocationGranularity }, {CC"getVMLargePageSize", CC"()J", (void*)&WB_GetVMLargePageSize}, {CC"getHeapSpaceAlignment", CC"()J", (void*)&WB_GetHeapSpaceAlignment}, + {CC"getHeapAlignment", CC"()J", (void*)&WB_GetHeapAlignment}, {CC"isClassAlive0", CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive }, {CC"parseCommandLine0", CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;", diff --git a/hotspot/test/gc/arguments/TestNewSizeFlags.java b/hotspot/test/gc/arguments/TestNewSizeFlags.java index 4762afbf1cb..df016560e8e 100644 --- a/hotspot/test/gc/arguments/TestNewSizeFlags.java +++ b/hotspot/test/gc/arguments/TestNewSizeFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -60,13 +60,13 @@ public class TestNewSizeFlags { // Test NewSize and MaxNewSize testNewSizeFlags(20 * M, 10 * M, 30 * M, 40 * M, options, false); - testNewSizeFlags(10 * M, 20 * M, 30 * M, 40 * M, options, false); + testNewSizeFlags(10 * M, 20 * M, 30 * M, 80 * M, options, false); testNewSizeFlags(-1, 20 * M, 30 * M, 40 * M, options, false); testNewSizeFlags(10 * M, -1, 30 * M, 40 * M, options, false); testNewSizeFlags(20 * M, 20 * M, 30 * M, 40 * M, options, false); testNewSizeFlags(20 * M, 30 * M, 40 * M, 50 * M, options, false); testNewSizeFlags(30 * M, 100 * M, 150 * M, 200 * M, options, false); - testNewSizeFlags(0, -1, 30 * M, 40 * M, options, false); + testNewSizeFlags(20 * M, 30 * M, 128 * M, 128 * M, options, false); // Test -Xmn testXmnFlags(0, 30 * M, 40 * M, options, true); @@ -88,9 +88,11 @@ public class TestNewSizeFlags { long heapSize, long maxHeapSize, LinkedList options, boolean failureExpected) throws Exception { + long expectedNewSize = newSize; + long expectedMaxNewSize = (maxNewSize >= 0 ? Math.max(maxNewSize, newSize) : maxNewSize); testVMOptions(newSize, maxNewSize, heapSize, maxHeapSize, - newSize, (maxNewSize >= 0 ? Math.max(maxNewSize, newSize) : maxNewSize), + expectedNewSize, expectedMaxNewSize, options, failureExpected); } @@ -159,7 +161,9 @@ public class TestNewSizeFlags { "-XX:-UseLargePages", NewSizeVerifier.class.getName(), Long.toString(expectedNewSize), - Long.toString(expectedMaxNewSize) + Long.toString(expectedMaxNewSize), + Long.toString(heapSize), + Long.toString(maxHeapSize) ); vmOptions.removeIf(String::isEmpty); ProcessBuilder procBuilder = ProcessTools.createJavaProcessBuilder(vmOptions.toArray(new String[vmOptions.size()])); @@ -177,7 +181,12 @@ public class TestNewSizeFlags { */ public static class NewSizeVerifier { - static WhiteBox wb = WhiteBox.getWhiteBox(); + private static final WhiteBox WB = WhiteBox.getWhiteBox(); + private static final GCTypes.YoungGCType YOUNG_GC_TYPE = GCTypes.YoungGCType.getYoungGCType(); + private static final long HEAP_SPACE_ALIGNMENT = WB.getHeapSpaceAlignment(); + private static final long HEAP_ALIGNMENT = WB.getHeapAlignment(); + private static final long PS_VIRTUAL_SPACE_ALIGNMENT = + (YOUNG_GC_TYPE == GCTypes.YoungGCType.PSNew) ? WB.psVirtualSpaceAlignment() : 0; public static final int ARRAY_LENGTH = 100; public static final int CHUNK_SIZE = 1024; @@ -185,63 +194,79 @@ public class TestNewSizeFlags { public static byte garbage[][] = new byte[ARRAY_LENGTH][]; public static void main(String args[]) throws Exception { - if (args.length != 2) { - throw new IllegalArgumentException("Expected 2 args: "); + if (args.length != 4) { + throw new IllegalArgumentException("Expected 4 args: "); } final long newSize = Long.valueOf(args[0]); final long maxNewSize = Long.valueOf(args[1]); + final long initialHeapSize = Long.valueOf(args[2]); + final long maxHeapSize = Long.valueOf(args[3]); // verify initial size - verifyNewSize(newSize, maxNewSize); + verifyNewSize(newSize, maxNewSize, initialHeapSize, maxHeapSize); // force GC and verify that size is still correct - AllocationHelper allocator = new AllocationHelper(MAX_ITERATIONS, ARRAY_LENGTH, CHUNK_SIZE, () -> (verifyNewSize(newSize, maxNewSize))); + AllocationHelper allocator = new AllocationHelper(MAX_ITERATIONS, ARRAY_LENGTH, CHUNK_SIZE, () -> (verifyNewSize(newSize, maxNewSize, initialHeapSize, maxHeapSize))); allocator.allocateMemoryAndVerifyNoOOME(); } /** * Verify that actual young gen size conforms NewSize and MaxNewSize values. */ - public static Void verifyNewSize(long newSize, long maxNewSize) { - long alignedNewSize = alignNewSize(newSize); - long alignedMaxNewSize = alignNewSize(maxNewSize); + public static Void verifyNewSize(long newSize, long maxNewSize, + long initialHeapSize, long maxHeapSize) { + long alignedNewSize = alignGenSize(newSize); + long alignedMaxNewSize = alignGenSize(maxNewSize); + long alignedXms = alignHeapSize(initialHeapSize); + long alignedXmx = alignHeapSize(maxHeapSize); MemoryUsage youngGenUsage = getYoungGenUsage(); + long initSize = youngGenUsage.getInit(); + long commitedSize = youngGenUsage.getCommitted(); + long maxSize = youngGenUsage.getMax(); if (newSize != -1) { - if (youngGenUsage.getInit() < alignedNewSize) { + if (initSize < alignedNewSize) { throw new RuntimeException("initial new size < NewSize value: " - + youngGenUsage.getInit() + " < " + alignedNewSize); + + initSize + " < " + alignedNewSize); } - if (youngGenUsage.getCommitted() < alignedNewSize) { + if (commitedSize < alignedNewSize) { throw new RuntimeException("actual new size < NewSize value: " - + youngGenUsage.getCommitted() + " < " + alignedNewSize); + + commitedSize + " < " + alignedNewSize); } // for G1 max new size == committed new size - if (GCTypes.YoungGCType.getYoungGCType() != GCTypes.YoungGCType.G1 - && youngGenUsage.getMax() < alignedNewSize) { + if (YOUNG_GC_TYPE != GCTypes.YoungGCType.G1 + && maxSize < alignedNewSize) { throw new RuntimeException("max new size < NewSize value: " - + youngGenUsage.getMax() + " < " + alignedNewSize); + + maxSize + " < " + alignedNewSize); } } if (maxNewSize != -1) { - if (youngGenUsage.getInit() > alignedMaxNewSize) { + if (initSize > alignedMaxNewSize) { throw new RuntimeException("initial new size > MaxNewSize value: " - + youngGenUsage.getInit() + " > " + alignedMaxNewSize); + + initSize + " > " + alignedMaxNewSize); } - if (youngGenUsage.getCommitted() > alignedMaxNewSize) { + if (commitedSize > alignedMaxNewSize) { throw new RuntimeException("actual new size > MaxNewSize value: " - + youngGenUsage.getCommitted() + " > " + alignedMaxNewSize); + + commitedSize + " > " + alignedMaxNewSize); } - if (GCTypes.YoungGCType.getYoungGCType() != GCTypes.YoungGCType.G1 - && youngGenUsage.getMax() != alignedMaxNewSize) { - throw new RuntimeException("max new size != MaxNewSize value: " - + youngGenUsage.getMax() + " != " + alignedMaxNewSize); + if (alignedXms != alignedXmx) { + if (YOUNG_GC_TYPE != GCTypes.YoungGCType.G1 + && maxSize != alignedMaxNewSize) { + throw new RuntimeException("max new size != MaxNewSize value: " + + maxSize + " != " + alignedMaxNewSize); + } + } else { + if (YOUNG_GC_TYPE != GCTypes.YoungGCType.G1 + && maxSize != alignedNewSize) { + throw new RuntimeException("max new size != NewSize for case InitialHeapSize == MaxHeapSize value: " + + maxSize + " != " + alignedNewSize + " HeapSize == " + alignedXms); + } } } return null; @@ -256,41 +281,47 @@ public class TestNewSizeFlags { * For all GCs used value is 0. */ private static MemoryUsage getYoungGenUsage() { - if (GCTypes.YoungGCType.getYoungGCType() == GCTypes.YoungGCType.G1) { - return new MemoryUsage(HeapRegionUsageTool.getEdenUsage().getInit() - + HeapRegionUsageTool.getSurvivorUsage().getInit(), - 0, - HeapRegionUsageTool.getEdenUsage().getCommitted() - + HeapRegionUsageTool.getSurvivorUsage().getCommitted(), - Long.MAX_VALUE); + MemoryUsage edenUsage = HeapRegionUsageTool.getEdenUsage(); + MemoryUsage survivorUsage = HeapRegionUsageTool.getSurvivorUsage(); + long edenUsageInit = edenUsage.getInit(); + long edenUsageCommited = edenUsage.getCommitted(); + long survivorUsageInit = survivorUsage.getInit(); + long survivorUsageCommited = survivorUsage.getCommitted(); + + if (YOUNG_GC_TYPE == GCTypes.YoungGCType.G1) { + return new MemoryUsage(edenUsageInit + survivorUsageInit, 0, + edenUsageCommited + survivorUsageCommited, Long.MAX_VALUE); } else { - return new MemoryUsage(HeapRegionUsageTool.getEdenUsage().getInit() - + HeapRegionUsageTool.getSurvivorUsage().getInit() * 2, - 0, - HeapRegionUsageTool.getEdenUsage().getCommitted() - + HeapRegionUsageTool.getSurvivorUsage().getCommitted() * 2, - HeapRegionUsageTool.getEdenUsage().getMax() - + HeapRegionUsageTool.getSurvivorUsage().getMax() * 2); + return new MemoryUsage(edenUsageInit + survivorUsageInit * 2, 0, + edenUsageCommited + survivorUsageCommited * 2, + edenUsage.getMax() + survivorUsage.getMax() * 2); } } /** - * Align value regardful to used young GC. + * Align generation size regardful to used young GC. */ - public static long alignNewSize(long value) { - switch (GCTypes.YoungGCType.getYoungGCType()) { + public static long alignGenSize(long value) { + switch (YOUNG_GC_TYPE) { case DefNew: case ParNew: - return HeapRegionUsageTool.alignDown(value, wb.getHeapSpaceAlignment()); + return HeapRegionUsageTool.alignDown(value, HEAP_SPACE_ALIGNMENT); case PSNew: return HeapRegionUsageTool.alignUp(HeapRegionUsageTool.alignDown(value, - wb.getHeapSpaceAlignment()), - wb.psVirtualSpaceAlignment()); + HEAP_SPACE_ALIGNMENT), + PS_VIRTUAL_SPACE_ALIGNMENT); case G1: - return HeapRegionUsageTool.alignUp(value, wb.g1RegionSize()); + return HeapRegionUsageTool.alignUp(value, WB.g1RegionSize()); default: throw new RuntimeException("Unexpected young GC type"); } } + + /** + * Align heap size. + */ + public static long alignHeapSize(long value){ + return HeapRegionUsageTool.alignUp(value,HEAP_ALIGNMENT); + } } } From 71e69edb42688bbe9289324575961f88a7c11a88 Mon Sep 17 00:00:00 2001 From: David Holmes Date: Tue, 2 Aug 2016 16:24:04 -0400 Subject: [PATCH 108/108] 7008747: Header files with conditional behaviour can not be precompiled Reviewed-by: kvn, gthornbr --- hotspot/src/cpu/sparc/vm/register_definitions_sparc.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/register_definitions_sparc.cpp b/hotspot/src/cpu/sparc/vm/register_definitions_sparc.cpp index a27dc432aed..8fd22e24670 100644 --- a/hotspot/src/cpu/sparc/vm/register_definitions_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/register_definitions_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, 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 @@ -25,7 +25,9 @@ // make sure the defines don't screw up the declarations later on in this file #define DONT_USE_REGISTER_DEFINES -#include "precompiled.hpp" +// Note: precompiled headers can not be used in this file because of the above +// definition + #include "asm/assembler.hpp" #include "asm/register.hpp" #include "interp_masm_sparc.hpp"