Record information about sections of emitted code+data.
The result of the emitter is a vector of bytes holding machine code, jump tables, and (in the future) other read-only data. Some clients, notably Firefox's Wasm compiler, needs to separate the machine code from the data in order to insert more code directly after the code generated by Cranelift. To make such separation possible, we record more information about the emitted bytes: the sizes of each of the sections of code, jump tables, and read-only data, as well as the locations within the code that reference (PC-relatively) the jump tables and read-only data.
This commit is contained in:
committed by
Lars T Hansen
parent
70f79d23bf
commit
420850adf0
@@ -138,9 +138,9 @@ impl Backend for FaerieBackend {
|
||||
name: &str,
|
||||
ctx: &cranelift_codegen::Context,
|
||||
namespace: &ModuleNamespace<Self>,
|
||||
code_size: u32,
|
||||
total_size: u32,
|
||||
) -> ModuleResult<FaerieCompiledFunction> {
|
||||
let mut code: Vec<u8> = vec![0; code_size as usize];
|
||||
let mut code: Vec<u8> = vec![0; total_size as usize];
|
||||
|
||||
// Non-lexical lifetimes would obviate the braces here.
|
||||
{
|
||||
@@ -153,7 +153,7 @@ impl Backend for FaerieBackend {
|
||||
};
|
||||
|
||||
if let Some(ref mut trap_manifest) = self.trap_manifest {
|
||||
let mut trap_sink = FaerieTrapSink::new(name, code_size);
|
||||
let mut trap_sink = FaerieTrapSink::new(name, total_size);
|
||||
unsafe {
|
||||
ctx.emit_to_memory(
|
||||
&*self.isa,
|
||||
|
||||
Reference in New Issue
Block a user