Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(runtime): add process.binding uv/natives/config + make global object properties lazy #5355

Merged
merged 14 commits into from
Sep 15, 2023

Conversation

paperclover
Copy link
Member

@paperclover paperclover commented Sep 14, 2023

What does this PR do?

changelog notes:

  • feat(runtime): add process.binding uv/natives/config
  • perf(runtime): make Bun's GlobalObject a static hash table

This refactors how process.binding works, mainly bringing it into native code. This implements the UV binding (which is simply an error map) which lays out the groundwork to implement the rest of the bindings easily.

Perhaps before this is merged i will implement some more of these bindings because some are very easy for us to do.

@paperclover paperclover marked this pull request as ready for review September 14, 2023 09:49
@github-actions
Copy link
Contributor

@paperdave 127 files with test failures on linux-x64-baseline:

  • test/bundler/bun-build-api.test.ts
  • test/bundler/bundler_browser.test.ts
  • test/bundler/bundler_cjs2esm.test.ts
  • test/bundler/bundler_compile.test.ts
  • test/bundler/bundler_edgecase.test.ts
  • test/bundler/bundler_jsx.test.ts
  • test/bundler/bundler_minify.test.ts
  • test/bundler/bundler_naming.test.ts
  • test/bundler/bundler_npm.test.ts
  • test/bundler/bundler_plugin.test.ts
  • test/bundler/bundler_regressions.test.ts
  • test/bundler/bundler_string.test.ts
  • test/bundler/cli.test.ts
  • test/bundler/esbuild/css.test.ts
  • test/bundler/esbuild/dce.test.ts
  • test/bundler/esbuild/default.test.ts
  • test/bundler/esbuild/extra.test.ts
  • test/bundler/esbuild/importstar.test.ts
  • test/bundler/esbuild/importstar_ts.test.ts
  • test/bundler/esbuild/loader.test.ts
  • test/bundler/esbuild/lower.test.ts
  • test/bundler/esbuild/packagejson.test.ts
  • test/bundler/esbuild/splitting.test.ts
  • test/bundler/esbuild/ts.test.ts
  • test/bundler/esbuild/tsconfig.test.ts
  • test/cli/bun.test.ts
  • test/cli/hot/hot.test.ts
  • test/cli/install/bad-workspace.test.ts
  • test/cli/install/bun-add.test.ts
  • test/cli/install/bun-install-pathname-trailing-slash.test.ts
  • test/cli/install/bun-install.test.ts
  • test/cli/install/bun-link.test.ts
  • test/cli/install/bun-pm.test.ts
  • test/cli/install/bun-remove.test.ts
  • test/cli/install/bun-run.test.ts
  • test/cli/install/bun-update.test.ts
  • test/cli/install/bunx.test.ts
  • test/cli/run/commonjs-no-export.test.ts
  • test/cli/run/env.test.ts
  • test/cli/run/log-test.test.ts
  • test/cli/run/preload-test.test.js
  • test/cli/run/require-cache.test.ts
  • test/cli/run/run-cjs.test.ts
  • test/cli/run/run-process-env.test.ts
  • test/cli/run/run-quote.test.ts
  • test/cli/test/bun-test.test.ts
  • test/internal/package-json-lint.test.ts
  • test/js/bun/ffi/ffi.test.js
  • test/js/bun/http/fetch-file-upload.test.ts
  • test/js/bun/http/proxy.test.js
  • test/js/bun/http/serve.test.ts
  • test/js/bun/io/bun-write.test.js
  • test/js/bun/jsc/domjit.test.ts
  • test/js/bun/plugin/plugins.test.ts
  • test/js/bun/resolve/import-meta.test.js
  • test/js/bun/resolve/non-english-import.test.js
  • test/js/bun/resolve/resolve.test.ts
  • test/js/bun/spawn/spawn-streaming-stdin.test.ts
  • test/js/bun/spawn/spawn-streaming-stdout.test.ts
  • test/js/bun/spawn/spawn.test.ts
  • test/js/bun/sqlite/sqlite.test.js
  • test/js/bun/test/expect.test.js
  • test/js/bun/test/jest-extended.test.js
  • test/js/bun/test/preload-test.test.js
  • test/js/bun/test/snapshot-tests/new-snapshot.test.ts
  • test/js/bun/test/test-test.test.ts
  • test/js/bun/util/bun-file-exists.test.js
  • test/js/bun/util/error-gc-test.test.js
  • test/js/bun/util/filesink.test.ts
  • test/js/bun/util/filesystem_router.test.ts
  • test/js/bun/util/which.test.ts
  • test/js/bun/wasm/wasi.test.js
  • test/js/node/async_hooks/AsyncLocalStorage.test.ts
  • test/js/node/buffer.test.js
  • test/js/node/child_process/child-process-stdio.test.js
  • test/js/node/child_process/child_process-node.test.js
  • test/js/node/child_process/child_process.test.ts
  • test/js/node/crypto/crypto-lazyhash.test.ts
  • test/js/node/crypto/crypto-scrypt.test.ts
  • test/js/node/crypto/crypto.test.ts
  • test/js/node/crypto/node-crypto.test.js
  • test/js/node/dns/node-dns.test.js
  • test/js/node/fs/cp.test.ts
  • test/js/node/fs/fs.test.ts
  • test/js/node/http/node-http.test.ts
  • test/js/node/net/node-net-server.test.ts
  • test/js/node/net/node-net.test.ts
  • test/js/node/os/os.test.js
  • test/js/node/process/process-stdio.test.ts
  • test/js/node/process/process.test.js
  • test/js/node/stream/node-stream.test.js
  • test/js/node/stubs.test.js
  • test/js/node/tls/node-tls-server.test.ts
  • test/js/node/util/util-promisify.test.js
  • test/js/node/watch/fs.watch.test.ts
  • test/js/node/watch/fs.watchFile.test.ts
  • test/js/node/zlib/zlib.test.js
  • test/js/third_party/body-parser/express-body-parser-test.test.ts
  • test/js/third_party/esbuild/esbuild-child_process.test.ts
  • test/js/third_party/mongodb/mongodb.test.ts
  • test/js/third_party/postgres/postgres.test.ts
  • test/js/third_party/prisma/prisma.test.ts
  • test/js/third_party/resvg/bbox.test.js
  • test/js/third_party/socket.io/socket.io-close.test.ts
  • test/js/third_party/socket.io/socket.io-connection-state-recovery.test.ts
  • test/js/third_party/socket.io/socket.io-handshake.test.ts
  • test/js/third_party/socket.io/socket.io-messaging-many.test.ts
  • test/js/third_party/socket.io/socket.io-middleware.test.ts
  • test/js/third_party/socket.io/socket.io-namespaces.test.ts
  • test/js/third_party/socket.io/socket.io-server-attachment.test.ts
  • test/js/third_party/socket.io/socket.io-socket-middleware.test.ts
  • test/js/third_party/socket.io/socket.io-socket-timeout.test.ts
  • test/js/third_party/socket.io/socket.io-utility-methods.test.ts
  • test/js/third_party/socket.io/socket.io.test.ts
  • test/js/third_party/svelte/svelte.test.ts
  • test/js/third_party/webpack/webpack.test.ts
  • test/js/web/abort/abort.test.ts
  • test/js/web/fetch/fetch-gzip.test.ts
  • test/js/web/fetch/fetch.stream.test.ts
  • test/js/web/fetch/fetch.test.ts
  • test/js/web/streams/streams.test.js
  • test/js/web/web-globals.test.js
  • test/js/web/workers/structured-clone.test.ts
  • test/js/workerd/html-rewriter.test.js
  • test/regression/issue/00631.test.ts
  • test/regression/issue/03216.test.ts
  • test/regression/issue/4893.test.ts

