Mercurial > hg > graal-jvmci-8
changeset 22166:2d03fccbbfa9
Merge with basic-graal
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 08 Jul 2015 15:18:07 +0200 |
parents | 616739e61fb6 (current diff) af6cc957bf04 (diff) |
children | 22b37f37be0a |
files | mx.jvmci/mx_jvmci.py |
diffstat | 11 files changed, 163 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/SpillMoveFactoryBase.java Wed Jul 08 15:18:07 2015 +0200 @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2015, 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 com.oracle.graal.lir.gen; + +import static com.oracle.graal.lir.LIRValueUtil.*; +import static jdk.internal.jvmci.code.ValueUtil.*; + +import java.util.*; + +import jdk.internal.jvmci.meta.*; + +import com.oracle.graal.lir.*; +import com.oracle.graal.lir.LIRInstruction.OperandFlag; +import com.oracle.graal.lir.LIRInstruction.OperandMode; +import com.oracle.graal.lir.StandardOp.StackMove; +import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; + +/** + * Base class for {@link SpillMoveFactory} that checks that the instructions created adhere to the + * contract of {@link SpillMoveFactory}. + */ +public abstract class SpillMoveFactoryBase implements SpillMoveFactory { + + public final LIRInstruction createMove(AllocatableValue result, Value input) { + LIRInstruction inst = createMoveIntern(result, input); + assert checkResult(inst, result, input); + return inst; + } + + public final LIRInstruction createStackMove(AllocatableValue result, Value input) { + LIRInstruction inst = createStackMoveIntern(result, input); + assert checkResult(inst, result, input); + return inst; + } + + protected abstract LIRInstruction createMoveIntern(AllocatableValue result, Value input); + + protected LIRInstruction createStackMoveIntern(AllocatableValue result, Value input) { + return new StackMove(result, input); + } + + /** Closure for {@link SpillMoveFactoryBase#checkResult}. */ + @SuppressWarnings("unused") + private static class CheckClosure { + + private final AllocatableValue result; + private final Value input; + + private int tempCount = 0; + private int aliveCount = 0; + private int stateCount = 0; + private int inputCount = 0; + private int outputCount = 0; + + CheckClosure(AllocatableValue result, Value input) { + this.result = result; + this.input = input; + } + + void tempProc(LIRInstruction op, Value value, OperandMode mode, EnumSet<OperandFlag> flags) { + assert false : String.format("SpillMoveFactory: Instruction %s is not allowed to contain operand %s of mode %s", op, value, mode); + tempCount++; + } + + void stateProc(LIRInstruction op, Value value, OperandMode mode, EnumSet<OperandFlag> flags) { + assert false : String.format("SpillMoveFactory: Instruction %s is not allowed to contain operand %s of mode %s", op, value, mode); + stateCount++; + } + + void aliveProc(LIRInstruction op, Value value, OperandMode mode, EnumSet<OperandFlag> flags) { + assert !isVariable(value) && flags.contains(OperandFlag.UNINITIALIZED) : String.format("SpillMoveFactory: Instruction %s is not allowed to contain operand %s of mode %s", op, value, mode); + aliveCount++; + } + + void inputProc(LIRInstruction op, Value value, OperandMode mode, EnumSet<OperandFlag> flags) { + assert value.equals(input) || isConstant(value) : String.format("SpillMoveFactory: Instruction %s can only have %s as input, got %s", op, input, value); + inputCount++; + } + + void outputProc(LIRInstruction op, Value value, OperandMode mode, EnumSet<OperandFlag> flags) { + assert value.equals(result) : String.format("SpillMoveFactory: Instruction %s can only have %s as input, got %s", op, input, value); + outputCount++; + } + } + + /** Checks that the instructions adheres to the contract of {@link SpillMoveFactory}. */ + private static boolean checkResult(LIRInstruction inst, AllocatableValue result, Value input) { + + SpillMoveFactoryBase.CheckClosure c = new CheckClosure(result, input); + inst.visitEachInput(c::inputProc); + inst.visitEachOutput(c::outputProc); + inst.visitEachAlive(c::aliveProc); + inst.visitEachTemp(c::tempProc); + inst.visitEachState(c::stateProc); + + assert c.outputCount >= 1 : "no output produced" + inst; + assert c.stateCount == 0 : "SpillMoveFactory: instruction must not have a state: " + inst; + return true; + } +}
--- a/jvmci/jdk.internal.jvmci.hotspot.sparc/src/jdk/internal/jvmci/hotspot/sparc/SPARCHotSpotRegisterConfig.java Wed Jul 08 15:11:28 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot.sparc/src/jdk/internal/jvmci/hotspot/sparc/SPARCHotSpotRegisterConfig.java Wed Jul 08 15:18:07 2015 +0200 @@ -235,7 +235,8 @@ // Stack slot is always aligned to its size in bytes but minimum wordsize int typeSize = SPARC.spillSlotSize(target, kind); currentStackOffset = roundUp(currentStackOffset, typeSize); - locations[i] = StackSlot.get(target.getLIRKind(kind.getStackKind()), currentStackOffset, !type.out); + int slotOffset = currentStackOffset + SPARC.REGISTER_SAFE_AREA_SIZE; + locations[i] = StackSlot.get(target.getLIRKind(kind.getStackKind()), slotOffset, !type.out); currentStackOffset += typeSize; } }
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedJavaMethodImpl.java Wed Jul 08 15:11:28 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedJavaMethodImpl.java Wed Jul 08 15:18:07 2015 +0200 @@ -611,7 +611,7 @@ */ public int vtableEntryOffset(ResolvedJavaType resolved) { if (!isInVirtualMethodTable(resolved)) { - throw new JVMCIError("%s does not have a vtable entry", this); + throw new JVMCIError("%s does not have a vtable entry in type %s", this, resolved); } HotSpotVMConfig config = runtime().getConfig(); final int vtableIndex = getVtableIndex((HotSpotResolvedObjectTypeImpl) resolved);
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedObjectTypeImpl.java Wed Jul 08 15:11:28 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedObjectTypeImpl.java Wed Jul 08 15:18:07 2015 +0200 @@ -387,7 +387,7 @@ @Override public ResolvedJavaMethod resolveConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType callerType) { - ResolvedJavaMethod resolvedMethod = resolveMethod(method, callerType, true); + ResolvedJavaMethod resolvedMethod = resolveMethod(method, callerType); if (resolvedMethod == null || resolvedMethod.isAbstract()) { return null; } @@ -395,10 +395,7 @@ } @Override - public ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType, boolean includeAbstract) { - if (!includeAbstract) { - return resolveConcreteMethod(method, callerType); - } + public ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType) { assert !callerType.isArray(); if (method.isConcrete() && method.getDeclaringClass().equals(this) && method.isPublic()) { return method; @@ -520,7 +517,7 @@ * The holder may be a subtype of the declaredHolder so make sure to resolve the method to * the correct method for the subtype. */ - HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) resolveMethod(hmethod, this, true); + HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) resolveMethod(hmethod, this); if (resolvedMethod == null) { // The type isn't known to implement the method. return null;
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedPrimitiveType.java Wed Jul 08 15:11:28 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedPrimitiveType.java Wed Jul 08 15:18:07 2015 +0200 @@ -179,7 +179,7 @@ } @Override - public ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType, boolean includeAbstract) { + public ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType) { return null; }
--- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/ResolvedJavaType.java Wed Jul 08 15:11:28 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/ResolvedJavaType.java Wed Jul 08 15:18:07 2015 +0200 @@ -234,14 +234,10 @@ * * @param method the method to select the implementation of * @param callerType the caller or context type used to perform access checks - * @param includeAbstract whether abstract methods should be returned. If it is {@code false} - * this method behaves like {@link #resolveConcreteMethod}. This is just a temporary - * parameter to highlight the changed semantics of this method. TODO (je) remove this - * flag. * @return the link-time resolved method (might be abstract) or {@code null} if it can not be * linked */ - ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType, boolean includeAbstract); + ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType); /** * Resolves the method implementation for virtual dispatches on objects of this dynamic type.
--- a/jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/ResolvedJavaTypeResolveMethodTest.java Wed Jul 08 15:11:28 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/ResolvedJavaTypeResolveMethodTest.java Wed Jul 08 15:18:07 2015 +0200 @@ -93,9 +93,9 @@ ResolvedJavaMethod di = getMethod(i, "d"); ResolvedJavaMethod dc = getMethod(c, "d"); - assertEquals(di, i.resolveMethod(di, c, true)); - assertEquals(di, b.resolveMethod(di, c, true)); - assertEquals(dc, c.resolveMethod(di, c, true)); + assertEquals(di, i.resolveMethod(di, c)); + assertEquals(di, b.resolveMethod(di, c)); + assertEquals(dc, c.resolveMethod(di, c)); } @Test @@ -105,8 +105,8 @@ ResolvedJavaType c = getType(C.class); ResolvedJavaMethod priv = getMethod(a, "priv"); - assertNull(a.resolveMethod(priv, c, true)); - assertNull(b.resolveMethod(priv, c, true)); + assertNull(a.resolveMethod(priv, c)); + assertNull(b.resolveMethod(priv, c)); } @Test @@ -120,16 +120,16 @@ ResolvedJavaMethod absb = getMethod(b, "abs"); ResolvedJavaMethod abse = getMethod(e, "abs"); - assertEquals(absa, a.resolveMethod(absa, c, true)); - assertEquals(absa, d.resolveMethod(absa, c, true)); + assertEquals(absa, a.resolveMethod(absa, c)); + assertEquals(absa, d.resolveMethod(absa, c)); - assertEquals(absb, b.resolveMethod(absa, c, true)); - assertEquals(absb, b.resolveMethod(absb, c, true)); - assertEquals(absb, c.resolveMethod(absa, c, true)); - assertEquals(absb, c.resolveMethod(absb, c, true)); - assertEquals(abse, e.resolveMethod(absa, c, true)); - assertNull(e.resolveMethod(absb, c, true)); - assertEquals(abse, e.resolveMethod(abse, c, true)); + assertEquals(absb, b.resolveMethod(absa, c)); + assertEquals(absb, b.resolveMethod(absb, c)); + assertEquals(absb, c.resolveMethod(absa, c)); + assertEquals(absb, c.resolveMethod(absb, c)); + assertEquals(abse, e.resolveMethod(absa, c)); + assertNull(e.resolveMethod(absb, c)); + assertEquals(abse, e.resolveMethod(abse, c)); } @Test @@ -141,14 +141,14 @@ ResolvedJavaMethod v2a = getMethod(a, "v2"); ResolvedJavaMethod v2b = getMethod(b, "v2"); - assertEquals(v1a, a.resolveMethod(v1a, c, true)); - assertEquals(v1a, b.resolveMethod(v1a, c, true)); - assertEquals(v1a, c.resolveMethod(v1a, c, true)); - assertEquals(v2a, a.resolveMethod(v2a, c, true)); - assertEquals(v2b, b.resolveMethod(v2a, c, true)); - assertEquals(v2b, b.resolveMethod(v2b, c, true)); - assertEquals(v2b, c.resolveMethod(v2a, c, true)); - assertEquals(v2b, c.resolveMethod(v2b, c, true)); + assertEquals(v1a, a.resolveMethod(v1a, c)); + assertEquals(v1a, b.resolveMethod(v1a, c)); + assertEquals(v1a, c.resolveMethod(v1a, c)); + assertEquals(v2a, a.resolveMethod(v2a, c)); + assertEquals(v2b, b.resolveMethod(v2a, c)); + assertEquals(v2b, b.resolveMethod(v2b, c)); + assertEquals(v2b, c.resolveMethod(v2a, c)); + assertEquals(v2b, c.resolveMethod(v2b, c)); }
--- a/jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestResolvedJavaType.java Wed Jul 08 15:11:28 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestResolvedJavaType.java Wed Jul 08 15:18:07 2015 +0200 @@ -563,7 +563,7 @@ for (Method m : c.getDeclaredMethods()) { if (JAVA_VERSION <= 1.7D || (!isStatic(m.getModifiers()) && !isPrivate(m.getModifiers()))) { ResolvedJavaMethod resolved = metaAccess.lookupJavaMethod(m); - ResolvedJavaMethod impl = type.resolveMethod(resolved, context, true); + ResolvedJavaMethod impl = type.resolveMethod(resolved, context); ResolvedJavaMethod expected = resolved.isDefault() || resolved.isAbstract() ? resolved : null; assertEquals(m.toString(), expected, impl); } else {
--- a/jvmci/jdk.internal.jvmci.sparc/src/jdk/internal/jvmci/sparc/SPARC.java Wed Jul 08 15:11:28 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.sparc/src/jdk/internal/jvmci/sparc/SPARC.java Wed Jul 08 15:18:07 2015 +0200 @@ -244,6 +244,11 @@ public static final int INSTRUCTION_SIZE = 4; + /** + * Size to keep free for flushing the register-window to stack. + */ + public static final int REGISTER_SAFE_AREA_SIZE = 128; + public final Set<CPUFeature> features; public SPARC(Set<CPUFeature> features) {
--- a/mx.jvmci/mx_jvmci.py Wed Jul 08 15:11:28 2015 +0200 +++ b/mx.jvmci/mx_jvmci.py Wed Jul 08 15:18:07 2015 +0200 @@ -1233,10 +1233,10 @@ with Task('UnitTests:hosted-product', tasks) as t: if t: unittest(['--enable-timing', '--verbose', '--fail-fast']) - # Run unit tests on server-hosted-jvmci with -G:+SSA_LIR + # Run unit tests on server-hosted-jvmci with -G:-SSA_LIR with VM('server', 'product'): - with Task('UnitTestsSSA:hosted-product', tasks) as t: - if t: unittest(['--enable-timing', '--verbose', '--fail-fast', '-G:+SSA_LIR']) + with Task('UnitTestsNonSSA:hosted-product', tasks) as t: + if t: unittest(['--enable-timing', '--verbose', '--fail-fast', '-G:-SSA_LIR']) # Run ctw against rt.jar on server-hosted-jvmci with VM('server', 'product'): with Task('CTW:hosted-product', tasks) as t: @@ -1281,10 +1281,10 @@ vm(['-XX:-TieredCompilation', '-G:RegisterPressure=' + registers, '-esa', '-version']) with VM('jvmci', 'product'): - with Task('BootstrapSSAWithRegisterPressure:product', tasks) as t: + with Task('BootstrapNonSSAWithRegisterPressure:product', tasks) as t: if t: registers = 'o0,o1,o2,o3,f8,f9,d32,d34' if platform.processor() == 'sparc' else 'rbx,r11,r10,r14,xmm3,xmm11,xmm14' - vm(['-XX:-TieredCompilation', '-G:+SSA_LIR', '-G:RegisterPressure=' + registers, '-esa', '-version']) + vm(['-XX:-TieredCompilation', '-G:-SSA_LIR', '-G:RegisterPressure=' + registers, '-esa', '-version']) with VM('jvmci', 'product'): with Task('BootstrapWithImmutableCode:product', tasks) as t:
--- a/src/share/vm/jvmci/jvmciCodeInstaller.cpp Wed Jul 08 15:11:28 2015 +0200 +++ b/src/share/vm/jvmci/jvmciCodeInstaller.cpp Wed Jul 08 15:18:07 2015 +0200 @@ -433,7 +433,7 @@ methodHandle method = getMethodFromHotSpotMethod(HotSpotCompiledNmethod::method(compiled_code)); jint entry_bci = HotSpotCompiledNmethod::entryBCI(compiled_code); jint id = HotSpotCompiledNmethod::id(compiled_code); - jboolean has_unsafe_access = HotSpotCompiledNmethod::hasUnsafeAccess(compiled_code); + bool has_unsafe_access = HotSpotCompiledNmethod::hasUnsafeAccess(compiled_code) == JNI_TRUE; JVMCIEnv* env = (JVMCIEnv*) (address) HotSpotCompiledNmethod::jvmciEnv(compiled_code); if (id == -1) { // Make sure a valid compile_id is associated with every compile @@ -442,7 +442,7 @@ result = JVMCIEnv::register_method(method, nm, entry_bci, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, JVMCICompiler::instance(), _debug_recorder, _dependencies, env, id, - (bool) has_unsafe_access, _has_wide_vector, installed_code, compiled_code, speculation_log); + has_unsafe_access, _has_wide_vector, installed_code, compiled_code, speculation_log); cb = nm; }