@@ -11,6 +11,7 @@ use libc;
|
|||||||
use memory::Memory;
|
use memory::Memory;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
use std::io::Write;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use target_lexicon::PointerWidth;
|
use target_lexicon::PointerWidth;
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
@@ -167,7 +168,7 @@ impl<'simple_jit_backend> Backend for SimpleJITBackend {
|
|||||||
|
|
||||||
fn define_function(
|
fn define_function(
|
||||||
&mut self,
|
&mut self,
|
||||||
_name: &str,
|
name: &str,
|
||||||
ctx: &cranelift_codegen::Context,
|
ctx: &cranelift_codegen::Context,
|
||||||
_namespace: &ModuleNamespace<Self>,
|
_namespace: &ModuleNamespace<Self>,
|
||||||
code_size: u32,
|
code_size: u32,
|
||||||
@@ -177,6 +178,17 @@ impl<'simple_jit_backend> Backend for SimpleJITBackend {
|
|||||||
.code_memory
|
.code_memory
|
||||||
.allocate(size)
|
.allocate(size)
|
||||||
.expect("TODO: handle OOM etc.");
|
.expect("TODO: handle OOM etc.");
|
||||||
|
|
||||||
|
if cfg!(target_os = "linux") && ::std::env::var_os("PERF_BUILDID_DIR").is_some() {
|
||||||
|
let mut map_file = ::std::fs::OpenOptions::new()
|
||||||
|
.create(true)
|
||||||
|
.append(true)
|
||||||
|
.open(format!("/tmp/perf-{}.map", ::std::process::id()))
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
writeln!(map_file, "{:x} {:x} {}", ptr as usize, code_size, name);
|
||||||
|
}
|
||||||
|
|
||||||
let mut reloc_sink = SimpleJITRelocSink::new();
|
let mut reloc_sink = SimpleJITRelocSink::new();
|
||||||
// Ignore traps for now. For now, frontends should just avoid generating code
|
// Ignore traps for now. For now, frontends should just avoid generating code
|
||||||
// that traps.
|
// that traps.
|
||||||
|
|||||||
Reference in New Issue
Block a user