changeset 18664:54712aa2d3ee

Merge.
author Doug Simon <doug.simon@oracle.com>
date Thu, 11 Dec 2014 20:02:36 +0100
parents 058cbb02b58c (diff) 81a26fb13a9e (current diff)
children 96861e3f8cc5
files
diffstat 17 files changed, 309 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java	Thu Dec 11 10:19:04 2014 +0100
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java	Thu Dec 11 20:02:36 2014 +0100
@@ -270,6 +270,9 @@
     @Option(help = "Try to avoid emitting code where patching is required")
     public static final OptionValue<Boolean> ImmutableCode = new OptionValue<>(false);
 
+    @Option(help = "Generate position independent code")
+    public static final OptionValue<Boolean> GeneratePIC = new OptionValue<>(false);
+
     @Option(help = "")
     public static final OptionValue<Boolean> CallArrayCopy = new OptionValue<>(true);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCardTableAddressOp.java	Thu Dec 11 20:02:36 2014 +0100
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 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.
+ */
+package com.oracle.graal.hotspot.amd64;
+
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.asm.amd64.*;
+import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.*;
+import com.oracle.graal.lir.amd64.*;
+import com.oracle.graal.lir.asm.*;
+import com.oracle.graal.hotspot.HotSpotGraalRuntime;
+
+public class AMD64HotSpotCardTableAddressOp extends AMD64LIRInstruction {
+
+    @Def({OperandFlag.REG}) private AllocatableValue result;
+
+    public AMD64HotSpotCardTableAddressOp(AllocatableValue result) {
+        this.result = result;
+    }
+
+    @Override
+    public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler asm) {
+        Kind hostWordKind = HotSpotGraalRuntime.getHostWordKind();
+        int alignment = hostWordKind.getBitCount() / Byte.SIZE;
+        JavaConstant address = JavaConstant.forIntegerKind(hostWordKind, 0);
+        // recordDataReferenceInCode forces the mov to be rip-relative
+        asm.movq(ValueUtil.asRegister(result), (AMD64Address) crb.recordDataReferenceInCode(address, alignment));
+        MarkId.recordMark(crb, MarkId.CARD_TABLE_ADDRESS);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCardTableShiftOp.java	Thu Dec 11 20:02:36 2014 +0100
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 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.
+ */
+package com.oracle.graal.hotspot.amd64;
+
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.asm.amd64.*;
+import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.*;
+import com.oracle.graal.lir.amd64.*;
+import com.oracle.graal.lir.asm.*;
+import com.oracle.graal.hotspot.HotSpotGraalRuntime;
+
+public class AMD64HotSpotCardTableShiftOp extends AMD64LIRInstruction {
+
+    @Def({OperandFlag.REG, OperandFlag.ILLEGAL}) private AllocatableValue result;
+
+    public AMD64HotSpotCardTableShiftOp(AllocatableValue result) {
+        this.result = result;
+    }
+
+    @Override
+    public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler asm) {
+        Kind hostWordKind = HotSpotGraalRuntime.getHostWordKind();
+        int alignment = Kind.Int.getBitCount() / Byte.SIZE;
+        JavaConstant shift = JavaConstant.forIntegerKind(hostWordKind, 0);
+        // recordDataReferenceInCode forces the mov to be rip-relative
+        asm.movq(ValueUtil.asRegister(result), (AMD64Address) crb.recordDataReferenceInCode(shift, alignment));
+        MarkId.recordMark(crb, MarkId.CARD_TABLE_SHIFT);
+    }
+}
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCompare.java	Thu Dec 11 10:19:04 2014 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCompare.java	Thu Dec 11 20:02:36 2014 +0100
@@ -25,6 +25,7 @@
 import static com.oracle.graal.api.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
