-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
145 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// This file contains code from external sources. | ||
// Attributions: https://github.com/wasmerio/wasmer/blob/master/ATTRIBUTIONS.md | ||
|
||
use wasmer_compiler::{FunctionAddressMap, FunctionBodyData, InstructionAddressMap, SourceLoc}; | ||
|
||
pub fn get_function_address_map<'data>( | ||
instructions: Vec<InstructionAddressMap>, | ||
data: &FunctionBodyData<'data>, | ||
body_len: usize, | ||
) -> FunctionAddressMap { | ||
// Generate artificial srcloc for function start/end to identify boundary | ||
// within module. It will wrap around if byte code is larger than 4 GB. | ||
let start_srcloc = SourceLoc::new(data.module_offset as u32); | ||
let end_srcloc = SourceLoc::new((data.module_offset + data.data.len()) as u32); | ||
|
||
FunctionAddressMap { | ||
instructions, | ||
start_srcloc, | ||
end_srcloc, | ||
body_offset: 0, | ||
body_len, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters