annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCardTableAddressOp.java @ 21720:d915361cc3a1

moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Thu, 04 Jun 2015 13:35:47 +0200
parents 6df25b1418be
children 0e095e2c24e2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
1 /*
19529
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18661
diff changeset
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
4 *
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
7 * published by the Free Software Foundation.
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
8 *
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
13 * accompanied this code).
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
14 *
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
18 *
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
21 * questions.
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
22 */
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
23 package com.oracle.graal.hotspot.amd64;
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
24
21556
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
25 import com.oracle.jvmci.code.ValueUtil;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
26 import com.oracle.jvmci.meta.JavaConstant;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
27 import com.oracle.jvmci.meta.AllocatableValue;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
28 import com.oracle.jvmci.meta.Kind;
21720
d915361cc3a1 moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21708
diff changeset
29 import com.oracle.graal.asm.amd64.*;
21413
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19529
diff changeset
30 import com.oracle.graal.hotspot.*;
19529
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18661
diff changeset
31 import com.oracle.graal.lir.*;
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
32 import com.oracle.graal.lir.amd64.*;
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
33 import com.oracle.graal.lir.asm.*;
21551
5324104ac4f3 moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
34 import com.oracle.jvmci.hotspot.*;
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
35
19529
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18661
diff changeset
36 public final class AMD64HotSpotCardTableAddressOp extends AMD64LIRInstruction {
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18661
diff changeset
37 public static final LIRInstructionClass<AMD64HotSpotCardTableAddressOp> TYPE = LIRInstructionClass.create(AMD64HotSpotCardTableAddressOp.class);
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
38
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
39 @Def({OperandFlag.REG}) private AllocatableValue result;
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
40
21413
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19529
diff changeset
41 private final HotSpotVMConfig config;
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19529
diff changeset
42
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19529
diff changeset
43 public AMD64HotSpotCardTableAddressOp(AllocatableValue result, HotSpotVMConfig config) {
19529
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18661
diff changeset
44 super(TYPE);
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
45 this.result = result;
21413
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19529
diff changeset
46 this.config = config;
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
47 }
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
48
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
49 @Override
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
50 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler asm) {
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
51 Kind hostWordKind = HotSpotGraalRuntime.getHostWordKind();
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
52 int alignment = hostWordKind.getBitCount() / Byte.SIZE;
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
53 JavaConstant address = JavaConstant.forIntegerKind(hostWordKind, 0);
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
54 // recordDataReferenceInCode forces the mov to be rip-relative
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
55 asm.movq(ValueUtil.asRegister(result), (AMD64Address) crb.recordDataReferenceInCode(address, alignment));
21413
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19529
diff changeset
56 crb.recordMark(config.MARKID_CARD_TABLE_ADDRESS);
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
57 }
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
58
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
59 }