forked from TkTech/Burger
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Fix instructions for some packets #42
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure this will work correctly. There's a different implementation for
java/util/Map
(which I'm also not sure is correct, but it does guarantee thatinstruction.pos <= pos
andpos < instruction.pos + 1
). Though, I also don't 100% remember whatpos
corresponds to - if it's a byte offset, this might be better as call instructions are multiple bytes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I didn't add to the instruction pos the
else
was empty and the instructions were getting mixed with theif
instructions, so I think the implementation for Map might actually be wrong. I also just checked by doingprint(instruction.pos)
at the beginning of a loop where a method is disassembled, and it does look like they're byte offsets since the positions usually increase by more than 1 at a time.Ok also you don't need to answer this, but why do operations even need to store their position? Can't that just be figured out from the order in the operations list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, it's probably fine.
I'm pretty sure that specific part of the code predates me. I do know that they aren't initially sorted (which is what
ordered_operations
does). I assume that it's related toendif
, which I think gets put into the list as soon as a jump is seen. Not that the if handling is great; see #2 and #3. I think it also relates to converting from a list of instructions into a nested tree structure (seeformat
).