Disable LLVM stackmap on Windows

This commit is contained in:
losfair
2019-08-21 15:23:11 -07:00
parent 6d7a91a271
commit 53ebcc355a
2 changed files with 116 additions and 112 deletions

View File

@ -226,6 +226,8 @@ impl LLVMBackend {
let buffer = Arc::new(Buffer::LlvmMemory(memory_buffer)); let buffer = Arc::new(Buffer::LlvmMemory(memory_buffer));
#[cfg(all(any(target_os = "linux", target_os = "macos"), target_arch = "x86_64"))]
{
let raw_stackmap = unsafe { let raw_stackmap = unsafe {
std::slice::from_raw_parts( std::slice::from_raw_parts(
llvm_backend_get_stack_map_ptr(module), llvm_backend_get_stack_map_ptr(module),
@ -321,7 +323,7 @@ impl LLVMBackend {
}) })
.collect(); .collect();
( return (
Self { Self {
module, module,
buffer: Arc::clone(&buffer), buffer: Arc::clone(&buffer),
@ -330,8 +332,10 @@ impl LLVMBackend {
}, },
LLVMCache { buffer }, LLVMCache { buffer },
) )
} else { }
// This module contains no functions so no stackmaps. }
// Stackmap is not supported on this platform, or this module contains no functions so no stackmaps.
( (
Self { Self {
module, module,
@ -342,7 +346,6 @@ impl LLVMBackend {
LLVMCache { buffer }, LLVMCache { buffer },
) )
} }
}
pub unsafe fn from_buffer(memory: Memory) -> Result<(Self, LLVMCache), String> { pub unsafe fn from_buffer(memory: Memory) -> Result<(Self, LLVMCache), String> {
let callbacks = get_callbacks(); let callbacks = get_callbacks();

View File

@ -3,11 +3,6 @@
use byteorder::{LittleEndian, ReadBytesExt}; use byteorder::{LittleEndian, ReadBytesExt};
use std::collections::{BTreeMap, HashMap}; use std::collections::{BTreeMap, HashMap};
use std::io::{self, Cursor}; use std::io::{self, Cursor};
use wasmer_runtime_core::state::{
x64::{new_machine_state, X64Register, GPR},
FunctionStateMap, MachineStateDiff, MachineValue, ModuleStateMap, OffsetInfo, RegisterIndex,
SuspendOffset, WasmAbstractValue,
};
use wasmer_runtime_core::vm::Ctx; use wasmer_runtime_core::vm::Ctx;
use wasmer_runtime_core::{ use wasmer_runtime_core::{
module::ModuleInfo, module::ModuleInfo,
@ -87,6 +82,7 @@ pub struct MachineStateDiff {
*/ */
impl StackmapEntry { impl StackmapEntry {
#[cfg(all(any(target_os = "linux", target_os = "macos"), target_arch = "x86_64"))]
pub fn populate_msm( pub fn populate_msm(
&self, &self,
module_info: &ModuleInfo, module_info: &ModuleInfo,
@ -95,8 +91,13 @@ impl StackmapEntry {
size_record: &StkSizeRecord, size_record: &StkSizeRecord,
map_record: &StkMapRecord, map_record: &StkMapRecord,
end: Option<(&StackmapEntry, &StkMapRecord)>, end: Option<(&StackmapEntry, &StkMapRecord)>,
msm: &mut ModuleStateMap, msm: &mut wasmer_runtime_core::state::ModuleStateMap,
) { ) {
use wasmer_runtime_core::state::{
x64::{new_machine_state, X64Register, GPR},
FunctionStateMap, MachineStateDiff, MachineValue, OffsetInfo, RegisterIndex,
SuspendOffset, WasmAbstractValue,
};
let func_base_addr = (size_record.function_address as usize) let func_base_addr = (size_record.function_address as usize)
.checked_sub(code_addr) .checked_sub(code_addr)
.unwrap(); .unwrap();
@ -232,7 +233,7 @@ impl StackmapEntry {
assert!(loc.offset_or_small_constant >= 16); // (saved_rbp, return_address) assert!(loc.offset_or_small_constant >= 16); // (saved_rbp, return_address)
assert!(loc.offset_or_small_constant % 8 == 0); assert!(loc.offset_or_small_constant % 8 == 0);
prev_frame_diff.insert( prev_frame_diff.insert(
((loc.offset_or_small_constant as usize - 16) / 8), (loc.offset_or_small_constant as usize - 16) / 8,
Some(mv), Some(mv),
); );
} else { } else {