playdate icon indicating copy to clipboard operation
playdate copied to clipboard

Global Api & Tools refactoring

Open boozook opened this issue 8 months ago • 1 comments

Main subject of this refactoring - how much we trust the vendor (Panic) to keep the execution (c-api, runtime) environment safe. So, we trust where we know exactly how the runtime works and that this behavior will not change. And that's why we optimize rust's safety checks as much as we have confidence in the API.

The second point is testability and simplifying testing of dependent packages.

  • [x] mock (#498, 5958ca2a91259245874d7ec87d019260aa2a703b)
  • [ ] bindgen
    • [x] fix issues (125c2a4b515d375a0f9d0976dcb4c7fa38a6658e, 60e4a3505f04136b2b5d9c609c902cb851215934, c2de818ea0a110f06b9f6c2826e2ac413e05801e)
    • [x] #550
    • [ ] configurable layout tests (on/off)
    • [ ] exclude-path list (#554, ...)
    • [ ] update docs
  • [ ] refactoring
    • [x] refactor & rebuild bindings
    • [x] playdate-sys (9d3bed0602cd5a0832d98ec45319ede7535f0172, 60e4a3505f04136b2b5d9c609c902cb851215934, following #513)
      • [x] new panic handler
      • [x] new allocator (+fix #556)
      • [x] support allocator-api
      • [x] on-stack heap-less (almost always) formatting for stdout & stderr (for panic and oom)
      • [x] renew examples
      • [x] reduce feafures: (#550)
      • [ ] update docs (features, cfg, tests: 9d3bed0602cd5a0832d98ec45319ede7535f0172, etc..)
    • [x] playdate-color (ea064e65e428af27b1df1a0601c201bd47c1c7f8)
    • [x] playdate-controls (faa3feed852664f34745c01cedd6dc6b3baeef9c, 1b6363c6b8925792fc592b799f6f47782f9fdc12)
    • [x] playdate-display
    • [x] playdate-fs (#555, bd890f559fafb9357a4722296685082f109ccb24)
    • [x] playdate-graphics (c9136a00414c899a0658e5fcd38519b4ae6b43cf, 58dddce7554f161669600f9022184c32957c81ff)
    • [x] playdate-menu (51fa1dac9814cc3c2a2ca0da9c9dd1b6caa75d05)
    • [ ] playdate-scoreboards
    • [ ] playdate-sound
    • [ ] playdate-sprite
    • [x] playdate-system
    • [ ] playdate
    • [ ] playdate-ui-crank-indicator
    • [x] playdate-lua (bff219f1fb2c68c6eadd88cfa8d25a6220d78675)
  • [ ] Tests using miri (#557)
    • [x] Explain how to test in docs
    • [x] playdate-sys & playdate-sys-mock (1587d7f7767ebcbcdeaac866374f11759b4adcca, f4e9e6356fcfdfe56e1a306ae6036bc4d3e98b21)
    • [x] playdate-color (27d900d64f948546756dfcac7f45cb7d6628f4f9, 4f18d2a850c8df6878e4e5bb7cb0c58335f81497)
    • [ ] playdate-controls (rem: 1b6363c6b8925792fc592b799f6f47782f9fdc12, )
    • [ ] playdate-display
    • [ ] playdate-fs (0d3c6efb9f325cb2d3ad20113b2cc025a0fe708e)
    • [ ] playdate-graphics
    • [ ] playdate-menu
    • [ ] playdate-scoreboards
    • [ ] playdate-sound
    • [ ] playdate-sprite
    • [] playdate-system
    • [ ] playdate
    • [ ] playdate-ui-crank-indicator
  • [x] new callbacks (#418, #561,..)
  • [ ] cover new APIs (see changelog)

boozook avatar Apr 10 '25 12:04 boozook

Just added neat little tracing 🎉 e.g.

[stack] 528 bytes for server_time::on_update at api/system/examples/get_server_time.rs:150:5
|alloc| global.dealloc	134b		0x168006c0
⎣alloc⎦ api.realloc	0b		0x168006c0
⎡alloc⎤ global.alloc	52b
⎣alloc⎦ api.realloc	52b		0
|alloc| global.realloc	52b -> 124b	0x168006c0
⎣alloc⎦ api.realloc	124b		0x168006c0
|alloc| global.realloc	124b -> 250b	0x168006c0
⎣alloc⎦ api.realloc	250b		0x168006c0
...
|alloc| global.dealloc	250b		0x168006c0

Usage: Build with RUSTFLAGS='--cfg pdtrace="alloc" --cfg pdtrace="stack"'

boozook avatar May 11 '25 15:05 boozook