2222 */
2323package com .oracle .truffle .espresso .runtime .dispatch .staticobject ;
2424
25+ import com .oracle .truffle .api .dsl .Bind ;
2526import com .oracle .truffle .api .dsl .Cached ;
2627import com .oracle .truffle .api .dsl .Cached .Exclusive ;
2728import com .oracle .truffle .api .dsl .GenerateUncached ;
2829import com .oracle .truffle .api .dsl .Specialization ;
2930import com .oracle .truffle .api .interop .ArityException ;
3031import com .oracle .truffle .api .interop .UnknownIdentifierException ;
3132import com .oracle .truffle .api .interop .UnsupportedTypeException ;
33+ import com .oracle .truffle .api .nodes .Node ;
3234import com .oracle .truffle .api .profiles .InlinedBranchProfile ;
3335import com .oracle .truffle .espresso .impl .Klass ;
3436import com .oracle .truffle .espresso .impl .Method ;
@@ -71,7 +73,8 @@ public abstract Object execute(StaticObject receiver, Klass klass, Object[] argu
7173 @ GenerateUncached
7274 public abstract static class Virtual extends InteropLookupAndInvoke {
7375 @ Specialization
74- public Object doVirtual (StaticObject receiver , Klass klass , Object [] arguments , String member ,
76+ Object doVirtual (StaticObject receiver , Klass klass , Object [] arguments , String member ,
77+ @ Bind Node node ,
7578 @ Cached LookupVirtualMethodNode lookup ,
7679 @ Cached SelectAndInvokeNode selectAndInvoke ,
7780 @ Cached InlinedBranchProfile error ,
@@ -80,17 +83,18 @@ public Object doVirtual(StaticObject receiver, Klass klass, Object[] arguments,
8083 assert receiver != null ;
8184 Method [] candidates = lookup .execute (klass , member , arguments .length );
8285 if (candidates != null ) {
83- return selectAndInvoke (selectAndInvoke , exception , receiver , arguments , candidates );
86+ return selectAndInvoke (selectAndInvoke , exception , node , receiver , arguments , candidates );
8487 }
85- error .enter (this );
88+ error .enter (node );
8689 throw ArityException .create (arguments .length + 1 , -1 , arguments .length );
8790 }
8891 }
8992
9093 @ GenerateUncached
9194 public abstract static class NonVirtual extends InteropLookupAndInvoke {
9295 @ Specialization
93- public Object doNonVirtual (StaticObject receiver , Klass klass , Object [] arguments , String member ,
96+ Object doNonVirtual (StaticObject receiver , Klass klass , Object [] arguments , String member ,
97+ @ Bind Node node ,
9498 @ Cached LookupDeclaredMethod lookup ,
9599 @ Cached SelectAndInvokeNode selectAndInvoke ,
96100 @ Cached InlinedBranchProfile error ,
@@ -99,19 +103,20 @@ public Object doNonVirtual(StaticObject receiver, Klass klass, Object[] argument
99103 boolean isStatic = receiver == null ;
100104 Method [] candidates = lookup .execute (klass , member , true , isStatic , arguments .length );
101105 if (candidates != null ) {
102- return selectAndInvoke (selectAndInvoke , exception , receiver , arguments , candidates );
106+ return selectAndInvoke (selectAndInvoke , exception , node , receiver , arguments , candidates );
103107 }
104- error .enter (this );
108+ error .enter (node );
105109 throw ArityException .create (arguments .length + 1 , -1 , arguments .length );
106110 }
107111 }
108112
109- Object selectAndInvoke (SelectAndInvokeNode selectAndInvoke , InlinedBranchProfile exception ,
113+ Object selectAndInvoke (SelectAndInvokeNode selectAndInvoke ,
114+ InlinedBranchProfile exception , Node node ,
110115 StaticObject receiver , Object [] args , Method [] candidates ) throws UnsupportedTypeException , ArityException {
111116 try {
112117 return selectAndInvoke .execute (receiver , args , candidates );
113118 } catch (EspressoException e ) {
114- exception .enter (this );
119+ exception .enter (node );
115120 throw InteropUtils .unwrapExceptionBoundary (getLanguage (), e , getMeta ());
116121 }
117122 }
@@ -121,7 +126,7 @@ abstract static class SelectAndInvokeNode extends EspressoNode {
121126 public abstract Object execute (StaticObject receiver , Object [] args , Method [] candidates ) throws ArityException , UnsupportedTypeException ;
122127
123128 @ Specialization (guards = {"isSingleNonVarargs(candidates)" })
124- Object doSingleNonVarargs (StaticObject receiver , Object [] args , Method [] candidates ,
129+ static Object doSingleNonVarargs (StaticObject receiver , Object [] args , Method [] candidates ,
125130 @ Cached @ Exclusive InvokeEspressoNode invoke ,
126131 @ Cached InteropUnwrapNode unwrapNode )
127132 throws ArityException , UnsupportedTypeException {
@@ -133,7 +138,8 @@ Object doSingleNonVarargs(StaticObject receiver, Object[] args, Method[] candida
133138 }
134139
135140 @ Specialization (guards = {"isSingleVarargs(candidates)" })
136- Object doSingleVarargs (StaticObject receiver , Object [] args , Method [] candidates ,
141+ static Object doSingleVarargs (StaticObject receiver , Object [] args , Method [] candidates ,
142+ @ Bind Node node ,
137143 @ Cached @ Exclusive InvokeEspressoNode invoke ,
138144 @ Cached ToEspressoNode .DynamicToEspresso toEspresso ,
139145 @ Cached InteropUnwrapNode unwrapNode ,
@@ -148,12 +154,13 @@ Object doSingleVarargs(StaticObject receiver, Object[] args, Method[] candidates
148154 assert matched != null ;
149155 return invoke .execute (matched .getMethod (), receiver , matched .getConvertedArgs (), true , unwrapNode );
150156 }
151- error .enter (this );
157+ error .enter (node );
152158 throw UnsupportedTypeException .create (args );
153159 }
154160
155161 @ Specialization (guards = {"isMulti(candidates)" })
156- Object doMulti (StaticObject receiver , Object [] args , Method [] candidates ,
162+ static Object doMulti (StaticObject receiver , Object [] args , Method [] candidates ,
163+ @ Bind Node node ,
157164 @ Cached OverLoadedMethodSelectorNode selector ,
158165 @ Cached @ Exclusive InvokeEspressoNode invoke ,
159166 @ Cached InteropUnwrapNode unwrapNode ,
@@ -165,7 +172,7 @@ Object doMulti(StaticObject receiver, Object[] args, Method[] candidates,
165172 return invoke .execute (typeMatched .getMethod (), receiver , typeMatched .getConvertedArgs (), true , unwrapNode );
166173 } else {
167174 // unable to select exactly one best candidate for the input args!
168- error .enter (this );
175+ error .enter (node );
169176 throw UnsupportedTypeException .create (args );
170177 }
171178 }
0 commit comments