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(serialized): deserialize with bytechecked #7460

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kwonoj
Copy link
Member

@kwonoj kwonoj commented May 29, 2023

Description:

Note: this PR currently fails, description's to explain those and discuss how to move forward.

This PR replaces current deserialize from unsafe, non-bytechecked to bytechecked version. This truly enables bytechecked operation since now we actually deserializes with bytechecked one. Enabling this revelas few place doesn't mark bytecheck attributes, addresses it as well.

However, this PR fails to build with this error message:

error[E0275]: overflow evaluating the requirement `swc_ecma_ast::stmt::ArchivedBlockStmt: bytecheck::CheckBytes<rkyv::validation::validators::DefaultValidator<'_>>`

error[E0275]: overflow evaluating the requirement `ArchivedComponentValue: bytecheck::CheckBytes<rkyv::validation::validators::DefaultValidator<'_>>`

There is an upstream issue explains this already: rkyv/rkyv#214 , and it looks like those 2 struct s(BlockStmt and ComponentValue) may include circular references in its structs somehow. for example BlockStmt -> Vec<Stmt> -> Stmt::Block(BlockStmt).

If this is true, this may explain some of esoteric failures when it gets to deserialization fail (or unexpected behaviors).

Now the question is how to resolve this. Quick peeking, it doesn't seem to obvious I can amend existing AST to conform the requirement.

@kwonoj kwonoj force-pushed the deserialize-bytechecked branch from 9221639 to 78317c4 Compare May 30, 2023 05:18
@kdy1 kdy1 added this to the Planned milestone Nov 13, 2023
@kwonoj kwonoj requested a review from a team as a code owner April 29, 2024 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants