OP_SELF restricted to constant short strings

Optimize this opcode for the common case. For long names or method
calls after too many constants, operation can be coded as a move
followed by 'gettable'.
This commit is contained in:
Roberto Ierusalimschy
2024-12-11 13:56:03 -03:00
parent b4b616bdf2
commit 25a491fe34
5 changed files with 35 additions and 34 deletions

View File

@@ -256,7 +256,7 @@ OP_SETFIELD,/* A B C R[A][K[B]:shortstring] := RK(C) */
OP_NEWTABLE,/* A B C k R[A] := {} */
OP_SELF,/* A B C R[A+1] := R[B]; R[A] := R[B][RK(C):string] */
OP_SELF,/* A B C R[A+1] := R[B]; R[A] := R[B][K[C]:shortstring] */
OP_ADDI,/* A B sC R[A] := R[B] + sC */