Code Monkey home page Code Monkey logo

Comments (6)

samdze avatar samdze commented on June 8, 2024

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.

samdze avatar samdze commented on June 8, 2024

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.

ninovanhooff avatar ninovanhooff commented on June 8, 2024

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.

samdze avatar samdze commented on June 8, 2024

I'll make a minimal reproduction project and file a bug on the forum.

from playdate-nim.

ninovanhooff avatar ninovanhooff commented on June 8, 2024

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.

samdze avatar samdze commented on June 8, 2024

This has been confirmed to be a Playdate SDK bug: comment

Closing.

from playdate-nim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.