Update jerry-port and jerry-ext (#4907)

Notable changes:
  - Updated and the port API interface, new functions have been added
    and some have been changed. The port library is now cleaned up to
    not have any dependency on jerry-core, as it should be. The port library
    is now strictly a collection of functions that implement
    embedding/platform specific behavior.
  - The default port implementation has been split for windows and unix.
    Implemented port functions have been categorized and reorganized,
    and marked with attribute((weak)) for better reusability.
  - External context allocation has been moved to the port API instead
    of a core API callback. The iterface has also been extended with a
    function to free the allocated context. When external context is
    enabled, jerry_init now automatically calls the port implementation
    to allocate the context and jerry_cleanup automatically calls the port
    to free the context.
  - jerry_port_log has been changed to no longer require formatting to
    be implemented by the port. The reason beind this is that it was vague what
    format specifiers were used by the engine, and in what manner. The port
    function now takes a zero-terminated string, and should only implement
    how the string should be logged.
  - Logging and log message formatting is now handled by the core jerry library
    where it can be implemented as necessary. Logging can be done through a new
    core API function, which uses the port to output the final log message.
  - Log level has been moved into jerry-core, and an API function has
    been added to set the log level. It should be the library that
    filters log messages based on the requested log level, instead of
    logging everything and requiring the user to do so.
  - Module resolving logic has been moved into jerry-core. There's no
    reason to have it in the port library and requiring embedders to
    duplicate the code. It also added an unnecessary dependency on
    jerry-core to the port. Platform specific behavior is still used through
    the port API, like resolving module specifiers, and reading source file
    contents. If necessary, the resolving logic can still be overridden as
    previously.
  - The jerry-ext library has also been cleaned up, and many utility
    functions have been added that previously were implemented in
    jerry-main. This allows easier reusability for some common operations,
    like printing unhandled exceptions or providing a repl console.
  - Debugger interaction with logged/printed messages has been fixed, so
    that it's no longer the port implementations responsibility to send
    the output to the debugger, as the port should have no notion of what a
    debugger is.  The printing and logging functions will now pass the
    result message to the debugger, if connected.
  - Cleaned up TZA handling in the date port implementation, and simplified
    the API function prototype.
  - Moved property access helper functions that use ASCII strings as
    keys from jerry-ext to the core API.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
This commit is contained in:
Dániel Bátyai
2022-01-20 13:53:47 +01:00
committed by GitHub
parent 79fd540ec9
commit ac1c48eeff
170 changed files with 4201 additions and 5698 deletions
+6 -6
View File
@@ -1,15 +1,15 @@
Connecting to: localhost:5001
Stopped at tests/debugger/client_source.js:15
(jerry-debugger) s
out: client-source-test
client-source-test
Stopped at tests/debugger/client_source.js:40
(jerry-debugger) s
Stopped at tests/debugger/client_source.js:35 (in test() at line:33, col:1)
(jerry-debugger) s
out: function test
function test
Stopped at tests/debugger/client_source.js:36 (in test() at line:33, col:1)
(jerry-debugger) continue
out: function foo
out: function bar
out: function finish
out: finish: test-foo-bar
function foo
function bar
function finish
finish: test-foo-bar
@@ -1,22 +1,22 @@
Connecting to: localhost:5001
Stopped at tests/debugger/client_source_multiple_2.js:15
(jerry-debugger) n
out: multiple-client-source-test-file-2
multiple-client-source-test-file-2
Stopped at tests/debugger/client_source_multiple_1.js:15
(jerry-debugger) n
out: multiple-client-source-test-file-1
multiple-client-source-test-file-1
Stopped at tests/debugger/client_source_multiple_1.js:27
(jerry-debugger) s
Stopped at tests/debugger/client_source_multiple_1.js:18 (in foo() at line:17, col:1)
(jerry-debugger) s
out: foo
foo
Stopped at tests/debugger/client_source_multiple_1.js:19 (in foo() at line:17, col:1)
(jerry-debugger) s
Stopped at tests/debugger/client_source_multiple_2.js:18 (in bar() at line:17, col:1)
(jerry-debugger) s
out: bar
bar
Stopped at tests/debugger/client_source_multiple_2.js:19 (in bar() at line:17, col:1)
(jerry-debugger) c
out: str-argument: called-from-test-file-1
out: crossFoo
out: str-argument: called-from-test-file-2
str-argument: called-from-test-file-1
crossFoo
str-argument: called-from-test-file-2
+1 -1
View File
@@ -9,4 +9,4 @@ Stopped at tests/debugger/do_abort.js:20 (in g() at line:19, col:1)
(jerry-debugger) s
Stopped at tests/debugger/do_abort.js:16 (in f() at line:15, col:1)
(jerry-debugger) abort new Error('Fatal error :)')
err: Unhandled exception: Error: Fatal error :)
Unhandled exception: Error: Fatal error :)
+4 -4
View File
@@ -1,7 +1,7 @@
Connecting to: localhost:5001
Stopped at tests/debugger/do_backtrace.js:15
(jerry-debugger) next
out: backtrace-test
backtrace-test
Stopped at tests/debugger/do_backtrace.js:28
(jerry-debugger) n
Stopped at tests/debugger/do_backtrace.js:37
@@ -10,7 +10,7 @@ Stopped at tests/debugger/do_backtrace.js:40
(jerry-debugger) step
Stopped at tests/debugger/do_backtrace.js:32 (in test() at line:30, col:1)
(jerry-debugger) next
out: function test
function test
Stopped at tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)
(jerry-debugger) s
Stopped at tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1)
@@ -36,7 +36,7 @@ Total number of frames: 3
Frame 0: tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1)
Frame 1: tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)
(jerry-debugger) n
out: function foo
function foo
Stopped at tests/debugger/do_backtrace.js:24 (in foo() at line:21, col:1)
(jerry-debugger) n
Stopped at tests/debugger/do_backtrace.js:25 (in foo() at line:21, col:1)
@@ -59,4 +59,4 @@ Frame 3: tests/debugger/do_backtrace.js:40
(jerry-debugger) bt 4 3
Error: Start depth needs to be lower than or equal to max depth
(jerry-debugger) c
out: function f4
function f4
+3 -3
View File
@@ -14,8 +14,8 @@ Breakpoint 4 at tests/debugger/do_break.js:45 (in f() at line:43, col:1)
3: tests/debugger/do_break.js:33 (in f() at line:31, col:3)
4: tests/debugger/do_break.js:45 (in f() at line:43, col:1)
(jerry-debugger) c
out: break test
out: var cat
break test
var cat
Stopped at breakpoint:1 tests/debugger/do_break.js:51
(jerry-debugger) delete 1
Breakpoint 1 deleted
@@ -27,6 +27,6 @@ Breakpoint 1 deleted
(jerry-debugger) c
Stopped at breakpoint:2 tests/debugger/do_break.js:36 (in test() at line:20, col:1)
(jerry-debugger) continue
out: function test
function test
Stopped at breakpoint:3 tests/debugger/do_break.js:33 (in f() at line:31, col:3)
(jerry-debugger) c
+1 -1
View File
@@ -1,7 +1,7 @@
Connecting to: localhost:5001
Stopped at tests/debugger/do_delete.js:15
(jerry-debugger) next
out: delete tests
delete tests
Stopped at tests/debugger/do_delete.js:17
(jerry-debugger) b do_delete.js:17
Breakpoint 1 at tests/debugger/do_delete.js:17
+4 -4
View File
@@ -14,7 +14,7 @@ Non-negative integer number expected, 0 turns off this function
Stopped at breakpoint:1 tests/debugger/do_display.js:15 (in a() at line:15, col:1)
(jerry-debugger) display 2
(jerry-debugger) c
out: hi
hi
Stopped at breakpoint:2 tests/debugger/do_display.js:16 (in b() at line:16, col:1)
Source: tests/debugger/do_display.js
15 function a() { print("hi"); }
@@ -22,7 +22,7 @@ Source: tests/debugger/do_display.js
17 function c() { print("hello"); }
(jerry-debugger) display 5435
(jerry-debugger) c
out: welcome
welcome
Stopped at breakpoint:3 tests/debugger/do_display.js:17 (in c() at line:17, col:1)
Source: tests/debugger/do_display.js
1 // Copyright JS Foundation and other contributors, http://js.foundation
@@ -50,7 +50,7 @@ Source: tests/debugger/do_display.js
23 d();
(jerry-debugger) display 0
(jerry-debugger) c
out: hello
hello
Stopped at breakpoint:4 tests/debugger/do_display.js:18 (in d() at line:18, col:1)
(jerry-debugger) c
out: goodbye
goodbye
+1 -1
View File
@@ -5,4 +5,4 @@ Stopped at tests/debugger/do_eval_syntax.js:26
(jerry-debugger) eval loop
Uncaught exception: Error
(jerry-debugger) c
out: bar function
bar function
+1 -1
View File
@@ -1,7 +1,7 @@
Connecting to: localhost:5001
Stopped at tests/debugger/do_exception.js:15
(jerry-debugger) c
out: exception handler configuration test
exception handler configuration test
Exception throw detected (to disable automatic stop type exception 0)
Exception hint: TypeError
Stopped around tests/debugger/do_exception.js:19 (in foo() at line:17, col:1)
+7 -7
View File
@@ -1,20 +1,20 @@
Connecting to: localhost:5001
Stopped at tests/debugger/do_finish.js:15
(jerry-debugger) finish
out: finish-test
finish-test
Stopped at tests/debugger/do_finish.js:26
(jerry-debugger) finish
Stopped at tests/debugger/do_finish.js:18 (in foo() at line:17, col:1)
(jerry-debugger) finish
out: foo
out: bar
foo
bar
Stopped at tests/debugger/do_finish.js:42
(jerry-debugger) step
Stopped at tests/debugger/do_finish.js:29 (in dog() at line:28, col:1)
(jerry-debugger) finish
out: *bark*
out: *sit*
out: *bark*
*bark*
*sit*
*bark*
Stopped at tests/debugger/do_finish.js:44
(jerry-debugger) continue
out: END: finish-test
END: finish-test
+3 -3
View File
@@ -1,15 +1,15 @@
Connecting to: localhost:5001
Stopped at tests/debugger/do_next.js:15
(jerry-debugger) next
out: next test
next test
Stopped at tests/debugger/do_next.js:28
(jerry-debugger) next
out: Func
Func
Stopped at tests/debugger/do_next.js:30
(jerry-debugger) n
Stopped at tests/debugger/do_next.js:33
(jerry-debugger) n
out: Func
Func
Stopped at tests/debugger/do_next.js:35
(jerry-debugger) next
Stopped at tests/debugger/do_next.js:39
@@ -9,7 +9,7 @@ No breakpoint found, do you want to add a pending breakpoint? (y or [n]) Pending
1: :1 (pending)
2: f() (pending)
(jerry-debugger) c
out: pending-breakpoints
pending-breakpoints
Breakpoint 3 at <unknown>:1
Breakpoint 4 at <unknown>:3 (in f() at line:2, col:1)
Stopped at breakpoint:3 <unknown>:1
+19 -109
View File
@@ -1,112 +1,22 @@
Connecting to: localhost:5001
Stopped at tests/debugger/do_print.js:15
(jerry-debugger) c
out: Hello world!
out: A [ ] 110 null true undefined
out:
out: [A
out: B C
out: D E
out: F
out: G]
out: 1: Az élet gyönyörű.
out: 2: Az élet gyönyörű.
out: 3: Az élet gyönyörű.
out: 4: Az élet gyönyörű.
out: 5: Az élet gyönyörű.
out: 6: Az élet gyönyörű.
out: 7: Az élet gyönyörű.
out: 8: Az élet gyönyörű.
out: 9: Az élet gyönyörű.
out: 10: Az élet gyönyörű.
out: 11: Az élet gyönyörű.
out: 12: Az élet gyönyörű.
out: 13: Az élet gyönyörű.
out: 14: Az élet gyönyörű.
out: 15: Az élet gyönyörű.
out: 16: Az élet gyönyörű.
out: 17: Az élet gyönyörű.
out: 18: Az élet gyönyörű.
out: 19: Az élet gyönyörű.
out: 20: Az élet gyönyörű.
out: 21: Az élet gyönyörű.
out: 22: Az élet gyönyörű.
out: 23: Az élet gyönyörű.
out: 24: Az élet gyönyörű.
out: 25: Az élet gyönyörű.
out: 26: Az élet gyönyörű.
out: 27: Az élet gyönyörű.
out: 28: Az élet gyönyörű.
out: 29: Az élet gyönyörű.
out: 30: Az élet gyönyörű.
out: 31: Az élet gyönyörű.
out: 32: Az élet gyönyörű.
out: 33: Az élet gyönyörű.
out: 34: Az élet gyönyörű.
out: 35: Az élet gyönyörű.
out: 36: Az élet gyönyörű.
out: 37: Az élet gyönyörű.
out: 38: Az élet gyönyörű.
out: 39: Az élet gyönyörű.
out: 40: Az élet gyönyörű.
out: 41: Az élet gyönyörű.
out: 42: Az élet gyönyörű.
out: 43: Az élet gyönyörű.
out: 44: Az élet gyönyörű.
out: 45: Az élet gyönyörű.
out: 46: Az élet gyönyörű.
out: 47: Az élet gyönyörű.
out: 48: Az élet gyönyörű.
out: 49: Az élet gyönyörű.
out: 50: Az élet gyönyörű.
out: 51: Az élet gyönyörű.
out: 52: Az élet gyönyörű.
out: 53: Az élet gyönyörű.
out: 54: Az élet gyönyörű.
out: 55: Az élet gyönyörű.
out: 56: Az élet gyönyörű.
out: 57: Az élet gyönyörű.
out: 58: Az élet gyönyörű.
out: 59: Az élet gyönyörű.
out: 60: Az élet gyönyörű.
out: 61: Az élet gyönyörű.
out: 62: Az élet gyönyörű.
out: 63: Az élet gyönyörű.
out: 64: Az élet gyönyörű.
out: 65: Az élet gyönyörű.
out: 66: Az élet gyönyörű.
out: 67: Az élet gyönyörű.
out: 68: Az élet gyönyörű.
out: 69: Az élet gyönyörű.
out: 70: Az élet gyönyörű.
out: 71: Az élet gyönyörű.
out: 72: Az élet gyönyörű.
out: 73: Az élet gyönyörű.
out: 74: Az élet gyönyörű.
out: 75: Az élet gyönyörű.
out: 76: Az élet gyönyörű.
out: 77: Az élet gyönyörű.
out: 78: Az élet gyönyörű.
out: 79: Az élet gyönyörű.
out: 80: Az élet gyönyörű.
out: 81: Az élet gyönyörű.
out: 82: Az élet gyönyörű.
out: 83: Az élet gyönyörű.
out: 84: Az élet gyönyörű.
out: 85: Az élet gyönyörű.
out: 86: Az élet gyönyörű.
out: 87: Az élet gyönyörű.
out: 88: Az élet gyönyörű.
out: 89: Az élet gyönyörű.
out: 90: Az élet gyönyörű.
out: 91: Az élet gyönyörű.
out: 92: Az élet gyönyörű.
out: 93: Az élet gyönyörű.
out: 94: Az élet gyönyörű.
out: 95: Az élet gyönyörű.
out: 96: Az élet gyönyörű.
out: 97: Az élet gyönyörű.
out: 98: Az élet gyönyörű.
out: 99: Az élet gyönyörű.
out: 100: Az élet gyönyörű.
out:
Hello world!
A [ ] 110 null true undefined
[A
B C
D E
F
G]
1: Az élet gyönyörű.
2: Az élet gyönyörű.
3: Az élet gyönyörű.
4: Az élet gyönyörű.
5: Az élet gyönyörű.
6: Az élet gyönyörű.
7: Az élet gyönyörű.
8: Az élet gyönyörű.
9: Az élet gyönyörű.
10: Az élet gyönyörű.
+1 -1
View File
@@ -19,7 +19,7 @@ print("[A\nB", "C\nD", "E\nF\nG]");
var s = "";
for (i = 1; i <= 100; i++) {
for (i = 1; i <= 10; i++) {
/* Translated from hungarian: life is beautiful */
s += i + ": Az élet gyönyörű.\n";
}
+6 -6
View File
@@ -3,16 +3,16 @@ Stopped at tests/debugger/do_restart.js:23
(jerry-debugger) n
Stopped at tests/debugger/do_restart.js:24
(jerry-debugger) n
out: foo
foo
Stopped at tests/debugger/do_restart.js:25
(jerry-debugger) n
out: bar
bar
Stopped at tests/debugger/do_restart.js:24
(jerry-debugger) restart
Connecting to: localhost:5001
Stopped at tests/debugger/do_restart.js:23
(jerry-debugger) continue
out: foo
out: bar
out: foo
out: bar
foo
bar
foo
bar
+2 -2
View File
@@ -5,7 +5,7 @@ Breakpoint 1 at tests/debugger/do_src.js:16 (in f() at line:15, col:1)
(jerry-debugger) n
Stopped at breakpoint:1 tests/debugger/do_src.js:16 (in f() at line:15, col:1)
(jerry-debugger) next
out: F1
F1
Stopped at tests/debugger/do_src.js:20
(jerry-debugger) s
Stopped at <unknown>:1
@@ -20,4 +20,4 @@ Stopped at <unknown>:2 (in f() at line:1, col:5)
1 f = function f() {
2 > print('F2') }
(jerry-debugger) c
out: F2
F2
+1 -1
View File
@@ -17,4 +17,4 @@ Stopped at tests/debugger/do_throw.js:34
(jerry-debugger) eval e.message.length
538
(jerry-debugger) throw new Error('Exit')
err: Unhandled exception: Error: Exit
Unhandled exception: Error: Exit
+1 -1
View File
@@ -39,4 +39,4 @@ Exception throw detected (to disable automatic stop type exception 0)
Exception hint: 16
Stopped at tests/debugger/do_throw_adv.js:18 (in f() at line:17, col:1)
(jerry-debugger) c
err: Unhandled exception: 16
Unhandled exception: 16