@@ -12,6 +12,7 @@ public class ArgsExpectation {
12
12
public static final short USE_BINDER = 0 ;
13
13
public static final short NO_ARGS = 1 ;
14
14
public static final short OBJ = 2 ;
15
+ public static final short OBJ_OBJ = 3 ;
15
16
16
17
public static void invokeByExpectation (ThreadContext tc , CodeRef cr ,
17
18
CallSiteDescriptor csd , Object [] args ) throws Throwable {
@@ -72,6 +73,67 @@ public static void invokeByExpectation(ThreadContext tc, CodeRef cr,
72
73
}
73
74
}
74
75
break ;
76
+ case ArgsExpectation .OBJ_OBJ :
77
+ if (csd .argFlags .length == 2 && csd .argFlags [0 ] == CallSiteDescriptor .ARG_OBJ
78
+ && csd .argFlags [1 ] == CallSiteDescriptor .ARG_OBJ ) {
79
+ /* Simple, common case. */
80
+ cr .staticInfo .mh .invokeExact (tc , cr , csd ,
81
+ (SixModelObject )args [0 ], (SixModelObject )args [1 ]);
82
+ }
83
+ else {
84
+ /* Flatten if needed. */
85
+ if (csd .hasFlattening ) {
86
+ csd = csd .explodeFlattening (tc .curFrame , args );
87
+ args = tc .flatArgs ;
88
+ }
89
+ if (csd .argFlags .length == 2 ) {
90
+ SixModelObject arg1 = null ;
91
+ SixModelObject arg2 = null ;
92
+ switch (csd .argFlags [0 ]) {
93
+ case CallSiteDescriptor .ARG_OBJ :
94
+ arg1 = (SixModelObject )args [0 ];
95
+ break ;
96
+ case CallSiteDescriptor .ARG_INT :
97
+ arg1 = Ops .box_i ((long )args [0 ], cr .staticInfo .compUnit .hllConfig .intBoxType , tc );
98
+ break ;
99
+ case CallSiteDescriptor .ARG_NUM :
100
+ arg1 = Ops .box_n ((double )args [0 ], cr .staticInfo .compUnit .hllConfig .numBoxType , tc );
101
+ break ;
102
+ case CallSiteDescriptor .ARG_STR :
103
+ arg1 = Ops .box_s ((String )args [0 ], cr .staticInfo .compUnit .hllConfig .strBoxType , tc );
104
+ break ;
105
+ default :
106
+ ExceptionHandling .dieInternal (tc ,
107
+ "Wrong number of arguments passed; expected 2..2, but got " +
108
+ csd .numPositionals );
109
+ }
110
+ switch (csd .argFlags [1 ]) {
111
+ case CallSiteDescriptor .ARG_OBJ :
112
+ arg2 = (SixModelObject )args [1 ];
113
+ break ;
114
+ case CallSiteDescriptor .ARG_INT :
115
+ arg2 = Ops .box_i ((long )args [1 ], cr .staticInfo .compUnit .hllConfig .intBoxType , tc );
116
+ break ;
117
+ case CallSiteDescriptor .ARG_NUM :
118
+ arg2 = Ops .box_n ((double )args [1 ], cr .staticInfo .compUnit .hllConfig .numBoxType , tc );
119
+ break ;
120
+ case CallSiteDescriptor .ARG_STR :
121
+ arg2 = Ops .box_s ((String )args [1 ], cr .staticInfo .compUnit .hllConfig .strBoxType , tc );
122
+ break ;
123
+ default :
124
+ ExceptionHandling .dieInternal (tc ,
125
+ "Wrong number of arguments passed; expected 2..2, but got " +
126
+ csd .numPositionals );
127
+ }
128
+ cr .staticInfo .mh .invokeExact (tc , cr , csd , arg1 , arg2 );
129
+ }
130
+ else {
131
+ ExceptionHandling .dieInternal (tc ,
132
+ "Wrong number of arguments passed; expected 2..2, but got " +
133
+ csd .numPositionals );
134
+ }
135
+ }
136
+ break ;
75
137
default :
76
138
ExceptionHandling .dieInternal (tc , "Unknown Argument Expectation in invoke" );
77
139
}
0 commit comments