+import com.oracle.graal.hotspot.HotSpotGraalRuntime;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.amd64.*;
@@ -66,14 +67,31 @@
                     masm.cmpq(asRegister(x), patch);
                 }
             } else if (y instanceof HotSpotMetaspaceConstant) {
+                boolean isImmutable = GraalOptions.ImmutableCode.getValue();
+                boolean generatePIC = GraalOptions.GeneratePIC.getValue();
                 if (y.getKind() == Kind.Int) {
                     // compressed metaspace pointer
                     crb.recordInlineDataInCode(y);
-                    masm.cmpl(asRegister(x), y.asInt());
+                    if (isImmutable && generatePIC) {
+                        Kind hostWordKind = HotSpotGraalRuntime.getHostWordKind();
+                        int alignment = hostWordKind.getBitCount() / Byte.SIZE;
+                        // recordDataReferenceInCode forces the mov to be rip-relative
+                        masm.cmpl(asRegister(x), (AMD64Address) crb.recordDataReferenceInCode(JavaConstant.INT_0, alignment));
+                    } else {
+                        masm.cmpl(asRegister(x), y.asInt());
+                    }
                 } else {
                     // uncompressed metaspace pointer
-                    AMD64Address patch = (AMD64Address) crb.recordDataReferenceInCode(y, 8);
-                    masm.cmpq(asRegister(x), patch);
+                    if (isImmutable && generatePIC) {
+                        crb.recordInlineDataInCode(y);
+                        Kind hostWordKind = HotSpotGraalRuntime.getHostWordKind();
+                        int alignment = hostWordKind.getBitCount() / Byte.SIZE;
+                        // recordDataReferenceInCode forces the mov to be rip-relative
+                        masm.cmpq(asRegister(x), (AMD64Address) crb.recordDataReferenceInCode(JavaConstant.INT_0, alignment));
+                    } else {
+                        AMD64Address patch = (AMD64Address) crb.recordDataReferenceInCode(y, 8);
+                        masm.cmpq(asRegister(x), patch);
+                    }
                 }
             } else {
                 throw GraalInternalError.shouldNotReachHere();
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Thu Dec 11 10:19:04 2014 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Thu Dec 11 20:02:36 2014 +0100
@@ -211,6 +211,20 @@
         append(new AMD64HotSpotLeaveUnpackFramesStackFrameOp(threadRegister, config.threadLastJavaSpOffset(), config.threadLastJavaPcOffset(), config.threadLastJavaFpOffset(), saveRegisterOp));
     }
 
+    @Override
+    public Value emitCardTableShift() {
+        Variable result = newVariable(LIRKind.value(Kind.Long));
+        append(new AMD64HotSpotCardTableShiftOp(result));
+        return result;
+    }
+
+    @Override
+    public Value emitCardTableAddress() {
+        Variable result = newVariable(LIRKind.value(Kind.Long));
+        append(new AMD64HotSpotCardTableAddressOp(result));
+        return result;
+    }
+
     /**
      * @param savedRegisters the registers saved by this operation which may be subject to pruning
      * @param savedRegisterLocations the slots to which the registers are saved
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotMove.java	Thu Dec 11 10:19:04 2014 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotMove.java	Thu Dec 11 20:02:36 2014 +0100
@@ -32,6 +32,7 @@
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag;
 import com.oracle.graal.compiler.common.*;
+import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.lir.*;
@@ -94,17 +95,37 @@
             } else if (input instanceof HotSpotMetaspaceConstant) {
                 assert input.getKind() == Kind.Int || input.getKind() == Kind.Long;
                 boolean compressed = input.getKind() == Kind.Int;
+                boolean isImmutable = GraalOptions.ImmutableCode.getValue();
+                boolean generatePIC = GraalOptions.GeneratePIC.getValue();
                 crb.recordInlineDataInCode(input);
                 if (isRegister(result)) {
                     if (compressed) {
-                        masm.movl(asRegister(result), input.asInt());
+                        if (isImmutable && generatePIC) {
+                            Kind hostWordKind = HotSpotGraalRuntime.getHostWordKind();
+                            int alignment = hostWordKind.getBitCount() / Byte.SIZE;
+                            // recordDataReferenceInCode forces the mov to be rip-relative
+                            masm.movl(asRegister(result), (AMD64Address) crb.recordDataReferenceInCode(JavaConstant.INT_0, alignment));
+                        } else {
+                            masm.movl(asRegister(result), input.asInt());
+                        }
                     } else {
-                        masm.movq(asRegister(result), input.asLong());
+                        if (isImmutable && generatePIC) {
+                            Kind hostWordKind = HotSpotGraalRuntime.getHostWordKind();
+                            int alignment = hostWordKind.getBitCount() / Byte.SIZE;
+                            // recordDataReferenceInCode forces the mov to be rip-relative
+                            masm.movq(asRegister(result), (AMD64Address) crb.recordDataReferenceInCode(JavaConstant.INT_0, alignment));
+                        } else {
+                            masm.movq(asRegister(result), input.asLong());
+                        }
                     }
                 } else {
                     assert isStackSlot(result);
                     if (compressed) {
-                        masm.movl((AMD64Address) crb.asAddress(result), input.asInt());
+                        if (isImmutable && generatePIC) {
+                            throw GraalInternalError.shouldNotReachHere("Unsupported operation offset(%rip) -> mem (mem -> mem)");
+                        } else {
+                            masm.movl((AMD64Address) crb.asAddress(result), input.asInt());
+                        }
                     } else {
                         throw GraalInternalError.shouldNotReachHere("Cannot store 64-bit constants to memory");
                     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRGenerator.java	Thu Dec 11 10:19:04 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRGenerator.java	Thu Dec 11 20:02:36 2014 +0100
@@ -127,6 +127,14 @@
         throw GraalInternalError.unimplemented();
     }
 
+    default Value emitCardTableShift() {
+        throw GraalInternalError.unimplemented();
+    }
+
+    default Value emitCardTableAddress() {
+        throw GraalInternalError.unimplemented();
+    }
+
     /**
      * Gets a stack slot for a lock at a given lock nesting depth.
      */
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReferenceMap.java	Thu Dec 11 10:19:04 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReferenceMap.java	Thu Dec 11 20:02:36 2014 +0100
@@ -34,7 +34,7 @@
 
     private static final long serialVersionUID = -1052183095979496819L;
 
