Format everything

This commit is contained in:
losfair
2019-08-21 15:23:56 -07:00
parent 53ebcc355a
commit 56e735349d
8 changed files with 93 additions and 96 deletions

View File

@ -21,10 +21,7 @@ void unwinding_setjmp(jmp_buf stack_out, void (*func)(void *), void *userdata) {
} }
} }
[[noreturn]] [[noreturn]] void unwinding_longjmp(jmp_buf stack_in) { longjmp(stack_in, 42); }
void unwinding_longjmp(jmp_buf stack_in) {
longjmp(stack_in, 42);
}
struct UnwindPoint { struct UnwindPoint {
UnwindPoint *prev; UnwindPoint *prev;
@ -78,8 +75,7 @@ uint8_t *MemoryManager::allocateDataSection(uintptr_t size, unsigned alignment,
if (read_only) { if (read_only) {
ret = allocate_bump(read_section, read_bump_ptr, size, alignment); ret = allocate_bump(read_section, read_bump_ptr, size, alignment);
} else { } else {
ret = ret = allocate_bump(readwrite_section, readwrite_bump_ptr, size, alignment);
allocate_bump(readwrite_section, readwrite_bump_ptr, size, alignment);
} }
if (section_name.equals(llvm::StringRef("__llvm_stackmaps")) || if (section_name.equals(llvm::StringRef("__llvm_stackmaps")) ||
section_name.equals(llvm::StringRef(".llvm_stackmaps"))) { section_name.equals(llvm::StringRef(".llvm_stackmaps"))) {
@ -89,7 +85,8 @@ uint8_t *MemoryManager::allocateDataSection(uintptr_t size, unsigned alignment,
return ret; return ret;
} }
void MemoryManager::reserveAllocationSpace(uintptr_t code_size, uint32_t code_align, void MemoryManager::reserveAllocationSpace(uintptr_t code_size,
uint32_t code_align,
uintptr_t read_data_size, uintptr_t read_data_size,
uint32_t read_data_align, uint32_t read_data_align,
uintptr_t read_write_data_size, uintptr_t read_write_data_size,
@ -113,9 +110,9 @@ void MemoryManager::reserveAllocationSpace(uintptr_t code_size, uint32_t code_al
uint8_t *read_ptr_out = nullptr; uint8_t *read_ptr_out = nullptr;
size_t read_size_out = 0; size_t read_size_out = 0;
auto read_result = callbacks.alloc_memory(aligner(read_data_size, 4096), auto read_result =
PROTECT_READ_WRITE, &read_ptr_out, callbacks.alloc_memory(aligner(read_data_size, 4096), PROTECT_READ_WRITE,
&read_size_out); &read_ptr_out, &read_size_out);
assert(read_result == RESULT_OK); assert(read_result == RESULT_OK);
read_section = Section{read_ptr_out, read_size_out}; read_section = Section{read_ptr_out, read_size_out};
read_bump_ptr = (uintptr_t)read_ptr_out; read_bump_ptr = (uintptr_t)read_ptr_out;
@ -176,8 +173,8 @@ bool MemoryManager::finalizeMemory(std::string *ErrMsg) {
void MemoryManager::notifyObjectLoaded(llvm::RuntimeDyld &RTDyld, void MemoryManager::notifyObjectLoaded(llvm::RuntimeDyld &RTDyld,
const llvm::object::ObjectFile &Obj) {} const llvm::object::ObjectFile &Obj) {}
uint8_t *MemoryManager::allocate_bump(Section &section, uintptr_t &bump_ptr, size_t size, uint8_t *MemoryManager::allocate_bump(Section &section, uintptr_t &bump_ptr,
size_t align) { size_t size, size_t align) {
auto aligner = [](uintptr_t &ptr, size_t align) { auto aligner = [](uintptr_t &ptr, size_t align) {
ptr = (ptr + align - 1) & ~(align - 1); ptr = (ptr + align - 1) & ~(align - 1);
}; };

View File

@ -3,10 +3,10 @@
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include <exception> #include <exception>
#include <iostream>
#include <sstream>
#include <setjmp.h>
#include <functional> #include <functional>
#include <iostream>
#include <setjmp.h>
#include <sstream>
#include <llvm/ExecutionEngine/RuntimeDyld.h> #include <llvm/ExecutionEngine/RuntimeDyld.h>
@ -239,7 +239,9 @@ result_t module_load(const uint8_t *mem_ptr, size_t mem_size,
return RESULT_OK; return RESULT_OK;
} }
[[noreturn]] void throw_trap(WasmTrap::Type ty) { unsafe_unwind(new WasmTrap(ty)); } [[noreturn]] void throw_trap(WasmTrap::Type ty) {
unsafe_unwind(new WasmTrap(ty));
}
void module_delete(WasmModule *module) { delete module; } void module_delete(WasmModule *module) { delete module; }

View File

@ -331,7 +331,7 @@ impl LLVMBackend {
local_func_id_to_offset, local_func_id_to_offset,
}, },
LLVMCache { buffer }, LLVMCache { buffer },
) );
} }
} }

View File

@ -4,7 +4,9 @@ use libc::{
c_void, mmap, mprotect, munmap, siginfo_t, MAP_ANON, MAP_PRIVATE, PROT_EXEC, PROT_NONE, c_void, mmap, mprotect, munmap, siginfo_t, MAP_ANON, MAP_PRIVATE, PROT_EXEC, PROT_NONE,
PROT_READ, PROT_WRITE, PROT_READ, PROT_WRITE,
}; };
use nix::sys::signal::{sigaction, SaFlags, SigAction, SigHandler, SigSet, SIGBUS, SIGSEGV, SIGILL}; use nix::sys::signal::{
sigaction, SaFlags, SigAction, SigHandler, SigSet, SIGBUS, SIGILL, SIGSEGV,
};
use std::ptr; use std::ptr;
/// `__register_frame` and `__deregister_frame` on macos take a single fde as an /// `__register_frame` and `__deregister_frame` on macos take a single fde as an

View File

@ -232,10 +232,8 @@ impl StackmapEntry {
if loc.offset_or_small_constant >= 0 { if loc.offset_or_small_constant >= 0 {
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
(loc.offset_or_small_constant as usize - 16) / 8, .insert((loc.offset_or_small_constant as usize - 16) / 8, Some(mv));
Some(mv),
);
} else { } else {
let stack_offset = ((-loc.offset_or_small_constant) / 4) as usize; let stack_offset = ((-loc.offset_or_small_constant) / 4) as usize;
assert!( assert!(

View File

@ -726,10 +726,7 @@ pub mod x64 {
assert_eq!(vmctx.internal.memory_bound, memory.len()); assert_eq!(vmctx.internal.memory_bound, memory.len());
} }
std::slice::from_raw_parts_mut( std::slice::from_raw_parts_mut(vmctx.internal.memory_base, vmctx.internal.memory_bound)
vmctx.internal.memory_base,
vmctx.internal.memory_bound,
)
.copy_from_slice(memory); .copy_from_slice(memory);
} }

View File

@ -210,8 +210,7 @@ pub unsafe fn run_tiering<F: Fn(InteractiveShellContext) -> ShellExitOperation>(
if let Err(e) = ret { if let Err(e) = ret {
if let Ok(new_image) = e.downcast::<InstanceImage>() { if let Ok(new_image) = e.downcast::<InstanceImage>() {
// Tier switch event // Tier switch event
if !was_sigint_triggered_fault() && opt_state.outcome.lock().unwrap().is_some() if !was_sigint_triggered_fault() && opt_state.outcome.lock().unwrap().is_some() {
{
resume_image = Some(*new_image); resume_image = Some(*new_image);
continue; continue;
} }

View File

@ -587,7 +587,8 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
let start_raw: extern "C" fn(&mut wasmer_runtime_core::vm::Ctx) = let start_raw: extern "C" fn(&mut wasmer_runtime_core::vm::Ctx) =
unsafe { ::std::mem::transmute(start.get_vm_func()) }; unsafe { ::std::mem::transmute(start.get_vm_func()) };
unsafe { run_tiering( unsafe {
run_tiering(
module.info(), module.info(),
&wasm_binary, &wasm_binary,
if let Some(ref path) = options.resume { if let Some(ref path) = options.resume {
@ -612,7 +613,8 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
}) })
.collect(), .collect(),
interactive_shell, interactive_shell,
)? }; )?
};
} }
#[cfg(not(feature = "managed"))] #[cfg(not(feature = "managed"))]