src/share/vm/runtime/sharedRuntime.hpp

Print this page
rev 5190 : 8024342: PPC64 (part 111): Support for C calling conventions that require 64-bit ints.
Summary: Some platforms, as ppc and s390x/zArch require that 32-bit ints are passed as 64-bit values to C functions. This change adds support to adapt the signature and to issue proper casts to c2-compiled stubs. The functions are used in generate_native_wrapper(). Adapt signature used by the compiler as in PhaseIdealLoop::intrinsify_fill().


 349   // the bottom of the frame the first 16 words will be skipped and SharedInfo::stack0
 350   // will be just above it. (
 351   // return value is the maximum number of VMReg stack slots the convention will use.
 352   static int java_calling_convention(const BasicType* sig_bt, VMRegPair* regs, int total_args_passed, int is_outgoing);
 353 
 354   static void check_member_name_argument_is_last_argument(methodHandle method,
 355                                                           const BasicType* sig_bt,
 356                                                           const VMRegPair* regs) NOT_DEBUG_RETURN;
 357 
 358   // Ditto except for calling C
 359   //
 360   // C argument in register AND stack slot.
 361   // Some architectures require that an argument must be passed in a register
 362   // AND in a stack slot. These architectures provide a second VMRegPair array
 363   // to be filled by the c_calling_convention method. On other architectures,
 364   // NULL is being passed as the second VMRegPair array, so arguments are either
 365   // passed in a register OR in a stack slot.
 366   static int c_calling_convention(const BasicType *sig_bt, VMRegPair *regs, VMRegPair *regs2,
 367                                   int total_args_passed);
 368 










 369   // Generate I2C and C2I adapters. These adapters are simple argument marshalling
 370   // blobs. Unlike adapters in the tiger and earlier releases the code in these
 371   // blobs does not create a new frame and are therefore virtually invisible
 372   // to the stack walking code. In general these blobs extend the callers stack
 373   // as needed for the conversion of argument locations.
 374 
 375   // When calling a c2i blob the code will always call the interpreter even if
 376   // by the time we reach the blob there is compiled code available. This allows
 377   // the blob to pass the incoming stack pointer (the sender sp) in a known
 378   // location for the interpreter to record. This is used by the frame code
 379   // to correct the sender code to match up with the stack pointer when the
 380   // thread left the compiled code. In addition it allows the interpreter
 381   // to remove the space the c2i adapter allocated to do it argument conversion.
 382 
 383   // Although a c2i blob will always run interpreted even if compiled code is
 384   // present if we see that compiled code is present the compiled call site
 385   // will be patched/re-resolved so that later calls will run compiled.
 386 
 387   // Aditionally a c2i blob need to have a unverified entry because it can be reached
 388   // in situations where the call site is an inlined cache site and may go megamorphic.
 389 
 390   // A i2c adapter is simpler than the c2i adapter. This is because it is assumed
 391   // that the interpreter before it does any call dispatch will record the current
 392   // stack pointer in the interpreter frame. On return it will restore the stack
 393   // pointer as needed. This means the i2c adapter code doesn't need any special
 394   // handshaking path with compiled code to keep the stack walking correct.
 395 
 396   static AdapterHandlerEntry* generate_i2c2i_adapters(MacroAssembler *_masm,
 397                                                       int total_args_passed,
 398                                                       int max_arg,
 399                                                       const BasicType *sig_bt,
 400                                                       const VMRegPair *regs,
 401                                                       AdapterFingerPrint* fingerprint);




 349   // the bottom of the frame the first 16 words will be skipped and SharedInfo::stack0
 350   // will be just above it. (
 351   // return value is the maximum number of VMReg stack slots the convention will use.
 352   static int java_calling_convention(const BasicType* sig_bt, VMRegPair* regs, int total_args_passed, int is_outgoing);
 353 
 354   static void check_member_name_argument_is_last_argument(methodHandle method,
 355                                                           const BasicType* sig_bt,
 356                                                           const VMRegPair* regs) NOT_DEBUG_RETURN;
 357 
 358   // Ditto except for calling C
 359   //
 360   // C argument in register AND stack slot.
 361   // Some architectures require that an argument must be passed in a register
 362   // AND in a stack slot. These architectures provide a second VMRegPair array
 363   // to be filled by the c_calling_convention method. On other architectures,
 364   // NULL is being passed as the second VMRegPair array, so arguments are either
 365   // passed in a register OR in a stack slot.
 366   static int c_calling_convention(const BasicType *sig_bt, VMRegPair *regs, VMRegPair *regs2,
 367                                   int total_args_passed);
 368 
 369   // Compute the new number of arguments in the signature if 32 bit ints
 370   // must be converted to longs. Needed if CCallingConventionRequiresIntsAsLongs
 371   // is true.
 372   static int  convert_ints_to_longints_argcnt(int in_args_count, BasicType* in_sig_bt);
 373   // Adapt a method's signature if it contains 32 bit integers that must
 374   // be converted to longs. Needed if CCallingConventionRequiresIntsAsLongs
 375   // is true.
 376   static void convert_ints_to_longints(int i2l_argcnt, int& in_args_count,
 377                                        BasicType*& in_sig_bt, VMRegPair*& in_regs);
 378 
 379   // Generate I2C and C2I adapters. These adapters are simple argument marshalling
 380   // blobs. Unlike adapters in the tiger and earlier releases the code in these
 381   // blobs does not create a new frame and are therefore virtually invisible
 382   // to the stack walking code. In general these blobs extend the callers stack
 383   // as needed for the conversion of argument locations.
 384 
 385   // When calling a c2i blob the code will always call the interpreter even if
 386   // by the time we reach the blob there is compiled code available. This allows
 387   // the blob to pass the incoming stack pointer (the sender sp) in a known
 388   // location for the interpreter to record. This is used by the frame code
 389   // to correct the sender code to match up with the stack pointer when the
 390   // thread left the compiled code. In addition it allows the interpreter
 391   // to remove the space the c2i adapter allocated to do its argument conversion.
 392 
 393   // Although a c2i blob will always run interpreted even if compiled code is
 394   // present if we see that compiled code is present the compiled call site
 395   // will be patched/re-resolved so that later calls will run compiled.
 396 
 397   // Aditionally a c2i blob need to have a unverified entry because it can be reached
 398   // in situations where the call site is an inlined cache site and may go megamorphic.
 399 
 400   // A i2c adapter is simpler than the c2i adapter. This is because it is assumed
 401   // that the interpreter before it does any call dispatch will record the current
 402   // stack pointer in the interpreter frame. On return it will restore the stack
 403   // pointer as needed. This means the i2c adapter code doesn't need any special
 404   // handshaking path with compiled code to keep the stack walking correct.
 405 
 406   static AdapterHandlerEntry* generate_i2c2i_adapters(MacroAssembler *_masm,
 407                                                       int total_args_passed,
 408                                                       int max_arg,
 409                                                       const BasicType *sig_bt,
 410                                                       const VMRegPair *regs,
 411                                                       AdapterFingerPrint* fingerprint);