-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Small opcode optimisation #14
Open
PierreAntoineGuillaume
wants to merge
6
commits into
igorw:master
Choose a base branch
from
PierreAntoineGuillaume:igorw
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
line #* E I O op fetch ext return operands ------------------------------------------------------------------------------------- 3 0 E > RECV !0 1 RECV !1 2 RECV_INIT !2 null 6 3 > NOP 7 4 INIT_DYNAMIC_CALL !1 5 DO_FCALL 0 $4 6 > RETURN $4 7* JMP ->24 8 8 E > > CATCH last 'Exception' 9 9 > > JMPZ !2, ->13 10 10 > INIT_DYNAMIC_CALL !2 11 SEND_VAR_EX !3 12 DO_FCALL 0 12 13 > BOOL_XOR ~6 !0 14 > JMPZ ~6, ->21 13 15 > NEW $7 :18 16 SEND_VAL_EX '' 17 SEND_VAL_EX 0 18 SEND_VAR_EX !3 19 DO_FCALL 0 20 > THROW 0 $7 15 21 > POST_DEC ~9 !0 22 FREE ~9 16 23 > JMP ->3 18 24* > RETURN null
line #* E I O op fetch ext return operands ------------------------------------------------------------------------------------- 3 0 E > RECV !0 1 RECV !1 2 RECV_INIT !2 null 6 3 > NOP 7 4 INIT_DYNAMIC_CALL !1 5 DO_FCALL 0 $4 6 > RETURN $4 7* JMP ->9 8 8 E > > CATCH last 'Exception' 10 9 > > JMPZ !2, ->13 11 10 > INIT_DYNAMIC_CALL !2 11 SEND_VAR_EX !3 12 DO_FCALL 0 13 13 > BOOL_XOR ~6 !0 14 > JMPZ ~6, ->21 14 15 > NEW $7 :18 16 SEND_VAL_EX '' 17 SEND_VAL_EX 0 18 SEND_VAR_EX !3 19 DO_FCALL 0 20 > THROW 0 $7 16 21 > POST_DEC ~9 !0 22 FREE ~9 17 23 > JMP ->3 18 24* > RETURN null
… {...}" because postfix operation returns a copy of the previous value line #* E I O op fetch ext return operands ------------------------------------------------------------------------------------- 2 0 E > RECV !0 1 RECV !1 2 RECV_INIT !2 null 5 3 > NOP 6 4 INIT_DYNAMIC_CALL !1 5 DO_FCALL 0 $4 6 > RETURN $4 7* JMP ->9 7 8 E > > CATCH last 'Exception' 8 9 > > JMPZ !2, ->13 9 10 > INIT_DYNAMIC_CALL !2 11 SEND_VAR_EX !3 12 DO_FCALL 0 11 13 > POST_DEC ~6 !0 14 BOOL_XOR ~7 ~6 15 > JMPZ ~7, ->22 12 16 > NEW $8 :14 17 SEND_VAL_EX '' 18 SEND_VAL_EX 0 19 SEND_VAR_EX !3 20 DO_FCALL 0 21 > THROW 0 $8 14 22 > > JMP ->3 15 23* > RETURN null
…ning, and if we dont, we fail too hard. line #* E I O op fetch ext return operands ------------------------------------------------------------------------------------- 2 0 E > RECV !0 1 RECV !1 2 RECV_INIT !2 null 5 3 > NOP 6 4 INIT_DYNAMIC_CALL !1 5 DO_FCALL 0 $4 6 > RETURN $4 7* JMP ->9 7 8 E > > CATCH last 'Exception' 8 9 > > JMPZ !2, ->13 9 10 > INIT_DYNAMIC_CALL !2 11 SEND_VAR_EX !3 12 DO_FCALL 0 11 13 > POST_DEC ~6 !0 14 > JMPZ ~6, ->16 12 15 > > JMP ->3 14 16 > NEW $7 :13 17 SEND_VAL_EX '' 18 SEND_VAL_EX 0 19 SEND_VAR_EX !3 20 DO_FCALL 0 21 > THROW 0 $7 15 22* > RETURN null
….. while condition, that does only one line #* E I O op fetch ext return operands ------------------------------------------------------------------------------------- 2 0 E > RECV !0 1 RECV !1 2 RECV_INIT !2 null 7 3 > INIT_DYNAMIC_CALL !1 4 DO_FCALL 0 $4 5 > RETURN $4 6* JMP ->8 8 7 E > > CATCH last 'Exception' 9 8 > > JMPZ !2, ->12 10 9 > INIT_DYNAMIC_CALL !2 10 SEND_VAR_EX !3 11 DO_FCALL 0 13 12 > POST_DEC ~6 !0 13 > JMPNZ ~6, ->3 14 14 > NEW $7 :12 15 SEND_VAL_EX '' 16 SEND_VAL_EX 0 17 SEND_VAR_EX !3 18 DO_FCALL 0 19 > THROW 0 $7 15 20* > RETURN null
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi !
I don't know if you are interested, but here's a tiny opcode optimisation for your retry.
It happens that it does not use goto, and of course it passes your tests.
Each commit has the opcode details of the transformation (the first is just a dummy commit to log the first opcode list).
Please know that I am not here for drama.
Have a nice day