View test output

#66a4e1a066c7dcfb1f5362986d67effdbf888e48

@github-actions
Copy link
Contributor

@paperdave 127 files with test failures on linux-x64:

  • test/bundler/bun-build-api.test.ts
  • test/bundler/bundler_browser.test.ts
  • test/bundler/bundler_cjs2esm.test.ts
  • test/bundler/bundler_compile.test.ts
  • test/bundler/bundler_edgecase.test.ts
  • test/bundler/bundler_jsx.test.ts
  • test/bundler/bundler_minify.test.ts
  • test/bundler/bundler_naming.test.ts
  • test/bundler/bundler_npm.test.ts
  • test/bundler/bundler_plugin.test.ts
  • test/bundler/bundler_regressions.test.ts
  • test/bundler/bundler_string.test.ts
  • test/bundler/cli.test.ts
  • test/bundler/esbuild/css.test.ts
  • test/bundler/esbuild/dce.test.ts
  • test/bundler/esbuild/default.test.ts
  • test/bundler/esbuild/extra.test.ts
  • test/bundler/esbuild/importstar.test.ts
  • test/bundler/esbuild/importstar_ts.test.ts
  • test/bundler/esbuild/loader.test.ts
  • test/bundler/esbuild/lower.test.ts
  • test/bundler/esbuild/packagejson.test.ts
  • test/bundler/esbuild/splitting.test.ts
  • test/bundler/esbuild/ts.test.ts
  • test/bundler/esbuild/tsconfig.test.ts
  • test/cli/bun.test.ts
  • test/cli/hot/hot.test.ts
  • test/cli/install/bad-workspace.test.ts
  • test/cli/install/bun-add.test.ts
  • test/cli/install/bun-install-pathname-trailing-slash.test.ts
  • test/cli/install/bun-install.test.ts
  • test/cli/install/bun-link.test.ts
  • test/cli/install/bun-pm.test.ts
  • test/cli/install/bun-remove.test.ts
  • test/cli/install/bun-run.test.ts
  • test/cli/install/bun-update.test.ts
  • test/cli/install/bunx.test.ts
  • test/cli/run/commonjs-no-export.test.ts
  • test/cli/run/env.test.ts
  • test/cli/run/log-test.test.ts
  • test/cli/run/preload-test.test.js
  • test/cli/run/require-cache.test.ts
  • test/cli/run/run-cjs.test.ts
  • test/cli/run/run-process-env.test.ts
  • test/cli/run/run-quote.test.ts
  • test/cli/test/bun-test.test.ts
  • test/internal/package-json-lint.test.ts
  • test/js/bun/ffi/ffi.test.js
  • test/js/bun/http/fetch-file-upload.test.ts
  • test/js/bun/http/proxy.test.js
  • test/js/bun/http/serve.test.ts
  • test/js/bun/io/bun-write.test.js
  • test/js/bun/jsc/domjit.test.ts
  • test/js/bun/plugin/plugins.test.ts
  • test/js/bun/resolve/import-meta.test.js
  • test/js/bun/resolve/non-english-import.test.js
  • test/js/bun/resolve/resolve.test.ts
  • test/js/bun/spawn/spawn-streaming-stdin.test.ts
  • test/js/bun/spawn/spawn-streaming-stdout.test.ts
  • test/js/bun/spawn/spawn.test.ts
  • test/js/bun/sqlite/sqlite.test.js
  • test/js/bun/test/expect.test.js
  • test/js/bun/test/jest-extended.test.js
  • test/js/bun/test/preload-test.test.js
  • test/js/bun/test/snapshot-tests/new-snapshot.test.ts
  • test/js/bun/test/test-test.test.ts
  • test/js/bun/util/bun-file-exists.test.js
  • test/js/bun/util/error-gc-test.test.js
  • test/js/bun/util/filesink.test.ts
  • test/js/bun/util/filesystem_router.test.ts
  • test/js/bun/util/which.test.ts
  • test/js/bun/wasm/wasi.test.js
  • test/js/node/async_hooks/AsyncLocalStorage.test.ts
  • test/js/node/buffer.test.js
  • test/js/node/child_process/child-process-stdio.test.js
  • test/js/node/child_process/child_process-node.test.js
  • test/js/node/child_process/child_process.test.ts
  • test/js/node/crypto/crypto-lazyhash.test.ts
  • test/js/node/crypto/crypto-scrypt.test.ts
  • test/js/node/crypto/crypto.test.ts
  • test/js/node/crypto/node-crypto.test.js
  • test/js/node/dns/node-dns.test.js
  • test/js/node/fs/cp.test.ts
  • test/js/node/fs/fs.test.ts
  • test/js/node/http/node-http.test.ts
  • test/js/node/net/node-net-server.test.ts
  • test/js/node/net/node-net.test.ts
  • test/js/node/os/os.test.js
  • test/js/node/process/process-stdio.test.ts
  • test/js/node/process/process.test.js
  • test/js/node/stream/node-stream.test.js
  • test/js/node/stubs.test.js
  • test/js/node/tls/node-tls-server.test.ts
  • test/js/node/util/util-promisify.test.js
  • test/js/node/watch/fs.watch.test.ts
  • test/js/node/watch/fs.watchFile.test.ts
  • test/js/node/zlib/zlib.test.js
  • test/js/third_party/body-parser/express-body-parser-test.test.ts
  • test/js/third_party/esbuild/esbuild-child_process.test.ts
  • test/js/third_party/mongodb/mongodb.test.ts
  • test/js/third_party/postgres/postgres.test.ts
  • test/js/third_party/prisma/prisma.test.ts
  • test/js/third_party/resvg/bbox.test.js
  • test/js/third_party/socket.io/socket.io-close.test.ts
  • test/js/third_party/socket.io/socket.io-connection-state-recovery.test.ts
  • test/js/third_party/socket.io/socket.io-handshake.test.ts
  • test/js/third_party/socket.io/socket.io-messaging-many.test.ts
  • test/js/third_party/socket.io/socket.io-middleware.test.ts
  • test/js/third_party/socket.io/socket.io-namespaces.test.ts
  • test/js/third_party/socket.io/socket.io-server-attachment.test.ts
  • test/js/third_party/socket.io/socket.io-socket-middleware.test.ts
  • test/js/third_party/socket.io/socket.io-socket-timeout.test.ts
  • test/js/third_party/socket.io/socket.io-utility-methods.test.ts
  • test/js/third_party/socket.io/socket.io.test.ts
  • test/js/third_party/svelte/svelte.test.ts
  • test/js/third_party/webpack/webpack.test.ts
  • test/js/web/abort/abort.test.ts
  • test/js/web/fetch/fetch-gzip.test.ts
  • test/js/web/fetch/fetch.stream.test.ts
  • test/js/web/fetch/fetch.test.ts
  • test/js/web/streams/streams.test.js
  • test/js/web/web-globals.test.js
  • test/js/web/workers/structured-clone.test.ts
  • test/js/workerd/html-rewriter.test.js
  • test/regression/issue/00631.test.ts
  • test/regression/issue/03216.test.ts
  • test/regression/issue/4893.test.ts

