diff options
author | Mike Pall <mike> | 2011-03-10 02:13:43 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2011-03-10 02:13:43 +0100 |
commit | 889368e921a11e2abb3769e2c1f395174e83112d (patch) | |
tree | a0280bec2142380ce13b1afc2d8e17fcd65e29e9 | |
parent | bfce3c1127fd57fe0c935c92bcf45b4737041edd (diff) | |
download | luajit-889368e921a11e2abb3769e2c1f395174e83112d.tar.gz luajit-889368e921a11e2abb3769e2c1f395174e83112d.tar.bz2 luajit-889368e921a11e2abb3769e2c1f395174e83112d.zip |
Get rid of the remaining silly cast macros from Lua.
-rw-r--r-- | src/buildvm_x64.h | 10 | ||||
-rw-r--r-- | src/buildvm_x64win.h | 10 | ||||
-rw-r--r-- | src/buildvm_x86.dasc | 2 | ||||
-rw-r--r-- | src/buildvm_x86.h | 10 | ||||
-rw-r--r-- | src/lj_api.c | 4 | ||||
-rw-r--r-- | src/lj_bc.h | 27 | ||||
-rw-r--r-- | src/lj_cparse.c | 2 | ||||
-rw-r--r-- | src/lj_def.h | 6 | ||||
-rw-r--r-- | src/lj_func.c | 4 | ||||
-rw-r--r-- | src/lj_gc.c | 14 | ||||
-rw-r--r-- | src/lj_ir.c | 2 | ||||
-rw-r--r-- | src/lj_lex.c | 2 | ||||
-rw-r--r-- | src/lj_meta.c | 8 | ||||
-rw-r--r-- | src/lj_opt_fold.c | 12 | ||||
-rw-r--r-- | src/lj_state.c | 2 | ||||
-rw-r--r-- | src/lj_str.c | 2 | ||||
-rw-r--r-- | src/lj_tab.c | 6 |
17 files changed, 58 insertions, 65 deletions
diff --git a/src/buildvm_x64.h b/src/buildvm_x64.h index 801345d5..1d2b8b44 100644 --- a/src/buildvm_x64.h +++ b/src/buildvm_x64.h | |||
@@ -1215,7 +1215,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse) | |||
1215 | dasm_put(Dst, 1850, ((char *)(&((GCfuncC *)0)->upvalue)), LJ_TSTR, ~LJ_TLIGHTUD, 1+1, LJ_TTAB, Dt6(->metatable), LJ_TNIL); | 1215 | dasm_put(Dst, 1850, ((char *)(&((GCfuncC *)0)->upvalue)), LJ_TSTR, ~LJ_TLIGHTUD, 1+1, LJ_TTAB, Dt6(->metatable), LJ_TNIL); |
1216 | dasm_put(Dst, 1929, DISPATCH_GL(gcroot)+4*(GCROOT_MMNAME+MM_metatable), LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), DtB(->next)); | 1216 | dasm_put(Dst, 1929, DISPATCH_GL(gcroot)+4*(GCROOT_MMNAME+MM_metatable), LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), DtB(->next)); |
1217 | dasm_put(Dst, 1987, LJ_TNIL, LJ_TUDATA, LJ_TISNUM, LJ_TNUMX, DISPATCH_GL(gcroot[GCROOT_BASEMT])); | 1217 | dasm_put(Dst, 1987, LJ_TNIL, LJ_TUDATA, LJ_TISNUM, LJ_TNUMX, DISPATCH_GL(gcroot[GCROOT_BASEMT])); |
1218 | dasm_put(Dst, 2056, 2+1, LJ_TTAB, Dt6(->metatable), LJ_TTAB, Dt6(->metatable), LJ_TTAB, Dt6(->marked), LJ_GC_BLACK, Dt6(->marked), cast_byte(~LJ_GC_BLACK)); | 1218 | dasm_put(Dst, 2056, 2+1, LJ_TTAB, Dt6(->metatable), LJ_TTAB, Dt6(->metatable), LJ_TTAB, Dt6(->marked), LJ_GC_BLACK, Dt6(->marked), (uint8_t)~LJ_GC_BLACK); |
1219 | dasm_put(Dst, 2125, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist), 2+1, LJ_TTAB, 1+1, LJ_TISNUM); | 1219 | dasm_put(Dst, 2125, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist), 2+1, LJ_TTAB, 1+1, LJ_TISNUM); |
1220 | if (LJ_DUALNUM) { | 1220 | if (LJ_DUALNUM) { |
1221 | dasm_put(Dst, 2211); | 1221 | dasm_put(Dst, 2211); |
@@ -2633,21 +2633,21 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse) | |||
2633 | dasm_put(Dst, 13339); | 2633 | dasm_put(Dst, 13339); |
2634 | } | 2634 | } |
2635 | dasm_put(Dst, 13344, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); | 2635 | dasm_put(Dst, 13344, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); |
2636 | dasm_put(Dst, 13425, LJ_TSTR, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); | 2636 | dasm_put(Dst, 13425, LJ_TSTR, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); |
2637 | break; | 2637 | break; |
2638 | case BC_TSETS: | 2638 | case BC_TSETS: |
2639 | dasm_put(Dst, 13484, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->nomm), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL); | 2639 | dasm_put(Dst, 13484, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->nomm), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL); |
2640 | dasm_put(Dst, 13561, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next)); | 2640 | dasm_put(Dst, 13561, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next)); |
2641 | dasm_put(Dst, 13648, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt1(->base), Dt1(->base), Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); | 2641 | dasm_put(Dst, 13648, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt1(->base), Dt1(->base), Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); |
2642 | break; | 2642 | break; |
2643 | case BC_TSETB: | 2643 | case BC_TSETB: |
2644 | dasm_put(Dst, 13740, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable)); | 2644 | dasm_put(Dst, 13740, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable)); |
2645 | dasm_put(Dst, 13835, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); | 2645 | dasm_put(Dst, 13835, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); |
2646 | break; | 2646 | break; |
2647 | 2647 | ||
2648 | case BC_TSETM: | 2648 | case BC_TSETM: |
2649 | dasm_put(Dst, 13883, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base)); | 2649 | dasm_put(Dst, 13883, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base)); |
2650 | dasm_put(Dst, 14033, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); | 2650 | dasm_put(Dst, 14033, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); |
2651 | break; | 2651 | break; |
2652 | 2652 | ||
2653 | /* -- Calls and vararg handling ----------------------------------------- */ | 2653 | /* -- Calls and vararg handling ----------------------------------------- */ |
diff --git a/src/buildvm_x64win.h b/src/buildvm_x64win.h index 5c19f6de..7bed2e94 100644 --- a/src/buildvm_x64win.h +++ b/src/buildvm_x64win.h | |||
@@ -1213,7 +1213,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse) | |||
1213 | dasm_put(Dst, 1827, ((char *)(&((GCfuncC *)0)->upvalue)), LJ_TSTR, ~LJ_TLIGHTUD, 1+1, LJ_TTAB, Dt6(->metatable), LJ_TNIL); | 1213 | dasm_put(Dst, 1827, ((char *)(&((GCfuncC *)0)->upvalue)), LJ_TSTR, ~LJ_TLIGHTUD, 1+1, LJ_TTAB, Dt6(->metatable), LJ_TNIL); |
1214 | dasm_put(Dst, 1906, DISPATCH_GL(gcroot)+4*(GCROOT_MMNAME+MM_metatable), LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), DtB(->next)); | 1214 | dasm_put(Dst, 1906, DISPATCH_GL(gcroot)+4*(GCROOT_MMNAME+MM_metatable), LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), DtB(->next)); |
1215 | dasm_put(Dst, 1963, LJ_TNIL, LJ_TUDATA, LJ_TISNUM, LJ_TNUMX, DISPATCH_GL(gcroot[GCROOT_BASEMT])); | 1215 | dasm_put(Dst, 1963, LJ_TNIL, LJ_TUDATA, LJ_TISNUM, LJ_TNUMX, DISPATCH_GL(gcroot[GCROOT_BASEMT])); |
1216 | dasm_put(Dst, 2031, 2+1, LJ_TTAB, Dt6(->metatable), LJ_TTAB, Dt6(->metatable), LJ_TTAB, Dt6(->marked), LJ_GC_BLACK, Dt6(->marked), cast_byte(~LJ_GC_BLACK)); | 1216 | dasm_put(Dst, 2031, 2+1, LJ_TTAB, Dt6(->metatable), LJ_TTAB, Dt6(->metatable), LJ_TTAB, Dt6(->marked), LJ_GC_BLACK, Dt6(->marked), (uint8_t)~LJ_GC_BLACK); |
1217 | dasm_put(Dst, 2100, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist), 2+1, LJ_TTAB, 1+1, LJ_TISNUM); | 1217 | dasm_put(Dst, 2100, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist), 2+1, LJ_TTAB, 1+1, LJ_TISNUM); |
1218 | if (LJ_DUALNUM) { | 1218 | if (LJ_DUALNUM) { |
1219 | dasm_put(Dst, 2185); | 1219 | dasm_put(Dst, 2185); |
@@ -2632,21 +2632,21 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse) | |||
2632 | dasm_put(Dst, 13221); | 2632 | dasm_put(Dst, 13221); |
2633 | } | 2633 | } |
2634 | dasm_put(Dst, 13226, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); | 2634 | dasm_put(Dst, 13226, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); |
2635 | dasm_put(Dst, 13306, LJ_TSTR, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); | 2635 | dasm_put(Dst, 13306, LJ_TSTR, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); |
2636 | break; | 2636 | break; |
2637 | case BC_TSETS: | 2637 | case BC_TSETS: |
2638 | dasm_put(Dst, 13363, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->nomm), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL); | 2638 | dasm_put(Dst, 13363, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->nomm), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL); |
2639 | dasm_put(Dst, 13439, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next)); | 2639 | dasm_put(Dst, 13439, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next)); |
2640 | dasm_put(Dst, 13527, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt1(->base), Dt1(->base), Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); | 2640 | dasm_put(Dst, 13527, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt1(->base), Dt1(->base), Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); |
2641 | break; | 2641 | break; |
2642 | case BC_TSETB: | 2642 | case BC_TSETB: |
2643 | dasm_put(Dst, 13618, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable)); | 2643 | dasm_put(Dst, 13618, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable)); |
2644 | dasm_put(Dst, 13712, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); | 2644 | dasm_put(Dst, 13712, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); |
2645 | break; | 2645 | break; |
2646 | 2646 | ||
2647 | case BC_TSETM: | 2647 | case BC_TSETM: |
2648 | dasm_put(Dst, 13758, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base)); | 2648 | dasm_put(Dst, 13758, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base)); |
2649 | dasm_put(Dst, 13901, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); | 2649 | dasm_put(Dst, 13901, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); |
2650 | break; | 2650 | break; |
2651 | 2651 | ||
2652 | /* -- Calls and vararg handling ----------------------------------------- */ | 2652 | /* -- Calls and vararg handling ----------------------------------------- */ |
diff --git a/src/buildvm_x86.dasc b/src/buildvm_x86.dasc index 17dcae2d..6b2dc877 100644 --- a/src/buildvm_x86.dasc +++ b/src/buildvm_x86.dasc | |||
@@ -400,7 +400,7 @@ | |||
400 | | | 400 | | |
401 | |// Move table write barrier back. Overwrites reg. | 401 | |// Move table write barrier back. Overwrites reg. |
402 | |.macro barrierback, tab, reg | 402 | |.macro barrierback, tab, reg |
403 | | and byte tab->marked, cast_byte(~LJ_GC_BLACK) // black2gray(tab) | 403 | | and byte tab->marked, (uint8_t)~LJ_GC_BLACK // black2gray(tab) |
404 | | mov reg, [DISPATCH+DISPATCH_GL(gc.grayagain)] | 404 | | mov reg, [DISPATCH+DISPATCH_GL(gc.grayagain)] |
405 | | mov [DISPATCH+DISPATCH_GL(gc.grayagain)], tab | 405 | | mov [DISPATCH+DISPATCH_GL(gc.grayagain)], tab |
406 | | mov tab->gclist, reg | 406 | | mov tab->gclist, reg |
diff --git a/src/buildvm_x86.h b/src/buildvm_x86.h index bc2ef125..a49b3dd5 100644 --- a/src/buildvm_x86.h +++ b/src/buildvm_x86.h | |||
@@ -1264,7 +1264,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse) | |||
1264 | dasm_put(Dst, 1837, ((char *)(&((GCfuncC *)0)->upvalue)), LJ_TSTR, 1+1, LJ_TTAB, Dt6(->metatable), LJ_TNIL, DISPATCH_GL(gcroot)+4*(GCROOT_MMNAME+MM_metatable), LJ_TTAB); | 1264 | dasm_put(Dst, 1837, ((char *)(&((GCfuncC *)0)->upvalue)), LJ_TSTR, 1+1, LJ_TTAB, Dt6(->metatable), LJ_TNIL, DISPATCH_GL(gcroot)+4*(GCROOT_MMNAME+MM_metatable), LJ_TTAB); |
1265 | dasm_put(Dst, 1920, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), DtB(->next), LJ_TNIL); | 1265 | dasm_put(Dst, 1920, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), DtB(->next), LJ_TNIL); |
1266 | dasm_put(Dst, 1978, LJ_TUDATA, LJ_TISNUM, LJ_TNUMX, DISPATCH_GL(gcroot[GCROOT_BASEMT]), 2+1); | 1266 | dasm_put(Dst, 1978, LJ_TUDATA, LJ_TISNUM, LJ_TNUMX, DISPATCH_GL(gcroot[GCROOT_BASEMT]), 2+1); |
1267 | dasm_put(Dst, 2041, LJ_TTAB, Dt6(->metatable), LJ_TTAB, Dt6(->metatable), LJ_TTAB, Dt6(->marked), LJ_GC_BLACK, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); | 1267 | dasm_put(Dst, 2041, LJ_TTAB, Dt6(->metatable), LJ_TTAB, Dt6(->metatable), LJ_TTAB, Dt6(->marked), LJ_GC_BLACK, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); |
1268 | dasm_put(Dst, 2113, 2+1, LJ_TTAB, 1+1, LJ_TISNUM); | 1268 | dasm_put(Dst, 2113, 2+1, LJ_TTAB, 1+1, LJ_TISNUM); |
1269 | if (LJ_DUALNUM) { | 1269 | if (LJ_DUALNUM) { |
1270 | dasm_put(Dst, 2202); | 1270 | dasm_put(Dst, 2202); |
@@ -2791,21 +2791,21 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse) | |||
2791 | dasm_put(Dst, 14358); | 2791 | dasm_put(Dst, 14358); |
2792 | } | 2792 | } |
2793 | dasm_put(Dst, 14363, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); | 2793 | dasm_put(Dst, 14363, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); |
2794 | dasm_put(Dst, 14447, LJ_TSTR, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); | 2794 | dasm_put(Dst, 14447, LJ_TSTR, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); |
2795 | break; | 2795 | break; |
2796 | case BC_TSETS: | 2796 | case BC_TSETS: |
2797 | dasm_put(Dst, 14504, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->nomm), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL); | 2797 | dasm_put(Dst, 14504, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->nomm), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL); |
2798 | dasm_put(Dst, 14579, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next)); | 2798 | dasm_put(Dst, 14579, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next)); |
2799 | dasm_put(Dst, 14671, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt1(->base), Dt1(->base), Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); | 2799 | dasm_put(Dst, 14671, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt1(->base), Dt1(->base), Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); |
2800 | break; | 2800 | break; |
2801 | case BC_TSETB: | 2801 | case BC_TSETB: |
2802 | dasm_put(Dst, 14767, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable)); | 2802 | dasm_put(Dst, 14767, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable)); |
2803 | dasm_put(Dst, 14865, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); | 2803 | dasm_put(Dst, 14865, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); |
2804 | break; | 2804 | break; |
2805 | 2805 | ||
2806 | case BC_TSETM: | 2806 | case BC_TSETM: |
2807 | dasm_put(Dst, 14911, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base)); | 2807 | dasm_put(Dst, 14911, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base)); |
2808 | dasm_put(Dst, 15060, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); | 2808 | dasm_put(Dst, 15060, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); |
2809 | break; | 2809 | break; |
2810 | 2810 | ||
2811 | /* -- Calls and vararg handling ----------------------------------------- */ | 2811 | /* -- Calls and vararg handling ----------------------------------------- */ |
diff --git a/src/lj_api.c b/src/lj_api.c index 10f9f3cb..70834f8d 100644 --- a/src/lj_api.c +++ b/src/lj_api.c | |||
@@ -500,7 +500,7 @@ LUA_API size_t lua_objlen(lua_State *L, int idx) | |||
500 | if (tvisstr(o)) | 500 | if (tvisstr(o)) |
501 | return strV(o)->len; | 501 | return strV(o)->len; |
502 | else if (tvistab(o)) | 502 | else if (tvistab(o)) |
503 | return cast(size_t, lj_tab_len(tabV(o))); | 503 | return (size_t)lj_tab_len(tabV(o)); |
504 | else if (tvisudata(o)) | 504 | else if (tvisudata(o)) |
505 | return udataV(o)->len; | 505 | return udataV(o)->len; |
506 | else if (tvisnumber(o)) | 506 | else if (tvisnumber(o)) |
@@ -1129,7 +1129,7 @@ LUA_API int lua_resume(lua_State *L, int nargs) | |||
1129 | 1129 | ||
1130 | static TValue *cpparser(lua_State *L, lua_CFunction dummy, void *ud) | 1130 | static TValue *cpparser(lua_State *L, lua_CFunction dummy, void *ud) |
1131 | { | 1131 | { |
1132 | LexState *ls = cast(LexState *, ud); | 1132 | LexState *ls = (LexState *)ud; |
1133 | GCfunc *fn; | 1133 | GCfunc *fn; |
1134 | UNUSED(dummy); | 1134 | UNUSED(dummy); |
1135 | cframe_errfunc(L->cframe) = -1; /* Inherit error function. */ | 1135 | cframe_errfunc(L->cframe) = -1; /* Inherit error function. */ |
diff --git a/src/lj_bc.h b/src/lj_bc.h index 9dffe0c0..97e4d926 100644 --- a/src/lj_bc.h +++ b/src/lj_bc.h | |||
@@ -31,30 +31,29 @@ | |||
31 | #define NO_JMP (~(BCPos)0) | 31 | #define NO_JMP (~(BCPos)0) |
32 | 32 | ||
33 | /* Macros to get instruction fields. */ | 33 | /* Macros to get instruction fields. */ |
34 | #define bc_op(i) (cast(BCOp, (i)&0xff)) | 34 | #define bc_op(i) ((BCOp)((i)&0xff)) |
35 | #define bc_a(i) (cast(BCReg, ((i)>>8)&0xff)) | 35 | #define bc_a(i) ((BCReg)(((i)>>8)&0xff)) |
36 | #define bc_b(i) (cast(BCReg, (i)>>24)) | 36 | #define bc_b(i) ((BCReg)((i)>>24)) |
37 | #define bc_c(i) (cast(BCReg, ((i)>>16)&0xff)) | 37 | #define bc_c(i) ((BCReg)(((i)>>16)&0xff)) |
38 | #define bc_d(i) (cast(BCReg, (i)>>16)) | 38 | #define bc_d(i) ((BCReg)((i)>>16)) |
39 | #define bc_j(i) ((ptrdiff_t)bc_d(i)-BCBIAS_J) | 39 | #define bc_j(i) ((ptrdiff_t)bc_d(i)-BCBIAS_J) |
40 | 40 | ||
41 | /* Macros to set instruction fields. */ | 41 | /* Macros to set instruction fields. */ |
42 | #define setbc_byte(p, x, ofs) \ | 42 | #define setbc_byte(p, x, ofs) \ |
43 | ((uint8_t *)(p))[LJ_ENDIAN_SELECT(ofs, 3-ofs)] = cast_byte(x) | 43 | ((uint8_t *)(p))[LJ_ENDIAN_SELECT(ofs, 3-ofs)] = (uint8_t)(x) |
44 | #define setbc_op(p, x) setbc_byte(p, (x), 0) | 44 | #define setbc_op(p, x) setbc_byte(p, (x), 0) |
45 | #define setbc_a(p, x) setbc_byte(p, (x), 1) | 45 | #define setbc_a(p, x) setbc_byte(p, (x), 1) |
46 | #define setbc_b(p, x) setbc_byte(p, (x), 3) | 46 | #define setbc_b(p, x) setbc_byte(p, (x), 3) |
47 | #define setbc_c(p, x) setbc_byte(p, (x), 2) | 47 | #define setbc_c(p, x) setbc_byte(p, (x), 2) |
48 | #define setbc_d(p, x) \ | 48 | #define setbc_d(p, x) \ |
49 | ((uint16_t *)(p))[LJ_ENDIAN_SELECT(1, 0)] = cast(uint16_t, (x)) | 49 | ((uint16_t *)(p))[LJ_ENDIAN_SELECT(1, 0)] = (uint16_t)(x) |
50 | #define setbc_j(p, x) setbc_d(p, (BCPos)((int32_t)(x)+BCBIAS_J)) | 50 | #define setbc_j(p, x) setbc_d(p, (BCPos)((int32_t)(x)+BCBIAS_J)) |
51 | 51 | ||
52 | /* Macros to compose instructions. */ | 52 | /* Macros to compose instructions. */ |
53 | #define BCINS_ABC(o, a, b, c) \ | 53 | #define BCINS_ABC(o, a, b, c) \ |
54 | (cast(BCIns, o)|(cast(BCIns, a)<<8)|\ | 54 | (((BCIns)(o))|((BCIns)(a)<<8)|((BCIns)(b)<<24)|((BCIns)(c)<<16)) |
55 | (cast(BCIns, b)<<24)|(cast(BCIns, c)<<16)) | ||
56 | #define BCINS_AD(o, a, d) \ | 55 | #define BCINS_AD(o, a, d) \ |
57 | (cast(BCIns, o)|(cast(BCIns, a)<<8)|(cast(BCIns, d)<<16)) | 56 | (((BCIns)(o))|((BCIns)(a)<<8)|((BCIns)(d)<<16)) |
58 | #define BCINS_AJ(o, a, j) BCINS_AD(o, a, (BCPos)((int32_t)(j)+BCBIAS_J)) | 57 | #define BCINS_AJ(o, a, j) BCINS_AD(o, a, (BCPos)((int32_t)(j)+BCBIAS_J)) |
59 | 58 | ||
60 | /* Bytecode instruction definition. Order matters, see below. | 59 | /* Bytecode instruction definition. Order matters, see below. |
@@ -240,12 +239,12 @@ typedef enum { | |||
240 | } BCMode; | 239 | } BCMode; |
241 | #define BCM___ BCMnone | 240 | #define BCM___ BCMnone |
242 | 241 | ||
243 | #define bcmode_a(op) (cast(BCMode, lj_bc_mode[op] & 7)) | 242 | #define bcmode_a(op) ((BCMode)(lj_bc_mode[op] & 7)) |
244 | #define bcmode_b(op) (cast(BCMode, (lj_bc_mode[op]>>3) & 15)) | 243 | #define bcmode_b(op) ((BCMode)((lj_bc_mode[op]>>3) & 15)) |
245 | #define bcmode_c(op) (cast(BCMode, (lj_bc_mode[op]>>7) & 15)) | 244 | #define bcmode_c(op) ((BCMode)((lj_bc_mode[op]>>7) & 15)) |
246 | #define bcmode_d(op) bcmode_c(op) | 245 | #define bcmode_d(op) bcmode_c(op) |
247 | #define bcmode_hasd(op) ((lj_bc_mode[op] & (15<<3)) == (BCMnone<<3)) | 246 | #define bcmode_hasd(op) ((lj_bc_mode[op] & (15<<3)) == (BCMnone<<3)) |
248 | #define bcmode_mm(op) (cast(MMS, lj_bc_mode[op]>>11)) | 247 | #define bcmode_mm(op) ((MMS)(lj_bc_mode[op]>>11)) |
249 | 248 | ||
250 | #define BCMODE(name, ma, mb, mc, mm) \ | 249 | #define BCMODE(name, ma, mb, mc, mm) \ |
251 | (BCM##ma|(BCM##mb<<3)|(BCM##mc<<7)|(MM_##mm<<11)), | 250 | (BCM##ma|(BCM##mb<<3)|(BCM##mc<<7)|(MM_##mm<<11)), |
diff --git a/src/lj_cparse.c b/src/lj_cparse.c index 7da4d12d..eadb38bb 100644 --- a/src/lj_cparse.c +++ b/src/lj_cparse.c | |||
@@ -1803,7 +1803,7 @@ static void cp_decl_single(CPState *cp) | |||
1803 | /* Protected callback for C parser. */ | 1803 | /* Protected callback for C parser. */ |
1804 | static TValue *cpcparser(lua_State *L, lua_CFunction dummy, void *ud) | 1804 | static TValue *cpcparser(lua_State *L, lua_CFunction dummy, void *ud) |
1805 | { | 1805 | { |
1806 | CPState *cp = cast(CPState *, ud); | 1806 | CPState *cp = (CPState *)ud; |
1807 | UNUSED(dummy); | 1807 | UNUSED(dummy); |
1808 | cframe_errfunc(L->cframe) = -1; /* Inherit error function. */ | 1808 | cframe_errfunc(L->cframe) = -1; /* Inherit error function. */ |
1809 | cp_init(cp); | 1809 | cp_init(cp); |
diff --git a/src/lj_def.h b/src/lj_def.h index f6f03318..b7df8606 100644 --- a/src/lj_def.h +++ b/src/lj_def.h | |||
@@ -74,13 +74,7 @@ typedef unsigned __int32 uintptr_t; | |||
74 | #define UNUSED(x) ((void)(x)) /* to avoid warnings */ | 74 | #define UNUSED(x) ((void)(x)) /* to avoid warnings */ |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | #ifndef cast | ||
78 | #define cast(t, exp) ((t)(exp)) | ||
79 | #endif | ||
80 | |||
81 | #define U64x(hi, lo) (((uint64_t)0x##hi << 32) + (uint64_t)0x##lo) | 77 | #define U64x(hi, lo) (((uint64_t)0x##hi << 32) + (uint64_t)0x##lo) |
82 | #define cast_byte(i) cast(uint8_t, (i)) | ||
83 | #define cast_num(i) cast(lua_Number, (i)) | ||
84 | #define i32ptr(p) ((int32_t)(intptr_t)(void *)(p)) | 78 | #define i32ptr(p) ((int32_t)(intptr_t)(void *)(p)) |
85 | #define u32ptr(p) ((uint32_t)(intptr_t)(void *)(p)) | 79 | #define u32ptr(p) ((uint32_t)(intptr_t)(void *)(p)) |
86 | 80 | ||
diff --git a/src/lj_func.c b/src/lj_func.c index b3564091..d7d37802 100644 --- a/src/lj_func.c +++ b/src/lj_func.c | |||
@@ -95,7 +95,7 @@ void LJ_FASTCALL lj_func_freeuv(global_State *g, GCupval *uv) | |||
95 | 95 | ||
96 | GCfunc *lj_func_newC(lua_State *L, MSize nelems, GCtab *env) | 96 | GCfunc *lj_func_newC(lua_State *L, MSize nelems, GCtab *env) |
97 | { | 97 | { |
98 | GCfunc *fn = cast(GCfunc *, lj_mem_newgco(L, sizeCfunc(nelems))); | 98 | GCfunc *fn = (GCfunc *)lj_mem_newgco(L, sizeCfunc(nelems)); |
99 | fn->c.gct = ~LJ_TFUNC; | 99 | fn->c.gct = ~LJ_TFUNC; |
100 | fn->c.ffid = FF_C; | 100 | fn->c.ffid = FF_C; |
101 | fn->c.nupvalues = (uint8_t)nelems; | 101 | fn->c.nupvalues = (uint8_t)nelems; |
@@ -107,7 +107,7 @@ GCfunc *lj_func_newC(lua_State *L, MSize nelems, GCtab *env) | |||
107 | 107 | ||
108 | GCfunc *lj_func_newL(lua_State *L, GCproto *pt, GCtab *env) | 108 | GCfunc *lj_func_newL(lua_State *L, GCproto *pt, GCtab *env) |
109 | { | 109 | { |
110 | GCfunc *fn = cast(GCfunc *, lj_mem_newgco(L, sizeLfunc((MSize)pt->sizeuv))); | 110 | GCfunc *fn = (GCfunc *)lj_mem_newgco(L, sizeLfunc((MSize)pt->sizeuv)); |
111 | fn->l.gct = ~LJ_TFUNC; | 111 | fn->l.gct = ~LJ_TFUNC; |
112 | fn->l.ffid = FF_LUA; | 112 | fn->l.ffid = FF_LUA; |
113 | fn->l.nupvalues = (uint8_t)pt->sizeuv; | 113 | fn->l.nupvalues = (uint8_t)pt->sizeuv; |
diff --git a/src/lj_gc.c b/src/lj_gc.c index f231b1ce..bc6d843a 100644 --- a/src/lj_gc.c +++ b/src/lj_gc.c | |||
@@ -32,11 +32,11 @@ | |||
32 | #define GCFINALIZECOST 100 | 32 | #define GCFINALIZECOST 100 |
33 | 33 | ||
34 | /* Macros to set GCobj colors and flags. */ | 34 | /* Macros to set GCobj colors and flags. */ |
35 | #define white2gray(x) ((x)->gch.marked &= cast_byte(~LJ_GC_WHITES)) | 35 | #define white2gray(x) ((x)->gch.marked &= (uint8_t)~LJ_GC_WHITES) |
36 | #define black2gray(x) ((x)->gch.marked &= cast_byte(~LJ_GC_BLACK)) | 36 | #define black2gray(x) ((x)->gch.marked &= (uint8_t)~LJ_GC_BLACK) |
37 | #define gray2black(x) ((x)->gch.marked |= LJ_GC_BLACK) | 37 | #define gray2black(x) ((x)->gch.marked |= LJ_GC_BLACK) |
38 | #define makewhite(g, x) \ | 38 | #define makewhite(g, x) \ |
39 | ((x)->gch.marked = ((x)->gch.marked & cast_byte(~LJ_GC_COLORS)) | curwhite(g)) | 39 | ((x)->gch.marked = ((x)->gch.marked & (uint8_t)~LJ_GC_COLORS) | curwhite(g)) |
40 | #define isfinalized(u) ((u)->marked & LJ_GC_FINALIZED) | 40 | #define isfinalized(u) ((u)->marked & LJ_GC_FINALIZED) |
41 | #define markfinalized(u) ((u)->marked |= LJ_GC_FINALIZED) | 41 | #define markfinalized(u) ((u)->marked |= LJ_GC_FINALIZED) |
42 | 42 | ||
@@ -52,7 +52,7 @@ | |||
52 | { if (iswhite(obj2gco(o))) gc_mark(g, obj2gco(o)); } | 52 | { if (iswhite(obj2gco(o))) gc_mark(g, obj2gco(o)); } |
53 | 53 | ||
54 | /* Mark a string object. */ | 54 | /* Mark a string object. */ |
55 | #define gc_mark_str(s) ((s)->marked &= cast_byte(~LJ_GC_WHITES)) | 55 | #define gc_mark_str(s) ((s)->marked &= (uint8_t)~LJ_GC_WHITES) |
56 | 56 | ||
57 | /* Mark a white GCobj. */ | 57 | /* Mark a white GCobj. */ |
58 | static void gc_mark(global_State *g, GCobj *o) | 58 | static void gc_mark(global_State *g, GCobj *o) |
@@ -174,7 +174,7 @@ static int gc_traverse_tab(global_State *g, GCtab *t) | |||
174 | else if (c == 'K') weak = (int)(~0u & ~LJ_GC_WEAKVAL); | 174 | else if (c == 'K') weak = (int)(~0u & ~LJ_GC_WEAKVAL); |
175 | } | 175 | } |
176 | if (weak > 0) { /* Weak tables are cleared in the atomic phase. */ | 176 | if (weak > 0) { /* Weak tables are cleared in the atomic phase. */ |
177 | t->marked = cast_byte((t->marked & ~LJ_GC_WEAK) | weak); | 177 | t->marked = (uint8_t)((t->marked & ~LJ_GC_WEAK) | weak); |
178 | setgcrefr(t->gclist, g->gc.weak); | 178 | setgcrefr(t->gclist, g->gc.weak); |
179 | setgcref(g->gc.weak, obj2gco(t)); | 179 | setgcref(g->gc.weak, obj2gco(t)); |
180 | } | 180 | } |
@@ -594,7 +594,7 @@ static void atomic(global_State *g, lua_State *L) | |||
594 | gc_clearweak(gcref(g->gc.weak)); | 594 | gc_clearweak(gcref(g->gc.weak)); |
595 | 595 | ||
596 | /* Prepare for sweep phase. */ | 596 | /* Prepare for sweep phase. */ |
597 | g->gc.currentwhite = cast_byte(otherwhite(g)); /* Flip current white. */ | 597 | g->gc.currentwhite = (uint8_t)otherwhite(g); /* Flip current white. */ |
598 | g->strempty.marked = g->gc.currentwhite; | 598 | g->strempty.marked = g->gc.currentwhite; |
599 | setmref(g->gc.sweep, &g->gc.root); | 599 | setmref(g->gc.sweep, &g->gc.root); |
600 | g->gc.estimate = g->gc.total - (MSize)udsize; /* Initial estimate. */ | 600 | g->gc.estimate = g->gc.total - (MSize)udsize; /* Initial estimate. */ |
@@ -772,7 +772,7 @@ void LJ_FASTCALL lj_gc_barrieruv(global_State *g, TValue *tv) | |||
772 | if (g->gc.state == GCSpropagate || g->gc.state == GCSatomic) | 772 | if (g->gc.state == GCSpropagate || g->gc.state == GCSatomic) |
773 | gc_mark(g, gcV(tv)); | 773 | gc_mark(g, gcV(tv)); |
774 | else | 774 | else |
775 | TV2MARKED(tv) = (TV2MARKED(tv) & cast_byte(~LJ_GC_COLORS)) | curwhite(g); | 775 | TV2MARKED(tv) = (TV2MARKED(tv) & (uint8_t)~LJ_GC_COLORS) | curwhite(g); |
776 | #undef TV2MARKED | 776 | #undef TV2MARKED |
777 | } | 777 | } |
778 | 778 | ||
diff --git a/src/lj_ir.c b/src/lj_ir.c index 721cfd0f..64467758 100644 --- a/src/lj_ir.c +++ b/src/lj_ir.c | |||
@@ -267,7 +267,7 @@ TRef lj_ir_kint64(jit_State *J, uint64_t u64) | |||
267 | static int numistrueint(lua_Number n, int32_t *kp) | 267 | static int numistrueint(lua_Number n, int32_t *kp) |
268 | { | 268 | { |
269 | int32_t k = lj_num2int(n); | 269 | int32_t k = lj_num2int(n); |
270 | if (n == cast_num(k)) { | 270 | if (n == (lua_Number)k) { |
271 | if (kp) *kp = k; | 271 | if (kp) *kp = k; |
272 | if (k == 0) { /* Special check for -0. */ | 272 | if (k == 0) { /* Special check for -0. */ |
273 | TValue tv; | 273 | TValue tv; |
diff --git a/src/lj_lex.c b/src/lj_lex.c index 78458572..bc029761 100644 --- a/src/lj_lex.c +++ b/src/lj_lex.c | |||
@@ -36,7 +36,7 @@ TKDEF(TKSTR1, TKSTR2) | |||
36 | 36 | ||
37 | /* -- Buffer handling ----------------------------------------------------- */ | 37 | /* -- Buffer handling ----------------------------------------------------- */ |
38 | 38 | ||
39 | #define char2int(c) cast(int, cast(uint8_t, (c))) | 39 | #define char2int(c) ((int)(uint8_t)(c)) |
40 | #define next(ls) \ | 40 | #define next(ls) \ |
41 | (ls->current = (ls->n--) > 0 ? char2int(*ls->p++) : fillbuf(ls)) | 41 | (ls->current = (ls->n--) > 0 ? char2int(*ls->p++) : fillbuf(ls)) |
42 | #define save_and_next(ls) (save(ls, ls->current), next(ls)) | 42 | #define save_and_next(ls) (save(ls, ls->current), next(ls)) |
diff --git a/src/lj_meta.c b/src/lj_meta.c index 48cee510..22301db7 100644 --- a/src/lj_meta.c +++ b/src/lj_meta.c | |||
@@ -291,7 +291,7 @@ TValue *lj_meta_equal(lua_State *L, GCobj *o1, GCobj *o2, int ne) | |||
291 | if (tabref(o1->gch.metatable) != tabref(o2->gch.metatable)) { | 291 | if (tabref(o1->gch.metatable) != tabref(o2->gch.metatable)) { |
292 | cTValue *mo2 = lj_meta_fast(L, tabref(o2->gch.metatable), MM_eq); | 292 | cTValue *mo2 = lj_meta_fast(L, tabref(o2->gch.metatable), MM_eq); |
293 | if (mo2 == NULL || !lj_obj_equal(mo, mo2)) | 293 | if (mo2 == NULL || !lj_obj_equal(mo, mo2)) |
294 | return cast(TValue *, (intptr_t)ne); | 294 | return (TValue *)(intptr_t)ne; |
295 | } | 295 | } |
296 | top = curr_top(L); | 296 | top = curr_top(L); |
297 | setcont(top, ne ? lj_cont_condf : lj_cont_condt); | 297 | setcont(top, ne ? lj_cont_condf : lj_cont_condt); |
@@ -301,7 +301,7 @@ TValue *lj_meta_equal(lua_State *L, GCobj *o1, GCobj *o2, int ne) | |||
301 | setgcV(L, top+3, o2, it); | 301 | setgcV(L, top+3, o2, it); |
302 | return top+2; /* Trigger metamethod call. */ | 302 | return top+2; /* Trigger metamethod call. */ |
303 | } | 303 | } |
304 | return cast(TValue *, (intptr_t)ne); | 304 | return (TValue *)(intptr_t)ne; |
305 | } | 305 | } |
306 | 306 | ||
307 | #if LJ_HASFFI | 307 | #if LJ_HASFFI |
@@ -329,7 +329,7 @@ TValue * LJ_FASTCALL lj_meta_equal_cd(lua_State *L, BCIns ins) | |||
329 | if (LJ_LIKELY(!tvisnil(mo))) | 329 | if (LJ_LIKELY(!tvisnil(mo))) |
330 | return mmcall(L, cont, mo, o1, o2); | 330 | return mmcall(L, cont, mo, o1, o2); |
331 | else | 331 | else |
332 | return cast(TValue *, (intptr_t)(bc_op(ins) & 1)); | 332 | return (TValue *)(intptr_t)(bc_op(ins) & 1); |
333 | } | 333 | } |
334 | #endif | 334 | #endif |
335 | 335 | ||
@@ -345,7 +345,7 @@ TValue *lj_meta_comp(lua_State *L, cTValue *o1, cTValue *o2, int op) | |||
345 | } else if (itype(o1) == itype(o2)) { /* Never called with two numbers. */ | 345 | } else if (itype(o1) == itype(o2)) { /* Never called with two numbers. */ |
346 | if (tvisstr(o1) && tvisstr(o2)) { | 346 | if (tvisstr(o1) && tvisstr(o2)) { |
347 | int32_t res = lj_str_cmp(strV(o1), strV(o2)); | 347 | int32_t res = lj_str_cmp(strV(o1), strV(o2)); |
348 | return cast(TValue *, (intptr_t)(((op&2) ? res <= 0 : res < 0) ^ (op&1))); | 348 | return (TValue *)(intptr_t)(((op&2) ? res <= 0 : res < 0) ^ (op&1)); |
349 | } else { | 349 | } else { |
350 | trymt: | 350 | trymt: |
351 | while (1) { | 351 | while (1) { |
diff --git a/src/lj_opt_fold.c b/src/lj_opt_fold.c index e2d5c517..eb500db9 100644 --- a/src/lj_opt_fold.c +++ b/src/lj_opt_fold.c | |||
@@ -189,7 +189,7 @@ LJFOLD(POW KNUM KINT) | |||
189 | LJFOLDF(kfold_numpow) | 189 | LJFOLDF(kfold_numpow) |
190 | { | 190 | { |
191 | lua_Number a = knumleft; | 191 | lua_Number a = knumleft; |
192 | lua_Number b = cast_num(fright->i); | 192 | lua_Number b = (lua_Number)fright->i; |
193 | lua_Number y = lj_vm_foldarith(a, b, IR_POW - IR_ADD); | 193 | lua_Number y = lj_vm_foldarith(a, b, IR_POW - IR_ADD); |
194 | return lj_ir_knum(J, y); | 194 | return lj_ir_knum(J, y); |
195 | } | 195 | } |
@@ -545,13 +545,13 @@ LJFOLDF(kfold_tobit) | |||
545 | LJFOLD(CONV KINT IRCONV_NUM_INT) | 545 | LJFOLD(CONV KINT IRCONV_NUM_INT) |
546 | LJFOLDF(kfold_conv_kint_num) | 546 | LJFOLDF(kfold_conv_kint_num) |
547 | { | 547 | { |
548 | return lj_ir_knum(J, cast_num(fleft->i)); | 548 | return lj_ir_knum(J, (lua_Number)fleft->i); |
549 | } | 549 | } |
550 | 550 | ||
551 | LJFOLD(CONV KINT IRCONV_NUM_U32) | 551 | LJFOLD(CONV KINT IRCONV_NUM_U32) |
552 | LJFOLDF(kfold_conv_kintu32_num) | 552 | LJFOLDF(kfold_conv_kintu32_num) |
553 | { | 553 | { |
554 | return lj_ir_knum(J, cast_num((uint32_t)fleft->i)); | 554 | return lj_ir_knum(J, (lua_Number)(uint32_t)fleft->i); |
555 | } | 555 | } |
556 | 556 | ||
557 | LJFOLD(CONV KINT IRCONV_I64_INT) | 557 | LJFOLD(CONV KINT IRCONV_I64_INT) |
@@ -567,13 +567,13 @@ LJFOLDF(kfold_conv_kint_i64) | |||
567 | LJFOLD(CONV KINT64 IRCONV_NUM_I64) | 567 | LJFOLD(CONV KINT64 IRCONV_NUM_I64) |
568 | LJFOLDF(kfold_conv_kint64_num_i64) | 568 | LJFOLDF(kfold_conv_kint64_num_i64) |
569 | { | 569 | { |
570 | return lj_ir_knum(J, cast_num((int64_t)ir_kint64(fleft)->u64)); | 570 | return lj_ir_knum(J, (lua_Number)(int64_t)ir_kint64(fleft)->u64); |
571 | } | 571 | } |
572 | 572 | ||
573 | LJFOLD(CONV KINT64 IRCONV_NUM_U64) | 573 | LJFOLD(CONV KINT64 IRCONV_NUM_U64) |
574 | LJFOLDF(kfold_conv_kint64_num_u64) | 574 | LJFOLDF(kfold_conv_kint64_num_u64) |
575 | { | 575 | { |
576 | return lj_ir_knum(J, cast_num(ir_kint64(fleft)->u64)); | 576 | return lj_ir_knum(J, (lua_Number)ir_kint64(fleft)->u64); |
577 | } | 577 | } |
578 | 578 | ||
579 | LJFOLD(CONV KINT64 IRCONV_INT_I64) | 579 | LJFOLD(CONV KINT64 IRCONV_INT_I64) |
@@ -589,7 +589,7 @@ LJFOLDF(kfold_conv_knum_int_num) | |||
589 | lua_Number n = knumleft; | 589 | lua_Number n = knumleft; |
590 | if (!(fins->op2 & IRCONV_TRUNC)) { | 590 | if (!(fins->op2 & IRCONV_TRUNC)) { |
591 | int32_t k = lj_num2int(n); | 591 | int32_t k = lj_num2int(n); |
592 | if (irt_isguard(fins->t) && n != cast_num(k)) { | 592 | if (irt_isguard(fins->t) && n != (lua_Number)k) { |
593 | /* We're about to create a guard which always fails, like CONV +1.5. | 593 | /* We're about to create a guard which always fails, like CONV +1.5. |
594 | ** Some pathological loops cause this during LICM, e.g.: | 594 | ** Some pathological loops cause this during LICM, e.g.: |
595 | ** local x,k,t = 0,1.5,{1,[1.5]=2} | 595 | ** local x,k,t = 0,1.5,{1,[1.5]=2} |
diff --git a/src/lj_state.c b/src/lj_state.c index 11b820b2..cd138f71 100644 --- a/src/lj_state.c +++ b/src/lj_state.c | |||
@@ -181,7 +181,7 @@ lua_State *lj_state_newstate(lua_Alloc f, void *ud) | |||
181 | LUA_API lua_State *lua_newstate(lua_Alloc f, void *ud) | 181 | LUA_API lua_State *lua_newstate(lua_Alloc f, void *ud) |
182 | #endif | 182 | #endif |
183 | { | 183 | { |
184 | GG_State *GG = cast(GG_State *, f(ud, NULL, 0, sizeof(GG_State))); | 184 | GG_State *GG = (GG_State *)f(ud, NULL, 0, sizeof(GG_State)); |
185 | lua_State *L = &GG->L; | 185 | lua_State *L = &GG->L; |
186 | global_State *g = &GG->g; | 186 | global_State *g = &GG->g; |
187 | if (GG == NULL || !checkptr32(GG)) return NULL; | 187 | if (GG == NULL || !checkptr32(GG)) return NULL; |
diff --git a/src/lj_str.c b/src/lj_str.c index febe6fbf..9e9650a2 100644 --- a/src/lj_str.c +++ b/src/lj_str.c | |||
@@ -316,7 +316,7 @@ static void addchar(lua_State *L, SBuf *sb, int c) | |||
316 | MSize sz = sb->sz * 2; | 316 | MSize sz = sb->sz * 2; |
317 | lj_str_resizebuf(L, sb, sz); | 317 | lj_str_resizebuf(L, sb, sz); |
318 | } | 318 | } |
319 | sb->buf[sb->n++] = cast(char, c); | 319 | sb->buf[sb->n++] = (char)c; |
320 | } | 320 | } |
321 | 321 | ||
322 | /* Push formatted message as a string object to Lua stack. va_list variant. */ | 322 | /* Push formatted message as a string object to Lua stack. va_list variant. */ |
diff --git a/src/lj_tab.c b/src/lj_tab.c index c8e4efe1..830e3023 100644 --- a/src/lj_tab.c +++ b/src/lj_tab.c | |||
@@ -580,20 +580,20 @@ static MSize unbound_search(GCtab *t, MSize j) | |||
580 | MSize i = j; /* i is zero or a present index */ | 580 | MSize i = j; /* i is zero or a present index */ |
581 | j++; | 581 | j++; |
582 | /* find `i' and `j' such that i is present and j is not */ | 582 | /* find `i' and `j' such that i is present and j is not */ |
583 | while ((tv = lj_tab_getint(t, cast(int32_t, j))) && !tvisnil(tv)) { | 583 | while ((tv = lj_tab_getint(t, (int32_t)j)) && !tvisnil(tv)) { |
584 | i = j; | 584 | i = j; |
585 | j *= 2; | 585 | j *= 2; |
586 | if (j > (MSize)(INT_MAX-2)) { /* overflow? */ | 586 | if (j > (MSize)(INT_MAX-2)) { /* overflow? */ |
587 | /* table was built with bad purposes: resort to linear search */ | 587 | /* table was built with bad purposes: resort to linear search */ |
588 | i = 1; | 588 | i = 1; |
589 | while ((tv = lj_tab_getint(t, cast(int32_t, i))) && !tvisnil(tv)) i++; | 589 | while ((tv = lj_tab_getint(t, (int32_t)i)) && !tvisnil(tv)) i++; |
590 | return i - 1; | 590 | return i - 1; |
591 | } | 591 | } |
592 | } | 592 | } |
593 | /* now do a binary search between them */ | 593 | /* now do a binary search between them */ |
594 | while (j - i > 1) { | 594 | while (j - i > 1) { |
595 | MSize m = (i+j)/2; | 595 | MSize m = (i+j)/2; |
596 | cTValue *tvb = lj_tab_getint(t, cast(int32_t, m)); | 596 | cTValue *tvb = lj_tab_getint(t, (int32_t)m); |
597 | if (tvb && !tvisnil(tvb)) i = m; else j = m; | 597 | if (tvb && !tvisnil(tvb)) i = m; else j = m; |
598 | } | 598 | } |
599 | return i; | 599 | return i; |