Mercurial > hg > truffle
comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotXirGenerator.java @ 1416:1b41af477605
Added HotSpotVM project Java source files.
author | Thomas Wuerthinger <thomas.wuerthinger@gmail.com> |
---|---|
date | Wed, 23 Jun 2010 16:36:58 +0200 |
parents | |
children | 2c41834aa270 |
comparison
equal
deleted
inserted
replaced
1415:712c7ff1afc1 | 1416:1b41af477605 |
---|---|
1 /* | |
2 * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. | |
3 * | |
4 * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product | |
5 * that is described in this document. In particular, and without limitation, these intellectual property | |
6 * rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or | |
7 * more additional patents or pending patent applications in the U.S. and in other countries. | |
8 * | |
9 * U.S. Government Rights - Commercial software. Government users are subject to the Sun | |
10 * Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its | |
11 * supplements. | |
12 * | |
13 * Use is subject to license terms. Sun, Sun Microsystems, the Sun logo, Java and Solaris are trademarks or | |
14 * registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks | |
15 * are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the | |
16 * U.S. and other countries. | |
17 * | |
18 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open | |
19 * Company, Ltd. | |
20 */ | |
21 package com.sun.hotspot.c1x; | |
22 | |
23 import java.util.ArrayList; | |
24 import java.util.List; | |
25 | |
26 import com.sun.cri.ci.CiKind; | |
27 import com.sun.cri.ri.RiField; | |
28 import com.sun.cri.ri.RiMethod; | |
29 import com.sun.cri.ri.RiType; | |
30 import com.sun.cri.ri.RiType.Representation; | |
31 import com.sun.cri.xir.CiXirAssembler; | |
32 import com.sun.cri.xir.RiXirGenerator; | |
33 import com.sun.cri.xir.XirArgument; | |
34 import com.sun.cri.xir.XirSite; | |
35 import com.sun.cri.xir.XirSnippet; | |
36 import com.sun.cri.xir.XirTemplate; | |
37 import com.sun.cri.xir.CiXirAssembler.XirOperand; | |
38 | |
39 /** | |
40 * | |
41 * @author Thomas Wuerthinger | |
42 * | |
43 */ | |
44 public class HotSpotXirGenerator extends RiXirGenerator { | |
45 | |
46 private XirTemplate[] emptyTemplates = new XirTemplate[CiKind.values().length]; | |
47 | |
48 @Override | |
49 public List<XirTemplate> buildTemplates(CiXirAssembler asm) { | |
50 | |
51 List<XirTemplate> templates = new ArrayList<XirTemplate>(); | |
52 for (int i=0; i<CiKind.values().length; i++) { | |
53 | |
54 CiKind curKind = CiKind.values()[i]; | |
55 | |
56 if (curKind == CiKind.Float || curKind == CiKind.Double) continue; | |
57 | |
58 if (CiKind.values()[i] == CiKind.Void) { | |
59 asm.restart(CiKind.values()[i]); | |
60 emptyTemplates[i] = asm.finishTemplate("empty-" + CiKind.values()[i]); | |
61 } else { | |
62 asm.restart(); | |
63 XirOperand result = asm.createTemp("result", CiKind.values()[i]); | |
64 emptyTemplates[i] = asm.finishTemplate(result, "empty-" + CiKind.values()[i]); | |
65 } | |
66 templates.add(emptyTemplates[i]); | |
67 } | |
68 | |
69 | |
70 return templates; | |
71 } | |
72 | |
73 @Override | |
74 public XirSnippet genArrayLength(XirSite site, XirArgument array) { | |
75 return new XirSnippet(emptyTemplates[CiKind.Int.ordinal()]); | |
76 } | |
77 | |
78 @Override | |
79 public XirSnippet genArrayLoad(XirSite site, XirArgument array, | |
80 XirArgument index, XirArgument length, CiKind elementKind, | |
81 RiType elementType) { | |
82 return new XirSnippet(emptyTemplates[elementKind.ordinal()]); | |
83 } | |
84 | |
85 @Override | |
86 public XirSnippet genArrayStore(XirSite site, XirArgument array, | |
87 XirArgument index, XirArgument length, XirArgument value, | |
88 CiKind elementKind, RiType elementType) { | |
89 return new XirSnippet(emptyTemplates[CiKind.Void.ordinal()]); | |
90 } | |
91 | |
92 @Override | |
93 public XirSnippet genCheckCast(XirSite site, XirArgument receiver, | |
94 XirArgument hub, RiType type) { | |
95 return new XirSnippet(emptyTemplates[CiKind.Object.ordinal()]); | |
96 } | |
97 | |
98 @Override | |
99 public XirSnippet genEntrypoint(XirSite site) { | |
100 return null; | |
101 } | |
102 | |
103 @Override | |
104 public XirSnippet genGetField(XirSite site, XirArgument receiver, | |
105 RiField field) { | |
106 return new XirSnippet(emptyTemplates[field.kind().ordinal()]); | |
107 } | |
108 | |
109 @Override | |
110 public XirSnippet genGetStatic(XirSite site, XirArgument staticTuple, | |
111 RiField field) { | |
112 return new XirSnippet(emptyTemplates[field.kind().ordinal()]); | |
113 } | |
114 | |
115 @Override | |
116 public XirSnippet genInstanceOf(XirSite site, XirArgument receiver, | |
117 XirArgument hub, RiType type) { | |
118 return new XirSnippet(emptyTemplates[CiKind.Boolean.ordinal()]); | |
119 } | |
120 | |
121 @Override | |
122 public XirSnippet genIntrinsic(XirSite site, XirArgument[] arguments, | |
123 RiMethod method) { | |
124 return null; | |
125 } | |
126 | |
127 @Override | |
128 public XirSnippet genInvokeInterface(XirSite site, XirArgument receiver, | |
129 RiMethod method) { | |
130 return new XirSnippet(emptyTemplates[CiKind.Word.ordinal()]); | |
131 } | |
132 | |
133 @Override | |
134 public XirSnippet genInvokeSpecial(XirSite site, XirArgument receiver, | |
135 RiMethod method) { | |
136 return new XirSnippet(emptyTemplates[CiKind.Word.ordinal()]); | |
137 } | |
138 | |
139 @Override | |
140 public XirSnippet genInvokeStatic(XirSite site, RiMethod method) { | |
141 return new XirSnippet(emptyTemplates[CiKind.Word.ordinal()]); | |
142 } | |
143 | |
144 @Override | |
145 public XirSnippet genInvokeVirtual(XirSite site, XirArgument receiver, | |
146 RiMethod method) { | |
147 return new XirSnippet(emptyTemplates[CiKind.Word.ordinal()]); | |
148 } | |
149 | |
150 @Override | |
151 public XirSnippet genMonitorEnter(XirSite site, XirArgument receiver) { | |
152 return new XirSnippet(emptyTemplates[CiKind.Void.ordinal()]); | |
153 } | |
154 | |
155 @Override | |
156 public XirSnippet genMonitorExit(XirSite site, XirArgument receiver) { | |
157 return new XirSnippet(emptyTemplates[CiKind.Void.ordinal()]); | |
158 } | |
159 | |
160 @Override | |
161 public XirSnippet genNewArray(XirSite site, XirArgument length, | |
162 CiKind elementKind, RiType componentType, RiType arrayType) { | |
163 return new XirSnippet(emptyTemplates[CiKind.Object.ordinal()]); | |
164 } | |
165 | |
166 @Override | |
167 public XirSnippet genNewInstance(XirSite site, RiType type) { | |
168 return new XirSnippet(emptyTemplates[CiKind.Object.ordinal()]); | |
169 } | |
170 | |
171 @Override | |
172 public XirSnippet genNewMultiArray(XirSite site, XirArgument[] lengths, | |
173 RiType type) { | |
174 return new XirSnippet(emptyTemplates[CiKind.Object.ordinal()]); | |
175 } | |
176 | |
177 @Override | |
178 public XirSnippet genPutField(XirSite site, XirArgument receiver, | |
179 RiField field, XirArgument value) { | |
180 return new XirSnippet(emptyTemplates[CiKind.Void.ordinal()]); | |
181 } | |
182 | |
183 @Override | |
184 public XirSnippet genPutStatic(XirSite site, XirArgument staticTuple, | |
185 RiField field, XirArgument value) { | |
186 return new XirSnippet(emptyTemplates[CiKind.Void.ordinal()]); | |
187 } | |
188 | |
189 @Override | |
190 public XirSnippet genResolveClass(XirSite site, RiType type, | |
191 Representation representation) { | |
192 return new XirSnippet(emptyTemplates[CiKind.Object.ordinal()]); | |
193 } | |
194 | |
195 @Override | |
196 public XirSnippet genSafepoint(XirSite site) { | |
197 return new XirSnippet(emptyTemplates[CiKind.Void.ordinal()]); | |
198 } | |
199 | |
200 } |