Mercurial > hg > graal-compiler
annotate graal/GraalCompiler/src/com/sun/c1x/asm/TargetMethodAssembler.java @ 2833:1cd59ca9ac86
Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Tue, 31 May 2011 13:30:23 +0200 |
parents | c1ce2a53d6c3 |
children |
rev | line source |
---|---|
2677
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
1 /* |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
2 * Copyright (c) 2011, 2011, Oracle and/or its affiliates. All rights reserved. |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
4 * |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
8 * |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
13 * accompanied this code). |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
14 * |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
18 * |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
21 * questions. |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
22 */ |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
23 package com.sun.c1x.asm; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
24 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
25 import java.util.*; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
26 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
27 import com.oracle.max.asm.*; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
28 import com.sun.c1x.*; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
29 import com.sun.c1x.debug.*; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
30 import com.sun.c1x.lir.*; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
31 import com.sun.c1x.util.*; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
32 import com.sun.cri.ci.*; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
33 import com.sun.cri.ri.*; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
34 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
35 public class TargetMethodAssembler { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
36 public final AbstractAssembler asm; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
37 public final CiTargetMethod targetMethod; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
38 public List<ExceptionInfo> exceptionInfoList; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
39 protected int lastSafepointPos; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
40 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
41 public TargetMethodAssembler(AbstractAssembler asm) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
42 this.asm = asm; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
43 this.targetMethod = new CiTargetMethod(); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
44 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
45 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
46 public void setFrameSize(int frameSize) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
47 targetMethod.setFrameSize(frameSize); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
48 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
49 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
50 public CiTargetMethod.Mark recordMark(Object id, CiTargetMethod.Mark[] references) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
51 return targetMethod.recordMark(asm.codeBuffer.position(), id, references); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
52 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
53 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
54 public void blockComment(String s) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
55 targetMethod.addAnnotation(new CiTargetMethod.CodeComment(asm.codeBuffer.position(), s)); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
56 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
57 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
58 public CiTargetMethod finishTargetMethod(Object name, RiRuntime runtime, int registerRestoreEpilogueOffset, boolean isStub) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
59 // Install code, data and frame size |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
60 targetMethod.setTargetCode(asm.codeBuffer.close(false), asm.codeBuffer.position()); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
61 targetMethod.setRegisterRestoreEpilogueOffset(registerRestoreEpilogueOffset); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
62 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
63 // Record exception handlers if they exist |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
64 if (exceptionInfoList != null) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
65 for (ExceptionInfo ei : exceptionInfoList) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
66 int codeOffset = ei.codeOffset; |
2718
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2707
diff
changeset
|
67 targetMethod.recordExceptionHandler(codeOffset, -1, 0, ei.exceptionEdge.blockEntryPco, -1, null); |
2677
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
68 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
69 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
70 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
71 if (C1XOptions.PrintMetrics) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
72 C1XMetrics.TargetMethods++; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
73 C1XMetrics.CodeBytesEmitted += targetMethod.targetCodeSize(); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
74 C1XMetrics.SafepointsEmitted += targetMethod.safepoints.size(); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
75 C1XMetrics.DirectCallSitesEmitted += targetMethod.directCalls.size(); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
76 C1XMetrics.IndirectCallSitesEmitted += targetMethod.indirectCalls.size(); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
77 C1XMetrics.DataPatches += targetMethod.dataReferences.size(); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
78 C1XMetrics.ExceptionHandlersEmitted += targetMethod.exceptionHandlers.size(); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
79 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
80 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
81 if (C1XOptions.PrintAssembly && !TTY.isSuppressed() && !isStub) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
82 Util.printSection("Target Method", Util.SECTION_CHARACTER); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
83 TTY.println("Name: " + name); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
84 TTY.println("Frame size: " + targetMethod.frameSize()); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
85 TTY.println("Register size: " + asm.target.arch.registerReferenceMapBitCount); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
86 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
87 if (C1XOptions.PrintCodeBytes) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
88 Util.printSection("Code", Util.SUB_SECTION_CHARACTER); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
89 TTY.println("Code: %d bytes", targetMethod.targetCodeSize()); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
90 Util.printBytes(0L, targetMethod.targetCode(), 0, targetMethod.targetCodeSize(), C1XOptions.PrintAssemblyBytesPerLine); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
91 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
92 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
93 Util.printSection("Disassembly", Util.SUB_SECTION_CHARACTER); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
94 String disassembly = runtime.disassemble(targetMethod); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
95 TTY.println(disassembly); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
96 boolean noDis = disassembly == null || disassembly.length() == 0; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
97 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
98 Util.printSection("Safepoints", Util.SUB_SECTION_CHARACTER); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
99 for (CiTargetMethod.Safepoint x : targetMethod.safepoints) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
100 TTY.println(x.toString()); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
101 if (noDis && x.debugInfo != null) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
102 TTY.println(CiUtil.indent(x.debugInfo.toString(), " ")); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
103 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
104 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
105 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
106 Util.printSection("Direct Call Sites", Util.SUB_SECTION_CHARACTER); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
107 for (CiTargetMethod.Call x : targetMethod.directCalls) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
108 TTY.println(x.toString()); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
109 if (noDis && x.debugInfo != null) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
110 TTY.println(CiUtil.indent(x.debugInfo.toString(), " ")); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
111 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
112 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
113 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
114 Util.printSection("Indirect Call Sites", Util.SUB_SECTION_CHARACTER); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
115 for (CiTargetMethod.Call x : targetMethod.indirectCalls) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
116 TTY.println(x.toString()); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
117 if (noDis && x.debugInfo != null) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
118 TTY.println(CiUtil.indent(x.debugInfo.toString(), " ")); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
119 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
120 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
121 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
122 Util.printSection("Data Patches", Util.SUB_SECTION_CHARACTER); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
123 for (CiTargetMethod.DataPatch x : targetMethod.dataReferences) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
124 TTY.println(x.toString()); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
125 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
126 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
127 Util.printSection("Marks", Util.SUB_SECTION_CHARACTER); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
128 for (CiTargetMethod.Mark x : targetMethod.marks) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
129 TTY.println(x.toString()); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
130 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
131 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
132 Util.printSection("Exception Handlers", Util.SUB_SECTION_CHARACTER); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
133 for (CiTargetMethod.ExceptionHandler x : targetMethod.exceptionHandlers) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
134 TTY.println(x.toString()); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
135 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
136 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
137 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
138 return targetMethod; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
139 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
140 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
141 public void recordExceptionHandlers(int pcOffset, LIRDebugInfo info) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
142 if (info != null) { |
2833
1cd59ca9ac86
Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2718
diff
changeset
|
143 if (info.exceptionEdge() != null) { |
2677
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
144 if (exceptionInfoList == null) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
145 exceptionInfoList = new ArrayList<ExceptionInfo>(4); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
146 } |
2833
1cd59ca9ac86
Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2718
diff
changeset
|
147 exceptionInfoList.add(new ExceptionInfo(pcOffset, info.exceptionEdge(), info.state.bci)); |
2677
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
148 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
149 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
150 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
151 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
152 public void recordImplicitException(int pcOffset, LIRDebugInfo info) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
153 // record an implicit exception point |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
154 if (info != null) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
155 assert lastSafepointPos < pcOffset; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
156 lastSafepointPos = pcOffset; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
157 targetMethod.recordSafepoint(pcOffset, info.debugInfo()); |
2833
1cd59ca9ac86
Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2718
diff
changeset
|
158 assert info.exceptionEdge() == null; |
2677
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
159 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
160 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
161 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
162 public void recordDirectCall(int posBefore, int posAfter, Object target, LIRDebugInfo info) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
163 CiDebugInfo debugInfo = info != null ? info.debugInfo() : null; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
164 assert lastSafepointPos < posAfter; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
165 lastSafepointPos = posAfter; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
166 targetMethod.recordCall(posBefore, target, debugInfo, true); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
167 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
168 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
169 public void recordIndirectCall(int posBefore, int posAfter, Object target, LIRDebugInfo info) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
170 CiDebugInfo debugInfo = info != null ? info.debugInfo() : null; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
171 assert lastSafepointPos < posAfter; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
172 lastSafepointPos = posAfter; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
173 targetMethod.recordCall(posBefore, target, debugInfo, false); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
174 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
175 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
176 public void recordSafepoint(int pos, LIRDebugInfo info) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
177 // safepoints always need debug info |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
178 CiDebugInfo debugInfo = info.debugInfo(); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
179 assert lastSafepointPos < pos; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
180 lastSafepointPos = pos; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
181 targetMethod.recordSafepoint(pos, debugInfo); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
182 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
183 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
184 public CiAddress recordDataReferenceInCode(CiConstant data) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
185 assert data != null; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
186 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
187 int pos = asm.codeBuffer.position(); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
188 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
189 if (C1XOptions.TraceRelocation) { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
190 TTY.print("Data reference in code: pos = %d, data = %s", pos, data.toString()); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
191 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
192 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
193 targetMethod.recordDataReference(pos, data); |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
194 return CiAddress.Placeholder; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
195 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
196 |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
197 public int lastSafepointPos() { |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
198 return lastSafepointPos; |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
199 } |
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
diff
changeset
|
200 } |