On Sun, Sep 24, 2017 at 11:26 PM, Peter Cawley <corsix@xxxxxxxxxx> wrote:
Thank you for the detailed explanation, I have some followup questions
while I am trying to digest this :)
Before I start, Some clarification about the numbers used in IR and Bytecode:
1. IR instruction number: First column of IR, increments continuously
by one per every instruction.
2. Argument to SLOAD: start at #0 (base frame, or call frame
metadata), #1: first slot in the first frame, starting at function
argument. In luajit wiki, it is defined as "(register 0 in the
bytecode)"
What is the register 0 mentioned here?
3. Instruction operands of IR. eg: in "0003 xmm7 + num MUL 0002
-3" what does 0002 denote? Is it a reference to a memory
location/register etc, or to an instruction?
On Sun, Sep 24, 2017 at 2:36 PM, Raj <rajlistuser@xxxxxxxxx> wrote:
My attempt is to trace backwards and to find
out what causes the snapshot to be filled up.
Lots of entries in a snapshot just means that there are lots of local
variables (*) whose values have changed since the start of the trace.
"x" in this case is local variable number #0 - you can see this
from e.g. cross-referencing "x = x * -3" with "0006 MULVN 0 0
1 ; -3" - the first 0 is the destination slot (x), and the second 0
is the source slot (also x).
SNAP #3 has fewer entries than SNAP #2, as it exits to after the loop
has finished (**), and and therefore all the for-loop variables have
dropped out of scope. SNAP #1 has fewer entries for the same reason:
it exits to after the loop has finished, rather than exiting into the
body of the loop.
(**) You can't actually tell where a snapshot exits to based on jdump
output - I do wish such information was included in the output.
I'm not sure whether that answers your question, but to be honest, I'm
not quite sure what exactly you were questioning.
[P] #define IRSLOAD_PARENT 0x01 /* Coalesce with parent trace. */
[I] #define IRSLOAD_INHERIT 0x20 /* Inherited by exits/side traces. */