348 349 public void setTo(int pos) { 350 assert intFrom == Integer.MAX_VALUE || intFrom < pos; 351 intTo = pos; 352 } 353 354 public void setFrom(int pos) { 355 assert intTo == Integer.MAX_VALUE || pos < intTo; 356 intFrom = pos; 357 } 358 359 @Override 360 public int from() { 361 return intFrom; 362 } 363 364 int to() { 365 return intTo; 366 } 367 368 int numUsePositions() { 369 return numUsePos(); 370 } 371 372 public void setLocationHint(IntervalHint interval) { 373 locationHint = interval; 374 } 375 376 public boolean hasHint() { 377 return locationHint != null; 378 } 379 380 public boolean isSplitParent() { 381 return splitParent == this; 382 } 383 384 boolean isSplitChild() { 385 return splitParent != this; 386 } 387 388 /** 389 * Gets the split parent for this interval. 390 */ 391 public TraceInterval splitParent() { 435 assert state.ordinal() >= spillState().ordinal() : "state cannot decrease"; 436 splitParent().spillState = state; 437 } 438 439 public void setSpillDefinitionPos(int pos) { 440 assert spillState() == SpillState.NoDefinitionFound || spillState() == SpillState.NoSpillStore || spillDefinitionPos() == -1 : "cannot set the position twice"; 441 int to = to(); 442 assert pos < to : String.format("Cannot spill %s at %d", this, pos); 443 splitParent().spillDefinitionPos = pos; 444 } 445 446 /** 447 * Returns true if this interval has a shadow copy on the stack that is correct after 448 * {@code opId}. 449 */ 450 public boolean inMemoryAt(int opId) { 451 SpillState spillSt = spillState(); 452 return spillSt == SpillState.StartInMemory || (spillSt == SpillState.SpillStore && opId > spillDefinitionPos() && !canMaterialize()); 453 } 454 455 // test intersection 456 boolean intersects(TraceInterval i) { 457 return intersectsAt(i) != -1; 458 } 459 460 int intersectsAt(TraceInterval i) { 461 TraceInterval i1; 462 TraceInterval i2; 463 if (i.from() < this.from()) { 464 i1 = i; 465 i2 = this; 466 } else { 467 i1 = this; 468 i2 = i; 469 } 470 assert i1.from() <= i2.from(); 471 472 if (i1.to() <= i2.from()) { 473 return -1; 474 } | 348 349 public void setTo(int pos) { 350 assert intFrom == Integer.MAX_VALUE || intFrom < pos; 351 intTo = pos; 352 } 353 354 public void setFrom(int pos) { 355 assert intTo == Integer.MAX_VALUE || pos < intTo; 356 intFrom = pos; 357 } 358 359 @Override 360 public int from() { 361 return intFrom; 362 } 363 364 int to() { 365 return intTo; 366 } 367 368 public void setLocationHint(IntervalHint interval) { 369 locationHint = interval; 370 } 371 372 public boolean hasHint() { 373 return locationHint != null; 374 } 375 376 public boolean isSplitParent() { 377 return splitParent == this; 378 } 379 380 boolean isSplitChild() { 381 return splitParent != this; 382 } 383 384 /** 385 * Gets the split parent for this interval. 386 */ 387 public TraceInterval splitParent() { 431 assert state.ordinal() >= spillState().ordinal() : "state cannot decrease"; 432 splitParent().spillState = state; 433 } 434 435 public void setSpillDefinitionPos(int pos) { 436 assert spillState() == SpillState.NoDefinitionFound || spillState() == SpillState.NoSpillStore || spillDefinitionPos() == -1 : "cannot set the position twice"; 437 int to = to(); 438 assert pos < to : String.format("Cannot spill %s at %d", this, pos); 439 splitParent().spillDefinitionPos = pos; 440 } 441 442 /** 443 * Returns true if this interval has a shadow copy on the stack that is correct after 444 * {@code opId}. 445 */ 446 public boolean inMemoryAt(int opId) { 447 SpillState spillSt = spillState(); 448 return spillSt == SpillState.StartInMemory || (spillSt == SpillState.SpillStore && opId > spillDefinitionPos() && !canMaterialize()); 449 } 450 451 public boolean preSpilledAllocated() { 452 return spillState() == SpillState.StartInMemory && numUsePos() == 0 && !hasHint(); 453 } 454 455 // test intersection 456 boolean intersects(TraceInterval i) { 457 return intersectsAt(i) != -1; 458 } 459 460 int intersectsAt(TraceInterval i) { 461 TraceInterval i1; 462 TraceInterval i2; 463 if (i.from() < this.from()) { 464 i1 = i; 465 i2 = this; 466 } else { 467 i1 = this; 468 i2 = i; 469 } 470 assert i1.from() <= i2.from(); 471 472 if (i1.to() <= i2.from()) { 473 return -1; 474 } |