Mercurial > hg > graal-jvmci-8
comparison graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java @ 2716:c1a9bf38da28
Removed bci from the Instruction class.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Thu, 19 May 2011 13:59:55 +0200 |
parents | 3ac3dd97d8df |
children | c1ce2a53d6c3 |
comparison
equal
deleted
inserted
replaced
2715:3ac3dd97d8df | 2716:c1a9bf38da28 |
---|---|
40 import com.sun.c1x.lir.*; | 40 import com.sun.c1x.lir.*; |
41 import com.sun.c1x.opt.*; | 41 import com.sun.c1x.opt.*; |
42 import com.sun.c1x.util.*; | 42 import com.sun.c1x.util.*; |
43 import com.sun.c1x.value.*; | 43 import com.sun.c1x.value.*; |
44 import com.sun.c1x.value.FrameState.PhiProcedure; | 44 import com.sun.c1x.value.FrameState.PhiProcedure; |
45 import com.sun.cri.bytecode.*; | |
45 import com.sun.cri.bytecode.Bytecodes.MemoryBarriers; | 46 import com.sun.cri.bytecode.Bytecodes.MemoryBarriers; |
46 import com.sun.cri.ci.*; | 47 import com.sun.cri.ci.*; |
47 import com.sun.cri.ri.*; | 48 import com.sun.cri.ri.*; |
48 import com.sun.cri.xir.CiXirAssembler.XirConstant; | 49 import com.sun.cri.xir.CiXirAssembler.XirConstant; |
49 import com.sun.cri.xir.CiXirAssembler.XirInstruction; | 50 import com.sun.cri.xir.CiXirAssembler.XirInstruction; |
445 lir.cmp(i.condition(), left, right); | 446 lir.cmp(i.condition(), left, right); |
446 lir.cmove(i.condition(), tVal, fVal, reg); | 447 lir.cmove(i.condition(), tVal, fVal, reg); |
447 } | 448 } |
448 | 449 |
449 protected FrameState stateBeforeInvokeReturn(Invoke invoke) { | 450 protected FrameState stateBeforeInvokeReturn(Invoke invoke) { |
450 return invoke.stateAfter().duplicateModified(invoke.bci(), invoke.kind/*, args*/); | 451 return invoke.stateAfter().duplicateModified(getBeforeInvokeBci(invoke), invoke.kind); |
451 } | 452 } |
452 | 453 |
453 protected FrameState stateBeforeInvokeWithArguments(Invoke invoke) { | 454 protected FrameState stateBeforeInvokeWithArguments(Invoke invoke) { |
454 Value[] args = new Value[invoke.argumentCount()]; | 455 Value[] args = new Value[invoke.argumentCount()]; |
455 for (int i = 0; i < invoke.argumentCount(); i++) { | 456 for (int i = 0; i < invoke.argumentCount(); i++) { |
456 args[i] = invoke.argument(i); | 457 args[i] = invoke.argument(i); |
457 } | 458 } |
458 return invoke.stateAfter().duplicateModified(invoke.bci(), invoke.kind, args); | 459 return invoke.stateAfter().duplicateModified(getBeforeInvokeBci(invoke), invoke.kind, args); |
460 } | |
461 | |
462 private int getBeforeInvokeBci(Invoke invoke) { | |
463 int length = 3; | |
464 if (invoke.opcode() == Bytecodes.INVOKEINTERFACE) { | |
465 length += 2; | |
466 } | |
467 return invoke.stateAfter().bci - length; | |
459 } | 468 } |
460 | 469 |
461 @Override | 470 @Override |
462 public void visitInvoke(Invoke x) { | 471 public void visitInvoke(Invoke x) { |
463 RiMethod target = x.target(); | 472 RiMethod target = x.target(); |
1391 Value value = state.stackAt(index); | 1400 Value value = state.stackAt(index); |
1392 if (value != x) { | 1401 if (value != x) { |
1393 walkStateValue(value); | 1402 walkStateValue(value); |
1394 } | 1403 } |
1395 } | 1404 } |
1396 FrameState s = state; | 1405 for (int index = 0; index < state.localsSize(); index++) { |
1397 int bci = x.bci(); | 1406 final Value value = state.localAt(index); |
1398 if (bci == Instruction.SYNCHRONIZATION_ENTRY_BCI) { | |
1399 assert x instanceof ExceptionObject || | |
1400 x instanceof Throw || | |
1401 x instanceof MonitorEnter || | |
1402 x instanceof MonitorExit : x + ", " + x.getClass(); | |
1403 } | |
1404 | |
1405 for (int index = 0; index < s.localsSize(); index++) { | |
1406 final Value value = s.localAt(index); | |
1407 if (value != null) { | 1407 if (value != null) { |
1408 if (!value.isIllegal()) { | 1408 if (!value.isIllegal()) { |
1409 walkStateValue(value); | 1409 walkStateValue(value); |
1410 } | 1410 } |
1411 } | 1411 } |