< prev index next >

src/hotspot/share/runtime/signature.cpp

Print this page

161       assert(is_java_type(_return_type), "return type must be a java type");
162       return;
163     }
164   }
165 
166   // Note:  This will always take the slow path, since _fp==zero_fp.
167   initialize_accumulator();
168   initialize_calling_convention(static_flag);
169   do_parameters_on(this);
170   assert(fp_is_valid_type(_return_type, true), "bad result type");
171 
172   // Fill in the return type and static bits:
173   _accumulator |= _return_type << fp_static_feature_size;
174   if (static_flag) {
175     _accumulator |= fp_is_static_bit;
176   } else {
177     _param_size += 1;  // this is the convention for Method::compute_size_of_parameters
178   }
179 
180 #if defined(_LP64) && !defined(ZERO)
181   _stack_arg_slots = align_up(_stack_arg_slots, 2);
182 #ifdef ASSERT
183   int dbg_stack_arg_slots = compute_num_stack_arg_slots(_signature, _param_size, static_flag);
184   assert(_stack_arg_slots == dbg_stack_arg_slots, "fingerprinter: %d full: %d", _stack_arg_slots, dbg_stack_arg_slots);
185 #endif
186 #else
187   // Fallback: computed _stack_arg_slots is unreliable, compute directly.
188   _stack_arg_slots = compute_num_stack_arg_slots(_signature, _param_size, static_flag);
189 #endif
190 
191   // Detect overflow.  (We counted _param_size correctly.)
192   if (_method == nullptr && _param_size > fp_max_size_of_parameters) {
193     // We did a one-pass computation of argument size, return type,
194     // and fingerprint.
195     _fingerprint = overflow_fingerprint();
196     return;
197   }
198 
199   assert(_shift_count < BitsPerLong,
200          "shift count overflow %d (%d vs. %d): %s",
201          _shift_count, _param_size, fp_max_size_of_parameters,

218   if (!static_flag) { // `this` takes up an int register
219     _int_args++;
220   }
221 }
222 
223 void Fingerprinter::do_type_calling_convention(BasicType type) {
224   // We compute the number of slots for stack-passed arguments in compiled calls.
225   // TODO: SharedRuntime::java_calling_convention is the shared code that knows all details
226   // about the platform-specific calling conventions. This method tries to compute the stack
227   // args number... poorly, at least for 32-bit ports and for zero. Current code has the fallback
228   // that recomputes the stack args number from SharedRuntime::java_calling_convention.
229 #if defined(_LP64) && !defined(ZERO)
230   switch (type) {
231   case T_VOID:
232     break;
233   case T_BOOLEAN:
234   case T_CHAR:
235   case T_BYTE:
236   case T_SHORT:
237   case T_INT:
238 #if defined(PPC64) || defined(S390)
239     if (_int_args < Argument::n_int_register_parameters_j) {
240       _int_args++;
241     } else {




242       _stack_arg_slots += 1;

243     }
244     break;
245 #endif // defined(PPC64) || defined(S390)
246   case T_LONG:
247   case T_OBJECT:
248   case T_ARRAY:
249   case T_ADDRESS:
250     if (_int_args < Argument::n_int_register_parameters_j) {
251       _int_args++;
252     } else {
253       PPC64_ONLY(_stack_arg_slots = align_up(_stack_arg_slots, 2));
254       S390_ONLY(_stack_arg_slots = align_up(_stack_arg_slots, 2));
255       _stack_arg_slots += 2;
256     }
257     break;
258   case T_FLOAT:
259 #if defined(PPC64) || defined(S390)
260     if (_fp_args < Argument::n_float_register_parameters_j) {
261       _fp_args++;
262     } else {




263       _stack_arg_slots += 1;

264     }
265     break;
266 #endif // defined(PPC64) || defined(S390)
267   case T_DOUBLE:
268     if (_fp_args < Argument::n_float_register_parameters_j) {
269       _fp_args++;
270     } else {
271       PPC64_ONLY(_stack_arg_slots = align_up(_stack_arg_slots, 2));
272       S390_ONLY(_stack_arg_slots = align_up(_stack_arg_slots, 2));
273       _stack_arg_slots += 2;
274     }
275     break;
276   default:
277     ShouldNotReachHere();
278     break;
279   }
280 #endif
281 }
282 
283 // Implementation of SignatureStream
284 
285 static inline BasicType decode_signature_char(int ch) {
286   switch (ch) {
287 #define EACH_SIG(ch, bt, ignore) \
288     case ch: return bt;
289     SIGNATURE_TYPES_DO(EACH_SIG, ignore)
290 #undef EACH_SIG
291   }
292   return (BasicType)0;

161       assert(is_java_type(_return_type), "return type must be a java type");
162       return;
163     }
164   }
165 
166   // Note:  This will always take the slow path, since _fp==zero_fp.
167   initialize_accumulator();
168   initialize_calling_convention(static_flag);
169   do_parameters_on(this);
170   assert(fp_is_valid_type(_return_type, true), "bad result type");
171 
172   // Fill in the return type and static bits:
173   _accumulator |= _return_type << fp_static_feature_size;
174   if (static_flag) {
175     _accumulator |= fp_is_static_bit;
176   } else {
177     _param_size += 1;  // this is the convention for Method::compute_size_of_parameters
178   }
179 
180 #if defined(_LP64) && !defined(ZERO)

