-
Notifications
You must be signed in to change notification settings - Fork 173
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
[Compiler/Decompiler] Better support for Bitfield and Enum types #374
Merged
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
water111
commented
Apr 21, 2021
@@ -3,20 +3,20 @@ | |||
{ | |||
"game_version":1, | |||
// the order here matters (not sure that this is true any more...). KERNEL and GAME should go first | |||
"dgo_names":["CGO/KERNEL.CGO","CGO/GAME.CGO", | |||
"dgo_names_":["CGO/KERNEL.CGO","CGO/GAME.CGO", |
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.
revert this!
A bunch of bitfield enum things now work properly operations with ;; old
(nonzero? (logand (-> arg0 mask) 256))
;; new
(nonzero? (logand (-> arg0 mask) (process-mask process-tree)))
;; old
(set! (-> pp mask) (logior (-> pp mask) 1024))
;; new
(set! (-> pp mask) (logior (-> pp mask) (process-mask going))) operations with ;; old
(set! (-> obj mask) (logand -961 (the-as int (-> arg0 mask))))
;; new
(set!
(-> obj mask)
(logand
(lognot (process-mask sleep sleep-code process-tree heap-shrunk))
(-> arg0 mask)
)
) Setting a value: ;; old
(set! (-> a0-57 mask) (the-as uint #x4011c))
;; new
(set! (-> a0-57 mask) (process-mask pause menu progress process-tree camera)) Still needs support for static data, and for non-bitfield enums. |
Pull Request Test Coverage Report for Build 775900710
💛 - Coveralls |
… w/fix-types-in-defun
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.
This makes enums real types, like bitfields.
So far:
To Do:
(logior <bitfield-enum> <constant>)
. The type pass correctly determines that the result of this is also a bitfield enum, but somehow things go wrong later on.Looks good
Also good:
Wrong:
if it attempted to cast the
512
to aprocess-mask
it would get decompiled properly.