Skip to content

Commit

Permalink
Merge #861
Browse files Browse the repository at this point in the history
861: [fix issue #679] add details when calling unimplemented! r=MarkMcCaskey a=pventuzelo

# Description

As discuss in issue #679, `unimplemented!` should provide a string to explain at least where the issue occurs. This pull request only add messages on existing `unimplemented!` and don't change any previous logics/behaviors in the code.

# Review

- [x] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Patrick Ventuzelo <[email protected]>
Co-authored-by: Mark McCaskey <[email protected]>
  • Loading branch information
3 people authored Oct 23, 2019
2 parents c2c0317 + 0fd0ab6 commit 9ccbe2d
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 50 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Blocks of changes will separated by version increments.

## **[Unreleased]**

- [#861](https://github.com/wasmerio/wasmer/pull/861) Add descriptions to `unimplemented!` macro in various places
- [#897](https://github.com/wasmerio/wasmer/pull/897) Removes special casing of stdin, stdout, and stderr in WASI. Closing these files now works. Removes `stdin`, `stdout`, and `stderr` from `WasiFS`, replaced by the methods `stdout`, `stdout_mut`, and so on.
- [#863](https://github.com/wasmerio/wasmer/pull/863) Fix min and max for cases involving NaN and negative zero when using the LLVM backend.

Expand Down
12 changes: 6 additions & 6 deletions lib/clif-backend/src/relocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl binemit::RelocSink for RelocSink {
_ebb_offset: binemit::CodeOffset,
) {
// This should use the `offsets` field of `ir::Function`.
unimplemented!();
unimplemented!("RelocSink::reloc_ebb");
}
fn reloc_external(
&mut self,
Expand Down Expand Up @@ -146,7 +146,7 @@ impl binemit::RelocSink for RelocSink {

DYNAMIC_MEM_GROW => VmCallKind::DynamicMemoryGrow,
DYNAMIC_MEM_SIZE => VmCallKind::DynamicMemorySize,
_ => unimplemented!(),
_ => unimplemented!("reloc_external VmCall::Local {}", index),
})),
IMPORT_NAMESPACE => RelocationType::VmCall(VmCall::Import(match index {
STATIC_MEM_GROW => VmCallKind::StaticMemoryGrow,
Expand All @@ -157,10 +157,10 @@ impl binemit::RelocSink for RelocSink {

DYNAMIC_MEM_GROW => VmCallKind::DynamicMemoryGrow,
DYNAMIC_MEM_SIZE => VmCallKind::DynamicMemorySize,
_ => unimplemented!(),
_ => unimplemented!("reloc_external VmCall::Import {}", index),
})),
SIG_NAMESPACE => RelocationType::Signature(SigIndex::new(index as usize)),
_ => unimplemented!(),
_ => unimplemented!("reloc_external SigIndex {}", index),
};
self.external_relocs.push(ExternalRelocation {
reloc,
Expand Down Expand Up @@ -204,7 +204,7 @@ impl binemit::RelocSink for RelocSink {
}

fn reloc_constant(&mut self, _: u32, _: cranelift_codegen::binemit::Reloc, _: u32) {
unimplemented!()
unimplemented!("RelocSink::reloc_constant")
}

fn reloc_jt(
Expand All @@ -213,7 +213,7 @@ impl binemit::RelocSink for RelocSink {
_reloc: binemit::Reloc,
_jt: ir::JumpTable,
) {
unimplemented!();
unimplemented!("RelocSink::reloc_jt");
}
}

Expand Down
5 changes: 4 additions & 1 deletion lib/clif-backend/src/signal/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ pub fn call_protected<T>(
},
Ok(SIGSEGV) | Ok(SIGBUS) => WasmTrapInfo::MemoryOutOfBounds,
Ok(SIGFPE) => WasmTrapInfo::IllegalArithmetic,
_ => unimplemented!(),
_ => unimplemented!(
"WasmTrapInfo::Unknown signal:{:?}",
Signal::from_c_int(signum)
),
}))
} else {
let signal = match Signal::from_c_int(signum) {
Expand Down
2 changes: 1 addition & 1 deletion lib/clif-backend/src/signal/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,5 @@ pub fn call_protected(

pub unsafe fn trigger_trap() -> ! {
// TODO
unimplemented!();
unimplemented!("windows::trigger_trap");
}
2 changes: 1 addition & 1 deletion lib/clif-backend/src/trampoline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl RelocSink for NullRelocSink {
fn reloc_external(&mut self, _: u32, _: Reloc, _: &ir::ExternalName, _: i64) {}

fn reloc_constant(&mut self, _: u32, _: Reloc, _: u32) {
unimplemented!()
unimplemented!("RelocSink::reloc_constant")
}

fn reloc_jt(&mut self, _: u32, _: Reloc, _: ir::JumpTable) {}
Expand Down
8 changes: 4 additions & 4 deletions lib/emscripten/src/exception.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ pub fn ___cxa_allocate_exception(ctx: &mut Ctx, size: u32) -> u32 {

pub fn ___cxa_current_primary_exception(_ctx: &mut Ctx) -> u32 {
debug!("emscripten::___cxa_current_primary_exception");
unimplemented!()
unimplemented!("emscripten::___cxa_current_primary_exception")
}

pub fn ___cxa_decrement_exception_refcount(_ctx: &mut Ctx, _a: u32) {
debug!("emscripten::___cxa_decrement_exception_refcount({})", _a);
unimplemented!()
unimplemented!("emscripten::___cxa_decrement_exception_refcount({})", _a)
}

pub fn ___cxa_increment_exception_refcount(_ctx: &mut Ctx, _a: u32) {
debug!("emscripten::___cxa_increment_exception_refcount({})", _a);
unimplemented!()
unimplemented!("emscripten::___cxa_increment_exception_refcount({})", _a)
}

pub fn ___cxa_rethrow_primary_exception(_ctx: &mut Ctx, _a: u32) {
debug!("emscripten::___cxa_rethrow_primary_exception({})", _a);
unimplemented!()
unimplemented!("emscripten::___cxa_rethrow_primary_exception({})", _a)
}

/// emscripten: ___cxa_throw
Expand Down
8 changes: 4 additions & 4 deletions lib/emscripten/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ use wasmer_runtime_core::vm::Ctx;
/// getprotobyname
pub fn getprotobyname(_ctx: &mut Ctx, _name_ptr: i32) -> i32 {
debug!("emscripten::getprotobyname");
unimplemented!()
unimplemented!("emscripten::getprotobyname")
}

/// getprotobynumber
pub fn getprotobynumber(_ctx: &mut Ctx, _one: i32) -> i32 {
debug!("emscripten::getprotobynumber");
unimplemented!()
unimplemented!("emscripten::getprotobynumber")
}

/// sigdelset
Expand Down Expand Up @@ -53,11 +53,11 @@ pub fn sigfillset(ctx: &mut Ctx, set: i32) -> i32 {
/// tzset
pub fn tzset(_ctx: &mut Ctx) {
debug!("emscripten::tzset - stub");
//unimplemented!()
//unimplemented!("emscripten::tzset - stub")
}

/// strptime
pub fn strptime(_ctx: &mut Ctx, _one: i32, _two: i32, _three: i32) -> i32 {
debug!("emscripten::strptime");
unimplemented!()
unimplemented!("emscripten::strptime")
}
4 changes: 2 additions & 2 deletions lib/emscripten/src/io/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ pub fn printf(_ctx: &mut Ctx, memory_offset: i32, extra: i32) -> i32 {
/// chroot
pub fn chroot(_ctx: &mut Ctx, _name_ptr: i32) -> i32 {
debug!("emscripten::chroot");
unimplemented!()
unimplemented!("emscripten::chroot")
}

/// getpwuid
pub fn getpwuid(_ctx: &mut Ctx, _uid: i32) -> i32 {
debug!("emscripten::getpwuid");
unimplemented!()
unimplemented!("emscripten::getpwuid")
}
4 changes: 2 additions & 2 deletions lib/emscripten/src/syscalls/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ pub fn ___syscall194(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_in
ftruncate64(_fd, _length)
}
#[cfg(target_os = "macos")]
unimplemented!()
unimplemented!("emscripten::___syscall194 (ftruncate64) {}", _which)
}

/// lchown
Expand Down Expand Up @@ -1111,6 +1111,6 @@ pub fn ___syscall324(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_in
}
#[cfg(target_os = "macos")]
{
unimplemented!()
unimplemented!("emscripten::___syscall324 (fallocate) {}", _which)
}
}
36 changes: 18 additions & 18 deletions lib/emscripten/src/syscalls/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ pub fn ___syscall5(ctx: &mut Ctx, which: c_int, mut varargs: VarArgs) -> c_int {
/// link
pub fn ___syscall9(_ctx: &mut Ctx, _which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall9 (link) {}", _which);
unimplemented!()
unimplemented!("emscripten::___syscall9 (link) {}", _which);
}

/// ftruncate64
pub fn ___syscall194(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall194 - stub");
unimplemented!()
unimplemented!("emscripten::___syscall194 - stub")
}

// chown
Expand All @@ -86,13 +86,13 @@ pub fn ___syscall212(_ctx: &mut Ctx, which: c_int, mut _varargs: VarArgs) -> c_i
/// access
pub fn ___syscall33(_ctx: &mut Ctx, _which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall33 (access) {}", _which);
unimplemented!()
unimplemented!("emscripten::___syscall33 (access) {}", _which);
}

/// nice
pub fn ___syscall34(_ctx: &mut Ctx, _which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall34 (nice) {}", _which);
unimplemented!()
unimplemented!("emscripten::___syscall34 (nice) {}", _which);
}

// mkdir
Expand All @@ -113,19 +113,19 @@ pub fn ___syscall39(ctx: &mut Ctx, which: c_int, mut varargs: VarArgs) -> c_int
/// dup
pub fn ___syscall41(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall41 (dup) {}", _which);
unimplemented!()
unimplemented!("emscripten::___syscall41 (dup) {}", _which);
}

/// getrusage
pub fn ___syscall77(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall77 (getrusage) {}", _which);
unimplemented!()
unimplemented!("emscripten::___syscall77 (getrusage) {}", _which);
}

/// symlink
pub fn ___syscall83(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall83 (symlink) {}", _which);
unimplemented!()
unimplemented!("emscripten::___syscall83 (symlink) {}", _which);
}

/// readlink
Expand All @@ -143,38 +143,38 @@ pub fn ___syscall132(_ctx: &mut Ctx, _which: c_int, mut _varargs: VarArgs) -> c_
/// lchown
pub fn ___syscall198(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall198 (lchown) {}", _which);
unimplemented!()
unimplemented!("emscripten::___syscall198 (lchown) {}", _which);
}

/// getgid32
pub fn ___syscall200(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall200 (getgid32)");
unimplemented!();
unimplemented!("emscripten::___syscall200 (getgid32)");
}

// geteuid32
pub fn ___syscall201(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall201 (geteuid32)");
unimplemented!();
unimplemented!("emscripten::___syscall201 (geteuid32)");
}

// getegid32
pub fn ___syscall202(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
// gid_t
debug!("emscripten::___syscall202 (getegid32)");
unimplemented!();
unimplemented!("emscripten::___syscall202 (getegid32)");
}

/// getgroups
pub fn ___syscall205(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall205 (getgroups) {}", _which);
unimplemented!()
unimplemented!("emscripten::___syscall205 (getgroups) {}", _which);
}

/// madvise
pub fn ___syscall219(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall212 (chown) {}", _which);
unimplemented!()
unimplemented!("emscripten::___syscall212 (chown) {}", _which);
}

/// dup3
Expand All @@ -194,7 +194,7 @@ pub fn ___syscall54(_ctx: &mut Ctx, which: c_int, mut _varargs: VarArgs) -> c_in
/// fchmod
pub fn ___syscall94(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall118 (fchmod) {}", _which);
unimplemented!()
unimplemented!("emscripten::___syscall118 (fchmod) {}", _which);
}

// socketcall
Expand All @@ -209,7 +209,7 @@ pub fn ___syscall102(_ctx: &mut Ctx, which: c_int, mut _varargs: VarArgs) -> c_i
/// fsync
pub fn ___syscall118(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall118 (fsync) {}", _which);
unimplemented!()
unimplemented!("emscripten::___syscall118 (fsync) {}", _which);
}

// pread
Expand Down Expand Up @@ -247,7 +247,7 @@ pub fn ___syscall142(_ctx: &mut Ctx, which: c_int, mut _varargs: VarArgs) -> c_i
/// fdatasync
pub fn ___syscall148(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall148 (fdatasync) {}", _which);
unimplemented!();
unimplemented!("emscripten::___syscall148 (fdatasync) {}", _which);
}

// setpgid
Expand Down Expand Up @@ -300,11 +300,11 @@ pub fn ___syscall221(_ctx: &mut Ctx, _which: c_int, mut _varargs: VarArgs) -> c_
/// fchown
pub fn ___syscall207(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall207 (fchown) {}", _which);
unimplemented!()
unimplemented!("emscripten::___syscall207 (fchown) {}", _which)
}

/// fallocate
pub fn ___syscall324(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall324 (fallocate) {}", _which);
unimplemented!()
unimplemented!("emscripten::___syscall324 (fallocate) {}", _which)
}
10 changes: 5 additions & 5 deletions lib/runtime-core/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ pub trait Instance {
type Error: Debug;
fn call(&mut self, id: usize, args: &[Value]) -> Result<u128, Self::Error>;
fn read_memory(&mut self, _offset: u32, _len: u32) -> Result<Vec<u8>, Self::Error> {
unimplemented!()
unimplemented!("Instance::read_memory")
}

fn write_memory(&mut self, _offset: u32, _len: u32, _buf: &[u8]) -> Result<(), Self::Error> {
unimplemented!()
unimplemented!("Instance::write_memory")
}
}

Expand Down Expand Up @@ -122,15 +122,15 @@ unsafe impl Sync for CodeMemory {}
#[cfg(not(unix))]
impl CodeMemory {
pub fn new(_size: usize) -> CodeMemory {
unimplemented!();
unimplemented!("CodeMemory::new");
}

pub fn make_executable(&self) {
unimplemented!();
unimplemented!("CodeMemory::make_executable");
}

pub fn make_writable(&self) {
unimplemented!();
unimplemented!("CodeMemory::make_writable");
}
}

Expand Down
6 changes: 3 additions & 3 deletions lib/runtime-core/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,15 +916,15 @@ mod vm_ctx_tests {
}

fn get_trampoline(&self, _module: &ModuleInfo, _sig_index: SigIndex) -> Option<Wasm> {
unimplemented!()
unimplemented!("generate_module::get_trampoline")
}
unsafe fn do_early_trap(&self, _: Box<dyn Any>) -> ! {
unimplemented!()
unimplemented!("generate_module::do_early_trap")
}
}
impl CacheGen for Placeholder {
fn generate_cache(&self) -> Result<(Box<[u8]>, Memory), CacheError> {
unimplemented!()
unimplemented!("generate_module::generate_cache")
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/runtime-core/src/vmcalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ pub unsafe extern "C" fn local_table_grow(
let _ = table_index;
let _ = delta;
let _ = ctx;
unimplemented!()
unimplemented!("vmcalls::local_table_grow")
}

pub unsafe extern "C" fn local_table_size(ctx: &vm::Ctx, table_index: LocalTableIndex) -> u32 {
let _ = table_index;
let _ = ctx;
unimplemented!()
unimplemented!("vmcalls::local_table_size")
}
2 changes: 1 addition & 1 deletion lib/wasi/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ impl WasiFs {
}
// TODO: verify this behavior
Kind::Dir { .. } => return Err(__WASI_EISDIR),
Kind::Symlink { .. } => unimplemented!(),
Kind::Symlink { .. } => unimplemented!("WasiFs::flush Kind::Symlink"),
Kind::Buffer { .. } => (),
_ => return Err(__WASI_EIO),
}
Expand Down

0 comments on commit 9ccbe2d

Please sign in to comment.