Skip to content

i2c.c: rename "clock" => "scl" (+ modSsd1306.c). Fixes gh-14 - #17

Closed
rwaldron wants to merge 320 commits into
Moddable-OpenSource:publicfrom
rwaldron:14
Closed

rwaldron wants to merge 320 commits into
Moddable-OpenSource:publicfrom
rwaldron:14

Conversation

@rwaldron

Copy link
Copy Markdown
Contributor

Smoke tested with:

  • examples/drivers/BMP180
  • examples/drivers/lis3dh
  • examples/drivers/mcp23008 (existing and new feature branch)
  • examples/drivers/mcp23017

@rwaldron
rwaldron requested review from mkellner and phoddie December 12, 2017 15:59
@phoddie

phoddie commented Dec 12, 2017

Copy link
Copy Markdown
Collaborator

Tnanks, looks good. I believe examples/drivers/HMC5883L/main.js needs to be updated in the call to the SMBus constructor. Additionally, it would be good to update the I2C constructor docs in pins.md.

Smoke tested with:

- examples/drivers/BMP180
- examples/drivers/HMC5883L
- examples/drivers/lis3dh
- examples/drivers/mcp23008 (existing and new feature branch)
- examples/drivers/mcp23017 (on new feature branch)
I created these while testing the examples and thought it might benefit others to share them.
@rwaldron

Copy link
Copy Markdown
Contributor Author

@phoddie updated!

@phoddie

phoddie commented Dec 14, 2017

Copy link
Copy Markdown
Collaborator

Looks great. We'll get these merged (Big thanks for the two manifests - I haven't had a chance to dig those components out recently to put those together)

@mkellner mkellner closed this Dec 14, 2017
mkellner pushed a commit that referenced this pull request Dec 1, 2021
kriscendobot added a commit to kriscendobot/moddable that referenced this pull request Jun 30, 2026
`fx_Array_prototype_flatAux` pushed each per-element mapper result (and
each nested sub-array) onto the value stack and never popped it before
the next iteration. Once an element is defined into the heap-allocated
result array (`mxDefineIndex`, which writes into `mxResult` and pops only
the result-array reference), or once a nested array has been fully
flattened into the result, its value-stack slot is dead weight: it is
already reachable from the result array, so it no longer needs a stack
root. Leaving it resident makes peak value-stack use O(flattened output
length) instead of O(depth).

Add a single `mxPop()` at the end of each iteration to drop that dead
slot, mirroring `fx_Array_prototype_forEach` (which already pops every
iteration and is therefore O(1)). The result is still constructed
entirely on the heap; we just stop spreading the inputs across the stack
while building it.

This is GC-safe: an element is popped only after `mxDefineIndex` has
stored it into the result array (heap-rooted), and a nested array is
popped only after the recursive `flatAux` has copied its leaves into the
result; during the recursion the sub-array stays on the stack as the
recursion source, so it is rooted throughout.

Motivation: a real Agoric contract upgrade import overflowed the xsnap
value stack (fixed stackCount=4096) at `@agoric/internal/src/hex.js`'s
top-level `new Map(encodings.flatMap(...))` (256x4 pair-arrays left
~1232 slots resident). With this fix the same import completes at the
stock 4096-slot stack. Investigation: kriscendobot/garden#9 and Moddable-OpenSource#17.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants