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

DSPAnalyzer: Migrate off file-scope state #9377

Merged
merged 7 commits into from Dec 29, 2020

Conversation

lioncash
Copy link
Member

Turns the DSP analyzer into a class and situates it within the SDSP struct. With this, I believe all relevant state within the DSP code has been made non-global.

These changes were significantly easier to chunk out into parts for review, as opposed to the deglobalization efforts in DSPCore, as the file-scope state itself was already hidden behind an interface. This more-or-less allowed for "sliding" the class into place in an easier manner.

Each commit should explain what it does and any rationale for it if necessary.

Adds the non-functional skeleton for the to-be Analyzer interface with
deglobalized components.
Attempts to simply make use of the interface. Cleanup will follow in
subsequent commits to make for nicer review.
Copy link
Member

@BhaaLseN BhaaLseN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, untested; and that one remark is ignorable if we want to keep it.

Source/Core/Core/DSP/Interpreter/DSPInterpreter.cpp Outdated Show resolved Hide resolved
Makes it harder to accidentally misuse and increases readability.
Now that we have the convenience functions around the flag
bit manipulations, there's no external usages of the flags, so we can
make these private to the analyzer implementation.

Now the Analyzer namespace is largely unnecessary and can be merged with
the DSP namespace in the next commit.
Now that the Analyzer class fully encapsulates all analyzer state, the
namespace is no longer necessary.
Allows the analyzer to exist independently of the DSP structure. This
allows for unit-tests to be created in a nicer manner.

SDSP is only necessary during the analysis phase, so we only need to
keep a reference around to it then as opposed to the entire lifecycle of
the analyzer.

This also allows the copy/move assignment operators to be defaulted, as
a reference member variable prevents that.
Places them into their own function to keep their functionality isolated
and self-documenting.
@leoetlino leoetlino merged commit ee048ad into dolphin-emu:master Dec 29, 2020
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants