Skip to content

Commit

Permalink
Sync TLA implementation with upstream
Browse files Browse the repository at this point in the history
Fixes: #339
  • Loading branch information
QuiiBz authored and saghul committed Jun 7, 2024
1 parent a4e48a6 commit e55b25e
Show file tree
Hide file tree
Showing 11 changed files with 3,474 additions and 2,862 deletions.
11 changes: 11 additions & 0 deletions doc/quickjs.texi
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,11 @@ optional properties:
@item backtrace_barrier
Boolean (default = false). If true, error backtraces do not list the
stack frames below the evalScript.
@item async
Boolean (default = false). If true, @code{await} is accepted in the
script and a promise is returned. The promise is resolved with an
object whose @code{value} property holds the value returned by the
script.
@end table

@item loadScript(filename)
Expand Down Expand Up @@ -717,6 +722,12 @@ write_fd]} or null in case of error.
@item sleep(delay_ms)
Sleep during @code{delay_ms} milliseconds.

@item sleepAsync(delay_ms)
Asynchronouse sleep during @code{delay_ms} milliseconds. Returns a promise. Example:
@example
await os.sleepAsync(500);
@end example

@item setTimeout(func, delay)
Call the function @code{func} after @code{delay} ms. Return a handle
to the timer.
Expand Down
96 changes: 48 additions & 48 deletions gen/hello_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,53 @@

#include "quickjs-libc.h"

const uint32_t qjsc_fib_module_size = 310;
const uint32_t qjsc_fib_module_size = 311;

