arbitrarily slash the size of most libsnes cothreads significantly, decreasing overall state size from 10MB to 7MB

This commit is contained in:
nattthebear 2017-06-11 20:33:58 -04:00
parent 4cd3325295
commit 668006fba0
19 changed files with 19 additions and 19 deletions

Binary file not shown.

View File

@ -113,7 +113,7 @@ void CPU::power() {
}
void CPU::reset() {
create(Enter, system.cpu_frequency());
create(Enter, system.cpu_frequency(), 16384);
coprocessors.reset();
PPUcounter::reset();

View File

@ -345,7 +345,7 @@ void PPU::power() {
}
void PPU::reset() {
create(Enter, system.cpu_frequency());
create(Enter, system.cpu_frequency(), 32768);
PPUcounter::reset();
memset(surface, 0, 512 * 512 * sizeof(uint32));

View File

@ -155,7 +155,7 @@ void ArmDSP::reset() {
}
void ArmDSP::arm_reset() {
create(ArmDSP::Enter, 21477272);
create(ArmDSP::Enter, 21477272, 8192);
bridge.ready = false;
bridge.timer = 0;

View File

@ -58,7 +58,7 @@ void HitachiDSP::power() {
}
void HitachiDSP::reset() {
create(HitachiDSP::Enter, frequency);
create(HitachiDSP::Enter, frequency, 8192);
state = State::Idle;
regs.n = 0;

View File

@ -45,7 +45,7 @@ void ICD2::power() {
}
void ICD2::reset() {
create(ICD2::Enter, cpu.frequency / 5);
create(ICD2::Enter, cpu.frequency / 5, 16384);
r6000_ly = 0x00;
r6000_row = 0x00;

View File

@ -44,7 +44,7 @@ void Link::power() {
void Link::reset() {
if(link_reset) link_reset();
create(Link::Enter, frequency);
create(Link::Enter, frequency, 8192);
}
uint8 Link::read(unsigned addr) {

View File

@ -63,7 +63,7 @@ void MSU1::power() {
}
void MSU1::reset() {
create(MSU1::Enter, 44100);
create(MSU1::Enter, 44100, 16384);
mmio.data_offset = 0;
mmio.audio_offset = 0;

View File

@ -275,7 +275,7 @@ void NECDSP::power() {
}
void NECDSP::reset() {
create(NECDSP::Enter, frequency);
create(NECDSP::Enter, frequency, 8192);
for(unsigned n = 0; n < 16; n++) regs.stack[n] = 0x0000;
regs.pc = 0x0000;

View File

@ -130,7 +130,7 @@ void SA1::power() {
}
void SA1::reset() {
create(SA1::Enter, system.cpu_frequency());
create(SA1::Enter, system.cpu_frequency(), 8192);
cpubwram.dma = false;
for(unsigned addr = 0; addr < iram.size(); addr++) {

View File

@ -53,7 +53,7 @@ void SuperFX::power() {
}
void SuperFX::reset() {
create(SuperFX::Enter, system.cpu_frequency());
create(SuperFX::Enter, system.cpu_frequency(), 16384);
instruction_counter = 0;
for(unsigned n = 0; n < 16; n++) regs.r[n] = 0x0000;

View File

@ -47,7 +47,7 @@ void Controller::iobit(bool data) {
}
Controller::Controller(bool port) : port(port) {
if(!thread) create(Controller::Enter, 1);
if(!thread) create(Controller::Enter, 1, 4096);
}

View File

@ -99,7 +99,7 @@ void Justifier::latch(bool data) {
}
Justifier::Justifier(bool port, bool chained) : Controller(port), chained(chained) {
create(Controller::Enter, 21477272);
create(Controller::Enter, 21477272, 8192);
latched = 0;
counter = 0;
active = 0;

View File

@ -99,7 +99,7 @@ void SuperScope::latch(bool data) {
}
SuperScope::SuperScope(bool port) : Controller(port) {
create(Controller::Enter, 21477272);
create(Controller::Enter, 21477272, 8192);
latched = 0;
counter = 0;

View File

@ -92,7 +92,7 @@ USART::USART(bool port) : Controller(port) {
if(0 /*open_absolute(filename)*/) {
init = sym("usart_init");
main = sym("usart_main");
if(init && main) create(Controller::Enter, 1000000);
if(init && main) create(Controller::Enter, 1000000, 8192);
}
}

View File

@ -138,7 +138,7 @@ void CPU::power() {
}
void CPU::reset() {
create(Enter, system.cpu_frequency());
create(Enter, system.cpu_frequency(), 16384);
coprocessors.reset();
PPUcounter::reset();

View File

@ -60,7 +60,7 @@ void SMP::power() {
}
void SMP::reset() {
create(Enter, system.apu_frequency());
create(Enter, system.apu_frequency(), 16384);
regs.pc = 0xffc0;
regs.a = 0x00;

View File

@ -23,9 +23,9 @@ namespace SNES {
unsigned frequency;
int64 clock;
inline void create(void (*entrypoint)(), unsigned frequency) {
inline void create(void (*entrypoint)(), unsigned frequency, int size) {
if(thread) co_delete(thread);
thread = co_create(65536 * sizeof(void*), entrypoint);
thread = co_create(size * sizeof(void*), entrypoint);
this->frequency = frequency;
clock = 0;
}

View File

@ -604,7 +604,7 @@ EXPORT void* DllInit()
co_delete(co_emu);
co_emu = nullptr;
}
co_emu = co_create(65536 * sizeof(void*), new_emuthread);
co_emu = co_create(32768 * sizeof(void*), new_emuthread);
return &comm;
}