Skip to content

Commit

Permalink
Fix some CI failures
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Nov 6, 2024
1 parent 6bf89b6 commit ecf99ca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 32 deletions.
2 changes: 1 addition & 1 deletion crates/c-api/include/wasmtime/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ WASMTIME_CONFIG_PROP(void, macos_use_mach_ports, bool)
* https://docs.wasmtime.dev/api/wasmtime/trait.LinearMemory.html
*/
typedef uint8_t *(*wasmtime_memory_get_callback_t)(void *env, size_t *byte_size,
size_t *maximum_byte_size);
size_t *byte_capacity);

/**
* Grow the memory to the `new_size` in bytes.
Expand Down
30 changes: 8 additions & 22 deletions crates/c-api/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,37 +322,23 @@ struct CHostLinearMemory {
unsafe impl LinearMemory for CHostLinearMemory {
fn byte_size(&self) -> usize {
let mut byte_size = 0;
let mut maximum_byte_size = 0;
let mut byte_capacity = 0;
let cb = self.get_memory;
cb(self.foreign.data, &mut byte_size, &mut maximum_byte_size);
cb(self.foreign.data, &mut byte_size, &mut byte_capacity);
return byte_size;
}
fn maximum_byte_size(&self) -> Option<usize> {
fn byte_capacity(&self) -> usize {
let mut byte_size = 0;
let mut maximum_byte_size = 0;
let mut byte_capacity = 0;
let cb = self.get_memory;
cb(self.foreign.data, &mut byte_size, &mut maximum_byte_size);
if maximum_byte_size == 0 {
None
} else {
Some(maximum_byte_size)
}
cb(self.foreign.data, &mut byte_size, &mut byte_capacity);
byte_capacity
}
fn as_ptr(&self) -> *mut u8 {
let mut byte_size = 0;
let mut maximum_byte_size = 0;
let cb = self.get_memory;
cb(self.foreign.data, &mut byte_size, &mut maximum_byte_size)
}
fn wasm_accessible(&self) -> Range<usize> {
let mut byte_size = 0;
let mut maximum_byte_size = 0;
let mut byte_capacity = 0;
let cb = self.get_memory;
let ptr = cb(self.foreign.data, &mut byte_size, &mut maximum_byte_size);
Range {
start: ptr as usize,
end: ptr as usize + byte_size,
}
cb(self.foreign.data, &mut byte_size, &mut byte_capacity)
}
fn grow_to(&mut self, new_size: usize) -> Result<()> {
let cb = self.grow_memory;
Expand Down
12 changes: 3 additions & 9 deletions crates/wasmtime/src/runtime/vm/threads/shared_memory_disabled.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#![allow(missing_docs)]

use crate::prelude::*;
use crate::runtime::vm::{RuntimeLinearMemory, VMMemoryDefinition, VMStore, WaitResult};
use crate::runtime::vm::memory::LocalMemory;
use crate::runtime::vm::{VMMemoryDefinition, VMStore, WaitResult};
use core::ops::Range;
use core::time::Duration;
use wasmtime_environ::{Trap, Tunables};
Expand All @@ -10,10 +11,7 @@ use wasmtime_environ::{Trap, Tunables};
pub enum SharedMemory {}

impl SharedMemory {
pub fn wrap(
_ty: &wasmtime_environ::Memory,
_memory: Box<dyn RuntimeLinearMemory>,
) -> Result<Self> {
pub fn wrap(_ty: &wasmtime_environ::Memory, _memory: LocalMemory) -> Result<Self> {
bail!("support for shared memories was disabled at compile time");
}

Expand Down Expand Up @@ -82,8 +80,4 @@ impl SharedMemory {
pub(crate) fn wasm_accessible(&self) -> Range<usize> {
match *self {}
}

fn memory_may_move(&self) -> bool {
match *self {}
}
}

0 comments on commit ecf99ca

Please sign in to comment.