127 b.add(new OpaqueNode(res)); 128 b.push(JavaKind.Int, res); 129 return true; 130 } 131 }); 132 super.registerInvocationPlugins(invocationPlugins); 133 } 134 135 public static int referenceMakeSuperAge() { 136 return 11; 137 } 138 139 public static int referenceMakePersonAge() { 140 return 42; 141 } 142 143 @Test 144 public void test01() { 145 Super inheritsHC = new Super(); 146 Person overridesHC = new Person(0); 147 test("getSuperAge", inheritsHC); 148 test("getSuperAge", overridesHC); 149 150 // Check that the virtual dispatch test exists after bytecode parsing 151 Assert.assertEquals(1, parsedForCompile.getNodes().filter(LoadMethodNode.class).count()); 152 Assert.assertEquals(1, parsedForCompile.getNodes().filter(LoadHubNode.class).count()); 153 154 // Check for the marker node indicating the intrinsic was applied 155 Assert.assertEquals(1, parsedForCompile.getNodes().filter(OpaqueNode.class).count()); 156 157 // Final graph should have a single invoke 158 List<Node> invokes = graph.getNodes().filter(n -> n instanceof Invoke).snapshot(); 159 Assert.assertEquals(invokes.toString(), 1, invokes.size()); 160 } 161 162 @Test 163 public void test02() { 164 test("getPersonAge", new Person(0)); 165 166 // Check that the virtual dispatch test does not exist after bytecode parsing | 127 b.add(new OpaqueNode(res)); 128 b.push(JavaKind.Int, res); 129 return true; 130 } 131 }); 132 super.registerInvocationPlugins(invocationPlugins); 133 } 134 135 public static int referenceMakeSuperAge() { 136 return 11; 137 } 138 139 public static int referenceMakePersonAge() { 140 return 42; 141 } 142 143 @Test 144 public void test01() { 145 Super inheritsHC = new Super(); 146 Person overridesHC = new Person(0); 147 148 // Ensure the profile for getSuperAge includes both receiver types 149 getSuperAge(inheritsHC); 150 getSuperAge(overridesHC); 151 152 test("getSuperAge", inheritsHC); 153 test("getSuperAge", overridesHC); 154 155 // Check that the virtual dispatch test exists after bytecode parsing 156 Assert.assertEquals(1, parsedForCompile.getNodes().filter(LoadMethodNode.class).count()); 157 Assert.assertEquals(1, parsedForCompile.getNodes().filter(LoadHubNode.class).count()); 158 159 // Check for the marker node indicating the intrinsic was applied 160 Assert.assertEquals(1, parsedForCompile.getNodes().filter(OpaqueNode.class).count()); 161 162 // Final graph should have a single invoke 163 List<Node> invokes = graph.getNodes().filter(n -> n instanceof Invoke).snapshot(); 164 Assert.assertEquals(invokes.toString(), 1, invokes.size()); 165 } 166 167 @Test 168 public void test02() { 169 test("getPersonAge", new Person(0)); 170 171 // Check that the virtual dispatch test does not exist after bytecode parsing |