const uint8_t qjsc_fib_module[310] = {
const uint8_t qjsc_fib_module[311] = {
0x0c, 0x03, 0x2c, 0x65, 0x78, 0x61, 0x6d, 0x70,
0x6c, 0x65, 0x73, 0x2f, 0x66, 0x69, 0x62, 0x5f,
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x6a,
0x73, 0x06, 0x66, 0x69, 0x62, 0x02, 0x6e, 0x0d,
0xb2, 0x03, 0x00, 0x01, 0x00, 0x00, 0xb4, 0x03,
0x00, 0x00, 0x0c, 0x20, 0xfa, 0x01, 0x9e, 0x01,
0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x09, 0x00,
0xb4, 0x03, 0x00, 0x01, 0x0c, 0x43, 0xfa, 0x01,
0xb4, 0x03, 0x01, 0x00, 0x01, 0x04, 0x01, 0x00,
0x1a, 0x01, 0xb6, 0x03, 0x00, 0x01, 0x00, 0xb4,
0x03, 0x00, 0x00, 0xd0, 0xb3, 0xa7, 0xe9, 0x03,
0xb3, 0x28, 0xd0, 0xb4, 0xac, 0xe9, 0x03, 0xb4,
0x28, 0xdc, 0xd0, 0xb4, 0x9e, 0xee, 0xdc, 0xd0,
0xb5, 0x9e, 0xee, 0x9d, 0x28, 0xb2, 0x03, 0x02,
0x08, 0x20, 0x04, 0x00, 0x07, 0x06, 0x07, 0x06,
0x12, 0x09, 0x08, 0x07, 0x07, 0x10, 0x07, 0x06,
0x07, 0x06, 0x12, 0x13, 0x08, 0x07, 0x08, 0x16,
0x0c, 0x0c, 0x07, 0x04, 0x0c, 0x0a, 0x0c, 0x0c,
0x07, 0x04, 0x8d, 0x01, 0x66, 0x75, 0x6e, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x69, 0x62,
0x28, 0x6e, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20,
0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6e, 0x20,
0x3c, 0x3d, 0x20, 0x30, 0x29, 0x0a, 0x20, 0x20,
0x00, 0x00, 0x00, 0x0c, 0x20, 0xfa, 0x01, 0x9e,
0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x09,
0x00, 0xb4, 0x03, 0x00, 0x01, 0x0c, 0x43, 0xfa,
0x01, 0xb4, 0x03, 0x01, 0x00, 0x01, 0x04, 0x01,
0x00, 0x1a, 0x01, 0xb6, 0x03, 0x00, 0x01, 0x00,
0xb4, 0x03, 0x00, 0x00, 0xd0, 0xb3, 0xa7, 0xe9,
0x03, 0xb3, 0x28, 0xd0, 0xb4, 0xac, 0xe9, 0x03,
0xb4, 0x28, 0xdc, 0xd0, 0xb4, 0x9e, 0xee, 0xdc,
0xd0, 0xb5, 0x9e, 0xee, 0x9d, 0x28, 0xb2, 0x03,
0x02, 0x08, 0x20, 0x04, 0x00, 0x07, 0x06, 0x07,
0x06, 0x12, 0x09, 0x08, 0x07, 0x07, 0x10, 0x07,
0x06, 0x07, 0x06, 0x12, 0x13, 0x08, 0x07, 0x08,
0x16, 0x0c, 0x0c, 0x07, 0x04, 0x0c, 0x0a, 0x0c,
0x0c, 0x07, 0x04, 0x8d, 0x01, 0x66, 0x75, 0x6e,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x69,
0x62, 0x28, 0x6e, 0x29, 0x0a, 0x7b, 0x0a, 0x20,
0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6e,
0x20, 0x3c, 0x3d, 0x20, 0x30, 0x29, 0x0a, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72,
0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x30, 0x3b,
0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73,
0x65, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6e, 0x20,
0x3d, 0x3d, 0x20, 0x31, 0x29, 0x0a, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65,
0x74, 0x75, 0x72, 0x6e, 0x20, 0x30, 0x3b, 0x0a,
0x74, 0x75, 0x72, 0x6e, 0x20, 0x31, 0x3b, 0x0a,
0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65,
0x20, 0x69, 0x66, 0x20, 0x28, 0x6e, 0x20, 0x3d,
0x3d, 0x20, 0x31, 0x29, 0x0a, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74,
0x75, 0x72, 0x6e, 0x20, 0x31, 0x3b, 0x0a, 0x20,
0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66,
0x69, 0x62, 0x28, 0x6e, 0x20, 0x2d, 0x20, 0x31,
0x29, 0x20, 0x2b, 0x20, 0x66, 0x69, 0x62, 0x28,
0x6e, 0x20, 0x2d, 0x20, 0x32, 0x29, 0x3b, 0x0a,
0x7d, 0x08, 0xe9, 0x05, 0xbe, 0x00, 0xe0, 0x29,
0x06, 0x2e, 0xb2, 0x03, 0x01, 0x01, 0x06, 0x01,
0x01, 0x00, 0x07, 0x14, 0x02, 0x00,
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20,
0x66, 0x69, 0x62, 0x28, 0x6e, 0x20, 0x2d, 0x20,
0x31, 0x29, 0x20, 0x2b, 0x20, 0x66, 0x69, 0x62,
0x28, 0x6e, 0x20, 0x2d, 0x20, 0x32, 0x29, 0x3b,
0x0a, 0x7d, 0x08, 0xe9, 0x05, 0xbe, 0x00, 0xe0,
0x29, 0x06, 0x2e, 0xb2, 0x03, 0x01, 0x01, 0x06,
0x01, 0x01, 0x00, 0x07, 0x14, 0x02, 0x00,
};

const uint32_t qjsc_hello_module_size = 177;
const uint32_t qjsc_hello_module_size = 178;

const uint8_t qjsc_hello_module[177] = {
const uint8_t qjsc_hello_module[178] = {
0x0c, 0x07, 0x30, 0x65, 0x78, 0x61, 0x6d, 0x70,
0x6c, 0x65, 0x73, 0x2f, 0x68, 0x65, 0x6c, 0x6c,
0x6f, 0x5f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
Expand All @@ -60,18 +60,18 @@ const uint8_t qjsc_hello_module[177] = {
0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x10,
0x66, 0x69, 0x62, 0x28, 0x31, 0x30, 0x29, 0x3d,
0x0d, 0xb2, 0x03, 0x01, 0xb4, 0x03, 0x00, 0x00,
0x01, 0x00, 0xb6, 0x03, 0x00, 0x0c, 0x20, 0xfa,
0x01, 0x9e, 0x01, 0x00, 0x00, 0x00, 0x05, 0x01,
0x00, 0x32, 0x00, 0xb6, 0x03, 0x00, 0x0c, 0x08,
0xe9, 0x02, 0x29, 0x38, 0xdc, 0x00, 0x00, 0x00,
0x42, 0xdd, 0x00, 0x00, 0x00, 0x04, 0xde, 0x00,
0x00, 0x00, 0x24, 0x01, 0x00, 0x0e, 0x38, 0xdc,
0x00, 0x00, 0x00, 0x42, 0xdd, 0x00, 0x00, 0x00,
0x04, 0xdf, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00,
0xbb, 0x0a, 0xee, 0x24, 0x02, 0x00, 0x0e, 0x06,
0x2e, 0xb2, 0x03, 0x01, 0x01, 0x0a, 0x01, 0x01,
0x00, 0x04, 0x0a, 0x02, 0x62, 0x00, 0x4d, 0x30,
0x00,
0x01, 0x00, 0xb6, 0x03, 0x00, 0x00, 0x0c, 0x20,
0xfa, 0x01, 0x9e, 0x01, 0x00, 0x00, 0x00, 0x05,
0x01, 0x00, 0x32, 0x00, 0xb6, 0x03, 0x00, 0x0c,
0x08, 0xe9, 0x02, 0x29, 0x38, 0xdc, 0x00, 0x00,
0x00, 0x42, 0xdd, 0x00, 0x00, 0x00, 0x04, 0xde,
0x00, 0x00, 0x00, 0x24, 0x01, 0x00, 0x0e, 0x38,
0xdc, 0x00, 0x00, 0x00, 0x42, 0xdd, 0x00, 0x00,
0x00, 0x04, 0xdf, 0x00, 0x00, 0x00, 0x65, 0x00,
0x00, 0xbb, 0x0a, 0xee, 0x24, 0x02, 0x00, 0x0e,
0x06, 0x2e, 0xb2, 0x03, 0x01, 0x01, 0x0a, 0x01,
0x01, 0x00, 0x04, 0x0a, 0x02, 0x62, 0x00, 0x4d,
0x30, 0x00,
};

static JSContext *JS_NewCustomContext(JSRuntime *rt)
Expand Down
Loading

0 comments on commit e55b25e

Please sign in to comment.