I've tried to print the OP_CODE for debugging, and I found that when print the same variable with different prefix string, the OP_CODE sequences are different. I wonder why there is such difference or what's the behavior of the extra different OP_CODE, because I think that the prefix string of printf should not impact the OP_CODE sequence.
Test case
This is my code to print OP_CODE in core/iwasm/interpreter/wasm_interp_classic.c:
Whether I use printf("c = %c\n", g[0].c); or printf("g[0].c = %c\n", g[0].c); to print g[0].c, the OP_CODE sequences should be the same.
Actual behavior
I recorded the OP_CODE sequence of printf("c = %c\n", g[0].c); and printf("g[0].c = %c\n", g[0].c);, but there are many differences between the two sequences, for example:
There are more differences between those two sequence.
I use wasm2wat to convert wasm file to wat file, and converted two wasm files with different print sentences(printf("c = %c\n", g[0].c); and printf("g[0].c = %c\n", g[0].c);). Then I compared the two wat files and found no difference between them.
Subject of the issue
I've tried to print the OP_CODE for debugging, and I found that when print the same variable with different prefix string, the OP_CODE sequences are different. I wonder why there is such difference or what's the behavior of the extra different OP_CODE, because I think that the prefix string of
printf
should not impact the OP_CODE sequence.Test case
This is my code to print OP_CODE in
core/iwasm/interpreter/wasm_interp_classic.c
:And this is my code for printing a variable:
And this is the script to build the test application:
Expected behavior
Whether I use
printf("c = %c\n", g[0].c);
orprintf("g[0].c = %c\n", g[0].c);
to printg[0].c
, the OP_CODE sequences should be the same.Actual behavior
I recorded the OP_CODE sequence of
printf("c = %c\n", g[0].c);
andprintf("g[0].c = %c\n", g[0].c);
, but there are many differences between the two sequences, for example:There are more differences between those two sequence.
My environment
Extra Info
I use
wasm2wat
to convert wasm file to wat file, and converted two wasm files with different print sentences(printf("c = %c\n", g[0].c);
andprintf("g[0].c = %c\n", g[0].c);
). Then I compared the two wat files and found no difference between them.