|
56 | 56 | import com.oracle.truffle.dsl.processor.TruffleTypes; |
57 | 57 | import com.oracle.truffle.dsl.processor.bytecode.generator.BytecodeRootNodeElement.InterpreterTier; |
58 | 58 | import com.oracle.truffle.dsl.processor.bytecode.model.BytecodeDSLModel; |
| 59 | +import com.oracle.truffle.dsl.processor.bytecode.model.ConstantOperandModel; |
59 | 60 | import com.oracle.truffle.dsl.processor.bytecode.model.InstructionModel; |
60 | 61 | import com.oracle.truffle.dsl.processor.bytecode.model.InstructionModel.ImmediateKind; |
61 | 62 | import com.oracle.truffle.dsl.processor.bytecode.model.InstructionModel.InstructionImmediate; |
@@ -163,10 +164,12 @@ public void beforeCallSpecialization(FlatNodeGenFactory nodeFactory, CodeTreeBui |
163 | 164 | private boolean buildChildExecution(CodeTreeBuilder b, FrameState frameState, String frame, int specializationIndex) { |
164 | 165 | int operandIndex = specializationIndex; |
165 | 166 | if (operandIndex < instruction.signature.constantOperandsBeforeCount) { |
166 | | - TypeMirror constantOperandType = instruction.operation.constantOperands.before().get(operandIndex).type(); |
167 | | - List<InstructionImmediate> imms = instruction.getImmediates(ImmediateKind.CONSTANT); |
168 | | - InstructionImmediate imm = imms.get(operandIndex); |
169 | | - b.tree(readConstFastPath(imm, constantOperandType)); |
| 167 | + ConstantOperandModel constantOperand = instruction.operation.constantOperands.before().get(operandIndex); |
| 168 | + InstructionImmediate imm = instruction.constantOperandImmediates.get(constantOperand); |
| 169 | + if (imm == null) { |
| 170 | + throw new AssertionError("Could not find an immediate for constant operand " + constantOperand + " on instruction " + instruction); |
| 171 | + } |
| 172 | + b.tree(rootNode.readConstantImmediate("$bc", "$bci", "$bytecode", imm, constantOperand.type())); |
170 | 173 | return false; |
171 | 174 | } |
172 | 175 | operandIndex -= instruction.signature.constantOperandsBeforeCount; |
@@ -236,20 +239,18 @@ private boolean buildChildExecution(CodeTreeBuilder b, FrameState frameState, St |
236 | 239 |
|
237 | 240 | int constantOperandAfterCount = instruction.signature.constantOperandsAfterCount; |
238 | 241 | if (operandIndex < constantOperandAfterCount) { |
239 | | - TypeMirror constantOperandType = instruction.operation.constantOperands.after().get(operandIndex).type(); |
240 | | - List<InstructionImmediate> imms = instruction.getImmediates(ImmediateKind.CONSTANT); |
241 | | - InstructionImmediate imm = imms.get(instruction.signature.constantOperandsBeforeCount + operandIndex); |
242 | | - b.tree(rootNode.readConstFastPath(readImmediate("$bc", "$bci", imm), "$bytecode.constants", constantOperandType)); |
| 242 | + ConstantOperandModel constantOperand = instruction.operation.constantOperands.after().get(operandIndex); |
| 243 | + InstructionImmediate imm = instruction.constantOperandImmediates.get(constantOperand); |
| 244 | + if (imm == null) { |
| 245 | + throw new AssertionError("Could not find an immediate for constant operand " + constantOperand + " on instruction " + instruction); |
| 246 | + } |
| 247 | + b.tree(rootNode.readConstantImmediate("$bc", "$bci", "$bytecode", imm, constantOperand.type())); |
243 | 248 | return false; |
244 | 249 | } |
245 | 250 |
|
246 | 251 | throw new AssertionError("index=" + specializationIndex + ", signature=" + instruction.signature); |
247 | 252 | } |
248 | 253 |
|
249 | | - private CodeTree readConstFastPath(InstructionImmediate imm, TypeMirror immediateType) { |
250 | | - return rootNode.readConstFastPath(readImmediate("$bc", "$bci", imm), "$bytecode.constants", immediateType); |
251 | | - } |
252 | | - |
253 | 254 | public CodeExecutableElement getQuickenMethod() { |
254 | 255 | return quickenMethod; |
255 | 256 | } |
@@ -307,7 +308,7 @@ public CodeTree bindExpressionValue(FrameState frameState, Variable variable) { |
307 | 308 | return CodeTreeBuilder.singleString("$bci"); |
308 | 309 | case BytecodeDSLParser.SYMBOL_CONTINUATION_ROOT: |
309 | 310 | InstructionImmediate continuationIndex = instruction.getImmediates(ImmediateKind.CONSTANT).getLast(); |
310 | | - return CodeTreeBuilder.createBuilder().tree(readConstFastPath(continuationIndex, rootNode.getContinuationRootNodeImpl().asType())).build(); |
| 311 | + return CodeTreeBuilder.createBuilder().tree(rootNode.readConstantImmediate("$bc", "$bci", "$bytecode", continuationIndex, rootNode.getContinuationRootNodeImpl().asType())).build(); |
311 | 312 | default: |
312 | 313 | return NodeGeneratorPlugs.super.bindExpressionValue(frameState, variable); |
313 | 314 |
|
|
0 commit comments