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
Avoid System::GetInstance() and ppcState global in Jit64 and CachedInterpreter. #11677
Avoid System::GetInstance() and ppcState global in Jit64 and CachedInterpreter. #11677
Conversation
72eb8b0
to
e67f4e5
Compare
| @@ -9,11 +9,10 @@ | |||
|
|
|||
| // We offset by 0x80 because the range of one byte memory offsets is | |||
| // -0x80..0x7f. | |||
| #define PPCSTATE(x) \ | |||
| MDisp(RPPCSTATE, (int)((char*)&PowerPC::ppcState.x - (char*)&PowerPC::ppcState) - 0x80) | |||
| #define PPCSTATE(state, x) MDisp(RPPCSTATE, (int)((char*)&(state).x - (char*)&(state)) - 0x80) | |||
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.
Any reason why you can't use something like offsetof here? We don't actually need to know where in memory the struct is when calculating this.
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 don't see why not.
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.
MSVC has no problems with this, but GCC unfortunately does.
/buildbot/pr-ubu-x64/build/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp:23:29: error: ‘field’ is not a constant expression
23 | return PPCSTATE(cr.fields[field]);
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've reverted the change again but if you want to experiment it's here: https://github.com/AdmiralCurtiss/dolphin/tree/deglobal-jit-offsetof
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.
Oh, I see. Come to think of it, we made a special helper for this in JitArm64 for this reason:
| #define PPCSTATE_OFF_CR(i) PPCSTATE_OFF_ARRAY(cr.fields, i) |
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.
Yeah that should work... lemme try that here too.
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.
Seems to work.
df313c2
to
31204ee
Compare
|
Poke? |
31204ee
to
0e06364
Compare
0e06364
to
fc394bd
Compare
No description provided.