コード例 #1
0
 @Test
 public void testJoinInterface2() {
   Stamp bExact = StampFactory.exactNonNull(getType(B.class));
   Stamp i = StampFactory.declaredTrusted(getType(I.class));
   Stamp join = join(i, bExact);
   Assert.assertEquals(StampFactory.illegal(Kind.Object), join);
 }
コード例 #2
0
 @Test
 public void testJoinInterface3() {
   Stamp bExact = StampFactory.exactNonNull(getType(B.class));
   Stamp i = StampFactory.declared(getType(I.class)); // not trusted
   Stamp join = join(i, bExact);
   Assert.assertEquals(bExact, join);
 }
コード例 #3
0
 @Test
 public void testJoin1() {
   Stamp aNonNull = StampFactory.declaredNonNull(getType(A.class));
   Stamp b = StampFactory.declared(getType(B.class));
   Stamp bNonNull = StampFactory.declaredNonNull(getType(B.class));
   Assert.assertEquals(bNonNull, join(aNonNull, b));
 }
コード例 #4
0
 @Test
 public void testJoin8() {
   Stamp bExact = StampFactory.exactNonNull(getType(B.class));
   Stamp dExact = StampFactory.exact(getType(D.class));
   Stamp join = join(bExact, dExact);
   Assert.assertFalse(join.isLegal());
 }
コード例 #5
0
 @Test
 public void testJoinInterface1() {
   Stamp aNonNull = StampFactory.declaredNonNull(getType(A.class));
   Stamp i = StampFactory.declaredTrusted(getType(I.class));
   Stamp join = join(aNonNull, i);
   Assert.assertTrue(join instanceof ObjectStamp);
   Assert.assertTrue(((ObjectStamp) join).nonNull());
 }
コード例 #6
0
 @Test
 public void testJoin9() {
   Stamp bExact = StampFactory.exact(getType(B.class));
   Stamp dExact = StampFactory.exact(getType(D.class));
   Stamp join = join(bExact, dExact);
   Assert.assertTrue(StampTool.isPointerAlwaysNull(join));
   Assert.assertNull(StampTool.typeOrNull(join));
   Assert.assertNull(StampTool.typeOrNull(join));
 }
コード例 #7
0
 @Test
 public void testJoin6() {
   Stamp dExactNonNull = StampFactory.exactNonNull(getType(D.class));
   Stamp alwaysNull = StampFactory.alwaysNull();
   Stamp join = join(alwaysNull, dExactNonNull);
   Assert.assertFalse(join.isLegal());
   Assert.assertFalse(StampTool.isPointerNonNull(join));
   Assert.assertFalse(StampTool.isPointerAlwaysNull(join));
 }
コード例 #8
0
 @Test
 public void testJoin7() {
   Stamp aExact = StampFactory.exact(getType(A.class));
   Stamp e = StampFactory.declared(getType(E.class));
   Stamp join = join(aExact, e);
   Assert.assertTrue(StampTool.isPointerAlwaysNull(join));
   Assert.assertNull(StampTool.typeOrNull(join));
   Assert.assertFalse(StampTool.isExactType(join));
 }
コード例 #9
0
 @Test
 public void testJoin5() {
   Stamp dExact = StampFactory.exact(getType(D.class));
   Stamp c = StampFactory.declared(getType(C.class));
   Stamp join = join(c, dExact);
   Assert.assertTrue(StampTool.isPointerAlwaysNull(join));
   Assert.assertNull(StampTool.typeOrNull(join));
   Assert.assertFalse(StampTool.isExactType(join));
 }
コード例 #10
0
ファイル: StampTool.java プロジェクト: rjsingh/graal
 public static Stamp div(IntegerStamp stamp1, IntegerStamp stamp2) {
   Kind kind = stamp1.kind();
   if (stamp2.isStrictlyPositive()) {
     long lowerBound = stamp1.lowerBound() / stamp2.lowerBound();
     long upperBound = stamp1.upperBound() / stamp2.lowerBound();
     return StampFactory.forInteger(
         kind, lowerBound, upperBound, IntegerStamp.maskFor(kind, lowerBound, upperBound));
   }
   return StampFactory.forKind(kind);
 }
