diff options
author | Mike Pall <mike> | 2011-04-29 19:40:50 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2011-04-29 19:40:50 +0200 |
commit | c77ca54564e63b7ac20a570eee84c57142d6960a (patch) | |
tree | 118392f8d4cd6ef783a7dd78f7894b8abe9309f5 /src/lj_opt_split.c | |
parent | eb7b452d5393993dc568683b05cbb7b3c4f4f5d0 (diff) | |
download | luajit-c77ca54564e63b7ac20a570eee84c57142d6960a.tar.gz luajit-c77ca54564e63b7ac20a570eee84c57142d6960a.tar.bz2 luajit-c77ca54564e63b7ac20a570eee84c57142d6960a.zip |
FFI: Compile C function calls with 64 bit args/results in 32 bit mode.
Diffstat (limited to 'src/lj_opt_split.c')
-rw-r--r-- | src/lj_opt_split.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/lj_opt_split.c b/src/lj_opt_split.c index 90b2b49c..e52ddfd4 100644 --- a/src/lj_opt_split.c +++ b/src/lj_opt_split.c | |||
@@ -256,6 +256,8 @@ static void split_ir(jit_State *J) | |||
256 | } | 256 | } |
257 | break; | 257 | break; |
258 | } | 258 | } |
259 | case IR_CALLXS: | ||
260 | goto split_call; | ||
259 | case IR_PHI: { | 261 | case IR_PHI: { |
260 | IRRef hiref2; | 262 | IRRef hiref2; |
261 | if ((irref_isk(nir->op1) && irref_isk(nir->op2)) || | 263 | if ((irref_isk(nir->op1) && irref_isk(nir->op2)) || |
@@ -285,6 +287,42 @@ static void split_ir(jit_State *J) | |||
285 | nir->op1 = nir->op2 = 0; | 287 | nir->op1 = nir->op2 = 0; |
286 | } | 288 | } |
287 | } | 289 | } |
290 | } else if (ir->o == IR_CALLXS) { | ||
291 | IRRef hiref; | ||
292 | split_call: | ||
293 | hiref = hisubst[ir->op1]; | ||
294 | if (hiref) { | ||
295 | IROpT ot = nir->ot; | ||
296 | IRRef op2 = nir->op2; | ||
297 | nir->ot = IRT(IR_CARG, IRT_NIL); | ||
298 | #if LJ_LE | ||
299 | nir->op2 = hiref; | ||
300 | #else | ||
301 | nir->op2 = nir->op1; nir->op1 = hiref; | ||
302 | #endif | ||
303 | ir->prev = nref = split_emit(J, ot, nref, op2); | ||
304 | } | ||
305 | if (irt_isint64(ir->t)) | ||
306 | hi = split_emit(J, IRTI(IR_HIOP), nref, nref); | ||
307 | } else if (ir->o == IR_CARG) { | ||
308 | IRRef hiref = hisubst[ir->op1]; | ||
309 | if (hiref) { | ||
310 | IRRef op2 = nir->op2; | ||
311 | #if LJ_LE | ||
312 | nir->op2 = hiref; | ||
313 | #else | ||
314 | nir->op2 = nir->op1; nir->op1 = hiref; | ||
315 | #endif | ||
316 | ir->prev = nref = split_emit(J, IRT(IR_CARG, IRT_NIL), nref, op2); | ||
317 | nir = IR(nref); | ||
318 | } | ||
319 | hiref = hisubst[ir->op2]; | ||
320 | if (hiref) { | ||
321 | #if LJ_BE | ||
322 | IRRef tmp = nir->op2; nir->op2 = hiref; hiref = tmp; | ||
323 | #endif | ||
324 | ir->prev = split_emit(J, IRT(IR_CARG, IRT_NIL), nref, hiref); | ||
325 | } | ||
288 | } else if (ir->o == IR_CNEWI) { | 326 | } else if (ir->o == IR_CNEWI) { |
289 | if (hisubst[ir->op2]) | 327 | if (hisubst[ir->op2]) |
290 | split_emit(J, IRT(IR_HIOP, IRT_NIL), nref, hisubst[ir->op2]); | 328 | split_emit(J, IRT(IR_HIOP, IRT_NIL), nref, hisubst[ir->op2]); |