Mercurial > hg > truffle
comparison src/share/vm/runtime/sharedRuntime.cpp @ 14418:cfd05ec74089
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().
Reviewed-by: kvn
author | goetz |
---|---|
date | Wed, 18 Sep 2013 14:34:56 -0700 |
parents | 583211d4b16b |
children | 2b8e28fdf503 |
comparison
equal
deleted
inserted
replaced
14417:f3806614494a | 14418:cfd05ec74089 |
---|---|
2712 assert(TypeArrayKlass::cast(jlsValue->klass())->element_type() == T_CHAR, "compressed string"); | 2712 assert(TypeArrayKlass::cast(jlsValue->klass())->element_type() == T_CHAR, "compressed string"); |
2713 (void) UNICODE::as_utf8(jlsPos, jlsLen, (char *)dst, max_dtrace_string_size); | 2713 (void) UNICODE::as_utf8(jlsPos, jlsLen, (char *)dst, max_dtrace_string_size); |
2714 } | 2714 } |
2715 #endif // ndef HAVE_DTRACE_H | 2715 #endif // ndef HAVE_DTRACE_H |
2716 | 2716 |
2717 int SharedRuntime::convert_ints_to_longints_argcnt(int in_args_count, BasicType* in_sig_bt) { | |
2718 int argcnt = in_args_count; | |
2719 if (CCallingConventionRequiresIntsAsLongs) { | |
2720 for (int in = 0; in < in_args_count; in++) { | |
2721 BasicType bt = in_sig_bt[in]; | |
2722 switch (bt) { | |
2723 case T_BOOLEAN: | |
2724 case T_CHAR: | |
2725 case T_BYTE: | |
2726 case T_SHORT: | |
2727 case T_INT: | |
2728 argcnt++; | |
2729 break; | |
2730 default: | |
2731 break; | |
2732 } | |
2733 } | |
2734 } else { | |
2735 assert(0, "This should not be needed on this platform"); | |
2736 } | |
2737 | |
2738 return argcnt; | |
2739 } | |
2740 | |
2741 void SharedRuntime::convert_ints_to_longints(int i2l_argcnt, int& in_args_count, | |
2742 BasicType*& in_sig_bt, VMRegPair*& in_regs) { | |
2743 if (CCallingConventionRequiresIntsAsLongs) { | |
2744 VMRegPair *new_in_regs = NEW_RESOURCE_ARRAY(VMRegPair, i2l_argcnt); | |
2745 BasicType *new_in_sig_bt = NEW_RESOURCE_ARRAY(BasicType, i2l_argcnt); | |
2746 | |
2747 int argcnt = 0; | |
2748 for (int in = 0; in < in_args_count; in++, argcnt++) { | |
2749 BasicType bt = in_sig_bt[in]; | |
2750 VMRegPair reg = in_regs[in]; | |
2751 switch (bt) { | |
2752 case T_BOOLEAN: | |
2753 case T_CHAR: | |
2754 case T_BYTE: | |
2755 case T_SHORT: | |
2756 case T_INT: | |
2757 // Convert (bt) to (T_LONG,bt). | |
2758 new_in_sig_bt[argcnt ] = T_LONG; | |
2759 new_in_sig_bt[argcnt+1] = bt; | |
2760 assert(reg.first()->is_valid() && !reg.second()->is_valid(), ""); | |
2761 new_in_regs[argcnt ].set2(reg.first()); | |
2762 new_in_regs[argcnt+1].set_bad(); | |
2763 argcnt++; | |
2764 break; | |
2765 default: | |
2766 // No conversion needed. | |
2767 new_in_sig_bt[argcnt] = bt; | |
2768 new_in_regs[argcnt] = reg; | |
2769 break; | |
2770 } | |
2771 } | |
2772 assert(argcnt == i2l_argcnt, "must match"); | |
2773 | |
2774 in_regs = new_in_regs; | |
2775 in_sig_bt = new_in_sig_bt; | |
2776 in_args_count = i2l_argcnt; | |
2777 } else { | |
2778 assert(0, "This should not be needed on this platform"); | |
2779 } | |
2780 } | |
2781 | |
2717 // ------------------------------------------------------------------------- | 2782 // ------------------------------------------------------------------------- |
2718 // Java-Java calling convention | 2783 // Java-Java calling convention |
2719 // (what you use when Java calls Java) | 2784 // (what you use when Java calls Java) |
2720 | 2785 |
2721 //------------------------------name_for_receiver---------------------------------- | 2786 //------------------------------name_for_receiver---------------------------------- |