@@ -52,7 +52,10 @@ public static CallSite subcall(Lookup caller, String _, MethodType type, String
52
52
/* Create a mutable callsite, and curry the resolver with it and
53
53
* the sub name. */
54
54
MutableCallSite cs = new MutableCallSite (type );
55
- cs .setTarget (MethodHandles .insertArguments (res , 0 , caller , cs , name , csIdx ));
55
+ cs .setTarget (MethodHandles
56
+ .insertArguments (res , 0 , caller , cs , name , csIdx )
57
+ .asCollector (Object [].class , type .parameterCount () - 1 )
58
+ .asType (type ));
56
59
57
60
/* Produce callsite; it'll be updated with the resolved call upon the
58
61
* first invocation. */
@@ -63,7 +66,7 @@ public static CallSite subcall(Lookup caller, String _, MethodType type, String
63
66
}
64
67
}
65
68
66
- public static void subcallResolve (Lookup caller , MutableCallSite cs , String name , int csIdx , ThreadContext tc , Object [] args ) {
69
+ public static void subcallResolve (Lookup caller , MutableCallSite cs , String name , int csIdx , ThreadContext tc , Object ... args ) {
67
70
/* Locate the thing to call. */
68
71
SixModelObject invokee = Ops .getlex (name , tc );
69
72
@@ -84,7 +87,7 @@ public static void subcallResolve(Lookup caller, MutableCallSite cs, String name
84
87
try {
85
88
cs .setTarget (caller
86
89
.findStatic (IndyBootstrap .class , "lexotic_o" ,
87
- MethodType .methodType (long .class , ThreadContext .class , Object [] .class ))
90
+ MethodType .methodType (long .class , ThreadContext .class , SixModelObject .class ))
88
91
.bindTo (throwee .target ));
89
92
}
90
93
catch (Exception e ) {
@@ -97,7 +100,7 @@ public static void subcallResolve(Lookup caller, MutableCallSite cs, String name
97
100
try {
98
101
cs .setTarget (MethodHandles .insertArguments (
99
102
caller .findStatic (IndyBootstrap .class , "lexotic_i" ,
100
- MethodType .methodType (long .class , ThreadContext .class , Object [] .class )),
103
+ MethodType .methodType (long .class , ThreadContext .class , long .class )),
101
104
0 , throwee .target , intBoxType ));
102
105
}
103
106
catch (Exception e ) {
@@ -110,7 +113,7 @@ public static void subcallResolve(Lookup caller, MutableCallSite cs, String name
110
113
try {
111
114
cs .setTarget (MethodHandles .insertArguments (
112
115
caller .findStatic (IndyBootstrap .class , "lexotic_n" ,
113
- MethodType .methodType (long .class , ThreadContext .class , Object [] .class )),
116
+ MethodType .methodType (long .class , ThreadContext .class , double .class )),
114
117
0 , throwee .target , numBoxType ));
115
118
}
116
119
catch (Exception e ) {
@@ -123,7 +126,7 @@ public static void subcallResolve(Lookup caller, MutableCallSite cs, String name
123
126
try {
124
127
cs .setTarget (MethodHandles .insertArguments (
125
128
caller .findStatic (IndyBootstrap .class , "lexotic_s" ,
126
- MethodType .methodType (long .class , ThreadContext .class , Object [] .class )),
129
+ MethodType .methodType (long .class , ThreadContext .class , String .class )),
127
130
0 , throwee .target , strBoxType ));
128
131
}
129
132
catch (Exception e ) {
@@ -153,7 +156,10 @@ public static void subcallResolve(Lookup caller, MutableCallSite cs, String name
153
156
154
157
/* Now need to adapt to the target callsite by binding the CodeRef
155
158
* and callsite with what they've been resolved to. */
156
- cs .setTarget (MethodHandles .insertArguments (cr .staticInfo .mh , 1 , cr , csd ));
159
+ cs .setTarget (MethodHandles
160
+ .insertArguments (cr .staticInfo .mh , 1 , cr , csd )
161
+ .asVarargsCollector (Object [].class )
162
+ .asType (cs .getTarget ().type ()));
157
163
158
164
/* Make the sub call directly for this initial call. */
159
165
try {
@@ -167,31 +173,31 @@ public static void subcallResolve(Lookup caller, MutableCallSite cs, String name
167
173
}
168
174
}
169
175
170
- public static void lexotic_o (long target , ThreadContext tc , Object [] args ) {
176
+ public static void lexotic_o (long target , ThreadContext tc , SixModelObject arg ) {
171
177
LexoticException throwee = tc .theLexotic ;
172
178
throwee .target = target ;
173
- throwee .payload = ( SixModelObject ) args [ 0 ] ;
179
+ throwee .payload = arg ;
174
180
throw throwee ;
175
181
}
176
182
177
- public static void lexotic_i (long target , SixModelObject boxType , ThreadContext tc , Object [] args ) {
183
+ public static void lexotic_i (long target , SixModelObject boxType , ThreadContext tc , long arg ) {
178
184
LexoticException throwee = tc .theLexotic ;
179
185
throwee .target = target ;
180
- throwee .payload = Ops .box_i (( long ) args [ 0 ] , boxType , tc );
186
+ throwee .payload = Ops .box_i (arg , boxType , tc );
181
187
throw throwee ;
182
188
}
183
189
184
- public static void lexotic_n (long target , SixModelObject boxType , ThreadContext tc , Object [] args ) {
190
+ public static void lexotic_n (long target , SixModelObject boxType , ThreadContext tc , double arg ) {
185
191
LexoticException throwee = tc .theLexotic ;
186
192
throwee .target = target ;
187
- throwee .payload = Ops .box_n (( double ) args [ 0 ] , boxType , tc );
193
+ throwee .payload = Ops .box_n (arg , boxType , tc );
188
194
throw throwee ;
189
195
}
190
196
191
- public static void lexotic_s (long target , SixModelObject boxType , ThreadContext tc , Object [] args ) {
197
+ public static void lexotic_s (long target , SixModelObject boxType , ThreadContext tc , String arg ) {
192
198
LexoticException throwee = tc .theLexotic ;
193
199
throwee .target = target ;
194
- throwee .payload = Ops .box_s (( String ) args [ 0 ] , boxType , tc );
200
+ throwee .payload = Ops .box_s (arg , boxType , tc );
195
201
throw throwee ;
196
202
}
197
203
}
0 commit comments