Revert part of "Specialize metatables for method calls"

This reverts part of commit b5783323ef.
This commit is contained in:
Jude Melton-Houghton 2022-09-19 20:14:42 -04:00
parent 126a4475dd
commit 6522e8019a
11 changed files with 7 additions and 48 deletions

View File

@ -144,7 +144,6 @@
_(GSET, var, ___, str, newindex) \ _(GSET, var, ___, str, newindex) \
_(TGETV, dst, var, var, index) \ _(TGETV, dst, var, var, index) \
_(TGETS, dst, var, str, index) \ _(TGETS, dst, var, str, index) \
_(TGETSS, dst, var, str, index) \
_(TGETB, dst, var, lit, index) \ _(TGETB, dst, var, lit, index) \
_(TGETR, dst, var, var, index) \ _(TGETR, dst, var, var, index) \
_(TSETV, var, var, var, newindex) \ _(TSETV, var, var, var, newindex) \
@ -260,8 +259,6 @@ static LJ_AINLINE int bc_isret(BCOp op)
return (op == BC_RETM || op == BC_RET || op == BC_RET0 || op == BC_RET1); return (op == BC_RETM || op == BC_RET || op == BC_RET0 || op == BC_RET1);
} }
#define bc_isalias(op) ((op) == BC_TGETSS)
LJ_DATA const uint16_t lj_bc_mode[]; LJ_DATA const uint16_t lj_bc_mode[];
LJ_DATA const uint16_t lj_bc_ofs[]; LJ_DATA const uint16_t lj_bc_ofs[];

View File

@ -271,10 +271,13 @@ restart:
return "global"; return "global";
case BC_TGETS: case BC_TGETS:
*name = strdata(gco2str(proto_kgc(pt, ~(ptrdiff_t)bc_c(ins)))); *name = strdata(gco2str(proto_kgc(pt, ~(ptrdiff_t)bc_c(ins))));
if (ip > proto_bc(pt)) {
BCIns insp = ip[-1];
if (bc_op(insp) == BC_MOV && bc_a(insp) == ra+1+LJ_FR2 &&
bc_d(insp) == bc_b(ins))
return "method";
}
return "field"; return "field";
case BC_TGETSS:
*name = strdata(gco2str(proto_kgc(pt, ~(ptrdiff_t)bc_c(ins))));
return "method";
case BC_UGET: case BC_UGET:
*name = lj_debug_uvname(pt, bc_d(ins)); *name = lj_debug_uvname(pt, bc_d(ins));
return "upvalue"; return "upvalue";

View File

