From 6a2784c52b488b86a578664e37fcf961320b6c72 Mon Sep 17 00:00:00 2001 From: Andrew Johnston Date: Sun, 23 Jun 2024 00:23:38 +0100 Subject: [PATCH 1/3] lots of small changes --- lib/asm/asm.js | 1 + lib/core/api.js | 2 +- lib/core/core.cc | 11 ++++----- lib/fs.js | 30 ++++++++++++++++++++++++- lib/gen.js | 12 +++++++++- lib/html.js | 16 +++++++++---- lib/net.js | 11 ++++++++- lib/net/api.js | 5 +++++ lib/path.js | 2 +- lib/proc.js | 6 ++--- lib/repl.js | 3 ++- lib/udp.js | 12 ++++++++-- lo.cc | 58 +++++++++++++++++++++++++++++++++++++++++++++++- lo.h | 1 + main.js | 3 +-- 15 files changed, 148 insertions(+), 25 deletions(-) diff --git a/lib/asm/asm.js b/lib/asm/asm.js index 1048c74..c57c7ed 100644 --- a/lib/asm/asm.js +++ b/lib/asm/asm.js @@ -4,3 +4,4 @@ import { Compiler } from 'lib/asm/compiler.js' export { Registers, Compiler, Assembler } // https://www.chromium.org/chromium-os/developer-library/reference/linux-constants/syscalls/ +// https://github.com/GregoryComer/x86-csv/blob/master/x86.csv diff --git a/lib/core/api.js b/lib/core/api.js index 955ac1e..6595545 100644 --- a/lib/core/api.js +++ b/lib/core/api.js @@ -775,7 +775,7 @@ const linux = { MFD_CLOEXEC: 'i32', MAP_HUGETLB: 'i32', MAP_HUGE_SHIFT: 'i32', - MAP_32BIT: 'i32', +// MAP_32BIT: 'i32', // this breaks arm64/linux build, even with -D_GNU_SOURCE defined MADV_HUGEPAGE: 'i32', MAP_FIXED: 'i32', POSIX_FADV_SEQUENTIAL: 'i32', POSIX_FADV_WILLNEED: 'i32', POSIX_FADV_RANDOM: 'i32', diff --git a/lib/core/core.cc b/lib/core/core.cc index 28faf12..5f0e862 100644 --- a/lib/core/core.cc +++ b/lib/core/core.cc @@ -479,14 +479,13 @@ v8::CFunctionInfo infowrite = v8::CFunctionInfo(rcwrite, 4, cargswrite); v8::CFunction pFwrite = v8::CFunction((const void*)&writeFast, &infowrite); int32_t write_stringFast(void* p, int32_t p0, struct FastOneByteString* const p1); -v8::CTypeInfo cargswrite_string[4] = { +v8::CTypeInfo cargswrite_string[3] = { v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), }; v8::CTypeInfo rcwrite_string = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infowrite_string = v8::CFunctionInfo(rcwrite_string, 4, cargswrite_string); +v8::CFunctionInfo infowrite_string = v8::CFunctionInfo(rcwrite_string, 3, cargswrite_string); v8::CFunction pFwrite_string = v8::CFunction((const void*)&write_stringFast, &infowrite_string); int32_t putcharFast(void* p, int32_t p0); @@ -1122,13 +1121,12 @@ v8::CFunctionInfo infostrnlen = v8::CFunctionInfo(rcstrnlen, 3, cargsstrnlen); v8::CFunction pFstrnlen = v8::CFunction((const void*)&strnlenFast, &infostrnlen); uint32_t strnlen_strFast(void* p, struct FastOneByteString* const p0); -v8::CTypeInfo cargsstrnlen_str[3] = { +v8::CTypeInfo cargsstrnlen_str[2] = { v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), }; v8::CTypeInfo rcstrnlen_str = v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); -v8::CFunctionInfo infostrnlen_str = v8::CFunctionInfo(rcstrnlen_str, 3, cargsstrnlen_str); +v8::CFunctionInfo infostrnlen_str = v8::CFunctionInfo(rcstrnlen_str, 2, cargsstrnlen_str); v8::CFunction pFstrnlen_str = v8::CFunction((const void*)&strnlen_strFast, &infostrnlen_str); void syncFast(void* p); @@ -2753,7 +2751,6 @@ void Init(Isolate* isolate, Local target) { SET_VALUE(isolate, module, "MFD_CLOEXEC", Integer::New(isolate, (int32_t)MFD_CLOEXEC)); SET_VALUE(isolate, module, "MAP_HUGETLB", Integer::New(isolate, (int32_t)MAP_HUGETLB)); SET_VALUE(isolate, module, "MAP_HUGE_SHIFT", Integer::New(isolate, (int32_t)MAP_HUGE_SHIFT)); - SET_VALUE(isolate, module, "MAP_32BIT", Integer::New(isolate, (int32_t)MAP_32BIT)); SET_VALUE(isolate, module, "MADV_HUGEPAGE", Integer::New(isolate, (int32_t)MADV_HUGEPAGE)); SET_VALUE(isolate, module, "MAP_FIXED", Integer::New(isolate, (int32_t)MAP_FIXED)); SET_VALUE(isolate, module, "POSIX_FADV_SEQUENTIAL", Integer::New(isolate, (int32_t)POSIX_FADV_SEQUENTIAL)); diff --git a/lib/fs.js b/lib/fs.js index 82941de..3128513 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -27,6 +27,11 @@ const write_mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH const read_flags = O_RDONLY const dir_flags = S_IRWXU | S_IRWXG | S_IROTH +const DT_CHR = 2 +const DT_DIR = 4 +const DT_REG = 8 +const default_options = { recursive: true } + function checkMode (val, mode) { return (val & S_IFMT) === mode } @@ -45,6 +50,29 @@ function file_size (path) { return size } +function readdir_sync (path, entries = [], options = default_options) { + const dir = opendir(path) + let next = readdir(dir) + assert(next) + while (next) { + const entry = readEntry(next) + if (!(entry.name === '..' || entry.name === '.')) { + const entry_path = `${path}/${entry.name}` + if (entry.d_type === DT_DIR) { + entries.push({ path, name: entry_path, isDirectory: true }) + if (options.recursive) readdir_sync(entry_path, entries, options) + } else if (entry.d_type === DT_REG) { + entries.push({ path, name: entry.name, isFile: true }) + } else if (entry.d_type === DT_CHR) { + entries.push({ path, name: entry.name, isChar: true }) + } + } + next = readdir(dir) + } + assert(closedir(dir) === 0) + return entries +} + function readEntry (handle) { readMemory(u8, handle, 19) const d_ino = dir_view.getUint32(0, true) @@ -150,5 +178,5 @@ const mkdir_all_safe = mkDirAllSafe export { mkDirAll, rmDirAll, isFile, isDir, readEntry, write_flags, read_flags, write_mode, dir_flags, - is_dir, is_file, mkdir_all, rmdir_all, mkdir_all_safe, file_size + is_dir, is_file, mkdir_all, rmdir_all, mkdir_all_safe, file_size, readdir_sync } diff --git a/lib/gen.js b/lib/gen.js index bd430c4..c127437 100644 --- a/lib/gen.js +++ b/lib/gen.js @@ -93,8 +93,13 @@ function getFastParameterCast (parameter, index, pointers, override) { } function getSlowParameterCast (parameter, index, pointers, override) { +// if (parameter === 'pointer64') { +// const pType = pointers[index] || 'void*' +// return ` ${pType} v${index} = reinterpret_cast<${pType}>((uint64_t)Local::Cast(args[${index}])->Uint64Value());` +// } if (parameter === 'pointer') { const pType = pointers[index] || 'void*' +// return ` ${pType} v${index} = reinterpret_cast<${pType}>((uint64_t)Local::Cast(args[${index}])->Uint64Value());` return ` ${pType} v${index} = reinterpret_cast<${pType}>((uint64_t)Local::Cast(args[${index}])->Value());` } if (parameter === 'string') { @@ -193,10 +198,15 @@ function bindings ({ api, includes = [], name, preamble, constants, structs = [] function getFastFunctionDecl (n, api) { const definition = api[n] - const { parameters, result, name = n, nofast } = definition + const { result, name = n, nofast, override } = definition if (nofast) { return '' } + let parameters = definition.parameters.slice(0) + if (override && override.length && override.length >= parameters.length) { + const overrides_len = override.filter(v => v).length + parameters = parameters.slice(0, parameters.length - overrides_len) + } if (needsUnwrap(result)) { let src = `\nvoid ${n}Fast(void* p${(parameters.length || needsUnwrap(definition.result)) ? ', ' : ''}${getParams(definition)});` src += `\nv8::CTypeInfo cargs${n}[${parameters.length + 2}] = {\n` diff --git a/lib/html.js b/lib/html.js index 63e6a2b..8020861 100644 --- a/lib/html.js +++ b/lib/html.js @@ -4,6 +4,9 @@ const rx = [ [/\n?\s+?([<{])/g, '$1'] ] +const { core } = lo +const { read_file } = core + const unsafeCharsRegExp = /[<&]/g const replaceMatch = (c) => c === "&" ? "&" : "<" const escape = str => unsafeCharsRegExp.test(str) ? str.replace(unsafeCharsRegExp, replaceMatch) : str; @@ -117,13 +120,13 @@ class Parser { if (type === 'string') { if (this.rawStrings) { if (this.depth > 0) { - inner.push(`String.raw\`${sanitize(token.value)}\``) + inner.push(`\$\{String.raw\`${sanitize(token.value)}\`\}`) } else { source.push(`html = html + String.raw\`${sanitize(token.value)}\``) } } else { if (this.depth > 0) { - inner.push(`${sanitize(token.value, true)}`) + inner.push(`\$\{${sanitize(token.value, true)}\}`) } else { source.push(`html = html + "${sanitize(token.value, true)}"`) } @@ -144,7 +147,11 @@ class Parser { return } if (this.command === 'code') { - source.push(`html += ${value}`) + if (this.depth > 0) { + inner.push(`\$\{${value}\}`) + } else { + source.push(`html = html + ${value}`) + } return } if (this.command === 'arg') { @@ -265,7 +272,7 @@ class Parser { } } -function compile (template, name = 'template', root = '', opts = {}) { +function compile (template, root = '', opts = {}) { const { plugins = {}, rawStrings, escape = false } = opts const tokenizer = new Tokenizer() tokenizer.tokenize(template) @@ -279,6 +286,7 @@ function compile (template, name = 'template', root = '', opts = {}) { }`) call = f(escapeHtml) } else { +// console.log(parser.source.join('\n')) call = new Function(...parser.args, parser.source.join('\n')) } return { call, tokenizer, parser, template } diff --git a/lib/net.js b/lib/net.js index 75c9ba5..0469b16 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1,6 +1,6 @@ const { net } = lo.load('net') -const { utf8EncodeIntoAtOffset } = lo +const { utf8EncodeIntoAtOffset, addr, assert } = lo // todo: use the constants from the bindings const { AF_INET, AF_UNIX, SOCK_STREAM, SOCK_NONBLOCK, EINPROGRESS } = net @@ -59,6 +59,12 @@ function sockaddr_in (ip, port) { return new Uint8Array(buf) } +function get_sockname (fd, sockaddr) { + u32[0] = 16 + assert(net.getsockname(fd, sockaddr, u32) === 0) + return addr(u32) +} + function sockaddr_un (path) { const u8 = new Uint8Array(102) const dv = new DataView(u8.buffer) @@ -79,12 +85,15 @@ net.pipe = (pipes, flags = O_CLOEXEC) => { net.inet_aton = inet_aton +const u32 = new Uint32Array(2) const on = new Uint32Array([1]) const off = new Uint32Array([0]) net.on = on net.off = off +net.get_sockname = get_sockname + net.types = { sockaddr_in, sockaddr_un, diff --git a/lib/net/api.js b/lib/net/api.js index e057750..1f67bd5 100644 --- a/lib/net/api.js +++ b/lib/net/api.js @@ -100,6 +100,11 @@ const api = lib_api_typed({ parameters: ['i32', 'i32'], result: 'i32' }, + getsockname: { + parameters: ['i32', 'buffer', 'u32array'], + pointers: [, 'struct sockaddr*', 'socklen_t*'], + result: 'i32' + }, }) const constants = { diff --git a/lib/path.js b/lib/path.js index ffbdd0a..c43db0d 100644 --- a/lib/path.js +++ b/lib/path.js @@ -99,7 +99,7 @@ function normalize (path) { function join (...args) { if (args.length === 0) return '.' - if (args.length === 2 && args[1][0] === '/') return normalize(args[1]) +// if (args.length === 2 && args[1][0] === '/') return normalize(args[1]) let joined for (let i = 0; i < args.length; ++i) { const arg = args[i] diff --git a/lib/proc.js b/lib/proc.js index 5bf435c..9d9797d 100644 --- a/lib/proc.js +++ b/lib/proc.js @@ -83,7 +83,7 @@ if (core.os === 'linux' || core.os === 'mac') { console.error(err.message) console.error((new Error(``)).stack) } - lo.exit(1) +// lo.exit(1) } else if (pid > 0) { status[1] = waitpid(pid, status, 0) if (status[0] === 0) assert(status[1] === pid) @@ -106,7 +106,7 @@ if (core.os === 'linux' || core.os === 'mac') { console.error(err.message) console.error((new Error(``)).stack) } - lo.exit(1) +// lo.exit(1) } else if (pid > 0) { status[1] = waitpid(pid, status, 0) if (status[0] === 0) assert(status[1] === pid) @@ -127,7 +127,7 @@ if (core.os === 'linux' || core.os === 'mac') { console.error(err.message) console.error((new Error(``)).stack) } - lo.exit(1) +// lo.exit(1) } else if (pid > 0) { status[1] = waitpid(pid, status, 0) if (status[0] === 0) assert(status[1] === pid) diff --git a/lib/repl.js b/lib/repl.js index fc4a773..3cd83d0 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -111,11 +111,12 @@ function bestline_isatty (p) { let nextline = (isatty(STDIN) && isatty(STDOUT)) ? bestline_isatty : bestline_notatty -async function repl () { +async function repl (ctx) { // cls(1) logo() info() let line + globalThis.repl = ctx while (line = nextline(prompt)) { try { const len = strnlen(line, MAX_LINE) diff --git a/lib/udp.js b/lib/udp.js index bdbea9f..594607e 100644 --- a/lib/udp.js +++ b/lib/udp.js @@ -67,7 +67,7 @@ class Node { fd = -1 msghdr = new MsgHdr() iov = new IoVec() - port = -1 + #port = 0 address = '127.0.0.1' peer_address = undefined @@ -87,7 +87,7 @@ class Node { assert(bind(fd, src, src.length) === 0) if (loop) assert(loop.add(fd, on_readable, Readable, on_error) === 0) this.fd = fd - this.port = port + this.#port = port this.address = address this.msghdr.payload = this.iov if (!loop) lo.nextTick(on_readable) @@ -123,6 +123,14 @@ class Node { close(this.fd) this.fd = -1 } + + get port () { + if (this.#port > 0) return this.#port + const src = sockaddr_in(this.address, this.#port) + net.get_sockname(this.fd, src) + this.#port = (new DataView(src.buffer)).getUint16(2, true) + return this.#port + } } diff --git a/lo.cc b/lo.cc index 6eaef83..1b00e85 100644 --- a/lo.cc +++ b/lo.cc @@ -54,6 +54,9 @@ using v8::kPromiseRejectAfterResolved; using v8::kPromiseResolveAfterResolved; using v8::kPromiseHandlerAddedAfterReject; using v8::Script; +using v8::HeapSpaceStatistics; +using v8::HeapStatistics; +using v8::BigUint64Array; // TODO: thread safety std::map builtins; @@ -585,6 +588,11 @@ int lo::CreateIsolate(int argc, char** argv, PrintStackTrace(isolate, try_catch); return 1; } +// if (!ScriptCompiler::CompileModule(isolate, &basescript, v8::ScriptCompiler::CompileOptions::kConsumeCodeCache).ToLocal(&module)) { +// PrintStackTrace(isolate, try_catch); +// return 1; +// } + Maybe ok2 = module->InstantiateModule(context, lo::OnModuleInstantiate); if (ok2.IsNothing()) { @@ -594,6 +602,17 @@ int lo::CreateIsolate(int argc, char** argv, // TODO: cleanup before return return 1; } +/* + ScriptCompiler::CachedData* cache = ScriptCompiler::CreateCodeCache(module->GetUnboundModuleScript()); + fprintf(stderr, "%i\n", cache->length); + int fd = open("script.data", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + int bytes = write(fd, cache->data, cache->length); + if (bytes < cache->length) { + fprintf(stderr, "error\n"); + } + close(fd); +*/ + module->Evaluate(context).ToLocalChecked(); if (try_catch.HasCaught() && !try_catch.HasTerminated()) { try_catch.ReThrow(); @@ -923,10 +942,45 @@ int32_t lo::fastUtf8Length (void* p, struct FastOneByteString* const p_str) { return p_str->length; } +void lo::HeapUsage(const FunctionCallbackInfo &args) { + Isolate *isolate = args.GetIsolate(); + HeapStatistics v8_heap_stats; + isolate->GetHeapStatistics(&v8_heap_stats); + Local array = args[0].As(); + uint64_t *fields = static_cast(array->Buffer()->Data()); + fields[0] = v8_heap_stats.total_heap_size(); + fields[1] = v8_heap_stats.used_heap_size(); + fields[2] = v8_heap_stats.external_memory(); + fields[3] = v8_heap_stats.does_zap_garbage(); + fields[4] = v8_heap_stats.heap_size_limit(); + fields[5] = v8_heap_stats.malloced_memory(); + fields[6] = v8_heap_stats.number_of_detached_contexts(); + fields[7] = v8_heap_stats.number_of_native_contexts(); + fields[8] = v8_heap_stats.peak_malloced_memory(); + fields[9] = v8_heap_stats.total_available_size(); + fields[10] = v8_heap_stats.total_heap_size_executable(); + fields[11] = v8_heap_stats.total_physical_size(); + fields[12] = isolate->AdjustAmountOfExternalAllocatedMemory(0); +} + void lo::GetMeta(const FunctionCallbackInfo &args) { Isolate *isolate = args.GetIsolate(); Local context = isolate->GetCurrentContext(); Local meta = args[1].As(); + if (args[0]->IsString()) { + Local str = args[0].As(); + if (str->IsExternalOneByte()) { + meta->Set(context, String::NewFromUtf8Literal(isolate, "isExternalOneByte", + NewStringType::kInternalized), v8::Boolean::New(isolate, true)).Check(); + } else if (str->IsOneByte()) { + meta->Set(context, String::NewFromUtf8Literal(isolate, "isOneByte", + NewStringType::kInternalized), v8::Boolean::New(isolate, true)).Check(); + } else { + meta->Set(context, String::NewFromUtf8Literal(isolate, "isTwoByte", + NewStringType::kInternalized), v8::Boolean::New(isolate, true)).Check(); + } + return; + } bool isExternal = false; bool isDetachable = false; bool isShared = false; @@ -1360,7 +1414,9 @@ void lo::Init(Isolate* isolate, Local target) { ReadMemoryAtOffset); SET_METHOD(isolate, target, "setFlags", SetFlags); - SET_METHOD(isolate, target, "getMeta", GetMeta); + SET_METHOD(isolate, target, "get_meta", GetMeta); + SET_METHOD(isolate, target, "heap_usage", HeapUsage); + SET_METHOD(isolate, target, "runScript", RunScript); SET_METHOD(isolate, target, "registerCallback", RegisterCallback); } diff --git a/lo.h b/lo.h index 6a8afe3..820411a 100644 --- a/lo.h +++ b/lo.h @@ -136,6 +136,7 @@ void Exit(const v8::FunctionCallbackInfo &args); void WrapMemory(const v8::FunctionCallbackInfo &args); void UnWrapMemory(const v8::FunctionCallbackInfo &args); void GetMeta(const v8::FunctionCallbackInfo &args); +void HeapUsage(const v8::FunctionCallbackInfo &args); // fast api methods void GetAddress(const v8::FunctionCallbackInfo &args); diff --git a/main.js b/main.js index f865b8a..e121b2b 100644 --- a/main.js +++ b/main.js @@ -320,7 +320,7 @@ const { const { core } = library('core') const { O_WRONLY, O_CREAT, O_TRUNC, O_RDONLY, S_IWUSR, S_IRUSR, S_IRGRP, S_IROTH, - S_IFREG, STDOUT, STDERR, S_IFMT, RTLD_LAZY, RTLD_NOW + S_IFREG, STDOUT, STDERR, S_IFMT, RTLD_LAZY } = core const { write_string, open, fstat, read, write, close, strnlen @@ -423,7 +423,6 @@ core.readFile = read_file core.writeFile = write_file lo.evaluate_module = lo.evaluateModule lo.get_address = lo.getAddress -lo.get_meta = lo.getMeta lo.latin1_decode = lo.latin1Decode lo.lib_cache = lo.libCache lo.load_module = lo.loadModule From e54fbcfa7d229d2d50935ce17f7b9c33c7922025 Mon Sep 17 00:00:00 2001 From: Andrew Johnston Date: Sun, 23 Jun 2024 00:25:22 +0100 Subject: [PATCH 2/3] bump version --- BOOK.md | 14 +++++++------- Makefile | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/BOOK.md b/BOOK.md index f20a186..360623f 100644 --- a/BOOK.md +++ b/BOOK.md @@ -16,25 +16,25 @@ gzip compressed binary from github. on linux/x64 ```shell -curl -L -o lo.gz https://github.com/just-js/lo/releases/download/0.0.16-pre/lo-linux-x64.gz +curl -L -o lo.gz https://github.com/just-js/lo/releases/download/0.0.17-pre/lo-linux-x64.gz ``` on linux/arm64 ```shell -curl -L -o lo.gz https://github.com/just-js/lo/releases/download/0.0.16-pre/lo-linux-arm64.gz +curl -L -o lo.gz https://github.com/just-js/lo/releases/download/0.0.17-pre/lo-linux-arm64.gz ``` on macos/x64 ```shell -curl -L -o lo.gz https://github.com/just-js/lo/releases/download/0.0.16-pre/lo-mac-x64.gz +curl -L -o lo.gz https://github.com/just-js/lo/releases/download/0.0.17-pre/lo-mac-x64.gz ``` on macos/arm64 (apple silicon) ```shell -curl -L -o lo.gz https://github.com/just-js/lo/releases/download/0.0.16-pre/lo-mac-arm64.gz +curl -L -o lo.gz https://github.com/just-js/lo/releases/download/0.0.17-pre/lo-mac-arm64.gz ``` Then, we need to decompress the downloaded file and make it executable @@ -122,7 +122,7 @@ let's check the version number of lo and the embedded JS engine it is using ```shell ./lo --version -0.0.16-pre +0.0.17-pre ``` ### evaluating JavaScript @@ -165,7 +165,7 @@ lo has a very basic repl which you can invoke as follows ⬛⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬛ ⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛ - lo 0.0.16-pre v8 12.4.254.18 + lo 0.0.17-pre v8 12.4.254.18 arch x64 os linux boot 6.02 ms rss 34996224 @@ -181,7 +181,7 @@ we downloaded. { version: { - lo: "0.0.16-pre", + lo: "0.0.17-pre", v8: "12.4.254.18" }, ... diff --git a/Makefile b/Makefile index 9711cd7..748d719 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ CCARGS=-std=c++17 -c -fno-omit-frame-pointer -fno-rtti -fno-exceptions CARGS=-c -fno-omit-frame-pointer WARN=-Werror -Wpedantic -Wall -Wextra -Wno-unused-parameter OPT=-O3 -VERSION=0.0.16-pre +VERSION=0.0.17-pre V8_VERSION=12.4 RUNTIME=lo LO_HOME=$(shell pwd) From ec5bf18a2e53f7ae859332f832efa003d7fed10b Mon Sep 17 00:00:00 2001 From: Andrew Johnston Date: Sun, 23 Jun 2024 00:27:57 +0100 Subject: [PATCH 3/3] fix broken test --- test/runtime.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/runtime.js b/test/runtime.js index c7db247..cf313e6 100644 --- a/test/runtime.js +++ b/test/runtime.js @@ -1,14 +1,13 @@ import { extName } from 'lib/path.js' const { assert, colors } = lo -const { AD, AY, AG, AM, AC } = colors async function test () { const names = [ 'nextTick', 'print', 'registerCallback', 'runMicroTasks', 'builtin', 'builtins', 'libraries', 'setModuleCallbacks', 'loadModule', 'evaluateModule', 'latin1Decode', 'utf8Decode', 'utf8Encode', 'wrapMemory', - 'unwrapMemory', 'setFlags', 'getMeta', 'runScript', 'arch', 'os', 'hrtime', + 'unwrapMemory', 'setFlags', 'get_meta', 'runScript', 'arch', 'os', 'hrtime', 'getAddress', 'utf8Length', 'utf8EncodeInto', 'utf8EncodeIntoAtOffset', 'readMemory', 'readMemoryAtOffset' ].sort()