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

Include handle in bytecode data segment metadata #113

Merged
merged 1 commit into from Feb 12, 2018

Conversation

tomdale
Copy link
Contributor

@tomdale tomdale commented Feb 12, 2018

Currently, we ship a JSON data structure with bytecode templates called meta that is keyed on specifier string and contains the component's VM handle and symbol table. This data structure supports dynamic lookup of components via the {{component}} helper, even though most component invocations are precompiled in bytecode mode.

However, we currently don't serialize each component's handle, which is an application-specific identifier. Handles are used to allow opcodes to refer to "live" JavaScript objects, like component classes, at runtime. While handles are built into the compiled bytecode, they are not accessible to dynamic component invocation. This means that Glimmer.js apps have to ship both the module resolution map as well as the template metadata just to get an app to boot, which is wasteful.

This commit adds each component's handle to its metadata entry in the compiled data segment. It also updates the BytecodeResolver to use the handle and external module table, so resolution happens identically to the static invocation path. In addition to this resolution being faster, it also means that Glimmer.js apps can boot without a resolution map and use the bytecode metadata for everything.

Currently, we ship a JSON data structure with bytecode templates called `meta` that is keyed on specifier string and contains the component's VM handle and symbol table. This data structure supports dynamic lookup of components via the `{{component}}` helper, even though most component invocations are precompiled in bytecode mode.

However, we currently don't serialize each component's handle, which is an application-specific identifier. Handles are used to allow opcodes to refer to "live" JavaScript objects, like component classes, at runtime. While handles are built into the compiled bytecode, they are not accessible to dynamic component invocation. This means that Glimmer.js apps have to ship both the module resolution map as well as the template metadata just to get an app to boot, which is wasteful.

This commit adds each component's handle to its metadata entry in the compiled data segment. It also updates the BytecodeResolver to use the handle and external module table, so resolution happens identically to the static invocation path. In addition to this resolution being faster, it also means that Glimmer.js apps can boot without a resolution map and use the bytecode metadata for everything.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants