aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2011-04-04 01:46:08 +0200
committerMike Pall <mike>2011-04-04 01:46:08 +0200
commit85fff386ef3fcbc50978ab6f79da3f13fece11c1 (patch)
tree6784b4e892b3e1327bdfe214cf1fda2b9943323a /src
parentf1c79f80c231b9591f018fd114f0f33d79c89bc2 (diff)
downloadluajit-85fff386ef3fcbc50978ab6f79da3f13fece11c1.tar.gz
luajit-85fff386ef3fcbc50978ab6f79da3f13fece11c1.tar.bz2
luajit-85fff386ef3fcbc50978ab6f79da3f13fece11c1.zip
ARM: Add missing parts of return handling.
Diffstat (limited to 'src')
-rw-r--r--src/buildvm_arm.dasc40
1 files changed, 37 insertions, 3 deletions
diff --git a/src/buildvm_arm.dasc b/src/buildvm_arm.dasc
index 136b4c06..e4672157 100644
--- a/src/buildvm_arm.dasc
+++ b/src/buildvm_arm.dasc
@@ -1255,7 +1255,12 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
1255 /* -- Returns ----------------------------------------------------------- */ 1255 /* -- Returns ----------------------------------------------------------- */
1256 1256
1257 case BC_RETM: 1257 case BC_RETM:
1258 | NYI 1258 | // RA = results*8, RC = extra results
1259 | ldr CARG1, SAVE_MULTRES
1260 | ldr PC, [BASE, FRAME_PC]
1261 | add RA, BASE, RA
1262 | add RC, CARG1, RC, lsl #3
1263 | b ->BC_RETM_Z
1259 break; 1264 break;
1260 1265
1261 case BC_RET: 1266 case BC_RET:
@@ -1263,16 +1268,45 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
1263 | ldr PC, [BASE, FRAME_PC] 1268 | ldr PC, [BASE, FRAME_PC]
1264 | lsl RC, RC, #3 1269 | lsl RC, RC, #3
1265 | add RA, BASE, RA 1270 | add RA, BASE, RA
1271 |->BC_RETM_Z:
1266 | str RC, SAVE_MULTRES 1272 | str RC, SAVE_MULTRES
1267 |1: 1273 |1:
1268 | ands CARG1, PC, #FRAME_TYPE 1274 | ands CARG1, PC, #FRAME_TYPE
1269 | eor CARG2, PC, #FRAME_VARG 1275 | eor CARG2, PC, #FRAME_VARG
1270 | ldreq INS, [PC, #-4]
1271 | bne ->BC_RETV2_Z 1276 | bne ->BC_RETV2_Z
1272 | 1277 |
1273 |->BC_RET_Z: 1278 |->BC_RET_Z:
1274 | // BASE = base, RA = resultptr, RC = (nresults+1)*8, PC = return 1279 | // BASE = base, RA = resultptr, RC = (nresults+1)*8, PC = return
1275 | NYI 1280 | ldr INS, [PC, #-4]
1281 | subs CARG4, RC, #8
1282 | sub CARG3, BASE, #8
1283 | beq >3
1284 |2:
1285 | ldrd CARG12, [RA], #8
1286 | add BASE, BASE, #8
1287 | subs CARG4, CARG4, #8
1288 | strd CARG12, [BASE, #-16]
1289 | bne <2
1290 |3:
1291 | decode_RA8 RA, INS
1292 | sub BASE, CARG3, RA
1293 | decode_RB8 RB, INS
1294 | ldr LFUNC:CARG1, [BASE, FRAME_FUNC]
1295 |5:
1296 | cmp RB, RC // More results expected?
1297 | bhi >6
1298 | ldr CARG2, LFUNC:CARG1->field_pc
1299 | ins_next1
1300 | ins_next2
1301 | ldr KBASE, [CARG2, #PC2PROTO(k)]
1302 | ins_next3
1303 |
1304 |6: // Fill up results with nil.
1305 | mvn CARG2, #~LJ_TNIL
1306 | sub BASE, BASE, #8
1307 | add RC, RC, #8
1308 | str CARG2, [BASE, #-12]
1309 | b <5
1276 | 1310 |
1277 |->BC_RETV1_Z: // Non-standard return case. 1311 |->BC_RETV1_Z: // Non-standard return case.
1278 | add RA, BASE, RA 1312 | add RA, BASE, RA