View test output

#66a4e1a066c7dcfb1f5362986d67effdbf888e48

@birkskyum birkskyum mentioned this pull request Sep 14, 2023
@paperclover paperclover marked this pull request as draft September 14, 2023 23:48
@paperclover paperclover changed the title feat(runtime): improve process.binding feat(runtime): add process.binding uv/natives/config + make global object properties lazy Sep 14, 2023
@Jarred-Sumner Jarred-Sumner marked this pull request as ready for review September 15, 2023 06:05
@Jarred-Sumner Jarred-Sumner merged commit 29b2217 into main Sep 15, 2023
@Jarred-Sumner Jarred-Sumner deleted the dave/process_binding branch September 15, 2023 15:22
paperclover added a commit to SuperAuguste/bun that referenced this pull request Sep 18, 2023
…lobal object properties lazy (oven-sh#5355)

* binding uv

* we did that

* some more bindings

* fix doc

* fix uv

* yo

* static hash table nonsense <3

* huge refactor to the global object i am not ready for merge conflicts

* it works part 3

* lose

---------

Co-authored-by: Jarred Sumner <[email protected]>
@mariobm
Copy link

mariobm commented Sep 28, 2023

Why can't I see this in changelog, wasn't this included in 1.0.3?

@paperclover
Copy link
Member Author

it was included in 1.0.3. i guess we forgot to add it to the changelog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants