changeset 22633:bd57042c2da5

Make narrow pointer kinds configurable by backend.
author Roland Schatz <roland.schatz@oracle.com>
date Tue, 15 Sep 2015 16:52:18 +0200
parents 8b18c68ac486
children 02482c5a535a
files graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/spi/LIRKindTool.java graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/DefaultHotSpotLIRKindTool.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/HotSpotLIRKindTool.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/KlassPointerStamp.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/NarrowOopStamp.java
diffstat 7 files changed, 197 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/spi/LIRKindTool.java	Tue Sep 15 15:36:07 2015 +0200
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/spi/LIRKindTool.java	Tue Sep 15 16:52:18 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,11 +29,23 @@
  */
 public interface LIRKindTool {
 
+    /**
+     * Get an architecture specific integer kind of a certain size.
+     */
     LIRKind getIntegerKind(int bits);
 
+    /**
+     * Get an architecture specific floating point kind of a certain size.
+     */
     LIRKind getFloatingKind(int bits);
 
+    /**
+     * Get the architecture specific kind used to represent Java objects.
+     */
     LIRKind getObjectKind();
 
+    /**
+     * Get the architecture specific kind pointer-sized integer kind.
+     */
     LIRKind getWordKind();
 }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Tue Sep 15 15:36:07 2015 +0200
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Tue Sep 15 16:52:18 2015 +0200
@@ -77,6 +77,7 @@
 import com.oracle.graal.hotspot.amd64.AMD64HotSpotMove.StoreRbpOp;
 import com.oracle.graal.hotspot.debug.BenchmarkCounters;
 import com.oracle.graal.hotspot.meta.HotSpotProviders;
+import com.oracle.graal.hotspot.nodes.type.DefaultHotSpotLIRKindTool;
 import com.oracle.graal.hotspot.stubs.Stub;
 import com.oracle.graal.lir.ConstantValue;
 import com.oracle.graal.lir.LIR;
@@ -102,7 +103,6 @@
 import com.oracle.graal.lir.amd64.AMD64ZapRegistersOp;
 import com.oracle.graal.lir.asm.CompilationResultBuilder;
 import com.oracle.graal.lir.framemap.FrameMapBuilder;