@ -675,7 +675,7 @@ static void bcemit_method(FuncState *fs, ExpDesc *e, ExpDesc *key)
idx = const_str(fs, key); idx = const_str(fs, key);
if (idx <= BCMAX_C) { if (idx <= BCMAX_C) {
bcreg_reserve(fs, 2+LJ_FR2); bcreg_reserve(fs, 2+LJ_FR2);
bcemit_ABC(fs, BC_TGETSS, func, obj, idx); bcemit_ABC(fs, BC_TGETS, func, obj, idx);
} else { } else {
bcreg_reserve(fs, 3+LJ_FR2); bcreg_reserve(fs, 3+LJ_FR2);
bcemit_AD(fs, BC_KSTR, func+2+LJ_FR2, idx); bcemit_AD(fs, BC_KSTR, func+2+LJ_FR2, idx);

View File

@ -2503,12 +2503,6 @@ void lj_record_ins(jit_State *J)
/* fallthrough */ /* fallthrough */
case BC_TGETV: case BC_TGETS: case BC_TSETV: case BC_TSETS: case BC_TGETV: case BC_TGETS: case BC_TSETV: case BC_TSETS:
ix.idxchain = LJ_MAX_IDXCHAIN; ix.idxchain = LJ_MAX_IDXCHAIN;
ix.mtspec = 0;
rc = lj_record_idx(J, &ix);
break;
case BC_TGETSS:
ix.idxchain = LJ_MAX_IDXCHAIN;
ix.mtspec = 1;
rc = lj_record_idx(J, &ix); rc = lj_record_idx(J, &ix);
break; break;
case BC_TGETR: case BC_TSETR: case BC_TGETR: case BC_TSETR:

View File

@ -2592,10 +2592,6 @@ static void build_subroutines(BuildCtx *ctx)
static void build_ins(BuildCtx *ctx, BCOp op, int defop) static void build_ins(BuildCtx *ctx, BCOp op, int defop)
{ {
int vk = 0; int vk = 0;
if (bc_isalias(op))
return;
|=>defop: |=>defop:
switch (op) { switch (op) {
@ -3546,7 +3542,6 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
| b ->vmeta_tgetv | b ->vmeta_tgetv
break; break;
case BC_TGETS: case BC_TGETS:
|=>BC_TGETSS:
| decode_RB8 RB, INS | decode_RB8 RB, INS
| and RC, RC, #255 | and RC, RC, #255
| // RA = dst*8, RB = table*8, RC = str_const (~) | // RA = dst*8, RB = table*8, RC = str_const (~)

View File

@ -2226,10 +2226,6 @@ static void build_subroutines(BuildCtx *ctx)
static void build_ins(BuildCtx *ctx, BCOp op, int defop) static void build_ins(BuildCtx *ctx, BCOp op, int defop)
{ {
int vk = 0; int vk = 0;
if (bc_isalias(op))
return;
|=>defop: |=>defop:
switch (op) { switch (op) {
@ -2996,7 +2992,6 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
| b ->BC_TGETS_Z | b ->BC_TGETS_Z
break; break;
case BC_TGETS: case BC_TGETS:
|=>BC_TGETSS:
| decode_RB RB, INS | decode_RB RB, INS
| and RC, RC, #255 | and RC, RC, #255
| // RA = dst, RB = table, RC = str_const (~) | // RA = dst, RB = table, RC = str_const (~)

View File

@ -2981,10 +2981,6 @@ static void build_subroutines(BuildCtx *ctx)
static void build_ins(BuildCtx *ctx, BCOp op, int defop) static void build_ins(BuildCtx *ctx, BCOp op, int defop)
{ {
int vk = 0; int vk = 0;
if (bc_isalias(op))
return;
|=>defop: |=>defop:
switch (op) { switch (op) {
@ -4080,7 +4076,6 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
|. nop |. nop
break; break;
case BC_TGETS: case BC_TGETS:
|=>BC_TGETSS:
| // RA = dst*8, RB = table*8, RC = str_const*4 (~) | // RA = dst*8, RB = table*8, RC = str_const*4 (~)
| decode_RB8a RB, INS | decode_RB8a RB, INS
| decode_RB8b RB | decode_RB8b RB

View File

@ -3104,10 +3104,6 @@ static void build_subroutines(BuildCtx *ctx)
static void build_ins(BuildCtx *ctx, BCOp op, int defop) static void build_ins(BuildCtx *ctx, BCOp op, int defop)
{ {
int vk = 0; int vk = 0;
if (bc_isalias(op))
return;
|=>defop: |=>defop:
switch (op) { switch (op) {
@ -4294,7 +4290,6 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
|. nop |. nop
break; break;
case BC_TGETS: case BC_TGETS:
|=>BC_TGETSS:
| // RA = dst*8, RB = table*8, RC = str_const*8 (~) | // RA = dst*8, RB = table*8, RC = str_const*8 (~)
| decode_RB8a RB, INS | decode_RB8a RB, INS
| decode_RB8b RB | decode_RB8b RB

View File

@ -3310,10 +3310,6 @@ static void build_subroutines(BuildCtx *ctx)
static void build_ins(BuildCtx *ctx, BCOp op, int defop) static void build_ins(BuildCtx *ctx, BCOp op, int defop)
{ {
int vk = 0; int vk = 0;
if (bc_isalias(op))
return;
|=>defop: |=>defop:
switch (op) { switch (op) {
@ -4567,7 +4563,6 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
| b ->BC_TGETS_Z // String key? | b ->BC_TGETS_Z // String key?
break; break;
case BC_TGETS: case BC_TGETS:
|=>BC_TGETSS:
| // RA = dst*8, RB = table*8, RC = str_const*8 (~) | // RA = dst*8, RB = table*8, RC = str_const*8 (~)
| lwzux CARG1, RB, BASE | lwzux CARG1, RB, BASE
| srwi TMP1, RC, 1 | srwi TMP1, RC, 1

View File

@ -2796,10 +2796,6 @@ static void build_subroutines(BuildCtx *ctx)
static void build_ins(BuildCtx *ctx, BCOp op, int defop) static void build_ins(BuildCtx *ctx, BCOp op, int defop)
{ {
int vk = 0; int vk = 0;
if (bc_isalias(op))
return;
|// Note: aligning all instructions does not pay off. |// Note: aligning all instructions does not pay off.
|=>defop: |=>defop:
@ -3682,7 +3678,6 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
| jmp ->BC_TGETS_Z | jmp ->BC_TGETS_Z
break; break;
case BC_TGETS: case BC_TGETS:
|=>BC_TGETSS:
| ins_ABC // RA = dst, RB = table, RC = str const (~) | ins_ABC // RA = dst, RB = table, RC = str const (~)
| mov TAB:RB, [BASE+RB*8] | mov TAB:RB, [BASE+RB*8]
| not RC | not RC

View File

@ -3381,10 +3381,6 @@ static void build_subroutines(BuildCtx *ctx)
static void build_ins(BuildCtx *ctx, BCOp op, int defop) static void build_ins(BuildCtx *ctx, BCOp op, int defop)
{ {
int vk = 0; int vk = 0;
if (bc_isalias(op))
return;
|// Note: aligning all instructions does not pay off. |// Note: aligning all instructions does not pay off.
|=>defop: |=>defop:
@ -4313,7 +4309,6 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
| jmp ->BC_TGETS_Z | jmp ->BC_TGETS_Z
break; break;
case BC_TGETS: case BC_TGETS:
|=>BC_TGETSS:
| ins_ABC // RA = dst, RB = table, RC = str const (~) | ins_ABC // RA = dst, RB = table, RC = str const (~)
| not RCa | not RCa
| mov STR:RC, [KBASE+RC*4] | mov STR:RC, [KBASE+RC*4]