Age | Commit message (Collapse) | Author |
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
String format improvements
|
|
Honour precision specifiers when parsing `J` format strings to enable or
disable JSON pretty printing.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Instead of disambiguating division operator vs. regexp literal by looking
at the preceeding token, raise a "no regexp" flag within the appropriate
parser states to tell the lexer how to treat a forward slash when parsing
the next token
- Introduce another "no keyword" flag which disables parsing labels into
keywords when reading the next token and set it in the appropriate parser
states. This allows using reserved names in object declarations and
property access expressions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Ensure that split by string produces an initial empty string in the
result array when the string to split starts with the split substring
- Ensure that split by string produces a trailing empty string in the
result array when the string to split ends with the split substring
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
New type system
|
|
- Shuffle typedefs to avoid need for non-compliant forward declarations
- Fix non-compliant empty struct initializers
- Remove use of braced expressions
- Remove use of anonymous unions
- Avoid `void *` pointer arithmetic
- Fix several warnings reported by gcc -pedantic mode and clang 11 compilation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Print "Before start of program" for errors that are raised before entering
main(), e.g. on module preloading failure.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
This is required for out-of-tree builds where the *.so file location
cannot be derived from the path of the ucode executable.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Instead of relying on json_object values internally, use custom types to
represent the different ucode value types which brings a number of
advantages compared to the previous approach:
- Due to the use of tagged pointers, small integer, string and bool
values can be stored directly in the pointer addresses, vastly
reducing required heap memory
- Ability to create circular data structures such as
`let o; o = { test: o };`
- Ability to register custom `tostring()` function through prototypes
- Initial mark/sweep GC implementation to tear down circular object
graphs on VM deinit
The change also paves the way for possible future extensions such as
constant variables and meta methods for custom ressource types.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Uses currently proof-of-concept openwrt-ci[1] in order to:
* improve the quality of the codebase in various areas
* decrease code review time and help merging contributions faster
* get automagic feedback loop on various platforms and tools
- out of tree build with OpenWrt SDK on following targets:
* ath79-generic
* imx6-generic
* malta-be
* mvebu-cortexa53
- out of tree native build on x86/64 with GCC (versions 8, 9, 10) and Clang 11
- out of tree native x86/64 static code analysis with cppcheck and
scan-build from Clang 11
1. https://gitlab.com/ynezz/openwrt-ci/
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
|
* add cram based tests
* test under either valgrind or LLVM sanitizers
* add libFuzzer template
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
|
Otherwise tests always pass in ctest.
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
|
It doesn't work properly with out of tree builds etc.
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
|
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
|
Otherwise it prints out complete path which is probably not desired and
we would need to filter out paths in the test's output etc.
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
|
Fixes bunch of following warnings:
lexer.c:68:37: warning: missing field 'parse' initializer [-Wmissing-field-initializers]
lexer.c:138:34: warning: missing field '' initializer [-Wmissing-field-initializers]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
|
Let's enforce additional automatic checks enforced by the compiler in
order to catch possible errors during compilation.
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
|
So it can be built out of the tree.
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
|
Probably using 3.0+ features anyway and should silence following
warning:
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixes: 97bf297 ("compiler: ensure that alternative if/for/while syntax has own block scope")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The `if ...: endif`, `for ...: endfor`, `while ...: endwhile` etc. syntax
statements are supposed to have their own lexical scope, like curly brace
blocks in normal statements.
Without this, local variable declarations within such blocks would
incorrectly shift stack offsets for the remainder of the program.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixes: aa9621d ("compiler: rework switch statement code generation")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Initialize stack slots belonging to skipped local variable declarations
- Group switch case value tests after switch statement body
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Fix an off-by-one when printing push/pop stack indexes
- Properly print negative hexadecimal values
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixes: 20a3763 ("vm: fix loop variable memory leak in NEXTK/NEXTKV instruction")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Make sure to increase the refcount of items being moved since the
subsequent put operation will decrease it, prematurely freeing
moved items which will lead to use-after-free errors later on.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixes: a478510 ("object: prevent registering the same ressource type multiple times")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
When patching jump targets for break statments while compiling for-loop
statments, jump beyond the instructions popping intermediate loop variables
off the stack to fix a stack position mismatch between compiler and vm.
Before that change, local loop body variables got popped twice, breaking
the expected stack layout.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The ref count of the unshifted value returned by uc_unshift() must be
increased in order to prevent a subsequent double free within the VM
when the value eventually goes out of scope.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|