diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 9971b40..024c2e3 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -24,8 +24,8 @@ jobs: if: ${{ matrix.platform == 'x64' }} run: | make check - brew install libffi lz4 zstd - ./lo test/build.js + brew install libffi lz4 zstd jsonschema + LO_PREFIX=/usr/local/opt ./lo test/build.js - name: upload runtime artifact uses: actions/upload-artifact@v3 with: diff --git a/.gitignore b/.gitignore index bdbcd64..466bbbf 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,7 @@ deps notes.md lib/inflate/em_inflate.c lib/inflate/em_inflate.h +lib/**/*.cc +!lib/core/core.cc +!lib/inflate/inflate.cc +!lib/mach/mach.cc diff --git a/Makefile b/Makefile index 944a1b1..e03b958 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,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.11-pre +VERSION=0.0.12-pre V8_VERSION=1.0.0 RUNTIME=lo LO_HOME=$(shell pwd) @@ -25,6 +25,7 @@ else LARGS+=-s else ifeq ($(UNAME_S),Darwin) os=mac + BINDINGS+=mach.o LARGS+=-s -w ifeq ($(ARCH),arm64) LARGS+=-arch arm64 @@ -84,6 +85,9 @@ ${RUNTIME}.exe: v8/include v8/v8_monolith.lib main.js ## link the runtime for wi cl /EHsc /std:c++17 /DRUNTIME='"${RUNTIME}"' /DVERSION='"${VERSION}"' /I./v8 /I./v8/include /c ${RUNTIME}.cc cl v8/v8_monolith.lib ${RUNTIME}.obj main.obj winmm.lib dbghelp.lib advapi32.lib /link /out:${TARGET}.exe +mach.o: lib/mach/mach.cc ## build the core binding + $(CC) -fPIC $(CCARGS) $(OPT) -I. -I./v8 -I./v8/include $(WARN) ${V8_FLAGS} -o mach.o lib/mach/mach.cc + core.o: lib/core/core.cc ## build the core binding $(CC) -fPIC $(CCARGS) $(OPT) -I. -I./v8 -I./v8/include $(WARN) ${V8_FLAGS} -o core.o lib/core/core.cc diff --git a/TODO.md b/TODO.md index e170002..7c23f86 100644 --- a/TODO.md +++ b/TODO.md @@ -68,6 +68,11 @@ - [ ] **todo**: fix build.js for libssl so it works for compiling openssl from scratch - [ ] **todo**: add a safe_wrap method to main.js so we can wrap pointers with a check for maxsafeinteger - [ ] **todo**: when i do ```lo build binding ``` generate binding definition with all cases covered and lots of comments, or not... +- [ ] **todo**: figure out a nice way to write modules that work on different platforms. can we pre-process the js in some way to only include code for that platform in the binary? +- [ ] **bug**: when i do ```lo build``` after downloading runtime it fails because em_inflate source files are not in the binary and the build script is not available in lib/inflate. how do we resolve this? +- [ ] **question**: how do we model constants like RTLD_DEFAULT which seem to be pointers to things? +- [ ] **bug**: on macos, when i do a ```lo build``` it generates same main.h for main.h main_win.h and main_mac.h +- [ ] **todo**: we need a way to ignore auto-generated files for git, but also to be able to re-generate them to check in when we need to. ## features diff --git a/builtins.S b/builtins.S index 61e604c..f0597b1 100644 --- a/builtins.S +++ b/builtins.S @@ -88,6 +88,16 @@ __binary_lib_curl_api_js_start: .incbin "lib/curl/api.js" .global __binary_lib_curl_api_js_end __binary_lib_curl_api_js_end: +.global __binary_lib_duckdb_api_js_start +__binary_lib_duckdb_api_js_start: + .incbin "lib/duckdb/api.js" + .global __binary_lib_duckdb_api_js_end +__binary_lib_duckdb_api_js_end: +.global __binary_lib_duckdb_build_js_start +__binary_lib_duckdb_build_js_start: + .incbin "lib/duckdb/build.js" + .global __binary_lib_duckdb_build_js_end +__binary_lib_duckdb_build_js_end: .global __binary_lib_encode_api_js_start __binary_lib_encode_api_js_start: .incbin "lib/encode/api.js" @@ -103,6 +113,11 @@ __binary_lib_inflate_api_js_start: .incbin "lib/inflate/api.js" .global __binary_lib_inflate_api_js_end __binary_lib_inflate_api_js_end: +.global __binary_lib_inflate_build_js_start +__binary_lib_inflate_build_js_start: + .incbin "lib/inflate/build.js" + .global __binary_lib_inflate_build_js_end +__binary_lib_inflate_build_js_end: .global __binary_lib_libffi_api_js_start __binary_lib_libffi_api_js_start: .incbin "lib/libffi/api.js" @@ -123,6 +138,11 @@ __binary_lib_mbedtls_api_js_start: .incbin "lib/mbedtls/api.js" .global __binary_lib_mbedtls_api_js_end __binary_lib_mbedtls_api_js_end: +.global __binary_lib_mbedtls_build_js_start +__binary_lib_mbedtls_build_js_start: + .incbin "lib/mbedtls/build.js" + .global __binary_lib_mbedtls_build_js_end +__binary_lib_mbedtls_build_js_end: .global __binary_lib_net_api_js_start __binary_lib_net_api_js_start: .incbin "lib/net/api.js" @@ -133,6 +153,11 @@ __binary_lib_pico_api_js_start: .incbin "lib/pico/api.js" .global __binary_lib_pico_api_js_end __binary_lib_pico_api_js_end: +.global __binary_lib_pico_build_js_start +__binary_lib_pico_build_js_start: + .incbin "lib/pico/build.js" + .global __binary_lib_pico_build_js_end +__binary_lib_pico_build_js_end: .global __binary_lib_pthread_api_js_start __binary_lib_pthread_api_js_start: .incbin "lib/pthread/api.js" @@ -158,18 +183,23 @@ __binary_lib_tcc_api_js_start: .incbin "lib/tcc/api.js" .global __binary_lib_tcc_api_js_end __binary_lib_tcc_api_js_end: +.global __binary_lib_tcc_build_js_start +__binary_lib_tcc_build_js_start: + .incbin "lib/tcc/build.js" + .global __binary_lib_tcc_build_js_end +__binary_lib_tcc_build_js_end: .global __binary_lib_wireguard_api_js_start __binary_lib_wireguard_api_js_start: .incbin "lib/wireguard/api.js" .global __binary_lib_wireguard_api_js_end __binary_lib_wireguard_api_js_end: +.global __binary_lib_wireguard_build_js_start +__binary_lib_wireguard_build_js_start: + .incbin "lib/wireguard/build.js" + .global __binary_lib_wireguard_build_js_end +__binary_lib_wireguard_build_js_end: .global __binary_lib_zlib_api_js_start __binary_lib_zlib_api_js_start: .incbin "lib/zlib/api.js" .global __binary_lib_zlib_api_js_end __binary_lib_zlib_api_js_end: -.global __binary_lib_duckdb_api_js_start -__binary_lib_duckdb_api_js_start: - .incbin "lib/duckdb/api.js" - .global __binary_lib_duckdb_api_js_end -__binary_lib_duckdb_api_js_end: diff --git a/builtins_linux.S b/builtins_linux.S index 7c8858a..963e979 100644 --- a/builtins_linux.S +++ b/builtins_linux.S @@ -88,6 +88,16 @@ _binary_lib_curl_api_js_start: .incbin "lib/curl/api.js" .global _binary_lib_curl_api_js_end _binary_lib_curl_api_js_end: +.global _binary_lib_duckdb_api_js_start +_binary_lib_duckdb_api_js_start: + .incbin "lib/duckdb/api.js" + .global _binary_lib_duckdb_api_js_end +_binary_lib_duckdb_api_js_end: +.global _binary_lib_duckdb_build_js_start +_binary_lib_duckdb_build_js_start: + .incbin "lib/duckdb/build.js" + .global _binary_lib_duckdb_build_js_end +_binary_lib_duckdb_build_js_end: .global _binary_lib_encode_api_js_start _binary_lib_encode_api_js_start: .incbin "lib/encode/api.js" @@ -103,6 +113,11 @@ _binary_lib_inflate_api_js_start: .incbin "lib/inflate/api.js" .global _binary_lib_inflate_api_js_end _binary_lib_inflate_api_js_end: +.global _binary_lib_inflate_build_js_start +_binary_lib_inflate_build_js_start: + .incbin "lib/inflate/build.js" + .global _binary_lib_inflate_build_js_end +_binary_lib_inflate_build_js_end: .global _binary_lib_libffi_api_js_start _binary_lib_libffi_api_js_start: .incbin "lib/libffi/api.js" @@ -123,6 +138,11 @@ _binary_lib_mbedtls_api_js_start: .incbin "lib/mbedtls/api.js" .global _binary_lib_mbedtls_api_js_end _binary_lib_mbedtls_api_js_end: +.global _binary_lib_mbedtls_build_js_start +_binary_lib_mbedtls_build_js_start: + .incbin "lib/mbedtls/build.js" + .global _binary_lib_mbedtls_build_js_end +_binary_lib_mbedtls_build_js_end: .global _binary_lib_net_api_js_start _binary_lib_net_api_js_start: .incbin "lib/net/api.js" @@ -133,6 +153,11 @@ _binary_lib_pico_api_js_start: .incbin "lib/pico/api.js" .global _binary_lib_pico_api_js_end _binary_lib_pico_api_js_end: +.global _binary_lib_pico_build_js_start +_binary_lib_pico_build_js_start: + .incbin "lib/pico/build.js" + .global _binary_lib_pico_build_js_end +_binary_lib_pico_build_js_end: .global _binary_lib_pthread_api_js_start _binary_lib_pthread_api_js_start: .incbin "lib/pthread/api.js" @@ -158,18 +183,23 @@ _binary_lib_tcc_api_js_start: .incbin "lib/tcc/api.js" .global _binary_lib_tcc_api_js_end _binary_lib_tcc_api_js_end: +.global _binary_lib_tcc_build_js_start +_binary_lib_tcc_build_js_start: + .incbin "lib/tcc/build.js" + .global _binary_lib_tcc_build_js_end +_binary_lib_tcc_build_js_end: .global _binary_lib_wireguard_api_js_start _binary_lib_wireguard_api_js_start: .incbin "lib/wireguard/api.js" .global _binary_lib_wireguard_api_js_end _binary_lib_wireguard_api_js_end: +.global _binary_lib_wireguard_build_js_start +_binary_lib_wireguard_build_js_start: + .incbin "lib/wireguard/build.js" + .global _binary_lib_wireguard_build_js_end +_binary_lib_wireguard_build_js_end: .global _binary_lib_zlib_api_js_start _binary_lib_zlib_api_js_start: .incbin "lib/zlib/api.js" .global _binary_lib_zlib_api_js_end _binary_lib_zlib_api_js_end: -.global _binary_lib_duckdb_api_js_start -_binary_lib_duckdb_api_js_start: - .incbin "lib/duckdb/api.js" - .global _binary_lib_duckdb_api_js_end -_binary_lib_duckdb_api_js_end: diff --git a/lib/build.js b/lib/build.js index 4a4529f..1ef3254 100644 --- a/lib/build.js +++ b/lib/build.js @@ -170,9 +170,14 @@ function create_header (libs = [], bindings = [], opts) { config.os = 'win' writeFile(`${LO_HOME}/main_win.h`, encoder.encode(headerFile([...libs, ...bindings.map(n => `lib/${n}/${n}.a`)], opts))) - config.os = os + config.os = 'mac' + // todo: this is a hack to get mach in core runtime on macos for now + writeFile(`${LO_HOME}/main_mac.h`, encoder.encode(headerFile([...libs, + ...[...bindings.includes('mach') ? [] : ['mach'], ...bindings].map(n => `lib/${n}/${n}.a`)], opts))) + config.os = 'linux' writeFile(`${LO_HOME}/main.h`, encoder.encode(headerFile([...libs, ...bindings.map(n => `lib/${n}/${n}.a`)], opts))) + config.os = os } async function build_runtime ({ libs = lo.builtins(), bindings = lo.libraries(), @@ -241,7 +246,7 @@ const encoder = new TextEncoder() const status = new Int32Array(2) // todo: clean up api so we can pass a config in and run builds through api -const VERSION = getenv('VERSION') || '"0.0.11pre"' +const VERSION = getenv('VERSION') || '"0.0.12pre"' const RUNTIME = getenv('RUNTIME') || '"lo"' const TARGET = getenv('TARGET') || 'lo' const LINK_TYPE = (getenv('LINK_TYPE') || '-rdynamic').split(' ') @@ -328,26 +333,33 @@ const runtimes = { 'lo.h', 'lib/core/api.js', 'lib/curl/api.js', + 'lib/duckdb/api.js', + 'lib/duckdb/build.js', 'lib/encode/api.js', 'lib/epoll/api.js', 'lib/inflate/api.js', + 'lib/inflate/build.js', 'lib/libffi/api.js', 'lib/libssl/api.js', 'lib/lz4/api.js', 'lib/mbedtls/api.js', + 'lib/mbedtls/build.js', 'lib/net/api.js', 'lib/pico/api.js', + 'lib/pico/build.js', 'lib/pthread/api.js', 'lib/seccomp/api.js', 'lib/sqlite/api.js', 'lib/system/api.js', 'lib/tcc/api.js', + 'lib/tcc/build.js', 'lib/wireguard/api.js', + 'lib/wireguard/build.js', 'lib/zlib/api.js', - 'lib/duckdb/api.js' ] }, full: { + // todo: change this so we define the platforms in the api.js and we just filter above bindings: (os === 'linux' ? [ 'core', 'curl', @@ -475,6 +487,10 @@ const runtimes = { } } +if (os === 'mac') { + Object.keys(runtimes).forEach(name => runtimes[name].bindings.push('mach')) +} + async function build (args) { let verbose = false if (args.includes('-v')) { diff --git a/lib/core/api.js b/lib/core/api.js index 3174f19..384a380 100644 --- a/lib/core/api.js +++ b/lib/core/api.js @@ -552,8 +552,23 @@ const constants = { O_TRUNC: 'i32', STDIN: 0, STDOUT: 1, STDERR: 2, O_CLOEXEC: 'i32', RUSAGE_SELF: 'i32', SEEK_SET: 'i32', SEEK_CUR: 'i32', SEEK_END: 'i32', S_IRWXO: 'i32', F_OK: 'i32', S_IFMT: 'i32', S_IFDIR: 'i32', - S_IFREG: 'i32', NAME_MAX: 'u32', O_RDWR: 'i32', O_DIRECTORY: 'i32' + S_IFREG: 'i32', NAME_MAX: 'u32', O_RDWR: 'i32', O_DIRECTORY: 'i32', + F_SETFL: 'i32', O_NONBLOCK: 'i32', + RTLD_NOW: 'i32', RTLD_LAZY: 'i32', EAGAIN: 'i32' } + +if (globalThis.lo) { + if (lo.core.os === 'mac') { + constants.RTLD_MAIN_ONLY = 'u64' + constants.RTLD_DEFAULT = 'u64' + constants.RTLD_SELF = 'u64' + constants.RTLD_NEXT = 'u64' + } else if (lo.core.os === 'linux') { +// todo: we need a way to inject defines before the includes +// preamble = `#define _GNU_SOURCE\n${preamble}` + } +} + // list of headers to include const includes = [ 'unistd.h', 'sys/stat.h', 'fcntl.h', 'dirent.h', 'dlfcn.h', 'sys/mman.h', diff --git a/lib/core/core.cc b/lib/core/core.cc index db01f8d..96b69e3 100644 --- a/lib/core/core.cc +++ b/lib/core/core.cc @@ -1690,38 +1690,43 @@ void Init(Isolate* isolate, Local target) { SET_METHOD(isolate, module, "isolate_start", isolate_startSlow); SET_FAST_METHOD(isolate, module, "strnlen", &pFstrnlen, strnlenSlow); - SET_VALUE(isolate, module, "S_IFBLK", Integer::New(isolate, S_IFBLK)); - SET_VALUE(isolate, module, "S_IFCHR", Integer::New(isolate, S_IFCHR)); - SET_VALUE(isolate, module, "S_IFIFO", Integer::New(isolate, S_IFIFO)); - SET_VALUE(isolate, module, "S_IRUSR", Integer::New(isolate, S_IRUSR)); - SET_VALUE(isolate, module, "S_IWUSR", Integer::New(isolate, S_IWUSR)); - SET_VALUE(isolate, module, "S_IRGRP", Integer::New(isolate, S_IRGRP)); - SET_VALUE(isolate, module, "S_IWGRP", Integer::New(isolate, S_IWGRP)); - SET_VALUE(isolate, module, "S_IROTH", Integer::New(isolate, S_IROTH)); - SET_VALUE(isolate, module, "S_IWOTH", Integer::New(isolate, S_IWOTH)); - SET_VALUE(isolate, module, "O_RDONLY", Integer::New(isolate, O_RDONLY)); - SET_VALUE(isolate, module, "O_WRONLY", Integer::New(isolate, O_WRONLY)); - SET_VALUE(isolate, module, "O_CREAT", Integer::New(isolate, O_CREAT)); - SET_VALUE(isolate, module, "S_IRWXU", Integer::New(isolate, S_IRWXU)); - SET_VALUE(isolate, module, "S_IRWXG", Integer::New(isolate, S_IRWXG)); - SET_VALUE(isolate, module, "S_IXOTH", Integer::New(isolate, S_IXOTH)); - SET_VALUE(isolate, module, "O_TRUNC", Integer::New(isolate, O_TRUNC)); - SET_VALUE(isolate, module, "STDIN", Integer::New(isolate, 0)); - SET_VALUE(isolate, module, "STDOUT", Integer::New(isolate, 1)); - SET_VALUE(isolate, module, "STDERR", Integer::New(isolate, 2)); - SET_VALUE(isolate, module, "O_CLOEXEC", Integer::New(isolate, O_CLOEXEC)); - SET_VALUE(isolate, module, "RUSAGE_SELF", Integer::New(isolate, RUSAGE_SELF)); - SET_VALUE(isolate, module, "SEEK_SET", Integer::New(isolate, SEEK_SET)); - SET_VALUE(isolate, module, "SEEK_CUR", Integer::New(isolate, SEEK_CUR)); - SET_VALUE(isolate, module, "SEEK_END", Integer::New(isolate, SEEK_END)); - SET_VALUE(isolate, module, "S_IRWXO", Integer::New(isolate, S_IRWXO)); - SET_VALUE(isolate, module, "F_OK", Integer::New(isolate, F_OK)); - SET_VALUE(isolate, module, "S_IFMT", Integer::New(isolate, S_IFMT)); - SET_VALUE(isolate, module, "S_IFDIR", Integer::New(isolate, S_IFDIR)); - SET_VALUE(isolate, module, "S_IFREG", Integer::New(isolate, S_IFREG)); - SET_VALUE(isolate, module, "NAME_MAX", Integer::New(isolate, NAME_MAX)); - SET_VALUE(isolate, module, "O_RDWR", Integer::New(isolate, O_RDWR)); - SET_VALUE(isolate, module, "O_DIRECTORY", Integer::New(isolate, O_DIRECTORY)); + SET_VALUE(isolate, module, "S_IFBLK", Integer::New(isolate, (int32_t)S_IFBLK)); + SET_VALUE(isolate, module, "S_IFCHR", Integer::New(isolate, (int32_t)S_IFCHR)); + SET_VALUE(isolate, module, "S_IFIFO", Integer::New(isolate, (int32_t)S_IFIFO)); + SET_VALUE(isolate, module, "S_IRUSR", Integer::New(isolate, (int32_t)S_IRUSR)); + SET_VALUE(isolate, module, "S_IWUSR", Integer::New(isolate, (int32_t)S_IWUSR)); + SET_VALUE(isolate, module, "S_IRGRP", Integer::New(isolate, (int32_t)S_IRGRP)); + SET_VALUE(isolate, module, "S_IWGRP", Integer::New(isolate, (int32_t)S_IWGRP)); + SET_VALUE(isolate, module, "S_IROTH", Integer::New(isolate, (int32_t)S_IROTH)); + SET_VALUE(isolate, module, "S_IWOTH", Integer::New(isolate, (int32_t)S_IWOTH)); + SET_VALUE(isolate, module, "O_RDONLY", Integer::New(isolate, (int32_t)O_RDONLY)); + SET_VALUE(isolate, module, "O_WRONLY", Integer::New(isolate, (int32_t)O_WRONLY)); + SET_VALUE(isolate, module, "O_CREAT", Integer::New(isolate, (int32_t)O_CREAT)); + SET_VALUE(isolate, module, "S_IRWXU", Integer::New(isolate, (int32_t)S_IRWXU)); + SET_VALUE(isolate, module, "S_IRWXG", Integer::New(isolate, (int32_t)S_IRWXG)); + SET_VALUE(isolate, module, "S_IXOTH", Integer::New(isolate, (int32_t)S_IXOTH)); + SET_VALUE(isolate, module, "O_TRUNC", Integer::New(isolate, (int32_t)O_TRUNC)); + SET_VALUE(isolate, module, "STDIN", Number::New(isolate, (int64_t)0)); + SET_VALUE(isolate, module, "STDOUT", Number::New(isolate, (int64_t)1)); + SET_VALUE(isolate, module, "STDERR", Number::New(isolate, (int64_t)2)); + SET_VALUE(isolate, module, "O_CLOEXEC", Integer::New(isolate, (int32_t)O_CLOEXEC)); + SET_VALUE(isolate, module, "RUSAGE_SELF", Integer::New(isolate, (int32_t)RUSAGE_SELF)); + SET_VALUE(isolate, module, "SEEK_SET", Integer::New(isolate, (int32_t)SEEK_SET)); + SET_VALUE(isolate, module, "SEEK_CUR", Integer::New(isolate, (int32_t)SEEK_CUR)); + SET_VALUE(isolate, module, "SEEK_END", Integer::New(isolate, (int32_t)SEEK_END)); + SET_VALUE(isolate, module, "S_IRWXO", Integer::New(isolate, (int32_t)S_IRWXO)); + SET_VALUE(isolate, module, "F_OK", Integer::New(isolate, (int32_t)F_OK)); + SET_VALUE(isolate, module, "S_IFMT", Integer::New(isolate, (int32_t)S_IFMT)); + SET_VALUE(isolate, module, "S_IFDIR", Integer::New(isolate, (int32_t)S_IFDIR)); + SET_VALUE(isolate, module, "S_IFREG", Integer::New(isolate, (int32_t)S_IFREG)); + SET_VALUE(isolate, module, "NAME_MAX", Integer::New(isolate, (uint32_t)NAME_MAX)); + SET_VALUE(isolate, module, "O_RDWR", Integer::New(isolate, (int32_t)O_RDWR)); + SET_VALUE(isolate, module, "O_DIRECTORY", Integer::New(isolate, (int32_t)O_DIRECTORY)); + SET_VALUE(isolate, module, "F_SETFL", Integer::New(isolate, (int32_t)F_SETFL)); + SET_VALUE(isolate, module, "O_NONBLOCK", Integer::New(isolate, (int32_t)O_NONBLOCK)); + SET_VALUE(isolate, module, "RTLD_NOW", Integer::New(isolate, (int32_t)RTLD_NOW)); + SET_VALUE(isolate, module, "RTLD_LAZY", Integer::New(isolate, (int32_t)RTLD_LAZY)); + SET_VALUE(isolate, module, "EAGAIN", Integer::New(isolate, (int32_t)EAGAIN)); SET_MODULE(isolate, target, "core", module); diff --git a/lib/curl/curl.cc b/lib/curl/curl.cc index 93442f7..e99c529 100644 --- a/lib/curl/curl.cc +++ b/lib/curl/curl.cc @@ -333,18 +333,18 @@ void Init(Isolate* isolate, Local target) { SET_FAST_METHOD(isolate, module, "global_cleanup", &pFglobal_cleanup, global_cleanupSlow); SET_FAST_METHOD(isolate, module, "easy_getinfo", &pFeasy_getinfo, easy_getinfoSlow); - SET_VALUE(isolate, module, "CURLINFO_OFF_T", Integer::New(isolate, CURLINFO_OFF_T)); - SET_VALUE(isolate, module, "CURL_GLOBAL_DEFAULT", Integer::New(isolate, CURL_GLOBAL_DEFAULT)); - SET_VALUE(isolate, module, "CURLOPT_URL", Integer::New(isolate, CURLOPT_URL)); - SET_VALUE(isolate, module, "CURLOPT_BUFFERSIZE", Integer::New(isolate, CURLOPT_BUFFERSIZE)); - SET_VALUE(isolate, module, "CURLOPT_HTTP_VERSION", Integer::New(isolate, CURLOPT_HTTP_VERSION)); - SET_VALUE(isolate, module, "CURL_HTTP_VERSION_1_1", Integer::New(isolate, CURL_HTTP_VERSION_1_1)); - SET_VALUE(isolate, module, "CURLOPT_FOLLOWLOCATION", Integer::New(isolate, CURLOPT_FOLLOWLOCATION)); - SET_VALUE(isolate, module, "CURLINFO_SIZE_DOWNLOAD_T", Integer::New(isolate, CURLINFO_SIZE_DOWNLOAD_T)); - SET_VALUE(isolate, module, "CURLOPT_WRITEFUNCTION", Integer::New(isolate, CURLOPT_WRITEFUNCTION)); - SET_VALUE(isolate, module, "CURLOPT_WRITEDATA", Integer::New(isolate, CURLOPT_WRITEDATA)); - SET_VALUE(isolate, module, "CURLINFO_RESPONSE_CODE", Integer::New(isolate, CURLINFO_RESPONSE_CODE)); - SET_VALUE(isolate, module, "CURLOPT_FAILONERROR", Integer::New(isolate, CURLOPT_FAILONERROR)); + SET_VALUE(isolate, module, "CURLINFO_OFF_T", Integer::New(isolate, (int32_t)CURLINFO_OFF_T)); + SET_VALUE(isolate, module, "CURL_GLOBAL_DEFAULT", Integer::New(isolate, (int32_t)CURL_GLOBAL_DEFAULT)); + SET_VALUE(isolate, module, "CURLOPT_URL", Integer::New(isolate, (int32_t)CURLOPT_URL)); + SET_VALUE(isolate, module, "CURLOPT_BUFFERSIZE", Integer::New(isolate, (int32_t)CURLOPT_BUFFERSIZE)); + SET_VALUE(isolate, module, "CURLOPT_HTTP_VERSION", Integer::New(isolate, (int32_t)CURLOPT_HTTP_VERSION)); + SET_VALUE(isolate, module, "CURL_HTTP_VERSION_1_1", Integer::New(isolate, (int32_t)CURL_HTTP_VERSION_1_1)); + SET_VALUE(isolate, module, "CURLOPT_FOLLOWLOCATION", Integer::New(isolate, (int32_t)CURLOPT_FOLLOWLOCATION)); + SET_VALUE(isolate, module, "CURLINFO_SIZE_DOWNLOAD_T", Integer::New(isolate, (int32_t)CURLINFO_SIZE_DOWNLOAD_T)); + SET_VALUE(isolate, module, "CURLOPT_WRITEFUNCTION", Integer::New(isolate, (int32_t)CURLOPT_WRITEFUNCTION)); + SET_VALUE(isolate, module, "CURLOPT_WRITEDATA", Integer::New(isolate, (int32_t)CURLOPT_WRITEDATA)); + SET_VALUE(isolate, module, "CURLINFO_RESPONSE_CODE", Integer::New(isolate, (int32_t)CURLINFO_RESPONSE_CODE)); + SET_VALUE(isolate, module, "CURLOPT_FAILONERROR", Integer::New(isolate, (int32_t)CURLOPT_FAILONERROR)); SET_MODULE(isolate, target, "curl", module); diff --git a/lib/duckdb/duckdb.cc b/lib/duckdb/duckdb.cc deleted file mode 100644 index 8578064..0000000 --- a/lib/duckdb/duckdb.cc +++ /dev/null @@ -1,638 +0,0 @@ - -// [do not edit,] -// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile -#include -#include - -namespace lo { -namespace duckdb { - -using v8::String; -using v8::FunctionCallbackInfo; -using v8::Array; -using v8::Local; -using v8::ObjectTemplate; -using v8::Isolate; -using v8::Value; -using v8::Uint32Array; -using v8::ArrayBuffer; -using v8::Context; -using v8::Integer; -using v8::Function; -using v8::NewStringType; -using v8::Object; -using v8::BackingStore; -using v8::TryCatch; -using v8::ScriptCompiler; -using v8::Module; -using v8::FixedArray; -using v8::ScriptOrigin; -using v8::SharedArrayBuffer; -using v8::MaybeLocal; -using v8::HandleScope; -using v8::Promise; -using v8::Number; -using v8::StackTrace; -using v8::Message; -using v8::StackFrame; -using v8::Maybe; -using v8::FunctionTemplate; -using v8::FunctionCallback; -using v8::PromiseRejectMessage; -using v8::CFunction; -using v8::Global; -using v8::Exception; -using v8::CTypeInfo; -using v8::PropertyAttribute; -using v8::Signature; -using v8::ConstructorBehavior; -using v8::SideEffectType; -using v8::kPromiseRejectAfterResolved; -using v8::kPromiseResolveAfterResolved; -using v8::kPromiseHandlerAddedAfterReject; -using v8::Data; -using v8::PrimitiveArray; -using v8::TypedArray; -using v8::Uint8Array; -using v8::Boolean; -using v8::ModuleRequest; -using v8::CFunctionInfo; -using v8::OOMDetails; -using v8::V8; -using v8::BigInt; - - -int set_config (duckdb_config* config, const char* key, const char* value) { - return duckdb_set_config(*config, key, value); -} - - -int32_t create_configFast(void* p, void* p0); -v8::CTypeInfo cargscreate_config[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rccreate_config = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infocreate_config = v8::CFunctionInfo(rccreate_config, 2, cargscreate_config); -v8::CFunction pFcreate_config = v8::CFunction((const void*)&create_configFast, &infocreate_config); - -int32_t open_extFast(void* p, struct FastOneByteString* const p0, struct FastApiTypedArray* const p1, void* p2, void* p3); -v8::CTypeInfo cargsopen_ext[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcopen_ext = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoopen_ext = v8::CFunctionInfo(rcopen_ext, 5, cargsopen_ext); -v8::CFunction pFopen_ext = v8::CFunction((const void*)&open_extFast, &infoopen_ext); - -int32_t set_configFast(void* p, void* p0, struct FastOneByteString* const p1, struct FastOneByteString* const p2); -v8::CTypeInfo cargsset_config[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rcset_config = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoset_config = v8::CFunctionInfo(rcset_config, 4, cargsset_config); -v8::CFunction pFset_config = v8::CFunction((const void*)&set_configFast, &infoset_config); - -int32_t connectFast(void* p, void* p0, struct FastApiTypedArray* const p1); -v8::CTypeInfo cargsconnect[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcconnect = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoconnect = v8::CFunctionInfo(rcconnect, 3, cargsconnect); -v8::CFunction pFconnect = v8::CFunction((const void*)&connectFast, &infoconnect); - -int32_t queryFast(void* p, void* p0, struct FastOneByteString* const p1, void* p2); -v8::CTypeInfo cargsquery[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcquery = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoquery = v8::CFunctionInfo(rcquery, 4, cargsquery); -v8::CFunction pFquery = v8::CFunction((const void*)&queryFast, &infoquery); - -int32_t prepareFast(void* p, void* p0, struct FastOneByteString* const p1, struct FastApiTypedArray* const p2); -v8::CTypeInfo cargsprepare[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcprepare = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoprepare = v8::CFunctionInfo(rcprepare, 4, cargsprepare); -v8::CFunction pFprepare = v8::CFunction((const void*)&prepareFast, &infoprepare); - -int32_t row_countFast(void* p, void* p0); -v8::CTypeInfo cargsrow_count[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcrow_count = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo inforow_count = v8::CFunctionInfo(rcrow_count, 2, cargsrow_count); -v8::CFunction pFrow_count = v8::CFunction((const void*)&row_countFast, &inforow_count); - -int32_t column_countFast(void* p, void* p0); -v8::CTypeInfo cargscolumn_count[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rccolumn_count = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infocolumn_count = v8::CFunctionInfo(rccolumn_count, 2, cargscolumn_count); -v8::CFunction pFcolumn_count = v8::CFunction((const void*)&column_countFast, &infocolumn_count); - -void value_timestampFast(void* p, void* p0, uint32_t p1, uint32_t p2, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsvalue_timestamp[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcvalue_timestamp = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infovalue_timestamp = v8::CFunctionInfo(rcvalue_timestamp, 5, cargsvalue_timestamp); -v8::CFunction pFvalue_timestamp = v8::CFunction((const void*)&value_timestampFast, &infovalue_timestamp); - -uint32_t value_uint32Fast(void* p, void* p0, uint32_t p1, uint32_t p2); -v8::CTypeInfo cargsvalue_uint32[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcvalue_uint32 = v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); -v8::CFunctionInfo infovalue_uint32 = v8::CFunctionInfo(rcvalue_uint32, 4, cargsvalue_uint32); -v8::CFunction pFvalue_uint32 = v8::CFunction((const void*)&value_uint32Fast, &infovalue_uint32); - -int32_t value_int32Fast(void* p, void* p0, uint32_t p1, uint32_t p2); -v8::CTypeInfo cargsvalue_int32[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcvalue_int32 = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infovalue_int32 = v8::CFunctionInfo(rcvalue_int32, 4, cargsvalue_int32); -v8::CFunction pFvalue_int32 = v8::CFunction((const void*)&value_int32Fast, &infovalue_int32); - -void value_varcharFast(void* p, void* p0, uint32_t p1, uint32_t p2, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsvalue_varchar[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcvalue_varchar = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infovalue_varchar = v8::CFunctionInfo(rcvalue_varchar, 5, cargsvalue_varchar); -v8::CFunction pFvalue_varchar = v8::CFunction((const void*)&value_varcharFast, &infovalue_varchar); - -void closeFast(void* p, void* p0); -v8::CTypeInfo cargsclose[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcclose = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoclose = v8::CFunctionInfo(rcclose, 2, cargsclose); -v8::CFunction pFclose = v8::CFunction((const void*)&closeFast, &infoclose); - -void destroy_resultFast(void* p, void* p0); -v8::CTypeInfo cargsdestroy_result[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcdestroy_result = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infodestroy_result = v8::CFunctionInfo(rcdestroy_result, 2, cargsdestroy_result); -v8::CFunction pFdestroy_result = v8::CFunction((const void*)&destroy_resultFast, &infodestroy_result); - -void destroy_prepareFast(void* p, void* p0); -v8::CTypeInfo cargsdestroy_prepare[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcdestroy_prepare = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infodestroy_prepare = v8::CFunctionInfo(rcdestroy_prepare, 2, cargsdestroy_prepare); -v8::CFunction pFdestroy_prepare = v8::CFunction((const void*)&destroy_prepareFast, &infodestroy_prepare); - -int32_t execute_preparedFast(void* p, void* p0, void* p1); -v8::CTypeInfo cargsexecute_prepared[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcexecute_prepared = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoexecute_prepared = v8::CFunctionInfo(rcexecute_prepared, 3, cargsexecute_prepared); -v8::CFunction pFexecute_prepared = v8::CFunction((const void*)&execute_preparedFast, &infoexecute_prepared); - -void column_nameFast(void* p, void* p0, uint32_t p1, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargscolumn_name[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rccolumn_name = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infocolumn_name = v8::CFunctionInfo(rccolumn_name, 4, cargscolumn_name); -v8::CFunction pFcolumn_name = v8::CFunction((const void*)&column_nameFast, &infocolumn_name); - -int32_t column_typeFast(void* p, void* p0, uint32_t p1); -v8::CTypeInfo cargscolumn_type[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rccolumn_type = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infocolumn_type = v8::CFunctionInfo(rccolumn_type, 3, cargscolumn_type); -v8::CFunction pFcolumn_type = v8::CFunction((const void*)&column_typeFast, &infocolumn_type); - -void result_errorFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsresult_error[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcresult_error = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo inforesult_error = v8::CFunctionInfo(rcresult_error, 3, cargsresult_error); -v8::CFunction pFresult_error = v8::CFunction((const void*)&result_errorFast, &inforesult_error); - -uint32_t value_is_nullFast(void* p, void* p0, uint32_t p1, uint32_t p2); -v8::CTypeInfo cargsvalue_is_null[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcvalue_is_null = v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); -v8::CFunctionInfo infovalue_is_null = v8::CFunctionInfo(rcvalue_is_null, 4, cargsvalue_is_null); -v8::CFunction pFvalue_is_null = v8::CFunction((const void*)&value_is_nullFast, &infovalue_is_null); - -void disconnectFast(void* p, void* p0); -v8::CTypeInfo cargsdisconnect[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcdisconnect = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infodisconnect = v8::CFunctionInfo(rcdisconnect, 2, cargsdisconnect); -v8::CFunction pFdisconnect = v8::CFunction((const void*)&disconnectFast, &infodisconnect); - -void library_versionFast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargslibrary_version[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rclibrary_version = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infolibrary_version = v8::CFunctionInfo(rclibrary_version, 2, cargslibrary_version); -v8::CFunction pFlibrary_version = v8::CFunction((const void*)&library_versionFast, &infolibrary_version); - - - -void create_configSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - duckdb_config* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = duckdb_create_config(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t create_configFast(void* p, void* p0) { - duckdb_config* v0 = reinterpret_cast(p0); - return duckdb_create_config(v0); -} -void open_extSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - String::Utf8Value v0(isolate, args[0]); - Local u321 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u321->Buffer()->Data() + u321->ByteOffset(); - duckdb_database* v1 = reinterpret_cast(ptr1); - duckdb_config v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - char** v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - int32_t rc = duckdb_open_ext(*v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t open_extFast(void* p, struct FastOneByteString* const p0, struct FastApiTypedArray* const p1, void* p2, void* p3) { - struct FastOneByteString* const v0 = p0; - duckdb_database* v1 = reinterpret_cast(p1->data); - duckdb_config v2 = reinterpret_cast(p2); - char** v3 = reinterpret_cast(p3); - return duckdb_open_ext(v0->data, v1, v2, v3); -} -void set_configSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - duckdb_config* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - String::Utf8Value v2(isolate, args[2]); - int32_t rc = set_config(v0, *v1, *v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t set_configFast(void* p, void* p0, struct FastOneByteString* const p1, struct FastOneByteString* const p2) { - duckdb_config* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - struct FastOneByteString* const v2 = p2; - return set_config(v0, v1->data, v2->data); -} -void connectSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - duckdb_database v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - Local u321 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u321->Buffer()->Data() + u321->ByteOffset(); - duckdb_connection* v1 = reinterpret_cast(ptr1); - int32_t rc = duckdb_connect(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t connectFast(void* p, void* p0, struct FastApiTypedArray* const p1) { - duckdb_database v0 = reinterpret_cast(p0); - duckdb_connection* v1 = reinterpret_cast(p1->data); - return duckdb_connect(v0, v1); -} -void querySlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - duckdb_connection v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - duckdb_result* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - int32_t rc = duckdb_query(v0, *v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t queryFast(void* p, void* p0, struct FastOneByteString* const p1, void* p2) { - duckdb_connection v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - duckdb_result* v2 = reinterpret_cast(p2); - return duckdb_query(v0, v1->data, v2); -} -void prepareSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - duckdb_connection v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - Local u322 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u322->Buffer()->Data() + u322->ByteOffset(); - duckdb_prepared_statement* v2 = reinterpret_cast(ptr2); - int32_t rc = duckdb_prepare(v0, *v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t prepareFast(void* p, void* p0, struct FastOneByteString* const p1, struct FastApiTypedArray* const p2) { - duckdb_connection v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - duckdb_prepared_statement* v2 = reinterpret_cast(p2->data); - return duckdb_prepare(v0, v1->data, v2); -} -void row_countSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - duckdb_result* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = duckdb_row_count(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t row_countFast(void* p, void* p0) { - duckdb_result* v0 = reinterpret_cast(p0); - return duckdb_row_count(v0); -} -void column_countSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - duckdb_result* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = duckdb_column_count(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t column_countFast(void* p, void* p0) { - duckdb_result* v0 = reinterpret_cast(p0); - return duckdb_column_count(v0); -} -void value_timestampSlow(const FunctionCallbackInfo &args) { - duckdb_result* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - uint32_t v2 = Local::Cast(args[2])->Value(); - duckdb_timestamp rc = duckdb_value_timestamp(v0, v1, v2); - Local ab = args[3].As()->Buffer(); - ((duckdb_timestamp*)ab->Data())[0] = rc; -} - -void value_timestampFast(void* p, void* p0, uint32_t p1, uint32_t p2, struct FastApiTypedArray* const p_ret) { - duckdb_result* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - uint32_t v2 = p2; - duckdb_timestamp r = duckdb_value_timestamp(v0, v1, v2); - ((duckdb_timestamp*)p_ret->data)[0] = r; - -} -void value_uint32Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - duckdb_result* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - uint32_t v2 = Local::Cast(args[2])->Value(); - uint32_t rc = duckdb_value_uint32(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -uint32_t value_uint32Fast(void* p, void* p0, uint32_t p1, uint32_t p2) { - duckdb_result* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - uint32_t v2 = p2; - return duckdb_value_uint32(v0, v1, v2); -} -void value_int32Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - duckdb_result* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = duckdb_value_int32(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t value_int32Fast(void* p, void* p0, uint32_t p1, uint32_t p2) { - duckdb_result* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - uint32_t v2 = p2; - return duckdb_value_int32(v0, v1, v2); -} -void value_varcharSlow(const FunctionCallbackInfo &args) { - duckdb_result* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - uint32_t v2 = Local::Cast(args[2])->Value(); - char* rc = duckdb_value_varchar(v0, v1, v2); - Local ab = args[3].As()->Buffer(); - ((char**)ab->Data())[0] = rc; -} - -void value_varcharFast(void* p, void* p0, uint32_t p1, uint32_t p2, struct FastApiTypedArray* const p_ret) { - duckdb_result* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - uint32_t v2 = p2; - char* r = duckdb_value_varchar(v0, v1, v2); - ((char**)p_ret->data)[0] = r; - -} -void closeSlow(const FunctionCallbackInfo &args) { - duckdb_database* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - duckdb_close(v0); -} - -void closeFast(void* p, void* p0) { - duckdb_database* v0 = reinterpret_cast(p0); - duckdb_close(v0); -} -void destroy_resultSlow(const FunctionCallbackInfo &args) { - duckdb_result* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - duckdb_destroy_result(v0); -} - -void destroy_resultFast(void* p, void* p0) { - duckdb_result* v0 = reinterpret_cast(p0); - duckdb_destroy_result(v0); -} -void destroy_prepareSlow(const FunctionCallbackInfo &args) { - duckdb_prepared_statement* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - duckdb_destroy_prepare(v0); -} - -void destroy_prepareFast(void* p, void* p0) { - duckdb_prepared_statement* v0 = reinterpret_cast(p0); - duckdb_destroy_prepare(v0); -} -void execute_preparedSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - duckdb_prepared_statement v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - duckdb_result* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t rc = duckdb_execute_prepared(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t execute_preparedFast(void* p, void* p0, void* p1) { - duckdb_prepared_statement v0 = reinterpret_cast(p0); - duckdb_result* v1 = reinterpret_cast(p1); - return duckdb_execute_prepared(v0, v1); -} -void column_nameSlow(const FunctionCallbackInfo &args) { - duckdb_result* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - const char* rc = duckdb_column_name(v0, v1); - Local ab = args[2].As()->Buffer(); - ((const char**)ab->Data())[0] = rc; -} - -void column_nameFast(void* p, void* p0, uint32_t p1, struct FastApiTypedArray* const p_ret) { - duckdb_result* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - const char* r = duckdb_column_name(v0, v1); - ((const char**)p_ret->data)[0] = r; - -} -void column_typeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - duckdb_result* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = duckdb_column_type(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t column_typeFast(void* p, void* p0, uint32_t p1) { - duckdb_result* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - return duckdb_column_type(v0, v1); -} -void result_errorSlow(const FunctionCallbackInfo &args) { - duckdb_result* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const char* rc = duckdb_result_error(v0); - Local ab = args[1].As()->Buffer(); - ((const char**)ab->Data())[0] = rc; -} - -void result_errorFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - duckdb_result* v0 = reinterpret_cast(p0); - const char* r = duckdb_result_error(v0); - ((const char**)p_ret->data)[0] = r; - -} -void value_is_nullSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - duckdb_result* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - uint32_t v2 = Local::Cast(args[2])->Value(); - uint32_t rc = duckdb_value_is_null(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -uint32_t value_is_nullFast(void* p, void* p0, uint32_t p1, uint32_t p2) { - duckdb_result* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - uint32_t v2 = p2; - return duckdb_value_is_null(v0, v1, v2); -} -void disconnectSlow(const FunctionCallbackInfo &args) { - duckdb_connection* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - duckdb_disconnect(v0); -} - -void disconnectFast(void* p, void* p0) { - duckdb_connection* v0 = reinterpret_cast(p0); - duckdb_disconnect(v0); -} -void library_versionSlow(const FunctionCallbackInfo &args) { - - const char* rc = duckdb_library_version(); - Local ab = args[0].As()->Buffer(); - ((const char**)ab->Data())[0] = rc; -} - -void library_versionFast(void* p, struct FastApiTypedArray* const p_ret) { - - const char* r = duckdb_library_version(); - ((const char**)p_ret->data)[0] = r; - -} - -void Init(Isolate* isolate, Local target) { - Local module = ObjectTemplate::New(isolate); - SET_FAST_METHOD(isolate, module, "create_config", &pFcreate_config, create_configSlow); - SET_FAST_METHOD(isolate, module, "open_ext", &pFopen_ext, open_extSlow); - SET_FAST_METHOD(isolate, module, "set_config", &pFset_config, set_configSlow); - SET_FAST_METHOD(isolate, module, "connect", &pFconnect, connectSlow); - SET_FAST_METHOD(isolate, module, "query", &pFquery, querySlow); - SET_FAST_METHOD(isolate, module, "prepare", &pFprepare, prepareSlow); - SET_FAST_METHOD(isolate, module, "row_count", &pFrow_count, row_countSlow); - SET_FAST_METHOD(isolate, module, "column_count", &pFcolumn_count, column_countSlow); - SET_FAST_METHOD(isolate, module, "value_timestamp", &pFvalue_timestamp, value_timestampSlow); - SET_FAST_METHOD(isolate, module, "value_uint32", &pFvalue_uint32, value_uint32Slow); - SET_FAST_METHOD(isolate, module, "value_int32", &pFvalue_int32, value_int32Slow); - SET_FAST_METHOD(isolate, module, "value_varchar", &pFvalue_varchar, value_varcharSlow); - SET_FAST_METHOD(isolate, module, "close", &pFclose, closeSlow); - SET_FAST_METHOD(isolate, module, "destroy_result", &pFdestroy_result, destroy_resultSlow); - SET_FAST_METHOD(isolate, module, "destroy_prepare", &pFdestroy_prepare, destroy_prepareSlow); - SET_FAST_METHOD(isolate, module, "execute_prepared", &pFexecute_prepared, execute_preparedSlow); - SET_FAST_METHOD(isolate, module, "column_name", &pFcolumn_name, column_nameSlow); - SET_FAST_METHOD(isolate, module, "column_type", &pFcolumn_type, column_typeSlow); - SET_FAST_METHOD(isolate, module, "result_error", &pFresult_error, result_errorSlow); - SET_FAST_METHOD(isolate, module, "value_is_null", &pFvalue_is_null, value_is_nullSlow); - SET_FAST_METHOD(isolate, module, "disconnect", &pFdisconnect, disconnectSlow); - SET_FAST_METHOD(isolate, module, "library_version", &pFlibrary_version, library_versionSlow); - - SET_VALUE(isolate, module, "DuckDBSuccess", Integer::New(isolate, DuckDBSuccess)); - SET_VALUE(isolate, module, "DuckDBError", Integer::New(isolate, DuckDBError)); - - SET_VALUE(isolate, module, "struct_duckdb_config_size", Integer::New(isolate, sizeof(duckdb_config))); - SET_VALUE(isolate, module, "struct_duckdb_result_size", Integer::New(isolate, sizeof(duckdb_result))); - SET_VALUE(isolate, module, "struct_duckdb_connection_size", Integer::New(isolate, sizeof(duckdb_connection))); - SET_VALUE(isolate, module, "struct_duckdb_database_size", Integer::New(isolate, sizeof(duckdb_database))); - SET_VALUE(isolate, module, "struct_duckdb_prepared_statement_size", Integer::New(isolate, sizeof(duckdb_prepared_statement))); - - SET_MODULE(isolate, target, "duckdb", module); -} -} // namespace duckdb -} // namespace lo - -extern "C" { - void* _register_duckdb() { - return (void*)lo::duckdb::Init; - } -} diff --git a/lib/encode/encode.cc b/lib/encode/encode.cc deleted file mode 100644 index c45b43a..0000000 --- a/lib/encode/encode.cc +++ /dev/null @@ -1,440 +0,0 @@ - -// [do not edit,] -// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile - -#include - -namespace lo { -namespace encode { - -using v8::String; -using v8::FunctionCallbackInfo; -using v8::Array; -using v8::Local; -using v8::ObjectTemplate; -using v8::Isolate; -using v8::Value; -using v8::Uint32Array; -using v8::ArrayBuffer; -using v8::Context; -using v8::Integer; -using v8::Function; -using v8::NewStringType; -using v8::Object; -using v8::BackingStore; -using v8::TryCatch; -using v8::ScriptCompiler; -using v8::Module; -using v8::FixedArray; -using v8::ScriptOrigin; -using v8::SharedArrayBuffer; -using v8::MaybeLocal; -using v8::HandleScope; -using v8::Promise; -using v8::Number; -using v8::StackTrace; -using v8::Message; -using v8::StackFrame; -using v8::Maybe; -using v8::FunctionTemplate; -using v8::FunctionCallback; -using v8::PromiseRejectMessage; -using v8::CFunction; -using v8::Global; -using v8::Exception; -using v8::CTypeInfo; -using v8::PropertyAttribute; -using v8::Signature; -using v8::ConstructorBehavior; -using v8::SideEffectType; -using v8::kPromiseRejectAfterResolved; -using v8::kPromiseResolveAfterResolved; -using v8::kPromiseHandlerAddedAfterReject; -using v8::Data; -using v8::PrimitiveArray; -using v8::TypedArray; -using v8::Uint8Array; -using v8::Boolean; -using v8::ModuleRequest; -using v8::CFunctionInfo; -using v8::OOMDetails; -using v8::V8; -using v8::BigInt; - - -const int8_t unbase64_table[256] = - { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -2, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, 62, -1, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, 63, - -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - }; - -const int8_t unhex_table[256] = - { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, - -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - }; - -inline unsigned unhex(uint8_t x) { - return unhex_table[x]; -} - -size_t hex_encode (const char* src, size_t slen, char* dst, size_t dlen) { - dlen = slen * 2; - for (uint32_t i = 0, k = 0; k < dlen; i += 1, k += 2) { - static const char hex[] = "0123456789abcdef"; - uint8_t val = (uint8_t)(src[i]); - dst[k + 0] = hex[val >> 4]; - dst[k + 1] = hex[val & 15]; - } - return dlen; -} - -size_t hex_decode(char* buf, - size_t len, - const char* src, - const size_t srcLen) { - size_t i; - for (i = 0; i < len && i * 2 + 1 < srcLen; ++i) { - unsigned a = unhex(src[i * 2 + 0]); - unsigned b = unhex(src[i * 2 + 1]); - if (!~a || !~b) - return i; - buf[i] = (a << 4) | b; - } - - return i; -} - -inline int8_t unbase64(uint8_t x) { - return unbase64_table[x]; -} - -inline constexpr size_t base64_encoded_size(size_t size) { - return ((size + 2 - ((size + 2) % 3)) / 3 * 4); -} - -// Doesn't check for padding at the end. Can be 1-2 bytes over. -inline size_t base64_decoded_size_fast(size_t size) { - size_t remainder = size % 4; - - size = (size / 4) * 3; - if (remainder) { - if (size == 0 && remainder == 1) { - // special case: 1-byte input cannot be decoded - size = 0; - } else { - // non-padded input, add 1 or 2 extra bytes - size += 1 + (remainder == 3); - } - } - - return size; -} - -size_t base64_decoded_size(const char* src, size_t size) { - if (size == 0) - return 0; - - if (src[size - 1] == '=') - size--; - if (size > 0 && src[size - 1] == '=') - size--; - - return base64_decoded_size_fast(size); -} - -bool base64_decode_group_slow(char* dst, const size_t dstlen, - const char* src, const size_t srclen, - size_t* const i, size_t* const k) { - uint8_t hi; - uint8_t lo; -#define V(expr) for (;;) { const uint8_t c = src[*i]; lo = unbase64(c); *i += 1; if (lo < 64) break; /* Legal character. */ if (c == '=' || *i >= srclen) return false; /* Stop decoding. */ } expr; if (*i >= srclen) return false; if (*k >= dstlen) return false; hi = lo; - V(/* Nothing. */); - V(dst[(*k)++] = ((hi & 0x3F) << 2) | ((lo & 0x30) >> 4)); - V(dst[(*k)++] = ((hi & 0x0F) << 4) | ((lo & 0x3C) >> 2)); - V(dst[(*k)++] = ((hi & 0x03) << 6) | ((lo & 0x3F) >> 0)); -#undef V - return true; // Continue decoding. -} - -size_t base64_decode_fast(char* dst, const size_t dstlen, - const char* src, const size_t srclen, - const size_t decoded_size) { - const size_t available = dstlen < decoded_size ? dstlen : decoded_size; - const size_t max_k = available / 3 * 3; - size_t max_i = srclen / 4 * 4; - size_t i = 0; - size_t k = 0; - while (i < max_i && k < max_k) { - const uint32_t v = - unbase64(src[i + 0]) << 24 | - unbase64(src[i + 1]) << 16 | - unbase64(src[i + 2]) << 8 | - unbase64(src[i + 3]); - // If MSB is set, input contains whitespace or is not valid base64. - if (v & 0x80808080) { - if (!base64_decode_group_slow(dst, dstlen, src, srclen, &i, &k)) - return k; - max_i = i + (srclen - i) / 4 * 4; // Align max_i again. - } else { - dst[k + 0] = ((v >> 22) & 0xFC) | ((v >> 20) & 0x03); - dst[k + 1] = ((v >> 12) & 0xF0) | ((v >> 10) & 0x0F); - dst[k + 2] = ((v >> 2) & 0xC0) | ((v >> 0) & 0x3F); - i += 4; - k += 3; - } - } - if (i < srclen && k < dstlen) { - base64_decode_group_slow(dst, dstlen, src, srclen, &i, &k); - } - return k; -} - -size_t base64_decode(char* dst, const size_t dstlen, - const char* src, const size_t srclen) { - const size_t decoded_size = base64_decoded_size(src, srclen); - return base64_decode_fast(dst, dstlen, src, srclen, decoded_size); -} - -size_t base64_encode(const char* src, - size_t slen, - char* dst, - size_t dlen) { - // We know how much we'll write, just make sure that there's space. - dlen = base64_encoded_size(slen); - - unsigned a; - unsigned b; - unsigned c; - unsigned i; - unsigned k; - unsigned n; - - static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789+/"; - - i = 0; - k = 0; - n = slen / 3 * 3; - - while (i < n) { - a = src[i + 0] & 0xff; - b = src[i + 1] & 0xff; - c = src[i + 2] & 0xff; - - dst[k + 0] = table[a >> 2]; - dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; - dst[k + 2] = table[((b & 0x0f) << 2) | (c >> 6)]; - dst[k + 3] = table[c & 0x3f]; - - i += 3; - k += 4; - } - - if (n != slen) { - switch (slen - n) { - case 1: - a = src[i + 0] & 0xff; - dst[k + 0] = table[a >> 2]; - dst[k + 1] = table[(a & 3) << 4]; - dst[k + 2] = '='; - dst[k + 3] = '='; - break; - - case 2: - a = src[i + 0] & 0xff; - b = src[i + 1] & 0xff; - dst[k + 0] = table[a >> 2]; - dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; - dst[k + 2] = table[(b & 0x0f) << 2]; - dst[k + 3] = '='; - break; - } - } - - return dlen; -} - - - -uint32_t hex_encodeFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2, uint32_t p3); -v8::CTypeInfo cargshex_encode[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rchex_encode = v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); -v8::CFunctionInfo infohex_encode = v8::CFunctionInfo(rchex_encode, 5, cargshex_encode); -v8::CFunction pFhex_encode = v8::CFunction((const void*)&hex_encodeFast, &infohex_encode); - -uint32_t hex_decodeFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2, uint32_t p3); -v8::CTypeInfo cargshex_decode[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rchex_decode = v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); -v8::CFunctionInfo infohex_decode = v8::CFunctionInfo(rchex_decode, 5, cargshex_decode); -v8::CFunction pFhex_decode = v8::CFunction((const void*)&hex_decodeFast, &infohex_decode); - -uint32_t base64_encodeFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2, uint32_t p3); -v8::CTypeInfo cargsbase64_encode[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcbase64_encode = v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); -v8::CFunctionInfo infobase64_encode = v8::CFunctionInfo(rcbase64_encode, 5, cargsbase64_encode); -v8::CFunction pFbase64_encode = v8::CFunction((const void*)&base64_encodeFast, &infobase64_encode); - -uint32_t base64_decodeFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2, uint32_t p3); -v8::CTypeInfo cargsbase64_decode[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcbase64_decode = v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); -v8::CFunctionInfo infobase64_decode = v8::CFunctionInfo(rcbase64_decode, 5, cargsbase64_decode); -v8::CFunction pFbase64_decode = v8::CFunction((const void*)&base64_decodeFast, &infobase64_decode); - - - -void hex_encodeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - const char* v0 = reinterpret_cast(ptr0); - uint32_t v1 = Local::Cast(args[1])->Value(); - Local u82 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u82->Buffer()->Data() + u82->ByteOffset(); - char* v2 = reinterpret_cast(ptr2); - uint32_t v3 = Local::Cast(args[3])->Value(); - uint32_t rc = hex_encode(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -uint32_t hex_encodeFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2, uint32_t p3) { - const char* v0 = reinterpret_cast(p0->data); - uint32_t v1 = p1; - char* v2 = reinterpret_cast(p2->data); - uint32_t v3 = p3; - return hex_encode(v0, v1, v2, v3); -} -void hex_decodeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - char* v0 = reinterpret_cast(ptr0); - uint32_t v1 = Local::Cast(args[1])->Value(); - Local u82 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u82->Buffer()->Data() + u82->ByteOffset(); - const char* v2 = reinterpret_cast(ptr2); - uint32_t v3 = Local::Cast(args[3])->Value(); - uint32_t rc = hex_decode(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -uint32_t hex_decodeFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2, uint32_t p3) { - char* v0 = reinterpret_cast(p0->data); - uint32_t v1 = p1; - const char* v2 = reinterpret_cast(p2->data); - uint32_t v3 = p3; - return hex_decode(v0, v1, v2, v3); -} -void base64_encodeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - const char* v0 = reinterpret_cast(ptr0); - uint32_t v1 = Local::Cast(args[1])->Value(); - Local u82 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u82->Buffer()->Data() + u82->ByteOffset(); - char* v2 = reinterpret_cast(ptr2); - uint32_t v3 = Local::Cast(args[3])->Value(); - uint32_t rc = base64_encode(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -uint32_t base64_encodeFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2, uint32_t p3) { - const char* v0 = reinterpret_cast(p0->data); - uint32_t v1 = p1; - char* v2 = reinterpret_cast(p2->data); - uint32_t v3 = p3; - return base64_encode(v0, v1, v2, v3); -} -void base64_decodeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - char* v0 = reinterpret_cast(ptr0); - uint32_t v1 = Local::Cast(args[1])->Value(); - Local u82 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u82->Buffer()->Data() + u82->ByteOffset(); - const char* v2 = reinterpret_cast(ptr2); - uint32_t v3 = Local::Cast(args[3])->Value(); - uint32_t rc = base64_decode(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -uint32_t base64_decodeFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2, uint32_t p3) { - char* v0 = reinterpret_cast(p0->data); - uint32_t v1 = p1; - const char* v2 = reinterpret_cast(p2->data); - uint32_t v3 = p3; - return base64_decode(v0, v1, v2, v3); -} - -void Init(Isolate* isolate, Local target) { - Local module = ObjectTemplate::New(isolate); - SET_FAST_METHOD(isolate, module, "hex_encode", &pFhex_encode, hex_encodeSlow); - SET_FAST_METHOD(isolate, module, "hex_decode", &pFhex_decode, hex_decodeSlow); - SET_FAST_METHOD(isolate, module, "base64_encode", &pFbase64_encode, base64_encodeSlow); - SET_FAST_METHOD(isolate, module, "base64_decode", &pFbase64_decode, base64_decodeSlow); - - - - SET_MODULE(isolate, target, "encode", module); -} -} // namespace encode -} // namespace lo - -extern "C" { - void* _register_encode() { - return (void*)lo::encode::Init; - } -} diff --git a/lib/epoll/api.js b/lib/epoll/api.js index 526c72a..476fa83 100644 --- a/lib/epoll/api.js +++ b/lib/epoll/api.js @@ -23,7 +23,24 @@ const api = { } } +const constants = { + EPOLLIN: 'i32', + EPOLLOUT: 'i32', + EPOLLERR: 'i32', + EPOLLHUP: 'i32', + EPOLL_CLOEXEC: 'i32', + EPOLLEXCLUSIVE: 'i32', + EPOLLWAKEUP: 'i32', + EPOLLONESHOT: 'i32', + EPOLLET: 'i32', + EPOLL_CTL_ADD: 'i32', + EPOLL_CTL_DEL: 'i32', + EPOLL_CTL_MOD: 'i32', + EVENT_SIZE: 12, + EAGAIN: 'i32', +} + const includes = ['sys/epoll.h', 'unistd.h'] const name = 'epoll' -export { api, includes, name } +export { api, includes, name, constants } diff --git a/lib/epoll/epoll.cc b/lib/epoll/epoll.cc deleted file mode 100644 index 15a1772..0000000 --- a/lib/epoll/epoll.cc +++ /dev/null @@ -1,190 +0,0 @@ - -// [do not edit,] -// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile -#include -#include -#include - -namespace lo { -namespace epoll { - -using v8::String; -using v8::FunctionCallbackInfo; -using v8::Array; -using v8::Local; -using v8::ObjectTemplate; -using v8::Isolate; -using v8::Value; -using v8::Uint32Array; -using v8::ArrayBuffer; -using v8::Context; -using v8::Integer; -using v8::Function; -using v8::NewStringType; -using v8::Object; -using v8::BackingStore; -using v8::TryCatch; -using v8::ScriptCompiler; -using v8::Module; -using v8::FixedArray; -using v8::ScriptOrigin; -using v8::SharedArrayBuffer; -using v8::MaybeLocal; -using v8::HandleScope; -using v8::Promise; -using v8::Number; -using v8::StackTrace; -using v8::Message; -using v8::StackFrame; -using v8::Maybe; -using v8::FunctionTemplate; -using v8::FunctionCallback; -using v8::PromiseRejectMessage; -using v8::CFunction; -using v8::Global; -using v8::Exception; -using v8::CTypeInfo; -using v8::PropertyAttribute; -using v8::Signature; -using v8::ConstructorBehavior; -using v8::SideEffectType; -using v8::kPromiseRejectAfterResolved; -using v8::kPromiseResolveAfterResolved; -using v8::kPromiseHandlerAddedAfterReject; -using v8::Data; -using v8::PrimitiveArray; -using v8::TypedArray; -using v8::Uint8Array; -using v8::Boolean; -using v8::ModuleRequest; -using v8::CFunctionInfo; -using v8::OOMDetails; -using v8::V8; -using v8::BigInt; - - - -int32_t createFast(void* p, int32_t p0); -v8::CTypeInfo cargscreate[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rccreate = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infocreate = v8::CFunctionInfo(rccreate, 2, cargscreate); -v8::CFunction pFcreate = v8::CFunction((const void*)&createFast, &infocreate); - -int32_t modifyFast(void* p, int32_t p0, int32_t p1, int32_t p2, struct FastApiTypedArray* const p3); -v8::CTypeInfo cargsmodify[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcmodify = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infomodify = v8::CFunctionInfo(rcmodify, 5, cargsmodify); -v8::CFunction pFmodify = v8::CFunction((const void*)&modifyFast, &infomodify); - -int32_t waitFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2, int32_t p3); -v8::CTypeInfo cargswait[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcwait = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infowait = v8::CFunctionInfo(rcwait, 5, cargswait); -v8::CFunction pFwait = v8::CFunction((const void*)&waitFast, &infowait); - -int32_t closeFast(void* p, int32_t p0); -v8::CTypeInfo cargsclose[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcclose = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoclose = v8::CFunctionInfo(rcclose, 2, cargsclose); -v8::CFunction pFclose = v8::CFunction((const void*)&closeFast, &infoclose); - - - -void createSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t rc = epoll_create1(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t createFast(void* p, int32_t p0) { - int32_t v0 = p0; - return epoll_create1(v0); -} -void modifySlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t v2 = Local::Cast(args[2])->Value(); - Local u83 = args[3].As(); - uint8_t* ptr3 = (uint8_t*)u83->Buffer()->Data() + u83->ByteOffset(); - struct epoll_event * v3 = reinterpret_cast(ptr3); - int32_t rc = epoll_ctl(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t modifyFast(void* p, int32_t p0, int32_t p1, int32_t p2, struct FastApiTypedArray* const p3) { - int32_t v0 = p0; - int32_t v1 = p1; - int32_t v2 = p2; - struct epoll_event * v3 = reinterpret_cast(p3->data); - return epoll_ctl(v0, v1, v2, v3); -} -void waitSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - struct epoll_event * v1 = reinterpret_cast(ptr1); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t v3 = Local::Cast(args[3])->Value(); - int32_t rc = epoll_wait(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t waitFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2, int32_t p3) { - int32_t v0 = p0; - struct epoll_event * v1 = reinterpret_cast(p1->data); - int32_t v2 = p2; - int32_t v3 = p3; - return epoll_wait(v0, v1, v2, v3); -} -void closeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t rc = close(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t closeFast(void* p, int32_t p0) { - int32_t v0 = p0; - return close(v0); -} - -void Init(Isolate* isolate, Local target) { - Local module = ObjectTemplate::New(isolate); - SET_FAST_METHOD(isolate, module, "create", &pFcreate, createSlow); - SET_FAST_METHOD(isolate, module, "modify", &pFmodify, modifySlow); - SET_FAST_METHOD(isolate, module, "wait", &pFwait, waitSlow); - SET_FAST_METHOD(isolate, module, "close", &pFclose, closeSlow); - - - - SET_MODULE(isolate, target, "epoll", module); -} -} // namespace epoll -} // namespace lo - -extern "C" { - void* _register_epoll() { - return (void*)lo::epoll::Init; - } -} diff --git a/lib/gen.js b/lib/gen.js index 5deb94d..95d4e47 100644 --- a/lib/gen.js +++ b/lib/gen.js @@ -140,14 +140,20 @@ function bindings ({ api, includes = [], name, preamble, constants, structs = [] if (!constants) return '' if (!constants.hasOwnProperty(n)) return '' const type = constants[n] - if (type ==='i32' || type === 'u32') { - return ` SET_VALUE(isolate, module, "${n}", Integer::New(isolate, ${n}));\n` + if (type === 'u32') { + return ` SET_VALUE(isolate, module, "${n}", Integer::New(isolate, (uint32_t)${n}));\n` } - if (type ==='u64' || type === 'i64') { - return ` SET_VALUE(isolate, module, "${n}", BigInt::New(isolate, ${n}));\n` + if (type ==='i32') { + return ` SET_VALUE(isolate, module, "${n}", Integer::New(isolate, (int32_t)${n}));\n` + } + if (type ==='u64') { + return ` SET_VALUE(isolate, module, "${n}", BigInt::New(isolate, (uint64_t)${n}));\n` + } + if (type ==='i64') { + return ` SET_VALUE(isolate, module, "${n}", BigInt::New(isolate, (int64_t)${type}));\n` } if (isNumeric(type)) { - return ` SET_VALUE(isolate, module, "${n}", Integer::New(isolate, ${type}));\n` + return ` SET_VALUE(isolate, module, "${n}", Number::New(isolate, (int64_t)${type}));\n` } throw new Error('TODO') } diff --git a/lib/kevents/api.js b/lib/kevents/api.js new file mode 100644 index 0000000..b79b8dd --- /dev/null +++ b/lib/kevents/api.js @@ -0,0 +1,50 @@ +const api = { + kqueue: { + parameters: [], + result: 'i32' + }, + kevent: { + parameters: ['i32', 'pointer', 'i32', 'pointer', 'i32', 'pointer'], + pointers: [, 'const struct kevent *', , 'struct kevent *', , 'const struct timespec *'], + result: 'i32' + }, + kevent64: { + parameters: ['i32', 'pointer', 'i32', 'pointer', 'i32', 'u32', 'pointer'], + pointers: [, 'const struct kevent64_s *', , 'struct kevent64_s *', , , 'const struct timespec *'], + result: 'i32' + } +} + +const name = 'kevents' + +const constants = { + EVFILT_READ: 'i32', + EVFILT_EXCEPT: 'i32', + EVFILT_WRITE: 'i32', + EVFILT_VNODE: 'i32', + EVFILT_PROC: 'i32', + EVFILT_SIGNAL: 'i32', + EVFILT_MACHPORT: 'i32', + EVFILT_TIMER: 'i32', + EV_ADD: 'i32', + EV_ENABLE: 'i32', + EV_DISABLE: 'i32', + EV_DELETE: 'i32', + EV_RECEIPT: 'i32', + EV_ONESHOT: 'i32', + EV_CLEAR: 'i32', + EV_EOF: 'i32', + EV_OOBAND: 'i32', + EV_ERROR: 'i32', + KEVENT_FLAG_IMMEDIATE: 'i32' +} + +const includes = [ + 'sys/event.h', 'sys/types.h', 'sys/time.h' +] + +const structs = [ + 'kevent64_s', 'time_t', 'timespec' +] + +export { name, api, constants, includes, structs } diff --git a/lib/libffi/api.js b/lib/libffi/api.js index 62b47f9..6345111 100644 --- a/lib/libffi/api.js +++ b/lib/libffi/api.js @@ -433,8 +433,9 @@ const include_paths = [] const lib_paths = [] if (globalThis.lo && lo.core.os === 'mac') { - include_paths.push('/usr/local/opt/libffi/include') - lib_paths.push('/usr/local/opt/libffi/lib') + const PREFIX = lo.getenv('LO_PREFIX') || '/opt/homebrew/opt' + include_paths.push(`${PREFIX}/libffi/include`) + lib_paths.push(`${PREFIX}/libffi/lib`) } export { api, includes, name, preamble, libs, obj, include_paths } diff --git a/lib/libffi/libffi.cc b/lib/libffi/libffi.cc deleted file mode 100644 index 86f16f1..0000000 --- a/lib/libffi/libffi.cc +++ /dev/null @@ -1,559 +0,0 @@ - -// [do not edit,] -// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile -#include -#include - -namespace lo { -namespace libffi { - -using v8::String; -using v8::FunctionCallbackInfo; -using v8::Array; -using v8::Local; -using v8::ObjectTemplate; -using v8::Isolate; -using v8::Value; -using v8::Uint32Array; -using v8::ArrayBuffer; -using v8::Context; -using v8::Integer; -using v8::Function; -using v8::NewStringType; -using v8::Object; -using v8::BackingStore; -using v8::TryCatch; -using v8::ScriptCompiler; -using v8::Module; -using v8::FixedArray; -using v8::ScriptOrigin; -using v8::SharedArrayBuffer; -using v8::MaybeLocal; -using v8::HandleScope; -using v8::Promise; -using v8::Number; -using v8::StackTrace; -using v8::Message; -using v8::StackFrame; -using v8::Maybe; -using v8::FunctionTemplate; -using v8::FunctionCallback; -using v8::PromiseRejectMessage; -using v8::CFunction; -using v8::Global; -using v8::Exception; -using v8::CTypeInfo; -using v8::PropertyAttribute; -using v8::Signature; -using v8::ConstructorBehavior; -using v8::SideEffectType; -using v8::kPromiseRejectAfterResolved; -using v8::kPromiseResolveAfterResolved; -using v8::kPromiseHandlerAddedAfterReject; -using v8::Data; -using v8::PrimitiveArray; -using v8::TypedArray; -using v8::Uint8Array; -using v8::Boolean; -using v8::ModuleRequest; -using v8::CFunctionInfo; -using v8::OOMDetails; -using v8::V8; -using v8::BigInt; - - -typedef void (*callback)(); - -struct foreignFunction { - void* fast; - void* ffi; - void** values; - void* start; - v8::CFunction* cfunc; - ffi_cif* cif; - FastTypes rc; - FastTypes* params; - int nargs; -}; - -inline uint8_t needsunwrap (lo::FastTypes t) { - if (t == lo::FastTypes::buffer) return 1; - if (t == lo::FastTypes::u32array) return 1; - if (t == lo::FastTypes::pointer) return 1; - if (t == lo::FastTypes::u64) return 1; - if (t == lo::FastTypes::i64) return 1; - return 0; -} - -v8::CTypeInfo* CTypeFromV8 (uint8_t v8Type) { - if (v8Type == lo::FastTypes::boolean) - return new v8::CTypeInfo(v8::CTypeInfo::Type::kBool); - if (v8Type == lo::FastTypes::i8) - return new v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); - if (v8Type == lo::FastTypes::i16) - return new v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); - if (v8Type == lo::FastTypes::i32) - return new v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); - if (v8Type == lo::FastTypes::u8) - return new v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); - if (v8Type == lo::FastTypes::u16) - return new v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); - if (v8Type == lo::FastTypes::u32) - return new v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); - if (v8Type == lo::FastTypes::f32) - return new v8::CTypeInfo(v8::CTypeInfo::Type::kFloat32); - if (v8Type == lo::FastTypes::f64) - return new v8::CTypeInfo(v8::CTypeInfo::Type::kFloat64); - if (v8Type == lo::FastTypes::i64) - return new v8::CTypeInfo(v8::CTypeInfo::Type::kInt64); - if (v8Type == lo::FastTypes::u64) - return new v8::CTypeInfo(v8::CTypeInfo::Type::kUint64); - if (v8Type == lo::FastTypes::iSize) - return new v8::CTypeInfo(v8::CTypeInfo::Type::kInt64); - if (v8Type == lo::FastTypes::uSize) - return new v8::CTypeInfo(v8::CTypeInfo::Type::kUint64); - if (v8Type == lo::FastTypes::pointer) - return new v8::CTypeInfo(v8::CTypeInfo::Type::kUint64); - if (v8Type == lo::FastTypes::function) - return new v8::CTypeInfo(v8::CTypeInfo::Type::kUint64); - if (v8Type == lo::FastTypes::string) - return new v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString); - if (v8Type == lo::FastTypes::buffer) { - return new v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, - v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone); - } - if (v8Type == lo::FastTypes::u32array) { - return new v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, - v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone); - } - return new v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -} - -ffi_type* FFITypeFromV8 (uint8_t v8Type) { - if (v8Type == lo::FastTypes::boolean) - return &ffi_type_uint8; - if (v8Type == lo::FastTypes::i8) - return &ffi_type_sint8; - if (v8Type == lo::FastTypes::i16) - return &ffi_type_sint16; - if (v8Type == lo::FastTypes::i32) - return &ffi_type_sint32; - if (v8Type == lo::FastTypes::u8) - return &ffi_type_uint8; - if (v8Type == lo::FastTypes::u16) - return &ffi_type_uint16; - if (v8Type == lo::FastTypes::u32) - return &ffi_type_uint32; - if (v8Type == lo::FastTypes::f32) - return &ffi_type_float; - if (v8Type == lo::FastTypes::f64) - return &ffi_type_double; - if (v8Type == lo::FastTypes::i64) - return &ffi_type_sint64; - if (v8Type == lo::FastTypes::u64) - return &ffi_type_uint64; - if (v8Type == lo::FastTypes::iSize) - return &ffi_type_sint64; - if (v8Type == lo::FastTypes::uSize) - return &ffi_type_uint64; - if (v8Type == lo::FastTypes::pointer) - return &ffi_type_pointer; - if (v8Type == lo::FastTypes::function) - return &ffi_type_pointer; - if (v8Type == lo::FastTypes::string) - return &ffi_type_pointer; - if (v8Type == lo::FastTypes::buffer) - return &ffi_type_pointer; - if (v8Type == lo::FastTypes::u32array) - return &ffi_type_pointer; - return &ffi_type_void; -} - -// 10 ns if this fn does nothing -// 46 ns for int fn (int) -// 4ns for looping through and allocating args -// 4ns return -// 30 ns for the ffi call - -void SlowCallback(const FunctionCallbackInfo &args) { - Isolate* isolate = args.GetIsolate(); - foreignFunction* ffn = (foreignFunction*)args.Data() - .As()->GetAlignedPointerFromInternalField(1); - ffi_cif* cif = ffn->cif; - ffi_arg result; - uint8_t* start = (uint8_t*)ffn->start; - for (int i = 0; i < ffn->nargs; i++) { - if (ffn->params[i] == lo::FastTypes::i32) { - *(int32_t*)start = (int32_t)Local::Cast(args[i])->Value(); - start += 4; - continue; - } - if (ffn->params[i] == lo::FastTypes::u32) { - *(uint32_t*)start = (uint32_t)Local::Cast(args[i])->Value(); - start += 4; - continue; - } - if (ffn->params[i] == lo::FastTypes::u16) { - *(uint16_t*)start = (uint16_t)Local::Cast(args[i])->Value(); - start += 2; - continue; - } - if (ffn->params[i] == lo::FastTypes::u8) { - *(uint8_t*)start = (uint8_t)Local::Cast(args[i])->Value(); - start += 1; - continue; - } - if (ffn->params[i] == lo::FastTypes::u64) { - *(uint64_t*)start = (uint64_t)Local::Cast(args[i])->Value(); - start += 8; - continue; - } - if (ffn->params[i] == lo::FastTypes::pointer) { - *(uint64_t*)start = (uint64_t)Local::Cast(args[i])->Value(); - start += 8; - continue; - } - if (ffn->params[i] == lo::FastTypes::buffer) { - Local u8 = args[i].As(); - uint8_t* ptr = (uint8_t*)u8->Buffer()->Data() + u8->ByteOffset(); - *(uint64_t*)start = (uint64_t)ptr; - start += 8; - continue; - } - if (ffn->params[i] == lo::FastTypes::u32array) { - Local u32 = args[i].As(); - uint8_t* ptr = (uint8_t*)u32->Buffer()->Data() + u32->ByteOffset(); - *(uint64_t*)start = (uint64_t)ptr; - start += 8; - continue; - } - if (ffn->params[i] == lo::FastTypes::string) { - String::Utf8Value arg0(isolate, args[i]); - *(uint64_t*)start = (uint64_t)strdup(*arg0); - start += 8; - continue; - } - } - ffi_call(cif, FFI_FN(ffn->ffi), &result, ffn->values); - if (args.Length() > ffn->nargs) { - uint64_t* res = (uint64_t*)args[ffn->nargs].As()->Buffer()->Data(); - *res = (uint64_t)result; - return; - } - if (ffn->rc == lo::FastTypes::i32) { - args.GetReturnValue().Set(Integer::New(isolate, (int32_t)result)); - return; - } - if (ffn->rc == lo::FastTypes::u32) { - args.GetReturnValue().Set(Integer::New(isolate, (uint32_t)result)); - return; - } -} - -void bindSlowApiSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local context = isolate->GetCurrentContext(); - void* fn = reinterpret_cast(Local::Cast(args[0])->Value()); - void* wrapped = reinterpret_cast(Local::Cast(args[1])->Value()); - int rtype = Local::Cast(args[2])->Value(); - Local params = args[3].As(); - Local tpl = ObjectTemplate::New(isolate); - tpl->SetInternalFieldCount(2); - Local data = tpl->NewInstance(context).ToLocalChecked(); - ffi_cif* cif = (ffi_cif*)calloc(1, sizeof(ffi_cif)); - foreignFunction* ffn = new foreignFunction(); - ffn->fast = wrapped; - ffn->ffi = fn; - ffn->cif = cif; - data->SetAlignedPointerInInternalField(1, ffn); - int len = params->Length(); - ffi_type* ffirc = FFITypeFromV8(rtype); - ffn->rc = (FastTypes)rtype; - ffi_type** ffiargs = (ffi_type**)calloc(len, sizeof(ffi_type*)); - ffn->params = (FastTypes*)calloc(len, sizeof(FastTypes)); - ffn->nargs = len; - ffn->values = (void**)calloc(ffn->nargs, sizeof(void*)); - int fastlen = len + 1 + needsunwrap((FastTypes)rtype); - CTypeInfo* cargs = (CTypeInfo*)calloc(fastlen, sizeof(CTypeInfo)); - cargs[0] = CTypeInfo(CTypeInfo::Type::kV8Value); - int size = 0; - for (int i = 0; i < len; i++) { - uint8_t ptype = Local::Cast( - params->Get(context, i).ToLocalChecked())->Value(); - cargs[i + 1] = *CTypeFromV8(ptype); - ffiargs[i] = FFITypeFromV8(ptype); - ffn->params[i] = (FastTypes)ptype; - if (ffn->params[i] == lo::FastTypes::u8) { - size += 1; - continue; - } - if (ffn->params[i] == lo::FastTypes::u16) { - size += 2; - continue; - } - if (ffn->params[i] == lo::FastTypes::i32) { - size += 4; - continue; - } - if (ffn->params[i] == lo::FastTypes::u32) { - size += 4; - continue; - } - size += 8; - } - ffn->start = calloc(1, size); - uint8_t* start = (uint8_t*)ffn->start; - for (int i = 0; i < ffn->nargs; i++) { - if (ffn->params[i] == lo::FastTypes::u8) { - ffn->values[i] = start; - start += 1; - continue; - } - if (ffn->params[i] == lo::FastTypes::u16) { - ffn->values[i] = start; - start += 2; - continue; - } - if (ffn->params[i] == lo::FastTypes::i32) { - ffn->values[i] = start; - start += 4; - continue; - } - if (ffn->params[i] == lo::FastTypes::u32) { - ffn->values[i] = start; - start += 4; - continue; - } - ffn->values[i] = start; - start += 8; - } - if (fastlen - 1 > len) { - cargs[fastlen - 1] = *CTypeFromV8(FastTypes::u32array); - } - ffi_status status = ffi_prep_cif(cif, FFI_DEFAULT_ABI, len, ffirc, ffiargs); - if (status != FFI_OK) { - // TODO: fix this api - return; - } - Local funcTemplate = FunctionTemplate::New( - isolate, - SlowCallback, - data, - Local(), - 0, - ConstructorBehavior::kThrow, - SideEffectType::kHasNoSideEffect, - NULL - ); - Local fun = - funcTemplate->GetFunction(context).ToLocalChecked(); - args.GetReturnValue().Set(fun); -} - -void bindFastApiSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local context = isolate->GetCurrentContext(); - void* fn = reinterpret_cast(Local::Cast(args[0])->Value()); - void* wrapped = reinterpret_cast(Local::Cast(args[1])->Value()); - int rtype = Local::Cast(args[2])->Value(); - Local params = args[3].As(); - - Local tpl = ObjectTemplate::New(isolate); - tpl->SetInternalFieldCount(2); - Local data = tpl->NewInstance(context).ToLocalChecked(); - ffi_cif* cif = (ffi_cif*)calloc(1, sizeof(ffi_cif)); - foreignFunction* ffn = new foreignFunction(); - ffn->fast = wrapped; - ffn->ffi = fn; - ffn->cif = cif; - data->SetAlignedPointerInInternalField(1, ffn); - int len = params->Length(); - ffi_type* ffirc = FFITypeFromV8(rtype); - CTypeInfo* rc; - if (needsunwrap((FastTypes)rtype)) { - rc = CTypeFromV8(FastTypes::empty); - } else { - rc = CTypeFromV8((FastTypes)rtype); - } - ffn->rc = (FastTypes)rtype; - ffi_type** ffiargs = (ffi_type**)calloc(len, sizeof(ffi_type*)); - ffn->params = (FastTypes*)calloc(len, sizeof(FastTypes)); - ffn->nargs = len; - ffn->values = (void**)calloc(ffn->nargs, sizeof(void*)); - int fastlen = len + 1 + needsunwrap((FastTypes)rtype); - CTypeInfo* cargs = (CTypeInfo*)calloc(fastlen, sizeof(CTypeInfo)); - cargs[0] = CTypeInfo(CTypeInfo::Type::kV8Value); - int size = 0; - for (int i = 0; i < len; i++) { - uint8_t ptype = Local::Cast( - params->Get(context, i).ToLocalChecked())->Value(); - cargs[i + 1] = *CTypeFromV8(ptype); - ffiargs[i] = FFITypeFromV8(ptype); - ffn->params[i] = (FastTypes)ptype; - if (ffn->params[i] == lo::FastTypes::u8) { - size += 1; - continue; - } - if (ffn->params[i] == lo::FastTypes::u16) { - size += 2; - continue; - } - if (ffn->params[i] == lo::FastTypes::i32) { - size += 4; - continue; - } - if (ffn->params[i] == lo::FastTypes::u32) { - size += 4; - continue; - } - size += 8; - } - ffn->start = calloc(1, size); - uint8_t* start = (uint8_t*)ffn->start; - for (int i = 0; i < ffn->nargs; i++) { - if (ffn->params[i] == lo::FastTypes::u8) { - ffn->values[i] = start; - start += 1; - continue; - } - if (ffn->params[i] == lo::FastTypes::u16) { - ffn->values[i] = start; - start += 2; - continue; - } - if (ffn->params[i] == lo::FastTypes::i32) { - ffn->values[i] = start; - start += 4; - continue; - } - if (ffn->params[i] == lo::FastTypes::u32) { - ffn->values[i] = start; - start += 4; - continue; - } - ffn->values[i] = start; - start += 8; - } - if (fastlen - 1 > len) { - cargs[fastlen - 1] = *CTypeFromV8(FastTypes::u32array); - } - ffi_status status = ffi_prep_cif(cif, FFI_DEFAULT_ABI, len, ffirc, ffiargs); - if (status != FFI_OK) { - // TODO: fix this api - return; - } - CFunctionInfo* info = new CFunctionInfo(*rc, fastlen, cargs); - CFunction* fastCFunc = new CFunction(wrapped, info); - ffn->cfunc = fastCFunc; - Local funcTemplate = FunctionTemplate::New( - isolate, - SlowCallback, - data, - Local(), - 0, - ConstructorBehavior::kThrow, - SideEffectType::kHasNoSideEffect, - fastCFunc - ); - // TODO: figure out how to handle side-effect flag: - // https://github.com/nodejs/node/pull/46619 - Local fun = - funcTemplate->GetFunction(context).ToLocalChecked(); - args.GetReturnValue().Set(fun); -} - - - -int32_t ffi_prep_cifFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, uint32_t p2, struct FastApiTypedArray* const p3, struct FastApiTypedArray* const p4); -v8::CTypeInfo cargsffi_prep_cif[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcffi_prep_cif = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoffi_prep_cif = v8::CFunctionInfo(rcffi_prep_cif, 6, cargsffi_prep_cif); -v8::CFunction pFffi_prep_cif = v8::CFunction((const void*)&ffi_prep_cifFast, &infoffi_prep_cif); - -void ffi_callFast(void* p, struct FastApiTypedArray* const p0, void* p1, struct FastApiTypedArray* const p2, struct FastApiTypedArray* const p3); -v8::CTypeInfo cargsffi_call[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcffi_call = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoffi_call = v8::CFunctionInfo(rcffi_call, 5, cargsffi_call); -v8::CFunction pFffi_call = v8::CFunction((const void*)&ffi_callFast, &infoffi_call); - - - -void ffi_prep_cifSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - ffi_cif* v0 = reinterpret_cast(ptr0); - uint32_t v1 = Local::Cast(args[1])->Value(); - uint32_t v2 = Local::Cast(args[2])->Value(); - Local u83 = args[3].As(); - uint8_t* ptr3 = (uint8_t*)u83->Buffer()->Data() + u83->ByteOffset(); - ffi_type* v3 = reinterpret_cast(ptr3); - Local u84 = args[4].As(); - uint8_t* ptr4 = (uint8_t*)u84->Buffer()->Data() + u84->ByteOffset(); - ffi_type** v4 = reinterpret_cast(ptr4); - int32_t rc = ffi_prep_cif(v0, (ffi_abi)v1, v2, v3, v4); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t ffi_prep_cifFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, uint32_t p2, struct FastApiTypedArray* const p3, struct FastApiTypedArray* const p4) { - ffi_cif* v0 = reinterpret_cast(p0->data); - uint32_t v1 = p1; - uint32_t v2 = p2; - ffi_type* v3 = reinterpret_cast(p3->data); - ffi_type** v4 = reinterpret_cast(p4->data); - return ffi_prep_cif(v0, (ffi_abi)v1, v2, v3, v4); -} -void ffi_callSlow(const FunctionCallbackInfo &args) { - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - ffi_cif* v0 = reinterpret_cast(ptr0); - callback v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - Local u322 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u322->Buffer()->Data() + u322->ByteOffset(); - void* v2 = reinterpret_cast(ptr2); - Local u83 = args[3].As(); - uint8_t* ptr3 = (uint8_t*)u83->Buffer()->Data() + u83->ByteOffset(); - void** v3 = reinterpret_cast(ptr3); - ffi_call(v0, v1, v2, v3); -} - -void ffi_callFast(void* p, struct FastApiTypedArray* const p0, void* p1, struct FastApiTypedArray* const p2, struct FastApiTypedArray* const p3) { - ffi_cif* v0 = reinterpret_cast(p0->data); - callback v1 = reinterpret_cast(p1); - void* v2 = reinterpret_cast(p2->data); - void** v3 = reinterpret_cast(p3->data); - ffi_call(v0, v1, v2, v3); -} - -void Init(Isolate* isolate, Local target) { - Local module = ObjectTemplate::New(isolate); - SET_FAST_METHOD(isolate, module, "ffi_prep_cif", &pFffi_prep_cif, ffi_prep_cifSlow); - SET_FAST_METHOD(isolate, module, "ffi_call", &pFffi_call, ffi_callSlow); - SET_METHOD(isolate, module, "bindFastApi", bindFastApiSlow); - SET_METHOD(isolate, module, "bindSlowApi", bindSlowApiSlow); - - - - SET_MODULE(isolate, target, "libffi", module); -} -} // namespace libffi -} // namespace lo - -extern "C" { - void* _register_libffi() { - return (void*)lo::libffi::Init; - } -} diff --git a/lib/libssl/api.js b/lib/libssl/api.js index 94081cc..27e72a5 100644 --- a/lib/libssl/api.js +++ b/lib/libssl/api.js @@ -564,12 +564,13 @@ const include_paths = [] const lib_paths = [] if (globalThis.lo) { + const PREFIX = lo.getenv('LO_PREFIX') || '/opt/homebrew/opt' if (lo.core.os === 'mac') { - include_paths.push('/opt/homebrew/opt/openssl@3.0/include') - lib_paths.push('/opt/homebrew/opt/openssl@3.0/lib') + include_paths.push(`${PREFIX}/openssl@3.0/include`) + lib_paths.push(`${PREFIX}/openssl@3.0/lib`) // add these if we want to statically link libssl into the shared library - obj.push('/opt/homebrew/opt/openssl@3.0/lib/libssl.a') - obj.push('/opt/homebrew/opt/openssl@3.0/lib/libcrypto.a') + obj.push(`${PREFIX}/openssl@3.0/lib/libssl.a`) + obj.push(`${PREFIX}/openssl@3.0/lib/libcrypto.a`) } else if (lo.core.os === 'linux') { libs.push('ssl') libs.push('crypto') diff --git a/lib/libssl/libssl.cc b/lib/libssl/libssl.cc deleted file mode 100644 index 25f42dc..0000000 --- a/lib/libssl/libssl.cc +++ /dev/null @@ -1,2576 +0,0 @@ - -// [do not edit,] -// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace lo { -namespace libssl { - -using v8::String; -using v8::FunctionCallbackInfo; -using v8::Array; -using v8::Local; -using v8::ObjectTemplate; -using v8::Isolate; -using v8::Value; -using v8::Uint32Array; -using v8::ArrayBuffer; -using v8::Context; -using v8::Integer; -using v8::Function; -using v8::NewStringType; -using v8::Object; -using v8::BackingStore; -using v8::TryCatch; -using v8::ScriptCompiler; -using v8::Module; -using v8::FixedArray; -using v8::ScriptOrigin; -using v8::SharedArrayBuffer; -using v8::MaybeLocal; -using v8::HandleScope; -using v8::Promise; -using v8::Number; -using v8::StackTrace; -using v8::Message; -using v8::StackFrame; -using v8::Maybe; -using v8::FunctionTemplate; -using v8::FunctionCallback; -using v8::PromiseRejectMessage; -using v8::CFunction; -using v8::Global; -using v8::Exception; -using v8::CTypeInfo; -using v8::PropertyAttribute; -using v8::Signature; -using v8::ConstructorBehavior; -using v8::SideEffectType; -using v8::kPromiseRejectAfterResolved; -using v8::kPromiseResolveAfterResolved; -using v8::kPromiseHandlerAddedAfterReject; -using v8::Data; -using v8::PrimitiveArray; -using v8::TypedArray; -using v8::Uint8Array; -using v8::Boolean; -using v8::ModuleRequest; -using v8::CFunctionInfo; -using v8::OOMDetails; -using v8::V8; -using v8::BigInt; - - - -void OpenSSL_versionFast(void* p, int32_t p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsOpenSSL_version[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcOpenSSL_version = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoOpenSSL_version = v8::CFunctionInfo(rcOpenSSL_version, 3, cargsOpenSSL_version); -v8::CFunction pFOpenSSL_version = v8::CFunction((const void*)&OpenSSL_versionFast, &infoOpenSSL_version); - -void EVP_PKEY_CTX_new_idFast(void* p, int32_t p0, void* p1, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsEVP_PKEY_CTX_new_id[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcEVP_PKEY_CTX_new_id = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoEVP_PKEY_CTX_new_id = v8::CFunctionInfo(rcEVP_PKEY_CTX_new_id, 4, cargsEVP_PKEY_CTX_new_id); -v8::CFunction pFEVP_PKEY_CTX_new_id = v8::CFunction((const void*)&EVP_PKEY_CTX_new_idFast, &infoEVP_PKEY_CTX_new_id); - -int32_t EVP_PKEY_keygen_initFast(void* p, void* p0); -v8::CTypeInfo cargsEVP_PKEY_keygen_init[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcEVP_PKEY_keygen_init = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoEVP_PKEY_keygen_init = v8::CFunctionInfo(rcEVP_PKEY_keygen_init, 2, cargsEVP_PKEY_keygen_init); -v8::CFunction pFEVP_PKEY_keygen_init = v8::CFunction((const void*)&EVP_PKEY_keygen_initFast, &infoEVP_PKEY_keygen_init); - -int32_t EVP_PKEY_keygenFast(void* p, void* p0, void* p1); -v8::CTypeInfo cargsEVP_PKEY_keygen[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcEVP_PKEY_keygen = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoEVP_PKEY_keygen = v8::CFunctionInfo(rcEVP_PKEY_keygen, 3, cargsEVP_PKEY_keygen); -v8::CFunction pFEVP_PKEY_keygen = v8::CFunction((const void*)&EVP_PKEY_keygenFast, &infoEVP_PKEY_keygen); - -void EVP_PKEY_newFast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsEVP_PKEY_new[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcEVP_PKEY_new = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoEVP_PKEY_new = v8::CFunctionInfo(rcEVP_PKEY_new, 2, cargsEVP_PKEY_new); -v8::CFunction pFEVP_PKEY_new = v8::CFunction((const void*)&EVP_PKEY_newFast, &infoEVP_PKEY_new); - -int32_t EVP_PKEY_idFast(void* p, void* p0); -v8::CTypeInfo cargsEVP_PKEY_id[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcEVP_PKEY_id = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoEVP_PKEY_id = v8::CFunctionInfo(rcEVP_PKEY_id, 2, cargsEVP_PKEY_id); -v8::CFunction pFEVP_PKEY_id = v8::CFunction((const void*)&EVP_PKEY_idFast, &infoEVP_PKEY_id); - -int32_t EVP_PKEY_typeFast(void* p, int32_t p0); -v8::CTypeInfo cargsEVP_PKEY_type[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcEVP_PKEY_type = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoEVP_PKEY_type = v8::CFunctionInfo(rcEVP_PKEY_type, 2, cargsEVP_PKEY_type); -v8::CFunction pFEVP_PKEY_type = v8::CFunction((const void*)&EVP_PKEY_typeFast, &infoEVP_PKEY_type); - -void EVP_PKEY_freeFast(void* p, void* p0); -v8::CTypeInfo cargsEVP_PKEY_free[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcEVP_PKEY_free = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoEVP_PKEY_free = v8::CFunctionInfo(rcEVP_PKEY_free, 2, cargsEVP_PKEY_free); -v8::CFunction pFEVP_PKEY_free = v8::CFunction((const void*)&EVP_PKEY_freeFast, &infoEVP_PKEY_free); - -void EVP_PKEY_CTX_freeFast(void* p, void* p0); -v8::CTypeInfo cargsEVP_PKEY_CTX_free[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcEVP_PKEY_CTX_free = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoEVP_PKEY_CTX_free = v8::CFunctionInfo(rcEVP_PKEY_CTX_free, 2, cargsEVP_PKEY_CTX_free); -v8::CFunction pFEVP_PKEY_CTX_free = v8::CFunction((const void*)&EVP_PKEY_CTX_freeFast, &infoEVP_PKEY_CTX_free); - -void EVP_MD_CTX_newFast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsEVP_MD_CTX_new[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcEVP_MD_CTX_new = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoEVP_MD_CTX_new = v8::CFunctionInfo(rcEVP_MD_CTX_new, 2, cargsEVP_MD_CTX_new); -v8::CFunction pFEVP_MD_CTX_new = v8::CFunction((const void*)&EVP_MD_CTX_newFast, &infoEVP_MD_CTX_new); - -int32_t EVP_MD_CTX_resetFast(void* p, void* p0); -v8::CTypeInfo cargsEVP_MD_CTX_reset[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcEVP_MD_CTX_reset = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoEVP_MD_CTX_reset = v8::CFunctionInfo(rcEVP_MD_CTX_reset, 2, cargsEVP_MD_CTX_reset); -v8::CFunction pFEVP_MD_CTX_reset = v8::CFunction((const void*)&EVP_MD_CTX_resetFast, &infoEVP_MD_CTX_reset); - -void EVP_MD_CTX_freeFast(void* p, void* p0); -v8::CTypeInfo cargsEVP_MD_CTX_free[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcEVP_MD_CTX_free = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoEVP_MD_CTX_free = v8::CFunctionInfo(rcEVP_MD_CTX_free, 2, cargsEVP_MD_CTX_free); -v8::CFunction pFEVP_MD_CTX_free = v8::CFunction((const void*)&EVP_MD_CTX_freeFast, &infoEVP_MD_CTX_free); - -void EVP_get_digestbynidFast(void* p, int32_t p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsEVP_get_digestbynid[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcEVP_get_digestbynid = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoEVP_get_digestbynid = v8::CFunctionInfo(rcEVP_get_digestbynid, 3, cargsEVP_get_digestbynid); -v8::CFunction pFEVP_get_digestbynid = v8::CFunction((const void*)&EVP_get_digestbynidFast, &infoEVP_get_digestbynid); - -void EVP_get_digestbynameFast(void* p, struct FastOneByteString* const p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsEVP_get_digestbyname[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcEVP_get_digestbyname = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoEVP_get_digestbyname = v8::CFunctionInfo(rcEVP_get_digestbyname, 3, cargsEVP_get_digestbyname); -v8::CFunction pFEVP_get_digestbyname = v8::CFunction((const void*)&EVP_get_digestbynameFast, &infoEVP_get_digestbyname); - -int32_t EVP_DigestFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2, struct FastApiTypedArray* const p3, void* p4, void* p5); -v8::CTypeInfo cargsEVP_Digest[7] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcEVP_Digest = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoEVP_Digest = v8::CFunctionInfo(rcEVP_Digest, 7, cargsEVP_Digest); -v8::CFunction pFEVP_Digest = v8::CFunction((const void*)&EVP_DigestFast, &infoEVP_Digest); - -int32_t EVP_DigestInit_exFast(void* p, void* p0, void* p1, void* p2); -v8::CTypeInfo cargsEVP_DigestInit_ex[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcEVP_DigestInit_ex = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoEVP_DigestInit_ex = v8::CFunctionInfo(rcEVP_DigestInit_ex, 4, cargsEVP_DigestInit_ex); -v8::CFunction pFEVP_DigestInit_ex = v8::CFunction((const void*)&EVP_DigestInit_exFast, &infoEVP_DigestInit_ex); - -int32_t EVP_DigestUpdateFast(void* p, void* p0, void* p1, uint32_t p2); -v8::CTypeInfo cargsEVP_DigestUpdate[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcEVP_DigestUpdate = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoEVP_DigestUpdate = v8::CFunctionInfo(rcEVP_DigestUpdate, 4, cargsEVP_DigestUpdate); -v8::CFunction pFEVP_DigestUpdate = v8::CFunction((const void*)&EVP_DigestUpdateFast, &infoEVP_DigestUpdate); - -int32_t EVP_DigestUpdateBufferFast(void* p, void* p0, struct FastApiTypedArray* const p1, uint32_t p2); -v8::CTypeInfo cargsEVP_DigestUpdateBuffer[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcEVP_DigestUpdateBuffer = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoEVP_DigestUpdateBuffer = v8::CFunctionInfo(rcEVP_DigestUpdateBuffer, 4, cargsEVP_DigestUpdateBuffer); -v8::CFunction pFEVP_DigestUpdateBuffer = v8::CFunction((const void*)&EVP_DigestUpdateBufferFast, &infoEVP_DigestUpdateBuffer); - -int32_t EVP_DigestUpdateStringFast(void* p, void* p0, struct FastOneByteString* const p1, uint32_t p2); -v8::CTypeInfo cargsEVP_DigestUpdateString[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcEVP_DigestUpdateString = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoEVP_DigestUpdateString = v8::CFunctionInfo(rcEVP_DigestUpdateString, 4, cargsEVP_DigestUpdateString); -v8::CFunction pFEVP_DigestUpdateString = v8::CFunction((const void*)&EVP_DigestUpdateStringFast, &infoEVP_DigestUpdateString); - -int32_t EVP_DigestVerifyFinalFast(void* p, void* p0, void* p1, uint32_t p2); -v8::CTypeInfo cargsEVP_DigestVerifyFinal[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcEVP_DigestVerifyFinal = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoEVP_DigestVerifyFinal = v8::CFunctionInfo(rcEVP_DigestVerifyFinal, 4, cargsEVP_DigestVerifyFinal); -v8::CFunction pFEVP_DigestVerifyFinal = v8::CFunction((const void*)&EVP_DigestVerifyFinalFast, &infoEVP_DigestVerifyFinal); - -int32_t EVP_DigestSignFinalFast(void* p, void* p0, void* p1, void* p2); -v8::CTypeInfo cargsEVP_DigestSignFinal[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcEVP_DigestSignFinal = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoEVP_DigestSignFinal = v8::CFunctionInfo(rcEVP_DigestSignFinal, 4, cargsEVP_DigestSignFinal); -v8::CFunction pFEVP_DigestSignFinal = v8::CFunction((const void*)&EVP_DigestSignFinalFast, &infoEVP_DigestSignFinal); - -int32_t EVP_DigestFinalFast(void* p, void* p0, struct FastApiTypedArray* const p1, struct FastApiTypedArray* const p2); -v8::CTypeInfo cargsEVP_DigestFinal[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcEVP_DigestFinal = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoEVP_DigestFinal = v8::CFunctionInfo(rcEVP_DigestFinal, 4, cargsEVP_DigestFinal); -v8::CFunction pFEVP_DigestFinal = v8::CFunction((const void*)&EVP_DigestFinalFast, &infoEVP_DigestFinal); - -void EVP_sha1Fast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsEVP_sha1[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcEVP_sha1 = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoEVP_sha1 = v8::CFunctionInfo(rcEVP_sha1, 2, cargsEVP_sha1); -v8::CFunction pFEVP_sha1 = v8::CFunction((const void*)&EVP_sha1Fast, &infoEVP_sha1); - -void EVP_sha224Fast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsEVP_sha224[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcEVP_sha224 = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoEVP_sha224 = v8::CFunctionInfo(rcEVP_sha224, 2, cargsEVP_sha224); -v8::CFunction pFEVP_sha224 = v8::CFunction((const void*)&EVP_sha224Fast, &infoEVP_sha224); - -void EVP_sha256Fast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsEVP_sha256[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcEVP_sha256 = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoEVP_sha256 = v8::CFunctionInfo(rcEVP_sha256, 2, cargsEVP_sha256); -v8::CFunction pFEVP_sha256 = v8::CFunction((const void*)&EVP_sha256Fast, &infoEVP_sha256); - -void EVP_sha384Fast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsEVP_sha384[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcEVP_sha384 = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoEVP_sha384 = v8::CFunctionInfo(rcEVP_sha384, 2, cargsEVP_sha384); -v8::CFunction pFEVP_sha384 = v8::CFunction((const void*)&EVP_sha384Fast, &infoEVP_sha384); - -void EVP_sha512Fast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsEVP_sha512[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcEVP_sha512 = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoEVP_sha512 = v8::CFunctionInfo(rcEVP_sha512, 2, cargsEVP_sha512); -v8::CFunction pFEVP_sha512 = v8::CFunction((const void*)&EVP_sha512Fast, &infoEVP_sha512); - -void EVP_sha512_256Fast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsEVP_sha512_256[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcEVP_sha512_256 = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoEVP_sha512_256 = v8::CFunctionInfo(rcEVP_sha512_256, 2, cargsEVP_sha512_256); -v8::CFunction pFEVP_sha512_256 = v8::CFunction((const void*)&EVP_sha512_256Fast, &infoEVP_sha512_256); - -int32_t EVP_DigestVerifyInitFast(void* p, void* p0, void* p1, void* p2, void* p3, void* p4); -v8::CTypeInfo cargsEVP_DigestVerifyInit[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcEVP_DigestVerifyInit = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoEVP_DigestVerifyInit = v8::CFunctionInfo(rcEVP_DigestVerifyInit, 6, cargsEVP_DigestVerifyInit); -v8::CFunction pFEVP_DigestVerifyInit = v8::CFunction((const void*)&EVP_DigestVerifyInitFast, &infoEVP_DigestVerifyInit); - -int32_t EVP_DigestSignInitFast(void* p, void* p0, void* p1, void* p2, void* p3, void* p4); -v8::CTypeInfo cargsEVP_DigestSignInit[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcEVP_DigestSignInit = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoEVP_DigestSignInit = v8::CFunctionInfo(rcEVP_DigestSignInit, 6, cargsEVP_DigestSignInit); -v8::CFunction pFEVP_DigestSignInit = v8::CFunction((const void*)&EVP_DigestSignInitFast, &infoEVP_DigestSignInit); - -void BIO_s_memFast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsBIO_s_mem[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcBIO_s_mem = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoBIO_s_mem = v8::CFunctionInfo(rcBIO_s_mem, 2, cargsBIO_s_mem); -v8::CFunction pFBIO_s_mem = v8::CFunction((const void*)&BIO_s_memFast, &infoBIO_s_mem); - -void BIO_newFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsBIO_new[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcBIO_new = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoBIO_new = v8::CFunctionInfo(rcBIO_new, 3, cargsBIO_new); -v8::CFunction pFBIO_new = v8::CFunction((const void*)&BIO_newFast, &infoBIO_new); - -void BIO_new_mem_bufFast(void* p, void* p0, int32_t p1, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsBIO_new_mem_buf[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcBIO_new_mem_buf = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoBIO_new_mem_buf = v8::CFunctionInfo(rcBIO_new_mem_buf, 4, cargsBIO_new_mem_buf); -v8::CFunction pFBIO_new_mem_buf = v8::CFunction((const void*)&BIO_new_mem_bufFast, &infoBIO_new_mem_buf); - -int32_t BIO_ctrlFast(void* p, void* p0, int32_t p1, uint64_t p2, void* p3); -v8::CTypeInfo cargsBIO_ctrl[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcBIO_ctrl = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoBIO_ctrl = v8::CFunctionInfo(rcBIO_ctrl, 5, cargsBIO_ctrl); -v8::CFunction pFBIO_ctrl = v8::CFunction((const void*)&BIO_ctrlFast, &infoBIO_ctrl); - -int32_t BIO_readFast(void* p, void* p0, void* p1, int32_t p2); -v8::CTypeInfo cargsBIO_read[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcBIO_read = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoBIO_read = v8::CFunctionInfo(rcBIO_read, 4, cargsBIO_read); -v8::CFunction pFBIO_read = v8::CFunction((const void*)&BIO_readFast, &infoBIO_read); - -int32_t PEM_write_bio_PrivateKeyFast(void* p, void* p0, void* p1, void* p2, void* p3, int32_t p4, void* p5, void* p6); -v8::CTypeInfo cargsPEM_write_bio_PrivateKey[8] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcPEM_write_bio_PrivateKey = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoPEM_write_bio_PrivateKey = v8::CFunctionInfo(rcPEM_write_bio_PrivateKey, 8, cargsPEM_write_bio_PrivateKey); -v8::CFunction pFPEM_write_bio_PrivateKey = v8::CFunction((const void*)&PEM_write_bio_PrivateKeyFast, &infoPEM_write_bio_PrivateKey); - -int32_t PEM_write_bio_PUBKEYFast(void* p, void* p0, void* p1); -v8::CTypeInfo cargsPEM_write_bio_PUBKEY[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcPEM_write_bio_PUBKEY = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoPEM_write_bio_PUBKEY = v8::CFunctionInfo(rcPEM_write_bio_PUBKEY, 3, cargsPEM_write_bio_PUBKEY); -v8::CFunction pFPEM_write_bio_PUBKEY = v8::CFunction((const void*)&PEM_write_bio_PUBKEYFast, &infoPEM_write_bio_PUBKEY); - -int32_t PEM_write_bio_X509_REQFast(void* p, void* p0, void* p1); -v8::CTypeInfo cargsPEM_write_bio_X509_REQ[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcPEM_write_bio_X509_REQ = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoPEM_write_bio_X509_REQ = v8::CFunctionInfo(rcPEM_write_bio_X509_REQ, 3, cargsPEM_write_bio_X509_REQ); -v8::CFunction pFPEM_write_bio_X509_REQ = v8::CFunction((const void*)&PEM_write_bio_X509_REQFast, &infoPEM_write_bio_X509_REQ); - -void PEM_read_bio_X509Fast(void* p, void* p0, void* p1, void* p2, void* p3, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsPEM_read_bio_X509[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcPEM_read_bio_X509 = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoPEM_read_bio_X509 = v8::CFunctionInfo(rcPEM_read_bio_X509, 6, cargsPEM_read_bio_X509); -v8::CFunction pFPEM_read_bio_X509 = v8::CFunction((const void*)&PEM_read_bio_X509Fast, &infoPEM_read_bio_X509); - -void X509_get_subject_nameFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsX509_get_subject_name[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcX509_get_subject_name = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoX509_get_subject_name = v8::CFunctionInfo(rcX509_get_subject_name, 3, cargsX509_get_subject_name); -v8::CFunction pFX509_get_subject_name = v8::CFunction((const void*)&X509_get_subject_nameFast, &infoX509_get_subject_name); - -void X509_NAME_onelineFast(void* p, void* p0, void* p1, int32_t p2, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsX509_NAME_oneline[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcX509_NAME_oneline = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoX509_NAME_oneline = v8::CFunctionInfo(rcX509_NAME_oneline, 5, cargsX509_NAME_oneline); -v8::CFunction pFX509_NAME_oneline = v8::CFunction((const void*)&X509_NAME_onelineFast, &infoX509_NAME_oneline); - -void X509_get_issuer_nameFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsX509_get_issuer_name[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcX509_get_issuer_name = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoX509_get_issuer_name = v8::CFunctionInfo(rcX509_get_issuer_name, 3, cargsX509_get_issuer_name); -v8::CFunction pFX509_get_issuer_name = v8::CFunction((const void*)&X509_get_issuer_nameFast, &infoX509_get_issuer_name); - -void X509_freeFast(void* p, void* p0); -v8::CTypeInfo cargsX509_free[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcX509_free = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoX509_free = v8::CFunctionInfo(rcX509_free, 2, cargsX509_free); -v8::CFunction pFX509_free = v8::CFunction((const void*)&X509_freeFast, &infoX509_free); - -void X509_get_pubkeyFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsX509_get_pubkey[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcX509_get_pubkey = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoX509_get_pubkey = v8::CFunctionInfo(rcX509_get_pubkey, 3, cargsX509_get_pubkey); -v8::CFunction pFX509_get_pubkey = v8::CFunction((const void*)&X509_get_pubkeyFast, &infoX509_get_pubkey); - -void X509_REQ_newFast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsX509_REQ_new[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcX509_REQ_new = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoX509_REQ_new = v8::CFunctionInfo(rcX509_REQ_new, 2, cargsX509_REQ_new); -v8::CFunction pFX509_REQ_new = v8::CFunction((const void*)&X509_REQ_newFast, &infoX509_REQ_new); - -int32_t X509_REQ_set_versionFast(void* p, void* p0, uint32_t p1); -v8::CTypeInfo cargsX509_REQ_set_version[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcX509_REQ_set_version = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoX509_REQ_set_version = v8::CFunctionInfo(rcX509_REQ_set_version, 3, cargsX509_REQ_set_version); -v8::CFunction pFX509_REQ_set_version = v8::CFunction((const void*)&X509_REQ_set_versionFast, &infoX509_REQ_set_version); - -void X509_REQ_get_subject_nameFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsX509_REQ_get_subject_name[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcX509_REQ_get_subject_name = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoX509_REQ_get_subject_name = v8::CFunctionInfo(rcX509_REQ_get_subject_name, 3, cargsX509_REQ_get_subject_name); -v8::CFunction pFX509_REQ_get_subject_name = v8::CFunction((const void*)&X509_REQ_get_subject_nameFast, &infoX509_REQ_get_subject_name); - -int32_t X509_NAME_add_entry_by_txtFast(void* p, void* p0, void* p1, int32_t p2, void* p3, int32_t p4, int32_t p5, int32_t p6); -v8::CTypeInfo cargsX509_NAME_add_entry_by_txt[8] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcX509_NAME_add_entry_by_txt = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoX509_NAME_add_entry_by_txt = v8::CFunctionInfo(rcX509_NAME_add_entry_by_txt, 8, cargsX509_NAME_add_entry_by_txt); -v8::CFunction pFX509_NAME_add_entry_by_txt = v8::CFunction((const void*)&X509_NAME_add_entry_by_txtFast, &infoX509_NAME_add_entry_by_txt); - -int32_t X509_REQ_set_pubkeyFast(void* p, void* p0, void* p1); -v8::CTypeInfo cargsX509_REQ_set_pubkey[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcX509_REQ_set_pubkey = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoX509_REQ_set_pubkey = v8::CFunctionInfo(rcX509_REQ_set_pubkey, 3, cargsX509_REQ_set_pubkey); -v8::CFunction pFX509_REQ_set_pubkey = v8::CFunction((const void*)&X509_REQ_set_pubkeyFast, &infoX509_REQ_set_pubkey); - -int32_t X509_REQ_signFast(void* p, void* p0, void* p1, void* p2); -v8::CTypeInfo cargsX509_REQ_sign[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcX509_REQ_sign = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoX509_REQ_sign = v8::CFunctionInfo(rcX509_REQ_sign, 4, cargsX509_REQ_sign); -v8::CFunction pFX509_REQ_sign = v8::CFunction((const void*)&X509_REQ_signFast, &infoX509_REQ_sign); - -int32_t OBJ_txt2nidFast(void* p, void* p0); -v8::CTypeInfo cargsOBJ_txt2nid[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcOBJ_txt2nid = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoOBJ_txt2nid = v8::CFunctionInfo(rcOBJ_txt2nid, 2, cargsOBJ_txt2nid); -v8::CFunction pFOBJ_txt2nid = v8::CFunction((const void*)&OBJ_txt2nidFast, &infoOBJ_txt2nid); - -int32_t SSL_get_errorFast(void* p, void* p0, int32_t p1); -v8::CTypeInfo cargsSSL_get_error[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcSSL_get_error = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoSSL_get_error = v8::CFunctionInfo(rcSSL_get_error, 3, cargsSSL_get_error); -v8::CFunction pFSSL_get_error = v8::CFunction((const void*)&SSL_get_errorFast, &infoSSL_get_error); - -int32_t OPENSSL_init_sslFast(void* p, uint64_t p0, void* p1); -v8::CTypeInfo cargsOPENSSL_init_ssl[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcOPENSSL_init_ssl = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoOPENSSL_init_ssl = v8::CFunctionInfo(rcOPENSSL_init_ssl, 3, cargsOPENSSL_init_ssl); -v8::CFunction pFOPENSSL_init_ssl = v8::CFunction((const void*)&OPENSSL_init_sslFast, &infoOPENSSL_init_ssl); - -int32_t SSL_is_init_finishedFast(void* p, void* p0); -v8::CTypeInfo cargsSSL_is_init_finished[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcSSL_is_init_finished = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoSSL_is_init_finished = v8::CFunctionInfo(rcSSL_is_init_finished, 2, cargsSSL_is_init_finished); -v8::CFunction pFSSL_is_init_finished = v8::CFunction((const void*)&SSL_is_init_finishedFast, &infoSSL_is_init_finished); - -int32_t SSL_shutdownFast(void* p, void* p0); -v8::CTypeInfo cargsSSL_shutdown[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcSSL_shutdown = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoSSL_shutdown = v8::CFunctionInfo(rcSSL_shutdown, 2, cargsSSL_shutdown); -v8::CFunction pFSSL_shutdown = v8::CFunction((const void*)&SSL_shutdownFast, &infoSSL_shutdown); - -void SSL_get_servernameFast(void* p, void* p0, int32_t p1, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsSSL_get_servername[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcSSL_get_servername = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoSSL_get_servername = v8::CFunctionInfo(rcSSL_get_servername, 4, cargsSSL_get_servername); -v8::CFunction pFSSL_get_servername = v8::CFunction((const void*)&SSL_get_servernameFast, &infoSSL_get_servername); - -int32_t SSL_get_servername_typeFast(void* p, void* p0); -v8::CTypeInfo cargsSSL_get_servername_type[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcSSL_get_servername_type = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoSSL_get_servername_type = v8::CFunctionInfo(rcSSL_get_servername_type, 2, cargsSSL_get_servername_type); -v8::CFunction pFSSL_get_servername_type = v8::CFunction((const void*)&SSL_get_servername_typeFast, &infoSSL_get_servername_type); - -void SSL_freeFast(void* p, void* p0); -v8::CTypeInfo cargsSSL_free[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcSSL_free = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoSSL_free = v8::CFunctionInfo(rcSSL_free, 2, cargsSSL_free); -v8::CFunction pFSSL_free = v8::CFunction((const void*)&SSL_freeFast, &infoSSL_free); - -int32_t SSL_readFast(void* p, void* p0, void* p1, int32_t p2); -v8::CTypeInfo cargsSSL_read[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcSSL_read = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoSSL_read = v8::CFunctionInfo(rcSSL_read, 4, cargsSSL_read); -v8::CFunction pFSSL_read = v8::CFunction((const void*)&SSL_readFast, &infoSSL_read); - -int32_t SSL_writeFast(void* p, void* p0, void* p1, int32_t p2); -v8::CTypeInfo cargsSSL_write[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcSSL_write = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoSSL_write = v8::CFunctionInfo(rcSSL_write, 4, cargsSSL_write); -v8::CFunction pFSSL_write = v8::CFunction((const void*)&SSL_writeFast, &infoSSL_write); - -void SSL_get_versionFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsSSL_get_version[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcSSL_get_version = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoSSL_get_version = v8::CFunctionInfo(rcSSL_get_version, 3, cargsSSL_get_version); -v8::CFunction pFSSL_get_version = v8::CFunction((const void*)&SSL_get_versionFast, &infoSSL_get_version); - -void SSL_CIPHER_get_nameFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsSSL_CIPHER_get_name[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcSSL_CIPHER_get_name = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoSSL_CIPHER_get_name = v8::CFunctionInfo(rcSSL_CIPHER_get_name, 3, cargsSSL_CIPHER_get_name); -v8::CFunction pFSSL_CIPHER_get_name = v8::CFunction((const void*)&SSL_CIPHER_get_nameFast, &infoSSL_CIPHER_get_name); - -void SSL_get_current_cipherFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsSSL_get_current_cipher[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcSSL_get_current_cipher = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoSSL_get_current_cipher = v8::CFunctionInfo(rcSSL_get_current_cipher, 3, cargsSSL_get_current_cipher); -v8::CFunction pFSSL_get_current_cipher = v8::CFunction((const void*)&SSL_get_current_cipherFast, &infoSSL_get_current_cipher); - -void SSL_get_peer_certificateFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsSSL_get_peer_certificate[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcSSL_get_peer_certificate = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoSSL_get_peer_certificate = v8::CFunctionInfo(rcSSL_get_peer_certificate, 3, cargsSSL_get_peer_certificate); -v8::CFunction pFSSL_get_peer_certificate = v8::CFunction((const void*)&SSL_get_peer_certificateFast, &infoSSL_get_peer_certificate); - -void SSL_set_SSL_CTXFast(void* p, void* p0, void* p1, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsSSL_set_SSL_CTX[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcSSL_set_SSL_CTX = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoSSL_set_SSL_CTX = v8::CFunctionInfo(rcSSL_set_SSL_CTX, 4, cargsSSL_set_SSL_CTX); -v8::CFunction pFSSL_set_SSL_CTX = v8::CFunction((const void*)&SSL_set_SSL_CTXFast, &infoSSL_set_SSL_CTX); - -void SSL_newFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsSSL_new[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcSSL_new = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoSSL_new = v8::CFunctionInfo(rcSSL_new, 3, cargsSSL_new); -v8::CFunction pFSSL_new = v8::CFunction((const void*)&SSL_newFast, &infoSSL_new); - -int32_t SSL_set_fdFast(void* p, void* p0, int32_t p1); -v8::CTypeInfo cargsSSL_set_fd[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcSSL_set_fd = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoSSL_set_fd = v8::CFunctionInfo(rcSSL_set_fd, 3, cargsSSL_set_fd); -v8::CFunction pFSSL_set_fd = v8::CFunction((const void*)&SSL_set_fdFast, &infoSSL_set_fd); - -void SSL_set_bioFast(void* p, void* p0, void* p1, void* p2); -v8::CTypeInfo cargsSSL_set_bio[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcSSL_set_bio = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoSSL_set_bio = v8::CFunctionInfo(rcSSL_set_bio, 4, cargsSSL_set_bio); -v8::CFunction pFSSL_set_bio = v8::CFunction((const void*)&SSL_set_bioFast, &infoSSL_set_bio); - -void SSL_set_accept_stateFast(void* p, void* p0); -v8::CTypeInfo cargsSSL_set_accept_state[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcSSL_set_accept_state = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoSSL_set_accept_state = v8::CFunctionInfo(rcSSL_set_accept_state, 2, cargsSSL_set_accept_state); -v8::CFunction pFSSL_set_accept_state = v8::CFunction((const void*)&SSL_set_accept_stateFast, &infoSSL_set_accept_state); - -int32_t SSL_connectFast(void* p, void* p0); -v8::CTypeInfo cargsSSL_connect[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcSSL_connect = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoSSL_connect = v8::CFunctionInfo(rcSSL_connect, 2, cargsSSL_connect); -v8::CFunction pFSSL_connect = v8::CFunction((const void*)&SSL_connectFast, &infoSSL_connect); - -int32_t SSL_acceptFast(void* p, void* p0); -v8::CTypeInfo cargsSSL_accept[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcSSL_accept = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoSSL_accept = v8::CFunctionInfo(rcSSL_accept, 2, cargsSSL_accept); -v8::CFunction pFSSL_accept = v8::CFunction((const void*)&SSL_acceptFast, &infoSSL_accept); - -void SSL_set_connect_stateFast(void* p, void* p0); -v8::CTypeInfo cargsSSL_set_connect_state[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcSSL_set_connect_state = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoSSL_set_connect_state = v8::CFunctionInfo(rcSSL_set_connect_state, 2, cargsSSL_set_connect_state); -v8::CFunction pFSSL_set_connect_state = v8::CFunction((const void*)&SSL_set_connect_stateFast, &infoSSL_set_connect_state); - -int32_t SSL_do_handshakeFast(void* p, void* p0); -v8::CTypeInfo cargsSSL_do_handshake[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcSSL_do_handshake = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoSSL_do_handshake = v8::CFunctionInfo(rcSSL_do_handshake, 2, cargsSSL_do_handshake); -v8::CFunction pFSSL_do_handshake = v8::CFunction((const void*)&SSL_do_handshakeFast, &infoSSL_do_handshake); - -void SSL_CTX_newFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsSSL_CTX_new[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcSSL_CTX_new = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoSSL_CTX_new = v8::CFunctionInfo(rcSSL_CTX_new, 3, cargsSSL_CTX_new); -v8::CFunction pFSSL_CTX_new = v8::CFunction((const void*)&SSL_CTX_newFast, &infoSSL_CTX_new); - -int32_t SSL_CTX_use_certificate_fileFast(void* p, void* p0, void* p1, int32_t p2); -v8::CTypeInfo cargsSSL_CTX_use_certificate_file[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcSSL_CTX_use_certificate_file = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoSSL_CTX_use_certificate_file = v8::CFunctionInfo(rcSSL_CTX_use_certificate_file, 4, cargsSSL_CTX_use_certificate_file); -v8::CFunction pFSSL_CTX_use_certificate_file = v8::CFunction((const void*)&SSL_CTX_use_certificate_fileFast, &infoSSL_CTX_use_certificate_file); - -int32_t SSL_CTX_use_certificate_chain_fileFast(void* p, void* p0, void* p1); -v8::CTypeInfo cargsSSL_CTX_use_certificate_chain_file[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcSSL_CTX_use_certificate_chain_file = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoSSL_CTX_use_certificate_chain_file = v8::CFunctionInfo(rcSSL_CTX_use_certificate_chain_file, 3, cargsSSL_CTX_use_certificate_chain_file); -v8::CFunction pFSSL_CTX_use_certificate_chain_file = v8::CFunction((const void*)&SSL_CTX_use_certificate_chain_fileFast, &infoSSL_CTX_use_certificate_chain_file); - -int32_t SSL_CTX_use_PrivateKey_fileFast(void* p, void* p0, void* p1, int32_t p2); -v8::CTypeInfo cargsSSL_CTX_use_PrivateKey_file[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcSSL_CTX_use_PrivateKey_file = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoSSL_CTX_use_PrivateKey_file = v8::CFunctionInfo(rcSSL_CTX_use_PrivateKey_file, 4, cargsSSL_CTX_use_PrivateKey_file); -v8::CFunction pFSSL_CTX_use_PrivateKey_file = v8::CFunction((const void*)&SSL_CTX_use_PrivateKey_fileFast, &infoSSL_CTX_use_PrivateKey_file); - -void SSL_CTX_set_optionsFast(void* p, void* p0, uint64_t p1, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsSSL_CTX_set_options[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcSSL_CTX_set_options = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoSSL_CTX_set_options = v8::CFunctionInfo(rcSSL_CTX_set_options, 4, cargsSSL_CTX_set_options); -v8::CFunction pFSSL_CTX_set_options = v8::CFunction((const void*)&SSL_CTX_set_optionsFast, &infoSSL_CTX_set_options); - -int32_t SSL_CTX_set_cipher_listFast(void* p, void* p0, struct FastOneByteString* const p1); -v8::CTypeInfo cargsSSL_CTX_set_cipher_list[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rcSSL_CTX_set_cipher_list = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoSSL_CTX_set_cipher_list = v8::CFunctionInfo(rcSSL_CTX_set_cipher_list, 3, cargsSSL_CTX_set_cipher_list); -v8::CFunction pFSSL_CTX_set_cipher_list = v8::CFunction((const void*)&SSL_CTX_set_cipher_listFast, &infoSSL_CTX_set_cipher_list); - -int32_t SSL_set_cipher_listFast(void* p, void* p0, struct FastOneByteString* const p1); -v8::CTypeInfo cargsSSL_set_cipher_list[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rcSSL_set_cipher_list = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoSSL_set_cipher_list = v8::CFunctionInfo(rcSSL_set_cipher_list, 3, cargsSSL_set_cipher_list); -v8::CFunction pFSSL_set_cipher_list = v8::CFunction((const void*)&SSL_set_cipher_listFast, &infoSSL_set_cipher_list); - -void SSL_CTX_freeFast(void* p, void* p0); -v8::CTypeInfo cargsSSL_CTX_free[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcSSL_CTX_free = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoSSL_CTX_free = v8::CFunctionInfo(rcSSL_CTX_free, 2, cargsSSL_CTX_free); -v8::CFunction pFSSL_CTX_free = v8::CFunction((const void*)&SSL_CTX_freeFast, &infoSSL_CTX_free); - -void TLS_server_methodFast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsTLS_server_method[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcTLS_server_method = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoTLS_server_method = v8::CFunctionInfo(rcTLS_server_method, 2, cargsTLS_server_method); -v8::CFunction pFTLS_server_method = v8::CFunction((const void*)&TLS_server_methodFast, &infoTLS_server_method); - -void TLS_client_methodFast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsTLS_client_method[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcTLS_client_method = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoTLS_client_method = v8::CFunctionInfo(rcTLS_client_method, 2, cargsTLS_client_method); -v8::CFunction pFTLS_client_method = v8::CFunction((const void*)&TLS_client_methodFast, &infoTLS_client_method); - -int32_t SSL_CTX_set_ciphersuitesFast(void* p, void* p0, struct FastOneByteString* const p1); -v8::CTypeInfo cargsSSL_CTX_set_ciphersuites[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rcSSL_CTX_set_ciphersuites = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoSSL_CTX_set_ciphersuites = v8::CFunctionInfo(rcSSL_CTX_set_ciphersuites, 3, cargsSSL_CTX_set_ciphersuites); -v8::CFunction pFSSL_CTX_set_ciphersuites = v8::CFunction((const void*)&SSL_CTX_set_ciphersuitesFast, &infoSSL_CTX_set_ciphersuites); - -void SSL_ctrlFast(void* p, void* p0, int32_t p1, uint64_t p2, void* p3, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsSSL_ctrl[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcSSL_ctrl = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoSSL_ctrl = v8::CFunctionInfo(rcSSL_ctrl, 6, cargsSSL_ctrl); -v8::CFunction pFSSL_ctrl = v8::CFunction((const void*)&SSL_ctrlFast, &infoSSL_ctrl); - -int32_t RSA_pkey_ctx_ctrlFast(void* p, void* p0, int32_t p1, int32_t p2, int32_t p3, void* p4); -v8::CTypeInfo cargsRSA_pkey_ctx_ctrl[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcRSA_pkey_ctx_ctrl = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoRSA_pkey_ctx_ctrl = v8::CFunctionInfo(rcRSA_pkey_ctx_ctrl, 6, cargsRSA_pkey_ctx_ctrl); -v8::CFunction pFRSA_pkey_ctx_ctrl = v8::CFunction((const void*)&RSA_pkey_ctx_ctrlFast, &infoRSA_pkey_ctx_ctrl); - -void EVP_sha512_224Fast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsEVP_sha512_224[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcEVP_sha512_224 = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoEVP_sha512_224 = v8::CFunctionInfo(rcEVP_sha512_224, 2, cargsEVP_sha512_224); -v8::CFunction pFEVP_sha512_224 = v8::CFunction((const void*)&EVP_sha512_224Fast, &infoEVP_sha512_224); - -void X509_newFast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsX509_new[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcX509_new = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoX509_new = v8::CFunctionInfo(rcX509_new, 2, cargsX509_new); -v8::CFunction pFX509_new = v8::CFunction((const void*)&X509_newFast, &infoX509_new); - -int32_t ASN1_INTEGER_setFast(void* p, void* p0, int32_t p1); -v8::CTypeInfo cargsASN1_INTEGER_set[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcASN1_INTEGER_set = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoASN1_INTEGER_set = v8::CFunctionInfo(rcASN1_INTEGER_set, 3, cargsASN1_INTEGER_set); -v8::CFunction pFASN1_INTEGER_set = v8::CFunction((const void*)&ASN1_INTEGER_setFast, &infoASN1_INTEGER_set); - -void X509_get_serialNumberFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsX509_get_serialNumber[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcX509_get_serialNumber = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoX509_get_serialNumber = v8::CFunctionInfo(rcX509_get_serialNumber, 3, cargsX509_get_serialNumber); -v8::CFunction pFX509_get_serialNumber = v8::CFunction((const void*)&X509_get_serialNumberFast, &infoX509_get_serialNumber); - -void X509_time_adj_exFast(void* p, void* p0, int32_t p1, uint32_t p2, void* p3, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsX509_time_adj_ex[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcX509_time_adj_ex = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoX509_time_adj_ex = v8::CFunctionInfo(rcX509_time_adj_ex, 6, cargsX509_time_adj_ex); -v8::CFunction pFX509_time_adj_ex = v8::CFunction((const void*)&X509_time_adj_exFast, &infoX509_time_adj_ex); - -void X509_gmtime_adjFast(void* p, void* p0, uint32_t p1, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsX509_gmtime_adj[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcX509_gmtime_adj = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoX509_gmtime_adj = v8::CFunctionInfo(rcX509_gmtime_adj, 4, cargsX509_gmtime_adj); -v8::CFunction pFX509_gmtime_adj = v8::CFunction((const void*)&X509_gmtime_adjFast, &infoX509_gmtime_adj); - -void X509_getm_notBeforeFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsX509_getm_notBefore[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcX509_getm_notBefore = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoX509_getm_notBefore = v8::CFunctionInfo(rcX509_getm_notBefore, 3, cargsX509_getm_notBefore); -v8::CFunction pFX509_getm_notBefore = v8::CFunction((const void*)&X509_getm_notBeforeFast, &infoX509_getm_notBefore); - -void X509_getm_notAfterFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsX509_getm_notAfter[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcX509_getm_notAfter = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoX509_getm_notAfter = v8::CFunctionInfo(rcX509_getm_notAfter, 3, cargsX509_getm_notAfter); -v8::CFunction pFX509_getm_notAfter = v8::CFunction((const void*)&X509_getm_notAfterFast, &infoX509_getm_notAfter); - -int32_t X509_set_pubkeyFast(void* p, void* p0, void* p1); -v8::CTypeInfo cargsX509_set_pubkey[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcX509_set_pubkey = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoX509_set_pubkey = v8::CFunctionInfo(rcX509_set_pubkey, 3, cargsX509_set_pubkey); -v8::CFunction pFX509_set_pubkey = v8::CFunction((const void*)&X509_set_pubkeyFast, &infoX509_set_pubkey); - -int32_t X509_signFast(void* p, void* p0, void* p1, void* p2); -v8::CTypeInfo cargsX509_sign[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcX509_sign = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoX509_sign = v8::CFunctionInfo(rcX509_sign, 4, cargsX509_sign); -v8::CFunction pFX509_sign = v8::CFunction((const void*)&X509_signFast, &infoX509_sign); - -int32_t PEM_write_bio_X509Fast(void* p, void* p0, void* p1); -v8::CTypeInfo cargsPEM_write_bio_X509[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcPEM_write_bio_X509 = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoPEM_write_bio_X509 = v8::CFunctionInfo(rcPEM_write_bio_X509, 3, cargsPEM_write_bio_X509); -v8::CFunction pFPEM_write_bio_X509 = v8::CFunction((const void*)&PEM_write_bio_X509Fast, &infoPEM_write_bio_X509); - -int32_t X509_set_issuer_nameFast(void* p, void* p0, void* p1); -v8::CTypeInfo cargsX509_set_issuer_name[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcX509_set_issuer_name = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoX509_set_issuer_name = v8::CFunctionInfo(rcX509_set_issuer_name, 3, cargsX509_set_issuer_name); -v8::CFunction pFX509_set_issuer_name = v8::CFunction((const void*)&X509_set_issuer_nameFast, &infoX509_set_issuer_name); - - - -void OpenSSL_versionSlow(const FunctionCallbackInfo &args) { - int32_t v0 = Local::Cast(args[0])->Value(); - const char* rc = OpenSSL_version(v0); - Local ab = args[1].As()->Buffer(); - ((const char**)ab->Data())[0] = rc; -} - -void OpenSSL_versionFast(void* p, int32_t p0, struct FastApiTypedArray* const p_ret) { - int32_t v0 = p0; - const char* r = OpenSSL_version(v0); - ((const char**)p_ret->data)[0] = r; - -} -void EVP_PKEY_CTX_new_idSlow(const FunctionCallbackInfo &args) { - int32_t v0 = Local::Cast(args[0])->Value(); - ENGINE* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - EVP_PKEY_CTX* rc = EVP_PKEY_CTX_new_id(v0, v1); - Local ab = args[2].As()->Buffer(); - ((EVP_PKEY_CTX**)ab->Data())[0] = rc; -} - -void EVP_PKEY_CTX_new_idFast(void* p, int32_t p0, void* p1, struct FastApiTypedArray* const p_ret) { - int32_t v0 = p0; - ENGINE* v1 = reinterpret_cast(p1); - EVP_PKEY_CTX* r = EVP_PKEY_CTX_new_id(v0, v1); - ((EVP_PKEY_CTX**)p_ret->data)[0] = r; - -} -void EVP_PKEY_keygen_initSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - EVP_PKEY_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = EVP_PKEY_keygen_init(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t EVP_PKEY_keygen_initFast(void* p, void* p0) { - EVP_PKEY_CTX* v0 = reinterpret_cast(p0); - return EVP_PKEY_keygen_init(v0); -} -void EVP_PKEY_keygenSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - EVP_PKEY_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - EVP_PKEY** v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t rc = EVP_PKEY_keygen(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t EVP_PKEY_keygenFast(void* p, void* p0, void* p1) { - EVP_PKEY_CTX* v0 = reinterpret_cast(p0); - EVP_PKEY** v1 = reinterpret_cast(p1); - return EVP_PKEY_keygen(v0, v1); -} -void EVP_PKEY_newSlow(const FunctionCallbackInfo &args) { - - EVP_PKEY* rc = EVP_PKEY_new(); - Local ab = args[0].As()->Buffer(); - ((EVP_PKEY**)ab->Data())[0] = rc; -} - -void EVP_PKEY_newFast(void* p, struct FastApiTypedArray* const p_ret) { - - EVP_PKEY* r = EVP_PKEY_new(); - ((EVP_PKEY**)p_ret->data)[0] = r; - -} -void EVP_PKEY_idSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - EVP_PKEY* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = EVP_PKEY_id(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t EVP_PKEY_idFast(void* p, void* p0) { - EVP_PKEY* v0 = reinterpret_cast(p0); - return EVP_PKEY_id(v0); -} -void EVP_PKEY_typeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t rc = EVP_PKEY_type(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t EVP_PKEY_typeFast(void* p, int32_t p0) { - int32_t v0 = p0; - return EVP_PKEY_type(v0); -} -void EVP_PKEY_freeSlow(const FunctionCallbackInfo &args) { - EVP_PKEY* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - EVP_PKEY_free(v0); -} - -void EVP_PKEY_freeFast(void* p, void* p0) { - EVP_PKEY* v0 = reinterpret_cast(p0); - EVP_PKEY_free(v0); -} -void EVP_PKEY_CTX_freeSlow(const FunctionCallbackInfo &args) { - EVP_PKEY_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - EVP_PKEY_CTX_free(v0); -} - -void EVP_PKEY_CTX_freeFast(void* p, void* p0) { - EVP_PKEY_CTX* v0 = reinterpret_cast(p0); - EVP_PKEY_CTX_free(v0); -} -void EVP_MD_CTX_newSlow(const FunctionCallbackInfo &args) { - - EVP_MD_CTX* rc = EVP_MD_CTX_new(); - Local ab = args[0].As()->Buffer(); - ((EVP_MD_CTX**)ab->Data())[0] = rc; -} - -void EVP_MD_CTX_newFast(void* p, struct FastApiTypedArray* const p_ret) { - - EVP_MD_CTX* r = EVP_MD_CTX_new(); - ((EVP_MD_CTX**)p_ret->data)[0] = r; - -} -void EVP_MD_CTX_resetSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - EVP_MD_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = EVP_MD_CTX_reset(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t EVP_MD_CTX_resetFast(void* p, void* p0) { - EVP_MD_CTX* v0 = reinterpret_cast(p0); - return EVP_MD_CTX_reset(v0); -} -void EVP_MD_CTX_freeSlow(const FunctionCallbackInfo &args) { - EVP_MD_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - EVP_MD_CTX_free(v0); -} - -void EVP_MD_CTX_freeFast(void* p, void* p0) { - EVP_MD_CTX* v0 = reinterpret_cast(p0); - EVP_MD_CTX_free(v0); -} -void EVP_get_digestbynidSlow(const FunctionCallbackInfo &args) { - int32_t v0 = Local::Cast(args[0])->Value(); - const EVP_MD* rc = EVP_get_digestbynid(v0); - Local ab = args[1].As()->Buffer(); - ((const EVP_MD**)ab->Data())[0] = rc; -} - -void EVP_get_digestbynidFast(void* p, int32_t p0, struct FastApiTypedArray* const p_ret) { - int32_t v0 = p0; - const EVP_MD* r = EVP_get_digestbynid(v0); - ((const EVP_MD**)p_ret->data)[0] = r; - -} -void EVP_get_digestbynameSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - String::Utf8Value v0(isolate, args[0]); - const EVP_MD* rc = EVP_get_digestbyname(*v0); - Local ab = args[1].As()->Buffer(); - ((const EVP_MD**)ab->Data())[0] = rc; -} - -void EVP_get_digestbynameFast(void* p, struct FastOneByteString* const p0, struct FastApiTypedArray* const p_ret) { - struct FastOneByteString* const v0 = p0; - const EVP_MD* r = EVP_get_digestbyname(v0->data); - ((const EVP_MD**)p_ret->data)[0] = r; - -} -void EVP_DigestSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - void* v0 = reinterpret_cast(ptr0); - uint32_t v1 = Local::Cast(args[1])->Value(); - Local u82 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u82->Buffer()->Data() + u82->ByteOffset(); - unsigned char* v2 = reinterpret_cast(ptr2); - Local u83 = args[3].As(); - uint8_t* ptr3 = (uint8_t*)u83->Buffer()->Data() + u83->ByteOffset(); - unsigned int* v3 = reinterpret_cast(ptr3); - const EVP_MD* v4 = reinterpret_cast((uint64_t)Local::Cast(args[4])->Value()); - ENGINE* v5 = reinterpret_cast((uint64_t)Local::Cast(args[5])->Value()); - int32_t rc = EVP_Digest(v0, v1, v2, v3, v4, v5); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t EVP_DigestFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2, struct FastApiTypedArray* const p3, void* p4, void* p5) { - void* v0 = reinterpret_cast(p0->data); - uint32_t v1 = p1; - unsigned char* v2 = reinterpret_cast(p2->data); - unsigned int* v3 = reinterpret_cast(p3->data); - const EVP_MD* v4 = reinterpret_cast(p4); - ENGINE* v5 = reinterpret_cast(p5); - return EVP_Digest(v0, v1, v2, v3, v4, v5); -} -void EVP_DigestInit_exSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - EVP_MD_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - EVP_MD* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - ENGINE* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - int32_t rc = EVP_DigestInit_ex(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t EVP_DigestInit_exFast(void* p, void* p0, void* p1, void* p2) { - EVP_MD_CTX* v0 = reinterpret_cast(p0); - EVP_MD* v1 = reinterpret_cast(p1); - ENGINE* v2 = reinterpret_cast(p2); - return EVP_DigestInit_ex(v0, v1, v2); -} -void EVP_DigestUpdateSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - EVP_MD_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - void* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = EVP_DigestUpdate(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t EVP_DigestUpdateFast(void* p, void* p0, void* p1, uint32_t p2) { - EVP_MD_CTX* v0 = reinterpret_cast(p0); - void* v1 = reinterpret_cast(p1); - uint32_t v2 = p2; - return EVP_DigestUpdate(v0, v1, v2); -} -void EVP_DigestUpdateBufferSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - EVP_MD_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - void* v1 = reinterpret_cast(ptr1); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = EVP_DigestUpdate(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t EVP_DigestUpdateBufferFast(void* p, void* p0, struct FastApiTypedArray* const p1, uint32_t p2) { - EVP_MD_CTX* v0 = reinterpret_cast(p0); - void* v1 = reinterpret_cast(p1->data); - uint32_t v2 = p2; - return EVP_DigestUpdate(v0, v1, v2); -} -void EVP_DigestUpdateStringSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - EVP_MD_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = EVP_DigestUpdate(v0, *v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t EVP_DigestUpdateStringFast(void* p, void* p0, struct FastOneByteString* const p1, uint32_t p2) { - EVP_MD_CTX* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - uint32_t v2 = p2; - return EVP_DigestUpdate(v0, v1->data, v2); -} -void EVP_DigestVerifyFinalSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - EVP_MD_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const unsigned char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = EVP_DigestVerifyFinal(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t EVP_DigestVerifyFinalFast(void* p, void* p0, void* p1, uint32_t p2) { - EVP_MD_CTX* v0 = reinterpret_cast(p0); - const unsigned char* v1 = reinterpret_cast(p1); - uint32_t v2 = p2; - return EVP_DigestVerifyFinal(v0, v1, v2); -} -void EVP_DigestSignFinalSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - EVP_MD_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - unsigned char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - size_t* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - int32_t rc = EVP_DigestSignFinal(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t EVP_DigestSignFinalFast(void* p, void* p0, void* p1, void* p2) { - EVP_MD_CTX* v0 = reinterpret_cast(p0); - unsigned char* v1 = reinterpret_cast(p1); - size_t* v2 = reinterpret_cast(p2); - return EVP_DigestSignFinal(v0, v1, v2); -} -void EVP_DigestFinalSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - EVP_MD_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - unsigned char* v1 = reinterpret_cast(ptr1); - Local u322 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u322->Buffer()->Data() + u322->ByteOffset(); - unsigned int* v2 = reinterpret_cast(ptr2); - int32_t rc = EVP_DigestFinal(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t EVP_DigestFinalFast(void* p, void* p0, struct FastApiTypedArray* const p1, struct FastApiTypedArray* const p2) { - EVP_MD_CTX* v0 = reinterpret_cast(p0); - unsigned char* v1 = reinterpret_cast(p1->data); - unsigned int* v2 = reinterpret_cast(p2->data); - return EVP_DigestFinal(v0, v1, v2); -} -void EVP_sha1Slow(const FunctionCallbackInfo &args) { - - const EVP_MD* rc = EVP_sha1(); - Local ab = args[0].As()->Buffer(); - ((const EVP_MD**)ab->Data())[0] = rc; -} - -void EVP_sha1Fast(void* p, struct FastApiTypedArray* const p_ret) { - - const EVP_MD* r = EVP_sha1(); - ((const EVP_MD**)p_ret->data)[0] = r; - -} -void EVP_sha224Slow(const FunctionCallbackInfo &args) { - - const EVP_MD* rc = EVP_sha224(); - Local ab = args[0].As()->Buffer(); - ((const EVP_MD**)ab->Data())[0] = rc; -} - -void EVP_sha224Fast(void* p, struct FastApiTypedArray* const p_ret) { - - const EVP_MD* r = EVP_sha224(); - ((const EVP_MD**)p_ret->data)[0] = r; - -} -void EVP_sha256Slow(const FunctionCallbackInfo &args) { - - const EVP_MD* rc = EVP_sha256(); - Local ab = args[0].As()->Buffer(); - ((const EVP_MD**)ab->Data())[0] = rc; -} - -void EVP_sha256Fast(void* p, struct FastApiTypedArray* const p_ret) { - - const EVP_MD* r = EVP_sha256(); - ((const EVP_MD**)p_ret->data)[0] = r; - -} -void EVP_sha384Slow(const FunctionCallbackInfo &args) { - - const EVP_MD* rc = EVP_sha384(); - Local ab = args[0].As()->Buffer(); - ((const EVP_MD**)ab->Data())[0] = rc; -} - -void EVP_sha384Fast(void* p, struct FastApiTypedArray* const p_ret) { - - const EVP_MD* r = EVP_sha384(); - ((const EVP_MD**)p_ret->data)[0] = r; - -} -void EVP_sha512Slow(const FunctionCallbackInfo &args) { - - const EVP_MD* rc = EVP_sha512(); - Local ab = args[0].As()->Buffer(); - ((const EVP_MD**)ab->Data())[0] = rc; -} - -void EVP_sha512Fast(void* p, struct FastApiTypedArray* const p_ret) { - - const EVP_MD* r = EVP_sha512(); - ((const EVP_MD**)p_ret->data)[0] = r; - -} -void EVP_sha512_256Slow(const FunctionCallbackInfo &args) { - - const EVP_MD* rc = EVP_sha512_256(); - Local ab = args[0].As()->Buffer(); - ((const EVP_MD**)ab->Data())[0] = rc; -} - -void EVP_sha512_256Fast(void* p, struct FastApiTypedArray* const p_ret) { - - const EVP_MD* r = EVP_sha512_256(); - ((const EVP_MD**)p_ret->data)[0] = r; - -} -void EVP_DigestVerifyInitSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - EVP_MD_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - EVP_PKEY_CTX** v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - EVP_MD* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - ENGINE* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - EVP_PKEY* v4 = reinterpret_cast((uint64_t)Local::Cast(args[4])->Value()); - int32_t rc = EVP_DigestVerifyInit(v0, v1, v2, v3, v4); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t EVP_DigestVerifyInitFast(void* p, void* p0, void* p1, void* p2, void* p3, void* p4) { - EVP_MD_CTX* v0 = reinterpret_cast(p0); - EVP_PKEY_CTX** v1 = reinterpret_cast(p1); - EVP_MD* v2 = reinterpret_cast(p2); - ENGINE* v3 = reinterpret_cast(p3); - EVP_PKEY* v4 = reinterpret_cast(p4); - return EVP_DigestVerifyInit(v0, v1, v2, v3, v4); -} -void EVP_DigestSignInitSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - EVP_MD_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - EVP_PKEY_CTX** v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - EVP_MD* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - ENGINE* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - EVP_PKEY* v4 = reinterpret_cast((uint64_t)Local::Cast(args[4])->Value()); - int32_t rc = EVP_DigestSignInit(v0, v1, v2, v3, v4); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t EVP_DigestSignInitFast(void* p, void* p0, void* p1, void* p2, void* p3, void* p4) { - EVP_MD_CTX* v0 = reinterpret_cast(p0); - EVP_PKEY_CTX** v1 = reinterpret_cast(p1); - EVP_MD* v2 = reinterpret_cast(p2); - ENGINE* v3 = reinterpret_cast(p3); - EVP_PKEY* v4 = reinterpret_cast(p4); - return EVP_DigestSignInit(v0, v1, v2, v3, v4); -} -void BIO_s_memSlow(const FunctionCallbackInfo &args) { - - const BIO_METHOD* rc = BIO_s_mem(); - Local ab = args[0].As()->Buffer(); - ((const BIO_METHOD**)ab->Data())[0] = rc; -} - -void BIO_s_memFast(void* p, struct FastApiTypedArray* const p_ret) { - - const BIO_METHOD* r = BIO_s_mem(); - ((const BIO_METHOD**)p_ret->data)[0] = r; - -} -void BIO_newSlow(const FunctionCallbackInfo &args) { - BIO_METHOD* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - BIO * rc = BIO_new(v0); - Local ab = args[1].As()->Buffer(); - ((BIO **)ab->Data())[0] = rc; -} - -void BIO_newFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - BIO_METHOD* v0 = reinterpret_cast(p0); - BIO * r = BIO_new(v0); - ((BIO **)p_ret->data)[0] = r; - -} -void BIO_new_mem_bufSlow(const FunctionCallbackInfo &args) { - const void* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - BIO* rc = BIO_new_mem_buf(v0, v1); - Local ab = args[2].As()->Buffer(); - ((BIO**)ab->Data())[0] = rc; -} - -void BIO_new_mem_bufFast(void* p, void* p0, int32_t p1, struct FastApiTypedArray* const p_ret) { - const void* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - BIO* r = BIO_new_mem_buf(v0, v1); - ((BIO**)p_ret->data)[0] = r; - -} -void BIO_ctrlSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - BIO* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - uint64_t v2 = Local::Cast(args[2])->Value(); - void* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - int32_t rc = BIO_ctrl(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t BIO_ctrlFast(void* p, void* p0, int32_t p1, uint64_t p2, void* p3) { - BIO* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - uint64_t v2 = p2; - void* v3 = reinterpret_cast(p3); - return BIO_ctrl(v0, v1, v2, v3); -} -void BIO_readSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - BIO* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - void* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = BIO_read(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t BIO_readFast(void* p, void* p0, void* p1, int32_t p2) { - BIO* v0 = reinterpret_cast(p0); - void* v1 = reinterpret_cast(p1); - int32_t v2 = p2; - return BIO_read(v0, v1, v2); -} -void PEM_write_bio_PrivateKeySlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - BIO* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - EVP_PKEY* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - EVP_CIPHER* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - unsigned char* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - int32_t v4 = Local::Cast(args[4])->Value(); - pem_password_cb* v5 = reinterpret_cast((uint64_t)Local::Cast(args[5])->Value()); - void* v6 = reinterpret_cast((uint64_t)Local::Cast(args[6])->Value()); - int32_t rc = PEM_write_bio_PrivateKey(v0, v1, v2, v3, v4, v5, v6); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t PEM_write_bio_PrivateKeyFast(void* p, void* p0, void* p1, void* p2, void* p3, int32_t p4, void* p5, void* p6) { - BIO* v0 = reinterpret_cast(p0); - EVP_PKEY* v1 = reinterpret_cast(p1); - EVP_CIPHER* v2 = reinterpret_cast(p2); - unsigned char* v3 = reinterpret_cast(p3); - int32_t v4 = p4; - pem_password_cb* v5 = reinterpret_cast(p5); - void* v6 = reinterpret_cast(p6); - return PEM_write_bio_PrivateKey(v0, v1, v2, v3, v4, v5, v6); -} -void PEM_write_bio_PUBKEYSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - BIO* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - EVP_PKEY* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t rc = PEM_write_bio_PUBKEY(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t PEM_write_bio_PUBKEYFast(void* p, void* p0, void* p1) { - BIO* v0 = reinterpret_cast(p0); - EVP_PKEY* v1 = reinterpret_cast(p1); - return PEM_write_bio_PUBKEY(v0, v1); -} -void PEM_write_bio_X509_REQSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - BIO* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - X509_REQ* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t rc = PEM_write_bio_X509_REQ(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t PEM_write_bio_X509_REQFast(void* p, void* p0, void* p1) { - BIO* v0 = reinterpret_cast(p0); - X509_REQ* v1 = reinterpret_cast(p1); - return PEM_write_bio_X509_REQ(v0, v1); -} -void PEM_read_bio_X509Slow(const FunctionCallbackInfo &args) { - BIO* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - X509** v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - pem_password_cb* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - void* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - X509* rc = PEM_read_bio_X509(v0, v1, v2, v3); - Local ab = args[4].As()->Buffer(); - ((X509**)ab->Data())[0] = rc; -} - -void PEM_read_bio_X509Fast(void* p, void* p0, void* p1, void* p2, void* p3, struct FastApiTypedArray* const p_ret) { - BIO* v0 = reinterpret_cast(p0); - X509** v1 = reinterpret_cast(p1); - pem_password_cb* v2 = reinterpret_cast(p2); - void* v3 = reinterpret_cast(p3); - X509* r = PEM_read_bio_X509(v0, v1, v2, v3); - ((X509**)p_ret->data)[0] = r; - -} -void X509_get_subject_nameSlow(const FunctionCallbackInfo &args) { - const X509* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - X509_NAME* rc = X509_get_subject_name(v0); - Local ab = args[1].As()->Buffer(); - ((X509_NAME**)ab->Data())[0] = rc; -} - -void X509_get_subject_nameFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - const X509* v0 = reinterpret_cast(p0); - X509_NAME* r = X509_get_subject_name(v0); - ((X509_NAME**)p_ret->data)[0] = r; - -} -void X509_NAME_onelineSlow(const FunctionCallbackInfo &args) { - const X509_NAME* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t v2 = Local::Cast(args[2])->Value(); - char* rc = X509_NAME_oneline(v0, v1, v2); - Local ab = args[3].As()->Buffer(); - ((char**)ab->Data())[0] = rc; -} - -void X509_NAME_onelineFast(void* p, void* p0, void* p1, int32_t p2, struct FastApiTypedArray* const p_ret) { - const X509_NAME* v0 = reinterpret_cast(p0); - char* v1 = reinterpret_cast(p1); - int32_t v2 = p2; - char* r = X509_NAME_oneline(v0, v1, v2); - ((char**)p_ret->data)[0] = r; - -} -void X509_get_issuer_nameSlow(const FunctionCallbackInfo &args) { - const X509* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - X509_NAME* rc = X509_get_issuer_name(v0); - Local ab = args[1].As()->Buffer(); - ((X509_NAME**)ab->Data())[0] = rc; -} - -void X509_get_issuer_nameFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - const X509* v0 = reinterpret_cast(p0); - X509_NAME* r = X509_get_issuer_name(v0); - ((X509_NAME**)p_ret->data)[0] = r; - -} -void X509_freeSlow(const FunctionCallbackInfo &args) { - X509* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - X509_free(v0); -} - -void X509_freeFast(void* p, void* p0) { - X509* v0 = reinterpret_cast(p0); - X509_free(v0); -} -void X509_get_pubkeySlow(const FunctionCallbackInfo &args) { - X509* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - EVP_PKEY* rc = X509_get_pubkey(v0); - Local ab = args[1].As()->Buffer(); - ((EVP_PKEY**)ab->Data())[0] = rc; -} - -void X509_get_pubkeyFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - X509* v0 = reinterpret_cast(p0); - EVP_PKEY* r = X509_get_pubkey(v0); - ((EVP_PKEY**)p_ret->data)[0] = r; - -} -void X509_REQ_newSlow(const FunctionCallbackInfo &args) { - - X509_REQ* rc = X509_REQ_new(); - Local ab = args[0].As()->Buffer(); - ((X509_REQ**)ab->Data())[0] = rc; -} - -void X509_REQ_newFast(void* p, struct FastApiTypedArray* const p_ret) { - - X509_REQ* r = X509_REQ_new(); - ((X509_REQ**)p_ret->data)[0] = r; - -} -void X509_REQ_set_versionSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - X509_REQ* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = X509_REQ_set_version(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t X509_REQ_set_versionFast(void* p, void* p0, uint32_t p1) { - X509_REQ* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - return X509_REQ_set_version(v0, v1); -} -void X509_REQ_get_subject_nameSlow(const FunctionCallbackInfo &args) { - X509_REQ* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - X509_NAME* rc = X509_REQ_get_subject_name(v0); - Local ab = args[1].As()->Buffer(); - ((X509_NAME**)ab->Data())[0] = rc; -} - -void X509_REQ_get_subject_nameFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - X509_REQ* v0 = reinterpret_cast(p0); - X509_NAME* r = X509_REQ_get_subject_name(v0); - ((X509_NAME**)p_ret->data)[0] = r; - -} -void X509_NAME_add_entry_by_txtSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - X509_NAME* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t v2 = Local::Cast(args[2])->Value(); - const unsigned char* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - int32_t v4 = Local::Cast(args[4])->Value(); - int32_t v5 = Local::Cast(args[5])->Value(); - int32_t v6 = Local::Cast(args[6])->Value(); - int32_t rc = X509_NAME_add_entry_by_txt(v0, v1, v2, v3, v4, v5, v6); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t X509_NAME_add_entry_by_txtFast(void* p, void* p0, void* p1, int32_t p2, void* p3, int32_t p4, int32_t p5, int32_t p6) { - X509_NAME* v0 = reinterpret_cast(p0); - const char* v1 = reinterpret_cast(p1); - int32_t v2 = p2; - const unsigned char* v3 = reinterpret_cast(p3); - int32_t v4 = p4; - int32_t v5 = p5; - int32_t v6 = p6; - return X509_NAME_add_entry_by_txt(v0, v1, v2, v3, v4, v5, v6); -} -void X509_REQ_set_pubkeySlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - X509_REQ* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - EVP_PKEY* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t rc = X509_REQ_set_pubkey(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t X509_REQ_set_pubkeyFast(void* p, void* p0, void* p1) { - X509_REQ* v0 = reinterpret_cast(p0); - EVP_PKEY* v1 = reinterpret_cast(p1); - return X509_REQ_set_pubkey(v0, v1); -} -void X509_REQ_signSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - X509_REQ* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - EVP_PKEY* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - const EVP_MD* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - int32_t rc = X509_REQ_sign(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t X509_REQ_signFast(void* p, void* p0, void* p1, void* p2) { - X509_REQ* v0 = reinterpret_cast(p0); - EVP_PKEY* v1 = reinterpret_cast(p1); - const EVP_MD* v2 = reinterpret_cast(p2); - return X509_REQ_sign(v0, v1, v2); -} -void OBJ_txt2nidSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - const char* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = OBJ_txt2nid(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t OBJ_txt2nidFast(void* p, void* p0) { - const char* v0 = reinterpret_cast(p0); - return OBJ_txt2nid(v0); -} -void SSL_get_errorSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - const SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = SSL_get_error(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t SSL_get_errorFast(void* p, void* p0, int32_t p1) { - const SSL* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - return SSL_get_error(v0, v1); -} -void OPENSSL_init_sslSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - uint64_t v0 = Local::Cast(args[0])->Value(); - const OPENSSL_INIT_SETTINGS * v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t rc = OPENSSL_init_ssl(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t OPENSSL_init_sslFast(void* p, uint64_t p0, void* p1) { - uint64_t v0 = p0; - const OPENSSL_INIT_SETTINGS * v1 = reinterpret_cast(p1); - return OPENSSL_init_ssl(v0, v1); -} -void SSL_is_init_finishedSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - const SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = SSL_is_init_finished(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t SSL_is_init_finishedFast(void* p, void* p0) { - const SSL* v0 = reinterpret_cast(p0); - return SSL_is_init_finished(v0); -} -void SSL_shutdownSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = SSL_shutdown(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t SSL_shutdownFast(void* p, void* p0) { - SSL* v0 = reinterpret_cast(p0); - return SSL_shutdown(v0); -} -void SSL_get_servernameSlow(const FunctionCallbackInfo &args) { - const SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - const char* rc = SSL_get_servername(v0, v1); - Local ab = args[2].As()->Buffer(); - ((const char**)ab->Data())[0] = rc; -} - -void SSL_get_servernameFast(void* p, void* p0, int32_t p1, struct FastApiTypedArray* const p_ret) { - const SSL* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - const char* r = SSL_get_servername(v0, v1); - ((const char**)p_ret->data)[0] = r; - -} -void SSL_get_servername_typeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - const SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = SSL_get_servername_type(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t SSL_get_servername_typeFast(void* p, void* p0) { - const SSL* v0 = reinterpret_cast(p0); - return SSL_get_servername_type(v0); -} -void SSL_freeSlow(const FunctionCallbackInfo &args) { - SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - SSL_free(v0); -} - -void SSL_freeFast(void* p, void* p0) { - SSL* v0 = reinterpret_cast(p0); - SSL_free(v0); -} -void SSL_readSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - void* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = SSL_read(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t SSL_readFast(void* p, void* p0, void* p1, int32_t p2) { - SSL* v0 = reinterpret_cast(p0); - void* v1 = reinterpret_cast(p1); - int32_t v2 = p2; - return SSL_read(v0, v1, v2); -} -void SSL_writeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - void* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = SSL_write(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t SSL_writeFast(void* p, void* p0, void* p1, int32_t p2) { - SSL* v0 = reinterpret_cast(p0); - void* v1 = reinterpret_cast(p1); - int32_t v2 = p2; - return SSL_write(v0, v1, v2); -} -void SSL_get_versionSlow(const FunctionCallbackInfo &args) { - const SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const char* rc = SSL_get_version(v0); - Local ab = args[1].As()->Buffer(); - ((const char**)ab->Data())[0] = rc; -} - -void SSL_get_versionFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - const SSL* v0 = reinterpret_cast(p0); - const char* r = SSL_get_version(v0); - ((const char**)p_ret->data)[0] = r; - -} -void SSL_CIPHER_get_nameSlow(const FunctionCallbackInfo &args) { - const SSL_CIPHER* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const char* rc = SSL_CIPHER_get_name(v0); - Local ab = args[1].As()->Buffer(); - ((const char**)ab->Data())[0] = rc; -} - -void SSL_CIPHER_get_nameFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - const SSL_CIPHER* v0 = reinterpret_cast(p0); - const char* r = SSL_CIPHER_get_name(v0); - ((const char**)p_ret->data)[0] = r; - -} -void SSL_get_current_cipherSlow(const FunctionCallbackInfo &args) { - const SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const SSL_CIPHER* rc = SSL_get_current_cipher(v0); - Local ab = args[1].As()->Buffer(); - ((const SSL_CIPHER**)ab->Data())[0] = rc; -} - -void SSL_get_current_cipherFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - const SSL* v0 = reinterpret_cast(p0); - const SSL_CIPHER* r = SSL_get_current_cipher(v0); - ((const SSL_CIPHER**)p_ret->data)[0] = r; - -} -void SSL_get_peer_certificateSlow(const FunctionCallbackInfo &args) { - const SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - X509* rc = SSL_get_peer_certificate(v0); - Local ab = args[1].As()->Buffer(); - ((X509**)ab->Data())[0] = rc; -} - -void SSL_get_peer_certificateFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - const SSL* v0 = reinterpret_cast(p0); - X509* r = SSL_get_peer_certificate(v0); - ((X509**)p_ret->data)[0] = r; - -} -void SSL_set_SSL_CTXSlow(const FunctionCallbackInfo &args) { - SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - SSL_CTX* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - SSL_CTX* rc = SSL_set_SSL_CTX(v0, v1); - Local ab = args[2].As()->Buffer(); - ((SSL_CTX**)ab->Data())[0] = rc; -} - -void SSL_set_SSL_CTXFast(void* p, void* p0, void* p1, struct FastApiTypedArray* const p_ret) { - SSL* v0 = reinterpret_cast(p0); - SSL_CTX* v1 = reinterpret_cast(p1); - SSL_CTX* r = SSL_set_SSL_CTX(v0, v1); - ((SSL_CTX**)p_ret->data)[0] = r; - -} -void SSL_newSlow(const FunctionCallbackInfo &args) { - SSL_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - SSL* rc = SSL_new(v0); - Local ab = args[1].As()->Buffer(); - ((SSL**)ab->Data())[0] = rc; -} - -void SSL_newFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - SSL_CTX* v0 = reinterpret_cast(p0); - SSL* r = SSL_new(v0); - ((SSL**)p_ret->data)[0] = r; - -} -void SSL_set_fdSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = SSL_set_fd(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t SSL_set_fdFast(void* p, void* p0, int32_t p1) { - SSL* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - return SSL_set_fd(v0, v1); -} -void SSL_set_bioSlow(const FunctionCallbackInfo &args) { - SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - BIO* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - BIO* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - SSL_set_bio(v0, v1, v2); -} - -void SSL_set_bioFast(void* p, void* p0, void* p1, void* p2) { - SSL* v0 = reinterpret_cast(p0); - BIO* v1 = reinterpret_cast(p1); - BIO* v2 = reinterpret_cast(p2); - SSL_set_bio(v0, v1, v2); -} -void SSL_set_accept_stateSlow(const FunctionCallbackInfo &args) { - SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - SSL_set_accept_state(v0); -} - -void SSL_set_accept_stateFast(void* p, void* p0) { - SSL* v0 = reinterpret_cast(p0); - SSL_set_accept_state(v0); -} -void SSL_connectSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = SSL_connect(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t SSL_connectFast(void* p, void* p0) { - SSL* v0 = reinterpret_cast(p0); - return SSL_connect(v0); -} -void SSL_acceptSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = SSL_accept(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t SSL_acceptFast(void* p, void* p0) { - SSL* v0 = reinterpret_cast(p0); - return SSL_accept(v0); -} -void SSL_set_connect_stateSlow(const FunctionCallbackInfo &args) { - SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - SSL_set_connect_state(v0); -} - -void SSL_set_connect_stateFast(void* p, void* p0) { - SSL* v0 = reinterpret_cast(p0); - SSL_set_connect_state(v0); -} -void SSL_do_handshakeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = SSL_do_handshake(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t SSL_do_handshakeFast(void* p, void* p0) { - SSL* v0 = reinterpret_cast(p0); - return SSL_do_handshake(v0); -} -void SSL_CTX_newSlow(const FunctionCallbackInfo &args) { - SSL_METHOD* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - SSL_CTX* rc = SSL_CTX_new(v0); - Local ab = args[1].As()->Buffer(); - ((SSL_CTX**)ab->Data())[0] = rc; -} - -void SSL_CTX_newFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - SSL_METHOD* v0 = reinterpret_cast(p0); - SSL_CTX* r = SSL_CTX_new(v0); - ((SSL_CTX**)p_ret->data)[0] = r; - -} -void SSL_CTX_use_certificate_fileSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - SSL_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = SSL_CTX_use_certificate_file(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t SSL_CTX_use_certificate_fileFast(void* p, void* p0, void* p1, int32_t p2) { - SSL_CTX* v0 = reinterpret_cast(p0); - const char* v1 = reinterpret_cast(p1); - int32_t v2 = p2; - return SSL_CTX_use_certificate_file(v0, v1, v2); -} -void SSL_CTX_use_certificate_chain_fileSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - SSL_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t rc = SSL_CTX_use_certificate_chain_file(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t SSL_CTX_use_certificate_chain_fileFast(void* p, void* p0, void* p1) { - SSL_CTX* v0 = reinterpret_cast(p0); - const char* v1 = reinterpret_cast(p1); - return SSL_CTX_use_certificate_chain_file(v0, v1); -} -void SSL_CTX_use_PrivateKey_fileSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - SSL_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = SSL_CTX_use_PrivateKey_file(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t SSL_CTX_use_PrivateKey_fileFast(void* p, void* p0, void* p1, int32_t p2) { - SSL_CTX* v0 = reinterpret_cast(p0); - const char* v1 = reinterpret_cast(p1); - int32_t v2 = p2; - return SSL_CTX_use_PrivateKey_file(v0, v1, v2); -} -void SSL_CTX_set_optionsSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - SSL_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint64_t v1 = Local::Cast(args[1])->Value(); - uint64_t rc = SSL_CTX_set_options(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, static_cast(rc))); -} - -void SSL_CTX_set_optionsFast(void* p, void* p0, uint64_t p1, struct FastApiTypedArray* const p_ret) { - SSL_CTX* v0 = reinterpret_cast(p0); - uint64_t v1 = p1; - uint64_t r = SSL_CTX_set_options(v0, v1); - ((uint64_t*)p_ret->data)[0] = r; - -} -void SSL_CTX_set_cipher_listSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - SSL_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - int32_t rc = SSL_CTX_set_cipher_list(v0, *v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t SSL_CTX_set_cipher_listFast(void* p, void* p0, struct FastOneByteString* const p1) { - SSL_CTX* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - return SSL_CTX_set_cipher_list(v0, v1->data); -} -void SSL_set_cipher_listSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - int32_t rc = SSL_set_cipher_list(v0, *v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t SSL_set_cipher_listFast(void* p, void* p0, struct FastOneByteString* const p1) { - SSL* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - return SSL_set_cipher_list(v0, v1->data); -} -void SSL_CTX_freeSlow(const FunctionCallbackInfo &args) { - SSL_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - SSL_CTX_free(v0); -} - -void SSL_CTX_freeFast(void* p, void* p0) { - SSL_CTX* v0 = reinterpret_cast(p0); - SSL_CTX_free(v0); -} -void TLS_server_methodSlow(const FunctionCallbackInfo &args) { - - const SSL_METHOD* rc = TLS_server_method(); - Local ab = args[0].As()->Buffer(); - ((const SSL_METHOD**)ab->Data())[0] = rc; -} - -void TLS_server_methodFast(void* p, struct FastApiTypedArray* const p_ret) { - - const SSL_METHOD* r = TLS_server_method(); - ((const SSL_METHOD**)p_ret->data)[0] = r; - -} -void TLS_client_methodSlow(const FunctionCallbackInfo &args) { - - const SSL_METHOD* rc = TLS_client_method(); - Local ab = args[0].As()->Buffer(); - ((const SSL_METHOD**)ab->Data())[0] = rc; -} - -void TLS_client_methodFast(void* p, struct FastApiTypedArray* const p_ret) { - - const SSL_METHOD* r = TLS_client_method(); - ((const SSL_METHOD**)p_ret->data)[0] = r; - -} -void SSL_CTX_set_ciphersuitesSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - SSL_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - int32_t rc = SSL_CTX_set_ciphersuites(v0, *v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t SSL_CTX_set_ciphersuitesFast(void* p, void* p0, struct FastOneByteString* const p1) { - SSL_CTX* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - return SSL_CTX_set_ciphersuites(v0, v1->data); -} -void SSL_ctrlSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - SSL* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - uint64_t v2 = Local::Cast(args[2])->Value(); - void* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - uint64_t rc = SSL_ctrl(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, static_cast(rc))); -} - -void SSL_ctrlFast(void* p, void* p0, int32_t p1, uint64_t p2, void* p3, struct FastApiTypedArray* const p_ret) { - SSL* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - uint64_t v2 = p2; - void* v3 = reinterpret_cast(p3); - uint64_t r = SSL_ctrl(v0, v1, v2, v3); - ((uint64_t*)p_ret->data)[0] = r; - -} -void RSA_pkey_ctx_ctrlSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - EVP_PKEY_CTX* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t v3 = Local::Cast(args[3])->Value(); - void* v4 = reinterpret_cast((uint64_t)Local::Cast(args[4])->Value()); - int32_t rc = RSA_pkey_ctx_ctrl(v0, v1, v2, v3, v4); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t RSA_pkey_ctx_ctrlFast(void* p, void* p0, int32_t p1, int32_t p2, int32_t p3, void* p4) { - EVP_PKEY_CTX* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - int32_t v2 = p2; - int32_t v3 = p3; - void* v4 = reinterpret_cast(p4); - return RSA_pkey_ctx_ctrl(v0, v1, v2, v3, v4); -} -void EVP_sha512_224Slow(const FunctionCallbackInfo &args) { - - const EVP_MD* rc = EVP_sha512_224(); - Local ab = args[0].As()->Buffer(); - ((const EVP_MD**)ab->Data())[0] = rc; -} - -void EVP_sha512_224Fast(void* p, struct FastApiTypedArray* const p_ret) { - - const EVP_MD* r = EVP_sha512_224(); - ((const EVP_MD**)p_ret->data)[0] = r; - -} -void X509_newSlow(const FunctionCallbackInfo &args) { - - X509* rc = X509_new(); - Local ab = args[0].As()->Buffer(); - ((X509**)ab->Data())[0] = rc; -} - -void X509_newFast(void* p, struct FastApiTypedArray* const p_ret) { - - X509* r = X509_new(); - ((X509**)p_ret->data)[0] = r; - -} -void ASN1_INTEGER_setSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - ASN1_INTEGER* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = ASN1_INTEGER_set(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t ASN1_INTEGER_setFast(void* p, void* p0, int32_t p1) { - ASN1_INTEGER* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - return ASN1_INTEGER_set(v0, v1); -} -void X509_get_serialNumberSlow(const FunctionCallbackInfo &args) { - X509* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - ASN1_INTEGER* rc = X509_get_serialNumber(v0); - Local ab = args[1].As()->Buffer(); - ((ASN1_INTEGER**)ab->Data())[0] = rc; -} - -void X509_get_serialNumberFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - X509* v0 = reinterpret_cast(p0); - ASN1_INTEGER* r = X509_get_serialNumber(v0); - ((ASN1_INTEGER**)p_ret->data)[0] = r; - -} -void X509_time_adj_exSlow(const FunctionCallbackInfo &args) { - ASN1_TIME* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - uint32_t v2 = Local::Cast(args[2])->Value(); - time_t* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - ASN1_TIME* rc = X509_time_adj_ex(v0, v1, v2, v3); - Local ab = args[4].As()->Buffer(); - ((ASN1_TIME**)ab->Data())[0] = rc; -} - -void X509_time_adj_exFast(void* p, void* p0, int32_t p1, uint32_t p2, void* p3, struct FastApiTypedArray* const p_ret) { - ASN1_TIME* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - uint32_t v2 = p2; - time_t* v3 = reinterpret_cast(p3); - ASN1_TIME* r = X509_time_adj_ex(v0, v1, v2, v3); - ((ASN1_TIME**)p_ret->data)[0] = r; - -} -void X509_gmtime_adjSlow(const FunctionCallbackInfo &args) { - ASN1_TIME* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - ASN1_TIME* rc = X509_gmtime_adj(v0, v1); - Local ab = args[2].As()->Buffer(); - ((ASN1_TIME**)ab->Data())[0] = rc; -} - -void X509_gmtime_adjFast(void* p, void* p0, uint32_t p1, struct FastApiTypedArray* const p_ret) { - ASN1_TIME* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - ASN1_TIME* r = X509_gmtime_adj(v0, v1); - ((ASN1_TIME**)p_ret->data)[0] = r; - -} -void X509_getm_notBeforeSlow(const FunctionCallbackInfo &args) { - X509* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - ASN1_TIME* rc = X509_getm_notBefore(v0); - Local ab = args[1].As()->Buffer(); - ((ASN1_TIME**)ab->Data())[0] = rc; -} - -void X509_getm_notBeforeFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - X509* v0 = reinterpret_cast(p0); - ASN1_TIME* r = X509_getm_notBefore(v0); - ((ASN1_TIME**)p_ret->data)[0] = r; - -} -void X509_getm_notAfterSlow(const FunctionCallbackInfo &args) { - X509* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - ASN1_TIME* rc = X509_getm_notAfter(v0); - Local ab = args[1].As()->Buffer(); - ((ASN1_TIME**)ab->Data())[0] = rc; -} - -void X509_getm_notAfterFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - X509* v0 = reinterpret_cast(p0); - ASN1_TIME* r = X509_getm_notAfter(v0); - ((ASN1_TIME**)p_ret->data)[0] = r; - -} -void X509_set_pubkeySlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - X509* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - EVP_PKEY* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t rc = X509_set_pubkey(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t X509_set_pubkeyFast(void* p, void* p0, void* p1) { - X509* v0 = reinterpret_cast(p0); - EVP_PKEY* v1 = reinterpret_cast(p1); - return X509_set_pubkey(v0, v1); -} -void X509_signSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - X509* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - EVP_PKEY* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - const EVP_MD * v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - int32_t rc = X509_sign(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t X509_signFast(void* p, void* p0, void* p1, void* p2) { - X509* v0 = reinterpret_cast(p0); - EVP_PKEY* v1 = reinterpret_cast(p1); - const EVP_MD * v2 = reinterpret_cast(p2); - return X509_sign(v0, v1, v2); -} -void PEM_write_bio_X509Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - BIO* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - X509* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t rc = PEM_write_bio_X509(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t PEM_write_bio_X509Fast(void* p, void* p0, void* p1) { - BIO* v0 = reinterpret_cast(p0); - X509* v1 = reinterpret_cast(p1); - return PEM_write_bio_X509(v0, v1); -} -void X509_set_issuer_nameSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - X509* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const X509_NAME* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t rc = X509_set_issuer_name(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t X509_set_issuer_nameFast(void* p, void* p0, void* p1) { - X509* v0 = reinterpret_cast(p0); - const X509_NAME* v1 = reinterpret_cast(p1); - return X509_set_issuer_name(v0, v1); -} - -void Init(Isolate* isolate, Local target) { - Local module = ObjectTemplate::New(isolate); - SET_FAST_METHOD(isolate, module, "OpenSSL_version", &pFOpenSSL_version, OpenSSL_versionSlow); - SET_FAST_METHOD(isolate, module, "EVP_PKEY_CTX_new_id", &pFEVP_PKEY_CTX_new_id, EVP_PKEY_CTX_new_idSlow); - SET_FAST_METHOD(isolate, module, "EVP_PKEY_keygen_init", &pFEVP_PKEY_keygen_init, EVP_PKEY_keygen_initSlow); - SET_FAST_METHOD(isolate, module, "EVP_PKEY_keygen", &pFEVP_PKEY_keygen, EVP_PKEY_keygenSlow); - SET_FAST_METHOD(isolate, module, "EVP_PKEY_new", &pFEVP_PKEY_new, EVP_PKEY_newSlow); - SET_FAST_METHOD(isolate, module, "EVP_PKEY_id", &pFEVP_PKEY_id, EVP_PKEY_idSlow); - SET_FAST_METHOD(isolate, module, "EVP_PKEY_type", &pFEVP_PKEY_type, EVP_PKEY_typeSlow); - SET_FAST_METHOD(isolate, module, "EVP_PKEY_free", &pFEVP_PKEY_free, EVP_PKEY_freeSlow); - SET_FAST_METHOD(isolate, module, "EVP_PKEY_CTX_free", &pFEVP_PKEY_CTX_free, EVP_PKEY_CTX_freeSlow); - SET_FAST_METHOD(isolate, module, "EVP_MD_CTX_new", &pFEVP_MD_CTX_new, EVP_MD_CTX_newSlow); - SET_FAST_METHOD(isolate, module, "EVP_MD_CTX_reset", &pFEVP_MD_CTX_reset, EVP_MD_CTX_resetSlow); - SET_FAST_METHOD(isolate, module, "EVP_MD_CTX_free", &pFEVP_MD_CTX_free, EVP_MD_CTX_freeSlow); - SET_FAST_METHOD(isolate, module, "EVP_get_digestbynid", &pFEVP_get_digestbynid, EVP_get_digestbynidSlow); - SET_FAST_METHOD(isolate, module, "EVP_get_digestbyname", &pFEVP_get_digestbyname, EVP_get_digestbynameSlow); - SET_FAST_METHOD(isolate, module, "EVP_Digest", &pFEVP_Digest, EVP_DigestSlow); - SET_FAST_METHOD(isolate, module, "EVP_DigestInit_ex", &pFEVP_DigestInit_ex, EVP_DigestInit_exSlow); - SET_FAST_METHOD(isolate, module, "EVP_DigestUpdate", &pFEVP_DigestUpdate, EVP_DigestUpdateSlow); - SET_FAST_METHOD(isolate, module, "EVP_DigestUpdateBuffer", &pFEVP_DigestUpdateBuffer, EVP_DigestUpdateBufferSlow); - SET_FAST_METHOD(isolate, module, "EVP_DigestUpdateString", &pFEVP_DigestUpdateString, EVP_DigestUpdateStringSlow); - SET_FAST_METHOD(isolate, module, "EVP_DigestVerifyFinal", &pFEVP_DigestVerifyFinal, EVP_DigestVerifyFinalSlow); - SET_FAST_METHOD(isolate, module, "EVP_DigestSignFinal", &pFEVP_DigestSignFinal, EVP_DigestSignFinalSlow); - SET_FAST_METHOD(isolate, module, "EVP_DigestFinal", &pFEVP_DigestFinal, EVP_DigestFinalSlow); - SET_FAST_METHOD(isolate, module, "EVP_sha1", &pFEVP_sha1, EVP_sha1Slow); - SET_FAST_METHOD(isolate, module, "EVP_sha224", &pFEVP_sha224, EVP_sha224Slow); - SET_FAST_METHOD(isolate, module, "EVP_sha256", &pFEVP_sha256, EVP_sha256Slow); - SET_FAST_METHOD(isolate, module, "EVP_sha384", &pFEVP_sha384, EVP_sha384Slow); - SET_FAST_METHOD(isolate, module, "EVP_sha512", &pFEVP_sha512, EVP_sha512Slow); - SET_FAST_METHOD(isolate, module, "EVP_sha512_256", &pFEVP_sha512_256, EVP_sha512_256Slow); - SET_FAST_METHOD(isolate, module, "EVP_DigestVerifyInit", &pFEVP_DigestVerifyInit, EVP_DigestVerifyInitSlow); - SET_FAST_METHOD(isolate, module, "EVP_DigestSignInit", &pFEVP_DigestSignInit, EVP_DigestSignInitSlow); - SET_FAST_METHOD(isolate, module, "BIO_s_mem", &pFBIO_s_mem, BIO_s_memSlow); - SET_FAST_METHOD(isolate, module, "BIO_new", &pFBIO_new, BIO_newSlow); - SET_FAST_METHOD(isolate, module, "BIO_new_mem_buf", &pFBIO_new_mem_buf, BIO_new_mem_bufSlow); - SET_FAST_METHOD(isolate, module, "BIO_ctrl", &pFBIO_ctrl, BIO_ctrlSlow); - SET_FAST_METHOD(isolate, module, "BIO_read", &pFBIO_read, BIO_readSlow); - SET_FAST_METHOD(isolate, module, "PEM_write_bio_PrivateKey", &pFPEM_write_bio_PrivateKey, PEM_write_bio_PrivateKeySlow); - SET_FAST_METHOD(isolate, module, "PEM_write_bio_PUBKEY", &pFPEM_write_bio_PUBKEY, PEM_write_bio_PUBKEYSlow); - SET_FAST_METHOD(isolate, module, "PEM_write_bio_X509_REQ", &pFPEM_write_bio_X509_REQ, PEM_write_bio_X509_REQSlow); - SET_FAST_METHOD(isolate, module, "PEM_read_bio_X509", &pFPEM_read_bio_X509, PEM_read_bio_X509Slow); - SET_FAST_METHOD(isolate, module, "X509_get_subject_name", &pFX509_get_subject_name, X509_get_subject_nameSlow); - SET_FAST_METHOD(isolate, module, "X509_NAME_oneline", &pFX509_NAME_oneline, X509_NAME_onelineSlow); - SET_FAST_METHOD(isolate, module, "X509_get_issuer_name", &pFX509_get_issuer_name, X509_get_issuer_nameSlow); - SET_FAST_METHOD(isolate, module, "X509_free", &pFX509_free, X509_freeSlow); - SET_FAST_METHOD(isolate, module, "X509_get_pubkey", &pFX509_get_pubkey, X509_get_pubkeySlow); - SET_FAST_METHOD(isolate, module, "X509_REQ_new", &pFX509_REQ_new, X509_REQ_newSlow); - SET_FAST_METHOD(isolate, module, "X509_REQ_set_version", &pFX509_REQ_set_version, X509_REQ_set_versionSlow); - SET_FAST_METHOD(isolate, module, "X509_REQ_get_subject_name", &pFX509_REQ_get_subject_name, X509_REQ_get_subject_nameSlow); - SET_FAST_METHOD(isolate, module, "X509_NAME_add_entry_by_txt", &pFX509_NAME_add_entry_by_txt, X509_NAME_add_entry_by_txtSlow); - SET_FAST_METHOD(isolate, module, "X509_REQ_set_pubkey", &pFX509_REQ_set_pubkey, X509_REQ_set_pubkeySlow); - SET_FAST_METHOD(isolate, module, "X509_REQ_sign", &pFX509_REQ_sign, X509_REQ_signSlow); - SET_FAST_METHOD(isolate, module, "OBJ_txt2nid", &pFOBJ_txt2nid, OBJ_txt2nidSlow); - SET_FAST_METHOD(isolate, module, "SSL_get_error", &pFSSL_get_error, SSL_get_errorSlow); - SET_FAST_METHOD(isolate, module, "OPENSSL_init_ssl", &pFOPENSSL_init_ssl, OPENSSL_init_sslSlow); - SET_FAST_METHOD(isolate, module, "SSL_is_init_finished", &pFSSL_is_init_finished, SSL_is_init_finishedSlow); - SET_FAST_METHOD(isolate, module, "SSL_shutdown", &pFSSL_shutdown, SSL_shutdownSlow); - SET_FAST_METHOD(isolate, module, "SSL_get_servername", &pFSSL_get_servername, SSL_get_servernameSlow); - SET_FAST_METHOD(isolate, module, "SSL_get_servername_type", &pFSSL_get_servername_type, SSL_get_servername_typeSlow); - SET_FAST_METHOD(isolate, module, "SSL_free", &pFSSL_free, SSL_freeSlow); - SET_FAST_METHOD(isolate, module, "SSL_read", &pFSSL_read, SSL_readSlow); - SET_FAST_METHOD(isolate, module, "SSL_write", &pFSSL_write, SSL_writeSlow); - SET_FAST_METHOD(isolate, module, "SSL_get_version", &pFSSL_get_version, SSL_get_versionSlow); - SET_FAST_METHOD(isolate, module, "SSL_CIPHER_get_name", &pFSSL_CIPHER_get_name, SSL_CIPHER_get_nameSlow); - SET_FAST_METHOD(isolate, module, "SSL_get_current_cipher", &pFSSL_get_current_cipher, SSL_get_current_cipherSlow); - SET_FAST_METHOD(isolate, module, "SSL_get_peer_certificate", &pFSSL_get_peer_certificate, SSL_get_peer_certificateSlow); - SET_FAST_METHOD(isolate, module, "SSL_set_SSL_CTX", &pFSSL_set_SSL_CTX, SSL_set_SSL_CTXSlow); - SET_FAST_METHOD(isolate, module, "SSL_new", &pFSSL_new, SSL_newSlow); - SET_FAST_METHOD(isolate, module, "SSL_set_fd", &pFSSL_set_fd, SSL_set_fdSlow); - SET_FAST_METHOD(isolate, module, "SSL_set_bio", &pFSSL_set_bio, SSL_set_bioSlow); - SET_FAST_METHOD(isolate, module, "SSL_set_accept_state", &pFSSL_set_accept_state, SSL_set_accept_stateSlow); - SET_FAST_METHOD(isolate, module, "SSL_connect", &pFSSL_connect, SSL_connectSlow); - SET_FAST_METHOD(isolate, module, "SSL_accept", &pFSSL_accept, SSL_acceptSlow); - SET_FAST_METHOD(isolate, module, "SSL_set_connect_state", &pFSSL_set_connect_state, SSL_set_connect_stateSlow); - SET_FAST_METHOD(isolate, module, "SSL_do_handshake", &pFSSL_do_handshake, SSL_do_handshakeSlow); - SET_FAST_METHOD(isolate, module, "SSL_CTX_new", &pFSSL_CTX_new, SSL_CTX_newSlow); - SET_FAST_METHOD(isolate, module, "SSL_CTX_use_certificate_file", &pFSSL_CTX_use_certificate_file, SSL_CTX_use_certificate_fileSlow); - SET_FAST_METHOD(isolate, module, "SSL_CTX_use_certificate_chain_file", &pFSSL_CTX_use_certificate_chain_file, SSL_CTX_use_certificate_chain_fileSlow); - SET_FAST_METHOD(isolate, module, "SSL_CTX_use_PrivateKey_file", &pFSSL_CTX_use_PrivateKey_file, SSL_CTX_use_PrivateKey_fileSlow); - SET_FAST_METHOD(isolate, module, "SSL_CTX_set_options", &pFSSL_CTX_set_options, SSL_CTX_set_optionsSlow); - SET_FAST_METHOD(isolate, module, "SSL_CTX_set_cipher_list", &pFSSL_CTX_set_cipher_list, SSL_CTX_set_cipher_listSlow); - SET_FAST_METHOD(isolate, module, "SSL_set_cipher_list", &pFSSL_set_cipher_list, SSL_set_cipher_listSlow); - SET_FAST_METHOD(isolate, module, "SSL_CTX_free", &pFSSL_CTX_free, SSL_CTX_freeSlow); - SET_FAST_METHOD(isolate, module, "TLS_server_method", &pFTLS_server_method, TLS_server_methodSlow); - SET_FAST_METHOD(isolate, module, "TLS_client_method", &pFTLS_client_method, TLS_client_methodSlow); - SET_FAST_METHOD(isolate, module, "SSL_CTX_set_ciphersuites", &pFSSL_CTX_set_ciphersuites, SSL_CTX_set_ciphersuitesSlow); - SET_FAST_METHOD(isolate, module, "SSL_ctrl", &pFSSL_ctrl, SSL_ctrlSlow); - SET_FAST_METHOD(isolate, module, "RSA_pkey_ctx_ctrl", &pFRSA_pkey_ctx_ctrl, RSA_pkey_ctx_ctrlSlow); - SET_FAST_METHOD(isolate, module, "EVP_sha512_224", &pFEVP_sha512_224, EVP_sha512_224Slow); - SET_FAST_METHOD(isolate, module, "X509_new", &pFX509_new, X509_newSlow); - SET_FAST_METHOD(isolate, module, "ASN1_INTEGER_set", &pFASN1_INTEGER_set, ASN1_INTEGER_setSlow); - SET_FAST_METHOD(isolate, module, "X509_get_serialNumber", &pFX509_get_serialNumber, X509_get_serialNumberSlow); - SET_FAST_METHOD(isolate, module, "X509_time_adj_ex", &pFX509_time_adj_ex, X509_time_adj_exSlow); - SET_FAST_METHOD(isolate, module, "X509_gmtime_adj", &pFX509_gmtime_adj, X509_gmtime_adjSlow); - SET_FAST_METHOD(isolate, module, "X509_getm_notBefore", &pFX509_getm_notBefore, X509_getm_notBeforeSlow); - SET_FAST_METHOD(isolate, module, "X509_getm_notAfter", &pFX509_getm_notAfter, X509_getm_notAfterSlow); - SET_FAST_METHOD(isolate, module, "X509_set_pubkey", &pFX509_set_pubkey, X509_set_pubkeySlow); - SET_FAST_METHOD(isolate, module, "X509_sign", &pFX509_sign, X509_signSlow); - SET_FAST_METHOD(isolate, module, "PEM_write_bio_X509", &pFPEM_write_bio_X509, PEM_write_bio_X509Slow); - SET_FAST_METHOD(isolate, module, "X509_set_issuer_name", &pFX509_set_issuer_name, X509_set_issuer_nameSlow); - - SET_VALUE(isolate, module, "SSL_OP_ALL", BigInt::New(isolate, SSL_OP_ALL)); - SET_VALUE(isolate, module, "SSL_OP_NO_RENEGOTIATION", BigInt::New(isolate, SSL_OP_NO_RENEGOTIATION)); - SET_VALUE(isolate, module, "SSL_OP_NO_SSLv3", BigInt::New(isolate, SSL_OP_NO_SSLv3)); - SET_VALUE(isolate, module, "SSL_OP_NO_TLSv1", BigInt::New(isolate, SSL_OP_NO_TLSv1)); - SET_VALUE(isolate, module, "SSL_OP_NO_TLSv1_1", BigInt::New(isolate, SSL_OP_NO_TLSv1_1)); - SET_VALUE(isolate, module, "SSL_OP_NO_DTLSv1", BigInt::New(isolate, SSL_OP_NO_DTLSv1)); - SET_VALUE(isolate, module, "SSL_OP_NO_DTLSv1_2", BigInt::New(isolate, SSL_OP_NO_DTLSv1_2)); - SET_VALUE(isolate, module, "SSL_OP_NO_TLSv1_2", BigInt::New(isolate, SSL_OP_NO_TLSv1_2)); - SET_VALUE(isolate, module, "SSL_OP_NO_SSLv2", BigInt::New(isolate, SSL_OP_NO_SSLv2)); - SET_VALUE(isolate, module, "SSL_OP_NO_COMPRESSION", BigInt::New(isolate, SSL_OP_NO_COMPRESSION)); - SET_VALUE(isolate, module, "OPENSSL_VERSION_MAJOR", Integer::New(isolate, OPENSSL_VERSION_MAJOR)); - SET_VALUE(isolate, module, "SSL_ERROR_WANT_READ", Integer::New(isolate, SSL_ERROR_WANT_READ)); - SET_VALUE(isolate, module, "SSL_ERROR_WANT_WRITE", Integer::New(isolate, SSL_ERROR_WANT_WRITE)); - SET_VALUE(isolate, module, "SSL_ERROR_SSL", Integer::New(isolate, SSL_ERROR_SSL)); - SET_VALUE(isolate, module, "SSL_ERROR_WANT_X509_LOOKUP", Integer::New(isolate, SSL_ERROR_WANT_X509_LOOKUP)); - SET_VALUE(isolate, module, "SSL_ERROR_WANT_CONNECT", Integer::New(isolate, SSL_ERROR_WANT_CONNECT)); - SET_VALUE(isolate, module, "SSL_ERROR_WANT_ACCEPT", Integer::New(isolate, SSL_ERROR_WANT_ACCEPT)); - SET_VALUE(isolate, module, "EVP_PKEY_RSA", Integer::New(isolate, EVP_PKEY_RSA)); - SET_VALUE(isolate, module, "EVP_PKEY_OP_KEYGEN", Integer::New(isolate, EVP_PKEY_OP_KEYGEN)); - SET_VALUE(isolate, module, "EVP_PKEY_CTRL_RSA_KEYGEN_BITS", Integer::New(isolate, EVP_PKEY_CTRL_RSA_KEYGEN_BITS)); - SET_VALUE(isolate, module, "BIO_CTRL_PENDING", Integer::New(isolate, BIO_CTRL_PENDING)); - SET_VALUE(isolate, module, "SSL_FILETYPE_PEM", Integer::New(isolate, SSL_FILETYPE_PEM)); - - - SET_MODULE(isolate, target, "libssl", module); -} -} // namespace libssl -} // namespace lo - -extern "C" { - void* _register_libssl() { - return (void*)lo::libssl::Init; - } -} diff --git a/lib/loop.js b/lib/loop.js index 7e0a6c9..0f39c6f 100644 --- a/lib/loop.js +++ b/lib/loop.js @@ -1,27 +1,127 @@ -const { epoll } = lo.load('epoll') +const { assert, core } = lo +const { os } = core + +let Loop + +if (os === 'mac') { + +const { kevents } = lo.load('kevents') +const { ptr, assert, core } = lo +const { close, EAGAIN } = core +const { + kqueue, kevent, + EVFILT_READ, EV_ADD, EV_ENABLE, EV_ERROR, EV_DELETE, EVFILT_WRITE, + struct_timespec_size +} = kevents + +const EVENT_SIZE = 8 +const empty_timespec = ptr(new Uint8Array(struct_timespec_size)) + +function event (ident, filter, flags = 0, data) { + const event = ptr(new Uint32Array(8)) + const view = new DataView(event.buffer) + view.setUint32(0, ident, true) + if (filter !== 0) view.setInt16(8, filter, true) + if (flags !== 0) view.setUint16(10, flags, true) + if (data) { + view.setBigUint64(16, BigInt(data), true) + } + return event +} + +function events (nevents = 1024) { + return ptr(new Uint32Array(EVENT_SIZE * nevents)) +} + +const noop = () => {} + +class MacLoop { + #size = 0 + + constructor (nevents = 4096, flags = 0) { + this.maxEvents = nevents + this.events = events(nevents) + this.fd = assert(kqueue()) + this.callbacks = {} + this.errors = {} + this.handles = {} + } + + get size () { + return this.#size + } + + add (fd, callback, flags = EVFILT_READ, onerror = noop) { + const set = event(fd, flags, EV_ADD | EV_ENABLE) + assert(kevent(this.fd, set.ptr, 1, 0, 0, 0) === 0) + this.callbacks[fd] = callback + if (onerror) this.errors[fd] = onerror + this.#size++ + } + + add_data (fd, callback, flags = EVFILT_READ, data, onerror = noop) { + const set = event(fd, flags, EV_ADD | EV_ENABLE, data) + assert(kevent(this.fd, set.ptr, 1, 0, 0, 0) === 0) + this.callbacks[fd] = callback + if (onerror) this.errors[fd] = onerror + this.#size++ + } + + modify (fd, flags = EVFILT_READ, callback = this.handles[fd], onerror = noop) { + return this.add(fd, callback, flags, onerror) + } + remove (fd, flags = EVFILT_READ) { + const set = event(fd, flags, EV_DELETE) + assert(kevent(this.fd, set.ptr, 1, 0, 0, 0) === 0) + delete this.callbacks[fd] + delete this.errors[fd] + this.#size-- + } + + poll (timeout = -1) { + if (this.#size === 0) return 0 + const { fd, maxEvents, events, callbacks, errors } = this + const n = kevent(fd, 0, 0, events.ptr, maxEvents, timeout === -1 ? 0 : empty_timespec.ptr) + let off = 0 + for (let i = 0; i < n; i++) { + const mask = events[off + 2] + if ((mask && 0xff) === EV_ERROR) { + const fd = events[off] + errors[fd](fd, mask) + close(fd) + delete callbacks[fd] + delete errors[fd] + this.#size-- + off += 8 + continue + } + const fd = events[off] + callbacks[fd](fd) + off += 8 + } + return n + } +} + +MacLoop.Readable = EVFILT_READ +MacLoop.Writable = EVFILT_WRITE +MacLoop.ReadableWritable = MacLoop.Readable | MacLoop.Writable +MacLoop.EdgeTriggered = 0 +MacLoop.Blocked = EAGAIN + +Loop = MacLoop + +} else if (os === 'linux') { + +const { epoll } = lo.load('epoll') const { create, wait, modify, close } = epoll -const EPOLLIN = 0x1 -const EPOLLOUT = 0x4 -const EPOLLERR = 0x8 -const EPOLLHUP = 0x10 -const EPOLL_CLOEXEC = 524288 -const EPOLLEXCLUSIVE = 1 << 28 -const EPOLLWAKEUP = 1 << 29 -const EPOLLONESHOT = 1 << 30 -const EPOLLET = 1 << 31 -const EPOLL_CTL_ADD = 1 -const EPOLL_CTL_DEL = 2 -const EPOLL_CTL_MOD = 3 -const EVENT_SIZE = 12 -const EAGAIN = 11 - -epoll.constants = { +const { EPOLLIN, EPOLLOUT, EPOLLERR, EPOLLHUP, EPOLL_CLOEXEC, EPOLLEXCLUSIVE, EPOLLWAKEUP, EPOLLONESHOT, EPOLLET, EPOLL_CTL_ADD, EPOLL_CTL_DEL, - EPOLL_CTL_MOD, EAGAIN -} + EPOLL_CTL_MOD, EAGAIN, EVENT_SIZE +} = epoll function event (fd, mask = EPOLLIN | EPOLLOUT) { const buf = new ArrayBuffer(EVENT_SIZE) @@ -44,7 +144,7 @@ epoll.types = { const noop = () => {} const nullptr = new Uint8Array(8) -class Loop { +class UnixLoop { #size = 0 constructor (nevents = 4096, flags = EPOLL_CLOEXEC) { @@ -86,6 +186,7 @@ class Loop { } poll (timeout = -1) { + if (this.#size === 0) return 0 const { fd, maxEvents, events, callbacks, errors } = this const n = wait(fd, events, maxEvents, timeout) let off = 0 @@ -108,10 +209,14 @@ class Loop { } } -Loop.Readable = EPOLLIN -Loop.Writable = EPOLLOUT -Loop.ReadableWritable = EPOLLIN | EPOLLOUT -Loop.EdgeTriggered = EPOLLET -Loop.Blocked = EAGAIN +UnixLoop.Readable = EPOLLIN +UnixLoop.Writable = EPOLLOUT +UnixLoop.ReadableWritable = EPOLLIN | EPOLLOUT +UnixLoop.EdgeTriggered = EPOLLET +UnixLoop.Blocked = EAGAIN + +Loop = UnixLoop + +} export { Loop } diff --git a/lib/lz4/lz4.cc b/lib/lz4/lz4.cc deleted file mode 100644 index c1d8203..0000000 --- a/lib/lz4/lz4.cc +++ /dev/null @@ -1,177 +0,0 @@ - -// [do not edit,] -// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile -#include -#include -#include - -namespace lo { -namespace lz4 { - -using v8::String; -using v8::FunctionCallbackInfo; -using v8::Array; -using v8::Local; -using v8::ObjectTemplate; -using v8::Isolate; -using v8::Value; -using v8::Uint32Array; -using v8::ArrayBuffer; -using v8::Context; -using v8::Integer; -using v8::Function; -using v8::NewStringType; -using v8::Object; -using v8::BackingStore; -using v8::TryCatch; -using v8::ScriptCompiler; -using v8::Module; -using v8::FixedArray; -using v8::ScriptOrigin; -using v8::SharedArrayBuffer; -using v8::MaybeLocal; -using v8::HandleScope; -using v8::Promise; -using v8::Number; -using v8::StackTrace; -using v8::Message; -using v8::StackFrame; -using v8::Maybe; -using v8::FunctionTemplate; -using v8::FunctionCallback; -using v8::PromiseRejectMessage; -using v8::CFunction; -using v8::Global; -using v8::Exception; -using v8::CTypeInfo; -using v8::PropertyAttribute; -using v8::Signature; -using v8::ConstructorBehavior; -using v8::SideEffectType; -using v8::kPromiseRejectAfterResolved; -using v8::kPromiseResolveAfterResolved; -using v8::kPromiseHandlerAddedAfterReject; -using v8::Data; -using v8::PrimitiveArray; -using v8::TypedArray; -using v8::Uint8Array; -using v8::Boolean; -using v8::ModuleRequest; -using v8::CFunctionInfo; -using v8::OOMDetails; -using v8::V8; -using v8::BigInt; - - - -int32_t compress_defaultFast(void* p, void* p0, void* p1, int32_t p2, int32_t p3); -v8::CTypeInfo cargscompress_default[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rccompress_default = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infocompress_default = v8::CFunctionInfo(rccompress_default, 5, cargscompress_default); -v8::CFunction pFcompress_default = v8::CFunction((const void*)&compress_defaultFast, &infocompress_default); - -int32_t compress_hcFast(void* p, void* p0, void* p1, int32_t p2, int32_t p3, int32_t p4); -v8::CTypeInfo cargscompress_hc[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rccompress_hc = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infocompress_hc = v8::CFunctionInfo(rccompress_hc, 6, cargscompress_hc); -v8::CFunction pFcompress_hc = v8::CFunction((const void*)&compress_hcFast, &infocompress_hc); - -int32_t decompress_safeFast(void* p, void* p0, void* p1, int32_t p2, int32_t p3); -v8::CTypeInfo cargsdecompress_safe[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcdecompress_safe = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infodecompress_safe = v8::CFunctionInfo(rcdecompress_safe, 5, cargsdecompress_safe); -v8::CFunction pFdecompress_safe = v8::CFunction((const void*)&decompress_safeFast, &infodecompress_safe); - - - -void compress_defaultSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - const char* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t v3 = Local::Cast(args[3])->Value(); - int32_t rc = LZ4_compress_default(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t compress_defaultFast(void* p, void* p0, void* p1, int32_t p2, int32_t p3) { - const char* v0 = reinterpret_cast(p0); - char* v1 = reinterpret_cast(p1); - int32_t v2 = p2; - int32_t v3 = p3; - return LZ4_compress_default(v0, v1, v2, v3); -} -void compress_hcSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - const char* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t v3 = Local::Cast(args[3])->Value(); - int32_t v4 = Local::Cast(args[4])->Value(); - int32_t rc = LZ4_compress_HC(v0, v1, v2, v3, v4); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t compress_hcFast(void* p, void* p0, void* p1, int32_t p2, int32_t p3, int32_t p4) { - const char* v0 = reinterpret_cast(p0); - char* v1 = reinterpret_cast(p1); - int32_t v2 = p2; - int32_t v3 = p3; - int32_t v4 = p4; - return LZ4_compress_HC(v0, v1, v2, v3, v4); -} -void decompress_safeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - const char* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t v3 = Local::Cast(args[3])->Value(); - int32_t rc = LZ4_decompress_safe(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t decompress_safeFast(void* p, void* p0, void* p1, int32_t p2, int32_t p3) { - const char* v0 = reinterpret_cast(p0); - char* v1 = reinterpret_cast(p1); - int32_t v2 = p2; - int32_t v3 = p3; - return LZ4_decompress_safe(v0, v1, v2, v3); -} - -void Init(Isolate* isolate, Local target) { - Local module = ObjectTemplate::New(isolate); - SET_FAST_METHOD(isolate, module, "compress_default", &pFcompress_default, compress_defaultSlow); - SET_FAST_METHOD(isolate, module, "compress_hc", &pFcompress_hc, compress_hcSlow); - SET_FAST_METHOD(isolate, module, "decompress_safe", &pFdecompress_safe, decompress_safeSlow); - - - - SET_MODULE(isolate, target, "lz4", module); -} -} // namespace lz4 -} // namespace lo - -extern "C" { - void* _register_lz4() { - return (void*)lo::lz4::Init; - } -} diff --git a/lib/mach/api.js b/lib/mach/api.js new file mode 100644 index 0000000..f5a63b8 --- /dev/null +++ b/lib/mach/api.js @@ -0,0 +1,32 @@ +const api = { + task_info: { + parameters: ['u32', 'i32', 'pointer', 'pointer'], + pointers: [, , 'task_info_t', 'mach_msg_type_number_t*'], + result: 'i32' + }, + task_self: { + parameters: [], + result: 'u32', + name: 'mach_task_self' + }, + get_executable_path: { + parameters: ['pointer', 'u32array'], + pointers: ['char*', 'uint32_t*'], + result: 'i32', + name: '_NSGetExecutablePath' + } +} + +const preamble = '' + +const name = 'mach' + +const constants = { + TASK_BASIC_INFO_COUNT: 'i32', + KERN_SUCCESS: 'i32', + TASK_BASIC_INFO: 'i32' +} +const includes = ['mach/mach.h', 'mach-o/dyld.h'] +const structs = ['task_basic_info', 'mach_msg_type_number_t'] + +export { name, api, constants, preamble, includes, structs } diff --git a/lib/mach/mach.cc b/lib/mach/mach.cc new file mode 100644 index 0000000..accb083 --- /dev/null +++ b/lib/mach/mach.cc @@ -0,0 +1,166 @@ + +// [do not edit,] +// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile +#include +#include +#include + +namespace lo { +namespace mach { + +using v8::String; +using v8::FunctionCallbackInfo; +using v8::Array; +using v8::Local; +using v8::ObjectTemplate; +using v8::Isolate; +using v8::Value; +using v8::Uint32Array; +using v8::ArrayBuffer; +using v8::Context; +using v8::Integer; +using v8::Function; +using v8::NewStringType; +using v8::Object; +using v8::BackingStore; +using v8::TryCatch; +using v8::ScriptCompiler; +using v8::Module; +using v8::FixedArray; +using v8::ScriptOrigin; +using v8::SharedArrayBuffer; +using v8::MaybeLocal; +using v8::HandleScope; +using v8::Promise; +using v8::Number; +using v8::StackTrace; +using v8::Message; +using v8::StackFrame; +using v8::Maybe; +using v8::FunctionTemplate; +using v8::FunctionCallback; +using v8::PromiseRejectMessage; +using v8::CFunction; +using v8::Global; +using v8::Exception; +using v8::CTypeInfo; +using v8::PropertyAttribute; +using v8::Signature; +using v8::ConstructorBehavior; +using v8::SideEffectType; +using v8::kPromiseRejectAfterResolved; +using v8::kPromiseResolveAfterResolved; +using v8::kPromiseHandlerAddedAfterReject; +using v8::Data; +using v8::PrimitiveArray; +using v8::TypedArray; +using v8::Uint8Array; +using v8::Boolean; +using v8::ModuleRequest; +using v8::CFunctionInfo; +using v8::OOMDetails; +using v8::V8; +using v8::BigInt; + + + +int32_t task_infoFast(void* p, uint32_t p0, int32_t p1, void* p2, void* p3); +v8::CTypeInfo cargstask_info[5] = { + v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), + v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), + v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), + v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), + v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), +}; +v8::CTypeInfo rctask_info = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); +v8::CFunctionInfo infotask_info = v8::CFunctionInfo(rctask_info, 5, cargstask_info); +v8::CFunction pFtask_info = v8::CFunction((const void*)&task_infoFast, &infotask_info); + +uint32_t task_selfFast(void* p); +v8::CTypeInfo cargstask_self[1] = { + v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), + +}; +v8::CTypeInfo rctask_self = v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); +v8::CFunctionInfo infotask_self = v8::CFunctionInfo(rctask_self, 1, cargstask_self); +v8::CFunction pFtask_self = v8::CFunction((const void*)&task_selfFast, &infotask_self); + +int32_t get_executable_pathFast(void* p, void* p0, struct FastApiTypedArray* const p1); +v8::CTypeInfo cargsget_executable_path[3] = { + v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), + v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), + v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), +}; +v8::CTypeInfo rcget_executable_path = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); +v8::CFunctionInfo infoget_executable_path = v8::CFunctionInfo(rcget_executable_path, 3, cargsget_executable_path); +v8::CFunction pFget_executable_path = v8::CFunction((const void*)&get_executable_pathFast, &infoget_executable_path); + + + +void task_infoSlow(const FunctionCallbackInfo &args) { + Isolate *isolate = args.GetIsolate(); + uint32_t v0 = Local::Cast(args[0])->Value(); + int32_t v1 = Local::Cast(args[1])->Value(); + task_info_t v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); + mach_msg_type_number_t* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); + int32_t rc = task_info(v0, v1, v2, v3); + args.GetReturnValue().Set(Number::New(isolate, rc)); +} + +int32_t task_infoFast(void* p, uint32_t p0, int32_t p1, void* p2, void* p3) { + uint32_t v0 = p0; + int32_t v1 = p1; + task_info_t v2 = reinterpret_cast(p2); + mach_msg_type_number_t* v3 = reinterpret_cast(p3); + return task_info(v0, v1, v2, v3); +} +void task_selfSlow(const FunctionCallbackInfo &args) { + Isolate *isolate = args.GetIsolate(); + + uint32_t rc = mach_task_self(); + args.GetReturnValue().Set(Number::New(isolate, rc)); +} + +uint32_t task_selfFast(void* p) { + + return mach_task_self(); +} +void get_executable_pathSlow(const FunctionCallbackInfo &args) { + Isolate *isolate = args.GetIsolate(); + char* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); + Local u321 = args[1].As(); + uint8_t* ptr1 = (uint8_t*)u321->Buffer()->Data() + u321->ByteOffset(); + uint32_t* v1 = reinterpret_cast(ptr1); + int32_t rc = _NSGetExecutablePath(v0, v1); + args.GetReturnValue().Set(Number::New(isolate, rc)); +} + +int32_t get_executable_pathFast(void* p, void* p0, struct FastApiTypedArray* const p1) { + char* v0 = reinterpret_cast(p0); + uint32_t* v1 = reinterpret_cast(p1->data); + return _NSGetExecutablePath(v0, v1); +} + +void Init(Isolate* isolate, Local target) { + Local module = ObjectTemplate::New(isolate); + SET_FAST_METHOD(isolate, module, "task_info", &pFtask_info, task_infoSlow); + SET_FAST_METHOD(isolate, module, "task_self", &pFtask_self, task_selfSlow); + SET_FAST_METHOD(isolate, module, "get_executable_path", &pFget_executable_path, get_executable_pathSlow); + + SET_VALUE(isolate, module, "TASK_BASIC_INFO_COUNT", Integer::New(isolate, (int32_t)TASK_BASIC_INFO_COUNT)); + SET_VALUE(isolate, module, "KERN_SUCCESS", Integer::New(isolate, (int32_t)KERN_SUCCESS)); + SET_VALUE(isolate, module, "TASK_BASIC_INFO", Integer::New(isolate, (int32_t)TASK_BASIC_INFO)); + + SET_VALUE(isolate, module, "struct_task_basic_info_size", Integer::New(isolate, sizeof(task_basic_info))); + SET_VALUE(isolate, module, "struct_mach_msg_type_number_t_size", Integer::New(isolate, sizeof(mach_msg_type_number_t))); + + SET_MODULE(isolate, target, "mach", module); +} +} // namespace mach +} // namespace lo + +extern "C" { + void* _register_mach() { + return (void*)lo::mach::Init; + } +} diff --git a/lib/machkq/api.js b/lib/machkq/api.js deleted file mode 100644 index e181ebd..0000000 --- a/lib/machkq/api.js +++ /dev/null @@ -1,20 +0,0 @@ -const api = { - kqueue: { - parameters: [], - result: 'i32' - }, - kevent: { - parameters: ['i32', 'pointer', 'i32', 'pointer', 'i32', 'pointer'], - pointers: [, 'const struct kevent *', , 'struct kevent *', , 'const struct timespec *'], - result: 'i32' - } -} - -const name = 'machkq' - -const constants = {} -const includes = [ - 'sys/event.h', 'sys/types.h', 'sys/time.h' -] - -export { name, api, constants, includes } diff --git a/lib/mbedtls/mbedtls.cc b/lib/mbedtls/mbedtls.cc deleted file mode 100644 index 15eebba..0000000 --- a/lib/mbedtls/mbedtls.cc +++ /dev/null @@ -1,1239 +0,0 @@ - -// [do not edit,] -// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile -#include -#include -#include -#include -#include -#include -#include -#include - -namespace lo { -namespace mbedtls { - -using v8::String; -using v8::FunctionCallbackInfo; -using v8::Array; -using v8::Local; -using v8::ObjectTemplate; -using v8::Isolate; -using v8::Value; -using v8::Uint32Array; -using v8::ArrayBuffer; -using v8::Context; -using v8::Integer; -using v8::Function; -using v8::NewStringType; -using v8::Object; -using v8::BackingStore; -using v8::TryCatch; -using v8::ScriptCompiler; -using v8::Module; -using v8::FixedArray; -using v8::ScriptOrigin; -using v8::SharedArrayBuffer; -using v8::MaybeLocal; -using v8::HandleScope; -using v8::Promise; -using v8::Number; -using v8::StackTrace; -using v8::Message; -using v8::StackFrame; -using v8::Maybe; -using v8::FunctionTemplate; -using v8::FunctionCallback; -using v8::PromiseRejectMessage; -using v8::CFunction; -using v8::Global; -using v8::Exception; -using v8::CTypeInfo; -using v8::PropertyAttribute; -using v8::Signature; -using v8::ConstructorBehavior; -using v8::SideEffectType; -using v8::kPromiseRejectAfterResolved; -using v8::kPromiseResolveAfterResolved; -using v8::kPromiseHandlerAddedAfterReject; -using v8::Data; -using v8::PrimitiveArray; -using v8::TypedArray; -using v8::Uint8Array; -using v8::Boolean; -using v8::ModuleRequest; -using v8::CFunctionInfo; -using v8::OOMDetails; -using v8::V8; -using v8::BigInt; - - -typedef int (*mbedtls_entropy_callback)(void *, unsigned char *, size_t); -typedef int (*mbedtls_rng_callback)(void *, unsigned char *, size_t); -typedef void (*mbedtls_dbg_callback)(void *, int, const char *, int, const char *); - - -void x509_crt_initFast(void* p, void* p0); -v8::CTypeInfo cargsx509_crt_init[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcx509_crt_init = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infox509_crt_init = v8::CFunctionInfo(rcx509_crt_init, 2, cargsx509_crt_init); -v8::CFunction pFx509_crt_init = v8::CFunction((const void*)&x509_crt_initFast, &infox509_crt_init); - -void net_initFast(void* p, void* p0); -v8::CTypeInfo cargsnet_init[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcnet_init = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infonet_init = v8::CFunctionInfo(rcnet_init, 2, cargsnet_init); -v8::CFunction pFnet_init = v8::CFunction((const void*)&net_initFast, &infonet_init); - -void ssl_initFast(void* p, void* p0); -v8::CTypeInfo cargsssl_init[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcssl_init = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infossl_init = v8::CFunctionInfo(rcssl_init, 2, cargsssl_init); -v8::CFunction pFssl_init = v8::CFunction((const void*)&ssl_initFast, &infossl_init); - -void ssl_config_initFast(void* p, void* p0); -v8::CTypeInfo cargsssl_config_init[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcssl_config_init = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infossl_config_init = v8::CFunctionInfo(rcssl_config_init, 2, cargsssl_config_init); -v8::CFunction pFssl_config_init = v8::CFunction((const void*)&ssl_config_initFast, &infossl_config_init); - -void entropy_initFast(void* p, void* p0); -v8::CTypeInfo cargsentropy_init[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcentropy_init = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoentropy_init = v8::CFunctionInfo(rcentropy_init, 2, cargsentropy_init); -v8::CFunction pFentropy_init = v8::CFunction((const void*)&entropy_initFast, &infoentropy_init); - -void ctr_drbg_initFast(void* p, void* p0); -v8::CTypeInfo cargsctr_drbg_init[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcctr_drbg_init = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoctr_drbg_init = v8::CFunctionInfo(rcctr_drbg_init, 2, cargsctr_drbg_init); -v8::CFunction pFctr_drbg_init = v8::CFunction((const void*)&ctr_drbg_initFast, &infoctr_drbg_init); - -int32_t x509_crt_parse_derFast(void* p, void* p0, void* p1, uint32_t p2); -v8::CTypeInfo cargsx509_crt_parse_der[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcx509_crt_parse_der = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infox509_crt_parse_der = v8::CFunctionInfo(rcx509_crt_parse_der, 4, cargsx509_crt_parse_der); -v8::CFunction pFx509_crt_parse_der = v8::CFunction((const void*)&x509_crt_parse_derFast, &infox509_crt_parse_der); - -void debug_set_thresholdFast(void* p, int32_t p0); -v8::CTypeInfo cargsdebug_set_threshold[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcdebug_set_threshold = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infodebug_set_threshold = v8::CFunctionInfo(rcdebug_set_threshold, 2, cargsdebug_set_threshold); -v8::CFunction pFdebug_set_threshold = v8::CFunction((const void*)&debug_set_thresholdFast, &infodebug_set_threshold); - -int32_t ctr_drbg_seedFast(void* p, void* p0, void* p1, void* p2, void* p3, uint32_t p4); -v8::CTypeInfo cargsctr_drbg_seed[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcctr_drbg_seed = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoctr_drbg_seed = v8::CFunctionInfo(rcctr_drbg_seed, 6, cargsctr_drbg_seed); -v8::CFunction pFctr_drbg_seed = v8::CFunction((const void*)&ctr_drbg_seedFast, &infoctr_drbg_seed); - -void exitFast(void* p, int32_t p0); -v8::CTypeInfo cargsexit[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcexit = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoexit = v8::CFunctionInfo(rcexit, 2, cargsexit); -v8::CFunction pFexit = v8::CFunction((const void*)&exitFast, &infoexit); - -int32_t x509_crt_parseFast(void* p, void* p0, void* p1, uint32_t p2); -v8::CTypeInfo cargsx509_crt_parse[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcx509_crt_parse = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infox509_crt_parse = v8::CFunctionInfo(rcx509_crt_parse, 4, cargsx509_crt_parse); -v8::CFunction pFx509_crt_parse = v8::CFunction((const void*)&x509_crt_parseFast, &infox509_crt_parse); - -int32_t ssl_config_defaultsFast(void* p, void* p0, int32_t p1, int32_t p2, int32_t p3); -v8::CTypeInfo cargsssl_config_defaults[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcssl_config_defaults = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infossl_config_defaults = v8::CFunctionInfo(rcssl_config_defaults, 5, cargsssl_config_defaults); -v8::CFunction pFssl_config_defaults = v8::CFunction((const void*)&ssl_config_defaultsFast, &infossl_config_defaults); - -int32_t ssl_conf_max_frag_lenFast(void* p, void* p0, uint8_t p1); -v8::CTypeInfo cargsssl_conf_max_frag_len[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kVoid), -}; -v8::CTypeInfo rcssl_conf_max_frag_len = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infossl_conf_max_frag_len = v8::CFunctionInfo(rcssl_conf_max_frag_len, 3, cargsssl_conf_max_frag_len); -v8::CFunction pFssl_conf_max_frag_len = v8::CFunction((const void*)&ssl_conf_max_frag_lenFast, &infossl_conf_max_frag_len); - -void ssl_conf_rngFast(void* p, void* p0, void* p1, void* p2); -v8::CTypeInfo cargsssl_conf_rng[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcssl_conf_rng = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infossl_conf_rng = v8::CFunctionInfo(rcssl_conf_rng, 4, cargsssl_conf_rng); -v8::CFunction pFssl_conf_rng = v8::CFunction((const void*)&ssl_conf_rngFast, &infossl_conf_rng); - -void ssl_conf_dbgFast(void* p, void* p0, void* p1, void* p2); -v8::CTypeInfo cargsssl_conf_dbg[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcssl_conf_dbg = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infossl_conf_dbg = v8::CFunctionInfo(rcssl_conf_dbg, 4, cargsssl_conf_dbg); -v8::CFunction pFssl_conf_dbg = v8::CFunction((const void*)&ssl_conf_dbgFast, &infossl_conf_dbg); - -void ssl_conf_read_timeoutFast(void* p, void* p0, uint32_t p1); -v8::CTypeInfo cargsssl_conf_read_timeout[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcssl_conf_read_timeout = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infossl_conf_read_timeout = v8::CFunctionInfo(rcssl_conf_read_timeout, 3, cargsssl_conf_read_timeout); -v8::CFunction pFssl_conf_read_timeout = v8::CFunction((const void*)&ssl_conf_read_timeoutFast, &infossl_conf_read_timeout); - -void ssl_conf_session_ticketsFast(void* p, void* p0, int32_t p1); -v8::CTypeInfo cargsssl_conf_session_tickets[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcssl_conf_session_tickets = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infossl_conf_session_tickets = v8::CFunctionInfo(rcssl_conf_session_tickets, 3, cargsssl_conf_session_tickets); -v8::CFunction pFssl_conf_session_tickets = v8::CFunction((const void*)&ssl_conf_session_ticketsFast, &infossl_conf_session_tickets); - -void ssl_conf_renegotiationFast(void* p, void* p0, int32_t p1); -v8::CTypeInfo cargsssl_conf_renegotiation[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcssl_conf_renegotiation = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infossl_conf_renegotiation = v8::CFunctionInfo(rcssl_conf_renegotiation, 3, cargsssl_conf_renegotiation); -v8::CFunction pFssl_conf_renegotiation = v8::CFunction((const void*)&ssl_conf_renegotiationFast, &infossl_conf_renegotiation); - -void ssl_conf_ca_chainFast(void* p, void* p0, void* p1, void* p2); -v8::CTypeInfo cargsssl_conf_ca_chain[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcssl_conf_ca_chain = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infossl_conf_ca_chain = v8::CFunctionInfo(rcssl_conf_ca_chain, 4, cargsssl_conf_ca_chain); -v8::CFunction pFssl_conf_ca_chain = v8::CFunction((const void*)&ssl_conf_ca_chainFast, &infossl_conf_ca_chain); - -void ssl_conf_min_versionFast(void* p, void* p0, int32_t p1, int32_t p2); -v8::CTypeInfo cargsssl_conf_min_version[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcssl_conf_min_version = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infossl_conf_min_version = v8::CFunctionInfo(rcssl_conf_min_version, 4, cargsssl_conf_min_version); -v8::CFunction pFssl_conf_min_version = v8::CFunction((const void*)&ssl_conf_min_versionFast, &infossl_conf_min_version); - -void ssl_conf_max_versionFast(void* p, void* p0, int32_t p1, int32_t p2); -v8::CTypeInfo cargsssl_conf_max_version[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcssl_conf_max_version = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infossl_conf_max_version = v8::CFunctionInfo(rcssl_conf_max_version, 4, cargsssl_conf_max_version); -v8::CFunction pFssl_conf_max_version = v8::CFunction((const void*)&ssl_conf_max_versionFast, &infossl_conf_max_version); - -int32_t ssl_setupFast(void* p, void* p0, void* p1); -v8::CTypeInfo cargsssl_setup[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcssl_setup = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infossl_setup = v8::CFunctionInfo(rcssl_setup, 3, cargsssl_setup); -v8::CFunction pFssl_setup = v8::CFunction((const void*)&ssl_setupFast, &infossl_setup); - -int32_t ssl_set_hostnameFast(void* p, void* p0, struct FastOneByteString* const p1); -v8::CTypeInfo cargsssl_set_hostname[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rcssl_set_hostname = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infossl_set_hostname = v8::CFunctionInfo(rcssl_set_hostname, 3, cargsssl_set_hostname); -v8::CFunction pFssl_set_hostname = v8::CFunction((const void*)&ssl_set_hostnameFast, &infossl_set_hostname); - -void ssl_set_bioFast(void* p, void* p0, void* p1, void* p2, void* p3, void* p4); -v8::CTypeInfo cargsssl_set_bio[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcssl_set_bio = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infossl_set_bio = v8::CFunctionInfo(rcssl_set_bio, 6, cargsssl_set_bio); -v8::CFunction pFssl_set_bio = v8::CFunction((const void*)&ssl_set_bioFast, &infossl_set_bio); - -int32_t net_connectFast(void* p, void* p0, struct FastOneByteString* const p1, struct FastOneByteString* const p2, int32_t p3); -v8::CTypeInfo cargsnet_connect[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcnet_connect = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infonet_connect = v8::CFunctionInfo(rcnet_connect, 5, cargsnet_connect); -v8::CFunction pFnet_connect = v8::CFunction((const void*)&net_connectFast, &infonet_connect); - -int32_t net_set_blockFast(void* p, void* p0); -v8::CTypeInfo cargsnet_set_block[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcnet_set_block = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infonet_set_block = v8::CFunctionInfo(rcnet_set_block, 2, cargsnet_set_block); -v8::CFunction pFnet_set_block = v8::CFunction((const void*)&net_set_blockFast, &infonet_set_block); - -int32_t ssl_handshakeFast(void* p, void* p0); -v8::CTypeInfo cargsssl_handshake[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcssl_handshake = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infossl_handshake = v8::CFunctionInfo(rcssl_handshake, 2, cargsssl_handshake); -v8::CFunction pFssl_handshake = v8::CFunction((const void*)&ssl_handshakeFast, &infossl_handshake); - -void ssl_get_versionFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsssl_get_version[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcssl_get_version = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infossl_get_version = v8::CFunctionInfo(rcssl_get_version, 3, cargsssl_get_version); -v8::CFunction pFssl_get_version = v8::CFunction((const void*)&ssl_get_versionFast, &infossl_get_version); - -void ssl_get_ciphersuiteFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsssl_get_ciphersuite[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcssl_get_ciphersuite = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infossl_get_ciphersuite = v8::CFunctionInfo(rcssl_get_ciphersuite, 3, cargsssl_get_ciphersuite); -v8::CFunction pFssl_get_ciphersuite = v8::CFunction((const void*)&ssl_get_ciphersuiteFast, &infossl_get_ciphersuite); - -uint32_t ssl_get_verify_resultFast(void* p, void* p0); -v8::CTypeInfo cargsssl_get_verify_result[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcssl_get_verify_result = v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); -v8::CFunctionInfo infossl_get_verify_result = v8::CFunctionInfo(rcssl_get_verify_result, 2, cargsssl_get_verify_result); -v8::CFunction pFssl_get_verify_result = v8::CFunction((const void*)&ssl_get_verify_resultFast, &infossl_get_verify_result); - -int32_t ssl_writeFast(void* p, void* p0, void* p1, uint32_t p2); -v8::CTypeInfo cargsssl_write[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcssl_write = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infossl_write = v8::CFunctionInfo(rcssl_write, 4, cargsssl_write); -v8::CFunction pFssl_write = v8::CFunction((const void*)&ssl_writeFast, &infossl_write); - -int32_t ssl_readFast(void* p, void* p0, void* p1, uint32_t p2); -v8::CTypeInfo cargsssl_read[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcssl_read = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infossl_read = v8::CFunctionInfo(rcssl_read, 4, cargsssl_read); -v8::CFunction pFssl_read = v8::CFunction((const void*)&ssl_readFast, &infossl_read); - -int32_t ssl_close_notifyFast(void* p, void* p0); -v8::CTypeInfo cargsssl_close_notify[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcssl_close_notify = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infossl_close_notify = v8::CFunctionInfo(rcssl_close_notify, 2, cargsssl_close_notify); -v8::CFunction pFssl_close_notify = v8::CFunction((const void*)&ssl_close_notifyFast, &infossl_close_notify); - -void net_freeFast(void* p, void* p0); -v8::CTypeInfo cargsnet_free[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcnet_free = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infonet_free = v8::CFunctionInfo(rcnet_free, 2, cargsnet_free); -v8::CFunction pFnet_free = v8::CFunction((const void*)&net_freeFast, &infonet_free); - -void ssl_freeFast(void* p, void* p0); -v8::CTypeInfo cargsssl_free[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcssl_free = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infossl_free = v8::CFunctionInfo(rcssl_free, 2, cargsssl_free); -v8::CFunction pFssl_free = v8::CFunction((const void*)&ssl_freeFast, &infossl_free); - -void ssl_config_freeFast(void* p, void* p0); -v8::CTypeInfo cargsssl_config_free[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcssl_config_free = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infossl_config_free = v8::CFunctionInfo(rcssl_config_free, 2, cargsssl_config_free); -v8::CFunction pFssl_config_free = v8::CFunction((const void*)&ssl_config_freeFast, &infossl_config_free); - -void x509_crt_freeFast(void* p, void* p0); -v8::CTypeInfo cargsx509_crt_free[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcx509_crt_free = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infox509_crt_free = v8::CFunctionInfo(rcx509_crt_free, 2, cargsx509_crt_free); -v8::CFunction pFx509_crt_free = v8::CFunction((const void*)&x509_crt_freeFast, &infox509_crt_free); - -void ctr_drbg_freeFast(void* p, void* p0); -v8::CTypeInfo cargsctr_drbg_free[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcctr_drbg_free = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoctr_drbg_free = v8::CFunctionInfo(rcctr_drbg_free, 2, cargsctr_drbg_free); -v8::CFunction pFctr_drbg_free = v8::CFunction((const void*)&ctr_drbg_freeFast, &infoctr_drbg_free); - -void entropy_freeFast(void* p, void* p0); -v8::CTypeInfo cargsentropy_free[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcentropy_free = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoentropy_free = v8::CFunctionInfo(rcentropy_free, 2, cargsentropy_free); -v8::CFunction pFentropy_free = v8::CFunction((const void*)&entropy_freeFast, &infoentropy_free); - -void dhm_initFast(void* p, void* p0); -v8::CTypeInfo cargsdhm_init[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcdhm_init = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infodhm_init = v8::CFunctionInfo(rcdhm_init, 2, cargsdhm_init); -v8::CFunction pFdhm_init = v8::CFunction((const void*)&dhm_initFast, &infodhm_init); - -void md5_initFast(void* p, void* p0); -v8::CTypeInfo cargsmd5_init[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcmd5_init = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infomd5_init = v8::CFunctionInfo(rcmd5_init, 2, cargsmd5_init); -v8::CFunction pFmd5_init = v8::CFunction((const void*)&md5_initFast, &infomd5_init); - -void md5_freeFast(void* p, void* p0); -v8::CTypeInfo cargsmd5_free[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcmd5_free = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infomd5_free = v8::CFunctionInfo(rcmd5_free, 2, cargsmd5_free); -v8::CFunction pFmd5_free = v8::CFunction((const void*)&md5_freeFast, &infomd5_free); - -void md5_startsFast(void* p, void* p0); -v8::CTypeInfo cargsmd5_starts[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcmd5_starts = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infomd5_starts = v8::CFunctionInfo(rcmd5_starts, 2, cargsmd5_starts); -v8::CFunction pFmd5_starts = v8::CFunction((const void*)&md5_startsFast, &infomd5_starts); - -void md5_updateFast(void* p, void* p0, void* p1, uint32_t p2); -v8::CTypeInfo cargsmd5_update[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcmd5_update = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infomd5_update = v8::CFunctionInfo(rcmd5_update, 4, cargsmd5_update); -v8::CFunction pFmd5_update = v8::CFunction((const void*)&md5_updateFast, &infomd5_update); - -void md5_finishFast(void* p, void* p0, void* p1); -v8::CTypeInfo cargsmd5_finish[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcmd5_finish = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infomd5_finish = v8::CFunctionInfo(rcmd5_finish, 3, cargsmd5_finish); -v8::CFunction pFmd5_finish = v8::CFunction((const void*)&md5_finishFast, &infomd5_finish); - -void sha256_initFast(void* p, void* p0); -v8::CTypeInfo cargssha256_init[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcsha256_init = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infosha256_init = v8::CFunctionInfo(rcsha256_init, 2, cargssha256_init); -v8::CFunction pFsha256_init = v8::CFunction((const void*)&sha256_initFast, &infosha256_init); - -void sha256_freeFast(void* p, void* p0); -v8::CTypeInfo cargssha256_free[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcsha256_free = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infosha256_free = v8::CFunctionInfo(rcsha256_free, 2, cargssha256_free); -v8::CFunction pFsha256_free = v8::CFunction((const void*)&sha256_freeFast, &infosha256_free); - -void sha256_startsFast(void* p, void* p0, int32_t p1); -v8::CTypeInfo cargssha256_starts[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcsha256_starts = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infosha256_starts = v8::CFunctionInfo(rcsha256_starts, 3, cargssha256_starts); -v8::CFunction pFsha256_starts = v8::CFunction((const void*)&sha256_startsFast, &infosha256_starts); - -void sha256_updateFast(void* p, void* p0, void* p1, uint32_t p2); -v8::CTypeInfo cargssha256_update[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcsha256_update = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infosha256_update = v8::CFunctionInfo(rcsha256_update, 4, cargssha256_update); -v8::CFunction pFsha256_update = v8::CFunction((const void*)&sha256_updateFast, &infosha256_update); - -void sha256_finishFast(void* p, void* p0, void* p1); -v8::CTypeInfo cargssha256_finish[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcsha256_finish = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infosha256_finish = v8::CFunctionInfo(rcsha256_finish, 3, cargssha256_finish); -v8::CFunction pFsha256_finish = v8::CFunction((const void*)&sha256_finishFast, &infosha256_finish); - - - -void x509_crt_initSlow(const FunctionCallbackInfo &args) { - mbedtls_x509_crt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_x509_crt_init(v0); -} - -void x509_crt_initFast(void* p, void* p0) { - mbedtls_x509_crt* v0 = reinterpret_cast(p0); - mbedtls_x509_crt_init(v0); -} -void net_initSlow(const FunctionCallbackInfo &args) { - mbedtls_net_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_net_init(v0); -} - -void net_initFast(void* p, void* p0) { - mbedtls_net_context* v0 = reinterpret_cast(p0); - mbedtls_net_init(v0); -} -void ssl_initSlow(const FunctionCallbackInfo &args) { - mbedtls_ssl_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_ssl_init(v0); -} - -void ssl_initFast(void* p, void* p0) { - mbedtls_ssl_context* v0 = reinterpret_cast(p0); - mbedtls_ssl_init(v0); -} -void ssl_config_initSlow(const FunctionCallbackInfo &args) { - mbedtls_ssl_config* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_ssl_config_init(v0); -} - -void ssl_config_initFast(void* p, void* p0) { - mbedtls_ssl_config* v0 = reinterpret_cast(p0); - mbedtls_ssl_config_init(v0); -} -void entropy_initSlow(const FunctionCallbackInfo &args) { - mbedtls_entropy_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_entropy_init(v0); -} - -void entropy_initFast(void* p, void* p0) { - mbedtls_entropy_context* v0 = reinterpret_cast(p0); - mbedtls_entropy_init(v0); -} -void ctr_drbg_initSlow(const FunctionCallbackInfo &args) { - mbedtls_ctr_drbg_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_ctr_drbg_init(v0); -} - -void ctr_drbg_initFast(void* p, void* p0) { - mbedtls_ctr_drbg_context* v0 = reinterpret_cast(p0); - mbedtls_ctr_drbg_init(v0); -} -void x509_crt_parse_derSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - mbedtls_x509_crt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const unsigned char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = mbedtls_x509_crt_parse_der(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t x509_crt_parse_derFast(void* p, void* p0, void* p1, uint32_t p2) { - mbedtls_x509_crt* v0 = reinterpret_cast(p0); - const unsigned char* v1 = reinterpret_cast(p1); - uint32_t v2 = p2; - return mbedtls_x509_crt_parse_der(v0, v1, v2); -} -void debug_set_thresholdSlow(const FunctionCallbackInfo &args) { - int32_t v0 = Local::Cast(args[0])->Value(); - mbedtls_debug_set_threshold(v0); -} - -void debug_set_thresholdFast(void* p, int32_t p0) { - int32_t v0 = p0; - mbedtls_debug_set_threshold(v0); -} -void ctr_drbg_seedSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - mbedtls_ctr_drbg_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_entropy_callback v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - void* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - const unsigned char* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - uint32_t v4 = Local::Cast(args[4])->Value(); - int32_t rc = mbedtls_ctr_drbg_seed(v0, v1, v2, v3, v4); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t ctr_drbg_seedFast(void* p, void* p0, void* p1, void* p2, void* p3, uint32_t p4) { - mbedtls_ctr_drbg_context* v0 = reinterpret_cast(p0); - mbedtls_entropy_callback v1 = reinterpret_cast(p1); - void* v2 = reinterpret_cast(p2); - const unsigned char* v3 = reinterpret_cast(p3); - uint32_t v4 = p4; - return mbedtls_ctr_drbg_seed(v0, v1, v2, v3, v4); -} -void exitSlow(const FunctionCallbackInfo &args) { - int32_t v0 = Local::Cast(args[0])->Value(); - mbedtls_exit(v0); -} - -void exitFast(void* p, int32_t p0) { - int32_t v0 = p0; - mbedtls_exit(v0); -} -void x509_crt_parseSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - mbedtls_x509_crt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const unsigned char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = mbedtls_x509_crt_parse(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t x509_crt_parseFast(void* p, void* p0, void* p1, uint32_t p2) { - mbedtls_x509_crt* v0 = reinterpret_cast(p0); - const unsigned char* v1 = reinterpret_cast(p1); - uint32_t v2 = p2; - return mbedtls_x509_crt_parse(v0, v1, v2); -} -void ssl_config_defaultsSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - mbedtls_ssl_config* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t v3 = Local::Cast(args[3])->Value(); - int32_t rc = mbedtls_ssl_config_defaults(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t ssl_config_defaultsFast(void* p, void* p0, int32_t p1, int32_t p2, int32_t p3) { - mbedtls_ssl_config* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - int32_t v2 = p2; - int32_t v3 = p3; - return mbedtls_ssl_config_defaults(v0, v1, v2, v3); -} -void ssl_conf_max_frag_lenSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - mbedtls_ssl_config* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint8_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = mbedtls_ssl_conf_max_frag_len(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t ssl_conf_max_frag_lenFast(void* p, void* p0, uint8_t p1) { - mbedtls_ssl_config* v0 = reinterpret_cast(p0); - uint8_t v1 = p1; - return mbedtls_ssl_conf_max_frag_len(v0, v1); -} -void ssl_conf_rngSlow(const FunctionCallbackInfo &args) { - mbedtls_ssl_config* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_rng_callback v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - void* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - mbedtls_ssl_conf_rng(v0, v1, v2); -} - -void ssl_conf_rngFast(void* p, void* p0, void* p1, void* p2) { - mbedtls_ssl_config* v0 = reinterpret_cast(p0); - mbedtls_rng_callback v1 = reinterpret_cast(p1); - void* v2 = reinterpret_cast(p2); - mbedtls_ssl_conf_rng(v0, v1, v2); -} -void ssl_conf_dbgSlow(const FunctionCallbackInfo &args) { - mbedtls_ssl_config* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_dbg_callback v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - void* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - mbedtls_ssl_conf_dbg(v0, v1, v2); -} - -void ssl_conf_dbgFast(void* p, void* p0, void* p1, void* p2) { - mbedtls_ssl_config* v0 = reinterpret_cast(p0); - mbedtls_dbg_callback v1 = reinterpret_cast(p1); - void* v2 = reinterpret_cast(p2); - mbedtls_ssl_conf_dbg(v0, v1, v2); -} -void ssl_conf_read_timeoutSlow(const FunctionCallbackInfo &args) { - mbedtls_ssl_config* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - mbedtls_ssl_conf_read_timeout(v0, v1); -} - -void ssl_conf_read_timeoutFast(void* p, void* p0, uint32_t p1) { - mbedtls_ssl_config* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - mbedtls_ssl_conf_read_timeout(v0, v1); -} -void ssl_conf_session_ticketsSlow(const FunctionCallbackInfo &args) { - mbedtls_ssl_config* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - mbedtls_ssl_conf_session_tickets(v0, v1); -} - -void ssl_conf_session_ticketsFast(void* p, void* p0, int32_t p1) { - mbedtls_ssl_config* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - mbedtls_ssl_conf_session_tickets(v0, v1); -} -void ssl_conf_renegotiationSlow(const FunctionCallbackInfo &args) { - mbedtls_ssl_config* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - mbedtls_ssl_conf_renegotiation(v0, v1); -} - -void ssl_conf_renegotiationFast(void* p, void* p0, int32_t p1) { - mbedtls_ssl_config* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - mbedtls_ssl_conf_renegotiation(v0, v1); -} -void ssl_conf_ca_chainSlow(const FunctionCallbackInfo &args) { - mbedtls_ssl_config* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_x509_crt* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - mbedtls_x509_crl* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - mbedtls_ssl_conf_ca_chain(v0, v1, v2); -} - -void ssl_conf_ca_chainFast(void* p, void* p0, void* p1, void* p2) { - mbedtls_ssl_config* v0 = reinterpret_cast(p0); - mbedtls_x509_crt* v1 = reinterpret_cast(p1); - mbedtls_x509_crl* v2 = reinterpret_cast(p2); - mbedtls_ssl_conf_ca_chain(v0, v1, v2); -} -void ssl_conf_min_versionSlow(const FunctionCallbackInfo &args) { - mbedtls_ssl_config* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t v2 = Local::Cast(args[2])->Value(); - mbedtls_ssl_conf_min_version(v0, v1, v2); -} - -void ssl_conf_min_versionFast(void* p, void* p0, int32_t p1, int32_t p2) { - mbedtls_ssl_config* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - int32_t v2 = p2; - mbedtls_ssl_conf_min_version(v0, v1, v2); -} -void ssl_conf_max_versionSlow(const FunctionCallbackInfo &args) { - mbedtls_ssl_config* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t v2 = Local::Cast(args[2])->Value(); - mbedtls_ssl_conf_max_version(v0, v1, v2); -} - -void ssl_conf_max_versionFast(void* p, void* p0, int32_t p1, int32_t p2) { - mbedtls_ssl_config* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - int32_t v2 = p2; - mbedtls_ssl_conf_max_version(v0, v1, v2); -} -void ssl_setupSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - mbedtls_ssl_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_ssl_config* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t rc = mbedtls_ssl_setup(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t ssl_setupFast(void* p, void* p0, void* p1) { - mbedtls_ssl_context* v0 = reinterpret_cast(p0); - mbedtls_ssl_config* v1 = reinterpret_cast(p1); - return mbedtls_ssl_setup(v0, v1); -} -void ssl_set_hostnameSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - mbedtls_ssl_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - int32_t rc = mbedtls_ssl_set_hostname(v0, *v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t ssl_set_hostnameFast(void* p, void* p0, struct FastOneByteString* const p1) { - mbedtls_ssl_context* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - return mbedtls_ssl_set_hostname(v0, v1->data); -} -void ssl_set_bioSlow(const FunctionCallbackInfo &args) { - mbedtls_ssl_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - void* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - mbedtls_ssl_send_t* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - mbedtls_ssl_recv_t* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - mbedtls_ssl_recv_timeout_t* v4 = reinterpret_cast((uint64_t)Local::Cast(args[4])->Value()); - mbedtls_ssl_set_bio(v0, v1, v2, v3, v4); -} - -void ssl_set_bioFast(void* p, void* p0, void* p1, void* p2, void* p3, void* p4) { - mbedtls_ssl_context* v0 = reinterpret_cast(p0); - void* v1 = reinterpret_cast(p1); - mbedtls_ssl_send_t* v2 = reinterpret_cast(p2); - mbedtls_ssl_recv_t* v3 = reinterpret_cast(p3); - mbedtls_ssl_recv_timeout_t* v4 = reinterpret_cast(p4); - mbedtls_ssl_set_bio(v0, v1, v2, v3, v4); -} -void net_connectSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - mbedtls_net_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - String::Utf8Value v2(isolate, args[2]); - int32_t v3 = Local::Cast(args[3])->Value(); - int32_t rc = mbedtls_net_connect(v0, *v1, *v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t net_connectFast(void* p, void* p0, struct FastOneByteString* const p1, struct FastOneByteString* const p2, int32_t p3) { - mbedtls_net_context* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - struct FastOneByteString* const v2 = p2; - int32_t v3 = p3; - return mbedtls_net_connect(v0, v1->data, v2->data, v3); -} -void net_set_blockSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - mbedtls_net_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = mbedtls_net_set_block(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t net_set_blockFast(void* p, void* p0) { - mbedtls_net_context* v0 = reinterpret_cast(p0); - return mbedtls_net_set_block(v0); -} -void ssl_handshakeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - mbedtls_ssl_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = mbedtls_ssl_handshake(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t ssl_handshakeFast(void* p, void* p0) { - mbedtls_ssl_context* v0 = reinterpret_cast(p0); - return mbedtls_ssl_handshake(v0); -} -void ssl_get_versionSlow(const FunctionCallbackInfo &args) { - mbedtls_ssl_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const char* rc = mbedtls_ssl_get_version(v0); - Local ab = args[1].As()->Buffer(); - ((const char**)ab->Data())[0] = rc; -} - -void ssl_get_versionFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - mbedtls_ssl_context* v0 = reinterpret_cast(p0); - const char* r = mbedtls_ssl_get_version(v0); - ((const char**)p_ret->data)[0] = r; - -} -void ssl_get_ciphersuiteSlow(const FunctionCallbackInfo &args) { - mbedtls_ssl_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const char* rc = mbedtls_ssl_get_ciphersuite(v0); - Local ab = args[1].As()->Buffer(); - ((const char**)ab->Data())[0] = rc; -} - -void ssl_get_ciphersuiteFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - mbedtls_ssl_context* v0 = reinterpret_cast(p0); - const char* r = mbedtls_ssl_get_ciphersuite(v0); - ((const char**)p_ret->data)[0] = r; - -} -void ssl_get_verify_resultSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - mbedtls_ssl_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t rc = mbedtls_ssl_get_verify_result(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -uint32_t ssl_get_verify_resultFast(void* p, void* p0) { - mbedtls_ssl_context* v0 = reinterpret_cast(p0); - return mbedtls_ssl_get_verify_result(v0); -} -void ssl_writeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - mbedtls_ssl_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const unsigned char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = mbedtls_ssl_write(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t ssl_writeFast(void* p, void* p0, void* p1, uint32_t p2) { - mbedtls_ssl_context* v0 = reinterpret_cast(p0); - const unsigned char* v1 = reinterpret_cast(p1); - uint32_t v2 = p2; - return mbedtls_ssl_write(v0, v1, v2); -} -void ssl_readSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - mbedtls_ssl_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - unsigned char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = mbedtls_ssl_read(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t ssl_readFast(void* p, void* p0, void* p1, uint32_t p2) { - mbedtls_ssl_context* v0 = reinterpret_cast(p0); - unsigned char* v1 = reinterpret_cast(p1); - uint32_t v2 = p2; - return mbedtls_ssl_read(v0, v1, v2); -} -void ssl_close_notifySlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - mbedtls_ssl_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = mbedtls_ssl_close_notify(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t ssl_close_notifyFast(void* p, void* p0) { - mbedtls_ssl_context* v0 = reinterpret_cast(p0); - return mbedtls_ssl_close_notify(v0); -} -void net_freeSlow(const FunctionCallbackInfo &args) { - mbedtls_net_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_net_free(v0); -} - -void net_freeFast(void* p, void* p0) { - mbedtls_net_context* v0 = reinterpret_cast(p0); - mbedtls_net_free(v0); -} -void ssl_freeSlow(const FunctionCallbackInfo &args) { - mbedtls_ssl_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_ssl_free(v0); -} - -void ssl_freeFast(void* p, void* p0) { - mbedtls_ssl_context* v0 = reinterpret_cast(p0); - mbedtls_ssl_free(v0); -} -void ssl_config_freeSlow(const FunctionCallbackInfo &args) { - mbedtls_ssl_config* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_ssl_config_free(v0); -} - -void ssl_config_freeFast(void* p, void* p0) { - mbedtls_ssl_config* v0 = reinterpret_cast(p0); - mbedtls_ssl_config_free(v0); -} -void x509_crt_freeSlow(const FunctionCallbackInfo &args) { - mbedtls_x509_crt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_x509_crt_free(v0); -} - -void x509_crt_freeFast(void* p, void* p0) { - mbedtls_x509_crt* v0 = reinterpret_cast(p0); - mbedtls_x509_crt_free(v0); -} -void ctr_drbg_freeSlow(const FunctionCallbackInfo &args) { - mbedtls_ctr_drbg_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_ctr_drbg_free(v0); -} - -void ctr_drbg_freeFast(void* p, void* p0) { - mbedtls_ctr_drbg_context* v0 = reinterpret_cast(p0); - mbedtls_ctr_drbg_free(v0); -} -void entropy_freeSlow(const FunctionCallbackInfo &args) { - mbedtls_entropy_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_entropy_free(v0); -} - -void entropy_freeFast(void* p, void* p0) { - mbedtls_entropy_context* v0 = reinterpret_cast(p0); - mbedtls_entropy_free(v0); -} -void dhm_initSlow(const FunctionCallbackInfo &args) { - mbedtls_dhm_context* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_dhm_init(v0); -} - -void dhm_initFast(void* p, void* p0) { - mbedtls_dhm_context* v0 = reinterpret_cast(p0); - mbedtls_dhm_init(v0); -} -void md5_initSlow(const FunctionCallbackInfo &args) { - mbedtls_md5_context * v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_md5_init(v0); -} - -void md5_initFast(void* p, void* p0) { - mbedtls_md5_context * v0 = reinterpret_cast(p0); - mbedtls_md5_init(v0); -} -void md5_freeSlow(const FunctionCallbackInfo &args) { - mbedtls_md5_context * v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_md5_free(v0); -} - -void md5_freeFast(void* p, void* p0) { - mbedtls_md5_context * v0 = reinterpret_cast(p0); - mbedtls_md5_free(v0); -} -void md5_startsSlow(const FunctionCallbackInfo &args) { - mbedtls_md5_context * v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_md5_starts(v0); -} - -void md5_startsFast(void* p, void* p0) { - mbedtls_md5_context * v0 = reinterpret_cast(p0); - mbedtls_md5_starts(v0); -} -void md5_updateSlow(const FunctionCallbackInfo &args) { - mbedtls_md5_context * v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const unsigned char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - uint32_t v2 = Local::Cast(args[2])->Value(); - mbedtls_md5_update(v0, v1, v2); -} - -void md5_updateFast(void* p, void* p0, void* p1, uint32_t p2) { - mbedtls_md5_context * v0 = reinterpret_cast(p0); - const unsigned char* v1 = reinterpret_cast(p1); - uint32_t v2 = p2; - mbedtls_md5_update(v0, v1, v2); -} -void md5_finishSlow(const FunctionCallbackInfo &args) { - mbedtls_md5_context * v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - unsigned char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - mbedtls_md5_finish(v0, v1); -} - -void md5_finishFast(void* p, void* p0, void* p1) { - mbedtls_md5_context * v0 = reinterpret_cast(p0); - unsigned char* v1 = reinterpret_cast(p1); - mbedtls_md5_finish(v0, v1); -} -void sha256_initSlow(const FunctionCallbackInfo &args) { - mbedtls_sha256_context * v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_sha256_init(v0); -} - -void sha256_initFast(void* p, void* p0) { - mbedtls_sha256_context * v0 = reinterpret_cast(p0); - mbedtls_sha256_init(v0); -} -void sha256_freeSlow(const FunctionCallbackInfo &args) { - mbedtls_sha256_context * v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - mbedtls_sha256_free(v0); -} - -void sha256_freeFast(void* p, void* p0) { - mbedtls_sha256_context * v0 = reinterpret_cast(p0); - mbedtls_sha256_free(v0); -} -void sha256_startsSlow(const FunctionCallbackInfo &args) { - mbedtls_sha256_context * v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - mbedtls_sha256_starts(v0, v1); -} - -void sha256_startsFast(void* p, void* p0, int32_t p1) { - mbedtls_sha256_context * v0 = reinterpret_cast(p0); - int32_t v1 = p1; - mbedtls_sha256_starts(v0, v1); -} -void sha256_updateSlow(const FunctionCallbackInfo &args) { - mbedtls_sha256_context * v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const unsigned char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - uint32_t v2 = Local::Cast(args[2])->Value(); - mbedtls_sha256_update(v0, v1, v2); -} - -void sha256_updateFast(void* p, void* p0, void* p1, uint32_t p2) { - mbedtls_sha256_context * v0 = reinterpret_cast(p0); - const unsigned char* v1 = reinterpret_cast(p1); - uint32_t v2 = p2; - mbedtls_sha256_update(v0, v1, v2); -} -void sha256_finishSlow(const FunctionCallbackInfo &args) { - mbedtls_sha256_context * v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - unsigned char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - mbedtls_sha256_finish(v0, v1); -} - -void sha256_finishFast(void* p, void* p0, void* p1) { - mbedtls_sha256_context * v0 = reinterpret_cast(p0); - unsigned char* v1 = reinterpret_cast(p1); - mbedtls_sha256_finish(v0, v1); -} - -void Init(Isolate* isolate, Local target) { - Local module = ObjectTemplate::New(isolate); - SET_FAST_METHOD(isolate, module, "x509_crt_init", &pFx509_crt_init, x509_crt_initSlow); - SET_FAST_METHOD(isolate, module, "net_init", &pFnet_init, net_initSlow); - SET_FAST_METHOD(isolate, module, "ssl_init", &pFssl_init, ssl_initSlow); - SET_FAST_METHOD(isolate, module, "ssl_config_init", &pFssl_config_init, ssl_config_initSlow); - SET_FAST_METHOD(isolate, module, "entropy_init", &pFentropy_init, entropy_initSlow); - SET_FAST_METHOD(isolate, module, "ctr_drbg_init", &pFctr_drbg_init, ctr_drbg_initSlow); - SET_FAST_METHOD(isolate, module, "x509_crt_parse_der", &pFx509_crt_parse_der, x509_crt_parse_derSlow); - SET_FAST_METHOD(isolate, module, "debug_set_threshold", &pFdebug_set_threshold, debug_set_thresholdSlow); - SET_FAST_METHOD(isolate, module, "ctr_drbg_seed", &pFctr_drbg_seed, ctr_drbg_seedSlow); - SET_FAST_METHOD(isolate, module, "exit", &pFexit, exitSlow); - SET_FAST_METHOD(isolate, module, "x509_crt_parse", &pFx509_crt_parse, x509_crt_parseSlow); - SET_FAST_METHOD(isolate, module, "ssl_config_defaults", &pFssl_config_defaults, ssl_config_defaultsSlow); - SET_FAST_METHOD(isolate, module, "ssl_conf_max_frag_len", &pFssl_conf_max_frag_len, ssl_conf_max_frag_lenSlow); - SET_FAST_METHOD(isolate, module, "ssl_conf_rng", &pFssl_conf_rng, ssl_conf_rngSlow); - SET_FAST_METHOD(isolate, module, "ssl_conf_dbg", &pFssl_conf_dbg, ssl_conf_dbgSlow); - SET_FAST_METHOD(isolate, module, "ssl_conf_read_timeout", &pFssl_conf_read_timeout, ssl_conf_read_timeoutSlow); - SET_FAST_METHOD(isolate, module, "ssl_conf_session_tickets", &pFssl_conf_session_tickets, ssl_conf_session_ticketsSlow); - SET_FAST_METHOD(isolate, module, "ssl_conf_renegotiation", &pFssl_conf_renegotiation, ssl_conf_renegotiationSlow); - SET_FAST_METHOD(isolate, module, "ssl_conf_ca_chain", &pFssl_conf_ca_chain, ssl_conf_ca_chainSlow); - SET_FAST_METHOD(isolate, module, "ssl_conf_min_version", &pFssl_conf_min_version, ssl_conf_min_versionSlow); - SET_FAST_METHOD(isolate, module, "ssl_conf_max_version", &pFssl_conf_max_version, ssl_conf_max_versionSlow); - SET_FAST_METHOD(isolate, module, "ssl_setup", &pFssl_setup, ssl_setupSlow); - SET_FAST_METHOD(isolate, module, "ssl_set_hostname", &pFssl_set_hostname, ssl_set_hostnameSlow); - SET_FAST_METHOD(isolate, module, "ssl_set_bio", &pFssl_set_bio, ssl_set_bioSlow); - SET_FAST_METHOD(isolate, module, "net_connect", &pFnet_connect, net_connectSlow); - SET_FAST_METHOD(isolate, module, "net_set_block", &pFnet_set_block, net_set_blockSlow); - SET_FAST_METHOD(isolate, module, "ssl_handshake", &pFssl_handshake, ssl_handshakeSlow); - SET_FAST_METHOD(isolate, module, "ssl_get_version", &pFssl_get_version, ssl_get_versionSlow); - SET_FAST_METHOD(isolate, module, "ssl_get_ciphersuite", &pFssl_get_ciphersuite, ssl_get_ciphersuiteSlow); - SET_FAST_METHOD(isolate, module, "ssl_get_verify_result", &pFssl_get_verify_result, ssl_get_verify_resultSlow); - SET_FAST_METHOD(isolate, module, "ssl_write", &pFssl_write, ssl_writeSlow); - SET_FAST_METHOD(isolate, module, "ssl_read", &pFssl_read, ssl_readSlow); - SET_FAST_METHOD(isolate, module, "ssl_close_notify", &pFssl_close_notify, ssl_close_notifySlow); - SET_FAST_METHOD(isolate, module, "net_free", &pFnet_free, net_freeSlow); - SET_FAST_METHOD(isolate, module, "ssl_free", &pFssl_free, ssl_freeSlow); - SET_FAST_METHOD(isolate, module, "ssl_config_free", &pFssl_config_free, ssl_config_freeSlow); - SET_FAST_METHOD(isolate, module, "x509_crt_free", &pFx509_crt_free, x509_crt_freeSlow); - SET_FAST_METHOD(isolate, module, "ctr_drbg_free", &pFctr_drbg_free, ctr_drbg_freeSlow); - SET_FAST_METHOD(isolate, module, "entropy_free", &pFentropy_free, entropy_freeSlow); - SET_FAST_METHOD(isolate, module, "dhm_init", &pFdhm_init, dhm_initSlow); - SET_FAST_METHOD(isolate, module, "md5_init", &pFmd5_init, md5_initSlow); - SET_FAST_METHOD(isolate, module, "md5_free", &pFmd5_free, md5_freeSlow); - SET_FAST_METHOD(isolate, module, "md5_starts", &pFmd5_starts, md5_startsSlow); - SET_FAST_METHOD(isolate, module, "md5_update", &pFmd5_update, md5_updateSlow); - SET_FAST_METHOD(isolate, module, "md5_finish", &pFmd5_finish, md5_finishSlow); - SET_FAST_METHOD(isolate, module, "sha256_init", &pFsha256_init, sha256_initSlow); - SET_FAST_METHOD(isolate, module, "sha256_free", &pFsha256_free, sha256_freeSlow); - SET_FAST_METHOD(isolate, module, "sha256_starts", &pFsha256_starts, sha256_startsSlow); - SET_FAST_METHOD(isolate, module, "sha256_update", &pFsha256_update, sha256_updateSlow); - SET_FAST_METHOD(isolate, module, "sha256_finish", &pFsha256_finish, sha256_finishSlow); - - SET_VALUE(isolate, module, "MBEDTLS_SSL_IS_CLIENT", Integer::New(isolate, MBEDTLS_SSL_IS_CLIENT)); - SET_VALUE(isolate, module, "MBEDTLS_SSL_TRANSPORT_STREAM", Integer::New(isolate, MBEDTLS_SSL_TRANSPORT_STREAM)); - SET_VALUE(isolate, module, "MBEDTLS_SSL_PRESET_DEFAULT", Integer::New(isolate, MBEDTLS_SSL_PRESET_DEFAULT)); - SET_VALUE(isolate, module, "MBEDTLS_SSL_MAX_FRAG_LEN_NONE", Integer::New(isolate, MBEDTLS_SSL_MAX_FRAG_LEN_NONE)); - SET_VALUE(isolate, module, "MBEDTLS_SSL_SESSION_TICKETS_ENABLED", Integer::New(isolate, MBEDTLS_SSL_SESSION_TICKETS_ENABLED)); - SET_VALUE(isolate, module, "MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_ALL", Integer::New(isolate, MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_ALL)); - SET_VALUE(isolate, module, "MBEDTLS_SSL_RENEGOTIATION_DISABLED", Integer::New(isolate, MBEDTLS_SSL_RENEGOTIATION_DISABLED)); - SET_VALUE(isolate, module, "MBEDTLS_SSL_MAJOR_VERSION_3", Integer::New(isolate, MBEDTLS_SSL_MAJOR_VERSION_3)); - SET_VALUE(isolate, module, "MBEDTLS_SSL_MINOR_VERSION_4", Integer::New(isolate, MBEDTLS_SSL_MINOR_VERSION_4)); - SET_VALUE(isolate, module, "MBEDTLS_NET_PROTO_TCP", Integer::New(isolate, MBEDTLS_NET_PROTO_TCP)); - SET_VALUE(isolate, module, "MBEDTLS_ERR_SSL_WANT_READ", Integer::New(isolate, MBEDTLS_ERR_SSL_WANT_READ)); - SET_VALUE(isolate, module, "MBEDTLS_ERR_SSL_WANT_WRITE", Integer::New(isolate, MBEDTLS_ERR_SSL_WANT_WRITE)); - SET_VALUE(isolate, module, "MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS", Integer::New(isolate, MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS)); - SET_VALUE(isolate, module, "MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY", Integer::New(isolate, MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY)); - - SET_VALUE(isolate, module, "struct_mbedtls_net_context_size", Integer::New(isolate, sizeof(mbedtls_net_context))); - SET_VALUE(isolate, module, "struct_mbedtls_x509_crt_size", Integer::New(isolate, sizeof(mbedtls_x509_crt))); - SET_VALUE(isolate, module, "struct_mbedtls_entropy_context_size", Integer::New(isolate, sizeof(mbedtls_entropy_context))); - SET_VALUE(isolate, module, "struct_mbedtls_ssl_context_size", Integer::New(isolate, sizeof(mbedtls_ssl_context))); - SET_VALUE(isolate, module, "struct_mbedtls_ssl_config_size", Integer::New(isolate, sizeof(mbedtls_ssl_config))); - SET_VALUE(isolate, module, "struct_mbedtls_ctr_drbg_context_size", Integer::New(isolate, sizeof(mbedtls_ctr_drbg_context))); - SET_VALUE(isolate, module, "struct_mbedtls_dhm_context_size", Integer::New(isolate, sizeof(mbedtls_dhm_context))); - SET_VALUE(isolate, module, "struct_mbedtls_md5_context_size", Integer::New(isolate, sizeof(mbedtls_md5_context))); - SET_VALUE(isolate, module, "struct_mbedtls_sha256_context_size", Integer::New(isolate, sizeof(mbedtls_sha256_context))); - - SET_MODULE(isolate, target, "mbedtls", module); -} -} // namespace mbedtls -} // namespace lo - -extern "C" { - void* _register_mbedtls() { - return (void*)lo::mbedtls::Init; - } -} diff --git a/lib/net/net.cc b/lib/net/net.cc deleted file mode 100644 index d74e0b4..0000000 --- a/lib/net/net.cc +++ /dev/null @@ -1,899 +0,0 @@ - -// [do not edit,] -// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace lo { -namespace net { - -using v8::String; -using v8::FunctionCallbackInfo; -using v8::Array; -using v8::Local; -using v8::ObjectTemplate; -using v8::Isolate; -using v8::Value; -using v8::Uint32Array; -using v8::ArrayBuffer; -using v8::Context; -using v8::Integer; -using v8::Function; -using v8::NewStringType; -using v8::Object; -using v8::BackingStore; -using v8::TryCatch; -using v8::ScriptCompiler; -using v8::Module; -using v8::FixedArray; -using v8::ScriptOrigin; -using v8::SharedArrayBuffer; -using v8::MaybeLocal; -using v8::HandleScope; -using v8::Promise; -using v8::Number; -using v8::StackTrace; -using v8::Message; -using v8::StackFrame; -using v8::Maybe; -using v8::FunctionTemplate; -using v8::FunctionCallback; -using v8::PromiseRejectMessage; -using v8::CFunction; -using v8::Global; -using v8::Exception; -using v8::CTypeInfo; -using v8::PropertyAttribute; -using v8::Signature; -using v8::ConstructorBehavior; -using v8::SideEffectType; -using v8::kPromiseRejectAfterResolved; -using v8::kPromiseResolveAfterResolved; -using v8::kPromiseHandlerAddedAfterReject; -using v8::Data; -using v8::PrimitiveArray; -using v8::TypedArray; -using v8::Uint8Array; -using v8::Boolean; -using v8::ModuleRequest; -using v8::CFunctionInfo; -using v8::OOMDetails; -using v8::V8; -using v8::BigInt; - - - -int32_t socketFast(void* p, int32_t p0, int32_t p1, int32_t p2); -v8::CTypeInfo cargssocket[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcsocket = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infosocket = v8::CFunctionInfo(rcsocket, 4, cargssocket); -v8::CFunction pFsocket = v8::CFunction((const void*)&socketFast, &infosocket); - -int32_t setsockoptFast(void* p, int32_t p0, int32_t p1, int32_t p2, struct FastApiTypedArray* const p3, int32_t p4); -v8::CTypeInfo cargssetsockopt[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcsetsockopt = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infosetsockopt = v8::CFunctionInfo(rcsetsockopt, 6, cargssetsockopt); -v8::CFunction pFsetsockopt = v8::CFunction((const void*)&setsockoptFast, &infosetsockopt); - -int32_t bindFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2); -v8::CTypeInfo cargsbind[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcbind = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infobind = v8::CFunctionInfo(rcbind, 4, cargsbind); -v8::CFunction pFbind = v8::CFunction((const void*)&bindFast, &infobind); - -int32_t connectFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2); -v8::CTypeInfo cargsconnect[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcconnect = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoconnect = v8::CFunctionInfo(rcconnect, 4, cargsconnect); -v8::CFunction pFconnect = v8::CFunction((const void*)&connectFast, &infoconnect); - -int32_t listenFast(void* p, int32_t p0, int32_t p1); -v8::CTypeInfo cargslisten[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rclisten = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infolisten = v8::CFunctionInfo(rclisten, 3, cargslisten); -v8::CFunction pFlisten = v8::CFunction((const void*)&listenFast, &infolisten); - -int32_t closeFast(void* p, int32_t p0); -v8::CTypeInfo cargsclose[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcclose = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoclose = v8::CFunctionInfo(rcclose, 2, cargsclose); -v8::CFunction pFclose = v8::CFunction((const void*)&closeFast, &infoclose); - -int32_t acceptFast(void* p, int32_t p0, void* p1, void* p2); -v8::CTypeInfo cargsaccept[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcaccept = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoaccept = v8::CFunctionInfo(rcaccept, 4, cargsaccept); -v8::CFunction pFaccept = v8::CFunction((const void*)&acceptFast, &infoaccept); - -int32_t accept4Fast(void* p, int32_t p0, void* p1, void* p2, int32_t p3); -v8::CTypeInfo cargsaccept4[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcaccept4 = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoaccept4 = v8::CFunctionInfo(rcaccept4, 5, cargsaccept4); -v8::CFunction pFaccept4 = v8::CFunction((const void*)&accept4Fast, &infoaccept4); - -int32_t sendFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, uint32_t p2, int32_t p3); -v8::CTypeInfo cargssend[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcsend = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infosend = v8::CFunctionInfo(rcsend, 5, cargssend); -v8::CFunction pFsend = v8::CFunction((const void*)&sendFast, &infosend); - -int32_t send_stringFast(void* p, int32_t p0, struct FastOneByteString* const p1, uint32_t p3); -v8::CTypeInfo cargssend_string[5] = { - 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(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcsend_string = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infosend_string = v8::CFunctionInfo(rcsend_string, 5, cargssend_string); -v8::CFunction pFsend_string = v8::CFunction((const void*)&send_stringFast, &infosend_string); - -int32_t send2Fast(void* p, int32_t p0, void* p1, int32_t p2, uint32_t p3); -v8::CTypeInfo cargssend2[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcsend2 = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infosend2 = v8::CFunctionInfo(rcsend2, 5, cargssend2); -v8::CFunction pFsend2 = v8::CFunction((const void*)&send2Fast, &infosend2); - -int32_t sendtoFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, uint32_t p2, int32_t p3, struct FastApiTypedArray* const p4, uint32_t p5); -v8::CTypeInfo cargssendto[7] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcsendto = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infosendto = v8::CFunctionInfo(rcsendto, 7, cargssendto); -v8::CFunction pFsendto = v8::CFunction((const void*)&sendtoFast, &infosendto); - -int32_t recvFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, uint32_t p2, int32_t p3); -v8::CTypeInfo cargsrecv[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcrecv = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo inforecv = v8::CFunctionInfo(rcrecv, 5, cargsrecv); -v8::CFunction pFrecv = v8::CFunction((const void*)&recvFast, &inforecv); - -int32_t recv2Fast(void* p, int32_t p0, void* p1, uint32_t p2, int32_t p3); -v8::CTypeInfo cargsrecv2[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcrecv2 = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo inforecv2 = v8::CFunctionInfo(rcrecv2, 5, cargsrecv2); -v8::CFunction pFrecv2 = v8::CFunction((const void*)&recv2Fast, &inforecv2); - -int32_t recvfromFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, uint32_t p2, int32_t p3, struct FastApiTypedArray* const p4, struct FastApiTypedArray* const p5); -v8::CTypeInfo cargsrecvfrom[7] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcrecvfrom = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo inforecvfrom = v8::CFunctionInfo(rcrecvfrom, 7, cargsrecvfrom); -v8::CFunction pFrecvfrom = v8::CFunction((const void*)&recvfromFast, &inforecvfrom); - -int32_t sendmsgFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2); -v8::CTypeInfo cargssendmsg[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcsendmsg = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infosendmsg = v8::CFunctionInfo(rcsendmsg, 4, cargssendmsg); -v8::CFunction pFsendmsg = v8::CFunction((const void*)&sendmsgFast, &infosendmsg); - -int32_t sendmmsgFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2, int32_t p3); -v8::CTypeInfo cargssendmmsg[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcsendmmsg = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infosendmmsg = v8::CFunctionInfo(rcsendmmsg, 5, cargssendmmsg); -v8::CFunction pFsendmmsg = v8::CFunction((const void*)&sendmmsgFast, &infosendmmsg); - -int32_t recvmsgFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, uint32_t p2); -v8::CTypeInfo cargsrecvmsg[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcrecvmsg = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo inforecvmsg = v8::CFunctionInfo(rcrecvmsg, 4, cargsrecvmsg); -v8::CFunction pFrecvmsg = v8::CFunction((const void*)&recvmsgFast, &inforecvmsg); - -int32_t recvmmsgFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2, int32_t p3, struct FastApiTypedArray* const p4); -v8::CTypeInfo cargsrecvmmsg[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcrecvmmsg = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo inforecvmmsg = v8::CFunctionInfo(rcrecvmmsg, 6, cargsrecvmmsg); -v8::CFunction pFrecvmmsg = v8::CFunction((const void*)&recvmmsgFast, &inforecvmmsg); - -int32_t readFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2); -v8::CTypeInfo cargsread[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcread = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo inforead = v8::CFunctionInfo(rcread, 4, cargsread); -v8::CFunction pFread = v8::CFunction((const void*)&readFast, &inforead); - -int32_t write_stringFast(void* p, int32_t p0, struct FastOneByteString* const p1); -v8::CTypeInfo cargswrite_string[4] = { - 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::CFunction pFwrite_string = v8::CFunction((const void*)&write_stringFast, &infowrite_string); - -int32_t writeFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2); -v8::CTypeInfo cargswrite[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcwrite = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infowrite = v8::CFunctionInfo(rcwrite, 4, cargswrite); -v8::CFunction pFwrite = v8::CFunction((const void*)&writeFast, &infowrite); - -int32_t pipe2Fast(void* p, struct FastApiTypedArray* const p0, int32_t p1); -v8::CTypeInfo cargspipe2[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcpipe2 = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infopipe2 = v8::CFunctionInfo(rcpipe2, 3, cargspipe2); -v8::CFunction pFpipe2 = v8::CFunction((const void*)&pipe2Fast, &infopipe2); - -int32_t dup2Fast(void* p, int32_t p0, int32_t p1); -v8::CTypeInfo cargsdup2[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcdup2 = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infodup2 = v8::CFunctionInfo(rcdup2, 3, cargsdup2); -v8::CFunction pFdup2 = v8::CFunction((const void*)&dup2Fast, &infodup2); - -int32_t ioctlFast(void* p, int32_t p0, int32_t p1, struct FastApiTypedArray* const p2); -v8::CTypeInfo cargsioctl[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcioctl = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoioctl = v8::CFunctionInfo(rcioctl, 4, cargsioctl); -v8::CFunction pFioctl = v8::CFunction((const void*)&ioctlFast, &infoioctl); - -int32_t ioctl2Fast(void* p, int32_t p0, int32_t p1, int32_t p2); -v8::CTypeInfo cargsioctl2[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcioctl2 = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoioctl2 = v8::CFunctionInfo(rcioctl2, 4, cargsioctl2); -v8::CFunction pFioctl2 = v8::CFunction((const void*)&ioctl2Fast, &infoioctl2); - - - -void socketSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = socket(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t socketFast(void* p, int32_t p0, int32_t p1, int32_t p2) { - int32_t v0 = p0; - int32_t v1 = p1; - int32_t v2 = p2; - return socket(v0, v1, v2); -} -void setsockoptSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t v2 = Local::Cast(args[2])->Value(); - Local u83 = args[3].As(); - uint8_t* ptr3 = (uint8_t*)u83->Buffer()->Data() + u83->ByteOffset(); - void* v3 = reinterpret_cast(ptr3); - int32_t v4 = Local::Cast(args[4])->Value(); - int32_t rc = setsockopt(v0, v1, v2, v3, v4); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t setsockoptFast(void* p, int32_t p0, int32_t p1, int32_t p2, struct FastApiTypedArray* const p3, int32_t p4) { - int32_t v0 = p0; - int32_t v1 = p1; - int32_t v2 = p2; - void* v3 = reinterpret_cast(p3->data); - int32_t v4 = p4; - return setsockopt(v0, v1, v2, v3, v4); -} -void bindSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - const struct sockaddr* v1 = reinterpret_cast(ptr1); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = bind(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t bindFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2) { - int32_t v0 = p0; - const struct sockaddr* v1 = reinterpret_cast(p1->data); - int32_t v2 = p2; - return bind(v0, v1, v2); -} -void connectSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - const sockaddr* v1 = reinterpret_cast(ptr1); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = connect(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t connectFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2) { - int32_t v0 = p0; - const sockaddr* v1 = reinterpret_cast(p1->data); - int32_t v2 = p2; - return connect(v0, v1, v2); -} -void listenSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = listen(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t listenFast(void* p, int32_t p0, int32_t p1) { - int32_t v0 = p0; - int32_t v1 = p1; - return listen(v0, v1); -} -void closeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t rc = close(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t closeFast(void* p, int32_t p0) { - int32_t v0 = p0; - return close(v0); -} -void acceptSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - sockaddr* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - socklen_t* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - int32_t rc = accept(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t acceptFast(void* p, int32_t p0, void* p1, void* p2) { - int32_t v0 = p0; - sockaddr* v1 = reinterpret_cast(p1); - socklen_t* v2 = reinterpret_cast(p2); - return accept(v0, v1, v2); -} -void accept4Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - sockaddr* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - socklen_t* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - int32_t v3 = Local::Cast(args[3])->Value(); - int32_t rc = accept4(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t accept4Fast(void* p, int32_t p0, void* p1, void* p2, int32_t p3) { - int32_t v0 = p0; - sockaddr* v1 = reinterpret_cast(p1); - socklen_t* v2 = reinterpret_cast(p2); - int32_t v3 = p3; - return accept4(v0, v1, v2, v3); -} -void sendSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - void* v1 = reinterpret_cast(ptr1); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t v3 = Local::Cast(args[3])->Value(); - int32_t rc = send(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t sendFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, uint32_t p2, int32_t p3) { - int32_t v0 = p0; - void* v1 = reinterpret_cast(p1->data); - uint32_t v2 = p2; - int32_t v3 = p3; - return send(v0, v1, v2, v3); -} -void send_stringSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - String::Utf8Value v1(isolate, args[1]); - int32_t v2 = v1.length(); - uint32_t v3 = Local::Cast(args[3])->Value(); - int32_t rc = send(v0, *v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t send_stringFast(void* p, int32_t p0, struct FastOneByteString* const p1, uint32_t p3) { - int32_t v0 = p0; - struct FastOneByteString* const v1 = p1; - int32_t v2 = p1->length; - uint32_t v3 = 0; - return send(v0, v1->data, v2, v3); -} -void send2Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - void* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t v2 = Local::Cast(args[2])->Value(); - uint32_t v3 = Local::Cast(args[3])->Value(); - int32_t rc = send(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t send2Fast(void* p, int32_t p0, void* p1, int32_t p2, uint32_t p3) { - int32_t v0 = p0; - void* v1 = reinterpret_cast(p1); - int32_t v2 = p2; - uint32_t v3 = p3; - return send(v0, v1, v2, v3); -} -void sendtoSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - void* v1 = reinterpret_cast(ptr1); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t v3 = Local::Cast(args[3])->Value(); - Local u84 = args[4].As(); - uint8_t* ptr4 = (uint8_t*)u84->Buffer()->Data() + u84->ByteOffset(); - const struct sockaddr* v4 = reinterpret_cast(ptr4); - uint32_t v5 = Local::Cast(args[5])->Value(); - int32_t rc = sendto(v0, v1, v2, v3, v4, v5); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t sendtoFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, uint32_t p2, int32_t p3, struct FastApiTypedArray* const p4, uint32_t p5) { - int32_t v0 = p0; - void* v1 = reinterpret_cast(p1->data); - uint32_t v2 = p2; - int32_t v3 = p3; - const struct sockaddr* v4 = reinterpret_cast(p4->data); - uint32_t v5 = p5; - return sendto(v0, v1, v2, v3, v4, v5); -} -void recvSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - void* v1 = reinterpret_cast(ptr1); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t v3 = Local::Cast(args[3])->Value(); - int32_t rc = recv(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t recvFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, uint32_t p2, int32_t p3) { - int32_t v0 = p0; - void* v1 = reinterpret_cast(p1->data); - uint32_t v2 = p2; - int32_t v3 = p3; - return recv(v0, v1, v2, v3); -} -void recv2Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - void* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t v3 = Local::Cast(args[3])->Value(); - int32_t rc = recv(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t recv2Fast(void* p, int32_t p0, void* p1, uint32_t p2, int32_t p3) { - int32_t v0 = p0; - void* v1 = reinterpret_cast(p1); - uint32_t v2 = p2; - int32_t v3 = p3; - return recv(v0, v1, v2, v3); -} -void recvfromSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - void* v1 = reinterpret_cast(ptr1); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t v3 = Local::Cast(args[3])->Value(); - Local u84 = args[4].As(); - uint8_t* ptr4 = (uint8_t*)u84->Buffer()->Data() + u84->ByteOffset(); - struct sockaddr* v4 = reinterpret_cast(ptr4); - Local u85 = args[5].As(); - uint8_t* ptr5 = (uint8_t*)u85->Buffer()->Data() + u85->ByteOffset(); - socklen_t* v5 = reinterpret_cast(ptr5); - int32_t rc = recvfrom(v0, v1, v2, v3, v4, v5); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t recvfromFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, uint32_t p2, int32_t p3, struct FastApiTypedArray* const p4, struct FastApiTypedArray* const p5) { - int32_t v0 = p0; - void* v1 = reinterpret_cast(p1->data); - uint32_t v2 = p2; - int32_t v3 = p3; - struct sockaddr* v4 = reinterpret_cast(p4->data); - socklen_t* v5 = reinterpret_cast(p5->data); - return recvfrom(v0, v1, v2, v3, v4, v5); -} -void sendmsgSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - const msghdr* v1 = reinterpret_cast(ptr1); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = sendmsg(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t sendmsgFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2) { - int32_t v0 = p0; - const msghdr* v1 = reinterpret_cast(p1->data); - int32_t v2 = p2; - return sendmsg(v0, v1, v2); -} -void sendmmsgSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - struct mmsghdr* v1 = reinterpret_cast(ptr1); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t v3 = Local::Cast(args[3])->Value(); - int32_t rc = sendmmsg(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t sendmmsgFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2, int32_t p3) { - int32_t v0 = p0; - struct mmsghdr* v1 = reinterpret_cast(p1->data); - int32_t v2 = p2; - int32_t v3 = p3; - return sendmmsg(v0, v1, v2, v3); -} -void recvmsgSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - msghdr* v1 = reinterpret_cast(ptr1); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = recvmsg(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t recvmsgFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, uint32_t p2) { - int32_t v0 = p0; - msghdr* v1 = reinterpret_cast(p1->data); - uint32_t v2 = p2; - return recvmsg(v0, v1, v2); -} -void recvmmsgSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - struct mmsghdr* v1 = reinterpret_cast(ptr1); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t v3 = Local::Cast(args[3])->Value(); - Local u84 = args[4].As(); - uint8_t* ptr4 = (uint8_t*)u84->Buffer()->Data() + u84->ByteOffset(); - struct timespec* v4 = reinterpret_cast(ptr4); - int32_t rc = recvmmsg(v0, v1, v2, v3, v4); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t recvmmsgFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2, int32_t p3, struct FastApiTypedArray* const p4) { - int32_t v0 = p0; - struct mmsghdr* v1 = reinterpret_cast(p1->data); - int32_t v2 = p2; - int32_t v3 = p3; - struct timespec* v4 = reinterpret_cast(p4->data); - return recvmmsg(v0, v1, v2, v3, v4); -} -void readSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - void* v1 = reinterpret_cast(ptr1); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = read(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t readFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2) { - int32_t v0 = p0; - void* v1 = reinterpret_cast(p1->data); - int32_t v2 = p2; - return read(v0, v1, v2); -} -void write_stringSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - String::Utf8Value v1(isolate, args[1]); - int32_t v2 = v1.length(); - int32_t rc = write(v0, *v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t write_stringFast(void* p, int32_t p0, struct FastOneByteString* const p1) { - int32_t v0 = p0; - struct FastOneByteString* const v1 = p1; - int32_t v2 = p1->length; - return write(v0, v1->data, v2); -} -void writeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - void* v1 = reinterpret_cast(ptr1); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = write(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t writeFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2) { - int32_t v0 = p0; - void* v1 = reinterpret_cast(p1->data); - int32_t v2 = p2; - return write(v0, v1, v2); -} -void pipe2Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local u320 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u320->Buffer()->Data() + u320->ByteOffset(); - int* v0 = reinterpret_cast(ptr0); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = pipe2(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t pipe2Fast(void* p, struct FastApiTypedArray* const p0, int32_t p1) { - int* v0 = reinterpret_cast(p0->data); - int32_t v1 = p1; - return pipe2(v0, v1); -} -void dup2Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = dup2(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t dup2Fast(void* p, int32_t p0, int32_t p1) { - int32_t v0 = p0; - int32_t v1 = p1; - return dup2(v0, v1); -} -void ioctlSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t v1 = Local::Cast(args[1])->Value(); - Local u82 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u82->Buffer()->Data() + u82->ByteOffset(); - void* v2 = reinterpret_cast(ptr2); - int32_t rc = ioctl(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t ioctlFast(void* p, int32_t p0, int32_t p1, struct FastApiTypedArray* const p2) { - int32_t v0 = p0; - int32_t v1 = p1; - void* v2 = reinterpret_cast(p2->data); - return ioctl(v0, v1, v2); -} -void ioctl2Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = ioctl(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t ioctl2Fast(void* p, int32_t p0, int32_t p1, int32_t p2) { - int32_t v0 = p0; - int32_t v1 = p1; - int32_t v2 = p2; - return ioctl(v0, v1, v2); -} - -void Init(Isolate* isolate, Local target) { - Local module = ObjectTemplate::New(isolate); - SET_FAST_METHOD(isolate, module, "socket", &pFsocket, socketSlow); - SET_FAST_METHOD(isolate, module, "setsockopt", &pFsetsockopt, setsockoptSlow); - SET_FAST_METHOD(isolate, module, "bind", &pFbind, bindSlow); - SET_FAST_METHOD(isolate, module, "connect", &pFconnect, connectSlow); - SET_FAST_METHOD(isolate, module, "listen", &pFlisten, listenSlow); - SET_FAST_METHOD(isolate, module, "close", &pFclose, closeSlow); - SET_FAST_METHOD(isolate, module, "accept", &pFaccept, acceptSlow); - SET_FAST_METHOD(isolate, module, "accept4", &pFaccept4, accept4Slow); - SET_FAST_METHOD(isolate, module, "send", &pFsend, sendSlow); - SET_FAST_METHOD(isolate, module, "send_string", &pFsend_string, send_stringSlow); - SET_FAST_METHOD(isolate, module, "send2", &pFsend2, send2Slow); - SET_FAST_METHOD(isolate, module, "sendto", &pFsendto, sendtoSlow); - SET_FAST_METHOD(isolate, module, "recv", &pFrecv, recvSlow); - SET_FAST_METHOD(isolate, module, "recv2", &pFrecv2, recv2Slow); - SET_FAST_METHOD(isolate, module, "recvfrom", &pFrecvfrom, recvfromSlow); - SET_FAST_METHOD(isolate, module, "sendmsg", &pFsendmsg, sendmsgSlow); - SET_FAST_METHOD(isolate, module, "sendmmsg", &pFsendmmsg, sendmmsgSlow); - SET_FAST_METHOD(isolate, module, "recvmsg", &pFrecvmsg, recvmsgSlow); - SET_FAST_METHOD(isolate, module, "recvmmsg", &pFrecvmmsg, recvmmsgSlow); - SET_FAST_METHOD(isolate, module, "read", &pFread, readSlow); - SET_FAST_METHOD(isolate, module, "write_string", &pFwrite_string, write_stringSlow); - SET_FAST_METHOD(isolate, module, "write", &pFwrite, writeSlow); - SET_FAST_METHOD(isolate, module, "pipe2", &pFpipe2, pipe2Slow); - SET_FAST_METHOD(isolate, module, "dup2", &pFdup2, dup2Slow); - SET_FAST_METHOD(isolate, module, "ioctl", &pFioctl, ioctlSlow); - SET_FAST_METHOD(isolate, module, "ioctl2", &pFioctl2, ioctl2Slow); - - SET_VALUE(isolate, module, "EINPROGRESS", Integer::New(isolate, EINPROGRESS)); - SET_VALUE(isolate, module, "EAGAIN", Integer::New(isolate, EAGAIN)); - SET_VALUE(isolate, module, "AF_INET", Integer::New(isolate, AF_INET)); - SET_VALUE(isolate, module, "SOCK_STREAM", Integer::New(isolate, SOCK_STREAM)); - SET_VALUE(isolate, module, "SOL_SOCKET", Integer::New(isolate, SOL_SOCKET)); - SET_VALUE(isolate, module, "SO_REUSEPORT", Integer::New(isolate, SO_REUSEPORT)); - SET_VALUE(isolate, module, "SOMAXCONN", Integer::New(isolate, SOMAXCONN)); - SET_VALUE(isolate, module, "MSG_NOSIGNAL", Integer::New(isolate, MSG_NOSIGNAL)); - SET_VALUE(isolate, module, "SOCK_DGRAM", Integer::New(isolate, SOCK_DGRAM)); - SET_VALUE(isolate, module, "SOCK_RAW", Integer::New(isolate, SOCK_RAW)); - SET_VALUE(isolate, module, "SIOCGIFADDR", Integer::New(isolate, SIOCGIFADDR)); - SET_VALUE(isolate, module, "IPPROTO_RAW", Integer::New(isolate, IPPROTO_RAW)); - SET_VALUE(isolate, module, "SIOCSIFFLAGS", Integer::New(isolate, SIOCSIFFLAGS)); - SET_VALUE(isolate, module, "SIOCSIFADDR", Integer::New(isolate, SIOCSIFADDR)); - SET_VALUE(isolate, module, "SIOCSIFNETMASK", Integer::New(isolate, SIOCSIFNETMASK)); - SET_VALUE(isolate, module, "SOCK_NONBLOCK", Integer::New(isolate, SOCK_NONBLOCK)); - SET_VALUE(isolate, module, "SOCKADDR_LEN", Integer::New(isolate, 16)); - SET_VALUE(isolate, module, "SOCK_CLOEXEC", Integer::New(isolate, SOCK_CLOEXEC)); - SET_VALUE(isolate, module, "PF_PACKET", Integer::New(isolate, PF_PACKET)); - SET_VALUE(isolate, module, "ETH_P_ALL", Integer::New(isolate, ETH_P_ALL)); - SET_VALUE(isolate, module, "ETH_P_ARP", Integer::New(isolate, ETH_P_ARP)); - SET_VALUE(isolate, module, "SIOCGIFHWADDR", Integer::New(isolate, SIOCGIFHWADDR)); - SET_VALUE(isolate, module, "SIOCGIFINDEX", Integer::New(isolate, SIOCGIFINDEX)); - SET_VALUE(isolate, module, "IFF_TUN", Integer::New(isolate, IFF_TUN)); - SET_VALUE(isolate, module, "IFF_TAP", Integer::New(isolate, IFF_TAP)); - SET_VALUE(isolate, module, "IFF_NO_PI", Integer::New(isolate, IFF_NO_PI)); - SET_VALUE(isolate, module, "IFF_UP", Integer::New(isolate, IFF_UP)); - SET_VALUE(isolate, module, "TUNSETIFF", Integer::New(isolate, TUNSETIFF)); - SET_VALUE(isolate, module, "TUNSETPERSIST", Integer::New(isolate, TUNSETPERSIST)); - - - SET_MODULE(isolate, target, "net", module); -} -} // namespace net -} // namespace lo - -extern "C" { - void* _register_net() { - return (void*)lo::net::Init; - } -} diff --git a/lib/pico/pico.cc b/lib/pico/pico.cc deleted file mode 100644 index 5493f24..0000000 --- a/lib/pico/pico.cc +++ /dev/null @@ -1,402 +0,0 @@ - -// [do not edit,] -// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile -#include -#include - -namespace lo { -namespace pico { - -using v8::String; -using v8::FunctionCallbackInfo; -using v8::Array; -using v8::Local; -using v8::ObjectTemplate; -using v8::Isolate; -using v8::Value; -using v8::Uint32Array; -using v8::ArrayBuffer; -using v8::Context; -using v8::Integer; -using v8::Function; -using v8::NewStringType; -using v8::Object; -using v8::BackingStore; -using v8::TryCatch; -using v8::ScriptCompiler; -using v8::Module; -using v8::FixedArray; -using v8::ScriptOrigin; -using v8::SharedArrayBuffer; -using v8::MaybeLocal; -using v8::HandleScope; -using v8::Promise; -using v8::Number; -using v8::StackTrace; -using v8::Message; -using v8::StackFrame; -using v8::Maybe; -using v8::FunctionTemplate; -using v8::FunctionCallback; -using v8::PromiseRejectMessage; -using v8::CFunction; -using v8::Global; -using v8::Exception; -using v8::CTypeInfo; -using v8::PropertyAttribute; -using v8::Signature; -using v8::ConstructorBehavior; -using v8::SideEffectType; -using v8::kPromiseRejectAfterResolved; -using v8::kPromiseResolveAfterResolved; -using v8::kPromiseHandlerAddedAfterReject; -using v8::Data; -using v8::PrimitiveArray; -using v8::TypedArray; -using v8::Uint8Array; -using v8::Boolean; -using v8::ModuleRequest; -using v8::CFunctionInfo; -using v8::OOMDetails; -using v8::V8; -using v8::BigInt; - - -#define JUST_MAX_HEADERS 14 - -typedef struct httpHeader httpHeader; -struct httpHeader { - uint32_t name_start; - uint32_t name_len; - uint32_t value_start; - uint32_t value_len; -}; - -typedef struct httpRequest httpRequest; -struct httpRequest { - size_t path_len; - size_t method_len; - size_t num_headers; - int32_t minor_version; - uint8_t padding[4]; - struct httpHeader headers[JUST_MAX_HEADERS]; -}; - -typedef struct httpResponse httpResponse; -struct httpResponse { - int32_t minor_version; - int32_t status_code; - size_t num_headers; - size_t status_message_len; - uint8_t padding[8]; - struct httpHeader headers[JUST_MAX_HEADERS]; -}; - -#ifdef __cplusplus -extern "C" { -#endif - -int parse_request(char* next, ssize_t bytes, httpRequest* req); -int parse_response(char* next, ssize_t bytes, httpResponse* res); -// we can do the routing inside c++ if we pre-define the routes -#ifdef __cplusplus -} -#endif - -// todo: read multiple headers in a single call - for pipelined -// todo: spec compliance checks -// todo: chunked parsing -int parse_request(char* next, ssize_t bytes, httpRequest* req) { - const char* method; - const char* path; - struct phr_header headers[JUST_MAX_HEADERS]; - req->num_headers = JUST_MAX_HEADERS; - int nread = phr_parse_request(next, bytes, - (const char **)&method, - &req->method_len, (const char **)&path, - &req->path_len, &req->minor_version, headers, - &req->num_headers, 0); - for (uint32_t i = 0; i < req->num_headers; i++) { - req->headers[i].name_start = (uint64_t)headers[i].name - (uint64_t)next; - req->headers[i].name_len = headers[i].name_len; - req->headers[i].value_start = (uint64_t)headers[i].value - (uint64_t)next; - req->headers[i].value_len = headers[i].value_len; - } - return nread; -} - -int parse_response(char* next, ssize_t bytes, httpResponse* res) { - const char* status_message; - struct phr_header headers[JUST_MAX_HEADERS]; - res->num_headers = JUST_MAX_HEADERS; - int nread = phr_parse_response(next, bytes, - &res->minor_version, &res->status_code, - (const char **)&status_message, - &res->status_message_len, headers, - &res->num_headers, 0); - for (uint32_t i = 0; i < res->num_headers; i++) { - res->headers[i].name_start = (uint64_t)headers[i].name - (uint64_t)next; - res->headers[i].name_len = headers[i].name_len; - res->headers[i].value_start = (uint64_t)headers[i].value - (uint64_t)next; - res->headers[i].value_len = headers[i].value_len; - } - return nread; -} - - - -int32_t parseRequestFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2); -v8::CTypeInfo cargsparseRequest[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcparseRequest = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoparseRequest = v8::CFunctionInfo(rcparseRequest, 4, cargsparseRequest); -v8::CFunction pFparseRequest = v8::CFunction((const void*)&parseRequestFast, &infoparseRequest); - -int32_t parseRequest2Fast(void* p, void* p0, uint32_t p1, void* p2); -v8::CTypeInfo cargsparseRequest2[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcparseRequest2 = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoparseRequest2 = v8::CFunctionInfo(rcparseRequest2, 4, cargsparseRequest2); -v8::CFunction pFparseRequest2 = v8::CFunction((const void*)&parseRequest2Fast, &infoparseRequest2); - -int32_t parseResponseFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2); -v8::CTypeInfo cargsparseResponse[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcparseResponse = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoparseResponse = v8::CFunctionInfo(rcparseResponse, 4, cargsparseResponse); -v8::CFunction pFparseResponse = v8::CFunction((const void*)&parseResponseFast, &infoparseResponse); - -int32_t parseResponse2Fast(void* p, void* p0, uint32_t p1, void* p2); -v8::CTypeInfo cargsparseResponse2[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcparseResponse2 = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoparseResponse2 = v8::CFunctionInfo(rcparseResponse2, 4, cargsparseResponse2); -v8::CFunction pFparseResponse2 = v8::CFunction((const void*)&parseResponse2Fast, &infoparseResponse2); - -int32_t parse_requestFast(void* p, void* p0, uint32_t p1, void* p2, void* p3, void* p4, void* p5, void* p6, void* p7, void* p8, uint64_t p9); -v8::CTypeInfo cargsparse_request[11] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcparse_request = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoparse_request = v8::CFunctionInfo(rcparse_request, 11, cargsparse_request); -v8::CFunction pFparse_request = v8::CFunction((const void*)&parse_requestFast, &infoparse_request); - -int32_t parse_responseFast(void* p, void* p0, uint32_t p1, void* p2, void* p3, void* p4, void* p5, void* p6, void* p7, uint32_t p8); -v8::CTypeInfo cargsparse_response[10] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcparse_response = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoparse_response = v8::CFunctionInfo(rcparse_response, 10, cargsparse_response); -v8::CFunction pFparse_response = v8::CFunction((const void*)&parse_responseFast, &infoparse_response); - -int32_t decode_chunkedFast(void* p, void* p0, void* p1, void* p2); -v8::CTypeInfo cargsdecode_chunked[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcdecode_chunked = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infodecode_chunked = v8::CFunctionInfo(rcdecode_chunked, 4, cargsdecode_chunked); -v8::CFunction pFdecode_chunked = v8::CFunction((const void*)&decode_chunkedFast, &infodecode_chunked); - - - -void parseRequestSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - char* v0 = reinterpret_cast(ptr0); - uint32_t v1 = Local::Cast(args[1])->Value(); - Local u82 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u82->Buffer()->Data() + u82->ByteOffset(); - httpRequest* v2 = reinterpret_cast(ptr2); - int32_t rc = parse_request(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t parseRequestFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2) { - char* v0 = reinterpret_cast(p0->data); - uint32_t v1 = p1; - httpRequest* v2 = reinterpret_cast(p2->data); - return parse_request(v0, v1, v2); -} -void parseRequest2Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - char* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - httpRequest* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - int32_t rc = parse_request(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t parseRequest2Fast(void* p, void* p0, uint32_t p1, void* p2) { - char* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - httpRequest* v2 = reinterpret_cast(p2); - return parse_request(v0, v1, v2); -} -void parseResponseSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - char* v0 = reinterpret_cast(ptr0); - uint32_t v1 = Local::Cast(args[1])->Value(); - Local u82 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u82->Buffer()->Data() + u82->ByteOffset(); - httpResponse* v2 = reinterpret_cast(ptr2); - int32_t rc = parse_response(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t parseResponseFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2) { - char* v0 = reinterpret_cast(p0->data); - uint32_t v1 = p1; - httpResponse* v2 = reinterpret_cast(p2->data); - return parse_response(v0, v1, v2); -} -void parseResponse2Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - char* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - httpResponse* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - int32_t rc = parse_response(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t parseResponse2Fast(void* p, void* p0, uint32_t p1, void* p2) { - char* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - httpResponse* v2 = reinterpret_cast(p2); - return parse_response(v0, v1, v2); -} -void parse_requestSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - const char* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - const char ** v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - size_t * v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - const char ** v4 = reinterpret_cast((uint64_t)Local::Cast(args[4])->Value()); - size_t * v5 = reinterpret_cast((uint64_t)Local::Cast(args[5])->Value()); - int* v6 = reinterpret_cast((uint64_t)Local::Cast(args[6])->Value()); - struct phr_header * v7 = reinterpret_cast((uint64_t)Local::Cast(args[7])->Value()); - size_t * v8 = reinterpret_cast((uint64_t)Local::Cast(args[8])->Value()); - uint64_t v9 = Local::Cast(args[9])->Value(); - int32_t rc = phr_parse_request(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t parse_requestFast(void* p, void* p0, uint32_t p1, void* p2, void* p3, void* p4, void* p5, void* p6, void* p7, void* p8, uint64_t p9) { - const char* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - const char ** v2 = reinterpret_cast(p2); - size_t * v3 = reinterpret_cast(p3); - const char ** v4 = reinterpret_cast(p4); - size_t * v5 = reinterpret_cast(p5); - int* v6 = reinterpret_cast(p6); - struct phr_header * v7 = reinterpret_cast(p7); - size_t * v8 = reinterpret_cast(p8); - uint64_t v9 = p9; - return phr_parse_request(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); -} -void parse_responseSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - const char* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - int * v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - int * v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - const char ** v4 = reinterpret_cast((uint64_t)Local::Cast(args[4])->Value()); - size_t * v5 = reinterpret_cast((uint64_t)Local::Cast(args[5])->Value()); - struct phr_header * v6 = reinterpret_cast((uint64_t)Local::Cast(args[6])->Value()); - size_t * v7 = reinterpret_cast((uint64_t)Local::Cast(args[7])->Value()); - uint32_t v8 = Local::Cast(args[8])->Value(); - int32_t rc = phr_parse_response(v0, v1, v2, v3, v4, v5, v6, v7, v8); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t parse_responseFast(void* p, void* p0, uint32_t p1, void* p2, void* p3, void* p4, void* p5, void* p6, void* p7, uint32_t p8) { - const char* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - int * v2 = reinterpret_cast(p2); - int * v3 = reinterpret_cast(p3); - const char ** v4 = reinterpret_cast(p4); - size_t * v5 = reinterpret_cast(p5); - struct phr_header * v6 = reinterpret_cast(p6); - size_t * v7 = reinterpret_cast(p7); - uint32_t v8 = p8; - return phr_parse_response(v0, v1, v2, v3, v4, v5, v6, v7, v8); -} -void decode_chunkedSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - struct phr_chunked_decoder * v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - size_t* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - int32_t rc = phr_decode_chunked(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t decode_chunkedFast(void* p, void* p0, void* p1, void* p2) { - struct phr_chunked_decoder * v0 = reinterpret_cast(p0); - char* v1 = reinterpret_cast(p1); - size_t* v2 = reinterpret_cast(p2); - return phr_decode_chunked(v0, v1, v2); -} - -void Init(Isolate* isolate, Local target) { - Local module = ObjectTemplate::New(isolate); - SET_FAST_METHOD(isolate, module, "parseRequest", &pFparseRequest, parseRequestSlow); - SET_FAST_METHOD(isolate, module, "parseRequest2", &pFparseRequest2, parseRequest2Slow); - SET_FAST_METHOD(isolate, module, "parseResponse", &pFparseResponse, parseResponseSlow); - SET_FAST_METHOD(isolate, module, "parseResponse2", &pFparseResponse2, parseResponse2Slow); - SET_FAST_METHOD(isolate, module, "parse_request", &pFparse_request, parse_requestSlow); - SET_FAST_METHOD(isolate, module, "parse_response", &pFparse_response, parse_responseSlow); - SET_FAST_METHOD(isolate, module, "decode_chunked", &pFdecode_chunked, decode_chunkedSlow); - - - SET_VALUE(isolate, module, "struct_phr_chunked_decoder_size", Integer::New(isolate, sizeof(phr_chunked_decoder))); - - SET_MODULE(isolate, target, "pico", module); -} -} // namespace pico -} // namespace lo - -extern "C" { - void* _register_pico() { - return (void*)lo::pico::Init; - } -} diff --git a/lib/proc.js b/lib/proc.js index e78cc76..04c600b 100644 --- a/lib/proc.js +++ b/lib/proc.js @@ -36,6 +36,21 @@ if (core.os === 'linux') { if (pread(fd, buf, 1024, 0) > 0) return findmem(decoder.decode(buf)) return 0 } +} else if (core.os === 'mac') { + const { mach } = lo.load('mach') + const { ptr, assert } = lo + const { + struct_task_basic_info_size, struct_mach_msg_type_number_t_size, + TASK_BASIC_INFO_COUNT, TASK_BASIC_INFO, KERN_SUCCESS, + task_self, task_info + } = mach + const info = ptr(new Uint32Array(struct_task_basic_info_size / 4)) + const msg_type = ptr(new Uint32Array(struct_mach_msg_type_number_t_size / 4)) + msg_type[0] = TASK_BASIC_INFO_COUNT + mem = () => { + assert(task_info(task_self(), TASK_BASIC_INFO, info.ptr, msg_type.ptr) === KERN_SUCCESS) + return info[3] + } } if (core.os === 'linux' || core.os === 'mac') { diff --git a/lib/pthread/pthread.cc b/lib/pthread/pthread.cc deleted file mode 100644 index 3a33d6c..0000000 --- a/lib/pthread/pthread.cc +++ /dev/null @@ -1,365 +0,0 @@ - -// [do not edit,] -// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile -#include -#include - -namespace lo { -namespace pthread { - -using v8::String; -using v8::FunctionCallbackInfo; -using v8::Array; -using v8::Local; -using v8::ObjectTemplate; -using v8::Isolate; -using v8::Value; -using v8::Uint32Array; -using v8::ArrayBuffer; -using v8::Context; -using v8::Integer; -using v8::Function; -using v8::NewStringType; -using v8::Object; -using v8::BackingStore; -using v8::TryCatch; -using v8::ScriptCompiler; -using v8::Module; -using v8::FixedArray; -using v8::ScriptOrigin; -using v8::SharedArrayBuffer; -using v8::MaybeLocal; -using v8::HandleScope; -using v8::Promise; -using v8::Number; -using v8::StackTrace; -using v8::Message; -using v8::StackFrame; -using v8::Maybe; -using v8::FunctionTemplate; -using v8::FunctionCallback; -using v8::PromiseRejectMessage; -using v8::CFunction; -using v8::Global; -using v8::Exception; -using v8::CTypeInfo; -using v8::PropertyAttribute; -using v8::Signature; -using v8::ConstructorBehavior; -using v8::SideEffectType; -using v8::kPromiseRejectAfterResolved; -using v8::kPromiseResolveAfterResolved; -using v8::kPromiseHandlerAddedAfterReject; -using v8::Data; -using v8::PrimitiveArray; -using v8::TypedArray; -using v8::Uint8Array; -using v8::Boolean; -using v8::ModuleRequest; -using v8::CFunctionInfo; -using v8::OOMDetails; -using v8::V8; -using v8::BigInt; - -typedef void* (*start_routine)(void*); - - -int32_t createFast(void* p, struct FastApiTypedArray* const p0, void* p1, void* p2, struct FastApiTypedArray* const p3); -v8::CTypeInfo cargscreate[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rccreate = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infocreate = v8::CFunctionInfo(rccreate, 5, cargscreate); -v8::CFunction pFcreate = v8::CFunction((const void*)&createFast, &infocreate); - -int32_t getcpuclockidFast(void* p, uint64_t p0, struct FastApiTypedArray* const p1); -v8::CTypeInfo cargsgetcpuclockid[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcgetcpuclockid = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infogetcpuclockid = v8::CFunctionInfo(rcgetcpuclockid, 3, cargsgetcpuclockid); -v8::CFunction pFgetcpuclockid = v8::CFunction((const void*)&getcpuclockidFast, &infogetcpuclockid); - -int32_t cancelFast(void* p, uint64_t p0); -v8::CTypeInfo cargscancel[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rccancel = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infocancel = v8::CFunctionInfo(rccancel, 2, cargscancel); -v8::CFunction pFcancel = v8::CFunction((const void*)&cancelFast, &infocancel); - -void selfFast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsself[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcself = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoself = v8::CFunctionInfo(rcself, 2, cargsself); -v8::CFunction pFself = v8::CFunction((const void*)&selfFast, &infoself); - -int32_t detachFast(void* p, uint64_t p0); -v8::CTypeInfo cargsdetach[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcdetach = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infodetach = v8::CFunctionInfo(rcdetach, 2, cargsdetach); -v8::CFunction pFdetach = v8::CFunction((const void*)&detachFast, &infodetach); - -int32_t joinFast(void* p, uint64_t p0, struct FastApiTypedArray* const p1); -v8::CTypeInfo cargsjoin[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcjoin = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infojoin = v8::CFunctionInfo(rcjoin, 3, cargsjoin); -v8::CFunction pFjoin = v8::CFunction((const void*)&joinFast, &infojoin); - -void exitFast(void* p, struct FastApiTypedArray* const p0); -v8::CTypeInfo cargsexit[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcexit = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoexit = v8::CFunctionInfo(rcexit, 2, cargsexit); -v8::CFunction pFexit = v8::CFunction((const void*)&exitFast, &infoexit); - -int32_t tryJoinFast(void* p, uint64_t p0, struct FastApiTypedArray* const p1); -v8::CTypeInfo cargstryJoin[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rctryJoin = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infotryJoin = v8::CFunctionInfo(rctryJoin, 3, cargstryJoin); -v8::CFunction pFtryJoin = v8::CFunction((const void*)&tryJoinFast, &infotryJoin); - -int32_t setNameFast(void* p, uint64_t p0, struct FastOneByteString* const p1); -v8::CTypeInfo cargssetName[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rcsetName = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infosetName = v8::CFunctionInfo(rcsetName, 3, cargssetName); -v8::CFunction pFsetName = v8::CFunction((const void*)&setNameFast, &infosetName); - -int32_t setAffinityFast(void* p, uint64_t p0, uint32_t p1, struct FastApiTypedArray* const p2); -v8::CTypeInfo cargssetAffinity[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcsetAffinity = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infosetAffinity = v8::CFunctionInfo(rcsetAffinity, 4, cargssetAffinity); -v8::CFunction pFsetAffinity = v8::CFunction((const void*)&setAffinityFast, &infosetAffinity); - -int32_t getAffinityFast(void* p, uint64_t p0, uint32_t p1, struct FastApiTypedArray* const p2); -v8::CTypeInfo cargsgetAffinity[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcgetAffinity = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infogetAffinity = v8::CFunctionInfo(rcgetAffinity, 4, cargsgetAffinity); -v8::CFunction pFgetAffinity = v8::CFunction((const void*)&getAffinityFast, &infogetAffinity); - - - -void createSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local u320 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u320->Buffer()->Data() + u320->ByteOffset(); - pthread_t* v0 = reinterpret_cast(ptr0); - const pthread_attr_t* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - start_routine v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - Local u83 = args[3].As(); - uint8_t* ptr3 = (uint8_t*)u83->Buffer()->Data() + u83->ByteOffset(); - void* v3 = reinterpret_cast(ptr3); - int32_t rc = pthread_create(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t createFast(void* p, struct FastApiTypedArray* const p0, void* p1, void* p2, struct FastApiTypedArray* const p3) { - pthread_t* v0 = reinterpret_cast(p0->data); - const pthread_attr_t* v1 = reinterpret_cast(p1); - start_routine v2 = reinterpret_cast(p2); - void* v3 = reinterpret_cast(p3->data); - return pthread_create(v0, v1, v2, v3); -} -void getcpuclockidSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - uint64_t v0 = Local::Cast(args[0])->Value(); - Local u321 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u321->Buffer()->Data() + u321->ByteOffset(); - __clockid_t* v1 = reinterpret_cast<__clockid_t*>(ptr1); - int32_t rc = pthread_getcpuclockid((pthread_t)v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t getcpuclockidFast(void* p, uint64_t p0, struct FastApiTypedArray* const p1) { - uint64_t v0 = p0; - __clockid_t* v1 = reinterpret_cast<__clockid_t*>(p1->data); - return pthread_getcpuclockid((pthread_t)v0, v1); -} -void cancelSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - uint64_t v0 = Local::Cast(args[0])->Value(); - int32_t rc = pthread_cancel((pthread_t)v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t cancelFast(void* p, uint64_t p0) { - uint64_t v0 = p0; - return pthread_cancel((pthread_t)v0); -} -void selfSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - - uint64_t rc = pthread_self(); - args.GetReturnValue().Set(Number::New(isolate, static_cast(rc))); -} - -void selfFast(void* p, struct FastApiTypedArray* const p_ret) { - - uint64_t r = pthread_self(); - ((uint64_t*)p_ret->data)[0] = r; - -} -void detachSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - uint64_t v0 = Local::Cast(args[0])->Value(); - int32_t rc = pthread_detach((pthread_t)v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t detachFast(void* p, uint64_t p0) { - uint64_t v0 = p0; - return pthread_detach((pthread_t)v0); -} -void joinSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - uint64_t v0 = Local::Cast(args[0])->Value(); - Local u321 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u321->Buffer()->Data() + u321->ByteOffset(); - void** v1 = reinterpret_cast(ptr1); - int32_t rc = pthread_join((pthread_t)v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t joinFast(void* p, uint64_t p0, struct FastApiTypedArray* const p1) { - uint64_t v0 = p0; - void** v1 = reinterpret_cast(p1->data); - return pthread_join((pthread_t)v0, v1); -} -void exitSlow(const FunctionCallbackInfo &args) { - Local u320 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u320->Buffer()->Data() + u320->ByteOffset(); - void* v0 = reinterpret_cast(ptr0); - pthread_exit(v0); -} - -void exitFast(void* p, struct FastApiTypedArray* const p0) { - void* v0 = reinterpret_cast(p0->data); - pthread_exit(v0); -} -void tryJoinSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - uint64_t v0 = Local::Cast(args[0])->Value(); - Local u321 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u321->Buffer()->Data() + u321->ByteOffset(); - void** v1 = reinterpret_cast(ptr1); - int32_t rc = pthread_tryjoin_np((pthread_t)v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t tryJoinFast(void* p, uint64_t p0, struct FastApiTypedArray* const p1) { - uint64_t v0 = p0; - void** v1 = reinterpret_cast(p1->data); - return pthread_tryjoin_np((pthread_t)v0, v1); -} -void setNameSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - uint64_t v0 = Local::Cast(args[0])->Value(); - String::Utf8Value v1(isolate, args[1]); - int32_t rc = pthread_setname_np((pthread_t)v0, *v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t setNameFast(void* p, uint64_t p0, struct FastOneByteString* const p1) { - uint64_t v0 = p0; - struct FastOneByteString* const v1 = p1; - return pthread_setname_np((pthread_t)v0, v1->data); -} -void setAffinitySlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - uint64_t v0 = Local::Cast(args[0])->Value(); - uint32_t v1 = Local::Cast(args[1])->Value(); - Local u82 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u82->Buffer()->Data() + u82->ByteOffset(); - cpu_set_t* v2 = reinterpret_cast(ptr2); - int32_t rc = pthread_setaffinity_np((pthread_t)v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t setAffinityFast(void* p, uint64_t p0, uint32_t p1, struct FastApiTypedArray* const p2) { - uint64_t v0 = p0; - uint32_t v1 = p1; - cpu_set_t* v2 = reinterpret_cast(p2->data); - return pthread_setaffinity_np((pthread_t)v0, v1, v2); -} -void getAffinitySlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - uint64_t v0 = Local::Cast(args[0])->Value(); - uint32_t v1 = Local::Cast(args[1])->Value(); - Local u82 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u82->Buffer()->Data() + u82->ByteOffset(); - cpu_set_t* v2 = reinterpret_cast(ptr2); - int32_t rc = pthread_getaffinity_np((pthread_t)v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t getAffinityFast(void* p, uint64_t p0, uint32_t p1, struct FastApiTypedArray* const p2) { - uint64_t v0 = p0; - uint32_t v1 = p1; - cpu_set_t* v2 = reinterpret_cast(p2->data); - return pthread_getaffinity_np((pthread_t)v0, v1, v2); -} - -void Init(Isolate* isolate, Local target) { - Local module = ObjectTemplate::New(isolate); - SET_FAST_METHOD(isolate, module, "create", &pFcreate, createSlow); - SET_FAST_METHOD(isolate, module, "getcpuclockid", &pFgetcpuclockid, getcpuclockidSlow); - SET_FAST_METHOD(isolate, module, "cancel", &pFcancel, cancelSlow); - SET_FAST_METHOD(isolate, module, "self", &pFself, selfSlow); - SET_FAST_METHOD(isolate, module, "detach", &pFdetach, detachSlow); - SET_FAST_METHOD(isolate, module, "join", &pFjoin, joinSlow); - SET_FAST_METHOD(isolate, module, "exit", &pFexit, exitSlow); - SET_FAST_METHOD(isolate, module, "tryJoin", &pFtryJoin, tryJoinSlow); - SET_FAST_METHOD(isolate, module, "setName", &pFsetName, setNameSlow); - SET_FAST_METHOD(isolate, module, "setAffinity", &pFsetAffinity, setAffinitySlow); - SET_FAST_METHOD(isolate, module, "getAffinity", &pFgetAffinity, getAffinitySlow); - - - - SET_MODULE(isolate, target, "pthread", module); -} -} // namespace pthread -} // namespace lo - -extern "C" { - void* _register_pthread() { - return (void*)lo::pthread::Init; - } -} diff --git a/lib/seccomp/seccomp.cc b/lib/seccomp/seccomp.cc deleted file mode 100644 index 9e7454e..0000000 --- a/lib/seccomp/seccomp.cc +++ /dev/null @@ -1,225 +0,0 @@ - -// [do not edit,] -// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile -#include -#include - -namespace lo { -namespace seccomp { - -using v8::String; -using v8::FunctionCallbackInfo; -using v8::Array; -using v8::Local; -using v8::ObjectTemplate; -using v8::Isolate; -using v8::Value; -using v8::Uint32Array; -using v8::ArrayBuffer; -using v8::Context; -using v8::Integer; -using v8::Function; -using v8::NewStringType; -using v8::Object; -using v8::BackingStore; -using v8::TryCatch; -using v8::ScriptCompiler; -using v8::Module; -using v8::FixedArray; -using v8::ScriptOrigin; -using v8::SharedArrayBuffer; -using v8::MaybeLocal; -using v8::HandleScope; -using v8::Promise; -using v8::Number; -using v8::StackTrace; -using v8::Message; -using v8::StackFrame; -using v8::Maybe; -using v8::FunctionTemplate; -using v8::FunctionCallback; -using v8::PromiseRejectMessage; -using v8::CFunction; -using v8::Global; -using v8::Exception; -using v8::CTypeInfo; -using v8::PropertyAttribute; -using v8::Signature; -using v8::ConstructorBehavior; -using v8::SideEffectType; -using v8::kPromiseRejectAfterResolved; -using v8::kPromiseResolveAfterResolved; -using v8::kPromiseHandlerAddedAfterReject; -using v8::Data; -using v8::PrimitiveArray; -using v8::TypedArray; -using v8::Uint8Array; -using v8::Boolean; -using v8::ModuleRequest; -using v8::CFunctionInfo; -using v8::OOMDetails; -using v8::V8; -using v8::BigInt; - - - -void seccomp_syscall_resolve_num_archFast(void* p, int32_t p0, int32_t p1, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsseccomp_syscall_resolve_num_arch[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcseccomp_syscall_resolve_num_arch = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoseccomp_syscall_resolve_num_arch = v8::CFunctionInfo(rcseccomp_syscall_resolve_num_arch, 4, cargsseccomp_syscall_resolve_num_arch); -v8::CFunction pFseccomp_syscall_resolve_num_arch = v8::CFunction((const void*)&seccomp_syscall_resolve_num_archFast, &infoseccomp_syscall_resolve_num_arch); - -void seccomp_initFast(void* p, uint32_t p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsseccomp_init[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcseccomp_init = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoseccomp_init = v8::CFunctionInfo(rcseccomp_init, 3, cargsseccomp_init); -v8::CFunction pFseccomp_init = v8::CFunction((const void*)&seccomp_initFast, &infoseccomp_init); - -int32_t seccomp_rule_add_exactFast(void* p, void* p0, uint32_t p1, int32_t p2, uint32_t p3); -v8::CTypeInfo cargsseccomp_rule_add_exact[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcseccomp_rule_add_exact = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoseccomp_rule_add_exact = v8::CFunctionInfo(rcseccomp_rule_add_exact, 5, cargsseccomp_rule_add_exact); -v8::CFunction pFseccomp_rule_add_exact = v8::CFunction((const void*)&seccomp_rule_add_exactFast, &infoseccomp_rule_add_exact); - -int32_t seccomp_loadFast(void* p, void* p0); -v8::CTypeInfo cargsseccomp_load[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcseccomp_load = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoseccomp_load = v8::CFunctionInfo(rcseccomp_load, 2, cargsseccomp_load); -v8::CFunction pFseccomp_load = v8::CFunction((const void*)&seccomp_loadFast, &infoseccomp_load); - -void seccomp_releaseFast(void* p, void* p0); -v8::CTypeInfo cargsseccomp_release[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcseccomp_release = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoseccomp_release = v8::CFunctionInfo(rcseccomp_release, 2, cargsseccomp_release); -v8::CFunction pFseccomp_release = v8::CFunction((const void*)&seccomp_releaseFast, &infoseccomp_release); - -int32_t seccomp_syscall_resolve_nameFast(void* p, struct FastOneByteString* const p0); -v8::CTypeInfo cargsseccomp_syscall_resolve_name[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rcseccomp_syscall_resolve_name = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoseccomp_syscall_resolve_name = v8::CFunctionInfo(rcseccomp_syscall_resolve_name, 2, cargsseccomp_syscall_resolve_name); -v8::CFunction pFseccomp_syscall_resolve_name = v8::CFunction((const void*)&seccomp_syscall_resolve_nameFast, &infoseccomp_syscall_resolve_name); - - - -void seccomp_syscall_resolve_num_archSlow(const FunctionCallbackInfo &args) { - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t v1 = Local::Cast(args[1])->Value(); - const char* rc = seccomp_syscall_resolve_num_arch(v0, v1); - Local ab = args[2].As()->Buffer(); - ((const char**)ab->Data())[0] = rc; -} - -void seccomp_syscall_resolve_num_archFast(void* p, int32_t p0, int32_t p1, struct FastApiTypedArray* const p_ret) { - int32_t v0 = p0; - int32_t v1 = p1; - const char* r = seccomp_syscall_resolve_num_arch(v0, v1); - ((const char**)p_ret->data)[0] = r; - -} -void seccomp_initSlow(const FunctionCallbackInfo &args) { - uint32_t v0 = Local::Cast(args[0])->Value(); - scmp_filter_ctx rc = seccomp_init(v0); - Local ab = args[1].As()->Buffer(); - ((scmp_filter_ctx*)ab->Data())[0] = rc; -} - -void seccomp_initFast(void* p, uint32_t p0, struct FastApiTypedArray* const p_ret) { - uint32_t v0 = p0; - scmp_filter_ctx r = seccomp_init(v0); - ((scmp_filter_ctx*)p_ret->data)[0] = r; - -} -void seccomp_rule_add_exactSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - scmp_filter_ctx v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - int32_t v2 = Local::Cast(args[2])->Value(); - uint32_t v3 = Local::Cast(args[3])->Value(); - int32_t rc = seccomp_rule_add_exact(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t seccomp_rule_add_exactFast(void* p, void* p0, uint32_t p1, int32_t p2, uint32_t p3) { - scmp_filter_ctx v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - int32_t v2 = p2; - uint32_t v3 = p3; - return seccomp_rule_add_exact(v0, v1, v2, v3); -} -void seccomp_loadSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - scmp_filter_ctx v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = seccomp_load(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t seccomp_loadFast(void* p, void* p0) { - scmp_filter_ctx v0 = reinterpret_cast(p0); - return seccomp_load(v0); -} -void seccomp_releaseSlow(const FunctionCallbackInfo &args) { - scmp_filter_ctx v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - seccomp_release(v0); -} - -void seccomp_releaseFast(void* p, void* p0) { - scmp_filter_ctx v0 = reinterpret_cast(p0); - seccomp_release(v0); -} -void seccomp_syscall_resolve_nameSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - String::Utf8Value v0(isolate, args[0]); - int32_t rc = seccomp_syscall_resolve_name(*v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t seccomp_syscall_resolve_nameFast(void* p, struct FastOneByteString* const p0) { - struct FastOneByteString* const v0 = p0; - return seccomp_syscall_resolve_name(v0->data); -} - -void Init(Isolate* isolate, Local target) { - Local module = ObjectTemplate::New(isolate); - SET_FAST_METHOD(isolate, module, "seccomp_syscall_resolve_num_arch", &pFseccomp_syscall_resolve_num_arch, seccomp_syscall_resolve_num_archSlow); - SET_FAST_METHOD(isolate, module, "seccomp_init", &pFseccomp_init, seccomp_initSlow); - SET_FAST_METHOD(isolate, module, "seccomp_rule_add_exact", &pFseccomp_rule_add_exact, seccomp_rule_add_exactSlow); - SET_FAST_METHOD(isolate, module, "seccomp_load", &pFseccomp_load, seccomp_loadSlow); - SET_FAST_METHOD(isolate, module, "seccomp_release", &pFseccomp_release, seccomp_releaseSlow); - SET_FAST_METHOD(isolate, module, "seccomp_syscall_resolve_name", &pFseccomp_syscall_resolve_name, seccomp_syscall_resolve_nameSlow); - - - - SET_MODULE(isolate, target, "seccomp", module); -} -} // namespace seccomp -} // namespace lo - -extern "C" { - void* _register_seccomp() { - return (void*)lo::seccomp::Init; - } -} diff --git a/lib/sqlite/sqlite.cc b/lib/sqlite/sqlite.cc deleted file mode 100644 index 9127bfd..0000000 --- a/lib/sqlite/sqlite.cc +++ /dev/null @@ -1,978 +0,0 @@ - -// [do not edit,] -// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile -#include -#include - -namespace lo { -namespace sqlite { - -using v8::String; -using v8::FunctionCallbackInfo; -using v8::Array; -using v8::Local; -using v8::ObjectTemplate; -using v8::Isolate; -using v8::Value; -using v8::Uint32Array; -using v8::ArrayBuffer; -using v8::Context; -using v8::Integer; -using v8::Function; -using v8::NewStringType; -using v8::Object; -using v8::BackingStore; -using v8::TryCatch; -using v8::ScriptCompiler; -using v8::Module; -using v8::FixedArray; -using v8::ScriptOrigin; -using v8::SharedArrayBuffer; -using v8::MaybeLocal; -using v8::HandleScope; -using v8::Promise; -using v8::Number; -using v8::StackTrace; -using v8::Message; -using v8::StackFrame; -using v8::Maybe; -using v8::FunctionTemplate; -using v8::FunctionCallback; -using v8::PromiseRejectMessage; -using v8::CFunction; -using v8::Global; -using v8::Exception; -using v8::CTypeInfo; -using v8::PropertyAttribute; -using v8::Signature; -using v8::ConstructorBehavior; -using v8::SideEffectType; -using v8::kPromiseRejectAfterResolved; -using v8::kPromiseResolveAfterResolved; -using v8::kPromiseHandlerAddedAfterReject; -using v8::Data; -using v8::PrimitiveArray; -using v8::TypedArray; -using v8::Uint8Array; -using v8::Boolean; -using v8::ModuleRequest; -using v8::CFunctionInfo; -using v8::OOMDetails; -using v8::V8; -using v8::BigInt; - -typedef int (*callback)(void*,int,char**,char**); - - -void versionFast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsversion[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcversion = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoversion = v8::CFunctionInfo(rcversion, 2, cargsversion); -v8::CFunction pFversion = v8::CFunction((const void*)&versionFast, &infoversion); - -int32_t openFast(void* p, void* p0, struct FastApiTypedArray* const p1); -v8::CTypeInfo cargsopen[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcopen = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoopen = v8::CFunctionInfo(rcopen, 3, cargsopen); -v8::CFunction pFopen = v8::CFunction((const void*)&openFast, &infoopen); - -int32_t open2Fast(void* p, struct FastOneByteString* const p0, struct FastApiTypedArray* const p1, int32_t p2, void* p3); -v8::CTypeInfo cargsopen2[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcopen2 = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoopen2 = v8::CFunctionInfo(rcopen2, 5, cargsopen2); -v8::CFunction pFopen2 = v8::CFunction((const void*)&open2Fast, &infoopen2); - -int32_t execFast(void* p, void* p0, struct FastOneByteString* const p1, void* p2, void* p3, struct FastApiTypedArray* const p4); -v8::CTypeInfo cargsexec[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcexec = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoexec = v8::CFunctionInfo(rcexec, 6, cargsexec); -v8::CFunction pFexec = v8::CFunction((const void*)&execFast, &infoexec); - -int32_t exec4Fast(void* p, void* p0, void* p1, void* p2, void* p3, void* p4); -v8::CTypeInfo cargsexec4[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcexec4 = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoexec4 = v8::CFunctionInfo(rcexec4, 6, cargsexec4); -v8::CFunction pFexec4 = v8::CFunction((const void*)&exec4Fast, &infoexec4); - -void errmsgFast(void* p, void* p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargserrmsg[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcerrmsg = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoerrmsg = v8::CFunctionInfo(rcerrmsg, 3, cargserrmsg); -v8::CFunction pFerrmsg = v8::CFunction((const void*)&errmsgFast, &infoerrmsg); - -int32_t close2Fast(void* p, void* p0); -v8::CTypeInfo cargsclose2[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcclose2 = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoclose2 = v8::CFunctionInfo(rcclose2, 2, cargsclose2); -v8::CFunction pFclose2 = v8::CFunction((const void*)&close2Fast, &infoclose2); - -int32_t prepare2Fast(void* p, void* p0, struct FastOneByteString* const p1, int32_t p2, struct FastApiTypedArray* const p3, void* p4); -v8::CTypeInfo cargsprepare2[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcprepare2 = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoprepare2 = v8::CFunctionInfo(rcprepare2, 6, cargsprepare2); -v8::CFunction pFprepare2 = v8::CFunction((const void*)&prepare2Fast, &infoprepare2); - -int32_t finalizeFast(void* p, void* p0); -v8::CTypeInfo cargsfinalize[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcfinalize = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infofinalize = v8::CFunctionInfo(rcfinalize, 2, cargsfinalize); -v8::CFunction pFfinalize = v8::CFunction((const void*)&finalizeFast, &infofinalize); - -int32_t column_countFast(void* p, void* p0); -v8::CTypeInfo cargscolumn_count[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rccolumn_count = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infocolumn_count = v8::CFunctionInfo(rccolumn_count, 2, cargscolumn_count); -v8::CFunction pFcolumn_count = v8::CFunction((const void*)&column_countFast, &infocolumn_count); - -int32_t column_typeFast(void* p, void* p0, int32_t p1); -v8::CTypeInfo cargscolumn_type[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rccolumn_type = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infocolumn_type = v8::CFunctionInfo(rccolumn_type, 3, cargscolumn_type); -v8::CFunction pFcolumn_type = v8::CFunction((const void*)&column_typeFast, &infocolumn_type); - -void column_nameFast(void* p, void* p0, int32_t p1, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargscolumn_name[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rccolumn_name = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infocolumn_name = v8::CFunctionInfo(rccolumn_name, 4, cargscolumn_name); -v8::CFunction pFcolumn_name = v8::CFunction((const void*)&column_nameFast, &infocolumn_name); - -int32_t stepFast(void* p, void* p0); -v8::CTypeInfo cargsstep[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcstep = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infostep = v8::CFunctionInfo(rcstep, 2, cargsstep); -v8::CFunction pFstep = v8::CFunction((const void*)&stepFast, &infostep); - -int32_t resetFast(void* p, void* p0); -v8::CTypeInfo cargsreset[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcreset = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo inforeset = v8::CFunctionInfo(rcreset, 2, cargsreset); -v8::CFunction pFreset = v8::CFunction((const void*)&resetFast, &inforeset); - -int32_t bind_intFast(void* p, void* p0, int32_t p1, int32_t p2); -v8::CTypeInfo cargsbind_int[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcbind_int = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infobind_int = v8::CFunctionInfo(rcbind_int, 4, cargsbind_int); -v8::CFunction pFbind_int = v8::CFunction((const void*)&bind_intFast, &infobind_int); - -int32_t bind_int64Fast(void* p, void* p0, int32_t p1, uint64_t p2); -v8::CTypeInfo cargsbind_int64[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcbind_int64 = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infobind_int64 = v8::CFunctionInfo(rcbind_int64, 4, cargsbind_int64); -v8::CFunction pFbind_int64 = v8::CFunction((const void*)&bind_int64Fast, &infobind_int64); - -int32_t bind_doubleFast(void* p, void* p0, int32_t p1, double p2); -v8::CTypeInfo cargsbind_double[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kFloat64), -}; -v8::CTypeInfo rcbind_double = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infobind_double = v8::CFunctionInfo(rcbind_double, 4, cargsbind_double); -v8::CFunction pFbind_double = v8::CFunction((const void*)&bind_doubleFast, &infobind_double); - -int32_t bind_textFast(void* p, void* p0, int32_t p1, struct FastOneByteString* const p2, int32_t p3, uint64_t p4); -v8::CTypeInfo cargsbind_text[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcbind_text = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infobind_text = v8::CFunctionInfo(rcbind_text, 6, cargsbind_text); -v8::CFunction pFbind_text = v8::CFunction((const void*)&bind_textFast, &infobind_text); - -int32_t bind_blobFast(void* p, void* p0, int32_t p1, struct FastApiTypedArray* const p2, int32_t p3, uint64_t p4); -v8::CTypeInfo cargsbind_blob[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcbind_blob = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infobind_blob = v8::CFunctionInfo(rcbind_blob, 6, cargsbind_blob); -v8::CFunction pFbind_blob = v8::CFunction((const void*)&bind_blobFast, &infobind_blob); - -int32_t column_intFast(void* p, void* p0, int32_t p1); -v8::CTypeInfo cargscolumn_int[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rccolumn_int = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infocolumn_int = v8::CFunctionInfo(rccolumn_int, 3, cargscolumn_int); -v8::CFunction pFcolumn_int = v8::CFunction((const void*)&column_intFast, &infocolumn_int); - -float column_doubleFast(void* p, void* p0, int32_t p1); -v8::CTypeInfo cargscolumn_double[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rccolumn_double = v8::CTypeInfo(v8::CTypeInfo::Type::kFloat32); -v8::CFunctionInfo infocolumn_double = v8::CFunctionInfo(rccolumn_double, 3, cargscolumn_double); -v8::CFunction pFcolumn_double = v8::CFunction((const void*)&column_doubleFast, &infocolumn_double); - -void column_textFast(void* p, void* p0, int32_t p1, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargscolumn_text[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rccolumn_text = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infocolumn_text = v8::CFunctionInfo(rccolumn_text, 4, cargscolumn_text); -v8::CFunction pFcolumn_text = v8::CFunction((const void*)&column_textFast, &infocolumn_text); - -void column_blobFast(void* p, void* p0, int32_t p1, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargscolumn_blob[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rccolumn_blob = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infocolumn_blob = v8::CFunctionInfo(rccolumn_blob, 4, cargscolumn_blob); -v8::CFunction pFcolumn_blob = v8::CFunction((const void*)&column_blobFast, &infocolumn_blob); - -int32_t column_bytesFast(void* p, void* p0, int32_t p1); -v8::CTypeInfo cargscolumn_bytes[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rccolumn_bytes = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infocolumn_bytes = v8::CFunctionInfo(rccolumn_bytes, 3, cargscolumn_bytes); -v8::CFunction pFcolumn_bytes = v8::CFunction((const void*)&column_bytesFast, &infocolumn_bytes); - -int32_t blob_openFast(void* p, void* p0, struct FastOneByteString* const p1, struct FastOneByteString* const p2, struct FastOneByteString* const p3, int64_t p4, int32_t p5, struct FastApiTypedArray* const p6); -v8::CTypeInfo cargsblob_open[8] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcblob_open = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoblob_open = v8::CFunctionInfo(rcblob_open, 8, cargsblob_open); -v8::CFunction pFblob_open = v8::CFunction((const void*)&blob_openFast, &infoblob_open); - -int32_t blob_bytesFast(void* p, void* p0); -v8::CTypeInfo cargsblob_bytes[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcblob_bytes = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoblob_bytes = v8::CFunctionInfo(rcblob_bytes, 2, cargsblob_bytes); -v8::CFunction pFblob_bytes = v8::CFunction((const void*)&blob_bytesFast, &infoblob_bytes); - -int32_t blob_readFast(void* p, void* p0, struct FastApiTypedArray* const p1, int32_t p2, int32_t p3); -v8::CTypeInfo cargsblob_read[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcblob_read = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoblob_read = v8::CFunctionInfo(rcblob_read, 5, cargsblob_read); -v8::CFunction pFblob_read = v8::CFunction((const void*)&blob_readFast, &infoblob_read); - -int32_t blob_closeFast(void* p, void* p0); -v8::CTypeInfo cargsblob_close[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcblob_close = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoblob_close = v8::CFunctionInfo(rcblob_close, 2, cargsblob_close); -v8::CFunction pFblob_close = v8::CFunction((const void*)&blob_closeFast, &infoblob_close); - -int32_t blob_writeFast(void* p, void* p0, struct FastApiTypedArray* const p1, int32_t p2, int32_t p3); -v8::CTypeInfo cargsblob_write[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcblob_write = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoblob_write = v8::CFunctionInfo(rcblob_write, 5, cargsblob_write); -v8::CFunction pFblob_write = v8::CFunction((const void*)&blob_writeFast, &infoblob_write); - -void serializeFast(void* p, void* p0, struct FastOneByteString* const p1, struct FastApiTypedArray* const p2, uint32_t p3, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsserialize[6] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcserialize = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoserialize = v8::CFunctionInfo(rcserialize, 6, cargsserialize); -v8::CFunction pFserialize = v8::CFunction((const void*)&serializeFast, &infoserialize); - -int32_t deserializeFast(void* p, void* p0, struct FastOneByteString* const p1, struct FastApiTypedArray* const p2, uint32_t p3, uint32_t p4, uint32_t p5); -v8::CTypeInfo cargsdeserialize[7] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcdeserialize = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infodeserialize = v8::CFunctionInfo(rcdeserialize, 7, cargsdeserialize); -v8::CFunction pFdeserialize = v8::CFunction((const void*)&deserializeFast, &infodeserialize); - - - -void versionSlow(const FunctionCallbackInfo &args) { - - const char* rc = sqlite3_libversion(); - Local ab = args[0].As()->Buffer(); - ((const char**)ab->Data())[0] = rc; -} - -void versionFast(void* p, struct FastApiTypedArray* const p_ret) { - - const char* r = sqlite3_libversion(); - ((const char**)p_ret->data)[0] = r; - -} -void openSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - const char* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - Local u321 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u321->Buffer()->Data() + u321->ByteOffset(); - sqlite3 ** v1 = reinterpret_cast(ptr1); - int32_t rc = sqlite3_open(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t openFast(void* p, void* p0, struct FastApiTypedArray* const p1) { - const char* v0 = reinterpret_cast(p0); - sqlite3 ** v1 = reinterpret_cast(p1->data); - return sqlite3_open(v0, v1); -} -void open2Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - String::Utf8Value v0(isolate, args[0]); - Local u321 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u321->Buffer()->Data() + u321->ByteOffset(); - sqlite3 ** v1 = reinterpret_cast(ptr1); - int32_t v2 = Local::Cast(args[2])->Value(); - const char* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - int32_t rc = sqlite3_open_v2(*v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t open2Fast(void* p, struct FastOneByteString* const p0, struct FastApiTypedArray* const p1, int32_t p2, void* p3) { - struct FastOneByteString* const v0 = p0; - sqlite3 ** v1 = reinterpret_cast(p1->data); - int32_t v2 = p2; - const char* v3 = reinterpret_cast(p3); - return sqlite3_open_v2(v0->data, v1, v2, v3); -} -void execSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - callback v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - void* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - Local u324 = args[4].As(); - uint8_t* ptr4 = (uint8_t*)u324->Buffer()->Data() + u324->ByteOffset(); - char** v4 = reinterpret_cast(ptr4); - int32_t rc = sqlite3_exec(v0, *v1, v2, v3, v4); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t execFast(void* p, void* p0, struct FastOneByteString* const p1, void* p2, void* p3, struct FastApiTypedArray* const p4) { - sqlite3* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - callback v2 = reinterpret_cast(p2); - void* v3 = reinterpret_cast(p3); - char** v4 = reinterpret_cast(p4->data); - return sqlite3_exec(v0, v1->data, v2, v3, v4); -} -void exec2Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - callback v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - void* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - Local u324 = args[4].As(); - uint8_t* ptr4 = (uint8_t*)u324->Buffer()->Data() + u324->ByteOffset(); - char** v4 = reinterpret_cast(ptr4); - int32_t rc = sqlite3_exec(v0, *v1, v2, v3, v4); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -void exec3Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - callback v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - void* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - char** v4 = reinterpret_cast((uint64_t)Local::Cast(args[4])->Value()); - int32_t rc = sqlite3_exec(v0, v1, v2, v3, v4); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -void exec4Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const char* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - callback v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - void* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - char** v4 = reinterpret_cast((uint64_t)Local::Cast(args[4])->Value()); - int32_t rc = sqlite3_exec(v0, v1, v2, v3, v4); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t exec4Fast(void* p, void* p0, void* p1, void* p2, void* p3, void* p4) { - sqlite3* v0 = reinterpret_cast(p0); - const char* v1 = reinterpret_cast(p1); - callback v2 = reinterpret_cast(p2); - void* v3 = reinterpret_cast(p3); - char** v4 = reinterpret_cast(p4); - return sqlite3_exec(v0, v1, v2, v3, v4); -} -void errmsgSlow(const FunctionCallbackInfo &args) { - sqlite3* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - const char* rc = sqlite3_errmsg(v0); - Local ab = args[1].As()->Buffer(); - ((const char**)ab->Data())[0] = rc; -} - -void errmsgFast(void* p, void* p0, struct FastApiTypedArray* const p_ret) { - sqlite3* v0 = reinterpret_cast(p0); - const char* r = sqlite3_errmsg(v0); - ((const char**)p_ret->data)[0] = r; - -} -void close2Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = sqlite3_close_v2(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t close2Fast(void* p, void* p0) { - sqlite3* v0 = reinterpret_cast(p0); - return sqlite3_close_v2(v0); -} -void prepare2Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - int32_t v2 = Local::Cast(args[2])->Value(); - Local u323 = args[3].As(); - uint8_t* ptr3 = (uint8_t*)u323->Buffer()->Data() + u323->ByteOffset(); - sqlite3_stmt ** v3 = reinterpret_cast(ptr3); - const char** v4 = reinterpret_cast((uint64_t)Local::Cast(args[4])->Value()); - int32_t rc = sqlite3_prepare_v2(v0, *v1, v2, v3, v4); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t prepare2Fast(void* p, void* p0, struct FastOneByteString* const p1, int32_t p2, struct FastApiTypedArray* const p3, void* p4) { - sqlite3* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - int32_t v2 = p2; - sqlite3_stmt ** v3 = reinterpret_cast(p3->data); - const char** v4 = reinterpret_cast(p4); - return sqlite3_prepare_v2(v0, v1->data, v2, v3, v4); -} -void finalizeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_stmt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = sqlite3_finalize(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t finalizeFast(void* p, void* p0) { - sqlite3_stmt* v0 = reinterpret_cast(p0); - return sqlite3_finalize(v0); -} -void column_countSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_stmt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = sqlite3_column_count(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t column_countFast(void* p, void* p0) { - sqlite3_stmt* v0 = reinterpret_cast(p0); - return sqlite3_column_count(v0); -} -void column_typeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_stmt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = sqlite3_column_type(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t column_typeFast(void* p, void* p0, int32_t p1) { - sqlite3_stmt* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - return sqlite3_column_type(v0, v1); -} -void column_nameSlow(const FunctionCallbackInfo &args) { - sqlite3_stmt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - const char* rc = sqlite3_column_name(v0, v1); - Local ab = args[2].As()->Buffer(); - ((const char**)ab->Data())[0] = rc; -} - -void column_nameFast(void* p, void* p0, int32_t p1, struct FastApiTypedArray* const p_ret) { - sqlite3_stmt* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - const char* r = sqlite3_column_name(v0, v1); - ((const char**)p_ret->data)[0] = r; - -} -void stepSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_stmt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = sqlite3_step(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t stepFast(void* p, void* p0) { - sqlite3_stmt* v0 = reinterpret_cast(p0); - return sqlite3_step(v0); -} -void resetSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_stmt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = sqlite3_reset(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t resetFast(void* p, void* p0) { - sqlite3_stmt* v0 = reinterpret_cast(p0); - return sqlite3_reset(v0); -} -void bind_intSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_stmt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = sqlite3_bind_int(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t bind_intFast(void* p, void* p0, int32_t p1, int32_t p2) { - sqlite3_stmt* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - int32_t v2 = p2; - return sqlite3_bind_int(v0, v1, v2); -} -void bind_int64Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_stmt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - uint64_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = sqlite3_bind_int64(v0, v1, (sqlite3_int64)v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t bind_int64Fast(void* p, void* p0, int32_t p1, uint64_t p2) { - sqlite3_stmt* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - uint64_t v2 = p2; - return sqlite3_bind_int64(v0, v1, (sqlite3_int64)v2); -} -void bind_doubleSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_stmt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - double v2 = Local::Cast(args[2])->Value(); - int32_t rc = sqlite3_bind_double(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t bind_doubleFast(void* p, void* p0, int32_t p1, double p2) { - sqlite3_stmt* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - double v2 = p2; - return sqlite3_bind_double(v0, v1, v2); -} -void bind_textSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_stmt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - String::Utf8Value v2(isolate, args[2]); - int32_t v3 = Local::Cast(args[3])->Value(); - uint64_t v4 = Local::Cast(args[4])->Value(); - int32_t rc = sqlite3_bind_text(v0, v1, *v2, v3, (sqlite3_destructor_type)v4); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t bind_textFast(void* p, void* p0, int32_t p1, struct FastOneByteString* const p2, int32_t p3, uint64_t p4) { - sqlite3_stmt* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - struct FastOneByteString* const v2 = p2; - int32_t v3 = p3; - uint64_t v4 = p4; - return sqlite3_bind_text(v0, v1, v2->data, v3, (sqlite3_destructor_type)v4); -} -void bind_blobSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_stmt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - Local u82 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u82->Buffer()->Data() + u82->ByteOffset(); - const void* v2 = reinterpret_cast(ptr2); - int32_t v3 = Local::Cast(args[3])->Value(); - uint64_t v4 = Local::Cast(args[4])->Value(); - int32_t rc = sqlite3_bind_blob(v0, v1, v2, v3, (sqlite3_destructor_type)v4); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t bind_blobFast(void* p, void* p0, int32_t p1, struct FastApiTypedArray* const p2, int32_t p3, uint64_t p4) { - sqlite3_stmt* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - const void* v2 = reinterpret_cast(p2->data); - int32_t v3 = p3; - uint64_t v4 = p4; - return sqlite3_bind_blob(v0, v1, v2, v3, (sqlite3_destructor_type)v4); -} -void column_intSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_stmt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = sqlite3_column_int(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t column_intFast(void* p, void* p0, int32_t p1) { - sqlite3_stmt* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - return sqlite3_column_int(v0, v1); -} -void column_doubleSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_stmt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - float rc = sqlite3_column_double(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -float column_doubleFast(void* p, void* p0, int32_t p1) { - sqlite3_stmt* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - return sqlite3_column_double(v0, v1); -} -void column_textSlow(const FunctionCallbackInfo &args) { - sqlite3_stmt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - const unsigned char* rc = sqlite3_column_text(v0, v1); - Local ab = args[2].As()->Buffer(); - ((const unsigned char**)ab->Data())[0] = rc; -} - -void column_textFast(void* p, void* p0, int32_t p1, struct FastApiTypedArray* const p_ret) { - sqlite3_stmt* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - const unsigned char* r = sqlite3_column_text(v0, v1); - ((const unsigned char**)p_ret->data)[0] = r; - -} -void column_blobSlow(const FunctionCallbackInfo &args) { - sqlite3_stmt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - const void* rc = sqlite3_column_blob(v0, v1); - Local ab = args[2].As()->Buffer(); - ((const void**)ab->Data())[0] = rc; -} - -void column_blobFast(void* p, void* p0, int32_t p1, struct FastApiTypedArray* const p_ret) { - sqlite3_stmt* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - const void* r = sqlite3_column_blob(v0, v1); - ((const void**)p_ret->data)[0] = r; - -} -void column_bytesSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_stmt* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = sqlite3_column_bytes(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t column_bytesFast(void* p, void* p0, int32_t p1) { - sqlite3_stmt* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - return sqlite3_column_bytes(v0, v1); -} -void blob_openSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - String::Utf8Value v2(isolate, args[2]); - String::Utf8Value v3(isolate, args[3]); - int64_t v4 = Local::Cast(args[4])->Value(); - int32_t v5 = Local::Cast(args[5])->Value(); - Local u326 = args[6].As(); - uint8_t* ptr6 = (uint8_t*)u326->Buffer()->Data() + u326->ByteOffset(); - sqlite3_blob** v6 = reinterpret_cast(ptr6); - int32_t rc = sqlite3_blob_open(v0, *v1, *v2, *v3, v4, v5, v6); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t blob_openFast(void* p, void* p0, struct FastOneByteString* const p1, struct FastOneByteString* const p2, struct FastOneByteString* const p3, int64_t p4, int32_t p5, struct FastApiTypedArray* const p6) { - sqlite3* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - struct FastOneByteString* const v2 = p2; - struct FastOneByteString* const v3 = p3; - int64_t v4 = p4; - int32_t v5 = p5; - sqlite3_blob** v6 = reinterpret_cast(p6->data); - return sqlite3_blob_open(v0, v1->data, v2->data, v3->data, v4, v5, v6); -} -void blob_bytesSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_blob* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = sqlite3_blob_bytes(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t blob_bytesFast(void* p, void* p0) { - sqlite3_blob* v0 = reinterpret_cast(p0); - return sqlite3_blob_bytes(v0); -} -void blob_readSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_blob* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - void* v1 = reinterpret_cast(ptr1); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t v3 = Local::Cast(args[3])->Value(); - int32_t rc = sqlite3_blob_read(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t blob_readFast(void* p, void* p0, struct FastApiTypedArray* const p1, int32_t p2, int32_t p3) { - sqlite3_blob* v0 = reinterpret_cast(p0); - void* v1 = reinterpret_cast(p1->data); - int32_t v2 = p2; - int32_t v3 = p3; - return sqlite3_blob_read(v0, v1, v2, v3); -} -void blob_closeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_blob* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = sqlite3_blob_close(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t blob_closeFast(void* p, void* p0) { - sqlite3_blob* v0 = reinterpret_cast(p0); - return sqlite3_blob_close(v0); -} -void blob_writeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3_blob* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - void* v1 = reinterpret_cast(ptr1); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t v3 = Local::Cast(args[3])->Value(); - int32_t rc = sqlite3_blob_write(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t blob_writeFast(void* p, void* p0, struct FastApiTypedArray* const p1, int32_t p2, int32_t p3) { - sqlite3_blob* v0 = reinterpret_cast(p0); - void* v1 = reinterpret_cast(p1->data); - int32_t v2 = p2; - int32_t v3 = p3; - return sqlite3_blob_write(v0, v1, v2, v3); -} -void serializeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - Local u322 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u322->Buffer()->Data() + u322->ByteOffset(); - sqlite3_int64* v2 = reinterpret_cast(ptr2); - uint32_t v3 = Local::Cast(args[3])->Value(); - unsigned char* rc = sqlite3_serialize(v0, *v1, v2, v3); - Local ab = args[4].As()->Buffer(); - ((unsigned char**)ab->Data())[0] = rc; -} - -void serializeFast(void* p, void* p0, struct FastOneByteString* const p1, struct FastApiTypedArray* const p2, uint32_t p3, struct FastApiTypedArray* const p_ret) { - sqlite3* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - sqlite3_int64* v2 = reinterpret_cast(p2->data); - uint32_t v3 = p3; - unsigned char* r = sqlite3_serialize(v0, v1->data, v2, v3); - ((unsigned char**)p_ret->data)[0] = r; - -} -void deserializeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - sqlite3* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - Local u82 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u82->Buffer()->Data() + u82->ByteOffset(); - unsigned char* v2 = reinterpret_cast(ptr2); - uint32_t v3 = Local::Cast(args[3])->Value(); - uint32_t v4 = Local::Cast(args[4])->Value(); - uint32_t v5 = Local::Cast(args[5])->Value(); - int32_t rc = sqlite3_deserialize(v0, *v1, v2, v3, v4, v5); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t deserializeFast(void* p, void* p0, struct FastOneByteString* const p1, struct FastApiTypedArray* const p2, uint32_t p3, uint32_t p4, uint32_t p5) { - sqlite3* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - unsigned char* v2 = reinterpret_cast(p2->data); - uint32_t v3 = p3; - uint32_t v4 = p4; - uint32_t v5 = p5; - return sqlite3_deserialize(v0, v1->data, v2, v3, v4, v5); -} - -void Init(Isolate* isolate, Local target) { - Local module = ObjectTemplate::New(isolate); - SET_FAST_METHOD(isolate, module, "version", &pFversion, versionSlow); - SET_FAST_METHOD(isolate, module, "open", &pFopen, openSlow); - SET_FAST_METHOD(isolate, module, "open2", &pFopen2, open2Slow); - SET_FAST_METHOD(isolate, module, "exec", &pFexec, execSlow); - SET_METHOD(isolate, module, "exec2", exec2Slow); - SET_METHOD(isolate, module, "exec3", exec3Slow); - SET_FAST_METHOD(isolate, module, "exec4", &pFexec4, exec4Slow); - SET_FAST_METHOD(isolate, module, "errmsg", &pFerrmsg, errmsgSlow); - SET_FAST_METHOD(isolate, module, "close2", &pFclose2, close2Slow); - SET_FAST_METHOD(isolate, module, "prepare2", &pFprepare2, prepare2Slow); - SET_FAST_METHOD(isolate, module, "finalize", &pFfinalize, finalizeSlow); - SET_FAST_METHOD(isolate, module, "column_count", &pFcolumn_count, column_countSlow); - SET_FAST_METHOD(isolate, module, "column_type", &pFcolumn_type, column_typeSlow); - SET_FAST_METHOD(isolate, module, "column_name", &pFcolumn_name, column_nameSlow); - SET_FAST_METHOD(isolate, module, "step", &pFstep, stepSlow); - SET_FAST_METHOD(isolate, module, "reset", &pFreset, resetSlow); - SET_FAST_METHOD(isolate, module, "bind_int", &pFbind_int, bind_intSlow); - SET_FAST_METHOD(isolate, module, "bind_int64", &pFbind_int64, bind_int64Slow); - SET_FAST_METHOD(isolate, module, "bind_double", &pFbind_double, bind_doubleSlow); - SET_FAST_METHOD(isolate, module, "bind_text", &pFbind_text, bind_textSlow); - SET_FAST_METHOD(isolate, module, "bind_blob", &pFbind_blob, bind_blobSlow); - SET_FAST_METHOD(isolate, module, "column_int", &pFcolumn_int, column_intSlow); - SET_FAST_METHOD(isolate, module, "column_double", &pFcolumn_double, column_doubleSlow); - SET_FAST_METHOD(isolate, module, "column_text", &pFcolumn_text, column_textSlow); - SET_FAST_METHOD(isolate, module, "column_blob", &pFcolumn_blob, column_blobSlow); - SET_FAST_METHOD(isolate, module, "column_bytes", &pFcolumn_bytes, column_bytesSlow); - SET_FAST_METHOD(isolate, module, "blob_open", &pFblob_open, blob_openSlow); - SET_FAST_METHOD(isolate, module, "blob_bytes", &pFblob_bytes, blob_bytesSlow); - SET_FAST_METHOD(isolate, module, "blob_read", &pFblob_read, blob_readSlow); - SET_FAST_METHOD(isolate, module, "blob_close", &pFblob_close, blob_closeSlow); - SET_FAST_METHOD(isolate, module, "blob_write", &pFblob_write, blob_writeSlow); - SET_FAST_METHOD(isolate, module, "serialize", &pFserialize, serializeSlow); - SET_FAST_METHOD(isolate, module, "deserialize", &pFdeserialize, deserializeSlow); - - SET_VALUE(isolate, module, "SQLITE_OPEN_READWRITE", Integer::New(isolate, SQLITE_OPEN_READWRITE)); - SET_VALUE(isolate, module, "SQLITE_OPEN_PRIVATECACHE", Integer::New(isolate, SQLITE_OPEN_PRIVATECACHE)); - SET_VALUE(isolate, module, "SQLITE_ROW", Integer::New(isolate, SQLITE_ROW)); - SET_VALUE(isolate, module, "SQLITE_OPEN_NOMUTEX", Integer::New(isolate, SQLITE_OPEN_NOMUTEX)); - SET_VALUE(isolate, module, "SQLITE_OPEN_CREATE", Integer::New(isolate, SQLITE_OPEN_CREATE)); - SET_VALUE(isolate, module, "SQLITE_OK", Integer::New(isolate, SQLITE_OK)); - SET_VALUE(isolate, module, "SQLITE_OPEN_READONLY", Integer::New(isolate, SQLITE_OPEN_READONLY)); - - - SET_MODULE(isolate, target, "sqlite", module); -} -} // namespace sqlite -} // namespace lo - -extern "C" { - void* _register_sqlite() { - return (void*)lo::sqlite::Init; - } -} diff --git a/lib/system.js b/lib/system.js new file mode 100644 index 0000000..eb72709 --- /dev/null +++ b/lib/system.js @@ -0,0 +1,17 @@ +const { system } = lo.load('system') + +const decoder = new TextDecoder() + +function wrapStrError () { + const eb = new Uint8Array(1024) + const { strerror_r } = system + system.strerror = (errnum = lo.errno) => { + const rc = strerror_r(errnum, eb, 1024) + if (rc !== 0) return + return decoder.decode(eb) + } +} + +wrapStrError() + +export { system } diff --git a/lib/system/system.cc b/lib/system/system.cc deleted file mode 100644 index a0539e8..0000000 --- a/lib/system/system.cc +++ /dev/null @@ -1,964 +0,0 @@ - -// [do not edit,] -// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace lo { -namespace system { - -using v8::String; -using v8::FunctionCallbackInfo; -using v8::Array; -using v8::Local; -using v8::ObjectTemplate; -using v8::Isolate; -using v8::Value; -using v8::Uint32Array; -using v8::ArrayBuffer; -using v8::Context; -using v8::Integer; -using v8::Function; -using v8::NewStringType; -using v8::Object; -using v8::BackingStore; -using v8::TryCatch; -using v8::ScriptCompiler; -using v8::Module; -using v8::FixedArray; -using v8::ScriptOrigin; -using v8::SharedArrayBuffer; -using v8::MaybeLocal; -using v8::HandleScope; -using v8::Promise; -using v8::Number; -using v8::StackTrace; -using v8::Message; -using v8::StackFrame; -using v8::Maybe; -using v8::FunctionTemplate; -using v8::FunctionCallback; -using v8::PromiseRejectMessage; -using v8::CFunction; -using v8::Global; -using v8::Exception; -using v8::CTypeInfo; -using v8::PropertyAttribute; -using v8::Signature; -using v8::ConstructorBehavior; -using v8::SideEffectType; -using v8::kPromiseRejectAfterResolved; -using v8::kPromiseResolveAfterResolved; -using v8::kPromiseHandlerAddedAfterReject; -using v8::Data; -using v8::PrimitiveArray; -using v8::TypedArray; -using v8::Uint8Array; -using v8::Boolean; -using v8::ModuleRequest; -using v8::CFunctionInfo; -using v8::OOMDetails; -using v8::V8; -using v8::BigInt; - - -#ifdef __cplusplus -extern "C" - { -#endif - extern - int __xpg_strerror_r(int errcode,char* buffer,size_t length); - #define strerror_r __xpg_strerror_r - -#ifdef __cplusplus - } -#endif - - -void mmapFast(void* p, void* p0, uint32_t p1, int32_t p2, int32_t p3, int32_t p4, uint32_t p5, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsmmap[8] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcmmap = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infommap = v8::CFunctionInfo(rcmmap, 8, cargsmmap); -v8::CFunction pFmmap = v8::CFunction((const void*)&mmapFast, &infommap); - -int32_t munmapFast(void* p, void* p0, uint32_t p1); -v8::CTypeInfo cargsmunmap[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcmunmap = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infomunmap = v8::CFunctionInfo(rcmunmap, 3, cargsmunmap); -v8::CFunction pFmunmap = v8::CFunction((const void*)&munmapFast, &infomunmap); - -void getcwdFast(void* p, struct FastApiTypedArray* const p0, int32_t p1, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsgetcwd[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcgetcwd = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infogetcwd = v8::CFunctionInfo(rcgetcwd, 4, cargsgetcwd); -v8::CFunction pFgetcwd = v8::CFunction((const void*)&getcwdFast, &infogetcwd); - -int32_t eventfdFast(void* p, uint32_t p0, int32_t p1); -v8::CTypeInfo cargseventfd[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rceventfd = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoeventfd = v8::CFunctionInfo(rceventfd, 3, cargseventfd); -v8::CFunction pFeventfd = v8::CFunction((const void*)&eventfdFast, &infoeventfd); - -int32_t clock_gettimeFast(void* p, int32_t p0, void* p1); -v8::CTypeInfo cargsclock_gettime[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcclock_gettime = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoclock_gettime = v8::CFunctionInfo(rcclock_gettime, 3, cargsclock_gettime); -v8::CFunction pFclock_gettime = v8::CFunction((const void*)&clock_gettimeFast, &infoclock_gettime); - -int32_t mprotectFast(void* p, void* p0, uint32_t p1, int32_t p2); -v8::CTypeInfo cargsmprotect[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcmprotect = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infomprotect = v8::CFunctionInfo(rcmprotect, 4, cargsmprotect); -v8::CFunction pFmprotect = v8::CFunction((const void*)&mprotectFast, &infomprotect); - -void memcpyFast(void* p, void* p0, void* p1, uint32_t p2, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsmemcpy[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcmemcpy = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infomemcpy = v8::CFunctionInfo(rcmemcpy, 5, cargsmemcpy); -v8::CFunction pFmemcpy = v8::CFunction((const void*)&memcpyFast, &infomemcpy); - -void memmoveFast(void* p, void* p0, void* p1, uint32_t p2, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsmemmove[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcmemmove = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infomemmove = v8::CFunctionInfo(rcmemmove, 5, cargsmemmove); -v8::CFunction pFmemmove = v8::CFunction((const void*)&memmoveFast, &infomemmove); - -void exitFast(void* p, int32_t p0); -v8::CTypeInfo cargsexit[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcexit = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infoexit = v8::CFunctionInfo(rcexit, 2, cargsexit); -v8::CFunction pFexit = v8::CFunction((const void*)&exitFast, &infoexit); - -int32_t usleepFast(void* p, uint32_t p0); -v8::CTypeInfo cargsusleep[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcusleep = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infousleep = v8::CFunctionInfo(rcusleep, 2, cargsusleep); -v8::CFunction pFusleep = v8::CFunction((const void*)&usleepFast, &infousleep); - -int32_t getpidFast(void* p); -v8::CTypeInfo cargsgetpid[1] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - -}; -v8::CTypeInfo rcgetpid = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infogetpid = v8::CFunctionInfo(rcgetpid, 1, cargsgetpid); -v8::CFunction pFgetpid = v8::CFunction((const void*)&getpidFast, &infogetpid); - -int32_t getrusageFast(void* p, int32_t p0, struct FastApiTypedArray* const p1); -v8::CTypeInfo cargsgetrusage[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcgetrusage = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infogetrusage = v8::CFunctionInfo(rcgetrusage, 3, cargsgetrusage); -v8::CFunction pFgetrusage = v8::CFunction((const void*)&getrusageFast, &infogetrusage); - -int32_t timerfd_createFast(void* p, int32_t p0, int32_t p1); -v8::CTypeInfo cargstimerfd_create[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rctimerfd_create = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infotimerfd_create = v8::CFunctionInfo(rctimerfd_create, 3, cargstimerfd_create); -v8::CFunction pFtimerfd_create = v8::CFunction((const void*)&timerfd_createFast, &infotimerfd_create); - -uint32_t sleepFast(void* p, uint32_t p0); -v8::CTypeInfo cargssleep[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcsleep = v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); -v8::CFunctionInfo infosleep = v8::CFunctionInfo(rcsleep, 2, cargssleep); -v8::CFunction pFsleep = v8::CFunction((const void*)&sleepFast, &infosleep); - -int32_t timerfd_settimeFast(void* p, int32_t p0, int32_t p1, struct FastApiTypedArray* const p2, void* p3); -v8::CTypeInfo cargstimerfd_settime[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rctimerfd_settime = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infotimerfd_settime = v8::CFunctionInfo(rctimerfd_settime, 5, cargstimerfd_settime); -v8::CFunction pFtimerfd_settime = v8::CFunction((const void*)&timerfd_settimeFast, &infotimerfd_settime); - -int32_t forkFast(void* p); -v8::CTypeInfo cargsfork[1] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - -}; -v8::CTypeInfo rcfork = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infofork = v8::CFunctionInfo(rcfork, 1, cargsfork); -v8::CFunction pFfork = v8::CFunction((const void*)&forkFast, &infofork); - -int32_t killFast(void* p, int32_t p0, int32_t p1); -v8::CTypeInfo cargskill[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rckill = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infokill = v8::CFunctionInfo(rckill, 3, cargskill); -v8::CFunction pFkill = v8::CFunction((const void*)&killFast, &infokill); - -int32_t waitpidFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2); -v8::CTypeInfo cargswaitpid[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcwaitpid = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infowaitpid = v8::CFunctionInfo(rcwaitpid, 4, cargswaitpid); -v8::CFunction pFwaitpid = v8::CFunction((const void*)&waitpidFast, &infowaitpid); - -int32_t execvpFast(void* p, struct FastOneByteString* const p0, struct FastApiTypedArray* const p1); -v8::CTypeInfo cargsexecvp[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcexecvp = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoexecvp = v8::CFunctionInfo(rcexecvp, 3, cargsexecvp); -v8::CFunction pFexecvp = v8::CFunction((const void*)&execvpFast, &infoexecvp); - -uint32_t readlinkFast(void* p, struct FastOneByteString* const p0, struct FastApiTypedArray* const p1, uint32_t p2); -v8::CTypeInfo cargsreadlink[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcreadlink = v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); -v8::CFunctionInfo inforeadlink = v8::CFunctionInfo(rcreadlink, 4, cargsreadlink); -v8::CFunction pFreadlink = v8::CFunction((const void*)&readlinkFast, &inforeadlink); - -uint32_t sysconfFast(void* p, int32_t p0); -v8::CTypeInfo cargssysconf[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcsysconf = v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); -v8::CFunctionInfo infosysconf = v8::CFunctionInfo(rcsysconf, 2, cargssysconf); -v8::CFunction pFsysconf = v8::CFunction((const void*)&sysconfFast, &infosysconf); - -int32_t pidfd_openFast(void* p, int32_t p0, int32_t p1, uint32_t p2); -v8::CTypeInfo cargspidfd_open[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcpidfd_open = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infopidfd_open = v8::CFunctionInfo(rcpidfd_open, 4, cargspidfd_open); -v8::CFunction pFpidfd_open = v8::CFunction((const void*)&pidfd_openFast, &infopidfd_open); - -int32_t gettidFast(void* p, int32_t p0); -v8::CTypeInfo cargsgettid[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rcgettid = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infogettid = v8::CFunctionInfo(rcgettid, 2, cargsgettid); -v8::CFunction pFgettid = v8::CFunction((const void*)&gettidFast, &infogettid); - -int32_t getrlimitFast(void* p, int32_t p0, struct FastApiTypedArray* const p1); -v8::CTypeInfo cargsgetrlimit[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcgetrlimit = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infogetrlimit = v8::CFunctionInfo(rcgetrlimit, 3, cargsgetrlimit); -v8::CFunction pFgetrlimit = v8::CFunction((const void*)&getrlimitFast, &infogetrlimit); - -int32_t setrlimitFast(void* p, int32_t p0, struct FastApiTypedArray* const p1); -v8::CTypeInfo cargssetrlimit[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcsetrlimit = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infosetrlimit = v8::CFunctionInfo(rcsetrlimit, 3, cargssetrlimit); -v8::CFunction pFsetrlimit = v8::CFunction((const void*)&setrlimitFast, &infosetrlimit); - -int32_t strerror_rFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, uint32_t p2); -v8::CTypeInfo cargsstrerror_r[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcstrerror_r = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infostrerror_r = v8::CFunctionInfo(rcstrerror_r, 4, cargsstrerror_r); -v8::CFunction pFstrerror_r = v8::CFunction((const void*)&strerror_rFast, &infostrerror_r); - -int32_t timesFast(void* p, struct FastApiTypedArray* const p0); -v8::CTypeInfo cargstimes[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rctimes = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infotimes = v8::CFunctionInfo(rctimes, 2, cargstimes); -v8::CFunction pFtimes = v8::CFunction((const void*)×Fast, &infotimes); - -uint32_t sysinfoFast(void* p, struct FastApiTypedArray* const p0); -v8::CTypeInfo cargssysinfo[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcsysinfo = v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); -v8::CFunctionInfo infosysinfo = v8::CFunctionInfo(rcsysinfo, 2, cargssysinfo); -v8::CFunction pFsysinfo = v8::CFunction((const void*)&sysinfoFast, &infosysinfo); - -uint32_t get_avphys_pagesFast(void* p); -v8::CTypeInfo cargsget_avphys_pages[1] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - -}; -v8::CTypeInfo rcget_avphys_pages = v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); -v8::CFunctionInfo infoget_avphys_pages = v8::CFunctionInfo(rcget_avphys_pages, 1, cargsget_avphys_pages); -v8::CFunction pFget_avphys_pages = v8::CFunction((const void*)&get_avphys_pagesFast, &infoget_avphys_pages); - -void signalFast(void* p, int32_t p0, void* p1, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargssignal[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcsignal = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infosignal = v8::CFunctionInfo(rcsignal, 4, cargssignal); -v8::CFunction pFsignal = v8::CFunction((const void*)&signalFast, &infosignal); - -void getenvFast(void* p, struct FastOneByteString* const p0, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargsgetenv[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rcgetenv = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infogetenv = v8::CFunctionInfo(rcgetenv, 3, cargsgetenv); -v8::CFunction pFgetenv = v8::CFunction((const void*)&getenvFast, &infogetenv); - -void callocFast(void* p, uint32_t p0, uint32_t p1, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargscalloc[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rccalloc = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infocalloc = v8::CFunctionInfo(rccalloc, 4, cargscalloc); -v8::CFunction pFcalloc = v8::CFunction((const void*)&callocFast, &infocalloc); - -void freeFast(void* p, void* p0); -v8::CTypeInfo cargsfree[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcfree = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infofree = v8::CFunctionInfo(rcfree, 2, cargsfree); -v8::CFunction pFfree = v8::CFunction((const void*)&freeFast, &infofree); - -int32_t memfd_createFast(void* p, struct FastOneByteString* const p0, uint32_t p1); -v8::CTypeInfo cargsmemfd_create[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcmemfd_create = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infomemfd_create = v8::CFunctionInfo(rcmemfd_create, 3, cargsmemfd_create); -v8::CFunction pFmemfd_create = v8::CFunction((const void*)&memfd_createFast, &infomemfd_create); - - - -void mmapSlow(const FunctionCallbackInfo &args) { - void* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t v3 = Local::Cast(args[3])->Value(); - int32_t v4 = Local::Cast(args[4])->Value(); - uint32_t v5 = Local::Cast(args[5])->Value(); - void* rc = mmap(v0, v1, v2, v3, v4, v5); - Local ab = args[6].As()->Buffer(); - ((void**)ab->Data())[0] = rc; -} - -void mmapFast(void* p, void* p0, uint32_t p1, int32_t p2, int32_t p3, int32_t p4, uint32_t p5, struct FastApiTypedArray* const p_ret) { - void* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - int32_t v2 = p2; - int32_t v3 = p3; - int32_t v4 = p4; - uint32_t v5 = p5; - void* r = mmap(v0, v1, v2, v3, v4, v5); - ((void**)p_ret->data)[0] = r; - -} -void munmapSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - void* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = munmap(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t munmapFast(void* p, void* p0, uint32_t p1) { - void* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - return munmap(v0, v1); -} -void getcwdSlow(const FunctionCallbackInfo &args) { - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - char* v0 = reinterpret_cast(ptr0); - int32_t v1 = Local::Cast(args[1])->Value(); - char* rc = getcwd(v0, v1); - Local ab = args[2].As()->Buffer(); - ((char**)ab->Data())[0] = rc; -} - -void getcwdFast(void* p, struct FastApiTypedArray* const p0, int32_t p1, struct FastApiTypedArray* const p_ret) { - char* v0 = reinterpret_cast(p0->data); - int32_t v1 = p1; - char* r = getcwd(v0, v1); - ((char**)p_ret->data)[0] = r; - -} -void eventfdSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - uint32_t v0 = Local::Cast(args[0])->Value(); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = eventfd(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t eventfdFast(void* p, uint32_t p0, int32_t p1) { - uint32_t v0 = p0; - int32_t v1 = p1; - return eventfd(v0, v1); -} -void clock_gettimeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - timespec* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t rc = clock_gettime(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t clock_gettimeFast(void* p, int32_t p0, void* p1) { - int32_t v0 = p0; - timespec* v1 = reinterpret_cast(p1); - return clock_gettime(v0, v1); -} -void mprotectSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - void* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - uint32_t v1 = Local::Cast(args[1])->Value(); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = mprotect(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t mprotectFast(void* p, void* p0, uint32_t p1, int32_t p2) { - void* v0 = reinterpret_cast(p0); - uint32_t v1 = p1; - int32_t v2 = p2; - return mprotect(v0, v1, v2); -} -void memcpySlow(const FunctionCallbackInfo &args) { - void* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - void* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - uint32_t v2 = Local::Cast(args[2])->Value(); - void* rc = memcpy(v0, v1, v2); - Local ab = args[3].As()->Buffer(); - ((void**)ab->Data())[0] = rc; -} - -void memcpyFast(void* p, void* p0, void* p1, uint32_t p2, struct FastApiTypedArray* const p_ret) { - void* v0 = reinterpret_cast(p0); - void* v1 = reinterpret_cast(p1); - uint32_t v2 = p2; - void* r = memcpy(v0, v1, v2); - ((void**)p_ret->data)[0] = r; - -} -void memmoveSlow(const FunctionCallbackInfo &args) { - void* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - void* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - uint32_t v2 = Local::Cast(args[2])->Value(); - void* rc = memmove(v0, v1, v2); - Local ab = args[3].As()->Buffer(); - ((void**)ab->Data())[0] = rc; -} - -void memmoveFast(void* p, void* p0, void* p1, uint32_t p2, struct FastApiTypedArray* const p_ret) { - void* v0 = reinterpret_cast(p0); - void* v1 = reinterpret_cast(p1); - uint32_t v2 = p2; - void* r = memmove(v0, v1, v2); - ((void**)p_ret->data)[0] = r; - -} -void exitSlow(const FunctionCallbackInfo &args) { - int32_t v0 = Local::Cast(args[0])->Value(); - exit(v0); -} - -void exitFast(void* p, int32_t p0) { - int32_t v0 = p0; - exit(v0); -} -void usleepSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - uint32_t v0 = Local::Cast(args[0])->Value(); - int32_t rc = usleep(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t usleepFast(void* p, uint32_t p0) { - uint32_t v0 = p0; - return usleep(v0); -} -void getpidSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - - int32_t rc = getpid(); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t getpidFast(void* p) { - - return getpid(); -} -void getrusageSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - struct rusage* v1 = reinterpret_cast(ptr1); - int32_t rc = getrusage(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t getrusageFast(void* p, int32_t p0, struct FastApiTypedArray* const p1) { - int32_t v0 = p0; - struct rusage* v1 = reinterpret_cast(p1->data); - return getrusage(v0, v1); -} -void timerfd_createSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = timerfd_create(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t timerfd_createFast(void* p, int32_t p0, int32_t p1) { - int32_t v0 = p0; - int32_t v1 = p1; - return timerfd_create(v0, v1); -} -void sleepSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - uint32_t v0 = Local::Cast(args[0])->Value(); - uint32_t rc = sleep(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -uint32_t sleepFast(void* p, uint32_t p0) { - uint32_t v0 = p0; - return sleep(v0); -} -void timerfd_settimeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t v1 = Local::Cast(args[1])->Value(); - Local u82 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u82->Buffer()->Data() + u82->ByteOffset(); - const struct itimerspec* v2 = reinterpret_cast(ptr2); - struct itimerspec* v3 = reinterpret_cast((uint64_t)Local::Cast(args[3])->Value()); - int32_t rc = timerfd_settime(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t timerfd_settimeFast(void* p, int32_t p0, int32_t p1, struct FastApiTypedArray* const p2, void* p3) { - int32_t v0 = p0; - int32_t v1 = p1; - const struct itimerspec* v2 = reinterpret_cast(p2->data); - struct itimerspec* v3 = reinterpret_cast(p3); - return timerfd_settime(v0, v1, v2, v3); -} -void forkSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - - int32_t rc = fork(); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t forkFast(void* p) { - - return fork(); -} -void killSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = kill(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t killFast(void* p, int32_t p0, int32_t p1) { - int32_t v0 = p0; - int32_t v1 = p1; - return kill(v0, v1); -} -void waitpidSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - int* v1 = reinterpret_cast(ptr1); - int32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = waitpid(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t waitpidFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, int32_t p2) { - int32_t v0 = p0; - int* v1 = reinterpret_cast(p1->data); - int32_t v2 = p2; - return waitpid(v0, v1, v2); -} -void execvpSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - String::Utf8Value v0(isolate, args[0]); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - char* const* v1 = reinterpret_cast(ptr1); - int32_t rc = execvp(*v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t execvpFast(void* p, struct FastOneByteString* const p0, struct FastApiTypedArray* const p1) { - struct FastOneByteString* const v0 = p0; - char* const* v1 = reinterpret_cast(p1->data); - return execvp(v0->data, v1); -} -void readlinkSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - String::Utf8Value v0(isolate, args[0]); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - char* v1 = reinterpret_cast(ptr1); - uint32_t v2 = Local::Cast(args[2])->Value(); - uint32_t rc = readlink(*v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -uint32_t readlinkFast(void* p, struct FastOneByteString* const p0, struct FastApiTypedArray* const p1, uint32_t p2) { - struct FastOneByteString* const v0 = p0; - char* v1 = reinterpret_cast(p1->data); - uint32_t v2 = p2; - return readlink(v0->data, v1, v2); -} -void sysconfSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - uint32_t rc = sysconf(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -uint32_t sysconfFast(void* p, int32_t p0) { - int32_t v0 = p0; - return sysconf(v0); -} -void pidfd_openSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t v1 = Local::Cast(args[1])->Value(); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = syscall(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t pidfd_openFast(void* p, int32_t p0, int32_t p1, uint32_t p2) { - int32_t v0 = p0; - int32_t v1 = p1; - uint32_t v2 = p2; - return syscall(v0, v1, v2); -} -void gettidSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - int32_t rc = syscall(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t gettidFast(void* p, int32_t p0) { - int32_t v0 = p0; - return syscall(v0); -} -void getrlimitSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u321 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u321->Buffer()->Data() + u321->ByteOffset(); - struct rlimit* v1 = reinterpret_cast(ptr1); - int32_t rc = getrlimit(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t getrlimitFast(void* p, int32_t p0, struct FastApiTypedArray* const p1) { - int32_t v0 = p0; - struct rlimit* v1 = reinterpret_cast(p1->data); - return getrlimit(v0, v1); -} -void setrlimitSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u321 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u321->Buffer()->Data() + u321->ByteOffset(); - const struct rlimit* v1 = reinterpret_cast(ptr1); - int32_t rc = setrlimit(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t setrlimitFast(void* p, int32_t p0, struct FastApiTypedArray* const p1) { - int32_t v0 = p0; - const struct rlimit* v1 = reinterpret_cast(p1->data); - return setrlimit(v0, v1); -} -void strerror_rSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - int32_t v0 = Local::Cast(args[0])->Value(); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - char* v1 = reinterpret_cast(ptr1); - uint32_t v2 = Local::Cast(args[2])->Value(); - int32_t rc = strerror_r(v0, v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t strerror_rFast(void* p, int32_t p0, struct FastApiTypedArray* const p1, uint32_t p2) { - int32_t v0 = p0; - char* v1 = reinterpret_cast(p1->data); - uint32_t v2 = p2; - return strerror_r(v0, v1, v2); -} -void timesSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - struct tms* v0 = reinterpret_cast(ptr0); - int32_t rc = times(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t timesFast(void* p, struct FastApiTypedArray* const p0) { - struct tms* v0 = reinterpret_cast(p0->data); - return times(v0); -} -void sysinfoSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - struct sysinfo* v0 = reinterpret_cast(ptr0); - uint32_t rc = sysinfo(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -uint32_t sysinfoFast(void* p, struct FastApiTypedArray* const p0) { - struct sysinfo* v0 = reinterpret_cast(p0->data); - return sysinfo(v0); -} -void get_avphys_pagesSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - - uint32_t rc = get_avphys_pages(); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -uint32_t get_avphys_pagesFast(void* p) { - - return get_avphys_pages(); -} -void signalSlow(const FunctionCallbackInfo &args) { - int32_t v0 = Local::Cast(args[0])->Value(); - sighandler_t v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - sighandler_t rc = signal(v0, v1); - Local ab = args[2].As()->Buffer(); - ((sighandler_t*)ab->Data())[0] = rc; -} - -void signalFast(void* p, int32_t p0, void* p1, struct FastApiTypedArray* const p_ret) { - int32_t v0 = p0; - sighandler_t v1 = reinterpret_cast(p1); - sighandler_t r = signal(v0, v1); - ((sighandler_t*)p_ret->data)[0] = r; - -} -void getenvSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - String::Utf8Value v0(isolate, args[0]); - char* rc = getenv(*v0); - Local ab = args[1].As()->Buffer(); - ((char**)ab->Data())[0] = rc; -} - -void getenvFast(void* p, struct FastOneByteString* const p0, struct FastApiTypedArray* const p_ret) { - struct FastOneByteString* const v0 = p0; - char* r = getenv(v0->data); - ((char**)p_ret->data)[0] = r; - -} -void callocSlow(const FunctionCallbackInfo &args) { - uint32_t v0 = Local::Cast(args[0])->Value(); - uint32_t v1 = Local::Cast(args[1])->Value(); - void* rc = calloc(v0, v1); - Local ab = args[2].As()->Buffer(); - ((void**)ab->Data())[0] = rc; -} - -void callocFast(void* p, uint32_t p0, uint32_t p1, struct FastApiTypedArray* const p_ret) { - uint32_t v0 = p0; - uint32_t v1 = p1; - void* r = calloc(v0, v1); - ((void**)p_ret->data)[0] = r; - -} -void freeSlow(const FunctionCallbackInfo &args) { - void* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - free(v0); -} - -void freeFast(void* p, void* p0) { - void* v0 = reinterpret_cast(p0); - free(v0); -} -void memfd_createSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - String::Utf8Value v0(isolate, args[0]); - uint32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = memfd_create(*v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t memfd_createFast(void* p, struct FastOneByteString* const p0, uint32_t p1) { - struct FastOneByteString* const v0 = p0; - uint32_t v1 = p1; - return memfd_create(v0->data, v1); -} - -void Init(Isolate* isolate, Local target) { - Local module = ObjectTemplate::New(isolate); - SET_FAST_METHOD(isolate, module, "mmap", &pFmmap, mmapSlow); - SET_FAST_METHOD(isolate, module, "munmap", &pFmunmap, munmapSlow); - SET_FAST_METHOD(isolate, module, "getcwd", &pFgetcwd, getcwdSlow); - SET_FAST_METHOD(isolate, module, "eventfd", &pFeventfd, eventfdSlow); - SET_FAST_METHOD(isolate, module, "clock_gettime", &pFclock_gettime, clock_gettimeSlow); - SET_FAST_METHOD(isolate, module, "mprotect", &pFmprotect, mprotectSlow); - SET_FAST_METHOD(isolate, module, "memcpy", &pFmemcpy, memcpySlow); - SET_FAST_METHOD(isolate, module, "memmove", &pFmemmove, memmoveSlow); - SET_FAST_METHOD(isolate, module, "exit", &pFexit, exitSlow); - SET_FAST_METHOD(isolate, module, "usleep", &pFusleep, usleepSlow); - SET_FAST_METHOD(isolate, module, "getpid", &pFgetpid, getpidSlow); - SET_FAST_METHOD(isolate, module, "getrusage", &pFgetrusage, getrusageSlow); - SET_FAST_METHOD(isolate, module, "timerfd_create", &pFtimerfd_create, timerfd_createSlow); - SET_FAST_METHOD(isolate, module, "sleep", &pFsleep, sleepSlow); - SET_FAST_METHOD(isolate, module, "timerfd_settime", &pFtimerfd_settime, timerfd_settimeSlow); - SET_FAST_METHOD(isolate, module, "fork", &pFfork, forkSlow); - SET_FAST_METHOD(isolate, module, "kill", &pFkill, killSlow); - SET_FAST_METHOD(isolate, module, "waitpid", &pFwaitpid, waitpidSlow); - SET_FAST_METHOD(isolate, module, "execvp", &pFexecvp, execvpSlow); - SET_FAST_METHOD(isolate, module, "readlink", &pFreadlink, readlinkSlow); - SET_FAST_METHOD(isolate, module, "sysconf", &pFsysconf, sysconfSlow); - SET_FAST_METHOD(isolate, module, "pidfd_open", &pFpidfd_open, pidfd_openSlow); - SET_FAST_METHOD(isolate, module, "gettid", &pFgettid, gettidSlow); - SET_FAST_METHOD(isolate, module, "getrlimit", &pFgetrlimit, getrlimitSlow); - SET_FAST_METHOD(isolate, module, "setrlimit", &pFsetrlimit, setrlimitSlow); - SET_FAST_METHOD(isolate, module, "strerror_r", &pFstrerror_r, strerror_rSlow); - SET_FAST_METHOD(isolate, module, "times", &pFtimes, timesSlow); - SET_FAST_METHOD(isolate, module, "sysinfo", &pFsysinfo, sysinfoSlow); - SET_FAST_METHOD(isolate, module, "get_avphys_pages", &pFget_avphys_pages, get_avphys_pagesSlow); - SET_FAST_METHOD(isolate, module, "signal", &pFsignal, signalSlow); - SET_FAST_METHOD(isolate, module, "getenv", &pFgetenv, getenvSlow); - SET_FAST_METHOD(isolate, module, "calloc", &pFcalloc, callocSlow); - SET_FAST_METHOD(isolate, module, "free", &pFfree, freeSlow); - SET_FAST_METHOD(isolate, module, "memfd_create", &pFmemfd_create, memfd_createSlow); - - SET_VALUE(isolate, module, "_SC_CLK_TCK", Integer::New(isolate, _SC_CLK_TCK)); - - - SET_MODULE(isolate, target, "system", module); -} -} // namespace system -} // namespace lo - -extern "C" { - void* _register_system() { - return (void*)lo::system::Init; - } -} diff --git a/lib/tcc/tcc.cc b/lib/tcc/tcc.cc deleted file mode 100644 index 0a35103..0000000 --- a/lib/tcc/tcc.cc +++ /dev/null @@ -1,396 +0,0 @@ - -// [do not edit,] -// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile -#include -#include - -namespace lo { -namespace tcc { - -using v8::String; -using v8::FunctionCallbackInfo; -using v8::Array; -using v8::Local; -using v8::ObjectTemplate; -using v8::Isolate; -using v8::Value; -using v8::Uint32Array; -using v8::ArrayBuffer; -using v8::Context; -using v8::Integer; -using v8::Function; -using v8::NewStringType; -using v8::Object; -using v8::BackingStore; -using v8::TryCatch; -using v8::ScriptCompiler; -using v8::Module; -using v8::FixedArray; -using v8::ScriptOrigin; -using v8::SharedArrayBuffer; -using v8::MaybeLocal; -using v8::HandleScope; -using v8::Promise; -using v8::Number; -using v8::StackTrace; -using v8::Message; -using v8::StackFrame; -using v8::Maybe; -using v8::FunctionTemplate; -using v8::FunctionCallback; -using v8::PromiseRejectMessage; -using v8::CFunction; -using v8::Global; -using v8::Exception; -using v8::CTypeInfo; -using v8::PropertyAttribute; -using v8::Signature; -using v8::ConstructorBehavior; -using v8::SideEffectType; -using v8::kPromiseRejectAfterResolved; -using v8::kPromiseResolveAfterResolved; -using v8::kPromiseHandlerAddedAfterReject; -using v8::Data; -using v8::PrimitiveArray; -using v8::TypedArray; -using v8::Uint8Array; -using v8::Boolean; -using v8::ModuleRequest; -using v8::CFunctionInfo; -using v8::OOMDetails; -using v8::V8; -using v8::BigInt; - - - -void tcc_newFast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargstcc_new[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rctcc_new = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infotcc_new = v8::CFunctionInfo(rctcc_new, 2, cargstcc_new); -v8::CFunction pFtcc_new = v8::CFunction((const void*)&tcc_newFast, &infotcc_new); - -void tcc_deleteFast(void* p, void* p0); -v8::CTypeInfo cargstcc_delete[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rctcc_delete = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infotcc_delete = v8::CFunctionInfo(rctcc_delete, 2, cargstcc_delete); -v8::CFunction pFtcc_delete = v8::CFunction((const void*)&tcc_deleteFast, &infotcc_delete); - -int32_t tcc_set_output_typeFast(void* p, void* p0, int32_t p1); -v8::CTypeInfo cargstcc_set_output_type[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kInt32), -}; -v8::CTypeInfo rctcc_set_output_type = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infotcc_set_output_type = v8::CFunctionInfo(rctcc_set_output_type, 3, cargstcc_set_output_type); -v8::CFunction pFtcc_set_output_type = v8::CFunction((const void*)&tcc_set_output_typeFast, &infotcc_set_output_type); - -void tcc_set_optionsFast(void* p, void* p0, struct FastOneByteString* const p1); -v8::CTypeInfo cargstcc_set_options[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rctcc_set_options = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infotcc_set_options = v8::CFunctionInfo(rctcc_set_options, 3, cargstcc_set_options); -v8::CFunction pFtcc_set_options = v8::CFunction((const void*)&tcc_set_optionsFast, &infotcc_set_options); - -int32_t tcc_add_library_pathFast(void* p, void* p0, struct FastOneByteString* const p1); -v8::CTypeInfo cargstcc_add_library_path[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rctcc_add_library_path = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infotcc_add_library_path = v8::CFunctionInfo(rctcc_add_library_path, 3, cargstcc_add_library_path); -v8::CFunction pFtcc_add_library_path = v8::CFunction((const void*)&tcc_add_library_pathFast, &infotcc_add_library_path); - -int32_t tcc_add_libraryFast(void* p, void* p0, struct FastOneByteString* const p1); -v8::CTypeInfo cargstcc_add_library[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rctcc_add_library = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infotcc_add_library = v8::CFunctionInfo(rctcc_add_library, 3, cargstcc_add_library); -v8::CFunction pFtcc_add_library = v8::CFunction((const void*)&tcc_add_libraryFast, &infotcc_add_library); - -int32_t tcc_add_include_pathFast(void* p, void* p0, struct FastOneByteString* const p1); -v8::CTypeInfo cargstcc_add_include_path[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rctcc_add_include_path = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infotcc_add_include_path = v8::CFunctionInfo(rctcc_add_include_path, 3, cargstcc_add_include_path); -v8::CFunction pFtcc_add_include_path = v8::CFunction((const void*)&tcc_add_include_pathFast, &infotcc_add_include_path); - -int32_t tcc_add_fileFast(void* p, void* p0, struct FastOneByteString* const p1); -v8::CTypeInfo cargstcc_add_file[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rctcc_add_file = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infotcc_add_file = v8::CFunctionInfo(rctcc_add_file, 3, cargstcc_add_file); -v8::CFunction pFtcc_add_file = v8::CFunction((const void*)&tcc_add_fileFast, &infotcc_add_file); - -int32_t tcc_compile_stringFast(void* p, void* p0, struct FastOneByteString* const p1); -v8::CTypeInfo cargstcc_compile_string[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rctcc_compile_string = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infotcc_compile_string = v8::CFunctionInfo(rctcc_compile_string, 3, cargstcc_compile_string); -v8::CFunction pFtcc_compile_string = v8::CFunction((const void*)&tcc_compile_stringFast, &infotcc_compile_string); - -int32_t tcc_relocateFast(void* p, void* p0, void* p1); -v8::CTypeInfo cargstcc_relocate[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rctcc_relocate = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infotcc_relocate = v8::CFunctionInfo(rctcc_relocate, 3, cargstcc_relocate); -v8::CFunction pFtcc_relocate = v8::CFunction((const void*)&tcc_relocateFast, &infotcc_relocate); - -void tcc_get_symbolFast(void* p, void* p0, struct FastOneByteString* const p1, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargstcc_get_symbol[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rctcc_get_symbol = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infotcc_get_symbol = v8::CFunctionInfo(rctcc_get_symbol, 4, cargstcc_get_symbol); -v8::CFunction pFtcc_get_symbol = v8::CFunction((const void*)&tcc_get_symbolFast, &infotcc_get_symbol); - -int32_t tcc_add_symbolFast(void* p, void* p0, struct FastOneByteString* const p1, void* p2); -v8::CTypeInfo cargstcc_add_symbol[4] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rctcc_add_symbol = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infotcc_add_symbol = v8::CFunctionInfo(rctcc_add_symbol, 4, cargstcc_add_symbol); -v8::CFunction pFtcc_add_symbol = v8::CFunction((const void*)&tcc_add_symbolFast, &infotcc_add_symbol); - -int32_t tcc_output_fileFast(void* p, void* p0, struct FastOneByteString* const p1); -v8::CTypeInfo cargstcc_output_file[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rctcc_output_file = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infotcc_output_file = v8::CFunctionInfo(rctcc_output_file, 3, cargstcc_output_file); -v8::CFunction pFtcc_output_file = v8::CFunction((const void*)&tcc_output_fileFast, &infotcc_output_file); - - - -void tcc_newSlow(const FunctionCallbackInfo &args) { - - void* rc = tcc_new(); - Local ab = args[0].As()->Buffer(); - ((void**)ab->Data())[0] = rc; -} - -void tcc_newFast(void* p, struct FastApiTypedArray* const p_ret) { - - void* r = tcc_new(); - ((void**)p_ret->data)[0] = r; - -} -void tcc_deleteSlow(const FunctionCallbackInfo &args) { - TCCState* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - tcc_delete(v0); -} - -void tcc_deleteFast(void* p, void* p0) { - TCCState* v0 = reinterpret_cast(p0); - tcc_delete(v0); -} -void tcc_set_output_typeSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - TCCState* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t v1 = Local::Cast(args[1])->Value(); - int32_t rc = tcc_set_output_type(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t tcc_set_output_typeFast(void* p, void* p0, int32_t p1) { - TCCState* v0 = reinterpret_cast(p0); - int32_t v1 = p1; - return tcc_set_output_type(v0, v1); -} -void tcc_set_optionsSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - TCCState* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - tcc_set_options(v0, *v1); -} - -void tcc_set_optionsFast(void* p, void* p0, struct FastOneByteString* const p1) { - TCCState* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - tcc_set_options(v0, v1->data); -} -void tcc_add_library_pathSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - TCCState* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - int32_t rc = tcc_add_library_path(v0, *v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t tcc_add_library_pathFast(void* p, void* p0, struct FastOneByteString* const p1) { - TCCState* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - return tcc_add_library_path(v0, v1->data); -} -void tcc_add_librarySlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - TCCState* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - int32_t rc = tcc_add_library(v0, *v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t tcc_add_libraryFast(void* p, void* p0, struct FastOneByteString* const p1) { - TCCState* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - return tcc_add_library(v0, v1->data); -} -void tcc_add_include_pathSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - TCCState* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - int32_t rc = tcc_add_include_path(v0, *v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t tcc_add_include_pathFast(void* p, void* p0, struct FastOneByteString* const p1) { - TCCState* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - return tcc_add_include_path(v0, v1->data); -} -void tcc_add_fileSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - TCCState* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - int32_t rc = tcc_add_file(v0, *v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t tcc_add_fileFast(void* p, void* p0, struct FastOneByteString* const p1) { - TCCState* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - return tcc_add_file(v0, v1->data); -} -void tcc_compile_stringSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - TCCState* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - int32_t rc = tcc_compile_string(v0, *v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t tcc_compile_stringFast(void* p, void* p0, struct FastOneByteString* const p1) { - TCCState* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - return tcc_compile_string(v0, v1->data); -} -void tcc_relocateSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - TCCState* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - void* v1 = reinterpret_cast((uint64_t)Local::Cast(args[1])->Value()); - int32_t rc = tcc_relocate(v0, v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t tcc_relocateFast(void* p, void* p0, void* p1) { - TCCState* v0 = reinterpret_cast(p0); - void* v1 = reinterpret_cast(p1); - return tcc_relocate(v0, v1); -} -void tcc_get_symbolSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - TCCState* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - void* rc = tcc_get_symbol(v0, *v1); - Local ab = args[2].As()->Buffer(); - ((void**)ab->Data())[0] = rc; -} - -void tcc_get_symbolFast(void* p, void* p0, struct FastOneByteString* const p1, struct FastApiTypedArray* const p_ret) { - TCCState* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - void* r = tcc_get_symbol(v0, v1->data); - ((void**)p_ret->data)[0] = r; - -} -void tcc_add_symbolSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - TCCState* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - const void* v2 = reinterpret_cast((uint64_t)Local::Cast(args[2])->Value()); - int32_t rc = tcc_add_symbol(v0, *v1, v2); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t tcc_add_symbolFast(void* p, void* p0, struct FastOneByteString* const p1, void* p2) { - TCCState* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - const void* v2 = reinterpret_cast(p2); - return tcc_add_symbol(v0, v1->data, v2); -} -void tcc_output_fileSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - TCCState* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - String::Utf8Value v1(isolate, args[1]); - int32_t rc = tcc_output_file(v0, *v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t tcc_output_fileFast(void* p, void* p0, struct FastOneByteString* const p1) { - TCCState* v0 = reinterpret_cast(p0); - struct FastOneByteString* const v1 = p1; - return tcc_output_file(v0, v1->data); -} - -void Init(Isolate* isolate, Local target) { - Local module = ObjectTemplate::New(isolate); - SET_FAST_METHOD(isolate, module, "tcc_new", &pFtcc_new, tcc_newSlow); - SET_FAST_METHOD(isolate, module, "tcc_delete", &pFtcc_delete, tcc_deleteSlow); - SET_FAST_METHOD(isolate, module, "tcc_set_output_type", &pFtcc_set_output_type, tcc_set_output_typeSlow); - SET_FAST_METHOD(isolate, module, "tcc_set_options", &pFtcc_set_options, tcc_set_optionsSlow); - SET_FAST_METHOD(isolate, module, "tcc_add_library_path", &pFtcc_add_library_path, tcc_add_library_pathSlow); - SET_FAST_METHOD(isolate, module, "tcc_add_library", &pFtcc_add_library, tcc_add_librarySlow); - SET_FAST_METHOD(isolate, module, "tcc_add_include_path", &pFtcc_add_include_path, tcc_add_include_pathSlow); - SET_FAST_METHOD(isolate, module, "tcc_add_file", &pFtcc_add_file, tcc_add_fileSlow); - SET_FAST_METHOD(isolate, module, "tcc_compile_string", &pFtcc_compile_string, tcc_compile_stringSlow); - SET_FAST_METHOD(isolate, module, "tcc_relocate", &pFtcc_relocate, tcc_relocateSlow); - SET_FAST_METHOD(isolate, module, "tcc_get_symbol", &pFtcc_get_symbol, tcc_get_symbolSlow); - SET_FAST_METHOD(isolate, module, "tcc_add_symbol", &pFtcc_add_symbol, tcc_add_symbolSlow); - SET_FAST_METHOD(isolate, module, "tcc_output_file", &pFtcc_output_file, tcc_output_fileSlow); - - - - SET_MODULE(isolate, target, "tcc", module); -} -} // namespace tcc -} // namespace lo - -extern "C" { - void* _register_tcc() { - return (void*)lo::tcc::Init; - } -} diff --git a/lib/timer.js b/lib/timer.js index b7c883d..ff5b272 100644 --- a/lib/timer.js +++ b/lib/timer.js @@ -1,4 +1,40 @@ const { assert, core } = lo + +const { os } = core + +let Timer + +if (os === 'mac') { + +const { kevents } = lo.load('kevents') + +let timer_id = 0 + +class MacTimer { + fd = 0 + loop = undefined + timeout = 1000 + repeat = 1000 + callback = undefined + + constructor (loop, timeout, callback, repeat = timeout) { + this.loop = loop + this.timeout = timeout + this.callback = callback + this.repeat = repeat + this.fd = timer_id++ + loop.add_data(this.fd, callback, kevents.EVFILT_TIMER, timeout) + } + + close () { + this.loop.remove(this.fd) + } +} + +Timer = MacTimer + +} else if (os === 'linux') { + const { read, close } = core const { system } = lo.load('system') @@ -20,7 +56,7 @@ function timer (repeat, timeout = repeat) { return fd } -class Timer { +class UnixTimer { fd = 0 loop = undefined timeout = 1000 @@ -42,8 +78,13 @@ class Timer { } close () { + this.loop.remove(this.fd) close(this.fd) } } -export { Timer, timer } +Timer = UnixTimer + +} + +export { Timer } diff --git a/lib/wireguard/wireguard.cc b/lib/wireguard/wireguard.cc deleted file mode 100644 index ebe6d65..0000000 --- a/lib/wireguard/wireguard.cc +++ /dev/null @@ -1,337 +0,0 @@ - -// [do not edit,] -// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile -#include -#include - -namespace lo { -namespace wireguard { - -using v8::String; -using v8::FunctionCallbackInfo; -using v8::Array; -using v8::Local; -using v8::ObjectTemplate; -using v8::Isolate; -using v8::Value; -using v8::Uint32Array; -using v8::ArrayBuffer; -using v8::Context; -using v8::Integer; -using v8::Function; -using v8::NewStringType; -using v8::Object; -using v8::BackingStore; -using v8::TryCatch; -using v8::ScriptCompiler; -using v8::Module; -using v8::FixedArray; -using v8::ScriptOrigin; -using v8::SharedArrayBuffer; -using v8::MaybeLocal; -using v8::HandleScope; -using v8::Promise; -using v8::Number; -using v8::StackTrace; -using v8::Message; -using v8::StackFrame; -using v8::Maybe; -using v8::FunctionTemplate; -using v8::FunctionCallback; -using v8::PromiseRejectMessage; -using v8::CFunction; -using v8::Global; -using v8::Exception; -using v8::CTypeInfo; -using v8::PropertyAttribute; -using v8::Signature; -using v8::ConstructorBehavior; -using v8::SideEffectType; -using v8::kPromiseRejectAfterResolved; -using v8::kPromiseResolveAfterResolved; -using v8::kPromiseHandlerAddedAfterReject; -using v8::Data; -using v8::PrimitiveArray; -using v8::TypedArray; -using v8::Uint8Array; -using v8::Boolean; -using v8::ModuleRequest; -using v8::CFunctionInfo; -using v8::OOMDetails; -using v8::V8; -using v8::BigInt; - - - -int32_t setFast(void* p, void* p0); -v8::CTypeInfo cargsset[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcset = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoset = v8::CFunctionInfo(rcset, 2, cargsset); -v8::CFunction pFset = v8::CFunction((const void*)&setFast, &infoset); - -int32_t getFast(void* p, struct FastApiTypedArray* const p0, struct FastOneByteString* const p1); -v8::CTypeInfo cargsget[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rcget = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoget = v8::CFunctionInfo(rcget, 3, cargsget); -v8::CFunction pFget = v8::CFunction((const void*)&getFast, &infoget); - -int32_t addFast(void* p, struct FastOneByteString* const p0); -v8::CTypeInfo cargsadd[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rcadd = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infoadd = v8::CFunctionInfo(rcadd, 2, cargsadd); -v8::CFunction pFadd = v8::CFunction((const void*)&addFast, &infoadd); - -int32_t deleteFast(void* p, struct FastOneByteString* const p0); -v8::CTypeInfo cargsdelete[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kSeqOneByteString), -}; -v8::CTypeInfo rcdelete = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infodelete = v8::CFunctionInfo(rcdelete, 2, cargsdelete); -v8::CFunction pFdelete = v8::CFunction((const void*)&deleteFast, &infodelete); - -void freeFast(void* p, void* p0); -v8::CTypeInfo cargsfree[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint64), -}; -v8::CTypeInfo rcfree = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infofree = v8::CFunctionInfo(rcfree, 2, cargsfree); -v8::CFunction pFfree = v8::CFunction((const void*)&freeFast, &infofree); - -void listFast(void* p, struct FastApiTypedArray* const p_ret); -v8::CTypeInfo cargslist[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32, v8::CTypeInfo::SequenceType::kIsTypedArray, v8::CTypeInfo::Flags::kNone) -}; -v8::CTypeInfo rclist = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infolist = v8::CFunctionInfo(rclist, 2, cargslist); -v8::CFunction pFlist = v8::CFunction((const void*)&listFast, &infolist); - -void keytobase64Fast(void* p, struct FastApiTypedArray* const p0, struct FastApiTypedArray* const p1); -v8::CTypeInfo cargskeytobase64[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rckeytobase64 = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infokeytobase64 = v8::CFunctionInfo(rckeytobase64, 3, cargskeytobase64); -v8::CFunction pFkeytobase64 = v8::CFunction((const void*)&keytobase64Fast, &infokeytobase64); - -int32_t keyfrombase64Fast(void* p, struct FastApiTypedArray* const p0, struct FastApiTypedArray* const p1); -v8::CTypeInfo cargskeyfrombase64[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rckeyfrombase64 = v8::CTypeInfo(v8::CTypeInfo::Type::kInt32); -v8::CFunctionInfo infokeyfrombase64 = v8::CFunctionInfo(rckeyfrombase64, 3, cargskeyfrombase64); -v8::CFunction pFkeyfrombase64 = v8::CFunction((const void*)&keyfrombase64Fast, &infokeyfrombase64); - -void genpubKeyFast(void* p, struct FastApiTypedArray* const p0, struct FastApiTypedArray* const p1); -v8::CTypeInfo cargsgenpubKey[3] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcgenpubKey = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infogenpubKey = v8::CFunctionInfo(rcgenpubKey, 3, cargsgenpubKey); -v8::CFunction pFgenpubKey = v8::CFunction((const void*)&genpubKeyFast, &infogenpubKey); - -void genprivKeyFast(void* p, struct FastApiTypedArray* const p0); -v8::CTypeInfo cargsgenprivKey[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcgenprivKey = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infogenprivKey = v8::CFunctionInfo(rcgenprivKey, 2, cargsgenprivKey); -v8::CFunction pFgenprivKey = v8::CFunction((const void*)&genprivKeyFast, &infogenprivKey); - -void genpresharedKeyFast(void* p, struct FastApiTypedArray* const p0); -v8::CTypeInfo cargsgenpresharedKey[2] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), -}; -v8::CTypeInfo rcgenpresharedKey = v8::CTypeInfo(v8::CTypeInfo::Type::kVoid); -v8::CFunctionInfo infogenpresharedKey = v8::CFunctionInfo(rcgenpresharedKey, 2, cargsgenpresharedKey); -v8::CFunction pFgenpresharedKey = v8::CFunction((const void*)&genpresharedKeyFast, &infogenpresharedKey); - - - -void setSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - wg_device* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - int32_t rc = wg_set_device(v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t setFast(void* p, void* p0) { - wg_device* v0 = reinterpret_cast(p0); - return wg_set_device(v0); -} -void getSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local u320 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u320->Buffer()->Data() + u320->ByteOffset(); - wg_device** v0 = reinterpret_cast(ptr0); - String::Utf8Value v1(isolate, args[1]); - int32_t rc = wg_get_device(v0, *v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t getFast(void* p, struct FastApiTypedArray* const p0, struct FastOneByteString* const p1) { - wg_device** v0 = reinterpret_cast(p0->data); - struct FastOneByteString* const v1 = p1; - return wg_get_device(v0, v1->data); -} -void addSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - String::Utf8Value v0(isolate, args[0]); - int32_t rc = wg_add_device(*v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t addFast(void* p, struct FastOneByteString* const p0) { - struct FastOneByteString* const v0 = p0; - return wg_add_device(v0->data); -} -void deleteSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - String::Utf8Value v0(isolate, args[0]); - int32_t rc = wg_del_device(*v0); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t deleteFast(void* p, struct FastOneByteString* const p0) { - struct FastOneByteString* const v0 = p0; - return wg_del_device(v0->data); -} -void freeSlow(const FunctionCallbackInfo &args) { - wg_device* v0 = reinterpret_cast((uint64_t)Local::Cast(args[0])->Value()); - wg_free_device(v0); -} - -void freeFast(void* p, void* p0) { - wg_device* v0 = reinterpret_cast(p0); - wg_free_device(v0); -} -void listSlow(const FunctionCallbackInfo &args) { - - const char* rc = wg_list_device_names(); - Local ab = args[0].As()->Buffer(); - ((const char**)ab->Data())[0] = rc; -} - -void listFast(void* p, struct FastApiTypedArray* const p_ret) { - - const char* r = wg_list_device_names(); - ((const char**)p_ret->data)[0] = r; - -} -void keytobase64Slow(const FunctionCallbackInfo &args) { - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - wg_key_b64_string* v0 = reinterpret_cast(ptr0); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - const wg_key* v1 = reinterpret_cast(ptr1); - wg_key_to_base64(*v0, *v1); -} - -void keytobase64Fast(void* p, struct FastApiTypedArray* const p0, struct FastApiTypedArray* const p1) { - wg_key_b64_string* v0 = reinterpret_cast(p0->data); - const wg_key* v1 = reinterpret_cast(p1->data); - wg_key_to_base64(*v0, *v1); -} -void keyfrombase64Slow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - wg_key* v0 = reinterpret_cast(ptr0); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - const wg_key_b64_string* v1 = reinterpret_cast(ptr1); - int32_t rc = wg_key_from_base64(*v0, *v1); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -int32_t keyfrombase64Fast(void* p, struct FastApiTypedArray* const p0, struct FastApiTypedArray* const p1) { - wg_key* v0 = reinterpret_cast(p0->data); - const wg_key_b64_string* v1 = reinterpret_cast(p1->data); - return wg_key_from_base64(*v0, *v1); -} -void genpubKeySlow(const FunctionCallbackInfo &args) { - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - wg_key* v0 = reinterpret_cast(ptr0); - Local u81 = args[1].As(); - uint8_t* ptr1 = (uint8_t*)u81->Buffer()->Data() + u81->ByteOffset(); - const wg_key* v1 = reinterpret_cast(ptr1); - wg_generate_public_key(*v0, *v1); -} - -void genpubKeyFast(void* p, struct FastApiTypedArray* const p0, struct FastApiTypedArray* const p1) { - wg_key* v0 = reinterpret_cast(p0->data); - const wg_key* v1 = reinterpret_cast(p1->data); - wg_generate_public_key(*v0, *v1); -} -void genprivKeySlow(const FunctionCallbackInfo &args) { - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - wg_key* v0 = reinterpret_cast(ptr0); - wg_generate_private_key(*v0); -} - -void genprivKeyFast(void* p, struct FastApiTypedArray* const p0) { - wg_key* v0 = reinterpret_cast(p0->data); - wg_generate_private_key(*v0); -} -void genpresharedKeySlow(const FunctionCallbackInfo &args) { - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - wg_key* v0 = reinterpret_cast(ptr0); - wg_generate_preshared_key(*v0); -} - -void genpresharedKeyFast(void* p, struct FastApiTypedArray* const p0) { - wg_key* v0 = reinterpret_cast(p0->data); - wg_generate_preshared_key(*v0); -} - -void Init(Isolate* isolate, Local target) { - Local module = ObjectTemplate::New(isolate); - SET_FAST_METHOD(isolate, module, "set", &pFset, setSlow); - SET_FAST_METHOD(isolate, module, "get", &pFget, getSlow); - SET_FAST_METHOD(isolate, module, "add", &pFadd, addSlow); - SET_FAST_METHOD(isolate, module, "delete", &pFdelete, deleteSlow); - SET_FAST_METHOD(isolate, module, "free", &pFfree, freeSlow); - SET_FAST_METHOD(isolate, module, "list", &pFlist, listSlow); - SET_FAST_METHOD(isolate, module, "keytobase64", &pFkeytobase64, keytobase64Slow); - SET_FAST_METHOD(isolate, module, "keyfrombase64", &pFkeyfrombase64, keyfrombase64Slow); - SET_FAST_METHOD(isolate, module, "genpubKey", &pFgenpubKey, genpubKeySlow); - SET_FAST_METHOD(isolate, module, "genprivKey", &pFgenprivKey, genprivKeySlow); - SET_FAST_METHOD(isolate, module, "genpresharedKey", &pFgenpresharedKey, genpresharedKeySlow); - - - - SET_MODULE(isolate, target, "wireguard", module); -} -} // namespace wireguard -} // namespace lo - -extern "C" { - void* _register_wireguard() { - return (void*)lo::wireguard::Init; - } -} diff --git a/lib/zlib/zlib.cc b/lib/zlib/zlib.cc deleted file mode 100644 index 3e768cd..0000000 --- a/lib/zlib/zlib.cc +++ /dev/null @@ -1,193 +0,0 @@ - -// [do not edit,] -// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile -#include -#include -#include -#include - -namespace lo { -namespace zlib { - -using v8::String; -using v8::FunctionCallbackInfo; -using v8::Array; -using v8::Local; -using v8::ObjectTemplate; -using v8::Isolate; -using v8::Value; -using v8::Uint32Array; -using v8::ArrayBuffer; -using v8::Context; -using v8::Integer; -using v8::Function; -using v8::NewStringType; -using v8::Object; -using v8::BackingStore; -using v8::TryCatch; -using v8::ScriptCompiler; -using v8::Module; -using v8::FixedArray; -using v8::ScriptOrigin; -using v8::SharedArrayBuffer; -using v8::MaybeLocal; -using v8::HandleScope; -using v8::Promise; -using v8::Number; -using v8::StackTrace; -using v8::Message; -using v8::StackFrame; -using v8::Maybe; -using v8::FunctionTemplate; -using v8::FunctionCallback; -using v8::PromiseRejectMessage; -using v8::CFunction; -using v8::Global; -using v8::Exception; -using v8::CTypeInfo; -using v8::PropertyAttribute; -using v8::Signature; -using v8::ConstructorBehavior; -using v8::SideEffectType; -using v8::kPromiseRejectAfterResolved; -using v8::kPromiseResolveAfterResolved; -using v8::kPromiseHandlerAddedAfterReject; -using v8::Data; -using v8::PrimitiveArray; -using v8::TypedArray; -using v8::Uint8Array; -using v8::Boolean; -using v8::ModuleRequest; -using v8::CFunctionInfo; -using v8::OOMDetails; -using v8::V8; -using v8::BigInt; - - -#define Z_DEFAULT_MEMLEVEL 8 - -uint32_t zlib_deflate (uint8_t* src, uint32_t ssize, uint8_t* dest, uint32_t dsize) { - z_stream* stream = (z_stream*)calloc(1, sizeof(z_stream)); - unsigned int compression = Z_DEFAULT_COMPRESSION; - int windowbits = 31; - deflateInit2(stream, compression, Z_DEFLATED, windowbits, Z_DEFAULT_MEMLEVEL, Z_DEFAULT_STRATEGY); - stream->next_in = (Bytef*)src; - stream->avail_in = ssize; - stream->next_out = (Bytef*)dest; - stream->avail_out = dsize; - uint32_t avail_out = stream->avail_out; - uint32_t flush = Z_FINISH; - deflate(stream, flush); - uint32_t written = avail_out - stream->avail_out; - deflateEnd(stream); - free(stream); - return written; -} - -// todo: this api is kinda nasty - fix it -uint32_t zlib_inflate (uint8_t* src, uint32_t ssize, uint8_t* dest, uint32_t dsize) { - z_stream* stream = (z_stream*)calloc(1, sizeof(z_stream)); - int windowbits = 31; - inflateInit2(stream, windowbits); - stream->next_in = (Bytef*)src; - stream->avail_in = ssize; - stream->next_out = (Bytef*)dest; - stream->avail_out = dsize; - uint32_t avail_out = stream->avail_out; - uint32_t flush = Z_FINISH; - //fprintf(stderr, "before next_in %lu avail_in %u next_out %lu avail_out %u\n", (uint64_t)stream->next_in, stream->avail_in, (uint64_t)stream->next_out, stream->avail_out); - inflate(stream, flush); - //fprintf(stderr, "after next_in %lu avail_in %u next_out %lu avail_out %u, rc = %i\n", (uint64_t)stream->next_in, stream->avail_in, (uint64_t)stream->next_out, stream->avail_out, rc); - uint32_t written = avail_out - stream->avail_out; - inflateEnd(stream); - free(stream); - return written; -} - - -uint32_t deflateFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2, uint32_t p3); -v8::CTypeInfo cargsdeflate[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcdeflate = v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); -v8::CFunctionInfo infodeflate = v8::CFunctionInfo(rcdeflate, 5, cargsdeflate); -v8::CFunction pFdeflate = v8::CFunction((const void*)&deflateFast, &infodeflate); - -uint32_t inflateFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2, uint32_t p3); -v8::CTypeInfo cargsinflate[5] = { - v8::CTypeInfo(v8::CTypeInfo::Type::kV8Value), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint8, CTypeInfo::SequenceType::kIsTypedArray, CTypeInfo::Flags::kNone), - v8::CTypeInfo(v8::CTypeInfo::Type::kUint32), -}; -v8::CTypeInfo rcinflate = v8::CTypeInfo(v8::CTypeInfo::Type::kUint32); -v8::CFunctionInfo infoinflate = v8::CFunctionInfo(rcinflate, 5, cargsinflate); -v8::CFunction pFinflate = v8::CFunction((const void*)&inflateFast, &infoinflate); - - - -void deflateSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - uint8_t* v0 = reinterpret_cast(ptr0); - uint32_t v1 = Local::Cast(args[1])->Value(); - Local u82 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u82->Buffer()->Data() + u82->ByteOffset(); - uint8_t* v2 = reinterpret_cast(ptr2); - uint32_t v3 = Local::Cast(args[3])->Value(); - uint32_t rc = zlib_deflate(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -uint32_t deflateFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2, uint32_t p3) { - uint8_t* v0 = reinterpret_cast(p0->data); - uint32_t v1 = p1; - uint8_t* v2 = reinterpret_cast(p2->data); - uint32_t v3 = p3; - return zlib_deflate(v0, v1, v2, v3); -} -void inflateSlow(const FunctionCallbackInfo &args) { - Isolate *isolate = args.GetIsolate(); - Local u80 = args[0].As(); - uint8_t* ptr0 = (uint8_t*)u80->Buffer()->Data() + u80->ByteOffset(); - uint8_t* v0 = reinterpret_cast(ptr0); - uint32_t v1 = Local::Cast(args[1])->Value(); - Local u82 = args[2].As(); - uint8_t* ptr2 = (uint8_t*)u82->Buffer()->Data() + u82->ByteOffset(); - uint8_t* v2 = reinterpret_cast(ptr2); - uint32_t v3 = Local::Cast(args[3])->Value(); - uint32_t rc = zlib_inflate(v0, v1, v2, v3); - args.GetReturnValue().Set(Number::New(isolate, rc)); -} - -uint32_t inflateFast(void* p, struct FastApiTypedArray* const p0, uint32_t p1, struct FastApiTypedArray* const p2, uint32_t p3) { - uint8_t* v0 = reinterpret_cast(p0->data); - uint32_t v1 = p1; - uint8_t* v2 = reinterpret_cast(p2->data); - uint32_t v3 = p3; - return zlib_inflate(v0, v1, v2, v3); -} - -void Init(Isolate* isolate, Local target) { - Local module = ObjectTemplate::New(isolate); - SET_FAST_METHOD(isolate, module, "deflate", &pFdeflate, deflateSlow); - SET_FAST_METHOD(isolate, module, "inflate", &pFinflate, inflateSlow); - - - - SET_MODULE(isolate, target, "zlib", module); -} -} // namespace zlib -} // namespace lo - -extern "C" { - void* _register_zlib() { - return (void*)lo::zlib::Init; - } -} diff --git a/main.cc b/main.cc index 83b989b..b74b264 100644 --- a/main.cc +++ b/main.cc @@ -1,4 +1,6 @@ -#ifdef _WIN32 +#ifdef __MACH__ +#include "main_mac.h" +#elif defined(_WIN64) #include "main_win.h" #else #include "main.h" diff --git a/main.h b/main.h index fa30f26..763545c 100644 --- a/main.h +++ b/main.h @@ -41,12 +41,18 @@ extern char _binary_lib_core_api_js_start[]; extern char _binary_lib_core_api_js_end[]; extern char _binary_lib_curl_api_js_start[]; extern char _binary_lib_curl_api_js_end[]; +extern char _binary_lib_duckdb_api_js_start[]; +extern char _binary_lib_duckdb_api_js_end[]; +extern char _binary_lib_duckdb_build_js_start[]; +extern char _binary_lib_duckdb_build_js_end[]; extern char _binary_lib_encode_api_js_start[]; extern char _binary_lib_encode_api_js_end[]; extern char _binary_lib_epoll_api_js_start[]; extern char _binary_lib_epoll_api_js_end[]; extern char _binary_lib_inflate_api_js_start[]; extern char _binary_lib_inflate_api_js_end[]; +extern char _binary_lib_inflate_build_js_start[]; +extern char _binary_lib_inflate_build_js_end[]; extern char _binary_lib_libffi_api_js_start[]; extern char _binary_lib_libffi_api_js_end[]; extern char _binary_lib_libssl_api_js_start[]; @@ -55,10 +61,14 @@ extern char _binary_lib_lz4_api_js_start[]; extern char _binary_lib_lz4_api_js_end[]; extern char _binary_lib_mbedtls_api_js_start[]; extern char _binary_lib_mbedtls_api_js_end[]; +extern char _binary_lib_mbedtls_build_js_start[]; +extern char _binary_lib_mbedtls_build_js_end[]; extern char _binary_lib_net_api_js_start[]; extern char _binary_lib_net_api_js_end[]; extern char _binary_lib_pico_api_js_start[]; extern char _binary_lib_pico_api_js_end[]; +extern char _binary_lib_pico_build_js_start[]; +extern char _binary_lib_pico_build_js_end[]; extern char _binary_lib_pthread_api_js_start[]; extern char _binary_lib_pthread_api_js_end[]; extern char _binary_lib_seccomp_api_js_start[]; @@ -69,12 +79,14 @@ extern char _binary_lib_system_api_js_start[]; extern char _binary_lib_system_api_js_end[]; extern char _binary_lib_tcc_api_js_start[]; extern char _binary_lib_tcc_api_js_end[]; +extern char _binary_lib_tcc_build_js_start[]; +extern char _binary_lib_tcc_build_js_end[]; extern char _binary_lib_wireguard_api_js_start[]; extern char _binary_lib_wireguard_api_js_end[]; +extern char _binary_lib_wireguard_build_js_start[]; +extern char _binary_lib_wireguard_build_js_end[]; extern char _binary_lib_zlib_api_js_start[]; extern char _binary_lib_zlib_api_js_end[]; -extern char _binary_lib_duckdb_api_js_start[]; -extern char _binary_lib_duckdb_api_js_end[]; extern "C" { extern void* _register_core(); @@ -101,23 +113,29 @@ void register_builtins() { lo::builtins_add("lo.h", _binary_lo_h_start, _binary_lo_h_end - _binary_lo_h_start); lo::builtins_add("lib/core/api.js", _binary_lib_core_api_js_start, _binary_lib_core_api_js_end - _binary_lib_core_api_js_start); lo::builtins_add("lib/curl/api.js", _binary_lib_curl_api_js_start, _binary_lib_curl_api_js_end - _binary_lib_curl_api_js_start); + lo::builtins_add("lib/duckdb/api.js", _binary_lib_duckdb_api_js_start, _binary_lib_duckdb_api_js_end - _binary_lib_duckdb_api_js_start); + lo::builtins_add("lib/duckdb/build.js", _binary_lib_duckdb_build_js_start, _binary_lib_duckdb_build_js_end - _binary_lib_duckdb_build_js_start); lo::builtins_add("lib/encode/api.js", _binary_lib_encode_api_js_start, _binary_lib_encode_api_js_end - _binary_lib_encode_api_js_start); lo::builtins_add("lib/epoll/api.js", _binary_lib_epoll_api_js_start, _binary_lib_epoll_api_js_end - _binary_lib_epoll_api_js_start); lo::builtins_add("lib/inflate/api.js", _binary_lib_inflate_api_js_start, _binary_lib_inflate_api_js_end - _binary_lib_inflate_api_js_start); + lo::builtins_add("lib/inflate/build.js", _binary_lib_inflate_build_js_start, _binary_lib_inflate_build_js_end - _binary_lib_inflate_build_js_start); lo::builtins_add("lib/libffi/api.js", _binary_lib_libffi_api_js_start, _binary_lib_libffi_api_js_end - _binary_lib_libffi_api_js_start); lo::builtins_add("lib/libssl/api.js", _binary_lib_libssl_api_js_start, _binary_lib_libssl_api_js_end - _binary_lib_libssl_api_js_start); lo::builtins_add("lib/lz4/api.js", _binary_lib_lz4_api_js_start, _binary_lib_lz4_api_js_end - _binary_lib_lz4_api_js_start); lo::builtins_add("lib/mbedtls/api.js", _binary_lib_mbedtls_api_js_start, _binary_lib_mbedtls_api_js_end - _binary_lib_mbedtls_api_js_start); + lo::builtins_add("lib/mbedtls/build.js", _binary_lib_mbedtls_build_js_start, _binary_lib_mbedtls_build_js_end - _binary_lib_mbedtls_build_js_start); lo::builtins_add("lib/net/api.js", _binary_lib_net_api_js_start, _binary_lib_net_api_js_end - _binary_lib_net_api_js_start); lo::builtins_add("lib/pico/api.js", _binary_lib_pico_api_js_start, _binary_lib_pico_api_js_end - _binary_lib_pico_api_js_start); + lo::builtins_add("lib/pico/build.js", _binary_lib_pico_build_js_start, _binary_lib_pico_build_js_end - _binary_lib_pico_build_js_start); lo::builtins_add("lib/pthread/api.js", _binary_lib_pthread_api_js_start, _binary_lib_pthread_api_js_end - _binary_lib_pthread_api_js_start); lo::builtins_add("lib/seccomp/api.js", _binary_lib_seccomp_api_js_start, _binary_lib_seccomp_api_js_end - _binary_lib_seccomp_api_js_start); lo::builtins_add("lib/sqlite/api.js", _binary_lib_sqlite_api_js_start, _binary_lib_sqlite_api_js_end - _binary_lib_sqlite_api_js_start); lo::builtins_add("lib/system/api.js", _binary_lib_system_api_js_start, _binary_lib_system_api_js_end - _binary_lib_system_api_js_start); lo::builtins_add("lib/tcc/api.js", _binary_lib_tcc_api_js_start, _binary_lib_tcc_api_js_end - _binary_lib_tcc_api_js_start); + lo::builtins_add("lib/tcc/build.js", _binary_lib_tcc_build_js_start, _binary_lib_tcc_build_js_end - _binary_lib_tcc_build_js_start); lo::builtins_add("lib/wireguard/api.js", _binary_lib_wireguard_api_js_start, _binary_lib_wireguard_api_js_end - _binary_lib_wireguard_api_js_start); + lo::builtins_add("lib/wireguard/build.js", _binary_lib_wireguard_build_js_start, _binary_lib_wireguard_build_js_end - _binary_lib_wireguard_build_js_start); lo::builtins_add("lib/zlib/api.js", _binary_lib_zlib_api_js_start, _binary_lib_zlib_api_js_end - _binary_lib_zlib_api_js_start); - lo::builtins_add("lib/duckdb/api.js", _binary_lib_duckdb_api_js_start, _binary_lib_duckdb_api_js_end - _binary_lib_duckdb_api_js_start); lo::modules_add("core", &_register_core); lo::modules_add("inflate", &_register_inflate); lo::modules_add("curl", &_register_curl); diff --git a/main_mac.h b/main_mac.h new file mode 100644 index 0000000..382d562 --- /dev/null +++ b/main_mac.h @@ -0,0 +1,151 @@ +#pragma once +// [do not edit,] +// This file has been automatically generated, please do not change unless you disable auto-generation in the Makefile + +#include "lo.h" + +extern char _binary_main_js_start[]; +extern char _binary_main_js_end[]; +static unsigned int main_js_len = _binary_main_js_end - _binary_main_js_start; +extern char _binary_lib_bench_js_start[]; +extern char _binary_lib_bench_js_end[]; +extern char _binary_lib_gen_js_start[]; +extern char _binary_lib_gen_js_end[]; +extern char _binary_lib_fs_js_start[]; +extern char _binary_lib_fs_js_end[]; +extern char _binary_lib_untar_js_start[]; +extern char _binary_lib_untar_js_end[]; +extern char _binary_lib_proc_js_start[]; +extern char _binary_lib_proc_js_end[]; +extern char _binary_lib_path_js_start[]; +extern char _binary_lib_path_js_end[]; +extern char _binary_lib_curl_js_start[]; +extern char _binary_lib_curl_js_end[]; +extern char _binary_lib_inflate_js_start[]; +extern char _binary_lib_inflate_js_end[]; +extern char _binary_lib_build_js_start[]; +extern char _binary_lib_build_js_end[]; +extern char _binary_lib_asm_js_start[]; +extern char _binary_lib_asm_js_end[]; +extern char _binary_lib_ffi_js_start[]; +extern char _binary_lib_ffi_js_end[]; +extern char _binary_lib_binary_js_start[]; +extern char _binary_lib_binary_js_end[]; +extern char _binary_main_cc_start[]; +extern char _binary_main_cc_end[]; +extern char _binary_lo_cc_start[]; +extern char _binary_lo_cc_end[]; +extern char _binary_lo_h_start[]; +extern char _binary_lo_h_end[]; +extern char _binary_lib_core_api_js_start[]; +extern char _binary_lib_core_api_js_end[]; +extern char _binary_lib_curl_api_js_start[]; +extern char _binary_lib_curl_api_js_end[]; +extern char _binary_lib_duckdb_api_js_start[]; +extern char _binary_lib_duckdb_api_js_end[]; +extern char _binary_lib_duckdb_build_js_start[]; +extern char _binary_lib_duckdb_build_js_end[]; +extern char _binary_lib_encode_api_js_start[]; +extern char _binary_lib_encode_api_js_end[]; +extern char _binary_lib_epoll_api_js_start[]; +extern char _binary_lib_epoll_api_js_end[]; +extern char _binary_lib_inflate_api_js_start[]; +extern char _binary_lib_inflate_api_js_end[]; +extern char _binary_lib_inflate_build_js_start[]; +extern char _binary_lib_inflate_build_js_end[]; +extern char _binary_lib_libffi_api_js_start[]; +extern char _binary_lib_libffi_api_js_end[]; +extern char _binary_lib_libssl_api_js_start[]; +extern char _binary_lib_libssl_api_js_end[]; +extern char _binary_lib_lz4_api_js_start[]; +extern char _binary_lib_lz4_api_js_end[]; +extern char _binary_lib_mbedtls_api_js_start[]; +extern char _binary_lib_mbedtls_api_js_end[]; +extern char _binary_lib_mbedtls_build_js_start[]; +extern char _binary_lib_mbedtls_build_js_end[]; +extern char _binary_lib_net_api_js_start[]; +extern char _binary_lib_net_api_js_end[]; +extern char _binary_lib_pico_api_js_start[]; +extern char _binary_lib_pico_api_js_end[]; +extern char _binary_lib_pico_build_js_start[]; +extern char _binary_lib_pico_build_js_end[]; +extern char _binary_lib_pthread_api_js_start[]; +extern char _binary_lib_pthread_api_js_end[]; +extern char _binary_lib_seccomp_api_js_start[]; +extern char _binary_lib_seccomp_api_js_end[]; +extern char _binary_lib_sqlite_api_js_start[]; +extern char _binary_lib_sqlite_api_js_end[]; +extern char _binary_lib_system_api_js_start[]; +extern char _binary_lib_system_api_js_end[]; +extern char _binary_lib_tcc_api_js_start[]; +extern char _binary_lib_tcc_api_js_end[]; +extern char _binary_lib_tcc_build_js_start[]; +extern char _binary_lib_tcc_build_js_end[]; +extern char _binary_lib_wireguard_api_js_start[]; +extern char _binary_lib_wireguard_api_js_end[]; +extern char _binary_lib_wireguard_build_js_start[]; +extern char _binary_lib_wireguard_build_js_end[]; +extern char _binary_lib_zlib_api_js_start[]; +extern char _binary_lib_zlib_api_js_end[]; + +extern "C" { + extern void* _register_mach(); + extern void* _register_core(); + extern void* _register_inflate(); + extern void* _register_curl(); +} + +void register_builtins() { + lo::builtins_add("main.js", _binary_main_js_start, _binary_main_js_end - _binary_main_js_start); + lo::builtins_add("lib/bench.js", _binary_lib_bench_js_start, _binary_lib_bench_js_end - _binary_lib_bench_js_start); + lo::builtins_add("lib/gen.js", _binary_lib_gen_js_start, _binary_lib_gen_js_end - _binary_lib_gen_js_start); + lo::builtins_add("lib/fs.js", _binary_lib_fs_js_start, _binary_lib_fs_js_end - _binary_lib_fs_js_start); + lo::builtins_add("lib/untar.js", _binary_lib_untar_js_start, _binary_lib_untar_js_end - _binary_lib_untar_js_start); + lo::builtins_add("lib/proc.js", _binary_lib_proc_js_start, _binary_lib_proc_js_end - _binary_lib_proc_js_start); + lo::builtins_add("lib/path.js", _binary_lib_path_js_start, _binary_lib_path_js_end - _binary_lib_path_js_start); + lo::builtins_add("lib/curl.js", _binary_lib_curl_js_start, _binary_lib_curl_js_end - _binary_lib_curl_js_start); + lo::builtins_add("lib/inflate.js", _binary_lib_inflate_js_start, _binary_lib_inflate_js_end - _binary_lib_inflate_js_start); + lo::builtins_add("lib/build.js", _binary_lib_build_js_start, _binary_lib_build_js_end - _binary_lib_build_js_start); + lo::builtins_add("lib/asm.js", _binary_lib_asm_js_start, _binary_lib_asm_js_end - _binary_lib_asm_js_start); + lo::builtins_add("lib/ffi.js", _binary_lib_ffi_js_start, _binary_lib_ffi_js_end - _binary_lib_ffi_js_start); + lo::builtins_add("lib/binary.js", _binary_lib_binary_js_start, _binary_lib_binary_js_end - _binary_lib_binary_js_start); + lo::builtins_add("main.cc", _binary_main_cc_start, _binary_main_cc_end - _binary_main_cc_start); + lo::builtins_add("lo.cc", _binary_lo_cc_start, _binary_lo_cc_end - _binary_lo_cc_start); + lo::builtins_add("lo.h", _binary_lo_h_start, _binary_lo_h_end - _binary_lo_h_start); + lo::builtins_add("lib/core/api.js", _binary_lib_core_api_js_start, _binary_lib_core_api_js_end - _binary_lib_core_api_js_start); + lo::builtins_add("lib/curl/api.js", _binary_lib_curl_api_js_start, _binary_lib_curl_api_js_end - _binary_lib_curl_api_js_start); + lo::builtins_add("lib/duckdb/api.js", _binary_lib_duckdb_api_js_start, _binary_lib_duckdb_api_js_end - _binary_lib_duckdb_api_js_start); + lo::builtins_add("lib/duckdb/build.js", _binary_lib_duckdb_build_js_start, _binary_lib_duckdb_build_js_end - _binary_lib_duckdb_build_js_start); + lo::builtins_add("lib/encode/api.js", _binary_lib_encode_api_js_start, _binary_lib_encode_api_js_end - _binary_lib_encode_api_js_start); + lo::builtins_add("lib/epoll/api.js", _binary_lib_epoll_api_js_start, _binary_lib_epoll_api_js_end - _binary_lib_epoll_api_js_start); + lo::builtins_add("lib/inflate/api.js", _binary_lib_inflate_api_js_start, _binary_lib_inflate_api_js_end - _binary_lib_inflate_api_js_start); + lo::builtins_add("lib/inflate/build.js", _binary_lib_inflate_build_js_start, _binary_lib_inflate_build_js_end - _binary_lib_inflate_build_js_start); + lo::builtins_add("lib/libffi/api.js", _binary_lib_libffi_api_js_start, _binary_lib_libffi_api_js_end - _binary_lib_libffi_api_js_start); + lo::builtins_add("lib/libssl/api.js", _binary_lib_libssl_api_js_start, _binary_lib_libssl_api_js_end - _binary_lib_libssl_api_js_start); + lo::builtins_add("lib/lz4/api.js", _binary_lib_lz4_api_js_start, _binary_lib_lz4_api_js_end - _binary_lib_lz4_api_js_start); + lo::builtins_add("lib/mbedtls/api.js", _binary_lib_mbedtls_api_js_start, _binary_lib_mbedtls_api_js_end - _binary_lib_mbedtls_api_js_start); + lo::builtins_add("lib/mbedtls/build.js", _binary_lib_mbedtls_build_js_start, _binary_lib_mbedtls_build_js_end - _binary_lib_mbedtls_build_js_start); + lo::builtins_add("lib/net/api.js", _binary_lib_net_api_js_start, _binary_lib_net_api_js_end - _binary_lib_net_api_js_start); + lo::builtins_add("lib/pico/api.js", _binary_lib_pico_api_js_start, _binary_lib_pico_api_js_end - _binary_lib_pico_api_js_start); + lo::builtins_add("lib/pico/build.js", _binary_lib_pico_build_js_start, _binary_lib_pico_build_js_end - _binary_lib_pico_build_js_start); + lo::builtins_add("lib/pthread/api.js", _binary_lib_pthread_api_js_start, _binary_lib_pthread_api_js_end - _binary_lib_pthread_api_js_start); + lo::builtins_add("lib/seccomp/api.js", _binary_lib_seccomp_api_js_start, _binary_lib_seccomp_api_js_end - _binary_lib_seccomp_api_js_start); + lo::builtins_add("lib/sqlite/api.js", _binary_lib_sqlite_api_js_start, _binary_lib_sqlite_api_js_end - _binary_lib_sqlite_api_js_start); + lo::builtins_add("lib/system/api.js", _binary_lib_system_api_js_start, _binary_lib_system_api_js_end - _binary_lib_system_api_js_start); + lo::builtins_add("lib/tcc/api.js", _binary_lib_tcc_api_js_start, _binary_lib_tcc_api_js_end - _binary_lib_tcc_api_js_start); + lo::builtins_add("lib/tcc/build.js", _binary_lib_tcc_build_js_start, _binary_lib_tcc_build_js_end - _binary_lib_tcc_build_js_start); + lo::builtins_add("lib/wireguard/api.js", _binary_lib_wireguard_api_js_start, _binary_lib_wireguard_api_js_end - _binary_lib_wireguard_api_js_start); + lo::builtins_add("lib/wireguard/build.js", _binary_lib_wireguard_build_js_start, _binary_lib_wireguard_build_js_end - _binary_lib_wireguard_build_js_start); + lo::builtins_add("lib/zlib/api.js", _binary_lib_zlib_api_js_start, _binary_lib_zlib_api_js_end - _binary_lib_zlib_api_js_start); + lo::modules_add("mach", &_register_mach); + lo::modules_add("core", &_register_core); + lo::modules_add("inflate", &_register_inflate); + lo::modules_add("curl", &_register_curl); +} + +static const char* main_js = _binary_main_js_start; +static const char* v8flags = "--stack-trace-limit=10 --use-strict --turbo-fast-api-calls --no-freeze-flags-after-init"; +static unsigned int _v8flags_from_commandline = 1; +static unsigned int _v8_threads = 2; +static unsigned int _v8_cleanup = 0; +static unsigned int _on_exit = 0; diff --git a/main_win.h b/main_win.h index 0d33ebc..ae68b14 100644 --- a/main_win.h +++ b/main_win.h @@ -32,23 +32,29 @@ void register_builtins() { lo::builtins_add("lo.h", _binary_lo_h_start, _binary_lo_h_len); lo::builtins_add("lib/core/api.js", _binary_lib_core_api_js_start, _binary_lib_core_api_js_len); lo::builtins_add("lib/curl/api.js", _binary_lib_curl_api_js_start, _binary_lib_curl_api_js_len); + lo::builtins_add("lib/duckdb/api.js", _binary_lib_duckdb_api_js_start, _binary_lib_duckdb_api_js_len); + lo::builtins_add("lib/duckdb/build.js", _binary_lib_duckdb_build_js_start, _binary_lib_duckdb_build_js_len); lo::builtins_add("lib/encode/api.js", _binary_lib_encode_api_js_start, _binary_lib_encode_api_js_len); lo::builtins_add("lib/epoll/api.js", _binary_lib_epoll_api_js_start, _binary_lib_epoll_api_js_len); lo::builtins_add("lib/inflate/api.js", _binary_lib_inflate_api_js_start, _binary_lib_inflate_api_js_len); + lo::builtins_add("lib/inflate/build.js", _binary_lib_inflate_build_js_start, _binary_lib_inflate_build_js_len); lo::builtins_add("lib/libffi/api.js", _binary_lib_libffi_api_js_start, _binary_lib_libffi_api_js_len); lo::builtins_add("lib/libssl/api.js", _binary_lib_libssl_api_js_start, _binary_lib_libssl_api_js_len); lo::builtins_add("lib/lz4/api.js", _binary_lib_lz4_api_js_start, _binary_lib_lz4_api_js_len); lo::builtins_add("lib/mbedtls/api.js", _binary_lib_mbedtls_api_js_start, _binary_lib_mbedtls_api_js_len); + lo::builtins_add("lib/mbedtls/build.js", _binary_lib_mbedtls_build_js_start, _binary_lib_mbedtls_build_js_len); lo::builtins_add("lib/net/api.js", _binary_lib_net_api_js_start, _binary_lib_net_api_js_len); lo::builtins_add("lib/pico/api.js", _binary_lib_pico_api_js_start, _binary_lib_pico_api_js_len); + lo::builtins_add("lib/pico/build.js", _binary_lib_pico_build_js_start, _binary_lib_pico_build_js_len); lo::builtins_add("lib/pthread/api.js", _binary_lib_pthread_api_js_start, _binary_lib_pthread_api_js_len); lo::builtins_add("lib/seccomp/api.js", _binary_lib_seccomp_api_js_start, _binary_lib_seccomp_api_js_len); lo::builtins_add("lib/sqlite/api.js", _binary_lib_sqlite_api_js_start, _binary_lib_sqlite_api_js_len); lo::builtins_add("lib/system/api.js", _binary_lib_system_api_js_start, _binary_lib_system_api_js_len); lo::builtins_add("lib/tcc/api.js", _binary_lib_tcc_api_js_start, _binary_lib_tcc_api_js_len); + lo::builtins_add("lib/tcc/build.js", _binary_lib_tcc_build_js_start, _binary_lib_tcc_build_js_len); lo::builtins_add("lib/wireguard/api.js", _binary_lib_wireguard_api_js_start, _binary_lib_wireguard_api_js_len); + lo::builtins_add("lib/wireguard/build.js", _binary_lib_wireguard_build_js_start, _binary_lib_wireguard_build_js_len); lo::builtins_add("lib/zlib/api.js", _binary_lib_zlib_api_js_start, _binary_lib_zlib_api_js_len); - lo::builtins_add("lib/duckdb/api.js", _binary_lib_duckdb_api_js_start, _binary_lib_duckdb_api_js_len); lo::modules_add("core", &_register_core); lo::modules_add("inflate", &_register_inflate); lo::modules_add("curl", &_register_curl); diff --git a/test/build.js b/test/build.js index 71e126d..cf0aed3 100644 --- a/test/build.js +++ b/test/build.js @@ -36,8 +36,9 @@ const bindings = (os === 'linux' ? [ 'encode', 'inflate', 'libffi', -// 'libssl', - 'machkq', +// 'libssl', // we cannot have libssl and curl (with openssl) linked into same binary, or can we? it should work if we dynamically link + 'kevents', + 'mach', 'net', 'pico', 'pthread', diff --git a/test/timer.js b/test/timer.js new file mode 100644 index 0000000..af3618e --- /dev/null +++ b/test/timer.js @@ -0,0 +1,14 @@ +import { Loop } from 'lib/loop.js' +import { Timer } from 'lib/timer.js' + +const { assert } = lo + +const loop = new Loop() +let counter = 0 +const timer = new Timer(loop, 1000, () => { + console.log('timer') + counter++ + if (counter === 5) timer.close() +}) +while (loop.poll() > 0) {} +assert(counter === 5)