Mercurial > hg > graal-compiler
comparison graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java @ 2581:4a36a0bd6d18
added GraalGraph to classpath, Node as superclass of Value
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Thu, 05 May 2011 13:27:48 +0200 |
parents | 46586c77b129 |
children | 768d77a1c7af |
comparison
equal
deleted
inserted
replaced
2579:4984c8ebd6c7 | 2581:4a36a0bd6d18 |
---|---|
108 */ | 108 */ |
109 public MutableFrameState copy(int bci, boolean withLocals, boolean withStack, boolean withLocks) { | 109 public MutableFrameState copy(int bci, boolean withLocals, boolean withStack, boolean withLocks) { |
110 final MutableFrameState other = new MutableFrameState(bci, localsSize(), maxStackSize()); | 110 final MutableFrameState other = new MutableFrameState(bci, localsSize(), maxStackSize()); |
111 if (withLocals && withStack) { | 111 if (withLocals && withStack) { |
112 // fast path: use array copy | 112 // fast path: use array copy |
113 int valuesSize = valuesSize(); | 113 System.arraycopy(values, 0, other.values, 0, valuesSize()); |
114 assert other.values.length >= valuesSize : "array size: " + other.values.length + ", valuesSize: " + valuesSize + ", maxStackSize: " + maxStackSize() + ", localsSize: " + localsSize(); | |
115 assert values.length >= valuesSize : "array size: " + values.length + ", valuesSize: " + valuesSize + ", maxStackSize: " + maxStackSize() + ", localsSize: " + localsSize(); | |
116 System.arraycopy(values, 0, other.values, 0, valuesSize); | |
117 other.stackIndex = stackIndex; | 114 other.stackIndex = stackIndex; |
118 } else { | 115 } else { |
119 if (withLocals) { | 116 if (withLocals) { |
120 other.replaceLocals(this); | 117 other.replaceLocals(this); |
121 } | 118 } |
148 */ | 145 */ |
149 public FrameState immutableCopyCodePosOnly() { | 146 public FrameState immutableCopyCodePosOnly() { |
150 return copy(bci, false, false, false); | 147 return copy(bci, false, false, false); |
151 } | 148 } |
152 | 149 |
153 public boolean isSame(FrameState other) { | 150 public boolean isCompatibleWith(FrameState other) { |
154 assert stackSize() == other.stackSize(); | 151 if (stackSize() != other.stackSize() || localsSize() != other.localsSize() || locksSize() != other.locksSize()) { |
155 assert localsSize() == other.localsSize(); | 152 return false; |
156 assert locksSize() == other.locksSize(); | 153 } |
157 for (int i = 0; i < stackIndex; i++) { | 154 for (int i = 0; i < stackIndex; i++) { |
158 Value x = stackAt(i); | 155 Value x = stackAt(i); |
159 Value y = other.stackAt(i); | 156 Value y = other.stackAt(i); |
160 if (x != y && typeMismatch(x, y)) { | 157 if (x != y && typeMismatch(x, y)) { |
161 return false; | 158 return false; |