mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 14:25:32 +00:00
Removed unused code
This commit is contained in:
parent
38f045da3c
commit
e59b95d95e
@ -1,6 +1,6 @@
|
|||||||
use super::super::host;
|
use super::super::host;
|
||||||
/// NOTE: These syscalls only support wasm_32 for now because they take u32 offset
|
/// NOTE: These syscalls only support wasm_32 for now because they take u32 offset
|
||||||
use libc::{c_int, c_void, close, exit, open, read, size_t, ssize_t};
|
use libc::{c_int};
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::os::raw::c_char;
|
use std::os::raw::c_char;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ pub extern "C" fn get_total_memory(instance: &mut Instance) -> u32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// emscripten: enlargeMemory
|
/// emscripten: enlargeMemory
|
||||||
pub extern "C" fn enlarge_memory(instance: &mut Instance) {
|
pub extern "C" fn enlarge_memory(_instance: &mut Instance) {
|
||||||
debug!("emscripten::enlarge_memory");
|
debug!("emscripten::enlarge_memory");
|
||||||
// instance.memories[0].grow(100);
|
// instance.memories[0].grow(100);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ mod utils;
|
|||||||
|
|
||||||
// SYSCALLS
|
// SYSCALLS
|
||||||
pub use self::utils::is_emscripten_module;
|
pub use self::utils::is_emscripten_module;
|
||||||
use super::host;
|
|
||||||
|
|
||||||
pub fn generate_emscripten_env<'a, 'b>() -> ImportObject<&'a str, &'b str> {
|
pub fn generate_emscripten_env<'a, 'b>() -> ImportObject<&'a str, &'b str> {
|
||||||
let mut import_object = ImportObject::new();
|
let mut import_object = ImportObject::new();
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
/// NOTE: These syscalls only support wasm_32 for now because they take u32 offset
|
/// NOTE: These syscalls only support wasm_32 for now because they take u32 offset
|
||||||
/// Syscall list: https://www.cs.utexas.edu/~bismith/test/syscalls/syscalls32.html
|
/// Syscall list: https://www.cs.utexas.edu/~bismith/test/syscalls/syscalls32.html
|
||||||
use libc::{c_int, c_void, close, exit, open, read, size_t, ssize_t, write};
|
use libc::{c_int, c_void, ssize_t, write};
|
||||||
use std::{mem, ptr};
|
|
||||||
|
|
||||||
use std::ffi::CStr;
|
|
||||||
use std::os::raw::c_char;
|
|
||||||
|
|
||||||
use crate::webassembly::Instance;
|
use crate::webassembly::Instance;
|
||||||
|
|
||||||
@ -12,22 +8,22 @@ use crate::webassembly::Instance;
|
|||||||
macro_rules! vararg {
|
macro_rules! vararg {
|
||||||
($name:ident, $type:ident, $instance:ident, $varargs:ident) => (
|
($name:ident, $type:ident, $instance:ident, $varargs:ident) => (
|
||||||
let ($name, $varargs) = unsafe {
|
let ($name, $varargs) = unsafe {
|
||||||
|
use std::ptr;
|
||||||
let ptr = $instance.memory_offset_addr(0, $varargs as usize);
|
let ptr = $instance.memory_offset_addr(0, $varargs as usize);
|
||||||
let ret = ptr::read(ptr as *const $type);
|
let ret = ptr::read(ptr as *const $type);
|
||||||
(ret, $varargs + 4)
|
(ret, $varargs + 4)
|
||||||
}
|
};
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// sys_read
|
/// sys_read
|
||||||
pub extern "C" fn ___syscall3(which: c_int, varargs: c_int, instance: &mut Instance) -> ssize_t {
|
pub extern "C" fn ___syscall3(_which: c_int, _varargs: c_int, _instance: &mut Instance) -> ssize_t {
|
||||||
debug!("emscripten::___syscall3");
|
debug!("emscripten::___syscall3");
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
/// sys_write
|
/// sys_write
|
||||||
#[no_mangle]
|
pub extern "C" fn ___syscall4(_which: c_int, varargs: c_int, instance: &mut Instance) -> c_int {
|
||||||
pub extern "C" fn ___syscall4(which: c_int, varargs: c_int, instance: &mut Instance) -> c_int {
|
|
||||||
debug!("emscripten::___syscall4");
|
debug!("emscripten::___syscall4");
|
||||||
vararg!(fd, i32, instance, varargs);
|
vararg!(fd, i32, instance, varargs);
|
||||||
vararg!(buf_ptr, u32, instance, varargs);
|
vararg!(buf_ptr, u32, instance, varargs);
|
||||||
@ -38,7 +34,7 @@ pub extern "C" fn ___syscall4(which: c_int, varargs: c_int, instance: &mut Insta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// sys_open
|
/// sys_open
|
||||||
pub extern "C" fn ___syscall5(which: c_int, varargs: c_int, instance: &mut Instance) -> c_int {
|
pub extern "C" fn ___syscall5(_which: c_int, varargs: c_int, instance: &mut Instance) -> c_int {
|
||||||
debug!("emscripten::___syscall5");
|
debug!("emscripten::___syscall5");
|
||||||
vararg!(pathname, u32, instance, varargs);
|
vararg!(pathname, u32, instance, varargs);
|
||||||
vararg!(flags, u32, instance, varargs);
|
vararg!(flags, u32, instance, varargs);
|
||||||
@ -48,8 +44,7 @@ pub extern "C" fn ___syscall5(which: c_int, varargs: c_int, instance: &mut Insta
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sys_ioctl
|
// sys_ioctl
|
||||||
#[no_mangle]
|
pub extern "C" fn ___syscall54(_which: c_int, varargs: c_int, instance: &mut Instance) -> c_int {
|
||||||
pub extern "C" fn ___syscall54(which: c_int, varargs: c_int, instance: &mut Instance) -> c_int {
|
|
||||||
debug!("emscripten::___syscall54");
|
debug!("emscripten::___syscall54");
|
||||||
vararg!(stream, u32, instance, varargs);
|
vararg!(stream, u32, instance, varargs);
|
||||||
vararg!(op, u32, instance, varargs);
|
vararg!(op, u32, instance, varargs);
|
||||||
@ -58,8 +53,7 @@ pub extern "C" fn ___syscall54(which: c_int, varargs: c_int, instance: &mut Inst
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sys_newuname
|
// sys_newuname
|
||||||
#[no_mangle]
|
pub extern "C" fn ___syscall122(_which: c_int, varargs: c_int, instance: &mut Instance) -> c_int {
|
||||||
pub extern "C" fn ___syscall122(which: c_int, varargs: c_int, instance: &mut Instance) -> c_int {
|
|
||||||
debug!("emscripten::___syscall122");
|
debug!("emscripten::___syscall122");
|
||||||
vararg!(buf, u32, instance, varargs);
|
vararg!(buf, u32, instance, varargs);
|
||||||
debug!("buf: {}", buf);
|
debug!("buf: {}", buf);
|
||||||
|
@ -2,7 +2,7 @@ use crate::webassembly::module::Module;
|
|||||||
|
|
||||||
/// We check if a provided module is an Emscripten generated one
|
/// We check if a provided module is an Emscripten generated one
|
||||||
pub fn is_emscripten_module(module: &Module) -> bool {
|
pub fn is_emscripten_module(module: &Module) -> bool {
|
||||||
for (module, field) in &module.info.imported_funcs {
|
for (module, _field) in &module.info.imported_funcs {
|
||||||
if module == "env" {
|
if module == "env" {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
0
src/apis/gcc/.gitignore
vendored
0
src/apis/gcc/.gitignore
vendored
@ -1,12 +1,7 @@
|
|||||||
/// NOTE: These syscalls only support wasm_32 for now because they take u32 offset
|
|
||||||
use libc::{c_int, c_void, close, exit, open, read, size_t, ssize_t};
|
|
||||||
use std::ffi::CStr;
|
|
||||||
use std::os::raw::c_char;
|
|
||||||
|
|
||||||
use crate::webassembly::Instance;
|
use crate::webassembly::Instance;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
pub extern "C" fn get_env(name: &str, instance: &mut Instance) -> Result<String, env::VarError> {
|
pub extern "C" fn get_env(name: &str, _instance: &mut Instance) -> Result<String, env::VarError> {
|
||||||
debug!("host::get_env({:?})", name);
|
debug!("host::get_env({:?})", name);
|
||||||
env::var(name)
|
env::var(name)
|
||||||
}
|
}
|
||||||
|
0
src/apis/llvm/.gitignore
vendored
0
src/apis/llvm/.gitignore
vendored
@ -7,7 +7,6 @@ pub mod module;
|
|||||||
pub mod relocation;
|
pub mod relocation;
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
use cranelift_codegen::isa::TargetIsa;
|
|
||||||
use cranelift_codegen::{isa, settings};
|
use cranelift_codegen::{isa, settings};
|
||||||
use std::panic;
|
use std::panic;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
@ -43,10 +43,10 @@ pub fn native_pointer_size() -> i32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Convert a TlsData offset into a `Offset32` for a global decl.
|
/// Convert a TlsData offset into a `Offset32` for a global decl.
|
||||||
fn offset32(offset: usize) -> ir::immediates::Offset32 {
|
// fn offset32(offset: usize) -> ir::immediates::Offset32 {
|
||||||
assert!(offset <= i32::max_value() as usize);
|
// assert!(offset <= i32::max_value() as usize);
|
||||||
(offset as i32).into()
|
// (offset as i32).into()
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// Convert a usize offset into a `Imm64` for an iadd_imm.
|
/// Convert a usize offset into a `Imm64` for an iadd_imm.
|
||||||
fn imm64(offset: usize) -> ir::immediates::Imm64 {
|
fn imm64(offset: usize) -> ir::immediates::Imm64 {
|
||||||
|
Loading…
Reference in New Issue
Block a user