mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
Gracefully skipping noaccess constant loads.
This commit is contained in:
parent
6f4049ac0f
commit
6edf4f898f
|
|
@ -188,18 +188,19 @@ bool ConstantPropagationPass::Run(HIRBuilder* builder) {
|
||||||
auto heap = memory->LookupHeap(address);
|
auto heap = memory->LookupHeap(address);
|
||||||
uint32_t protect;
|
uint32_t protect;
|
||||||
if (heap->QueryProtect(address, &protect) &&
|
if (heap->QueryProtect(address, &protect) &&
|
||||||
!(protect & kMemoryProtectWrite)) {
|
!(protect & kMemoryProtectWrite) &&
|
||||||
|
(protect & kMemoryProtectRead)) {
|
||||||
// Memory is readonly - can just return the value.
|
// Memory is readonly - can just return the value.
|
||||||
switch (v->type) {
|
switch (v->type) {
|
||||||
case INT32_TYPE:
|
case INT32_TYPE:
|
||||||
v->set_constant(xe::load_and_swap<uint32_t>(
|
v->set_constant(xe::load_and_swap<uint32_t>(
|
||||||
memory->TranslateVirtual(address)));
|
memory->TranslateVirtual(address)));
|
||||||
|
i->Remove();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert_unhandled_case(v->type);
|
assert_unhandled_case(v->type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i->Remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue