Moddable SDK 4.7.0
The Moddable SDK 4.7.0 release contains improvements made between April 3, 2024 and May 5, 2024.
This release features very low-level improvements to the Moddable SDK. Highlights include:
- Nordic nRF52 IO enhancements
- String performance optimizations
- First implementation of draft ECMA-419 Files API
- Significant additions to
xst
, the XS test tool, to expand test coverage including running test262 under Hardened JavaScript
Note: This release is expected to be the last using ESP-IDF 5.1.2. We will migrate to ESP-IDF 5.2.1 in the next few weeks. ESP-IDF 5.2.1 has many Wi-Fi and BLE improvements.
Release Details
-
XS JavaScript engine
- String optimizations
- Background: XS optimizes strings to minimize memory use. For some operations on larger strings (over 1024 bytes), this reduces performance.
- Added optional side-table to optimize common string operations. The side-table caches the following information for the most recently used strings:
- String length in bytes
- String length in Unicode codepoints
- Flag indicating string is 7-bit only ASCII
- Last accessed index in bytes and Unicode codepoints
- Side-table improves performance of common operations by 100x or more for long strings
- Disabled by default in embedded runtimes
- Enabled by default in command line build tools and
xsbug
- Upgrade to
fdlibm
from FreeBSD (previously using Netlib version)- Benefits
- Actively maintained version
- Fixes several undefined behavior errors
- Generates results consistent with V8
- Note: XS does not use
fdlibm
by default but provides it as an option for runtimes that need numerical consistency beyond what ECMA-262 requires
- Benefits
- Fixes for issues uncovered through fuzz testing. Thank you to @Agoric for their support of this work.
String.prototype.at
could read from arbitrary memory if garbage collection occurred while validating arguments- Eliminate overflow in newly added
Uint8Array
toBase64
andtoHex
- Fix build conflict between string cache and metering (contributed by @raphdev)
- String optimizations
-
Modules
- ECMA-419
- Early implementation of Files for ECMA-419 3rd Edition. This is currently POSIX-only, for macOS and Linux. Embedded device support and unit tests are planned.
- Poco
- Option to allocate pixel buffers in DMA capable memory as required by ILI9341 (MIPI) 8-bit parallel display driver
- Let display driver set minimum size of pixel rendering buffer
- ILI9341 (MIPI) 8-bit parallel display driver keeps display output disabled until first frame is drawn to eliminate start-up display glitch
- ECMA-419
-
Devices
- nRF52
- Improvements when building on nRF targets on Windows
USE_WDT
supported- Don't build USB sources on device without USB (UART-only)
- ECMA-419 PWM
hz
getter returns actual frequency, not requested frequency- Support more frequencies with nrF52 specific
top_value
property in constructor's options object
- Instrumentation supported on UART-only builds
- Reset pins to default configuration when closed (not in use). This can reduce energy use.
- Uses SPI2 by default, instead of SPI3, to work around intermittent start-up failures
- Fix build conflict with nRF52
_read
and newread
symbol from XS Base64 support
- Improvements when building on nRF targets on Windows
- ESP32
- Backlight management changes for Hosts that implement
Backlight
class (e.g. Moddable Two, Moddable Display 2)- Commodetto and Piu turn on backlight for projects that include them
- Projects that don't use Commodetto or Piu leave backlight off at start-up
- Backlight management changes for Hosts that implement
- nRF52
-
Documentation
- Add note about working with ESP32 devices that have both USB and UART ports
- Document XS build flags related to strings for configuring ports
- Fix broken links in documentation (contributed by @stc1988). Discovered as part of the project translating Moddable SDK documentation into Japanese.
-
Tools
xst
- Option to track all XS memory allocations to support more efficient fuzzing
- Optionally abort when memory limit exceeded
- Free memory on unrecoverable VM exists
- Source code split into three parts to contain test262 and fuzzing support in their own files for easier maintenance
- Profiling data includes metering count when metering is enabled
- Remove code to disable LSAN, now that xst can clean-up memory allocations on abort (contributed by @raphdev)
- Options to run test262 under lockdown (
-l
) and inside a Compartment after lockdown (-lc
) to validate test262 conformance under Hardened JavaScript.
- Option to track all XS memory allocations to support more efficient fuzzing
serial2xsbug
on macOS suggests launching xsbug if attempt to connect to it failsnodered2mcu
maps Blockly to Function node (enables Blockly support for embedded JavaScript using Node-RED) (thanks to @ralphwetzel for the suggestion and @spillz-dxb for the motivation) @phoddie/node-red-mcu#126
Contact Us
If you have questions or suggestions about anything here, please reach out:
- Start a new Discussion on our GitHub repository
- Drop by our Gitter to chat
- Contact us on Twitter at @moddabletech