Add builtin function executable bytecode encode/decode API#177
Draft
sosukesuzuki wants to merge 2 commits intomainfrom
Draft
Add builtin function executable bytecode encode/decode API#177sosukesuzuki wants to merge 2 commits intomainfrom
sosukesuzuki wants to merge 2 commits intomainfrom
Conversation
Preview Builds
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds JSC API for encoding/decoding
UnlinkedFunctionExecutable(includingnested code blocks) as top-level bytecode cache entries. Used by Bun to
pre-generate bytecode for internal modules and builtin functions at build
time, so standalone executables can skip parsing at runtime.
Changes
CachedTypes.h/.cpp
BuiltinFunctionCacheEntry: simplified cache entry for builtin executables(skips
SourceCodeKeyvalidation since builtin sources are fixed at buildtime; only checks cache version)
encodeBuiltinFunctionExecutable(VM&, UnlinkedFunctionExecutable*): serializedecodeBuiltinFunctionExecutable(VM&, Ref<CachedBytecode>): deserializeCodeCache.h/.cpp
recursivelyGenerateUnlinkedCodeBlockForBuiltinFunction: parses a builtinsource (with
@-prefixed private identifiers) and recursively generatesbytecode for all nested functions. Similar to the existing
recursivelyGenerateUnlinkedCodeBlockForProgram/Modulebut for builtins.Metadata parameters (
ImplementationVisibility,ConstructorKind,ConstructAbility,InlineAttribute) have default values matching whatinternal module wrappers need.
All additions are guarded by
USE(BUN_JSC_ADDITIONS).Companion Bun PR: oven-sh/bun#28461