# HG changeset patch # User Doug Simon # Date 1443539382 -7200 # Node ID 638bfbc6727035c2b5a8f5932141bd5261bfb064 # Parent cbc844f64937b3337010b06c08259fe876630140 added CodeCacheProvider.getMaxCallTargetOffset and made CompilerToVM.getMaxCallTargetOffset package-private diff -r cbc844f64937 -r 638bfbc67270 graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/spi/ForeignCallLinkage.java --- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/spi/ForeignCallLinkage.java Tue Sep 29 15:56:37 2015 +0200 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/spi/ForeignCallLinkage.java Tue Sep 29 17:09:42 2015 +0200 @@ -44,8 +44,8 @@ CallingConvention getIncomingCallingConvention(); /** - * Returns the maximum absolute offset of PC relative call to this stub from any position in the - * code cache or -1 when not applicable. Intended for determining the required size of + * Returns the maximum absolute offset of a PC relative call to this stub from any position in + * the code cache or -1 when not applicable. Intended for determining the required size of * address/offset fields. */ long getMaxCallTargetOffset(); diff -r cbc844f64937 -r 638bfbc67270 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java Tue Sep 29 15:56:37 2015 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java Tue Sep 29 17:09:42 2015 +0200 @@ -41,7 +41,6 @@ import jdk.internal.jvmci.code.CodeCacheProvider; import jdk.internal.jvmci.code.RegisterValue; import jdk.internal.jvmci.code.TargetDescription; -import jdk.internal.jvmci.hotspot.CompilerToVM; import jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntimeProvider; import jdk.internal.jvmci.hotspot.HotSpotVMConfig; import jdk.internal.jvmci.meta.LIRKind; @@ -76,9 +75,8 @@ RegisterValue exception = rax.asValue(LIRKind.reference(word)); RegisterValue exceptionPc = rdx.asValue(LIRKind.value(word)); CallingConvention exceptionCc = new CallingConvention(0, ILLEGAL, exception, exceptionPc); - CompilerToVM vm = jvmciRuntime.getCompilerToVM(); - register(new HotSpotForeignCallLinkageImpl(vm, EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF_NOFP, null, exceptionCc, NOT_REEXECUTABLE, any())); - register(new HotSpotForeignCallLinkageImpl(vm, EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF_NOFP, exceptionCc, null, NOT_REEXECUTABLE, any())); + register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF_NOFP, null, exceptionCc, NOT_REEXECUTABLE, any())); + register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF_NOFP, exceptionCc, null, NOT_REEXECUTABLE, any())); if (PreferGraalStubs.getValue()) { link(new AMD64DeoptimizationStub(providers, target, config, registerStubCall(DEOPTIMIZATION_HANDLER, REEXECUTABLE, LEAF, NO_LOCATIONS))); diff -r cbc844f64937 -r 638bfbc67270 graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java Tue Sep 29 15:56:37 2015 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java Tue Sep 29 17:09:42 2015 +0200 @@ -41,7 +41,6 @@ import jdk.internal.jvmci.code.CodeCacheProvider; import jdk.internal.jvmci.code.RegisterValue; import jdk.internal.jvmci.code.TargetDescription; -import jdk.internal.jvmci.hotspot.CompilerToVM; import jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntimeProvider; import jdk.internal.jvmci.meta.JavaKind; import jdk.internal.jvmci.meta.LIRKind; @@ -78,9 +77,8 @@ RegisterValue incomingExceptionPc = i1.asValue(LIRKind.value(word)); CallingConvention outgoingExceptionCc = new CallingConvention(0, ILLEGAL, outgoingException, outgoingExceptionPc); CallingConvention incomingExceptionCc = new CallingConvention(0, ILLEGAL, incomingException, incomingExceptionPc); - CompilerToVM vm = jvmciRuntime.getCompilerToVM(); - register(new HotSpotForeignCallLinkageImpl(vm, EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF_NOFP, outgoingExceptionCc, incomingExceptionCc, NOT_REEXECUTABLE, any())); - register(new HotSpotForeignCallLinkageImpl(vm, EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF_NOFP, outgoingExceptionCc, incomingExceptionCc, NOT_REEXECUTABLE, any())); + register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF_NOFP, outgoingExceptionCc, incomingExceptionCc, NOT_REEXECUTABLE, any())); + register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF_NOFP, outgoingExceptionCc, incomingExceptionCc, NOT_REEXECUTABLE, any())); if (PreferGraalStubs.getValue()) { link(new SPARCDeoptimizationStub(providers, target, registerStubCall(DEOPTIMIZATION_HANDLER, REEXECUTABLE, LEAF, NO_LOCATIONS))); diff -r cbc844f64937 -r 638bfbc67270 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotForeignCallLinkageImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotForeignCallLinkageImpl.java Tue Sep 29 15:56:37 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotForeignCallLinkageImpl.java Tue Sep 29 17:09:42 2015 +0200 @@ -23,6 +23,7 @@ package com.oracle.graal.hotspot; import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_REGISTERS; +import static jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntime.runtime; import java.util.Set; @@ -33,7 +34,6 @@ import jdk.internal.jvmci.code.Register; import jdk.internal.jvmci.code.RegisterConfig; import jdk.internal.jvmci.code.TargetDescription; -import jdk.internal.jvmci.hotspot.CompilerToVM; import jdk.internal.jvmci.hotspot.HotSpotForeignCallTarget; import jdk.internal.jvmci.hotspot.HotSpotProxified; import jdk.internal.jvmci.meta.AllocatableValue; @@ -90,8 +90,6 @@ private final boolean reexecutable; - private final CompilerToVM vm; - /** * Creates a {@link HotSpotForeignCallLinkage}. * @@ -107,12 +105,11 @@ * re-executed. * @param killedLocations the memory locations killed by the call */ - public static HotSpotForeignCallLinkage create(MetaAccessProvider metaAccess, CodeCacheProvider codeCache, HotSpotForeignCallsProvider foreignCalls, CompilerToVM vm, - ForeignCallDescriptor descriptor, long address, RegisterEffect effect, Type outgoingCcType, Type incomingCcType, Transition transition, boolean reexecutable, - LocationIdentity... killedLocations) { + public static HotSpotForeignCallLinkage create(MetaAccessProvider metaAccess, CodeCacheProvider codeCache, HotSpotForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, + long address, RegisterEffect effect, Type outgoingCcType, Type incomingCcType, Transition transition, boolean reexecutable, LocationIdentity... killedLocations) { CallingConvention outgoingCc = createCallingConvention(metaAccess, codeCache, descriptor, outgoingCcType); CallingConvention incomingCc = incomingCcType == null ? null : createCallingConvention(metaAccess, codeCache, descriptor, incomingCcType); - HotSpotForeignCallLinkageImpl linkage = new HotSpotForeignCallLinkageImpl(vm, descriptor, address, effect, transition, outgoingCc, incomingCc, reexecutable, killedLocations); + HotSpotForeignCallLinkageImpl linkage = new HotSpotForeignCallLinkageImpl(descriptor, address, effect, transition, outgoingCc, incomingCc, reexecutable, killedLocations); if (outgoingCcType == Type.NativeCall) { linkage.temporaries = foreignCalls.getNativeABICallerSaveRegisters(); } @@ -143,10 +140,9 @@ } } - public HotSpotForeignCallLinkageImpl(CompilerToVM vm, ForeignCallDescriptor descriptor, long address, RegisterEffect effect, Transition transition, CallingConvention outgoingCallingConvention, + public HotSpotForeignCallLinkageImpl(ForeignCallDescriptor descriptor, long address, RegisterEffect effect, Transition transition, CallingConvention outgoingCallingConvention, CallingConvention incomingCallingConvention, boolean reexecutable, LocationIdentity... killedLocations) { super(address); - this.vm = vm; this.descriptor = descriptor; this.address = address; this.effect = effect; @@ -196,7 +192,7 @@ } public long getMaxCallTargetOffset() { - return vm.getMaxCallTargetOffset(address); + return runtime().getHostJVMCIBackend().getCodeCache().getMaxCallTargetOffset(address); } public ForeignCallDescriptor getDescriptor() { diff -r cbc844f64937 -r 638bfbc67270 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotForeignCallsProviderImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotForeignCallsProviderImpl.java Tue Sep 29 15:56:37 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotForeignCallsProviderImpl.java Tue Sep 29 17:09:42 2015 +0200 @@ -32,7 +32,6 @@ import jdk.internal.jvmci.code.CallingConvention; import jdk.internal.jvmci.code.CodeCacheProvider; -import jdk.internal.jvmci.hotspot.CompilerToVM; import jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntimeProvider; import jdk.internal.jvmci.meta.LocationIdentity; import jdk.internal.jvmci.meta.MetaAccessProvider; @@ -93,8 +92,7 @@ * @param killedLocations the memory locations killed by the stub call */ public HotSpotForeignCallLinkage registerStubCall(ForeignCallDescriptor descriptor, boolean reexecutable, Transition transition, LocationIdentity... killedLocations) { - CompilerToVM vm = jvmciRuntime.getCompilerToVM(); - return register(HotSpotForeignCallLinkageImpl.create(metaAccess, codeCache, this, vm, descriptor, 0L, PRESERVES_REGISTERS, JavaCall, JavaCallee, transition, reexecutable, killedLocations)); + return register(HotSpotForeignCallLinkageImpl.create(metaAccess, codeCache, this, descriptor, 0L, PRESERVES_REGISTERS, JavaCall, JavaCallee, transition, reexecutable, killedLocations)); } /** @@ -116,8 +114,7 @@ Class resultType = descriptor.getResultType(); assert address != 0; assert transition != NOT_LEAF || resultType.isPrimitive() || Word.class.isAssignableFrom(resultType) : "non-leaf foreign calls must return objects in thread local storage: " + descriptor; - CompilerToVM vm = jvmciRuntime.getCompilerToVM(); - return register(HotSpotForeignCallLinkageImpl.create(metaAccess, codeCache, this, vm, descriptor, address, effect, outgoingCcType, null, transition, reexecutable, killedLocations)); + return register(HotSpotForeignCallLinkageImpl.create(metaAccess, codeCache, this, descriptor, address, effect, outgoingCcType, null, transition, reexecutable, killedLocations)); } /** diff -r cbc844f64937 -r 638bfbc67270 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Tue Sep 29 15:56:37 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Tue Sep 29 17:09:42 2015 +0200 @@ -99,14 +99,14 @@ */ public ForeignCallStub(HotSpotJVMCIRuntimeProvider runtime, HotSpotProviders providers, long address, ForeignCallDescriptor descriptor, boolean prependThread, Transition transition, boolean reexecutable, LocationIdentity... killedLocations) { - super(providers, HotSpotForeignCallLinkageImpl.create(providers.getMetaAccess(), providers.getCodeCache(), providers.getForeignCalls(), runtime.getCompilerToVM(), descriptor, 0L, - PRESERVES_REGISTERS, JavaCall, JavaCallee, transition, reexecutable, killedLocations)); + super(providers, HotSpotForeignCallLinkageImpl.create(providers.getMetaAccess(), providers.getCodeCache(), providers.getForeignCalls(), descriptor, 0L, PRESERVES_REGISTERS, + JavaCall, JavaCallee, transition, reexecutable, killedLocations)); this.jvmciRuntime = runtime; this.prependThread = prependThread; Class[] targetParameterTypes = createTargetParameters(descriptor); ForeignCallDescriptor targetSig = new ForeignCallDescriptor(descriptor.getName() + ":C", descriptor.getResultType(), targetParameterTypes); - target = HotSpotForeignCallLinkageImpl.create(providers.getMetaAccess(), providers.getCodeCache(), providers.getForeignCalls(), runtime.getCompilerToVM(), targetSig, address, - DESTROYS_REGISTERS, NativeCall, NativeCall, transition, reexecutable, killedLocations); + target = HotSpotForeignCallLinkageImpl.create(providers.getMetaAccess(), providers.getCodeCache(), providers.getForeignCalls(), targetSig, address, DESTROYS_REGISTERS, + NativeCall, NativeCall, transition, reexecutable, killedLocations); } /** diff -r cbc844f64937 -r 638bfbc67270 mx.graal/suite.py --- a/mx.graal/suite.py Tue Sep 29 15:56:37 2015 +0200 +++ b/mx.graal/suite.py Tue Sep 29 17:09:42 2015 +0200 @@ -6,7 +6,7 @@ "suites": [ { "name" : "jvmci", - "version" : "b6b46b741102e33d6c7cf04266b69dc95b18a632", + "version" : "2e71226319dabc82684ea82cd33a6763350b70a4", "urls" : [ {"url" : "http://lafo.ssw.uni-linz.ac.at/hg/graal-jvmci-8", "kind" : "hg"}, {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},