181 #ifdef ASSERT
182   int dbg_stack_arg_slots = compute_num_stack_arg_slots(_signature, _param_size, static_flag);
183   assert(_stack_arg_slots == dbg_stack_arg_slots, "fingerprinter: %d full: %d", _stack_arg_slots, dbg_stack_arg_slots);
184 #endif
185 #else
186   // Fallback: computed _stack_arg_slots is unreliable, compute directly.
187   _stack_arg_slots = compute_num_stack_arg_slots(_signature, _param_size, static_flag);
188 #endif
189 
190   // Detect overflow.  (We counted _param_size correctly.)
191   if (_method == nullptr && _param_size > fp_max_size_of_parameters) {
192     // We did a one-pass computation of argument size, return type,
193     // and fingerprint.
194     _fingerprint = overflow_fingerprint();
195     return;
196   }
197 
198   assert(_shift_count < BitsPerLong,
199          "shift count overflow %d (%d vs. %d): %s",
200          _shift_count, _param_size, fp_max_size_of_parameters,

217   if (!static_flag) { // `this` takes up an int register
218     _int_args++;
219   }
220 }
221 
222 void Fingerprinter::do_type_calling_convention(BasicType type) {
223   // We compute the number of slots for stack-passed arguments in compiled calls.
224   // TODO: SharedRuntime::java_calling_convention is the shared code that knows all details
225   // about the platform-specific calling conventions. This method tries to compute the stack
226   // args number... poorly, at least for 32-bit ports and for zero. Current code has the fallback
227   // that recomputes the stack args number from SharedRuntime::java_calling_convention.
228 #if defined(_LP64) && !defined(ZERO)
229   switch (type) {
230   case T_VOID:
231     break;
232   case T_BOOLEAN:
233   case T_CHAR:
234   case T_BYTE:
235   case T_SHORT:
236   case T_INT:

237     if (_int_args < Argument::n_int_register_parameters_j) {
238       _int_args++;
239     } else {
240 #if defined(PPC64) || defined(S390)
241       _stack_arg_slots += 1;
242 #else
243       _stack_arg_slots = align_up(_stack_arg_slots, 2);
244       _stack_arg_slots += 1;
245 #endif // defined(PPC64) || defined(S390)
246     }
247     break;

248   case T_LONG:
249   case T_OBJECT:
250   case T_ARRAY:
251   case T_ADDRESS:
252     if (_int_args < Argument::n_int_register_parameters_j) {
253       _int_args++;
254     } else {
255       _stack_arg_slots = align_up(_stack_arg_slots, 2);

256       _stack_arg_slots += 2;
257     }
258     break;
259   case T_FLOAT:

260     if (_fp_args < Argument::n_float_register_parameters_j) {
261       _fp_args++;
262     } else {
263 #if defined(PPC64) || defined(S390)
264       _stack_arg_slots += 1;
265 #else
266       _stack_arg_slots = align_up(_stack_arg_slots, 2);
267       _stack_arg_slots += 1;
268 #endif // defined(PPC64) || defined(S390)
269     }
270     break;

271   case T_DOUBLE:
272     if (_fp_args < Argument::n_float_register_parameters_j) {
273       _fp_args++;
274     } else {
275       _stack_arg_slots = align_up(_stack_arg_slots, 2);

276       _stack_arg_slots += 2;
277     }
278     break;
279   default:
280     ShouldNotReachHere();
281     break;
282   }
283 #endif
284 }
285 
286 // Implementation of SignatureStream
287 
288 static inline BasicType decode_signature_char(int ch) {
289   switch (ch) {
290 #define EACH_SIG(ch, bt, ignore) \
291     case ch: return bt;
292     SIGNATURE_TYPES_DO(EACH_SIG, ignore)
293 #undef EACH_SIG
294   }
295   return (BasicType)0;
< prev index next >