From e8ca7b87996c12b17344925a8374e2211df0050a Mon Sep 17 00:00:00 2001 From: Michael Munday Date: Thu, 29 Dec 2016 11:23:45 -0500 Subject: [PATCH] Implement CAT. Allows the use of the '..' operator, for example: x = "hello" y = " " z = "world!" print(x..y..z) -- prints 'hello world!' --- src/vm_s390x.dasc | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/vm_s390x.dasc b/src/vm_s390x.dasc index 99200bc6..cf9a8cca 100644 --- a/src/vm_s390x.dasc +++ b/src/vm_s390x.dasc @@ -2078,8 +2078,28 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) break; case BC_CAT: - | stg r0, 0(r0) - | stg r0, 0(r0) + | ins_ABC // RA = dst, RB = src_start, RC = src_end + | lg L:CARG1, SAVE_L + | stg BASE, L:CARG1->base + | lgr CARG3, RC + | sgr CARG3, RB + | sllg RC, RC, 3(r0) + | la CARG2, 0(RC, BASE) + |->BC_CAT_Z: + | lgr L:RB, L:CARG1 + | stg PC, SAVE_PC + | brasl r14, extern lj_meta_cat // (lua_State *L, TValue *top, int left) + | // NULL (finished) or TValue * (metamethod) returned in r2 (CRET1). + | lg BASE, L:RB->base + | ltgr RC, CRET1 + | jne ->vmeta_binop + | llgc RB, PC_RB // Copy result to Stk[RA] from Stk[RB]. + | sllg RB, RB, 3(r0) + | llgc RA, PC_RA + | sllg RA, RA, 3(r0) + | lg RC, 0(RB, BASE) + | stg RC, 0(RA, BASE) + | ins_next break; /* -- Constant ops ------------------------------------------------------ */