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

SSEM emulation is incredibly slow on Windows #181

Closed
vbmacher opened this issue Jul 2, 2020 · 2 comments
Closed

SSEM emulation is incredibly slow on Windows #181

vbmacher opened this issue Jul 2, 2020 · 2 comments
Labels
Milestone

Comments

@vbmacher
Copy link
Collaborator

vbmacher commented Jul 2, 2020

Tested with Java 14

@vbmacher vbmacher added the bug label Jul 2, 2020
@vbmacher vbmacher added this to the 0.41 milestone Jul 2, 2020
@vbmacher
Copy link
Collaborator Author

[ERROR] Memory listener error
java.lang.ArrayIndexOutOfBoundsException: Index 128 out of bounds for length 128
        at net.emustudio.plugins.memory.ssem.MemoryContextImpl.readWord(MemoryContextImpl.java:46)
        at net.emustudio.plugins.memory.ssem.MemoryContextImpl.readWord(MemoryContextImpl.java:26)
        at net.emustudio.plugins.device.ssem.display.DisplayGui$1.memoryChanged(DisplayGui.java:53)
        at net.emustudio.emulib.plugins.memory.AbstractMemoryContext.lambda$notifyMemoryChanged$0(AbstractMemoryContext.java:89)
        at java.base/java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:804)
        at java.base/java.util.concurrent.CopyOnWriteArraySet.forEach(CopyOnWriteArraySet.java:425)
        at net.emustudio.emulib.plugins.memory.AbstractMemoryContext.notifyMemoryChanged(AbstractMemoryContext.java:87)
        at net.emustudio.plugins.memory.ssem.MemoryContextImpl.writeWord(MemoryContextImpl.java:60)
        at net.emustudio.plugins.memory.ssem.MemoryContextImpl.writeWord(MemoryContextImpl.java:26)
        at net.emustudio.plugins.cpu.ssem.EmulatorEngine.writeInt(EmulatorEngine.java:112)
        at net.emustudio.plugins.cpu.ssem.EmulatorEngine.step(EmulatorEngine.java:82)
        at net.emustudio.plugins.cpu.ssem.EmulatorEngine.run(EmulatorEngine.java:127)
        at net.emustudio.plugins.cpu.ssem.CpuImpl.call(CpuImpl.java:147)
        at net.emustudio.plugins.cpu.ssem.CpuImpl.call(CpuImpl.java:44)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
        at java.base/java.lang.Thread.run(Thread.java:832)

@vbmacher
Copy link
Collaborator Author

vbmacher commented Apr 8, 2021

Slowness was caused by imprecise LockSupport.parkNanos() on Windows. The exception was caused by wrong handling of memory addresses. The commit above also improved measuring how many nanos we should wait after each instructions to get 700 instructions/second.

vbmacher added a commit that referenced this issue Apr 8, 2021
[#181] Fix slowness and wrong reading memory
@vbmacher vbmacher closed this as completed Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant