-
Notifications
You must be signed in to change notification settings - Fork 146
Slot opcodes #246
Comments
I understand that it will reduce opcodes and it could be faster, but could yo specify how will work the argument slot? it will be an array? |
After Other |
Is good to me, I think that it will improve the execution flow. |
so we have argumentlist,slotlist,staticslotlist on executecontext? INITSLOT is not nessessary STLOC or STSFLD can init it automatic. |
Initially all the parameters are on the stack, you need
int min(int x, int y)
{
if (x > y) x = y;
return x;
} |
if CALL do not create param list Push1 ?where fill 1 2 to paramlist? insert code at beginning of xxx? |
|
|
ok,got it. |
At the beginning of the entry point, the compiler should generate |
Cool,more like c# now. |
NEO RAM Memory |
More like wasm as well. So we move from altstack model to linear memory... both work for me. I guess altstack is used on 99.9% of the time just for a single element or two, so it doesnt make sense indeed. |
If we use so much double pushes, I think we could create an opcode DPUSH 02 00 that pushes two next bytes on stack. Its very common pattern, and will be more. Agree with static args and local structure. |
The two parameters could be the operand of |
Better idea 😂 its also much safer... otherwise local buffers will get unpredictable sizes, terrible for optimizers and bug checkers. I'd like to see same strategy for args index loads and stores as well,so we easily guarantee var structure is correct. |
Quite radical change, but maybe interesting. One question that I have is what's the rationale for these three slots other than it resembles CLR? Maybe we are fine with just one? If we're to solve |
I think three is just to simplify access, and avoid counts... otherwise we mix local, global and params. Space complexity is the same, so it may help us simplify. |
In NEO2, we have alt stack and several opcodes such as
TOALTSTACK
andFROMALTSTACK
to support parameters, local variables, and static fields. But since we are not going to be compatible with NEO2, we can remove the alt stack.By adding some new opcodes, we can make access to parameters, local variables, and static fields easier:
The argument slot and local variable list will be automatically cleaned up when
RET
is executed. The static field list will be automatically cleaned up when the last execution context belonging to the current contract is unloaded.This way, we can completely remove alt stack and related opcodes. The implementation of the compiler will also be more convenient.
The text was updated successfully, but these errors were encountered: