mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
wasm: comments & renaming
This commit is contained in:
parent
7ccc5ec768
commit
7958158d89
4 changed files with 17 additions and 29 deletions
|
@ -66,17 +66,18 @@ impl<'a> PreloadsCallGraph<'a> {
|
|||
pub fn parse_preloads_call_graph<'a>(
|
||||
arena: &'a Bump,
|
||||
code_section_body: &[u8],
|
||||
import_signatures: &[u32],
|
||||
function_signatures: &[u32],
|
||||
imported_fn_signatures: &[u32],
|
||||
defined_fn_signatures: &[u32],
|
||||
indirect_callees: &[u32],
|
||||
) -> PreloadsCallGraph<'a> {
|
||||
let mut call_graph =
|
||||
PreloadsCallGraph::new(arena, import_signatures.len(), function_signatures.len());
|
||||
PreloadsCallGraph::new(arena, imported_fn_signatures.len(), defined_fn_signatures.len());
|
||||
|
||||
// Function type signatures, used for indirect calls
|
||||
let mut signatures =
|
||||
Vec::with_capacity_in(import_signatures.len() + function_signatures.len(), arena);
|
||||
signatures.extend_from_slice(import_signatures);
|
||||
signatures.extend_from_slice(function_signatures);
|
||||
Vec::with_capacity_in(imported_fn_signatures.len() + defined_fn_signatures.len(), arena);
|
||||
signatures.extend_from_slice(imported_fn_signatures);
|
||||
signatures.extend_from_slice(defined_fn_signatures);
|
||||
|
||||
// Iterate over the bytes of the Code section
|
||||
let mut cursor: usize = 0;
|
||||
|
|
|
@ -133,10 +133,10 @@ impl<'a> WasmModule<'a> {
|
|||
types.parse_offsets();
|
||||
|
||||
let mut import = ImportSection::preload(arena, bytes, &mut cursor);
|
||||
let import_signatures = import.parse(arena);
|
||||
let imported_fn_signatures = import.parse(arena);
|
||||
|
||||
let function = FunctionSection::preload(arena, bytes, &mut cursor);
|
||||
let function_signatures = function.parse(arena);
|
||||
let defined_fn_signatures = function.parse(arena);
|
||||
|
||||
let table = OpaqueSection::preload(SectionId::Table, arena, bytes, &mut cursor);
|
||||
|
||||
|
@ -155,8 +155,8 @@ impl<'a> WasmModule<'a> {
|
|||
arena,
|
||||
bytes,
|
||||
&mut cursor,
|
||||
&import_signatures,
|
||||
&function_signatures,
|
||||
&imported_fn_signatures,
|
||||
&defined_fn_signatures,
|
||||
&indirect_callees,
|
||||
);
|
||||
|
||||
|
|
|
@ -383,8 +383,8 @@ impl<'a> ImportSection<'a> {
|
|||
let mut fn_signatures = bumpalo::vec![in arena];
|
||||
let mut cursor = 0;
|
||||
while cursor < self.bytes.len() {
|
||||
String::skip_bytes(&self.bytes, &mut cursor);
|
||||
String::skip_bytes(&self.bytes, &mut cursor);
|
||||
String::skip_bytes(&self.bytes, &mut cursor); // import namespace
|
||||
String::skip_bytes(&self.bytes, &mut cursor); // import name
|
||||
|
||||
let type_id = ImportTypeId::from(self.bytes[cursor]);
|
||||
cursor += 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue