Mercurial > hg > graal-compiler
comparison 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 |
comparison
equal
deleted
inserted
replaced
14417:f3806614494a | 14418:cfd05ec74089 |
---|---|
115 // Compute signature for C call. Varies from the Java signature! | 115 // Compute signature for C call. Varies from the Java signature! |
116 const Type **fields = TypeTuple::fields(2*parm_cnt+2); | 116 const Type **fields = TypeTuple::fields(2*parm_cnt+2); |
117 uint cnt = TypeFunc::Parms; | 117 uint cnt = TypeFunc::Parms; |
118 // The C routines gets the base of thread-local storage passed in as an | 118 // The C routines gets the base of thread-local storage passed in as an |
119 // extra argument. Not all calls need it, but its cheap to add here. | 119 // extra argument. Not all calls need it, but its cheap to add here. |
120 for( ; cnt<parm_cnt; cnt++ ) | 120 for (uint pcnt = cnt; pcnt < parm_cnt; pcnt++, cnt++) { |
121 fields[cnt] = jdomain->field_at(cnt); | 121 // Convert ints to longs if required. |
122 if (CCallingConventionRequiresIntsAsLongs && jdomain->field_at(pcnt)->isa_int()) { | |
123 fields[cnt++] = TypeLong::LONG; | |
124 fields[cnt] = Type::HALF; // must add an additional half for a long | |
125 } else { | |
126 fields[cnt] = jdomain->field_at(pcnt); | |
127 } | |
128 } | |
129 | |
122 fields[cnt++] = TypeRawPtr::BOTTOM; // Thread-local storage | 130 fields[cnt++] = TypeRawPtr::BOTTOM; // Thread-local storage |
123 // Also pass in the caller's PC, if asked for. | 131 // Also pass in the caller's PC, if asked for. |
124 if( return_pc ) | 132 if( return_pc ) |
125 fields[cnt++] = TypeRawPtr::BOTTOM; // Return PC | 133 fields[cnt++] = TypeRawPtr::BOTTOM; // Return PC |
126 | 134 |
167 call->jvms()->set_bci(0); | 175 call->jvms()->set_bci(0); |
168 call->jvms()->set_offsets(cnt); | 176 call->jvms()->set_offsets(cnt); |
169 | 177 |
170 // Set fixed predefined input arguments | 178 // Set fixed predefined input arguments |
171 cnt = 0; | 179 cnt = 0; |
172 for( i=0; i<TypeFunc::Parms; i++ ) | 180 for (i = 0; i < TypeFunc::Parms; i++) |
173 call->init_req( cnt++, map()->in(i) ); | 181 call->init_req(cnt++, map()->in(i)); |
174 // A little too aggressive on the parm copy; return address is not an input | 182 // A little too aggressive on the parm copy; return address is not an input |
175 call->set_req(TypeFunc::ReturnAdr, top()); | 183 call->set_req(TypeFunc::ReturnAdr, top()); |
176 for( ; i<parm_cnt; i++ ) // Regular input arguments | 184 for (; i < parm_cnt; i++) { // Regular input arguments |
177 call->init_req( cnt++, map()->in(i) ); | 185 // Convert ints to longs if required. |
186 if (CCallingConventionRequiresIntsAsLongs && jdomain->field_at(i)->isa_int()) { | |
187 Node* int_as_long = _gvn.transform(new (C) ConvI2LNode(map()->in(i))); | |
188 call->init_req(cnt++, int_as_long); // long | |
189 call->init_req(cnt++, top()); // half | |
190 } else { | |
191 call->init_req(cnt++, map()->in(i)); | |
192 } | |
193 } | |
178 | 194 |
179 call->init_req( cnt++, thread ); | 195 call->init_req( cnt++, thread ); |
180 if( return_pc ) // Return PC, if asked for | 196 if( return_pc ) // Return PC, if asked for |
181 call->init_req( cnt++, returnadr() ); | 197 call->init_req( cnt++, returnadr() ); |
182 _gvn.transform_no_reclaim(call); | 198 _gvn.transform_no_reclaim(call); |