Redesign and harden string interning.
Up to 40% faster on hash-intensive benchmarks. With some ideas from Sokolov Yura.
This commit is contained in:
@@ -1012,9 +1012,9 @@ static void build_subroutines(BuildCtx *ctx)
|
||||
| cmp TAB:RB, #0
|
||||
| beq ->fff_restv
|
||||
| ldr CARG3, TAB:RB->hmask
|
||||
| ldr CARG4, STR:RC->hash
|
||||
| ldr CARG4, STR:RC->sid
|
||||
| ldr NODE:INS, TAB:RB->node
|
||||
| and CARG3, CARG3, CARG4 // idx = str->hash & tab->hmask
|
||||
| and CARG3, CARG3, CARG4 // idx = str->sid & tab->hmask
|
||||
| add CARG3, CARG3, CARG3, lsl #1
|
||||
| add NODE:INS, NODE:INS, CARG3, lsl #3 // node = tab->node + idx*3*8
|
||||
|3: // Rearranged logic, because we expect _not_ to find the key.
|
||||
@@ -3500,10 +3500,10 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
|
||||
|->BC_TGETS_Z:
|
||||
| // (TAB:RB =) TAB:CARG1 = GCtab *, STR:RC = GCstr *, RA = dst*8
|
||||
| ldr CARG3, TAB:CARG1->hmask
|
||||
| ldr CARG4, STR:RC->hash
|
||||
| ldr CARG4, STR:RC->sid
|
||||
| ldr NODE:INS, TAB:CARG1->node
|
||||
| mov TAB:RB, TAB:CARG1
|
||||
| and CARG3, CARG3, CARG4 // idx = str->hash & tab->hmask
|
||||
| and CARG3, CARG3, CARG4 // idx = str->sid & tab->hmask
|
||||
| add CARG3, CARG3, CARG3, lsl #1
|
||||
| add NODE:INS, NODE:INS, CARG3, lsl #3 // node = tab->node + idx*3*8
|
||||
|1:
|
||||
@@ -3647,10 +3647,10 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
|
||||
|->BC_TSETS_Z:
|
||||
| // (TAB:RB =) TAB:CARG1 = GCtab *, STR:RC = GCstr *, RA = dst*8
|
||||
| ldr CARG3, TAB:CARG1->hmask
|
||||
| ldr CARG4, STR:RC->hash
|
||||
| ldr CARG4, STR:RC->sid
|
||||
| ldr NODE:INS, TAB:CARG1->node
|
||||
| mov TAB:RB, TAB:CARG1
|
||||
| and CARG3, CARG3, CARG4 // idx = str->hash & tab->hmask
|
||||
| and CARG3, CARG3, CARG4 // idx = str->sid & tab->hmask
|
||||
| add CARG3, CARG3, CARG3, lsl #1
|
||||
| mov CARG4, #0
|
||||
| add NODE:INS, NODE:INS, CARG3, lsl #3 // node = tab->node + idx*3*8
|
||||
|
||||
Reference in New Issue
Block a user