mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-14 06:35:40 +00:00
Merge pull request #44 from bjfish/fix-more-clippy-warnings
Fix more clippy warnings
This commit is contained in:
commit
f9629018c7
@ -1,4 +1,4 @@
|
|||||||
use libc::{abort, c_char, pid_t, c_int, fork, exit};
|
use libc::{abort, c_char, pid_t, c_int, exit};
|
||||||
|
|
||||||
use crate::webassembly::Instance;
|
use crate::webassembly::Instance;
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
|
@ -25,7 +25,7 @@ use libc::{
|
|||||||
getsockname,
|
getsockname,
|
||||||
getsockopt,
|
getsockopt,
|
||||||
gid_t,
|
gid_t,
|
||||||
iovec,
|
// iovec,
|
||||||
listen,
|
listen,
|
||||||
lseek,
|
lseek,
|
||||||
mkdir,
|
mkdir,
|
||||||
@ -36,7 +36,7 @@ use libc::{
|
|||||||
pread,
|
pread,
|
||||||
pwrite,
|
pwrite,
|
||||||
read,
|
read,
|
||||||
readv,
|
// readv,
|
||||||
recvfrom,
|
recvfrom,
|
||||||
recvmsg,
|
recvmsg,
|
||||||
sendmsg,
|
sendmsg,
|
||||||
@ -50,7 +50,7 @@ use libc::{
|
|||||||
uname,
|
uname,
|
||||||
utsname,
|
utsname,
|
||||||
write,
|
write,
|
||||||
writev,
|
// writev,
|
||||||
select,
|
select,
|
||||||
FIONBIO,
|
FIONBIO,
|
||||||
setpgid,
|
setpgid,
|
||||||
@ -58,7 +58,7 @@ use libc::{
|
|||||||
sa_family_t,
|
sa_family_t,
|
||||||
in_port_t,
|
in_port_t,
|
||||||
in_addr_t,
|
in_addr_t,
|
||||||
sockaddr_in,
|
// sockaddr_in,
|
||||||
FIOCLEX,
|
FIOCLEX,
|
||||||
SOL_SOCKET,
|
SOL_SOCKET,
|
||||||
TIOCGWINSZ,
|
TIOCGWINSZ,
|
||||||
@ -592,7 +592,7 @@ pub extern "C" fn ___syscall145(
|
|||||||
if curr < 0 {
|
if curr < 0 {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
ret = ret + curr;
|
ret += curr;
|
||||||
}
|
}
|
||||||
// debug!(" => ret: {}", ret);
|
// debug!(" => ret: {}", ret);
|
||||||
ret
|
ret
|
||||||
@ -628,7 +628,7 @@ pub extern "C" fn ___syscall146(
|
|||||||
if curr < 0 {
|
if curr < 0 {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
ret = ret + curr;
|
ret += curr;
|
||||||
}
|
}
|
||||||
// debug!(" => ret: {}", ret);
|
// debug!(" => ret: {}", ret);
|
||||||
ret
|
ret
|
||||||
|
@ -2,7 +2,7 @@ use byteorder::{ByteOrder, LittleEndian};
|
|||||||
use crate::webassembly::module::Module;
|
use crate::webassembly::module::Module;
|
||||||
use crate::webassembly::Instance;
|
use crate::webassembly::Instance;
|
||||||
use libc::stat;
|
use libc::stat;
|
||||||
use std::ffi::{CStr, CString};
|
use std::ffi::CStr;
|
||||||
use std::os::raw::c_char;
|
use std::os::raw::c_char;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
|
@ -61,12 +61,11 @@ fn get_function_addr(
|
|||||||
) -> *const u8 {
|
) -> *const u8 {
|
||||||
let index = func_index.index();
|
let index = func_index.index();
|
||||||
let len = import_functions.len();
|
let len = import_functions.len();
|
||||||
let func_pointer = if index < len {
|
if index < len {
|
||||||
import_functions[index]
|
import_functions[index]
|
||||||
} else {
|
} else {
|
||||||
(functions[index - len]).as_ptr()
|
(functions[index - len]).as_ptr()
|
||||||
};
|
}
|
||||||
func_pointer
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct EmscriptenData {
|
pub struct EmscriptenData {
|
||||||
@ -668,12 +667,10 @@ extern "C" fn grow_memory(size: u32, memory_index: u32, instance: &mut Instance)
|
|||||||
"non-default memory_index (0) not supported yet"
|
"non-default memory_index (0) not supported yet"
|
||||||
);
|
);
|
||||||
|
|
||||||
let old_mem_size = instance
|
instance
|
||||||
.memory_mut(memory_index as usize)
|
.memory_mut(memory_index as usize)
|
||||||
.grow(size)
|
.grow(size)
|
||||||
.unwrap_or(-1);
|
.unwrap_or(-1)
|
||||||
|
|
||||||
old_mem_size
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" fn current_memory(memory_index: u32, instance: &mut Instance) -> u32 {
|
extern "C" fn current_memory(memory_index: u32, instance: &mut Instance) -> u32 {
|
||||||
|
@ -389,15 +389,13 @@ impl<'environment> FuncEnvironmentTrait for FuncEnvironment<'environment> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Create table based on the data above
|
// Create table based on the data above
|
||||||
let table = func.create_table(ir::TableData {
|
func.create_table(ir::TableData {
|
||||||
base_gv,
|
base_gv,
|
||||||
min_size: Imm64::new(0),
|
min_size: Imm64::new(0),
|
||||||
bound_gv,
|
bound_gv,
|
||||||
element_size: Imm64::new(i64::from(self.pointer_bytes())),
|
element_size: Imm64::new(i64::from(self.pointer_bytes())),
|
||||||
index_type: I64,
|
index_type: I64,
|
||||||
});
|
})
|
||||||
|
|
||||||
table
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: offsets should be based on the architecture the wasmer was compiled for.
|
// TODO: offsets should be based on the architecture the wasmer was compiled for.
|
||||||
@ -432,7 +430,7 @@ impl<'environment> FuncEnvironmentTrait for FuncEnvironment<'environment> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Create table based on the data above
|
// Create table based on the data above
|
||||||
let heap = func.create_heap(ir::HeapData {
|
func.create_heap(ir::HeapData {
|
||||||
base: heap_base,
|
base: heap_base,
|
||||||
min_size: 0.into(),
|
min_size: 0.into(),
|
||||||
guard_size: (LinearMemory::DEFAULT_GUARD_SIZE as i64).into(),
|
guard_size: (LinearMemory::DEFAULT_GUARD_SIZE as i64).into(),
|
||||||
@ -440,9 +438,7 @@ impl<'environment> FuncEnvironmentTrait for FuncEnvironment<'environment> {
|
|||||||
bound: (LinearMemory::DEFAULT_HEAP_SIZE as i64).into(),
|
bound: (LinearMemory::DEFAULT_HEAP_SIZE as i64).into(),
|
||||||
},
|
},
|
||||||
index_type: I32,
|
index_type: I32,
|
||||||
});
|
})
|
||||||
|
|
||||||
heap
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_global(
|
fn make_global(
|
||||||
@ -518,8 +514,8 @@ impl<'environment> FuncEnvironmentTrait for FuncEnvironment<'environment> {
|
|||||||
// pos.ins().imul_imm(callee, 4)
|
// pos.ins().imul_imm(callee, 4)
|
||||||
callee
|
callee
|
||||||
} else {
|
} else {
|
||||||
let ext = pos.ins().uextend(ptr, callee);
|
pos.ins().uextend(ptr, callee)
|
||||||
ext
|
// let ext = pos.ins().uextend(ptr, callee);
|
||||||
// pos.ins().imul_imm(ext, 4)
|
// pos.ins().imul_imm(ext, 4)
|
||||||
};
|
};
|
||||||
// let entry_size = native_pointer_size() as i64 * 2;
|
// let entry_size = native_pointer_size() as i64 * 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user