diff options
| author | Mike Pall <mike> | 2010-09-09 12:01:29 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2010-09-09 12:01:29 +0200 |
| commit | fd63b05253f11d7e436c3685827fce9b64725da6 (patch) | |
| tree | 309dc62115841c0ec35ca92cd2ce4871f8dc6679 /src | |
| parent | 8a1af8cf89e5b23d4c7e47dafd0bdba09a3c7e01 (diff) | |
| download | luajit-fd63b05253f11d7e436c3685827fce9b64725da6.tar.gz luajit-fd63b05253f11d7e436c3685827fce9b64725da6.tar.bz2 luajit-fd63b05253f11d7e436c3685827fce9b64725da6.zip | |
Use biased integer constant for TSETM array index.
Diffstat (limited to 'src')
| -rw-r--r-- | src/buildvm_x86.dasc | 12 | ||||
| -rw-r--r-- | src/lj_parse.c | 3 |
2 files changed, 4 insertions, 11 deletions
diff --git a/src/buildvm_x86.dasc b/src/buildvm_x86.dasc index bc128457..d7c36d90 100644 --- a/src/buildvm_x86.dasc +++ b/src/buildvm_x86.dasc | |||
| @@ -4288,15 +4288,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse) | |||
| 4288 | case BC_TSETM: | 4288 | case BC_TSETM: |
| 4289 | | ins_AD // RA = base (table at base-1), RD = num const (start index) | 4289 | | ins_AD // RA = base (table at base-1), RD = num const (start index) |
| 4290 | | mov TMP1, KBASE // Need one more free register. | 4290 | | mov TMP1, KBASE // Need one more free register. |
| 4291 | if (sse) { | 4291 | | mov KBASE, dword [KBASE+RD*8] // Integer constant is in lo-word. |
| 4292 | | cvtsd2si KBASE, qword [KBASE+RD*8] | ||
| 4293 | } else { | ||
| 4294 | |.if not X64 | ||
| 4295 | | fld qword [KBASE+RD*8] | ||
| 4296 | | fistp ARG4 // Const is guaranteed to be an int. | ||
| 4297 | | mov KBASE, ARG4 | ||
| 4298 | |.endif | ||
| 4299 | } | ||
| 4300 | |1: | 4292 | |1: |
| 4301 | | lea RA, [BASE+RA*8] | 4293 | | lea RA, [BASE+RA*8] |
| 4302 | | mov TAB:RB, [RA-8] // Guaranteed to be a table. | 4294 | | mov TAB:RB, [RA-8] // Guaranteed to be a table. |
| @@ -4308,7 +4300,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse) | |||
| 4308 | | jz >4 // Nothing to copy? | 4300 | | jz >4 // Nothing to copy? |
| 4309 | | add RD, KBASE // Compute needed size. | 4301 | | add RD, KBASE // Compute needed size. |
| 4310 | | cmp RD, TAB:RB->asize | 4302 | | cmp RD, TAB:RB->asize |
| 4311 | | jae >5 // Does not fit into array part? | 4303 | | jae >5 // Doesn't fit into array part? |
| 4312 | | sub RD, KBASE | 4304 | | sub RD, KBASE |
| 4313 | | shl KBASE, 3 | 4305 | | shl KBASE, 3 |
| 4314 | | add KBASE, TAB:RB->array | 4306 | | add KBASE, TAB:RB->array |
diff --git a/src/lj_parse.c b/src/lj_parse.c index f5f59d03..e1ca2ff7 100644 --- a/src/lj_parse.c +++ b/src/lj_parse.c | |||
| @@ -1369,7 +1369,8 @@ static void expr_table(LexState *ls, ExpDesc *e) | |||
| 1369 | lua_assert(bc_a(ilp->ins) == freg && | 1369 | lua_assert(bc_a(ilp->ins) == freg && |
| 1370 | bc_op(ilp->ins) == (narr > 256 ? BC_TSETV : BC_TSETB)); | 1370 | bc_op(ilp->ins) == (narr > 256 ? BC_TSETV : BC_TSETB)); |
| 1371 | expr_init(&en, VKNUM, 0); | 1371 | expr_init(&en, VKNUM, 0); |
| 1372 | setintV(&en.u.nval, narr-1); | 1372 | en.u.nval.u32.lo = narr-1; |
| 1373 | en.u.nval.u32.hi = 0x43300000; /* Biased integer to avoid denormals. */ | ||
| 1373 | if (narr > 256) { fs->pc--; ilp--; } | 1374 | if (narr > 256) { fs->pc--; ilp--; } |
| 1374 | ilp->ins = BCINS_AD(BC_TSETM, freg, const_num(fs, &en)); | 1375 | ilp->ins = BCINS_AD(BC_TSETM, freg, const_num(fs, &en)); |
| 1375 | setbc_b(&ilp[-1].ins, 0); | 1376 | setbc_b(&ilp[-1].ins, 0); |
