1 /* |
1 /* |
2 * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. |
2 * Copyright 2003-2010 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
291 intptr_t* _to; |
291 intptr_t* _to; |
292 intptr_t* _reg_args; |
292 intptr_t* _reg_args; |
293 intptr_t* _fp_identifiers; |
293 intptr_t* _fp_identifiers; |
294 unsigned int _num_args; |
294 unsigned int _num_args; |
295 |
295 |
296 #ifdef ASSERT |
|
297 void verify_tag(frame::Tag t) { |
|
298 assert(!TaggedStackInterpreter || |
|
299 *(intptr_t*)(_from+Interpreter::local_tag_offset_in_bytes(0)) == t, "wrong tag"); |
|
300 } |
|
301 #endif // ASSERT |
|
302 |
|
303 virtual void pass_int() |
296 virtual void pass_int() |
304 { |
297 { |
305 jint from_obj = *(jint *)(_from+Interpreter::local_offset_in_bytes(0)); |
298 jint from_obj = *(jint *)(_from+Interpreter::local_offset_in_bytes(0)); |
306 debug_only(verify_tag(frame::TagValue)); |
299 _from -= Interpreter::stackElementSize; |
307 _from -= Interpreter::stackElementSize(); |
|
308 |
300 |
309 if (_num_args < Argument::n_int_register_parameters_c-1) { |
301 if (_num_args < Argument::n_int_register_parameters_c-1) { |
310 *_reg_args++ = from_obj; |
302 *_reg_args++ = from_obj; |
311 _num_args++; |
303 _num_args++; |
312 } else { |
304 } else { |
315 } |
307 } |
316 |
308 |
317 virtual void pass_long() |
309 virtual void pass_long() |
318 { |
310 { |
319 intptr_t from_obj = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1)); |
311 intptr_t from_obj = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1)); |
320 debug_only(verify_tag(frame::TagValue)); |
312 _from -= 2*Interpreter::stackElementSize; |
321 _from -= 2*Interpreter::stackElementSize(); |
|
322 |
313 |
323 if (_num_args < Argument::n_int_register_parameters_c-1) { |
314 if (_num_args < Argument::n_int_register_parameters_c-1) { |
324 *_reg_args++ = from_obj; |
315 *_reg_args++ = from_obj; |
325 _num_args++; |
316 _num_args++; |
326 } else { |
317 } else { |
329 } |
320 } |
330 |
321 |
331 virtual void pass_object() |
322 virtual void pass_object() |
332 { |
323 { |
333 intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0)); |
324 intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0)); |
334 debug_only(verify_tag(frame::TagReference)); |
325 _from -= Interpreter::stackElementSize; |
335 _from -= Interpreter::stackElementSize(); |
|
336 if (_num_args < Argument::n_int_register_parameters_c-1) { |
326 if (_num_args < Argument::n_int_register_parameters_c-1) { |
337 *_reg_args++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr; |
327 *_reg_args++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr; |
338 _num_args++; |
328 _num_args++; |
339 } else { |
329 } else { |
340 *_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr; |
330 *_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr; |
342 } |
332 } |
343 |
333 |
344 virtual void pass_float() |
334 virtual void pass_float() |
345 { |
335 { |
346 jint from_obj = *(jint *)(_from+Interpreter::local_offset_in_bytes(0)); |
336 jint from_obj = *(jint *)(_from+Interpreter::local_offset_in_bytes(0)); |
347 debug_only(verify_tag(frame::TagValue)); |
337 _from -= Interpreter::stackElementSize; |
348 _from -= Interpreter::stackElementSize(); |
|
349 |
338 |
350 if (_num_args < Argument::n_float_register_parameters_c-1) { |
339 if (_num_args < Argument::n_float_register_parameters_c-1) { |
351 *_reg_args++ = from_obj; |
340 *_reg_args++ = from_obj; |
352 *_fp_identifiers |= (intptr_t)(0x01 << (_num_args*2)); // mark as float |
341 *_fp_identifiers |= (intptr_t)(0x01 << (_num_args*2)); // mark as float |
353 _num_args++; |
342 _num_args++; |
357 } |
346 } |
358 |
347 |
359 virtual void pass_double() |
348 virtual void pass_double() |
360 { |
349 { |
361 intptr_t from_obj = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1)); |
350 intptr_t from_obj = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1)); |
362 debug_only(verify_tag(frame::TagValue)); |
351 _from -= 2*Interpreter::stackElementSize; |
363 _from -= 2*Interpreter::stackElementSize(); |
|
364 |
352 |
365 if (_num_args < Argument::n_float_register_parameters_c-1) { |
353 if (_num_args < Argument::n_float_register_parameters_c-1) { |
366 *_reg_args++ = from_obj; |
354 *_reg_args++ = from_obj; |
367 *_fp_identifiers |= (intptr_t)(0x3 << (_num_args*2)); // mark as double |
355 *_fp_identifiers |= (intptr_t)(0x3 << (_num_args*2)); // mark as double |
368 _num_args++; |
356 _num_args++; |
395 intptr_t* _fp_args; |
383 intptr_t* _fp_args; |
396 intptr_t* _fp_identifiers; |
384 intptr_t* _fp_identifiers; |
397 unsigned int _num_int_args; |
385 unsigned int _num_int_args; |
398 unsigned int _num_fp_args; |
386 unsigned int _num_fp_args; |
399 |
387 |
400 #ifdef ASSERT |
|
401 void verify_tag(frame::Tag t) { |
|
402 assert(!TaggedStackInterpreter || |
|
403 *(intptr_t*)(_from+Interpreter::local_tag_offset_in_bytes(0)) == t, "wrong tag"); |
|
404 } |
|
405 #endif // ASSERT |
|
406 |
|
407 virtual void pass_int() |
388 virtual void pass_int() |
408 { |
389 { |
409 jint from_obj = *(jint *)(_from+Interpreter::local_offset_in_bytes(0)); |
390 jint from_obj = *(jint *)(_from+Interpreter::local_offset_in_bytes(0)); |
410 debug_only(verify_tag(frame::TagValue)); |
391 _from -= Interpreter::stackElementSize; |
411 _from -= Interpreter::stackElementSize(); |
|
412 |
392 |
413 if (_num_int_args < Argument::n_int_register_parameters_c-1) { |
393 if (_num_int_args < Argument::n_int_register_parameters_c-1) { |
414 *_int_args++ = from_obj; |
394 *_int_args++ = from_obj; |
415 _num_int_args++; |
395 _num_int_args++; |
416 } else { |
396 } else { |
419 } |
399 } |
420 |
400 |
421 virtual void pass_long() |
401 virtual void pass_long() |
422 { |
402 { |
423 intptr_t from_obj = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1)); |
403 intptr_t from_obj = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1)); |
424 debug_only(verify_tag(frame::TagValue)); |
404 _from -= 2*Interpreter::stackElementSize; |
425 _from -= 2*Interpreter::stackElementSize(); |
|
426 |
405 |
427 if (_num_int_args < Argument::n_int_register_parameters_c-1) { |
406 if (_num_int_args < Argument::n_int_register_parameters_c-1) { |
428 *_int_args++ = from_obj; |
407 *_int_args++ = from_obj; |
429 _num_int_args++; |
408 _num_int_args++; |
430 } else { |
409 } else { |
433 } |
412 } |
434 |
413 |
435 virtual void pass_object() |
414 virtual void pass_object() |
436 { |
415 { |
437 intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0)); |
416 intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0)); |
438 debug_only(verify_tag(frame::TagReference)); |
417 _from -= Interpreter::stackElementSize; |
439 _from -= Interpreter::stackElementSize(); |
|
440 |
418 |
441 if (_num_int_args < Argument::n_int_register_parameters_c-1) { |
419 if (_num_int_args < Argument::n_int_register_parameters_c-1) { |
442 *_int_args++ = (*from_addr == 0) ? NULL : (intptr_t)from_addr; |
420 *_int_args++ = (*from_addr == 0) ? NULL : (intptr_t)from_addr; |
443 _num_int_args++; |
421 _num_int_args++; |
444 } else { |
422 } else { |
447 } |
425 } |
448 |
426 |
449 virtual void pass_float() |
427 virtual void pass_float() |
450 { |
428 { |
451 jint from_obj = *(jint*)(_from+Interpreter::local_offset_in_bytes(0)); |
429 jint from_obj = *(jint*)(_from+Interpreter::local_offset_in_bytes(0)); |
452 debug_only(verify_tag(frame::TagValue)); |
430 _from -= Interpreter::stackElementSize; |
453 _from -= Interpreter::stackElementSize(); |
|
454 |
431 |
455 if (_num_fp_args < Argument::n_float_register_parameters_c) { |
432 if (_num_fp_args < Argument::n_float_register_parameters_c) { |
456 *_fp_args++ = from_obj; |
433 *_fp_args++ = from_obj; |
457 _num_fp_args++; |
434 _num_fp_args++; |
458 } else { |
435 } else { |
461 } |
438 } |
462 |
439 |
463 virtual void pass_double() |
440 virtual void pass_double() |
464 { |
441 { |
465 intptr_t from_obj = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1)); |
442 intptr_t from_obj = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1)); |
466 _from -= 2*Interpreter::stackElementSize(); |
443 _from -= 2*Interpreter::stackElementSize; |
467 |
444 |
468 if (_num_fp_args < Argument::n_float_register_parameters_c) { |
445 if (_num_fp_args < Argument::n_float_register_parameters_c) { |
469 *_fp_args++ = from_obj; |
446 *_fp_args++ = from_obj; |
470 *_fp_identifiers |= (1 << _num_fp_args); // mark as double |
447 *_fp_identifiers |= (1 << _num_fp_args); // mark as double |
471 _num_fp_args++; |
448 _num_fp_args++; |