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

Core/HW -> PowerPC/JIT: Fastmem arena construction #8537

Merged
merged 6 commits into from Jan 13, 2020

Conversation

@degasus
Copy link
Member

degasus commented Dec 28, 2019

This pull request splits the fastmem arena construction out of the memory mapper. So for the generic emulation, we won't allocate the huge junk of virtual memory.

However the JIT now creates them the fastmem arena if needed. So with disabled fastmem, we won't allocate it any more.

degasus added 6 commits Nov 27, 2019
physical_base is a fastmem helper. Its access is unsafe and might not be available without a Jit.
This shall be called by the Jit, not by the emulation start itself.
The code is safe not to create memory errors, but it accesses the fastmem area.
RMEM won't help if there is no fastmem arena, so let's use our memory helpers.
This was a huge speedup with disabled fastmem, but it still requires the fastmem arena.
So let's disable it for now, even if this commit has a huge performance hit with disabled fastmem.
@degasus degasus force-pushed the degasus:fastmem branch from 871e9c1 to aad8aab Dec 28, 2019
for (PhysicalMemoryRegion& region : physical_regions)
{
if ((flags & region.flags) != region.flags)
continue;

u8* base = physical_base + region.physical_address;
*region.out_pointer = (u8*)g_arena.CreateView(region.shm_position, region.size, base);
*region.out_pointer = (u8*)g_arena.CreateView(region.shm_position, region.size);

This comment has been minimized.

Copy link
@BhaaLseN

BhaaLseN Dec 28, 2019

Member

What do you think of replacing those C-style casts with the appropriate C++ cast while we're at it?

@@ -304,7 +304,9 @@ void Jit64::dcbz(UGeckoInstruction inst)
AND(32, R(RSCRATCH), Imm32(~31));
}

if (MSR.DR)
bool emit_fast_path = MSR.DR && m_jit.jo.fastmem_arena;

This comment has been minimized.

Copy link
@stenzek

stenzek Jan 3, 2020

Contributor

Can this be jo.fastmem instead as fastmem checks for fastmem_arena in the base class?

This comment has been minimized.

Copy link
@degasus

degasus Jan 3, 2020

Author Member

I tried to keep this separate. jo.fastmem_arena might be turned on without the exception handlers. The checks for jo.fastmem requires both.

@@ -371,7 +371,7 @@ void EmuCodeBlock::SafeLoadToReg(X64Reg reg_value, const Gen::OpArg& opAddress,

FixupBranch exit;
const bool dr_set = (flags & SAFE_LOADSTORE_DR_ON) || MSR.DR;
const bool fast_check_address = !slowmem && dr_set;
const bool fast_check_address = !slowmem && dr_set && m_jit.jo.fastmem_arena;

This comment has been minimized.

Copy link
@stenzek

stenzek Jan 3, 2020

Contributor

Same with these

@stenzek
stenzek approved these changes Jan 3, 2020
Copy link
Contributor

stenzek left a comment

LGTM then

@JMC47

This comment has been minimized.

Copy link
Contributor

JMC47 commented Jan 13, 2020

Is this ready to go? I see pending questions that don't appear to be answered. When they're taking care of, I'm willing to merge.

@stenzek

This comment has been minimized.

Copy link
Contributor

stenzek commented Jan 13, 2020

degasus explained the reasoning on IRC. I probably should've mentioned that in my review.

@stenzek stenzek merged commit efc1ee8 into dolphin-emu:master Jan 13, 2020
10 checks passed
10 checks passed
default Very basic checks passed, handed off to Buildbot.
Details
lint Build succeeded on builder lint
Details
pr-android Build succeeded on builder pr-android
Details
pr-deb-dbg-x64 Build succeeded on builder pr-deb-dbg-x64
Details
pr-deb-x64 Build succeeded on builder pr-deb-x64
Details
pr-freebsd-x64 Build succeeded on builder pr-freebsd-x64
Details
pr-osx-x64 Build succeeded on builder pr-osx-x64
Details
pr-ubu-x64 Build succeeded on builder pr-ubu-x64
Details
pr-win-dbg-x64 Build succeeded on builder pr-win-dbg-x64
Details
pr-win-x64 Build succeeded on builder pr-win-x64
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.