* LICENSE needed year update.
* The asm component of the posix target of jerry-libc had no
copyright & license notice since it has been introduced in 2015.
Traced back history and added missing header with correct years.
* Three tests in jerry/fail/1 also missed header. Added.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Apps that use jerry should not (must not!) include and rely on its
internal headers. Typical issue is the use of "jrt/jrt.h". Fixing
`main-{unix,mcu}.c`, and speculatively the apps under the `targets`
directory as well.
(Note: a fix can be either including "jerry-port.h" and using
functions declared there, e.g., `jerry_port_errormsg`, or simply
using standard libc function like `printf`. Both approaches occur
in this patch.)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
The two target implementations are very close clones of each other.
The only known differences are the following:
* The asm component of the linux target has `.type` and `.size`
declarations for the functions defined therein, while the darwin
target doesn't support those.
* Linux uses `__NR_xxx` mnemonics for syscall numbers, while darwin
uses `SYS_xxx` format.
* Darwin does not have `exit_group` syscall but `exit` only.
* The linux target has a commented out `jrt_set_mem_limits` fuction
declaration at the end of the C source. (Based on its name, this
function does not really belong here.)
Simple preprocessor macros can unify the first three differences.
While for the sake of legacy, we can keep the fourth commented-out
code in the code base; it might turn out to be useful elsewhere in
the future. Since it remains commented out it wont cause any
problems on any OSs.
So, this patch gets rid of a lot of duplication.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Introducing the `assert.h` public header with the `assert(x)` macro
and already making use of it in jerry-libc sources. These newly
introduced ISO C-conforming features replace the non-conforming
`LIBC_ASSERT` and `LIBC_NDEBUG` at no cost, and they also have the
benefit that we can expose `assert` in a public header and make it
useful to jerry-libc users.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Improvements related to lexer:
* duplicated clone elimination
* magic numbers are replaced with constants
* functions are moved form util to lit-char-helpers
JerryScript-DCO-1.0-Signed-off-by: István Kádár ikadar@inf.u-szeged.hu
itself seems a step back, but the primary aim is opening future
optimization opportunities. The list of changes follows:
- Property is changed to be an abstract type, which has type, flags,
and a value. It does not have a name anymore and property pointers
cannot be compressed.
- Full (32 bit) ecma values can be property values. This allows
using non-compressed pointers for ecma values in the future.
- The property chain is not restricted to the same item anymore,
it can contain hash maps, arrays in the future.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Fixed doc comments issues:
* Fixed mistyped param doc comments (`/**<` is OK, `/** <` is not).
* Put special characters (e.g., pipe, backslash, etc.) in quotes, as they can
confuse doxygen and it will print lots of various warnings. For the sake of
completeness and consistent style, also quote some special characters in
re-bytecode.h
* Added missing `@{`s, removed extra `@}`s.
* Turned `/*` comments to `/**<` doc comments.
Ensured same style for doc groups everywhere:
* Where `\addtogroup`, `@{`, and `@}` doxygen commands are used, the order to be
followed is: license, `#ifndef` guards (in headers), includes, `\addtogroup`
and `@{`, main code content, `@}`, `#endif` guards (in headers).
* Multiple `\addtogroup`s or multiple `@}`s should be in the same doc comment.
* First `\addtogroup` should be on the very first line of a doc comment, i.e.,
`/** \addtogroup`.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
The core functionality (i.e., the equivalent of `kill (getpid (), sig);`)
was already there in the implementation of `abort ()`. Now, it got
factored out to `raise ()` so that others (most importantly,
`__aeabi_ldiv0`) can call and link to it as well.
Also, removed `LIBC_UNREACHABLE_STUB_FOR` macro, as it is not used anymore.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
The MCU-targets depend on some platform-related resources.
When these files are missing the build cannot be performed.
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
Benefits:
* Better readability and maintenance
* Better heap consumption on 'date-format-xparb.js' test of SunSpider
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
After recent changes to jerry-libc, `syscall_N` C functions became
pure trampolines to their appropriate `syscall_N_asm` counterparts
written in assembly. Removing the C functions and renaming the
assembly functions to take their place simplifies the code.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Follow up fix after #815 ('a187e6d'). Fixed the following
assertion on unhandled exceptions:
* ICE: Assertion 'ecma_get_value_type_field (value) == ECMA_TYPE_OBJECT'
failed at ecma-helpers-value.c(ecma_get_object_from_value):375.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
Discussions on Termination Port API point in a different direction
than what's already in the API. Moreover, since the function has
been throwing unimplemented assert error since its introduction,
we should remove it from the code base.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
* Rename modified fdlibm to jerry-libm
* Move third-party/fdlibm to jerry-libm
* Rename original fdlibm.h to jerry-libm-internal.h
* And remove it from the public headers.
* Rename jerry-libm's public header to math.h
* This also makes jerry-core sources include `<math.h>`. Therefore,
should anyone want to use a different libm implementation with
jerry, it becomes possible. (The same way as we provide a minimal
libc with standard headers, but should it be insufficient or
conflicting for someone, it can be replaced.)
* Drop `s_` prefix from jerry-libm sources
* The original fdlibm implementation had various prefixes (e.g., `k_`
for sources of kernel routines, and `w_` for wrapper routines), but
after the specialization of fdlibm to jerry, only `s_` remained.
Since it does not encode anything anymore, it can be dropped.
* Stylistic edits to jerry-libm's CMakeLists
* Align project name with other CMakeLists in the code base
* Move Jerry-LibM under Apache License
* Using the same approach as was used by linux-wireless when ath5k
driver license needed clarification. Solution was proposed by SFLC.
External mail for future reference: http://lwn.net/Articles/247806/
* Tests & checks
* Remove FD from the name of libm unit test-related files
* Make vera++ and cppcheck check jerry-libm
* Targets
* Speculative update of targets to use jerry-libm
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Endianness was not properly set/detected for AArch64. Once that is
fixed, the platform is well-supported.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Those macros are legacy and are not used consitently throughout the
code base. This patch eliminates their definitions and rewrites
their remaining occurrences to TODO comments.
All occurrences have been checked and made sure that the comments
used a consistent style.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Re-styling of the sources revealed that the false branch of an
if-else construct in `asin` did not contain all the statements
that it should. (This was an issue -- a bad smell at least --
that's been around since 1995, according to the legacy SCCS ID.)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
* First re-style was done automatically by indent to minimize the
chance of errors during rewrite.
* Manual changes were applied to non-critical places only (comments
and spaces):
* Replaced all tabs with spaces.
* Fixed tab stops in formulae in function comments.
(Note: ASCII art for math formulae (especially for super- and
subscripts) is a terrible idea.)
* Unified the style of function comments.
* Moved some in-code comments to their right places, which indent
couldn't handle.
* Added spaces to formulae of in-code comments to make them more
readable.
* Added braces mandated by jerry style guidelines.
* Added parentheses to multiline #ifdef.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
* Made helper functions static.
* Changed the signature of __kernel_rem_pio2 not to require the
ipio2 argument
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Keep IEEE code paths only:
* removed SVID, XOPEN, POSIX code paths from everywhere.
* deleted s_lib_version.c, as version is only useful if multiple
standards are supported.
* deleted k_standard.c, as it handles non-IEEE exception cases only.
* renamed the e_{acos,asin,atan2,exp,fmod,log,pow,sqrt}.c sources as
s_.*, dropped the __ieee754_ prefix from the names of the
appropriate functions therein, and deleted the
w_{acos,asin,atan2,exp,fmod,log,pow,sqrt}.c wrapper code.
Keep C99 declaration variants only:
* removed old C-style function declaration variants.
* removed data declaration variants where const qualifier was not
used.
Clean unused sources/functions:
* removed s_{rint,significand,tanh}.c and the appropriate functions
defined therein.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
The positive side effect is that the maximum Jerry memory is increased to 512K.
Furthermore a slight (1.3%) performance improvement was measured on RPi2 with
SunSpider.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Add new build target: test-buildoptions
Now every build option is tested on the proper targets. These are the native
and the MCU targets in release mode and unittests.
Therefore the USE_COMPILER_DEFAULT_LIBC build option is refactored.
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
Snapshot save algorithm should not resolve uninitialized literals.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
MEM_HEAP_PTR_64 is duplicating existing information: stdint.h, which
header is already used by the project, defines various _MAX macros
for upper limits of integer types. The comparison of UINTPTR_MAX and
UINT32_MAX can give the same info as encoded in MEM_HEAP_PTR_64.
The stdint.h-based approach has the benefit that jerry can support
any 64-bit architecture without the need for editing the build
system. (With the existing approach, CMakeLists has to know about
every 64-bit architecture to work properly.)
Thus, removing the extraneous macro from the code.
The patch also changes the mem_pools_chunk_t struct, as it turned
out that the struct does not have to be padded to MEM_POOL_CHUNK_SIZE.
(The padding also depended on MEM_HEAP_PTR_64.) It is enough if the
size of the struct is smaller than (or equal to) MEM_POOL_CHUNK_SIZE.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
* inline some hot function
* add 'ecma_copy_value_if_not_object' similer to 'ecma_value_free_if_not_object'
* remove unnecessary helpers
* improve 'do_number_bitwise_logic'
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
The project is relying on a variant of fdlibm, which has aleady
been edited but never verified for correctness. This patch adds
unit testing of fdlibm by:
* introducing a test generator that uses a trusted libm
implementation to calculate correct and expected results of math
functions
(tools/gen-test-fdlibm.sh and tools/unit-tests/gen-test-fdlibm.c),
* adding tests created with the generator that stress all publicly
exported functions of jerry's fdlibm
(tests/unit/test-fdlibm.inc.h), and
* adding a unit test file to drive the generated tests
(tests/unit/test-fdlibm.c).
Note: The test generator is not expected to be executed often, thus
it is not wired into the build system. If it gets edited, it must
be used locally to re-generate the .inc.h file.
During development, it turned out that tests/unit/test-common.h
included the system header math.h, which was only a bad smell until
now but became a real header conflict issue with the introduction
of the fdlibm unit test. Thus, this patch also changes the include
to fdlibm-math.h.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Currently, if a regexp contains a character class and that
character class contains a hex-specified code point -- either
\uNNNN or \xNN --, then the character 'u' or 'x' is added to the
character class as well. This patch fixes the error and also adds
a regression test covering the issue.
Fixes#962
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
In case of literals and in main, snapshot saving is incorrectly
named dumping. Elsewhere in the code, 'dump' functions output debug
data (even literals have a `lit_dump_literals` debug function). To
help distinction and to align terminologies, snapshot saving
functions of literals and command line options of main are also
re-named 'save'.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
memory consumption, because the new allocator uses less memory if
the size as available when a block is freed. Snapshot generation
is also simplified.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Most of the legacy version control IDs in fdlibm are already simple
comments at the beginning of the source files. However, in some
files, there are leftover global variables and pragmas. (The global
variable in e_pow.c even increases the .data section in both debug
and release builds.) This patch turns all legacy IDs to comments of
unified style.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu