diff options
author | Mike Pall <mike> | 2012-07-03 13:19:32 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2012-07-03 13:19:32 +0200 |
commit | 17d3fc47f30f8d8e62231252ce41f4feba71aa2f (patch) | |
tree | 6134124f9357a0f4ca821556de644337491e4e0b /src | |
parent | c740a302238cf650dd7fef6ebed8aeb878cf0c1d (diff) | |
download | luajit-17d3fc47f30f8d8e62231252ce41f4feba71aa2f.tar.gz luajit-17d3fc47f30f8d8e62231252ce41f4feba71aa2f.tar.bz2 luajit-17d3fc47f30f8d8e62231252ce41f4feba71aa2f.zip |
Avoid pesky compiler warnings about C++ keywords (eh?).
Diffstat (limited to 'src')
-rw-r--r-- | src/lib_base.c | 2 | ||||
-rw-r--r-- | src/lib_ffi.c | 22 | ||||
-rw-r--r-- | src/lj_asm_arm.h | 12 | ||||
-rw-r--r-- | src/lj_asm_mips.h | 10 | ||||
-rw-r--r-- | src/lj_asm_ppc.h | 10 | ||||
-rw-r--r-- | src/lj_asm_x86.h | 8 | ||||
-rw-r--r-- | src/lj_bcwrite.c | 2 | ||||
-rw-r--r-- | src/lj_carith.c | 6 | ||||
-rw-r--r-- | src/lj_ccall.c | 4 | ||||
-rw-r--r-- | src/lj_cconv.c | 2 | ||||
-rw-r--r-- | src/lj_cdata.c | 10 | ||||
-rw-r--r-- | src/lj_cdata.h | 4 | ||||
-rw-r--r-- | src/lj_cparse.c | 56 | ||||
-rw-r--r-- | src/lj_crecord.c | 30 | ||||
-rw-r--r-- | src/lj_ir.h | 2 | ||||
-rw-r--r-- | src/lj_obj.h | 2 | ||||
-rw-r--r-- | src/lj_opt_fold.c | 10 | ||||
-rw-r--r-- | src/lj_parse.c | 2 |
18 files changed, 97 insertions, 97 deletions
diff --git a/src/lib_base.c b/src/lib_base.c index 149aa5cf..7539e92e 100644 --- a/src/lib_base.c +++ b/src/lib_base.c | |||
@@ -198,7 +198,7 @@ LJLIB_ASM(tonumber) LJLIB_REC(.) | |||
198 | #if LJ_HASFFI | 198 | #if LJ_HASFFI |
199 | if (tviscdata(o)) { | 199 | if (tviscdata(o)) { |
200 | CTState *cts = ctype_cts(L); | 200 | CTState *cts = ctype_cts(L); |
201 | CType *ct = lj_ctype_rawref(cts, cdataV(o)->typeid); | 201 | CType *ct = lj_ctype_rawref(cts, cdataV(o)->ctypeid); |
202 | if (ctype_isenum(ct->info)) ct = ctype_child(cts, ct); | 202 | if (ctype_isenum(ct->info)) ct = ctype_child(cts, ct); |
203 | if (ctype_isnum(ct->info) || ctype_iscomplex(ct->info)) { | 203 | if (ctype_isnum(ct->info) || ctype_iscomplex(ct->info)) { |
204 | if (LJ_DUALNUM && ctype_isinteger_or_bool(ct->info) && | 204 | if (LJ_DUALNUM && ctype_isinteger_or_bool(ct->info) && |
diff --git a/src/lib_ffi.c b/src/lib_ffi.c index e7d31fe7..931164b7 100644 --- a/src/lib_ffi.c +++ b/src/lib_ffi.c | |||
@@ -60,7 +60,7 @@ static CTypeID ffi_checkctype(lua_State *L, CTState *cts, TValue *param) | |||
60 | if (!tviscdata(o)) goto err_argtype; | 60 | if (!tviscdata(o)) goto err_argtype; |
61 | if (param && param < L->top) lj_err_arg(L, 1, LJ_ERR_FFI_NUMPARAM); | 61 | if (param && param < L->top) lj_err_arg(L, 1, LJ_ERR_FFI_NUMPARAM); |
62 | cd = cdataV(o); | 62 | cd = cdataV(o); |
63 | return cd->typeid == CTID_CTYPEID ? *(CTypeID *)cdataptr(cd) : cd->typeid; | 63 | return cd->ctypeid == CTID_CTYPEID ? *(CTypeID *)cdataptr(cd) : cd->ctypeid; |
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
@@ -213,11 +213,11 @@ LJLIB_CF(ffi_meta___call) LJLIB_REC(cdata_call) | |||
213 | { | 213 | { |
214 | CTState *cts = ctype_cts(L); | 214 | CTState *cts = ctype_cts(L); |
215 | GCcdata *cd = ffi_checkcdata(L, 1); | 215 | GCcdata *cd = ffi_checkcdata(L, 1); |
216 | CTypeID id = cd->typeid; | 216 | CTypeID id = cd->ctypeid; |
217 | CType *ct; | 217 | CType *ct; |
218 | cTValue *tv; | 218 | cTValue *tv; |
219 | MMS mm = MM_call; | 219 | MMS mm = MM_call; |
220 | if (cd->typeid == CTID_CTYPEID) { | 220 | if (cd->ctypeid == CTID_CTYPEID) { |
221 | id = *(CTypeID *)cdataptr(cd); | 221 | id = *(CTypeID *)cdataptr(cd); |
222 | mm = MM_new; | 222 | mm = MM_new; |
223 | } else { | 223 | } else { |
@@ -276,7 +276,7 @@ LJLIB_CF(ffi_meta___tostring) | |||
276 | { | 276 | { |
277 | GCcdata *cd = ffi_checkcdata(L, 1); | 277 | GCcdata *cd = ffi_checkcdata(L, 1); |
278 | const char *msg = "cdata<%s>: %p"; | 278 | const char *msg = "cdata<%s>: %p"; |
279 | CTypeID id = cd->typeid; | 279 | CTypeID id = cd->ctypeid; |
280 | void *p = cdataptr(cd); | 280 | void *p = cdataptr(cd); |
281 | if (id == CTID_CTYPEID) { | 281 | if (id == CTID_CTYPEID) { |
282 | msg = "ctype<%s>"; | 282 | msg = "ctype<%s>"; |
@@ -340,7 +340,7 @@ LJLIB_CF(ffi_clib___index) LJLIB_REC(clib_index 1) | |||
340 | if (tviscdata(tv)) { | 340 | if (tviscdata(tv)) { |
341 | CTState *cts = ctype_cts(L); | 341 | CTState *cts = ctype_cts(L); |
342 | GCcdata *cd = cdataV(tv); | 342 | GCcdata *cd = cdataV(tv); |
343 | CType *s = ctype_get(cts, cd->typeid); | 343 | CType *s = ctype_get(cts, cd->ctypeid); |
344 | if (ctype_isextern(s->info)) { | 344 | if (ctype_isextern(s->info)) { |
345 | CTypeID sid = ctype_cid(s->info); | 345 | CTypeID sid = ctype_cid(s->info); |
346 | void *sp = *(void **)cdataptr(cd); | 346 | void *sp = *(void **)cdataptr(cd); |
@@ -362,7 +362,7 @@ LJLIB_CF(ffi_clib___newindex) LJLIB_REC(clib_index 0) | |||
362 | if (o < L->top && tviscdata(tv)) { | 362 | if (o < L->top && tviscdata(tv)) { |
363 | CTState *cts = ctype_cts(L); | 363 | CTState *cts = ctype_cts(L); |
364 | GCcdata *cd = cdataV(tv); | 364 | GCcdata *cd = cdataV(tv); |
365 | CType *d = ctype_get(cts, cd->typeid); | 365 | CType *d = ctype_get(cts, cd->ctypeid); |
366 | if (ctype_isextern(d->info)) { | 366 | if (ctype_isextern(d->info)) { |
367 | CTInfo qual = 0; | 367 | CTInfo qual = 0; |
368 | for (;;) { /* Skip attributes and collect qualifiers. */ | 368 | for (;;) { /* Skip attributes and collect qualifiers. */ |
@@ -398,7 +398,7 @@ static int ffi_callback_set(lua_State *L, GCfunc *fn) | |||
398 | { | 398 | { |
399 | GCcdata *cd = ffi_checkcdata(L, 1); | 399 | GCcdata *cd = ffi_checkcdata(L, 1); |
400 | CTState *cts = ctype_cts(L); | 400 | CTState *cts = ctype_cts(L); |
401 | CType *ct = ctype_raw(cts, cd->typeid); | 401 | CType *ct = ctype_raw(cts, cd->ctypeid); |
402 | if (ctype_isptr(ct->info) && (LJ_32 || ct->size == 8)) { | 402 | if (ctype_isptr(ct->info) && (LJ_32 || ct->size == 8)) { |
403 | MSize slot = lj_ccallback_ptr2slot(cts, *(void **)cdataptr(cd)); | 403 | MSize slot = lj_ccallback_ptr2slot(cts, *(void **)cdataptr(cd)); |
404 | if (slot < cts->cb.sizeid && cts->cb.cbid[slot] != 0) { | 404 | if (slot < cts->cb.sizeid && cts->cb.cbid[slot] != 0) { |
@@ -504,7 +504,7 @@ LJLIB_CF(ffi_cast) LJLIB_REC(ffi_new) | |||
504 | L->top = o+1; /* Make sure this is the last item on the stack. */ | 504 | L->top = o+1; /* Make sure this is the last item on the stack. */ |
505 | if (!(ctype_isnum(d->info) || ctype_isptr(d->info) || ctype_isenum(d->info))) | 505 | if (!(ctype_isnum(d->info) || ctype_isptr(d->info) || ctype_isenum(d->info))) |
506 | lj_err_arg(L, 1, LJ_ERR_FFI_INVTYPE); | 506 | lj_err_arg(L, 1, LJ_ERR_FFI_INVTYPE); |
507 | if (!(tviscdata(o) && cdataV(o)->typeid == id)) { | 507 | if (!(tviscdata(o) && cdataV(o)->ctypeid == id)) { |
508 | GCcdata *cd = lj_cdata_new(cts, id, d->size); | 508 | GCcdata *cd = lj_cdata_new(cts, id, d->size); |
509 | lj_cconv_ct_tv(cts, d, cdataptr(cd), o, CCF_CAST); | 509 | lj_cconv_ct_tv(cts, d, cdataptr(cd), o, CCF_CAST); |
510 | setcdataV(L, o, cd); | 510 | setcdataV(L, o, cd); |
@@ -532,8 +532,8 @@ LJLIB_CF(ffi_istype) LJLIB_REC(ffi_istype) | |||
532 | int b = 0; | 532 | int b = 0; |
533 | if (tviscdata(o)) { | 533 | if (tviscdata(o)) { |
534 | GCcdata *cd = cdataV(o); | 534 | GCcdata *cd = cdataV(o); |
535 | CTypeID id2 = cd->typeid == CTID_CTYPEID ? *(CTypeID *)cdataptr(cd) : | 535 | CTypeID id2 = cd->ctypeid == CTID_CTYPEID ? *(CTypeID *)cdataptr(cd) : |
536 | cd->typeid; | 536 | cd->ctypeid; |
537 | CType *ct1 = lj_ctype_rawref(cts, id1); | 537 | CType *ct1 = lj_ctype_rawref(cts, id1); |
538 | CType *ct2 = lj_ctype_rawref(cts, id2); | 538 | CType *ct2 = lj_ctype_rawref(cts, id2); |
539 | if (ct1 == ct2) { | 539 | if (ct1 == ct2) { |
@@ -735,7 +735,7 @@ LJLIB_CF(ffi_gc) | |||
735 | TValue *fin = lj_lib_checkany(L, 2); | 735 | TValue *fin = lj_lib_checkany(L, 2); |
736 | CTState *cts = ctype_cts(L); | 736 | CTState *cts = ctype_cts(L); |
737 | GCtab *t = cts->finalizer; | 737 | GCtab *t = cts->finalizer; |
738 | CType *ct = ctype_raw(cts, cd->typeid); | 738 | CType *ct = ctype_raw(cts, cd->ctypeid); |
739 | if (!(ctype_isptr(ct->info) || ctype_isstruct(ct->info) || | 739 | if (!(ctype_isptr(ct->info) || ctype_isstruct(ct->info) || |
740 | ctype_isrefarray(ct->info))) | 740 | ctype_isrefarray(ct->info))) |
741 | lj_err_arg(L, 1, LJ_ERR_FFI_INVTYPE); | 741 | lj_err_arg(L, 1, LJ_ERR_FFI_INVTYPE); |
diff --git a/src/lj_asm_arm.h b/src/lj_asm_arm.h index 19250254..d5a242e7 100644 --- a/src/lj_asm_arm.h +++ b/src/lj_asm_arm.h | |||
@@ -947,9 +947,9 @@ static void asm_sload(ASMState *as, IRIns *ir) | |||
947 | static void asm_cnew(ASMState *as, IRIns *ir) | 947 | static void asm_cnew(ASMState *as, IRIns *ir) |
948 | { | 948 | { |
949 | CTState *cts = ctype_ctsG(J2G(as->J)); | 949 | CTState *cts = ctype_ctsG(J2G(as->J)); |
950 | CTypeID typeid = (CTypeID)IR(ir->op1)->i; | 950 | CTypeID ctypeid = (CTypeID)IR(ir->op1)->i; |
951 | CTSize sz = (ir->o == IR_CNEWI || ir->op2 == REF_NIL) ? | 951 | CTSize sz = (ir->o == IR_CNEWI || ir->op2 == REF_NIL) ? |
952 | lj_ctype_size(cts, typeid) : (CTSize)IR(ir->op2)->i; | 952 | lj_ctype_size(cts, ctypeid) : (CTSize)IR(ir->op2)->i; |
953 | const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_mem_newgco]; | 953 | const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_mem_newgco]; |
954 | IRRef args[2]; | 954 | IRRef args[2]; |
955 | RegSet allow = (RSET_GPR & ~RSET_SCRATCH); | 955 | RegSet allow = (RSET_GPR & ~RSET_SCRATCH); |
@@ -982,12 +982,12 @@ static void asm_cnew(ASMState *as, IRIns *ir) | |||
982 | ofs -= 4; ir--; | 982 | ofs -= 4; ir--; |
983 | } | 983 | } |
984 | } | 984 | } |
985 | /* Initialize gct and typeid. lj_mem_newgco() already sets marked. */ | 985 | /* Initialize gct and ctypeid. lj_mem_newgco() already sets marked. */ |
986 | { | 986 | { |
987 | uint32_t k = emit_isk12(ARMI_MOV, typeid); | 987 | uint32_t k = emit_isk12(ARMI_MOV, ctypeid); |
988 | Reg r = k ? RID_R1 : ra_allock(as, typeid, allow); | 988 | Reg r = k ? RID_R1 : ra_allock(as, ctypeid, allow); |
989 | emit_lso(as, ARMI_STRB, RID_TMP, RID_RET, offsetof(GCcdata, gct)); | 989 | emit_lso(as, ARMI_STRB, RID_TMP, RID_RET, offsetof(GCcdata, gct)); |
990 | emit_lsox(as, ARMI_STRH, r, RID_RET, offsetof(GCcdata, typeid)); | 990 | emit_lsox(as, ARMI_STRH, r, RID_RET, offsetof(GCcdata, ctypeid)); |
991 | emit_d(as, ARMI_MOV|ARMI_K12|~LJ_TCDATA, RID_TMP); | 991 | emit_d(as, ARMI_MOV|ARMI_K12|~LJ_TCDATA, RID_TMP); |
992 | if (k) emit_d(as, ARMI_MOV^k, RID_R1); | 992 | if (k) emit_d(as, ARMI_MOV^k, RID_R1); |
993 | } | 993 | } |
diff --git a/src/lj_asm_mips.h b/src/lj_asm_mips.h index def3eb2a..0adc2f6b 100644 --- a/src/lj_asm_mips.h +++ b/src/lj_asm_mips.h | |||
@@ -1043,9 +1043,9 @@ dotypecheck: | |||
1043 | static void asm_cnew(ASMState *as, IRIns *ir) | 1043 | static void asm_cnew(ASMState *as, IRIns *ir) |
1044 | { | 1044 | { |
1045 | CTState *cts = ctype_ctsG(J2G(as->J)); | 1045 | CTState *cts = ctype_ctsG(J2G(as->J)); |
1046 | CTypeID typeid = (CTypeID)IR(ir->op1)->i; | 1046 | CTypeID ctypeid = (CTypeID)IR(ir->op1)->i; |
1047 | CTSize sz = (ir->o == IR_CNEWI || ir->op2 == REF_NIL) ? | 1047 | CTSize sz = (ir->o == IR_CNEWI || ir->op2 == REF_NIL) ? |
1048 | lj_ctype_size(cts, typeid) : (CTSize)IR(ir->op2)->i; | 1048 | lj_ctype_size(cts, ctypeid) : (CTSize)IR(ir->op2)->i; |
1049 | const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_mem_newgco]; | 1049 | const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_mem_newgco]; |
1050 | IRRef args[2]; | 1050 | IRRef args[2]; |
1051 | RegSet allow = (RSET_GPR & ~RSET_SCRATCH); | 1051 | RegSet allow = (RSET_GPR & ~RSET_SCRATCH); |
@@ -1079,11 +1079,11 @@ static void asm_cnew(ASMState *as, IRIns *ir) | |||
1079 | ofs -= 4; if (LJ_BE) ir++; else ir--; | 1079 | ofs -= 4; if (LJ_BE) ir++; else ir--; |
1080 | } | 1080 | } |
1081 | } | 1081 | } |
1082 | /* Initialize gct and typeid. lj_mem_newgco() already sets marked. */ | 1082 | /* Initialize gct and ctypeid. lj_mem_newgco() already sets marked. */ |
1083 | emit_tsi(as, MIPSI_SB, RID_RET+1, RID_RET, offsetof(GCcdata, gct)); | 1083 | emit_tsi(as, MIPSI_SB, RID_RET+1, RID_RET, offsetof(GCcdata, gct)); |
1084 | emit_tsi(as, MIPSI_SH, RID_TMP, RID_RET, offsetof(GCcdata, typeid)); | 1084 | emit_tsi(as, MIPSI_SH, RID_TMP, RID_RET, offsetof(GCcdata, ctypeid)); |
1085 | emit_ti(as, MIPSI_LI, RID_RET+1, ~LJ_TCDATA); | 1085 | emit_ti(as, MIPSI_LI, RID_RET+1, ~LJ_TCDATA); |
1086 | emit_ti(as, MIPSI_LI, RID_TMP, typeid); /* Lower 16 bit used. Sign-ext ok. */ | 1086 | emit_ti(as, MIPSI_LI, RID_TMP, ctypeid); /* Lower 16 bit used. Sign-ext ok. */ |
1087 | asm_gencall(as, ci, args); | 1087 | asm_gencall(as, ci, args); |
1088 | ra_allockreg(as, (int32_t)(sz+sizeof(GCcdata)), | 1088 | ra_allockreg(as, (int32_t)(sz+sizeof(GCcdata)), |
1089 | ra_releasetmp(as, ASMREF_TMP1)); | 1089 | ra_releasetmp(as, ASMREF_TMP1)); |
diff --git a/src/lj_asm_ppc.h b/src/lj_asm_ppc.h index 142ef212..85b87bd5 100644 --- a/src/lj_asm_ppc.h +++ b/src/lj_asm_ppc.h | |||
@@ -1086,9 +1086,9 @@ dotypecheck: | |||
1086 | static void asm_cnew(ASMState *as, IRIns *ir) | 1086 | static void asm_cnew(ASMState *as, IRIns *ir) |
1087 | { | 1087 | { |
1088 | CTState *cts = ctype_ctsG(J2G(as->J)); | 1088 | CTState *cts = ctype_ctsG(J2G(as->J)); |
1089 | CTypeID typeid = (CTypeID)IR(ir->op1)->i; | 1089 | CTypeID ctypeid = (CTypeID)IR(ir->op1)->i; |
1090 | CTSize sz = (ir->o == IR_CNEWI || ir->op2 == REF_NIL) ? | 1090 | CTSize sz = (ir->o == IR_CNEWI || ir->op2 == REF_NIL) ? |
1091 | lj_ctype_size(cts, typeid) : (CTSize)IR(ir->op2)->i; | 1091 | lj_ctype_size(cts, ctypeid) : (CTSize)IR(ir->op2)->i; |
1092 | const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_mem_newgco]; | 1092 | const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_mem_newgco]; |
1093 | IRRef args[2]; | 1093 | IRRef args[2]; |
1094 | RegSet allow = (RSET_GPR & ~RSET_SCRATCH); | 1094 | RegSet allow = (RSET_GPR & ~RSET_SCRATCH); |
@@ -1121,11 +1121,11 @@ static void asm_cnew(ASMState *as, IRIns *ir) | |||
1121 | ofs -= 4; ir++; | 1121 | ofs -= 4; ir++; |
1122 | } | 1122 | } |
1123 | } | 1123 | } |
1124 | /* Initialize gct and typeid. lj_mem_newgco() already sets marked. */ | 1124 | /* Initialize gct and ctypeid. lj_mem_newgco() already sets marked. */ |
1125 | emit_tai(as, PPCI_STB, RID_RET+1, RID_RET, offsetof(GCcdata, gct)); | 1125 | emit_tai(as, PPCI_STB, RID_RET+1, RID_RET, offsetof(GCcdata, gct)); |
1126 | emit_tai(as, PPCI_STH, RID_TMP, RID_RET, offsetof(GCcdata, typeid)); | 1126 | emit_tai(as, PPCI_STH, RID_TMP, RID_RET, offsetof(GCcdata, ctypeid)); |
1127 | emit_ti(as, PPCI_LI, RID_RET+1, ~LJ_TCDATA); | 1127 | emit_ti(as, PPCI_LI, RID_RET+1, ~LJ_TCDATA); |
1128 | emit_ti(as, PPCI_LI, RID_TMP, typeid); /* Lower 16 bit used. Sign-ext ok. */ | 1128 | emit_ti(as, PPCI_LI, RID_TMP, ctypeid); /* Lower 16 bit used. Sign-ext ok. */ |
1129 | asm_gencall(as, ci, args); | 1129 | asm_gencall(as, ci, args); |
1130 | ra_allockreg(as, (int32_t)(sz+sizeof(GCcdata)), | 1130 | ra_allockreg(as, (int32_t)(sz+sizeof(GCcdata)), |
1131 | ra_releasetmp(as, ASMREF_TMP1)); | 1131 | ra_releasetmp(as, ASMREF_TMP1)); |
diff --git a/src/lj_asm_x86.h b/src/lj_asm_x86.h index ae14b3b6..59c808c4 100644 --- a/src/lj_asm_x86.h +++ b/src/lj_asm_x86.h | |||
@@ -1476,9 +1476,9 @@ static void asm_sload(ASMState *as, IRIns *ir) | |||
1476 | static void asm_cnew(ASMState *as, IRIns *ir) | 1476 | static void asm_cnew(ASMState *as, IRIns *ir) |
1477 | { | 1477 | { |
1478 | CTState *cts = ctype_ctsG(J2G(as->J)); | 1478 | CTState *cts = ctype_ctsG(J2G(as->J)); |
1479 | CTypeID typeid = (CTypeID)IR(ir->op1)->i; | 1479 | CTypeID ctypeid = (CTypeID)IR(ir->op1)->i; |
1480 | CTSize sz = (ir->o == IR_CNEWI || ir->op2 == REF_NIL) ? | 1480 | CTSize sz = (ir->o == IR_CNEWI || ir->op2 == REF_NIL) ? |
1481 | lj_ctype_size(cts, typeid) : (CTSize)IR(ir->op2)->i; | 1481 | lj_ctype_size(cts, ctypeid) : (CTSize)IR(ir->op2)->i; |
1482 | const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_mem_newgco]; | 1482 | const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_mem_newgco]; |
1483 | IRRef args[2]; | 1483 | IRRef args[2]; |
1484 | lua_assert(sz != CTSIZE_INVALID); | 1484 | lua_assert(sz != CTSIZE_INVALID); |
@@ -1529,10 +1529,10 @@ static void asm_cnew(ASMState *as, IRIns *ir) | |||
1529 | lua_assert(sz == 4 || sz == 8); | 1529 | lua_assert(sz == 4 || sz == 8); |
1530 | } | 1530 | } |
1531 | 1531 | ||
1532 | /* Combine initialization of marked, gct and typeid. */ | 1532 | /* Combine initialization of marked, gct and ctypeid. */ |
1533 | emit_movtomro(as, RID_ECX, RID_RET, offsetof(GCcdata, marked)); | 1533 | emit_movtomro(as, RID_ECX, RID_RET, offsetof(GCcdata, marked)); |
1534 | emit_gri(as, XG_ARITHi(XOg_OR), RID_ECX, | 1534 | emit_gri(as, XG_ARITHi(XOg_OR), RID_ECX, |
1535 | (int32_t)((~LJ_TCDATA<<8)+(typeid<<16))); | 1535 | (int32_t)((~LJ_TCDATA<<8)+(ctypeid<<16))); |
1536 | emit_gri(as, XG_ARITHi(XOg_AND), RID_ECX, LJ_GC_WHITES); | 1536 | emit_gri(as, XG_ARITHi(XOg_AND), RID_ECX, LJ_GC_WHITES); |
1537 | emit_opgl(as, XO_MOVZXb, RID_ECX, gc.currentwhite); | 1537 | emit_opgl(as, XO_MOVZXb, RID_ECX, gc.currentwhite); |
1538 | 1538 | ||
diff --git a/src/lj_bcwrite.c b/src/lj_bcwrite.c index 4ea868a0..27f08fe8 100644 --- a/src/lj_bcwrite.c +++ b/src/lj_bcwrite.c | |||
@@ -164,7 +164,7 @@ static void bcwrite_kgc(BCWriteCtx *ctx, GCproto *pt) | |||
164 | tp = BCDUMP_KGC_CHILD; | 164 | tp = BCDUMP_KGC_CHILD; |
165 | #if LJ_HASFFI | 165 | #if LJ_HASFFI |
166 | } else if (o->gch.gct == ~LJ_TCDATA) { | 166 | } else if (o->gch.gct == ~LJ_TCDATA) { |
167 | CTypeID id = gco2cd(o)->typeid; | 167 | CTypeID id = gco2cd(o)->ctypeid; |
168 | need = 1+4*5; | 168 | need = 1+4*5; |
169 | if (id == CTID_INT64) { | 169 | if (id == CTID_INT64) { |
170 | tp = BCDUMP_KGC_I64; | 170 | tp = BCDUMP_KGC_I64; |
diff --git a/src/lj_carith.c b/src/lj_carith.c index 583a3876..e1abf6e6 100644 --- a/src/lj_carith.c +++ b/src/lj_carith.c | |||
@@ -35,7 +35,7 @@ static int carith_checkarg(lua_State *L, CTState *cts, CDArith *ca) | |||
35 | for (i = 0; i < 2; i++, o++) { | 35 | for (i = 0; i < 2; i++, o++) { |
36 | if (tviscdata(o)) { | 36 | if (tviscdata(o)) { |
37 | GCcdata *cd = cdataV(o); | 37 | GCcdata *cd = cdataV(o); |
38 | CTypeID id = (CTypeID)cd->typeid; | 38 | CTypeID id = (CTypeID)cd->ctypeid; |
39 | CType *ct = ctype_raw(cts, id); | 39 | CType *ct = ctype_raw(cts, id); |
40 | uint8_t *p = (uint8_t *)cdataptr(cd); | 40 | uint8_t *p = (uint8_t *)cdataptr(cd); |
41 | if (ctype_isptr(ct->info)) { | 41 | if (ctype_isptr(ct->info)) { |
@@ -199,9 +199,9 @@ static int lj_carith_meta(lua_State *L, CTState *cts, CDArith *ca, MMS mm) | |||
199 | { | 199 | { |
200 | cTValue *tv = NULL; | 200 | cTValue *tv = NULL; |
201 | if (tviscdata(L->base)) | 201 | if (tviscdata(L->base)) |
202 | tv = lj_ctype_meta(cts, cdataV(L->base)->typeid, mm); | 202 | tv = lj_ctype_meta(cts, cdataV(L->base)->ctypeid, mm); |
203 | if (!tv && L->base+1 < L->top && tviscdata(L->base+1)) | 203 | if (!tv && L->base+1 < L->top && tviscdata(L->base+1)) |
204 | tv = lj_ctype_meta(cts, cdataV(L->base+1)->typeid, mm); | 204 | tv = lj_ctype_meta(cts, cdataV(L->base+1)->ctypeid, mm); |
205 | if (!tv) { | 205 | if (!tv) { |
206 | const char *repr[2]; | 206 | const char *repr[2]; |
207 | int i; | 207 | int i; |
diff --git a/src/lj_ccall.c b/src/lj_ccall.c index eb9f709c..22171778 100644 --- a/src/lj_ccall.c +++ b/src/lj_ccall.c | |||
@@ -461,7 +461,7 @@ CTypeID lj_ccall_ctid_vararg(CTState *cts, cTValue *o) | |||
461 | if (tvisnumber(o)) { | 461 | if (tvisnumber(o)) { |
462 | return CTID_DOUBLE; | 462 | return CTID_DOUBLE; |
463 | } else if (tviscdata(o)) { | 463 | } else if (tviscdata(o)) { |
464 | CTypeID id = cdataV(o)->typeid; | 464 | CTypeID id = cdataV(o)->ctypeid; |
465 | CType *s = ctype_get(cts, id); | 465 | CType *s = ctype_get(cts, id); |
466 | if (ctype_isrefarray(s->info)) { | 466 | if (ctype_isrefarray(s->info)) { |
467 | return lj_ctype_intern(cts, | 467 | return lj_ctype_intern(cts, |
@@ -692,7 +692,7 @@ static int ccall_get_results(lua_State *L, CTState *cts, CType *ct, | |||
692 | int lj_ccall_func(lua_State *L, GCcdata *cd) | 692 | int lj_ccall_func(lua_State *L, GCcdata *cd) |
693 | { | 693 | { |
694 | CTState *cts = ctype_cts(L); | 694 | CTState *cts = ctype_cts(L); |
695 | CType *ct = ctype_raw(cts, cd->typeid); | 695 | CType *ct = ctype_raw(cts, cd->ctypeid); |
696 | CTSize sz = CTSIZE_PTR; | 696 | CTSize sz = CTSIZE_PTR; |
697 | if (ctype_isptr(ct->info)) { | 697 | if (ctype_isptr(ct->info)) { |
698 | sz = ct->size; | 698 | sz = ct->size; |
diff --git a/src/lj_cconv.c b/src/lj_cconv.c index b09c0abe..97091d08 100644 --- a/src/lj_cconv.c +++ b/src/lj_cconv.c | |||
@@ -547,7 +547,7 @@ void lj_cconv_ct_tv(CTState *cts, CType *d, | |||
547 | flags |= CCF_FROMTV; | 547 | flags |= CCF_FROMTV; |
548 | } else if (tviscdata(o)) { | 548 | } else if (tviscdata(o)) { |
549 | sp = cdataptr(cdataV(o)); | 549 | sp = cdataptr(cdataV(o)); |
550 | sid = cdataV(o)->typeid; | 550 | sid = cdataV(o)->ctypeid; |
551 | s = ctype_get(cts, sid); | 551 | s = ctype_get(cts, sid); |
552 | if (ctype_isref(s->info)) { /* Resolve reference for value. */ | 552 | if (ctype_isref(s->info)) { /* Resolve reference for value. */ |
553 | lua_assert(s->size == CTSIZE_PTR); | 553 | lua_assert(s->size == CTSIZE_PTR); |
diff --git a/src/lj_cdata.c b/src/lj_cdata.c index b477ce77..461b55a2 100644 --- a/src/lj_cdata.c +++ b/src/lj_cdata.c | |||
@@ -46,7 +46,7 @@ GCcdata *lj_cdata_newv(CTState *cts, CTypeID id, CTSize sz, CTSize align) | |||
46 | newwhite(g, obj2gco(cd)); | 46 | newwhite(g, obj2gco(cd)); |
47 | cd->marked |= 0x80; | 47 | cd->marked |= 0x80; |
48 | cd->gct = ~LJ_TCDATA; | 48 | cd->gct = ~LJ_TCDATA; |
49 | cd->typeid = id; | 49 | cd->ctypeid = id; |
50 | return cd; | 50 | return cd; |
51 | } | 51 | } |
52 | 52 | ||
@@ -66,7 +66,7 @@ void LJ_FASTCALL lj_cdata_free(global_State *g, GCcdata *cd) | |||
66 | setgcref(g->gc.mmudata, obj2gco(cd)); | 66 | setgcref(g->gc.mmudata, obj2gco(cd)); |
67 | } | 67 | } |
68 | } else if (LJ_LIKELY(!cdataisv(cd))) { | 68 | } else if (LJ_LIKELY(!cdataisv(cd))) { |
69 | CType *ct = ctype_raw(ctype_ctsG(g), cd->typeid); | 69 | CType *ct = ctype_raw(ctype_ctsG(g), cd->ctypeid); |
70 | CTSize sz = ctype_hassize(ct->info) ? ct->size : CTSIZE_PTR; | 70 | CTSize sz = ctype_hassize(ct->info) ? ct->size : CTSIZE_PTR; |
71 | lua_assert(ctype_hassize(ct->info) || ctype_isfunc(ct->info) || | 71 | lua_assert(ctype_hassize(ct->info) || ctype_isfunc(ct->info) || |
72 | ctype_isextern(ct->info)); | 72 | ctype_isextern(ct->info)); |
@@ -101,7 +101,7 @@ CType *lj_cdata_index(CTState *cts, GCcdata *cd, cTValue *key, uint8_t **pp, | |||
101 | CTInfo *qual) | 101 | CTInfo *qual) |
102 | { | 102 | { |
103 | uint8_t *p = (uint8_t *)cdataptr(cd); | 103 | uint8_t *p = (uint8_t *)cdataptr(cd); |
104 | CType *ct = ctype_get(cts, cd->typeid); | 104 | CType *ct = ctype_get(cts, cd->ctypeid); |
105 | ptrdiff_t idx; | 105 | ptrdiff_t idx; |
106 | 106 | ||
107 | /* Resolve reference for cdata object. */ | 107 | /* Resolve reference for cdata object. */ |
@@ -140,7 +140,7 @@ collect_attrib: | |||
140 | } | 140 | } |
141 | } else if (tviscdata(key)) { /* Integer cdata key. */ | 141 | } else if (tviscdata(key)) { /* Integer cdata key. */ |
142 | GCcdata *cdk = cdataV(key); | 142 | GCcdata *cdk = cdataV(key); |
143 | CType *ctk = ctype_raw(cts, cdk->typeid); | 143 | CType *ctk = ctype_raw(cts, cdk->ctypeid); |
144 | if (ctype_isenum(ctk->info)) ctk = ctype_child(cts, ctk); | 144 | if (ctype_isenum(ctk->info)) ctk = ctype_child(cts, ctk); |
145 | if (ctype_isinteger(ctk->info)) { | 145 | if (ctype_isinteger(ctk->info)) { |
146 | lj_cconv_ct_ct(cts, ctype_get(cts, CTID_INT_PSZ), ctk, | 146 | lj_cconv_ct_ct(cts, ctype_get(cts, CTID_INT_PSZ), ctk, |
@@ -167,7 +167,7 @@ collect_attrib: | |||
167 | return ct; | 167 | return ct; |
168 | } | 168 | } |
169 | } | 169 | } |
170 | } else if (cd->typeid == CTID_CTYPEID) { | 170 | } else if (cd->ctypeid == CTID_CTYPEID) { |
171 | /* Allow indexing a (pointer to) struct constructor to get constants. */ | 171 | /* Allow indexing a (pointer to) struct constructor to get constants. */ |
172 | CType *sct = ctype_raw(cts, *(CTypeID *)p); | 172 | CType *sct = ctype_raw(cts, *(CTypeID *)p); |
173 | if (ctype_isptr(sct->info)) | 173 | if (ctype_isptr(sct->info)) |
diff --git a/src/lj_cdata.h b/src/lj_cdata.h index 4618bc99..31329266 100644 --- a/src/lj_cdata.h +++ b/src/lj_cdata.h | |||
@@ -44,7 +44,7 @@ static LJ_AINLINE GCcdata *lj_cdata_new(CTState *cts, CTypeID id, CTSize sz) | |||
44 | #endif | 44 | #endif |
45 | cd = (GCcdata *)lj_mem_newgco(cts->L, sizeof(GCcdata) + sz); | 45 | cd = (GCcdata *)lj_mem_newgco(cts->L, sizeof(GCcdata) + sz); |
46 | cd->gct = ~LJ_TCDATA; | 46 | cd->gct = ~LJ_TCDATA; |
47 | cd->typeid = ctype_check(cts, id); | 47 | cd->ctypeid = ctype_check(cts, id); |
48 | return cd; | 48 | return cd; |
49 | } | 49 | } |
50 | 50 | ||
@@ -53,7 +53,7 @@ static LJ_AINLINE GCcdata *lj_cdata_new_(lua_State *L, CTypeID id, CTSize sz) | |||
53 | { | 53 | { |
54 | GCcdata *cd = (GCcdata *)lj_mem_newgco(L, sizeof(GCcdata) + sz); | 54 | GCcdata *cd = (GCcdata *)lj_mem_newgco(L, sizeof(GCcdata) + sz); |
55 | cd->gct = ~LJ_TCDATA; | 55 | cd->gct = ~LJ_TCDATA; |
56 | cd->typeid = id; | 56 | cd->ctypeid = id; |
57 | return cd; | 57 | return cd; |
58 | } | 58 | } |
59 | 59 | ||
diff --git a/src/lj_cparse.c b/src/lj_cparse.c index 0c02c160..d9f66227 100644 --- a/src/lj_cparse.c +++ b/src/lj_cparse.c | |||
@@ -227,10 +227,10 @@ static CPToken cp_param(CPState *cp) | |||
227 | GCcdata *cd; | 227 | GCcdata *cd; |
228 | if (!tviscdata(o)) lj_err_argtype(cp->L, o-cp->L->base+1, "type parameter"); | 228 | if (!tviscdata(o)) lj_err_argtype(cp->L, o-cp->L->base+1, "type parameter"); |
229 | cd = cdataV(o); | 229 | cd = cdataV(o); |
230 | if (cd->typeid == CTID_CTYPEID) | 230 | if (cd->ctypeid == CTID_CTYPEID) |
231 | cp->val.id = *(CTypeID *)cdataptr(cd); | 231 | cp->val.id = *(CTypeID *)cdataptr(cd); |
232 | else | 232 | else |
233 | cp->val.id = cd->typeid; | 233 | cp->val.id = cd->ctypeid; |
234 | return '$'; | 234 | return '$'; |
235 | } | 235 | } |
236 | } | 236 | } |
@@ -970,16 +970,16 @@ static void cp_decl_reset(CPDecl *decl) | |||
970 | 970 | ||
971 | /* Parse constant initializer. */ | 971 | /* Parse constant initializer. */ |
972 | /* NYI: FP constants and strings as initializers. */ | 972 | /* NYI: FP constants and strings as initializers. */ |
973 | static CTypeID cp_decl_constinit(CPState *cp, CType **ctp, CTypeID typeid) | 973 | static CTypeID cp_decl_constinit(CPState *cp, CType **ctp, CTypeID ctypeid) |
974 | { | 974 | { |
975 | CType *ctt = ctype_get(cp->cts, typeid); | 975 | CType *ctt = ctype_get(cp->cts, ctypeid); |
976 | CTInfo info; | 976 | CTInfo info; |
977 | CTSize size; | 977 | CTSize size; |
978 | CPValue k; | 978 | CPValue k; |
979 | CTypeID constid; | 979 | CTypeID constid; |
980 | while (ctype_isattrib(ctt->info)) { /* Skip attributes. */ | 980 | while (ctype_isattrib(ctt->info)) { /* Skip attributes. */ |
981 | typeid = ctype_cid(ctt->info); /* Update ID, too. */ | 981 | ctypeid = ctype_cid(ctt->info); /* Update ID, too. */ |
982 | ctt = ctype_get(cp->cts, typeid); | 982 | ctt = ctype_get(cp->cts, ctypeid); |
983 | } | 983 | } |
984 | info = ctt->info; | 984 | info = ctt->info; |
985 | size = ctt->size; | 985 | size = ctt->size; |
@@ -988,7 +988,7 @@ static CTypeID cp_decl_constinit(CPState *cp, CType **ctp, CTypeID typeid) | |||
988 | cp_check(cp, '='); | 988 | cp_check(cp, '='); |
989 | cp_expr_sub(cp, &k, 0); | 989 | cp_expr_sub(cp, &k, 0); |
990 | constid = lj_ctype_new(cp->cts, ctp); | 990 | constid = lj_ctype_new(cp->cts, ctp); |
991 | (*ctp)->info = CTINFO(CT_CONSTVAL, CTF_CONST|typeid); | 991 | (*ctp)->info = CTINFO(CT_CONSTVAL, CTF_CONST|ctypeid); |
992 | k.u32 <<= 8*(4-size); | 992 | k.u32 <<= 8*(4-size); |
993 | if ((info & CTF_UNSIGNED)) | 993 | if ((info & CTF_UNSIGNED)) |
994 | k.u32 >>= 8*(4-size); | 994 | k.u32 >>= 8*(4-size); |
@@ -1352,18 +1352,18 @@ static CTypeID cp_decl_struct(CPState *cp, CPDecl *sdecl, CTInfo sinfo) | |||
1352 | CPARSE_MODE_DIRECT|CPARSE_MODE_ABSTRACT|CPARSE_MODE_FIELD; | 1352 | CPARSE_MODE_DIRECT|CPARSE_MODE_ABSTRACT|CPARSE_MODE_FIELD; |
1353 | 1353 | ||
1354 | for (;;) { | 1354 | for (;;) { |
1355 | CTypeID typeid; | 1355 | CTypeID ctypeid; |
1356 | 1356 | ||
1357 | if (lastdecl) cp_err_token(cp, '}'); | 1357 | if (lastdecl) cp_err_token(cp, '}'); |
1358 | 1358 | ||
1359 | /* Parse field declarator. */ | 1359 | /* Parse field declarator. */ |
1360 | decl.bits = CTSIZE_INVALID; | 1360 | decl.bits = CTSIZE_INVALID; |
1361 | cp_declarator(cp, &decl); | 1361 | cp_declarator(cp, &decl); |
1362 | typeid = cp_decl_intern(cp, &decl); | 1362 | ctypeid = cp_decl_intern(cp, &decl); |
1363 | 1363 | ||
1364 | if ((scl & CDF_STATIC)) { /* Static constant in struct namespace. */ | 1364 | if ((scl & CDF_STATIC)) { /* Static constant in struct namespace. */ |
1365 | CType *ct; | 1365 | CType *ct; |
1366 | CTypeID fieldid = cp_decl_constinit(cp, &ct, typeid); | 1366 | CTypeID fieldid = cp_decl_constinit(cp, &ct, ctypeid); |
1367 | ctype_get(cp->cts, lastid)->sib = fieldid; | 1367 | ctype_get(cp->cts, lastid)->sib = fieldid; |
1368 | lastid = fieldid; | 1368 | lastid = fieldid; |
1369 | ctype_setname(ct, decl.name); | 1369 | ctype_setname(ct, decl.name); |
@@ -1371,7 +1371,7 @@ static CTypeID cp_decl_struct(CPState *cp, CPDecl *sdecl, CTInfo sinfo) | |||
1371 | CTSize bsz = CTBSZ_FIELD; /* Temp. for layout phase. */ | 1371 | CTSize bsz = CTBSZ_FIELD; /* Temp. for layout phase. */ |
1372 | CType *ct; | 1372 | CType *ct; |
1373 | CTypeID fieldid = lj_ctype_new(cp->cts, &ct); /* Do this first. */ | 1373 | CTypeID fieldid = lj_ctype_new(cp->cts, &ct); /* Do this first. */ |
1374 | CType *tct = ctype_raw(cp->cts, typeid); | 1374 | CType *tct = ctype_raw(cp->cts, ctypeid); |
1375 | 1375 | ||
1376 | if (decl.bits == CTSIZE_INVALID) { /* Regular field. */ | 1376 | if (decl.bits == CTSIZE_INVALID) { /* Regular field. */ |
1377 | if (ctype_isarray(tct->info) && tct->size == CTSIZE_INVALID) | 1377 | if (ctype_isarray(tct->info) && tct->size == CTSIZE_INVALID) |
@@ -1382,7 +1382,7 @@ static CTypeID cp_decl_struct(CPState *cp, CPDecl *sdecl, CTInfo sinfo) | |||
1382 | if (!((ctype_isstruct(tct->info) && !(tct->info & CTF_VLA)) || | 1382 | if (!((ctype_isstruct(tct->info) && !(tct->info & CTF_VLA)) || |
1383 | ctype_isenum(tct->info))) | 1383 | ctype_isenum(tct->info))) |
1384 | cp_err_token(cp, CTOK_IDENT); | 1384 | cp_err_token(cp, CTOK_IDENT); |
1385 | ct->info = CTINFO(CT_ATTRIB, CTATTRIB(CTA_SUBTYPE) + typeid); | 1385 | ct->info = CTINFO(CT_ATTRIB, CTATTRIB(CTA_SUBTYPE) + ctypeid); |
1386 | ct->size = ctype_isstruct(tct->info) ? | 1386 | ct->size = ctype_isstruct(tct->info) ? |
1387 | (decl.attr|0x80000000u) : 0; /* For layout phase. */ | 1387 | (decl.attr|0x80000000u) : 0; /* For layout phase. */ |
1388 | goto add_field; | 1388 | goto add_field; |
@@ -1396,7 +1396,7 @@ static CTypeID cp_decl_struct(CPState *cp, CPDecl *sdecl, CTInfo sinfo) | |||
1396 | } | 1396 | } |
1397 | 1397 | ||
1398 | /* Create temporary field for layout phase. */ | 1398 | /* Create temporary field for layout phase. */ |
1399 | ct->info = CTINFO(CT_FIELD, typeid + (bsz << CTSHIFT_BITCSZ)); | 1399 | ct->info = CTINFO(CT_FIELD, ctypeid + (bsz << CTSHIFT_BITCSZ)); |
1400 | ct->size = decl.attr; | 1400 | ct->size = decl.attr; |
1401 | if (decl.name) ctype_setname(ct, decl.name); | 1401 | if (decl.name) ctype_setname(ct, decl.name); |
1402 | 1402 | ||
@@ -1601,7 +1601,7 @@ static void cp_decl_func(CPState *cp, CPDecl *fdecl) | |||
1601 | if (cp->tok != ')') { | 1601 | if (cp->tok != ')') { |
1602 | do { | 1602 | do { |
1603 | CPDecl decl; | 1603 | CPDecl decl; |
1604 | CTypeID typeid, fieldid; | 1604 | CTypeID ctypeid, fieldid; |
1605 | CType *ct; | 1605 | CType *ct; |
1606 | if (cp_opt(cp, '.')) { /* Vararg function. */ | 1606 | if (cp_opt(cp, '.')) { /* Vararg function. */ |
1607 | cp_check(cp, '.'); /* Workaround for the minimalistic lexer. */ | 1607 | cp_check(cp, '.'); /* Workaround for the minimalistic lexer. */ |
@@ -1612,16 +1612,16 @@ static void cp_decl_func(CPState *cp, CPDecl *fdecl) | |||
1612 | cp_decl_spec(cp, &decl, CDF_REGISTER); | 1612 | cp_decl_spec(cp, &decl, CDF_REGISTER); |
1613 | decl.mode = CPARSE_MODE_DIRECT|CPARSE_MODE_ABSTRACT; | 1613 | decl.mode = CPARSE_MODE_DIRECT|CPARSE_MODE_ABSTRACT; |
1614 | cp_declarator(cp, &decl); | 1614 | cp_declarator(cp, &decl); |
1615 | typeid = cp_decl_intern(cp, &decl); | 1615 | ctypeid = cp_decl_intern(cp, &decl); |
1616 | ct = ctype_raw(cp->cts, typeid); | 1616 | ct = ctype_raw(cp->cts, ctypeid); |
1617 | if (ctype_isvoid(ct->info)) | 1617 | if (ctype_isvoid(ct->info)) |
1618 | break; | 1618 | break; |
1619 | else if (ctype_isrefarray(ct->info)) | 1619 | else if (ctype_isrefarray(ct->info)) |
1620 | typeid = lj_ctype_intern(cp->cts, | 1620 | ctypeid = lj_ctype_intern(cp->cts, |
1621 | CTINFO(CT_PTR, CTALIGN_PTR|ctype_cid(ct->info)), CTSIZE_PTR); | 1621 | CTINFO(CT_PTR, CTALIGN_PTR|ctype_cid(ct->info)), CTSIZE_PTR); |
1622 | else if (ctype_isfunc(ct->info)) | 1622 | else if (ctype_isfunc(ct->info)) |
1623 | typeid = lj_ctype_intern(cp->cts, | 1623 | ctypeid = lj_ctype_intern(cp->cts, |
1624 | CTINFO(CT_PTR, CTALIGN_PTR|typeid), CTSIZE_PTR); | 1624 | CTINFO(CT_PTR, CTALIGN_PTR|ctypeid), CTSIZE_PTR); |
1625 | /* Add new parameter. */ | 1625 | /* Add new parameter. */ |
1626 | fieldid = lj_ctype_new(cp->cts, &ct); | 1626 | fieldid = lj_ctype_new(cp->cts, &ct); |
1627 | if (anchor) | 1627 | if (anchor) |
@@ -1630,7 +1630,7 @@ static void cp_decl_func(CPState *cp, CPDecl *fdecl) | |||
1630 | anchor = fieldid; | 1630 | anchor = fieldid; |
1631 | lastid = fieldid; | 1631 | lastid = fieldid; |
1632 | if (decl.name) ctype_setname(ct, decl.name); | 1632 | if (decl.name) ctype_setname(ct, decl.name); |
1633 | ct->info = CTINFO(CT_FIELD, typeid); | 1633 | ct->info = CTINFO(CT_FIELD, ctypeid); |
1634 | ct->size = nargs++; | 1634 | ct->size = nargs++; |
1635 | } while (cp_opt(cp, ',')); | 1635 | } while (cp_opt(cp, ',')); |
1636 | } | 1636 | } |
@@ -1794,28 +1794,28 @@ static void cp_decl_multi(CPState *cp) | |||
1794 | goto decl_end; /* Accept empty declaration of struct/union/enum. */ | 1794 | goto decl_end; /* Accept empty declaration of struct/union/enum. */ |
1795 | } | 1795 | } |
1796 | for (;;) { | 1796 | for (;;) { |
1797 | CTypeID typeid; | 1797 | CTypeID ctypeid; |
1798 | cp_declarator(cp, &decl); | 1798 | cp_declarator(cp, &decl); |
1799 | typeid = cp_decl_intern(cp, &decl); | 1799 | ctypeid = cp_decl_intern(cp, &decl); |
1800 | if (decl.name && !decl.nameid) { /* NYI: redeclarations are ignored. */ | 1800 | if (decl.name && !decl.nameid) { /* NYI: redeclarations are ignored. */ |
1801 | CType *ct; | 1801 | CType *ct; |
1802 | CTypeID id; | 1802 | CTypeID id; |
1803 | if ((scl & CDF_TYPEDEF)) { /* Create new typedef. */ | 1803 | if ((scl & CDF_TYPEDEF)) { /* Create new typedef. */ |
1804 | id = lj_ctype_new(cp->cts, &ct); | 1804 | id = lj_ctype_new(cp->cts, &ct); |
1805 | ct->info = CTINFO(CT_TYPEDEF, typeid); | 1805 | ct->info = CTINFO(CT_TYPEDEF, ctypeid); |
1806 | goto noredir; | 1806 | goto noredir; |
1807 | } else if (ctype_isfunc(ctype_get(cp->cts, typeid)->info)) { | 1807 | } else if (ctype_isfunc(ctype_get(cp->cts, ctypeid)->info)) { |
1808 | /* Treat both static and extern function declarations as extern. */ | 1808 | /* Treat both static and extern function declarations as extern. */ |
1809 | ct = ctype_get(cp->cts, typeid); | 1809 | ct = ctype_get(cp->cts, ctypeid); |
1810 | /* We always get new anonymous functions (typedefs are copied). */ | 1810 | /* We always get new anonymous functions (typedefs are copied). */ |
1811 | lua_assert(gcref(ct->name) == NULL); | 1811 | lua_assert(gcref(ct->name) == NULL); |
1812 | id = typeid; /* Just name it. */ | 1812 | id = ctypeid; /* Just name it. */ |
1813 | } else if ((scl & CDF_STATIC)) { /* Accept static constants. */ | 1813 | } else if ((scl & CDF_STATIC)) { /* Accept static constants. */ |
1814 | id = cp_decl_constinit(cp, &ct, typeid); | 1814 | id = cp_decl_constinit(cp, &ct, ctypeid); |
1815 | goto noredir; | 1815 | goto noredir; |
1816 | } else { /* External references have extern or no storage class. */ | 1816 | } else { /* External references have extern or no storage class. */ |
1817 | id = lj_ctype_new(cp->cts, &ct); | 1817 | id = lj_ctype_new(cp->cts, &ct); |
1818 | ct->info = CTINFO(CT_EXTERN, typeid); | 1818 | ct->info = CTINFO(CT_EXTERN, ctypeid); |
1819 | } | 1819 | } |
1820 | if (decl.redir) { /* Add attribute for redirected symbol name. */ | 1820 | if (decl.redir) { /* Add attribute for redirected symbol name. */ |
1821 | CType *cta; | 1821 | CType *cta; |
diff --git a/src/lj_crecord.c b/src/lj_crecord.c index d46a239c..18e1ee13 100644 --- a/src/lj_crecord.c +++ b/src/lj_crecord.c | |||
@@ -50,8 +50,8 @@ static GCcdata *argv2cdata(jit_State *J, TRef tr, cTValue *o) | |||
50 | lj_trace_err(J, LJ_TRERR_BADTYPE); | 50 | lj_trace_err(J, LJ_TRERR_BADTYPE); |
51 | cd = cdataV(o); | 51 | cd = cdataV(o); |
52 | /* Specialize to the CTypeID. */ | 52 | /* Specialize to the CTypeID. */ |
53 | trtypeid = emitir(IRT(IR_FLOAD, IRT_U16), tr, IRFL_CDATA_TYPEID); | 53 | trtypeid = emitir(IRT(IR_FLOAD, IRT_U16), tr, IRFL_CDATA_CTYPEID); |
54 | emitir(IRTG(IR_EQ, IRT_INT), trtypeid, lj_ir_kint(J, (int32_t)cd->typeid)); | 54 | emitir(IRTG(IR_EQ, IRT_INT), trtypeid, lj_ir_kint(J, (int32_t)cd->ctypeid)); |
55 | return cd; | 55 | return cd; |
56 | } | 56 | } |
57 | 57 | ||
@@ -59,7 +59,7 @@ static GCcdata *argv2cdata(jit_State *J, TRef tr, cTValue *o) | |||
59 | static CTypeID crec_constructor(jit_State *J, GCcdata *cd, TRef tr) | 59 | static CTypeID crec_constructor(jit_State *J, GCcdata *cd, TRef tr) |
60 | { | 60 | { |
61 | CTypeID id; | 61 | CTypeID id; |
62 | lua_assert(tref_iscdata(tr) && cd->typeid == CTID_CTYPEID); | 62 | lua_assert(tref_iscdata(tr) && cd->ctypeid == CTID_CTYPEID); |
63 | id = *(CTypeID *)cdataptr(cd); | 63 | id = *(CTypeID *)cdataptr(cd); |
64 | tr = emitir(IRT(IR_ADD, IRT_PTR), tr, lj_ir_kintp(J, sizeof(GCcdata))); | 64 | tr = emitir(IRT(IR_ADD, IRT_PTR), tr, lj_ir_kintp(J, sizeof(GCcdata))); |
65 | tr = emitir(IRT(IR_XLOAD, IRT_INT), tr, 0); | 65 | tr = emitir(IRT(IR_XLOAD, IRT_INT), tr, 0); |
@@ -87,8 +87,8 @@ static CTypeID argv2ctype(jit_State *J, TRef tr, cTValue *o) | |||
87 | return cp.val.id; | 87 | return cp.val.id; |
88 | } else { | 88 | } else { |
89 | GCcdata *cd = argv2cdata(J, tr, o); | 89 | GCcdata *cd = argv2cdata(J, tr, o); |
90 | return cd->typeid == CTID_CTYPEID ? crec_constructor(J, cd, tr) : | 90 | return cd->ctypeid == CTID_CTYPEID ? crec_constructor(J, cd, tr) : |
91 | cd->typeid; | 91 | cd->ctypeid; |
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
@@ -415,7 +415,7 @@ static TRef crec_ct_tv(jit_State *J, CType *d, TRef dp, TRef sp, cTValue *sval) | |||
415 | } | 415 | } |
416 | } else { /* NYI: tref_istab(sp), tref_islightud(sp). */ | 416 | } else { /* NYI: tref_istab(sp), tref_islightud(sp). */ |
417 | IRType t; | 417 | IRType t; |
418 | sid = argv2cdata(J, sp, sval)->typeid; | 418 | sid = argv2cdata(J, sp, sval)->ctypeid; |
419 | s = ctype_raw(cts, sid); | 419 | s = ctype_raw(cts, sid); |
420 | svisnz = cdataptr(cdataV(sval)); | 420 | svisnz = cdataptr(cdataV(sval)); |
421 | if (ctype_isenum(s->info)) s = ctype_child(cts, s); | 421 | if (ctype_isenum(s->info)) s = ctype_child(cts, s); |
@@ -514,7 +514,7 @@ void LJ_FASTCALL recff_cdata_index(jit_State *J, RecordFFData *rd) | |||
514 | ptrdiff_t ofs = sizeof(GCcdata); | 514 | ptrdiff_t ofs = sizeof(GCcdata); |
515 | GCcdata *cd = argv2cdata(J, ptr, &rd->argv[0]); | 515 | GCcdata *cd = argv2cdata(J, ptr, &rd->argv[0]); |
516 | CTState *cts = ctype_ctsG(J2G(J)); | 516 | CTState *cts = ctype_ctsG(J2G(J)); |
517 | CType *ct = ctype_raw(cts, cd->typeid); | 517 | CType *ct = ctype_raw(cts, cd->ctypeid); |
518 | CTypeID sid = 0; | 518 | CTypeID sid = 0; |
519 | 519 | ||
520 | /* Resolve pointer or reference for cdata object. */ | 520 | /* Resolve pointer or reference for cdata object. */ |
@@ -553,7 +553,7 @@ again: | |||
553 | } | 553 | } |
554 | } else if (tref_iscdata(idx)) { | 554 | } else if (tref_iscdata(idx)) { |
555 | GCcdata *cdk = cdataV(&rd->argv[1]); | 555 | GCcdata *cdk = cdataV(&rd->argv[1]); |
556 | CType *ctk = ctype_raw(cts, cdk->typeid); | 556 | CType *ctk = ctype_raw(cts, cdk->ctypeid); |
557 | IRType t; | 557 | IRType t; |
558 | if (ctype_isenum(ctk->info)) ctk = ctype_child(cts, ctk); | 558 | if (ctype_isenum(ctk->info)) ctk = ctype_child(cts, ctk); |
559 | if (ctype_ispointer(ct->info) && | 559 | if (ctype_ispointer(ct->info) && |
@@ -577,7 +577,7 @@ again: | |||
577 | } | 577 | } |
578 | } else if (tref_isstr(idx)) { | 578 | } else if (tref_isstr(idx)) { |
579 | GCstr *name = strV(&rd->argv[1]); | 579 | GCstr *name = strV(&rd->argv[1]); |
580 | if (cd->typeid == CTID_CTYPEID) | 580 | if (cd->ctypeid == CTID_CTYPEID) |
581 | ct = ctype_raw(cts, crec_constructor(J, cd, ptr)); | 581 | ct = ctype_raw(cts, crec_constructor(J, cd, ptr)); |
582 | if (ctype_isstruct(ct->info)) { | 582 | if (ctype_isstruct(ct->info)) { |
583 | CTSize fofs; | 583 | CTSize fofs; |
@@ -879,7 +879,7 @@ static void crec_snap_caller(jit_State *J) | |||
879 | static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd) | 879 | static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd) |
880 | { | 880 | { |
881 | CTState *cts = ctype_ctsG(J2G(J)); | 881 | CTState *cts = ctype_ctsG(J2G(J)); |
882 | CType *ct = ctype_raw(cts, cd->typeid); | 882 | CType *ct = ctype_raw(cts, cd->ctypeid); |
883 | IRType tp = IRT_PTR; | 883 | IRType tp = IRT_PTR; |
884 | if (ctype_isptr(ct->info)) { | 884 | if (ctype_isptr(ct->info)) { |
885 | tp = (LJ_64 && ct->size == 8) ? IRT_P64 : IRT_P32; | 885 | tp = (LJ_64 && ct->size == 8) ? IRT_P64 : IRT_P32; |
@@ -946,7 +946,7 @@ void LJ_FASTCALL recff_cdata_call(jit_State *J, RecordFFData *rd) | |||
946 | { | 946 | { |
947 | CTState *cts = ctype_ctsG(J2G(J)); | 947 | CTState *cts = ctype_ctsG(J2G(J)); |
948 | GCcdata *cd = argv2cdata(J, J->base[0], &rd->argv[0]); | 948 | GCcdata *cd = argv2cdata(J, J->base[0], &rd->argv[0]); |
949 | CTypeID id = cd->typeid; | 949 | CTypeID id = cd->ctypeid; |
950 | CType *ct; | 950 | CType *ct; |
951 | cTValue *tv; | 951 | cTValue *tv; |
952 | MMS mm = MM_call; | 952 | MMS mm = MM_call; |
@@ -1084,10 +1084,10 @@ static void crec_arith_meta(jit_State *J, CTState *cts, RecordFFData *rd) | |||
1084 | cTValue *tv = NULL; | 1084 | cTValue *tv = NULL; |
1085 | if (J->base[0]) { | 1085 | if (J->base[0]) { |
1086 | if (tviscdata(&rd->argv[0])) | 1086 | if (tviscdata(&rd->argv[0])) |
1087 | tv = lj_ctype_meta(cts, argv2cdata(J, J->base[0], &rd->argv[0])->typeid, | 1087 | tv = lj_ctype_meta(cts, argv2cdata(J, J->base[0], &rd->argv[0])->ctypeid, |
1088 | (MMS)rd->data); | 1088 | (MMS)rd->data); |
1089 | if (!tv && J->base[1] && tviscdata(&rd->argv[1])) | 1089 | if (!tv && J->base[1] && tviscdata(&rd->argv[1])) |
1090 | tv = lj_ctype_meta(cts, argv2cdata(J, J->base[1], &rd->argv[1])->typeid, | 1090 | tv = lj_ctype_meta(cts, argv2cdata(J, J->base[1], &rd->argv[1])->ctypeid, |
1091 | (MMS)rd->data); | 1091 | (MMS)rd->data); |
1092 | } | 1092 | } |
1093 | if (tv) { | 1093 | if (tv) { |
@@ -1115,7 +1115,7 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd) | |||
1115 | if (!tr) { | 1115 | if (!tr) { |
1116 | goto trymeta; | 1116 | goto trymeta; |
1117 | } else if (tref_iscdata(tr)) { | 1117 | } else if (tref_iscdata(tr)) { |
1118 | CTypeID id = argv2cdata(J, tr, &rd->argv[i])->typeid; | 1118 | CTypeID id = argv2cdata(J, tr, &rd->argv[i])->ctypeid; |
1119 | ct = ctype_raw(cts, id); | 1119 | ct = ctype_raw(cts, id); |
1120 | if (ctype_isptr(ct->info)) { /* Resolve pointer or reference. */ | 1120 | if (ctype_isptr(ct->info)) { /* Resolve pointer or reference. */ |
1121 | IRType t = (LJ_64 && ct->size == 8) ? IRT_P64 : IRT_P32; | 1121 | IRType t = (LJ_64 && ct->size == 8) ? IRT_P64 : IRT_P32; |
@@ -1323,7 +1323,7 @@ void LJ_FASTCALL recff_ffi_abi(jit_State *J, RecordFFData *rd) | |||
1323 | void LJ_FASTCALL lj_crecord_tonumber(jit_State *J, RecordFFData *rd) | 1323 | void LJ_FASTCALL lj_crecord_tonumber(jit_State *J, RecordFFData *rd) |
1324 | { | 1324 | { |
1325 | CTState *cts = ctype_ctsG(J2G(J)); | 1325 | CTState *cts = ctype_ctsG(J2G(J)); |
1326 | CType *d, *ct = lj_ctype_rawref(cts, cdataV(&rd->argv[0])->typeid); | 1326 | CType *d, *ct = lj_ctype_rawref(cts, cdataV(&rd->argv[0])->ctypeid); |
1327 | if (ctype_isenum(ct->info)) ct = ctype_child(cts, ct); | 1327 | if (ctype_isenum(ct->info)) ct = ctype_child(cts, ct); |
1328 | if (ctype_isnum(ct->info) || ctype_iscomplex(ct->info)) { | 1328 | if (ctype_isnum(ct->info) || ctype_iscomplex(ct->info)) { |
1329 | if (ctype_isinteger_or_bool(ct->info) && ct->size <= 4 && | 1329 | if (ctype_isinteger_or_bool(ct->info) && ct->size <= 4 && |
diff --git a/src/lj_ir.h b/src/lj_ir.h index 7e14066a..0bdc19df 100644 --- a/src/lj_ir.h +++ b/src/lj_ir.h | |||
@@ -195,7 +195,7 @@ IRFPMDEF(FPMENUM) | |||
195 | _(UDATA_META, offsetof(GCudata, metatable)) \ | 195 | _(UDATA_META, offsetof(GCudata, metatable)) \ |
196 | _(UDATA_UDTYPE, offsetof(GCudata, udtype)) \ | 196 | _(UDATA_UDTYPE, offsetof(GCudata, udtype)) \ |
197 | _(UDATA_FILE, sizeof(GCudata)) \ | 197 | _(UDATA_FILE, sizeof(GCudata)) \ |
198 | _(CDATA_TYPEID, offsetof(GCcdata, typeid)) \ | 198 | _(CDATA_CTYPEID, offsetof(GCcdata, ctypeid)) \ |
199 | _(CDATA_PTR, sizeof(GCcdata)) \ | 199 | _(CDATA_PTR, sizeof(GCcdata)) \ |
200 | _(CDATA_INT, sizeof(GCcdata)) \ | 200 | _(CDATA_INT, sizeof(GCcdata)) \ |
201 | _(CDATA_INT64, sizeof(GCcdata)) \ | 201 | _(CDATA_INT64, sizeof(GCcdata)) \ |
diff --git a/src/lj_obj.h b/src/lj_obj.h index d7e8ec09..4ec67aed 100644 --- a/src/lj_obj.h +++ b/src/lj_obj.h | |||
@@ -264,7 +264,7 @@ enum { | |||
264 | /* C data object. Payload follows. */ | 264 | /* C data object. Payload follows. */ |
265 | typedef struct GCcdata { | 265 | typedef struct GCcdata { |
266 | GCHeader; | 266 | GCHeader; |
267 | uint16_t typeid; /* C type ID. */ | 267 | uint16_t ctypeid; /* C type ID. */ |
268 | } GCcdata; | 268 | } GCcdata; |
269 | 269 | ||
270 | /* Prepended to variable-sized or realigned C data objects. */ | 270 | /* Prepended to variable-sized or realigned C data objects. */ |
diff --git a/src/lj_opt_fold.c b/src/lj_opt_fold.c index 5a634bbc..aa80a6aa 100644 --- a/src/lj_opt_fold.c +++ b/src/lj_opt_fold.c | |||
@@ -1939,11 +1939,11 @@ LJFOLDF(fload_str_len_snew) | |||
1939 | } | 1939 | } |
1940 | 1940 | ||
1941 | /* The C type ID of cdata objects is immutable. */ | 1941 | /* The C type ID of cdata objects is immutable. */ |
1942 | LJFOLD(FLOAD KGC IRFL_CDATA_TYPEID) | 1942 | LJFOLD(FLOAD KGC IRFL_CDATA_CTYPEID) |
1943 | LJFOLDF(fload_cdata_typeid_kgc) | 1943 | LJFOLDF(fload_cdata_typeid_kgc) |
1944 | { | 1944 | { |
1945 | if (LJ_LIKELY(J->flags & JIT_F_OPT_FOLD)) | 1945 | if (LJ_LIKELY(J->flags & JIT_F_OPT_FOLD)) |
1946 | return INTFOLD((int32_t)ir_kcdata(fleft)->typeid); | 1946 | return INTFOLD((int32_t)ir_kcdata(fleft)->ctypeid); |
1947 | return NEXTFOLD; | 1947 | return NEXTFOLD; |
1948 | } | 1948 | } |
1949 | 1949 | ||
@@ -1962,8 +1962,8 @@ LJFOLDF(fload_cdata_int64_kgc) | |||
1962 | return NEXTFOLD; | 1962 | return NEXTFOLD; |
1963 | } | 1963 | } |
1964 | 1964 | ||
1965 | LJFOLD(FLOAD CNEW IRFL_CDATA_TYPEID) | 1965 | LJFOLD(FLOAD CNEW IRFL_CDATA_CTYPEID) |
1966 | LJFOLD(FLOAD CNEWI IRFL_CDATA_TYPEID) | 1966 | LJFOLD(FLOAD CNEWI IRFL_CDATA_CTYPEID) |
1967 | LJFOLDF(fload_cdata_typeid_cnew) | 1967 | LJFOLDF(fload_cdata_typeid_cnew) |
1968 | { | 1968 | { |
1969 | if (LJ_LIKELY(J->flags & JIT_F_OPT_FOLD)) | 1969 | if (LJ_LIKELY(J->flags & JIT_F_OPT_FOLD)) |
@@ -1983,7 +1983,7 @@ LJFOLDF(fload_cdata_ptr_int64_cnew) | |||
1983 | } | 1983 | } |
1984 | 1984 | ||
1985 | LJFOLD(FLOAD any IRFL_STR_LEN) | 1985 | LJFOLD(FLOAD any IRFL_STR_LEN) |
1986 | LJFOLD(FLOAD any IRFL_CDATA_TYPEID) | 1986 | LJFOLD(FLOAD any IRFL_CDATA_CTYPEID) |
1987 | LJFOLD(FLOAD any IRFL_CDATA_PTR) | 1987 | LJFOLD(FLOAD any IRFL_CDATA_PTR) |
1988 | LJFOLD(FLOAD any IRFL_CDATA_INT) | 1988 | LJFOLD(FLOAD any IRFL_CDATA_INT) |
1989 | LJFOLD(FLOAD any IRFL_CDATA_INT64) | 1989 | LJFOLD(FLOAD any IRFL_CDATA_INT64) |
diff --git a/src/lj_parse.c b/src/lj_parse.c index 170801ed..2cbfbe56 100644 --- a/src/lj_parse.c +++ b/src/lj_parse.c | |||
@@ -938,7 +938,7 @@ static void bcemit_unop(FuncState *fs, BCOp op, ExpDesc *e) | |||
938 | if (e->k == VKCDATA) { /* Fold in-place since cdata is not interned. */ | 938 | if (e->k == VKCDATA) { /* Fold in-place since cdata is not interned. */ |
939 | GCcdata *cd = cdataV(&e->u.nval); | 939 | GCcdata *cd = cdataV(&e->u.nval); |
940 | int64_t *p = (int64_t *)cdataptr(cd); | 940 | int64_t *p = (int64_t *)cdataptr(cd); |
941 | if (cd->typeid == CTID_COMPLEX_DOUBLE) | 941 | if (cd->ctypeid == CTID_COMPLEX_DOUBLE) |
942 | p[1] ^= (int64_t)U64x(80000000,00000000); | 942 | p[1] ^= (int64_t)U64x(80000000,00000000); |
943 | else | 943 | else |
944 | *p = -*p; | 944 | *p = -*p; |