116 // compute the size of the arguments first. The signature array
117 // that java_calling_convention takes includes a T_VOID after double
118 // work items but our signatures do not.
119 int i;
120 int sizeargs = 0;
121 for (i = 0; i < signature->length(); i++) {
122 sizeargs += type2size[signature->at(i)];
123 }
124
125 BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, sizeargs);
126 VMRegPair* regs = NEW_RESOURCE_ARRAY(VMRegPair, sizeargs);
127 int sig_index = 0;
128 for (i = 0; i < sizeargs; i++, sig_index++) {
129 sig_bt[i] = signature->at(sig_index);
130 if (sig_bt[i] == T_LONG || sig_bt[i] == T_DOUBLE) {
131 sig_bt[i + 1] = T_VOID;
132 i++;
133 }
134 }
135
136 intptr_t out_preserve = SharedRuntime::c_calling_convention(sig_bt, regs, sizeargs);
137 LIR_OprList* args = new LIR_OprList(signature->length());
138 for (i = 0; i < sizeargs;) {
139 BasicType t = sig_bt[i];
140 assert(t != T_VOID, "should be skipping these");
141
142 // C calls are always outgoing
143 bool outgoing = true;
144 LIR_Opr opr = map_to_opr(t, regs + i, outgoing);
145 // they might be of different types if for instance floating point
146 // values are passed in cpu registers, but the sizes must match.
147 assert(type2size[opr->type()] == type2size[t], "type mismatch");
148 args->append(opr);
149 if (opr->is_address()) {
150 LIR_Address* addr = opr->as_address_ptr();
151 out_preserve = MAX2(out_preserve, (intptr_t)(addr->disp() - STACK_BIAS) / 4);
152 }
153 i += type2size[t];
154 }
155 assert(args->length() == signature->length(), "size mismatch");
156 out_preserve += SharedRuntime::out_preserve_stack_slots();
|
116 // compute the size of the arguments first. The signature array
117 // that java_calling_convention takes includes a T_VOID after double
118 // work items but our signatures do not.
119 int i;
120 int sizeargs = 0;
121 for (i = 0; i < signature->length(); i++) {
122 sizeargs += type2size[signature->at(i)];
123 }
124
125 BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, sizeargs);
126 VMRegPair* regs = NEW_RESOURCE_ARRAY(VMRegPair, sizeargs);
127 int sig_index = 0;
128 for (i = 0; i < sizeargs; i++, sig_index++) {
129 sig_bt[i] = signature->at(sig_index);
130 if (sig_bt[i] == T_LONG || sig_bt[i] == T_DOUBLE) {
131 sig_bt[i + 1] = T_VOID;
132 i++;
133 }
134 }
135
136 intptr_t out_preserve = SharedRuntime::c_calling_convention(sig_bt, regs, NULL, sizeargs);
137 LIR_OprList* args = new LIR_OprList(signature->length());
138 for (i = 0; i < sizeargs;) {
139 BasicType t = sig_bt[i];
140 assert(t != T_VOID, "should be skipping these");
141
142 // C calls are always outgoing
143 bool outgoing = true;
144 LIR_Opr opr = map_to_opr(t, regs + i, outgoing);
145 // they might be of different types if for instance floating point
146 // values are passed in cpu registers, but the sizes must match.
147 assert(type2size[opr->type()] == type2size[t], "type mismatch");
148 args->append(opr);
149 if (opr->is_address()) {
150 LIR_Address* addr = opr->as_address_ptr();
151 out_preserve = MAX2(out_preserve, (intptr_t)(addr->disp() - STACK_BIAS) / 4);
152 }
153 i += type2size[t];
154 }
155 assert(args->length() == signature->length(), "size mismatch");
156 out_preserve += SharedRuntime::out_preserve_stack_slots();
|