353 return graph.add(new FrameState(outerFrameState, code, bci, locals, stack, stackSize, lockedObjects, Arrays.asList(monitorIds), rethrowException, duringCall));
354 }
355 }
356
357 public NodeSourcePosition createBytecodePosition(int bci) {
358 BytecodeParser parent = parser.getParent();
359 NodeSourcePosition position = create(bci, parent);
360 return position;
361 }
362
363 private NodeSourcePosition create(int bci, BytecodeParser parent) {
364 if (outerSourcePosition == null && parent != null) {
365 outerSourcePosition = parent.getFrameStateBuilder().createBytecodePosition(parent.bci());
366 }
367 if (bci == BytecodeFrame.AFTER_EXCEPTION_BCI && parent != null) {
368 return FrameState.toSourcePosition(outerFrameState);
369 }
370 if (bci == BytecodeFrame.INVALID_FRAMESTATE_BCI) {
371 throw shouldNotReachHere();
372 }
373 return new NodeSourcePosition(outerSourcePosition, code.getMethod(), bci);
374 }
375
376 public FrameStateBuilder copy() {
377 return new FrameStateBuilder(this);
378 }
379
380 public boolean isCompatibleWith(FrameStateBuilder other) {
381 assert code.equals(other.code) && graph == other.graph && localsSize() == other.localsSize() : "Can only compare frame states of the same method";
382 assert lockedObjects.length == monitorIds.length && other.lockedObjects.length == other.monitorIds.length : "mismatch between lockedObjects and monitorIds";
383
384 if (stackSize() != other.stackSize()) {
385 return false;
386 }
387 for (int i = 0; i < stackSize(); i++) {
388 ValueNode x = stack[i];
389 ValueNode y = other.stack[i];
390 assert x != null && y != null;
391 if (x != y && (x == TWO_SLOT_MARKER || x.isDeleted() || y == TWO_SLOT_MARKER || y.isDeleted() || x.getStackKind() != y.getStackKind())) {
392 return false;
393 }
|
353 return graph.add(new FrameState(outerFrameState, code, bci, locals, stack, stackSize, lockedObjects, Arrays.asList(monitorIds), rethrowException, duringCall));
354 }
355 }
356
357 public NodeSourcePosition createBytecodePosition(int bci) {
358 BytecodeParser parent = parser.getParent();
359 NodeSourcePosition position = create(bci, parent);
360 return position;
361 }
362
363 private NodeSourcePosition create(int bci, BytecodeParser parent) {
364 if (outerSourcePosition == null && parent != null) {
365 outerSourcePosition = parent.getFrameStateBuilder().createBytecodePosition(parent.bci());
366 }
367 if (bci == BytecodeFrame.AFTER_EXCEPTION_BCI && parent != null) {
368 return FrameState.toSourcePosition(outerFrameState);
369 }
370 if (bci == BytecodeFrame.INVALID_FRAMESTATE_BCI) {
371 throw shouldNotReachHere();
372 }
373 if (parser.intrinsicContext != null && (parent == null || parent.intrinsicContext != parser.intrinsicContext)) {
374 // When parsing an intrinsic put in a substitution marker showing the original method as
375 // the caller. This keeps the relationship between the method and the method
376 // substitution clear in resulting NodeSourcePosition.
377 NodeSourcePosition original = new NodeSourcePosition(outerSourcePosition, parser.intrinsicContext.getOriginalMethod(), -1);
378 return NodeSourcePosition.substitution(original, code.getMethod(), bci);
379 } else {
380 return new NodeSourcePosition(outerSourcePosition, code.getMethod(), bci);
381 }
382 }
383
384 public FrameStateBuilder copy() {
385 return new FrameStateBuilder(this);
386 }
387
388 public boolean isCompatibleWith(FrameStateBuilder other) {
389 assert code.equals(other.code) && graph == other.graph && localsSize() == other.localsSize() : "Can only compare frame states of the same method";
390 assert lockedObjects.length == monitorIds.length && other.lockedObjects.length == other.monitorIds.length : "mismatch between lockedObjects and monitorIds";
391
392 if (stackSize() != other.stackSize()) {
393 return false;
394 }
395 for (int i = 0; i < stackSize(); i++) {
396 ValueNode x = stack[i];
397 ValueNode y = other.stack[i];
398 assert x != null && y != null;
399 if (x != y && (x == TWO_SLOT_MARKER || x.isDeleted() || y == TWO_SLOT_MARKER || y.isDeleted() || x.getStackKind() != y.getStackKind())) {
400 return false;
401 }
|