Pre-sizing export tables.

This commit is contained in:
Ben Vanik 2015-06-03 22:40:23 -07:00
parent 5c41a8f0f9
commit bba530f628
2 changed files with 6 additions and 14 deletions

View File

@ -35,12 +35,10 @@ XamModule::XamModule(Emulator* emulator, KernelState* kernel_state)
xam::RegisterVoiceExports(export_resolver_, kernel_state_);
}
std::vector<xe::cpu::Export*> xam_exports;
std::vector<xe::cpu::Export*> xam_exports(4096);
xe::cpu::Export* RegisterExport_xam(xe::cpu::Export* export) {
if (xam_exports.size() <= export->ordinal) {
xam_exports.resize(xe::round_up(export->ordinal, 256));
}
assert_true(export->ordinal < xam_exports.size());
xam_exports[export->ordinal] = export;
return export;
}
@ -56,9 +54,7 @@ void XamModule::RegisterExportTable(xe::cpu::ExportResolver* export_resolver) {
#include "xenia/kernel/util/export_table_post.inc"
for (size_t i = 0; i < xe::countof(xam_export_table); ++i) {
auto& export = xam_export_table[i];
if (xam_exports.size() <= export.ordinal) {
xam_exports.resize(xe::round_up(export.ordinal, 256));
}
assert_true(export.ordinal < xam_exports.size());
if (!xam_exports[export.ordinal]) {
xam_exports[export.ordinal] = &export;
}

View File

@ -150,12 +150,10 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
WT_EXECUTEINTIMERTHREAD);
}
std::vector<xe::cpu::Export*> xboxkrnl_exports;
std::vector<xe::cpu::Export*> xboxkrnl_exports(4096);
xe::cpu::Export* RegisterExport_xboxkrnl(xe::cpu::Export* export) {
if (xboxkrnl_exports.size() <= export->ordinal) {
xboxkrnl_exports.resize(xe::round_up(export->ordinal, 256));
}
assert_true(export->ordinal < xboxkrnl_exports.size());
xboxkrnl_exports[export->ordinal] = export;
return export;
}
@ -172,9 +170,7 @@ void XboxkrnlModule::RegisterExportTable(
#include "xenia/kernel/util/export_table_post.inc"
for (size_t i = 0; i < xe::countof(xboxkrnl_export_table); ++i) {
auto& export = xboxkrnl_export_table[i];
if (xboxkrnl_exports.size() <= export.ordinal) {
xboxkrnl_exports.resize(xe::round_up(export.ordinal, 256));
}
assert_true(export.ordinal < xboxkrnl_exports.size());
if (!xboxkrnl_exports[export.ordinal]) {
xboxkrnl_exports[export.ordinal] = &export;
}