mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
Wasm: add preloaded_bytes and preloaded_count to Code section
This commit is contained in:
parent
743e14148c
commit
b8f51fb1bb
2 changed files with 7 additions and 1 deletions
|
@ -489,6 +489,8 @@ impl<'a> Serialize for ExportSection<'a> {
|
|||
|
||||
#[derive(Debug)]
|
||||
pub struct CodeSection<'a> {
|
||||
pub preloaded_count: u32,
|
||||
pub preloaded_bytes: Vec<'a, u8>,
|
||||
pub code_builders: Vec<'a, CodeBuilder<'a>>,
|
||||
}
|
||||
|
||||
|
@ -500,7 +502,9 @@ impl<'a> CodeSection<'a> {
|
|||
relocations: &mut Vec<'a, RelocationEntry>,
|
||||
) -> usize {
|
||||
let header_indices = write_section_header(buffer, SectionId::Code);
|
||||
buffer.encode_u32(self.code_builders.len() as u32);
|
||||
buffer.encode_u32(self.preloaded_count + self.code_builders.len() as u32);
|
||||
|
||||
buffer.append_slice(&self.preloaded_bytes);
|
||||
|
||||
for code_builder in self.code_builders.iter() {
|
||||
code_builder.serialize_with_relocs(buffer, relocations, header_indices.body_index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue