Skip to content
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

[decompiler] Better support for non-virtual methods #543

Merged
merged 2 commits into from
May 31, 2021
Merged

Conversation

water111
Copy link
Collaborator

@water111 water111 commented May 31, 2021

Previously the decompiler didn't care if a method call was virtual or not. Now it checks to see if it is what it expects, and gives an error. By default, any basic expects virtual methods. If you find a basic type that doesn't use virtual methods (I think res-lump will be one of these), you can add the :final option in the deftype to tell the compiler/decompiler to use non-virtual method calls.

The decompiler will now recognizes non-virtual method calls, but only if the types match up. If they don't, it leaves it as method-of-type.

Example:

((method-of-type connection get-process) obj)

is now

(get-process obj)

but only when the decompiler know the type of obj is exactly connection.

This also recognizes (new 'stack 'blah ...). Previously they were not recognized in the case where the constructor was actually called.
Example:

((method-of-type vector4s-3 new)
         (the-as symbol (new 'stack-no-clear 'vector4s-3))
         vector4s-3
         )

is now

(new 'stack 'vector4s-3)

@coveralls
Copy link

Pull Request Test Coverage Report for Build 891500464

  • 60 of 88 (68.18%) changed or added relevant lines in 9 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.01%) to 69.773%

Changes Missing Coverage Covered Lines Changed/Added Lines %
decompiler/IR2/AtomicOpTypeAnalysis.cpp 2 3 66.67%
decompiler/IR2/Form.h 0 1 0.0%
common/type_system/deftype.cpp 3 10 30.0%
decompiler/IR2/FormExpressionAnalysis.cpp 29 48 60.42%
Files with Coverage Reduction New Missed Lines %
decompiler/IR2/Form.cpp 3 75.07%
Totals Coverage Status
Change from base Build 891277849: -0.01%
Covered Lines: 35982
Relevant Lines: 51570

💛 - Coveralls

@water111 water111 linked an issue May 31, 2021 that may be closed by this pull request
@water111 water111 merged commit c4f44e2 into master May 31, 2021
@water111 water111 deleted the w/final-methods branch May 31, 2021 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[decompiler] Handle virtual vs. nonvirtual method calls
2 participants