annotate graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java @ 6996:eec373d34caf

added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
author Doug Simon <doug.simon@oracle.com>
date Tue, 20 Nov 2012 22:49:27 +0100
parents f5715c5a106a
children 5e3d1a68664e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
4181
319860ae697a Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
23 package com.oracle.graal.lir.asm;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
25 import static com.oracle.graal.api.code.ValueUtil.*;
4183
9e0c1b4cfef5 Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4181
diff changeset
26
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27 import java.util.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
29 import com.oracle.graal.api.code.*;
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5506
diff changeset
30 import com.oracle.graal.api.meta.*;
6531
4afe23aa0a00 renamed packages: com.oracle.max.asm... -> com.oracle.graal.asm...
Doug Simon <doug.simon@oracle.com>
parents: 6476
diff changeset
31 import com.oracle.graal.asm.*;
5273
7689999f0ea6 improved disassembly comments for out-of-line stubs
Doug Simon <doug.simon@oracle.com>
parents: 5251
diff changeset
32 import com.oracle.graal.debug.*;
7689999f0ea6 improved disassembly comments for out-of-line stubs
Doug Simon <doug.simon@oracle.com>
parents: 5251
diff changeset
33 import com.oracle.graal.graph.*;
7689999f0ea6 improved disassembly comments for out-of-line stubs
Doug Simon <doug.simon@oracle.com>
parents: 5251
diff changeset
34 import com.oracle.graal.lir.*;
7689999f0ea6 improved disassembly comments for out-of-line stubs
Doug Simon <doug.simon@oracle.com>
parents: 5251
diff changeset
35 import com.oracle.graal.lir.LIR.Code;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
36
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37 public class TargetMethodAssembler {
4262
744dade427b8 another batch of work towards GraalCompilation removal:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
38
4524
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4405
diff changeset
39 private static class ExceptionInfo {
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4405
diff changeset
40 public final int codeOffset;
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4405
diff changeset
41 public final LabelRef exceptionEdge;
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4405
diff changeset
42
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4405
diff changeset
43 public ExceptionInfo(int pcOffset, LabelRef exceptionEdge) {
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4405
diff changeset
44 this.codeOffset = pcOffset;
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4405
diff changeset
45 this.exceptionEdge = exceptionEdge;
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4405
diff changeset
46 }
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4405
diff changeset
47 }
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4405
diff changeset
48
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49 public final AbstractAssembler asm;
5546
e42c0df7212a Rename CiTargetMethod => CompilationResult.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
50 public final CompilationResult targetMethod;
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
51 public final TargetDescription target;
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
52 public final CodeCacheProvider runtime;
4262
744dade427b8 another batch of work towards GraalCompilation removal:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
53 public final FrameMap frameMap;
5273
7689999f0ea6 improved disassembly comments for out-of-line stubs
Doug Simon <doug.simon@oracle.com>
parents: 5251
diff changeset
54
7689999f0ea6 improved disassembly comments for out-of-line stubs
Doug Simon <doug.simon@oracle.com>
parents: 5251
diff changeset
55 /**
7689999f0ea6 improved disassembly comments for out-of-line stubs
Doug Simon <doug.simon@oracle.com>
parents: 5251
diff changeset
56 * Out-of-line stubs to be emitted.
7689999f0ea6 improved disassembly comments for out-of-line stubs
Doug Simon <doug.simon@oracle.com>
parents: 5251
diff changeset
57 */
7689999f0ea6 improved disassembly comments for out-of-line stubs
Doug Simon <doug.simon@oracle.com>
parents: 5251
diff changeset
58 public final List<Code> stubs;
5251
467de393651a optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents: 5233
diff changeset
59
467de393651a optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents: 5233
diff changeset
60 /**
467de393651a optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents: 5233
diff changeset
61 * The object that emits code for managing a method's frame.
467de393651a optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents: 5233
diff changeset
62 * If null, no frame is used by the method.
467de393651a optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents: 5233
diff changeset
63 */
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5061
diff changeset
64 public final FrameContext frameContext;
4262
744dade427b8 another batch of work towards GraalCompilation removal:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
65
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
66 private List<ExceptionInfo> exceptionInfoList;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
67 private int lastSafepointPos;
4524
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4405
diff changeset
68
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
69 public TargetMethodAssembler(TargetDescription target, CodeCacheProvider runtime, FrameMap frameMap, AbstractAssembler asm, FrameContext frameContext, List<Code> stubs) {
4262
744dade427b8 another batch of work towards GraalCompilation removal:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
70 this.target = target;
744dade427b8 another batch of work towards GraalCompilation removal:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
71 this.runtime = runtime;
744dade427b8 another batch of work towards GraalCompilation removal:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
72 this.frameMap = frameMap;
5273
7689999f0ea6 improved disassembly comments for out-of-line stubs
Doug Simon <doug.simon@oracle.com>
parents: 5251
diff changeset
73 this.stubs = stubs;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
74 this.asm = asm;
5546
e42c0df7212a Rename CiTargetMethod => CompilationResult.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
75 this.targetMethod = new CompilationResult();
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5061
diff changeset
76 this.frameContext = frameContext;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
77 // 0 is a valid pc for safepoints in template methods
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
78 this.lastSafepointPos = -1;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
79 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
80
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
81 public void setFrameSize(int frameSize) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
82 targetMethod.setFrameSize(frameSize);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
83 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
84
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5774
diff changeset
85 private static final CompilationResult.Mark[] NO_REFS = {};
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5774
diff changeset
86
5546
e42c0df7212a Rename CiTargetMethod => CompilationResult.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
87 public CompilationResult.Mark recordMark(Object id) {
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5774
diff changeset
88 return targetMethod.recordMark(asm.codeBuffer.position(), id, NO_REFS);
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5061
diff changeset
89 }
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5061
diff changeset
90
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5774
diff changeset
91 public CompilationResult.Mark recordMark(Object id, CompilationResult.Mark... references) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
92 return targetMethod.recordMark(asm.codeBuffer.position(), id, references);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
93 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
94
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
95 public void blockComment(String s) {
5546
e42c0df7212a Rename CiTargetMethod => CompilationResult.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
96 targetMethod.addAnnotation(new CompilationResult.CodeComment(asm.codeBuffer.position(), s));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
97 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
98
5546
e42c0df7212a Rename CiTargetMethod => CompilationResult.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
99 public CompilationResult finishTargetMethod(Object name, boolean isStub) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
100 // Install code, data and frame size
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
101 targetMethod.setTargetCode(asm.codeBuffer.close(false), asm.codeBuffer.position());
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
102
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
103 // Record exception handlers if they exist
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
104 if (exceptionInfoList != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
105 for (ExceptionInfo ei : exceptionInfoList) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
106 int codeOffset = ei.codeOffset;
4693
07bcee8b70a4 Simplify exception debug information and exception handler table creation based on Graal's simplified model of exception handler information (i.e. the dispatch is done in compiled code).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4555
diff changeset
107 targetMethod.recordExceptionHandler(codeOffset, ei.exceptionEdge.label().position());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
108 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
109 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
110
6698
f5715c5a106a Make CalleeSaveLayout available in CompilationResult
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6539
diff changeset
111 // Set the info on callee-saved registers
f5715c5a106a Make CalleeSaveLayout available in CompilationResult
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6539
diff changeset
112 targetMethod.setCalleeSaveLayout(frameMap.registerConfig.getCalleeSaveLayout());
f5715c5a106a Make CalleeSaveLayout available in CompilationResult
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6539
diff changeset
113
4348
d49c90e641cb Remove GraalMetrics, replace with new syntax for metrics.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4199
diff changeset
114 Debug.metric("TargetMethods").increment();
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6531
diff changeset
115 Debug.metric("CodeBytesEmitted").add(targetMethod.getTargetCodeSize());
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
116 Debug.metric("SafepointsEmitted").add(targetMethod.getSafepoints().size());
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
117 Debug.metric("DataPatches").add(targetMethod.getDataReferences().size());
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
118 Debug.metric("ExceptionHandlersEmitted").add(targetMethod.getExceptionHandlers().size());
4555
ce13e056d821 explicitly exclude com.oracle.max.graal.tests from graal class path to make JUnit tests work
Lukas Stadler <lukas.stadler@jku.at>
parents: 4525
diff changeset
119 Debug.log("Finished target method %s, isStub %b", name, isStub);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
120 return targetMethod;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
121 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
122
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5552
diff changeset
123 public void recordExceptionHandlers(int pcOffset, LIRFrameState info) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
124 if (info != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
125 if (info.exceptionEdge != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
126 if (exceptionInfoList == null) {
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
127 exceptionInfoList = new ArrayList<>(4);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
128 }
4524
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4405
diff changeset
129 exceptionInfoList.add(new ExceptionInfo(pcOffset, info.exceptionEdge));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
130 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
131 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
132 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
133
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5552
diff changeset
134 public void recordImplicitException(int pcOffset, LIRFrameState info) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
135 // record an implicit exception point
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
136 if (info != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
137 assert lastSafepointPos < pcOffset : lastSafepointPos + "<" + pcOffset;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
138 lastSafepointPos = pcOffset;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
139 targetMethod.recordSafepoint(pcOffset, info.debugInfo());
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
140 assert info.exceptionEdge == null;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
141 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
142 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
143
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5552
diff changeset
144 public void recordDirectCall(int posBefore, int posAfter, Object callTarget, LIRFrameState info) {
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
145 DebugInfo debugInfo = info != null ? info.debugInfo() : null;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
146 assert lastSafepointPos < posAfter;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
147 lastSafepointPos = posAfter;
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
148 targetMethod.recordCall(posBefore, posAfter - posBefore, callTarget, debugInfo, true);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
149 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
150
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5552
diff changeset
151 public void recordIndirectCall(int posBefore, int posAfter, Object callTarget, LIRFrameState info) {
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
152 DebugInfo debugInfo = info != null ? info.debugInfo() : null;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
153 assert lastSafepointPos < posAfter;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
154 lastSafepointPos = posAfter;
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
155 targetMethod.recordCall(posBefore, posAfter - posBefore, callTarget, debugInfo, false);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
156 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
157
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5552
diff changeset
158 public void recordSafepoint(int pos, LIRFrameState info) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
159 // safepoints always need debug info
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
160 DebugInfo debugInfo = info.debugInfo();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
161 assert lastSafepointPos < pos;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
162 lastSafepointPos = pos;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
163 targetMethod.recordSafepoint(pos, debugInfo);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
164 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
165
6996
eec373d34caf added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents: 6698
diff changeset
166 public Address recordDataReferenceInCode(Constant data, int alignment, boolean inlined) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
167 assert data != null;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
168 int pos = asm.codeBuffer.position();
4405
aa867c7c1d1e Remove TraceRelocation flag.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4365
diff changeset
169 Debug.log("Data reference in code: pos = %d, data = %s", pos, data.toString());
6996
eec373d34caf added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents: 6698
diff changeset
170 targetMethod.recordDataReference(pos, data, alignment, inlined);
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
171 return Address.Placeholder;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
172 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
173
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
174 public int lastSafepointPos() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
175 return lastSafepointPos;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
176 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
177
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
178 /**
6996
eec373d34caf added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents: 6698
diff changeset
179 * Returns the integer value of any constant that can be represented by a 32-bit integer value,
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
180 * including long constants that fit into the 32-bit range.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
181 */
5539
bc647d8b0080 Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
182 public int asIntConst(Value value) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6531
diff changeset
183 assert (value.getKind().getStackKind() == Kind.Int || value.getKind() == Kind.Jsr || value.getKind() == Kind.Long) && isConstant(value);
6996
eec373d34caf added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents: 6698
diff changeset
184 Constant constant = (Constant) value;
eec373d34caf added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents: 6698
diff changeset
185 assert !runtime.needsDataPatch(constant) : constant + " should be in a DataPatch";
eec373d34caf added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents: 6698
diff changeset
186 long c = constant.asLong();
eec373d34caf added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents: 6698
diff changeset
187 if (!NumUtil.isInt(c)) {
4524
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4405
diff changeset
188 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
189 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
190 return (int) c;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
191 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
192
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
193 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
194 * Returns the address of a float constant that is embedded as a data references into the code.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
195 */
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
196 public Address asFloatConstRef(Value value) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
197 return asFloatConstRef(value, 4);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
198 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
199
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
200 public Address asFloatConstRef(Value value, int alignment) {
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5798
diff changeset
201 assert value.getKind() == Kind.Float && isConstant(value);
6996
eec373d34caf added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents: 6698
diff changeset
202 return recordDataReferenceInCode((Constant) value, alignment, false);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
203 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
204
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
205 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
206 * Returns the address of a double constant that is embedded as a data references into the code.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
207 */
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
208 public Address asDoubleConstRef(Value value) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
209 return asDoubleConstRef(value, 8);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
210 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
211
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
212 public Address asDoubleConstRef(Value value, int alignment) {
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5798
diff changeset
213 assert value.getKind() == Kind.Double && isConstant(value);
6996
eec373d34caf added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents: 6698
diff changeset
214 return recordDataReferenceInCode((Constant) value, alignment, false);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
215 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
216
4277
9a3a0cdb6e34 Remove asAddress from FrameMap, I don't like it there.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4265
diff changeset
217 /**
9a3a0cdb6e34 Remove asAddress from FrameMap, I don't like it there.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4265
diff changeset
218 * Returns the address of a long constant that is embedded as a data references into the code.
9a3a0cdb6e34 Remove asAddress from FrameMap, I don't like it there.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4265
diff changeset
219 */
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
220 public Address asLongConstRef(Value value) {
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5798
diff changeset
221 assert value.getKind() == Kind.Long && isConstant(value);
6996
eec373d34caf added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents: 6698
diff changeset
222 return recordDataReferenceInCode((Constant) value, 8, false);
4277
9a3a0cdb6e34 Remove asAddress from FrameMap, I don't like it there.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4265
diff changeset
223 }
9a3a0cdb6e34 Remove asAddress from FrameMap, I don't like it there.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4265
diff changeset
224
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
225 public Address asIntAddr(Value value) {
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5798
diff changeset
226 assert value.getKind() == Kind.Int;
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
227 return asAddress(value);
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
228 }
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
229
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
230 public Address asLongAddr(Value value) {
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5798
diff changeset
231 assert value.getKind() == Kind.Long;
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
232 return asAddress(value);
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
233 }
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
234
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
235 public Address asObjectAddr(Value value) {
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5798
diff changeset
236 assert value.getKind() == Kind.Object;
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
237 return asAddress(value);
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
238 }
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
239
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
240 public Address asFloatAddr(Value value) {
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5798
diff changeset
241 assert value.getKind() == Kind.Float;
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
242 return asAddress(value);
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
243 }
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
244
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
245 public Address asDoubleAddr(Value value) {
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5798
diff changeset
246 assert value.getKind() == Kind.Double;
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
247 return asAddress(value);
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
248 }
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4277
diff changeset
249
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
250 public Address asAddress(Value value) {
4277
9a3a0cdb6e34 Remove asAddress from FrameMap, I don't like it there.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4265
diff changeset
251 if (isStackSlot(value)) {
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
252 StackSlot slot = (StackSlot) value;
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5798
diff changeset
253 return new Address(slot.getKind(), frameMap.registerConfig.getFrameRegister().asValue(), frameMap.offsetForStackSlot(slot));
4277
9a3a0cdb6e34 Remove asAddress from FrameMap, I don't like it there.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4265
diff changeset
254 }
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
255 return (Address) value;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
256 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
257 }