comparison graal/GraalCompiler/src/com/sun/c1x/value/FrameStateBuilder.java @ 2842:7596ae867a7b

basic inlining passes all tests, including optimistic inlining
author Lukas Stadler <lukas.stadler@jku.at>
date Wed, 01 Jun 2011 16:26:17 +0200
parents 75e0d39833a0
children 14708c03abba 7f14e6b48a9c
comparison
equal deleted inserted replaced
2841:633e66de40fe 2842:7596ae867a7b
26 import static java.lang.reflect.Modifier.*; 26 import static java.lang.reflect.Modifier.*;
27 27
28 import java.util.*; 28 import java.util.*;
29 29
30 import com.oracle.graal.graph.*; 30 import com.oracle.graal.graph.*;
31 import com.sun.c1x.graph.*;
32 import com.sun.c1x.ir.*; 31 import com.sun.c1x.ir.*;
33 import com.sun.cri.ci.*; 32 import com.sun.cri.ci.*;
34 import com.sun.cri.ri.*; 33 import com.sun.cri.ri.*;
35 34
36 35
42 private final Value[] stack; 41 private final Value[] stack;
43 private final ArrayList<Value> locks; 42 private final ArrayList<Value> locks;
44 43
45 private int stackIndex; 44 private int stackIndex;
46 45
46 private final RiMethod method;
47
47 public FrameStateBuilder(RiMethod method, Graph graph) { 48 public FrameStateBuilder(RiMethod method, Graph graph) {
49 this.method = method;
48 this.graph = graph; 50 this.graph = graph;
49 this.locals = new Value[method.maxLocals()]; 51 this.locals = new Value[method.maxLocals()];
50 this.stack = new Value[method.maxStackSize()]; 52 this.stack = new Value[method.maxStackSize()];
51 53
52 int javaIndex = 0; 54 int javaIndex = 0;
95 locks.add(other.lockAt(i)); 97 locks.add(other.lockAt(i));
96 } 98 }
97 } 99 }
98 100
99 public FrameState create(int bci) { 101 public FrameState create(int bci) {
100 return new FrameState(bci, locals, stack, stackIndex, locks, graph); 102 return new FrameState(method, bci, locals, stack, stackIndex, locks, graph);
101 } 103 }
102 104
103 @Override 105 @Override
104 public FrameState duplicateWithEmptyStack(int bci) { 106 public FrameState duplicateWithEmptyStack(int bci) {
105 FrameState frameState = new FrameState(bci, locals, new Value[0], 0, locks, graph); 107 FrameState frameState = new FrameState(method, bci, locals, new Value[0], 0, locks, graph);
106 frameState.setOuterFrameState(outerFrameState()); 108 frameState.setOuterFrameState(outerFrameState());
107 return frameState; 109 return frameState;
108 } 110 }
109 111
110 /** 112 /**
359 /** 361 /**
360 * Locks a new object within the specified IRScope. 362 * Locks a new object within the specified IRScope.
361 * @param scope the IRScope in which this locking operation occurs 363 * @param scope the IRScope in which this locking operation occurs
362 * @param obj the object being locked 364 * @param obj the object being locked
363 */ 365 */
364 public void lock(IR ir, Value obj, int totalNumberOfLocks) { 366 public void lock(Value obj) {
365 locks.add(obj); 367 locks.add(obj);
366 } 368 }
367 369
368 /** 370 /**
369 * Unlock the lock on the top of the stack. 371 * Unlock the lock on the top of the stack.
496 locks.set(i - locals.length - stack.length, v); 498 locks.set(i - locals.length - stack.length, v);
497 } 499 }
498 } 500 }
499 501
500 @Override 502 @Override
501 public Value outerFrameState() { 503 public FrameState outerFrameState() {
502 return null; 504 return null;
503 } 505 }
504 } 506 }