コード例 #11
0
ファイル: StampTool.java プロジェクト: rjsingh/graal
  public static Stamp add(IntegerStamp stamp1, IntegerStamp stamp2) {
    Kind kind = stamp1.kind();
    assert kind == stamp2.kind();
    if (addOverflow(stamp1.lowerBound(), stamp2.lowerBound(), kind)) {
      return StampFactory.forKind(kind);
    }
    if (addOverflow(stamp1.upperBound(), stamp2.upperBound(), kind)) {
      return StampFactory.forKind(kind);
    }
    long lowerBound = stamp1.lowerBound() + stamp2.lowerBound();
    long upperBound = stamp1.upperBound() + stamp2.upperBound();
    long mask = IntegerStamp.maskFor(kind, lowerBound, upperBound);

    return StampFactory.forInteger(kind, lowerBound, upperBound, mask);
  }
コード例 #12
0
ファイル: StampTool.java プロジェクト: rjsingh/graal
 public static Stamp intToLong(IntegerStamp intStamp) {
   long mask;
   if (intStamp.isPositive()) {
     mask = intStamp.mask();
   } else {
     mask = 0xffffffff00000000L | intStamp.mask();
   }
   return StampFactory.forInteger(Kind.Long, intStamp.lowerBound(), intStamp.upperBound(), mask);
 }
コード例 #13
0
ファイル: StampTool.java プロジェクト: rjsingh/graal
 private static Stamp narrowingKindConvertion(IntegerStamp fromStamp, Kind toKind) {
   long mask = fromStamp.mask() & IntegerStamp.defaultMask(toKind);
   long lowerBound = saturate(fromStamp.lowerBound(), toKind);
   long upperBound = saturate(fromStamp.upperBound(), toKind);
   if (fromStamp.lowerBound() < toKind.getMinValue()) {
     upperBound = toKind.getMaxValue();
   }
   if (fromStamp.upperBound() > toKind.getMaxValue()) {
     lowerBound = toKind.getMinValue();
   }
   return StampFactory.forInteger(toKind.getStackKind(), lowerBound, upperBound, mask);
 }
コード例 #14
0
ファイル: StampTool.java プロジェクト: rjsingh/graal
 public static Stamp meet(Collection<? extends StampProvider> values) {
   Iterator<? extends StampProvider> iterator = values.iterator();
   if (iterator.hasNext()) {
     Stamp stamp = iterator.next().stamp();
     while (iterator.hasNext()) {
       stamp = stamp.meet(iterator.next().stamp());
     }
     return stamp;
   } else {
     return StampFactory.forVoid();
   }
 }
コード例 #15
0
ファイル: StampTool.java プロジェクト: rjsingh/graal
 public static Stamp leftShift(IntegerStamp value, IntegerStamp shift) {
   Kind kind = value.kind();
   int shiftBits = kind == Kind.Int ? 5 : 6;
   long shiftMask = kind == Kind.Int ? 0x1FL : 0x3FL;
   if ((shift.lowerBound() >>> shiftBits) == (shift.upperBound() >>> shiftBits)) {
     long mask = 0;
     for (long i = shift.lowerBound() & shiftMask; i <= (shift.upperBound() & shiftMask); i++) {
       mask |= value.mask() << i;
     }
     mask &= IntegerStamp.defaultMask(kind);
     return stampForMask(kind, mask);
   }
   return StampFactory.forKind(kind);
 }
コード例 #16
0
ファイル: StampTool.java プロジェクト: rjsingh/graal
 public static Stamp negate(Stamp stamp) {
   Kind kind = stamp.kind();
   if (stamp instanceof IntegerStamp) {
     IntegerStamp integerStamp = (IntegerStamp) stamp;
     if (integerStamp.lowerBound() != kind.getMinValue()) {
       // TODO(ls) check if the mask calculation is correct...
       return new IntegerStamp(
           kind,
           -integerStamp.upperBound(),
           -integerStamp.lowerBound(),
           IntegerStamp.defaultMask(kind) & (integerStamp.mask() | -integerStamp.mask()));
     }
   }
   return StampFactory.forKind(kind);
 }
