* Automatically pin C literals interned into heap strings. Or if the
literal maps to an already interned string, pin it too. Pinning is
implemented using a duk_hstring flag and a one-off refcount bump.
Mark-and-sweep avoids sweeping pinned strings based on the flag.
* Add a lookup cache for quickly mapping a C literal address (which is
assumed stable) into a duk_hstring pointer. Once a mapping has been
formed, it never needs to be invalidated because the duk_hstring is
always pinned if the cache is used. Only heap destruction will free
the pinned duk_hstrings.
* More internal call site conversion for literals.
* Wording trivia.
Headers are copied in $(INSTALL_PREFIX)/include so mkdir this directory
otherwise cp will fail
Same thing for libraries and $(INSTALL_PREFIX)/lib
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
* Add a microbenchmark that captures the (very small) impact of using
duk_push_literal() internally.
* Add an unrelated perf test missing from a previous commit.
All Makefiles in extra folder were using gcc instead of $(CC), fix this
to allow cross-compilation
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
* Shared error throwers for smaller footprint.
* Add explicit checks for a few potential wraps and out-of-range casts.
* Remove unnecessary cbor extra test helpers (for definite and indefinite
length arrays and maps).
* Related CBOR extra Makefile changes and improvements.
* Add duk_cbor_init() to create the global object binding if caller
wants it.
* CBOR README update.
Previously extras relied on ../../src which only exists in the end user
distributable. It's better to run tools/configure.py because the extras
will then work both from the main repo and the distributable. Also the
configure.py will be more apparent and maybe picked up by the user.
* Add support for encoding into JX which is useful for testing because e.g.
zero sign, NaN, and Inf are preserved in output.
* Support -d (decode CBOR to JSON) and -e (encode JSON to CBOR) for brevity,
but add support for explicit -r (read format) and -w (write format) options.
Supported formats are: cbor, json, jx.
* Support also -r js (eval input as Ecmascript) for testing; this allows e.g.
creation of typed arrays.
* Add --indent N option which affects json/jx output.
* Update usage.
* Remove now unnecessary test.c tool.
* Implement CBOR half-float decoding for all inputs: denormals, normals,
Inf, NaN.
* Enable half-float encoding now that the decoder is fully functional.
The encoder still doesn't emit denormals, but that's not mandatory.
* Implement single precision encoding, with same limitation for denormals
as with half-floats.
* Warning trivia, e.g. cast memcpy() to void, signed/unsigned casts.
* Comment improvements.
The align trick used in duk_hbuffer_fixed uses a union which includes an
IEEE double for align-by-8. Also include a duk_uint64_t if available in
case double/integer align requirements differ.