-import com.oracle.graal.lir.gen.DefaultLIRKindTool;
 import com.oracle.graal.lir.gen.LIRGenerationResult;
 
 /**
@@ -114,7 +114,7 @@
     private HotSpotLockStack lockStack;
 
     protected AMD64HotSpotLIRGenerator(HotSpotProviders providers, HotSpotVMConfig config, CallingConvention cc, LIRGenerationResult lirGenRes) {
-        this(new DefaultLIRKindTool(providers.getCodeCache().getTarget().wordKind), providers, config, cc, lirGenRes);
+        this(new DefaultHotSpotLIRKindTool(providers.getCodeCache().getTarget().wordKind), providers, config, cc, lirGenRes);
     }
 
     protected AMD64HotSpotLIRGenerator(LIRKindTool lirKindTool, HotSpotProviders providers, HotSpotVMConfig config, CallingConvention cc, LIRGenerationResult lirGenRes) {
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java	Tue Sep 15 15:36:07 2015 +0200
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java	Tue Sep 15 16:52:18 2015 +0200
@@ -22,38 +22,109 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-import static com.oracle.graal.hotspot.HotSpotBackend.*;
-import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
-import static com.oracle.graal.lir.LIRValueUtil.*;
-import static jdk.internal.jvmci.hotspot.HotSpotCompressedNullConstant.*;
-import static jdk.internal.jvmci.sparc.SPARC.*;
+import static com.oracle.graal.hotspot.HotSpotBackend.FETCH_UNROLL_INFO;
+import static com.oracle.graal.hotspot.HotSpotBackend.UNCOMMON_TRAP;
+import static com.oracle.graal.hotspot.HotSpotGraalRuntime.getHostWordKind;
+import static com.oracle.graal.hotspot.HotSpotGraalRuntime.runtime;
+import static com.oracle.graal.lir.LIRValueUtil.asConstant;
+import static com.oracle.graal.lir.LIRValueUtil.asJavaConstant;
+import static com.oracle.graal.lir.LIRValueUtil.isConstantValue;
+import static com.oracle.graal.lir.LIRValueUtil.isJavaConstant;
+import static jdk.internal.jvmci.hotspot.HotSpotCompressedNullConstant.COMPRESSED_NULL;
+import static jdk.internal.jvmci.meta.JavaConstant.INT_0;
+import static jdk.internal.jvmci.sparc.SPARC.d32;
+import static jdk.internal.jvmci.sparc.SPARC.d34;
+import static jdk.internal.jvmci.sparc.SPARC.d36;
+import static jdk.internal.jvmci.sparc.SPARC.d38;
+import static jdk.internal.jvmci.sparc.SPARC.d40;
+import static jdk.internal.jvmci.sparc.SPARC.d42;
+import static jdk.internal.jvmci.sparc.SPARC.d44;
+import static jdk.internal.jvmci.sparc.SPARC.d46;
+import static jdk.internal.jvmci.sparc.SPARC.d48;
+import static jdk.internal.jvmci.sparc.SPARC.d50;
+import static jdk.internal.jvmci.sparc.SPARC.d52;
+import static jdk.internal.jvmci.sparc.SPARC.d54;
+import static jdk.internal.jvmci.sparc.SPARC.d56;
+import static jdk.internal.jvmci.sparc.SPARC.d58;
+import static jdk.internal.jvmci.sparc.SPARC.d60;
+import static jdk.internal.jvmci.sparc.SPARC.d62;
+import static jdk.internal.jvmci.sparc.SPARC.f0;
+import static jdk.internal.jvmci.sparc.SPARC.f10;
+import static jdk.internal.jvmci.sparc.SPARC.f12;
+import static jdk.internal.jvmci.sparc.SPARC.f14;
+import static jdk.internal.jvmci.sparc.SPARC.f16;
+import static jdk.internal.jvmci.sparc.SPARC.f18;
+import static jdk.internal.jvmci.sparc.SPARC.f2;
+import static jdk.internal.jvmci.sparc.SPARC.f20;
+import static jdk.internal.jvmci.sparc.SPARC.f22;
+import static jdk.internal.jvmci.sparc.SPARC.f24;
+import static jdk.internal.jvmci.sparc.SPARC.f26;
+import static jdk.internal.jvmci.sparc.SPARC.f28;
+import static jdk.internal.jvmci.sparc.SPARC.f30;
+import static jdk.internal.jvmci.sparc.SPARC.f4;
+import static jdk.internal.jvmci.sparc.SPARC.f6;
+import static jdk.internal.jvmci.sparc.SPARC.f8;
+import static jdk.internal.jvmci.sparc.SPARC.g1;
+import static jdk.internal.jvmci.sparc.SPARC.g3;
+import static jdk.internal.jvmci.sparc.SPARC.g4;
+import static jdk.internal.jvmci.sparc.SPARC.g5;
 
-import java.util.*;
+import java.util.Map;
 
-import jdk.internal.jvmci.code.*;
-import jdk.internal.jvmci.common.*;
-import jdk.internal.jvmci.hotspot.*;
+import jdk.internal.jvmci.code.CallingConvention;
+import jdk.internal.jvmci.code.Register;
+import jdk.internal.jvmci.code.RegisterValue;
+import jdk.internal.jvmci.code.StackSlot;
+import jdk.internal.jvmci.code.StackSlotValue;
+import jdk.internal.jvmci.code.VirtualStackSlot;
+import jdk.internal.jvmci.common.JVMCIError;
+import jdk.internal.jvmci.hotspot.HotSpotCompressedNullConstant;
+import jdk.internal.jvmci.hotspot.HotSpotMetaspaceConstant;
+import jdk.internal.jvmci.hotspot.HotSpotObjectConstant;
+import jdk.internal.jvmci.hotspot.HotSpotVMConfig;
 import jdk.internal.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
-import jdk.internal.jvmci.meta.*;
-import jdk.internal.jvmci.sparc.*;
+import jdk.internal.jvmci.meta.AllocatableValue;
+import jdk.internal.jvmci.meta.Constant;
+import jdk.internal.jvmci.meta.DeoptimizationAction;
+import jdk.internal.jvmci.meta.DeoptimizationReason;
+import jdk.internal.jvmci.meta.JavaConstant;
+import jdk.internal.jvmci.meta.JavaKind;
+import jdk.internal.jvmci.meta.LIRKind;
+import jdk.internal.jvmci.meta.PlatformKind;
+import jdk.internal.jvmci.meta.Value;
+import jdk.internal.jvmci.sparc.SPARC;
 
-import com.oracle.graal.compiler.common.calc.*;
-import com.oracle.graal.compiler.common.spi.*;
-import com.oracle.graal.compiler.sparc.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.debug.*;
-import com.oracle.graal.hotspot.meta.*;
-import com.oracle.graal.hotspot.stubs.*;
-import com.oracle.graal.lir.*;
+import com.oracle.graal.compiler.common.calc.Condition;
+import com.oracle.graal.compiler.common.spi.ForeignCallLinkage;
+import com.oracle.graal.compiler.common.spi.LIRKindTool;
+import com.oracle.graal.compiler.sparc.SPARCLIRGenerator;
+import com.oracle.graal.hotspot.HotSpotBackend;
+import com.oracle.graal.hotspot.HotSpotForeignCallLinkage;
+import com.oracle.graal.hotspot.HotSpotLIRGenerator;
+import com.oracle.graal.hotspot.HotSpotLockStack;
+import com.oracle.graal.hotspot.debug.BenchmarkCounters;
+import com.oracle.graal.hotspot.meta.HotSpotProviders;
+import com.oracle.graal.hotspot.meta.HotSpotRegistersProvider;
+import com.oracle.graal.hotspot.nodes.type.DefaultHotSpotLIRKindTool;
+import com.oracle.graal.hotspot.stubs.Stub;
+import com.oracle.graal.lir.LIRFrameState;
+import com.oracle.graal.lir.LIRInstruction;
+import com.oracle.graal.lir.LabelRef;
 import com.oracle.graal.lir.StandardOp.SaveRegistersOp;
-import com.oracle.graal.lir.gen.*;
-import com.oracle.graal.lir.sparc.*;
+import com.oracle.graal.lir.SwitchStrategy;
+import com.oracle.graal.lir.Variable;
+import com.oracle.graal.lir.gen.LIRGenerationResult;
+import com.oracle.graal.lir.sparc.SPARCAddressValue;
 import com.oracle.graal.lir.sparc.SPARCControlFlow.StrategySwitchOp;
+import com.oracle.graal.lir.sparc.SPARCFrameMapBuilder;
+import com.oracle.graal.lir.sparc.SPARCImmediateAddressValue;
+import com.oracle.graal.lir.sparc.SPARCMove;
 import com.oracle.graal.lir.sparc.SPARCMove.CompareAndSwapOp;
 import com.oracle.graal.lir.sparc.SPARCMove.LoadOp;
 import com.oracle.graal.lir.sparc.SPARCMove.NullCheckOp;
 import com.oracle.graal.lir.sparc.SPARCMove.StoreConstantOp;
 import com.oracle.graal.lir.sparc.SPARCMove.StoreOp;
+import com.oracle.graal.lir.sparc.SPARCSaveRegistersOp;
 
 public class SPARCHotSpotLIRGenerator extends SPARCLIRGenerator implements HotSpotLIRGenerator {
 
@@ -62,7 +133,7 @@
     private LIRFrameState currentRuntimeCallInfo;
 
     public SPARCHotSpotLIRGenerator(HotSpotProviders providers, HotSpotVMConfig config, CallingConvention cc, LIRGenerationResult lirGenRes) {
-        this(new DefaultLIRKindTool(providers.getCodeCache().getTarget().wordKind), providers, config, cc, lirGenRes);
+        this(new DefaultHotSpotLIRKindTool(providers.getCodeCache().getTarget().wordKind), providers, config, cc, lirGenRes);
     }
 
     protected SPARCHotSpotLIRGenerator(LIRKindTool lirKindTool, HotSpotProviders providers, HotSpotVMConfig config, CallingConvention cc, LIRGenerationResult lirGenRes) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/DefaultHotSpotLIRKindTool.java	Tue Sep 15 16:52:18 2015 +0200
@@ -0,0 +1,44 @@
+/*
+ * 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.hotspot.nodes.type;
+
+import jdk.internal.jvmci.meta.JavaKind;
+import jdk.internal.jvmci.meta.LIRKind;
+import jdk.internal.jvmci.meta.PlatformKind;
+
+import com.oracle.graal.lir.gen.DefaultLIRKindTool;
+
+public class DefaultHotSpotLIRKindTool extends DefaultLIRKindTool implements HotSpotLIRKindTool {
+
+    public DefaultHotSpotLIRKindTool(PlatformKind wordKind) {
+        super(wordKind);
+    }
+
+    public LIRKind getNarrowOopKind() {
+        return LIRKind.reference(JavaKind.Int);
+    }
+
+    public LIRKind getNarrowPointerKind() {
+        return LIRKind.value(JavaKind.Int);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/HotSpotLIRKindTool.java	Tue Sep 15 16:52:18 2015 +0200
@@ -0,0 +1,43 @@
+/*
+ * 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.hotspot.nodes.type;
+
+import jdk.internal.jvmci.meta.*;
+
+import com.oracle.graal.compiler.common.spi.*;
+
+/**
+ * Extension of {@link LIRKindTool} that includes support for compressed pointer kinds.
+ */
+public interface HotSpotLIRKindTool extends LIRKindTool {
+
+    /**
+     * Get the platform specific kind used to represent compressed oops.
+     */
+    LIRKind getNarrowOopKind();
+
+    /**
+     * Gets the platform specific kind used to represent compressed metaspace pointers.
+     */
+    LIRKind getNarrowPointerKind();
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/KlassPointerStamp.java	Tue Sep 15 15:36:07 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/KlassPointerStamp.java	Tue Sep 15 16:52:18 2015 +0200
@@ -111,7 +111,7 @@
     @Override
     public LIRKind getLIRKind(LIRKindTool tool) {
         if (isCompressed()) {
-            return LIRKind.value(JavaKind.Int);
+            return ((HotSpotLIRKindTool) tool).getNarrowPointerKind();
         } else {
             return super.getLIRKind(tool);
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/NarrowOopStamp.java	Tue Sep 15 15:36:07 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/NarrowOopStamp.java	Tue Sep 15 16:52:18 2015 +0200
@@ -57,7 +57,7 @@
 
     @Override
     public LIRKind getLIRKind(LIRKindTool tool) {
-        return LIRKind.reference(JavaKind.Int);
+        return ((HotSpotLIRKindTool) tool).getNarrowOopKind();
     }
 
     @Override