コード例 #17
0
ファイル: StampTool.java プロジェクト: rjsingh/graal
 private static Stamp stampForMask(Kind kind, long mask, long alwaysSetBits) {
   long lowerBound;
   long upperBound;
   if (kind == Kind.Int && (mask & INTEGER_SIGN_BIT) != 0) {
     // the mask is negative
     lowerBound = Integer.MIN_VALUE;
     upperBound = mask ^ INTEGER_SIGN_BIT;
   } else if (kind == Kind.Long && (mask & LONG_SIGN_BIT) != 0) {
     // the mask is negative
     lowerBound = Long.MIN_VALUE;
     upperBound = mask ^ LONG_SIGN_BIT;
   } else {
     lowerBound = alwaysSetBits;
     upperBound = mask;
   }
   return StampFactory.forInteger(kind, lowerBound, upperBound, mask);
 }
コード例 #18
0
ファイル: StampTool.java プロジェクト: rjsingh/graal
 public static Stamp unsignedRightShift(IntegerStamp value, IntegerStamp shift) {
   Kind kind = value.kind();
   if (shift.lowerBound() == shift.upperBound()) {
     long shiftMask = kind == Kind.Int ? 0x1FL : 0x3FL;
     long shiftCount = shift.lowerBound() & shiftMask;
     if (shiftCount != 0) {
       long lowerBound;
       long upperBound;
       if (value.lowerBound() < 0) {
         lowerBound = 0;
         upperBound = IntegerStamp.defaultMask(kind) >>> shiftCount;
       } else {
         lowerBound = value.lowerBound() >>> shiftCount;
         upperBound = value.upperBound() >>> shiftCount;
       }
       long mask = value.mask() >>> shiftCount;
       return StampFactory.forInteger(kind, lowerBound, upperBound, mask);
     }
   }
   long mask = IntegerStamp.maskFor(kind, value.lowerBound(), value.upperBound());
   return stampForMask(kind, mask);
 }
コード例 #19
0
 @Test
 public void testJoinInterface0() {
   Stamp a = StampFactory.declared(getType(A.class));
   Stamp i = StampFactory.declaredTrusted(getType(I.class));
   Assert.assertNotSame(StampFactory.illegal(Kind.Object), join(a, i));
 }
コード例 #20
0
 @Test
 public void testJoin4() {
   Stamp dExactNonNull = StampFactory.exactNonNull(getType(D.class));
   Stamp c = StampFactory.declared(getType(C.class));
   Assert.assertEquals(StampFactory.illegal(Kind.Object), join(c, dExactNonNull));
 }
コード例 #21
0
 @Test
 public void testJoin3() {
   Stamp d = StampFactory.declared(getType(D.class));
   Stamp c = StampFactory.declared(getType(C.class));
   Assert.assertTrue(StampTool.isPointerAlwaysNull(join(c, d)));
 }
コード例 #22
0
 @Test
 public void testJoin2() {
   Stamp aExact = StampFactory.exactNonNull(getType(A.class));
   Stamp b = StampFactory.declared(getType(B.class));
   Assert.assertEquals(StampFactory.illegal(Kind.Object), join(aExact, b));
 }
コード例 #23
0
 @Test
 public void testJoin0() {
   Stamp a = StampFactory.declared(getType(A.class));
   Stamp b = StampFactory.declared(getType(B.class));
   Assert.assertEquals(b, join(a, b));
 }
コード例 #24
0
 protected AbstractDeoptimizeNode(
     NodeClass<? extends AbstractDeoptimizeNode> c, FrameState stateBefore) {
   super(c, StampFactory.forVoid());
   this.stateBefore = stateBefore;
 }
コード例 #25
0
ファイル: DirectReadNode.java プロジェクト: smarr/graal
 protected DirectReadNode(ValueNode address, Kind readKind) {
   super(StampFactory.forKind(readKind.getStackKind()));
   this.address = address;
   this.readKind = readKind;
 }