@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());
 }
 @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));
 }
 @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));
 }
 @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));
 }
Пример #5
0
  protected InstalledCode assembleMethod(Method m, CodeGenTest test) {
    ResolvedJavaMethod method = codeCache.lookupJavaMethod(m);
    RegisterConfig registerConfig = codeCache.lookupRegisterConfig();
    CallingConvention cc =
        CodeUtil.getCallingConvention(codeCache, CallingConvention.Type.JavaCallee, method, false);

    CompilationResult compResult = new CompilationResult();
    Buffer codeBuffer = test.generateCode(compResult, codeCache.getTarget(), registerConfig, cc);
    compResult.setTargetCode(codeBuffer.close(true), codeBuffer.position());

    InstalledCode code = codeCache.addMethod(method, compResult);

    DisassemblerProvider dis = Graal.getRuntime().getCapability(DisassemblerProvider.class);
    if (dis != null) {
      String disasm = dis.disassemble(code);
      Assert.assertTrue(code.toString(), disasm == null || disasm.length() > 0);
    }
    return code;
  }
 @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)));
 }