Mercurial > hg > graal-compiler
comparison graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java @ 3160:8044bdfaab06
Lowering of array accesses.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 06 Jul 2011 16:15:15 +0200 |
parents | eb120717a534 |
children | ce7e5b3798f7 |
comparison
equal
deleted
inserted
replaced
3159:7f2bf8fe6804 | 3160:8044bdfaab06 |
---|---|
482 emitBooleanBranch(((NegateBooleanNode) node).value(), falseSuccessor, trueSuccessor, info); | 482 emitBooleanBranch(((NegateBooleanNode) node).value(), falseSuccessor, trueSuccessor, info); |
483 } else if (node instanceof Compare) { | 483 } else if (node instanceof Compare) { |
484 emitCompare((Compare) node, trueSuccessor, falseSuccessor); | 484 emitCompare((Compare) node, trueSuccessor, falseSuccessor); |
485 } else if (node instanceof InstanceOf) { | 485 } else if (node instanceof InstanceOf) { |
486 emitInstanceOf((TypeCheck) node, trueSuccessor, falseSuccessor, info); | 486 emitInstanceOf((TypeCheck) node, trueSuccessor, falseSuccessor, info); |
487 } else if (node instanceof Constant) { | |
488 emitConstantBranch(((Constant) node).asConstant().asBoolean(), trueSuccessor, falseSuccessor, info); | |
487 } else { | 489 } else { |
488 throw Util.unimplemented(node.toString()); | 490 throw Util.unimplemented(node.toString()); |
489 } | 491 } |
490 } | 492 } |
491 | 493 |
494 XirSnippet snippet = xir.genInstanceOf(site(x), obj, toXirArgument(x.targetClassInstruction()), x.targetClass()); | 496 XirSnippet snippet = xir.genInstanceOf(site(x), obj, toXirArgument(x.targetClassInstruction()), x.targetClass()); |
495 emitXir(snippet, x, info, null, false); | 497 emitXir(snippet, x, info, null, false); |
496 LIRXirInstruction instr = (LIRXirInstruction) lir.instructionsList().get(lir.instructionsList().size() - 1); | 498 LIRXirInstruction instr = (LIRXirInstruction) lir.instructionsList().get(lir.instructionsList().size() - 1); |
497 instr.setTrueSuccessor(trueSuccessor); | 499 instr.setTrueSuccessor(trueSuccessor); |
498 instr.setFalseSuccessor(falseSuccessor); | 500 instr.setFalseSuccessor(falseSuccessor); |
501 } | |
502 | |
503 | |
504 public void emitConstantBranch(boolean value, LIRBlock trueSuccessorBlock, LIRBlock falseSuccessorBlock, LIRDebugInfo info) { | |
505 if (value) { | |
506 emitConstantBranch(trueSuccessorBlock, info); | |
507 } else { | |
508 emitConstantBranch(falseSuccessorBlock, info); | |
509 } | |
510 } | |
511 | |
512 private void emitConstantBranch(LIRBlock block, LIRDebugInfo info) { | |
513 if (block != null) { | |
514 lir.jump(block); | |
515 } | |
499 } | 516 } |
500 | 517 |
501 public void emitCompare(Compare compare, LIRBlock trueSuccessorBlock, LIRBlock falseSuccessorBlock) { | 518 public void emitCompare(Compare compare, LIRBlock trueSuccessorBlock, LIRBlock falseSuccessorBlock) { |
502 CiKind kind = compare.x().kind; | 519 CiKind kind = compare.x().kind; |
503 | 520 |
759 emitXir(typeCheck, x, info, compilation.method, false); | 776 emitXir(typeCheck, x, info, compilation.method, false); |
760 } else { | 777 } else { |
761 FrameState state = lastState; | 778 FrameState state = lastState; |
762 assert state != null : "deoptimize instruction always needs a state"; | 779 assert state != null : "deoptimize instruction always needs a state"; |
763 | 780 |
764 if (deoptimizationStubs == null) { | 781 if (comp instanceof Constant && comp.asConstant().asBoolean()) { |
765 deoptimizationStubs = new ArrayList<DeoptimizationStub>(); | 782 // Nothing to emit. |
766 } | 783 } else { |
767 DeoptimizationStub stub = new DeoptimizationStub(DeoptAction.InvalidateReprofile, state); | 784 if (deoptimizationStubs == null) { |
768 deoptimizationStubs.add(stub); | 785 deoptimizationStubs = new ArrayList<DeoptimizationStub>(); |
769 | 786 } |
770 emitBooleanBranch(comp, null, new LIRBlock(stub.label, stub.info), stub.info); | 787 |
788 DeoptimizationStub stub = new DeoptimizationStub(DeoptAction.InvalidateReprofile, state); | |
789 deoptimizationStubs.add(stub); | |
790 emitBooleanBranch(comp, null, new LIRBlock(stub.label, stub.info), stub.info); | |
791 } | |
771 } | 792 } |
772 } | 793 } |
773 | 794 |
774 @Override | 795 @Override |
775 public void visitPhi(Phi i) { | 796 public void visitPhi(Phi i) { |