annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCardTableAddressOp.java @ 21526:1da7aef31a08

created com.oracle.graal.hotspot.jvmci package and moved classes destined for future JVMCI module into it (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Tue, 19 May 2015 23:16:07 +0200
parents 15a46a918fc1
children 5324104ac4f3
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 /*
19526
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
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
25 import com.oracle.graal.api.code.*;
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
26 import com.oracle.graal.api.meta.*;
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
27 import com.oracle.graal.asm.amd64.*;
21413
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19526
diff changeset
28 import com.oracle.graal.hotspot.*;
21526
1da7aef31a08 created com.oracle.graal.hotspot.jvmci package and moved classes destined for future JVMCI module into it (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21413
diff changeset
29 import com.oracle.graal.hotspot.jvmci.*;
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18661
diff changeset
30 import com.oracle.graal.lir.*;
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
31 import com.oracle.graal.lir.amd64.*;
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
32 import com.oracle.graal.lir.asm.*;
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
33
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18661
diff changeset
34 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
35 public static final LIRInstructionClass<AMD64HotSpotCardTableAddressOp> TYPE = LIRInstructionClass.create(AMD64HotSpotCardTableAddressOp.class);
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
36
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
37 @Def({OperandFlag.REG}) private AllocatableValue result;
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
38
21413
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19526
diff changeset
39 private final HotSpotVMConfig config;
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19526
diff changeset
40
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19526
diff changeset
41 public AMD64HotSpotCardTableAddressOp(AllocatableValue result, HotSpotVMConfig config) {
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18661
diff changeset
42 super(TYPE);
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
43 this.result = result;
21413
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19526
diff changeset
44 this.config = config;
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
45 }
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
46
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
47 @Override
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
48 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler asm) {
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
49 Kind hostWordKind = HotSpotGraalRuntime.getHostWordKind();
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
50 int alignment = hostWordKind.getBitCount() / Byte.SIZE;
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
51 JavaConstant address = JavaConstant.forIntegerKind(hostWordKind, 0);
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
52 // recordDataReferenceInCode forces the mov to be rip-relative
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
53 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: 19526
diff changeset
54 crb.recordMark(config.MARKID_CARD_TABLE_ADDRESS);
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
55 }
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
56
aa4f2e3629ca Added card table PIC support
adlertz
parents:
diff changeset
57 }