comparison graal/GraalCompiler/src/com/sun/c1x/C1XCompilation.java @ 2677:0ea5f12e873a

use com.oracle.max.asm project for assembler
author Christian.Wimmer@Oracle.com
date Fri, 13 May 2011 17:09:20 -0700
parents bcd20d26d52d
children 785e9ecdcc69 7ed72769d51a
comparison
equal deleted inserted replaced
2676:e0e89714e2f1 2677:0ea5f12e873a
23 23
24 package com.sun.c1x; 24 package com.sun.c1x;
25 25
26 import java.util.*; 26 import java.util.*;
27 27
28 import com.oracle.max.asm.*;
28 import com.oracle.graal.graph.*; 29 import com.oracle.graal.graph.*;
29 import com.sun.c1x.alloc.*; 30 import com.sun.c1x.alloc.*;
30 import com.sun.c1x.asm.*; 31 import com.sun.c1x.asm.*;
31 import com.sun.c1x.gen.*; 32 import com.sun.c1x.gen.*;
32 import com.sun.c1x.gen.LIRGenerator.DeoptimizationStub; 33 import com.sun.c1x.gen.LIRGenerator.DeoptimizationStub;
39 import com.sun.cri.ri.*; 40 import com.sun.cri.ri.*;
40 41
41 /** 42 /**
42 * This class encapsulates global information about the compilation of a particular method, 43 * This class encapsulates global information about the compilation of a particular method,
43 * including a reference to the runtime, statistics about the compiled code, etc. 44 * including a reference to the runtime, statistics about the compiled code, etc.
44 *
45 * @author Ben L. Titzer
46 */ 45 */
47 public final class C1XCompilation { 46 public final class C1XCompilation {
48 47
49 private static ThreadLocal<C1XCompilation> currentCompilation = new ThreadLocal<C1XCompilation>(); 48 private static ThreadLocal<C1XCompilation> currentCompilation = new ThreadLocal<C1XCompilation>();
50 49
69 private boolean typesafe = true; 68 private boolean typesafe = true;
70 69
71 private int nextID = 1; 70 private int nextID = 1;
72 71
73 private FrameMap frameMap; 72 private FrameMap frameMap;
74 private AbstractAssembler assembler; 73 private TargetMethodAssembler assembler;
75 74
76 private IR hir; 75 private IR hir;
77 76
78 private LIRGenerator lirGenerator; 77 private LIRGenerator lirGenerator;
79 78
185 */ 184 */
186 public FrameMap frameMap() { 185 public FrameMap frameMap() {
187 return frameMap; 186 return frameMap;
188 } 187 }
189 188
190 public AbstractAssembler masm() { 189 public TargetMethodAssembler assembler() {
191 if (assembler == null) { 190 if (assembler == null) {
192 assembler = compiler.backend.newAssembler(registerConfig); 191 AbstractAssembler asm = compiler.backend.newAssembler(registerConfig);
192 assembler = new TargetMethodAssembler(asm);
193 assembler.setFrameSize(frameMap.frameSize()); 193 assembler.setFrameSize(frameMap.frameSize());
194 assembler.targetMethod.setCustomStackAreaOffset(frameMap.offsetToCustomArea()); 194 assembler.targetMethod.setCustomStackAreaOffset(frameMap.offsetToCustomArea());
195 } 195 }
196 return assembler; 196 return assembler;
197 } 197 }
278 } 278 }
279 279
280 // generate traps at the end of the method 280 // generate traps at the end of the method
281 lirAssembler.emitTraps(); 281 lirAssembler.emitTraps();
282 282
283 CiTargetMethod targetMethod = masm().finishTargetMethod(method, runtime, lirAssembler.registerRestoreEpilogueOffset, false); 283 CiTargetMethod targetMethod = assembler().finishTargetMethod(method, runtime, lirAssembler.registerRestoreEpilogueOffset, false);
284 if (assumptions.count() > 0) { 284 if (assumptions.count() > 0) {
285 targetMethod.setAssumptions(assumptions); 285 targetMethod.setAssumptions(assumptions);
286 } 286 }
287 287
288 if (compiler.isObserved()) { 288 if (compiler.isObserved()) {