-
Notifications
You must be signed in to change notification settings - Fork 203
Description
Currently, when contracts have both internal and external receivers, our low-level function selector generates two separate IFNOTJMP
instructions: one for internal and one for external messages. However, at runtime, only one of these branches can ever be executed, since the incoming message must be either internal or external.
The inefficient compilation occurs because the Fift-assembler decides whether to use JMPREF
or inline the code (PUSHCONT
+ JMP
) based on the size of the code block. If the receiver handlers are small enough, the assembler chooses to inline both branches, unnecessarily enlarging the current code cell and causing extra implicit JMPREF
s.
Since we know that only one receiver (internal or external) can ever execute, we can optimize this scenario by implementing custom logic in our function selector. This logic would explicitly determine whether to inline or reference each receiver's code block, avoiding unnecessary duplication and implicit jumps.