59
59
public class TestMethodBinding extends CodeInstallationTest {
60
60
61
61
62
- interface MethodProviderInterface {
63
- int invokeInterface ();
64
- }
65
-
66
- static abstract class AbstractMethodProvider implements MethodProviderInterface {
67
- public int invokeVirtual () {
68
- return 5 + 6 ;
69
- }
70
- }
71
-
72
- static class MethodProvider extends AbstractMethodProvider {
73
- @ Override
74
- public int invokeInterface () {
75
- return 3 + 4 ;
76
- }
77
-
62
+ static class MethodProvider {
78
63
public static int invokeStatic () {
79
64
return 1 + 2 ;
80
65
}
@@ -83,19 +68,10 @@ public static int invokeStatic() {
83
68
@ Test
84
69
public void test () {
85
70
Class <?> returnType = int .class ;
86
- Object receiver = new MethodProvider ();
87
71
Class <?>[] staticArgumentTypes = new Class <?>[]{};
88
- Class <?>[] interfaceArgumentTypes = new Class <?>[]{MethodProviderInterface .class };
89
- Class <?>[] virtualArgumentTypes = new Class <?>[]{AbstractMethodProvider .class };
90
72
Object [] staticArguments = new Object []{};
91
- Object [] interfaceArguments = new Object []{receiver };
92
- Object [] virtualArguments = interfaceArguments ;
93
-
94
73
95
- test (getMethod (MethodProvider .class , "invokeInterface" ), returnType , interfaceArgumentTypes , virtualArguments , config .MARKID_INVOKEINTERFACE );
96
74
test (getMethod (MethodProvider .class , "invokeStatic" ), returnType , staticArgumentTypes , staticArguments , config .MARKID_INVOKESTATIC );
97
- test (getMethod (AbstractMethodProvider .class , "invokeVirtual" ), returnType , virtualArgumentTypes , virtualArguments , config .MARKID_INVOKEVIRTUAL );
98
- test (getMethod (MethodProvider .class , "invokeInterface" ), returnType , virtualArgumentTypes , virtualArguments , config .MARKID_INVOKESPECIAL );
99
75
}
100
76
101
77
@@ -120,6 +96,8 @@ public void test(Method method, Class<?> returnClazz, Class<?>[] types, Object[]
120
96
121
97
asm .recordMark (markId );
122
98
int [] pos = new int [2 ];
99
+ // duringCall has to be false to trigger our bind logic in SharedRuntime::find_callee_info_helper
100
+ // we are allowed to do this because the call has no side-effect
123
101
BytecodeFrame frame = new BytecodeFrame (null , resolvedMethod , 0 , false , false , new JavaValue [0 ], new JavaKind [0 ], 0 , 0 , 0 );
124
102
DebugInfo info = new DebugInfo (frame , new VirtualObject [0 ]);
125
103
if (resolvedMethod .isStatic ()) {
0 commit comments