Mercurial > hg > graal-jvmci-8
diff src/share/vm/opto/generateOptoStub.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 | 75ef1a499665 |
children | 2b8e28fdf503 |
line wrap: on
line diff
--- a/src/share/vm/opto/generateOptoStub.cpp Fri Sep 13 22:50:47 2013 +0200 +++ b/src/share/vm/opto/generateOptoStub.cpp Wed Sep 18 14:34:56 2013 -0700 @@ -117,8 +117,16 @@ uint cnt = TypeFunc::Parms; // The C routines gets the base of thread-local storage passed in as an // extra argument. Not all calls need it, but its cheap to add here. - for( ; cnt<parm_cnt; cnt++ ) - fields[cnt] = jdomain->field_at(cnt); + for (uint pcnt = cnt; pcnt < parm_cnt; pcnt++, cnt++) { + // Convert ints to longs if required. + if (CCallingConventionRequiresIntsAsLongs && jdomain->field_at(pcnt)->isa_int()) { + fields[cnt++] = TypeLong::LONG; + fields[cnt] = Type::HALF; // must add an additional half for a long + } else { + fields[cnt] = jdomain->field_at(pcnt); + } + } + fields[cnt++] = TypeRawPtr::BOTTOM; // Thread-local storage // Also pass in the caller's PC, if asked for. if( return_pc ) @@ -169,12 +177,20 @@ // Set fixed predefined input arguments cnt = 0; - for( i=0; i<TypeFunc::Parms; i++ ) - call->init_req( cnt++, map()->in(i) ); + for (i = 0; i < TypeFunc::Parms; i++) + call->init_req(cnt++, map()->in(i)); // A little too aggressive on the parm copy; return address is not an input call->set_req(TypeFunc::ReturnAdr, top()); - for( ; i<parm_cnt; i++ ) // Regular input arguments - call->init_req( cnt++, map()->in(i) ); + for (; i < parm_cnt; i++) { // Regular input arguments + // Convert ints to longs if required. + if (CCallingConventionRequiresIntsAsLongs && jdomain->field_at(i)->isa_int()) { + Node* int_as_long = _gvn.transform(new (C) ConvI2LNode(map()->in(i))); + call->init_req(cnt++, int_as_long); // long + call->init_req(cnt++, top()); // half + } else { + call->init_req(cnt++, map()->in(i)); + } + } call->init_req( cnt++, thread ); if( return_pc ) // Return PC, if asked for