-    private static final int BITS_PER_WORD = 3;
+    public static final int BITS_PER_WORD = 3;
 
     /**
      * Contains 3 bits per scalar register, and n*3 bits per n-word vector register (e.g., on a
@@ -167,6 +167,14 @@
         }
     }
 
+    public BitSet getFrameMap() {
+        return (BitSet) frameRefMap.clone();
+    }
+
+    public BitSet getRegisterMap() {
+        return (BitSet) registerRefMap.clone();
+    }
+
     // clear
 
     private static void clearOop(BitSet map, int startIdx, LIRKind kind) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Thu Dec 11 10:19:04 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Thu Dec 11 20:02:36 2014 +0100
@@ -1554,6 +1554,8 @@
     @HotSpotVMConstant(name = "CodeInstaller::POLL_RETURN_NEAR") @Stable public int codeInstallerMarkIdPollReturnNear;
     @HotSpotVMConstant(name = "CodeInstaller::POLL_FAR") @Stable public int codeInstallerMarkIdPollFar;
     @HotSpotVMConstant(name = "CodeInstaller::POLL_RETURN_FAR") @Stable public int codeInstallerMarkIdPollReturnFar;
+    @HotSpotVMConstant(name = "CodeInstaller::CARD_TABLE_SHIFT") @Stable public int codeInstallerMarkIdCardTableShift;
+    @HotSpotVMConstant(name = "CodeInstaller::CARD_TABLE_ADDRESS") @Stable public int codeInstallerMarkIdCardTableAddress;
     @HotSpotVMConstant(name = "CodeInstaller::INVOKE_INVALID") @Stable public int codeInstallerMarkIdInvokeInvalid;
 
     public boolean check() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java	Thu Dec 11 10:19:04 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java	Thu Dec 11 20:02:36 2014 +0100
@@ -80,7 +80,9 @@
         POLL_NEAR(config().codeInstallerMarkIdPollNear),
         POLL_RETURN_NEAR(config().codeInstallerMarkIdPollReturnNear),
         POLL_FAR(config().codeInstallerMarkIdPollFar),
-        POLL_RETURN_FAR(config().codeInstallerMarkIdPollReturnFar);
+        POLL_RETURN_FAR(config().codeInstallerMarkIdPollReturnFar),
+        CARD_TABLE_SHIFT(config().codeInstallerMarkIdCardTableShift),
+        CARD_TABLE_ADDRESS(config().codeInstallerMarkIdCardTableAddress);
 
         private final int value;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CardTableAddressNode.java	Thu Dec 11 20:02:36 2014 +0100
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 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.
+ */
+package com.oracle.graal.hotspot.replacements;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.common.type.*;
+import com.oracle.graal.hotspot.*;
+import com.oracle.graal.nodeinfo.*;
+import com.oracle.graal.nodes.calc.*;
+import com.oracle.graal.nodes.spi.*;
+
+@NodeInfo
+public class CardTableAddressNode extends FloatingNode implements LIRLowerable {
+
+    public static CardTableAddressNode create() {
+        return new CardTableAddressNode();
+    }
+
+    protected CardTableAddressNode() {
+        super(StampFactory.forKind(Kind.Long));
+    }
+
+    @Override
+    public void generate(NodeLIRBuilderTool generator) {
+        Value res = ((HotSpotLIRGenerator) generator.getLIRGeneratorTool()).emitCardTableAddress();
+        generator.setResult(this, res);
+    }
+
+    @NodeIntrinsic
+    public static native long cardTableAddress();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CardTableShiftNode.java	Thu Dec 11 20:02:36 2014 +0100
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 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.
+ */
+package com.oracle.graal.hotspot.replacements;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.common.type.*;
+import com.oracle.graal.hotspot.*;
+import com.oracle.graal.nodeinfo.*;
+import com.oracle.graal.nodes.calc.*;
+import com.oracle.graal.nodes.spi.*;
+
+@NodeInfo
+public class CardTableShiftNode extends FloatingNode implements LIRLowerable {
+
+    public static CardTableShiftNode create() {
+        return new CardTableShiftNode();
+    }
+
+    protected CardTableShiftNode() {
+        super(StampFactory.intValue());
+    }
+
+    @Override
+    public void generate(NodeLIRBuilderTool generator) {
+        Value res = ((HotSpotLIRGenerator) generator.getLIRGeneratorTool()).emitCardTableShift();
+        generator.setResult(this, res);
+    }
+
+    @NodeIntrinsic
+    public static native int cardTableShift();
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java	Thu Dec 11 10:19:04 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java	Thu Dec 11 20:02:36 2014 +0100
@@ -810,6 +810,16 @@
     public static native int identityHashCode(@ConstantNodeParameter ForeignCallDescriptor descriptor, Object object);
 
     @Fold
+    public static boolean isImmutableCode() {
+        return GraalOptions.ImmutableCode.getValue();
+    }
+
+    @Fold
+    public static boolean generatePIC() {
+        return GraalOptions.GeneratePIC.getValue();
+    }
+
+    @Fold
     public static int verifiedEntryPointOffset() {
         return config().nmethodEntryOffset;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java	Thu Dec 11 10:19:04 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java	Thu Dec 11 20:02:36 2014 +0100
@@ -77,13 +77,15 @@
             oop = Word.fromObject(fixedObject);
         }
         serialWriteBarrierCounter.inc();
-        Word base = (Word) oop.unsignedShiftRight(cardTableShift());
-        long startAddress = cardTableStart();
+        int cardTableShift = (isImmutableCode() && generatePIC()) ? CardTableShiftNode.cardTableShift() : cardTableShift();
+        long cardTableAddress = (isImmutableCode() && generatePIC()) ? CardTableAddressNode.cardTableAddress() : cardTableStart();
+        Word base = (Word) oop.unsignedShiftRight(cardTableShift);
+        long startAddress = cardTableAddress;
         int displacement = 0;
         if (((int) startAddress) == startAddress) {
             displacement = (int) startAddress;
         } else {
-            base = base.add(Word.unsigned(cardTableStart()));
+            base = base.add(Word.unsigned(cardTableAddress));
         }
         base.writeByte(displacement, (byte) 0, GC_CARD_LOCATION);
     }
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Thu Dec 11 10:19:04 2014 +0100
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Thu Dec 11 20:02:36 2014 +0100
@@ -962,6 +962,9 @@
       case POLL_RETURN_FAR:
         pd_relocate_poll(pc, id);
         break;
+      case CARD_TABLE_SHIFT:
+      case CARD_TABLE_ADDRESS:
+        break;
       default:
         ShouldNotReachHere();
         break;
--- a/src/share/vm/graal/graalCodeInstaller.hpp	Thu Dec 11 10:19:04 2014 +0100
+++ b/src/share/vm/graal/graalCodeInstaller.hpp	Thu Dec 11 20:02:36 2014 +0100
@@ -47,6 +47,8 @@
     POLL_RETURN_NEAR           = 12,
     POLL_FAR                   = 13,
     POLL_RETURN_FAR            = 14,
+    CARD_TABLE_ADDRESS         = 15,
+    CARD_TABLE_SHIFT           = 16,
     INVOKE_INVALID             = -1
   };
 
--- a/src/share/vm/graal/vmStructs_graal.hpp	Thu Dec 11 10:19:04 2014 +0100
+++ b/src/share/vm/graal/vmStructs_graal.hpp	Thu Dec 11 20:02:36 2014 +0100
@@ -73,6 +73,8 @@
   declare_constant(CodeInstaller::POLL_RETURN_NEAR)                                               \
   declare_constant(CodeInstaller::POLL_FAR)                                                       \
   declare_constant(CodeInstaller::POLL_RETURN_FAR)                                                \
+  declare_constant(CodeInstaller::CARD_TABLE_SHIFT)                                               \
+  declare_constant(CodeInstaller::CARD_TABLE_ADDRESS)                                             \
   declare_constant(CodeInstaller::INVOKE_INVALID)                                                 \
                                                                                                   \
   declare_constant(Method::invalid_vtable_index)                                                  \