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

Investigate bytecode serialization #732

Closed
pepeiborra opened this issue Oct 9, 2020 · 4 comments
Closed

Investigate bytecode serialization #732

pepeiborra opened this issue Oct 9, 2020 · 4 comments

Comments

@pepeiborra
Copy link
Collaborator

Bytecode itself can be serialised. ResolvedBCO has a Binary instance although that might be too late in the compilation pipeline for you. Specifically the compilation pipeline for bytecode is,

CoreProgram                             \
  ⇓  GHC.CoreToByteCode.schemeTopBind    |
ProtoBCO                                 | GHC.CoreToByteCode.byteCodeGen
  ⇓  GHC.ByteCode.Asm.assembleBCOs       |
CompiledByteCode                        /
  ⇓  GHC.ByteCode.Linker.linkBCO
ResolvedBCO
  ⇓  GHCi.CreateBCO.createBCOs
HValueRef

I haven't thought hard about where the right place in this pipeline would be to persist bytecode.

Originally posted by @bgamari in https://github.com/haskell/ghcide/issues/854#issuecomment-705790631

@pepeiborra
Copy link
Collaborator Author

/cc @josefs

@pepeiborra
Copy link
Collaborator Author

Relevant: it should be possible to serialize core to iface files, taking hints from ezyang/ghc@13615ca. The idea here is that we can preserve the Core produced by the frontend in the interface file such that we can later easily produce restart the compilation pipeline to produce bytecode (which should be quick).

@josefs
Copy link

josefs commented Nov 29, 2020

Note that ResolvedBCO contains pointers into memory, so to serialize it we would have to unresolve it. I don't know what the Binary instance is for but it sounds very easy to misuse.

@pepeiborra pepeiborra transferred this issue from haskell/ghcide Dec 30, 2020
@pepeiborra
Copy link
Collaborator Author

closing as this is a non-actionable documentation ticket

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

No branches or pull requests

2 participants