Comments (6)
This is bizarre.
I investigated a bit and the issue seems to rise only if the Lua environment has been initialized.
If you try to run the benchmark after an initialization based on kEventInit
instead of kEventInitLua
everything is fine.
I had this suspicion when I saw the simulator crash report, the simulator crashed calling some Lua related stuff under the hood.
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x19057d11c __pthread_kill + 8
1 libsystem_pthread.dylib 0x1905b4cc0 pthread_kill + 288
2 libsystem_c.dylib 0x1904c4a40 abort + 180
3 Playdate Simulator 0x104aa44c8 luaD_throw + 84
4 Playdate Simulator 0x104ad18a0 luaG_errormsg + 168
5 Playdate Simulator 0x104ab55a0 lua_error + 160
6 Playdate Simulator 0x104a9de4c luaL_error + 76
7 Playdate Simulator 0x104afaf0c pc_luaError + 80
8 Playdate Simulator 0x104ab350c auxgetstr + 224
9 Playdate Simulator 0x104a9e368 luaL_testudata + 76
10 Playdate Simulator 0x104a9e3c8 luaL_checkudata + 32
11 Playdate Simulator 0x104af65b0 luasprite_setImage + 108
12 Playdate Simulator 0x104af6508 pc_sprite_setImage + 140
13 pdex.dylib 0x10c976de8 setImage__OOZOOZOOZOOZOnimbleZpkgsZplaydate4548O4949O50ZplaydateZsprite_781 + 208 (sprite.nim:120)
14 pdex.dylib 0x10c97d510 colonanonymous___bench_225 + 104 (bench.nim:124)
15 pdex.dylib 0x10c97ee54 update__bench_550 + 1368 (bench.nim:242)
16 pdex.dylib 0x10c984050 update__screen_9 + 392 (screen.nim:6)
17 pdex.dylib 0x10c98379c catchingUpdate__nim95snake_10 + 368 (nim_snake.nim:19)
18 pdex.dylib 0x10c97303c privateUpdate__OOZOOZOOZOOZOnimbleZpkgsZplaydate4548O4949O50ZplaydateZsystem_75 + 312 (system.nim:38)
19 Playdate Simulator 0x104b03064 pd_update + 468
20 Playdate Simulator 0x104b55850 -[PCPlaydateSimulator update] + 508
21 Foundation 0x1917b62d8 __NSThreadPerformPerform + 264
22 CoreFoundation 0x190691cfc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
23 CoreFoundation 0x190691c90 __CFRunLoopDoSource0 + 176
24 CoreFoundation 0x190691a00 __CFRunLoopDoSources0 + 244
25 CoreFoundation 0x1906905f0 __CFRunLoopRun + 828
26 CoreFoundation 0x19068fc5c CFRunLoopRunSpecific + 608
27 HIToolbox 0x19ac0c448 RunCurrentEventLoopInMode + 292
28 HIToolbox 0x19ac0c0d8 ReceiveNextEventCommon + 220
29 HIToolbox 0x19ac0bfdc _BlockUntilNextEventMatchingListInModeWithFilter + 76
30 AppKit 0x193e6ac54 _DPSNextEvent + 660
31 AppKit 0x194640ebc -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716
32 AppKit 0x193e5e100 -[NSApplication run] + 476
33 AppKit 0x193e353cc NSApplicationMain + 880
34 dyld 0x1902390e0 start + 2360
Maybe initializing the Lua environment the OS assumes the Lua env is the main resource handler and the GC starts doing some shenanigans?
Not sure, but this could be a firmware-side bug.
from playdate-nim.
I can confirm this also happens in C (as the update-defining language) calling setImage
multiple times when the Lua environment is also initialized.
from playdate-nim.
I can confirm your result.
That's a setback.
Wondered whether adding playdate.stop() and playdate.setCollectsGarbage(false)to main.lua would help. I did see the print statement output I put above that, so I know it got executed, but unfortunately it did not make a difference.
from playdate-nim.
I'll make a minimal reproduction project and file a bug on the forum.
from playdate-nim.
Thanks. I'd offer to do it myself, but I don't have a pure C environment ready to go at the moment. Making an example that is more ready to run (without having to install nim) and excludes nim as the problem would have benefits for sure
from playdate-nim.
This has been confirmed to be a Playdate SDK bug: comment
Closing.
from playdate-nim.
Related Issues (20)
- Build for device OS 2.0 error: undefined reference to `_fini' HOT 1
- Does not compile with Nim 2.0.0 HOT 8
- Runtime crashes halt simulator without any indication of problems HOT 6
- Feature: Basic Lua interop HOT 9
- Implement Std/random HOT 3
- api aliases HOT 2
- implement os module HOT 2
- Use `projectName()` instead of static PDX name? HOT 4
- Conflicting types HOT 4
- player volume: double promotion warning HOT 2
- Unclear naming requirement for main entrypoint nim file HOT 2
- arm-none-eabi-gcc: fatal error: cannot read spec file 'nosys.specs': No such file or directory HOT 3
- Any guidance on unit tests? HOT 1
- When importing std/logging, device compilation fails HOT 1
- Mac device Debug builds for device profiling HOT 1
- How to deal with "declared lock level is 0, but real lock level is <unknown> [LockLevel]" HOT 3
- Playdate memory allocator HOT 6
- Update the recommended VSCode Nim extension in the README HOT 1
- sigabrt: double free when calling file.close()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from playdate-nim.