Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wasix major fixes and tweaks #3584

Merged
merged 13 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 79 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion lib/api/src/sys/mem_access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ impl<'a, T: ValueType> WasmSlice<'a, T> {

/// Reads this `WasmSlice` into a `slice`.
#[inline]
pub fn copy_to_slice(self, buf: &mut [MaybeUninit<u8>]) -> Result<usize, MemoryAccessError> {
pub fn copy_to_slice<'b>(
self,
buf: &'b mut [MaybeUninit<u8>],
) -> Result<usize, MemoryAccessError> {
let len = self.len.try_into().expect("WasmSlice length overflow");
self.buffer.read_uninit(self.offset, buf)?;
Ok(len)
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler-llvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ rayon = "1.5"

[dependencies.inkwell]
package = "inkwell"
version = "=0.1.0-beta.4"
version = "0.1.1"
default-features = false
features = ["llvm12-0", "target-x86", "target-aarch64"]

Expand Down
2 changes: 1 addition & 1 deletion lib/compiler-llvm/src/abi/aarch64_systemv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl Abi for Aarch64SystemV {
.collect::<Result<_, _>>()?;

let sret = context.struct_type(&basic_types, false);
let sret_ptr = sret.ptr_type(AddressSpace::Generic);
let sret_ptr = sret.ptr_type(AddressSpace::default());

let param_types =
std::iter::once(Ok(sret_ptr.as_basic_type_enum())).chain(param_types);
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler-llvm/src/abi/x86_64_systemv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ impl Abi for X86_64SystemV {
.collect::<Result<_, _>>()?;

let sret = context.struct_type(&basic_types, false);
let sret_ptr = sret.ptr_type(AddressSpace::Generic);
let sret_ptr = sret.ptr_type(AddressSpace::default());

let param_types =
std::iter::once(Ok(sret_ptr.as_basic_type_enum())).chain(param_types);
Expand Down
16 changes: 8 additions & 8 deletions lib/compiler-llvm/src/trampoline/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ impl FuncTrampoline {
.func_type_to_llvm(&self.ctx, &intrinsics, None, ty)?;
let trampoline_ty = intrinsics.void_ty.fn_type(
&[
intrinsics.ctx_ptr_ty.into(), // vmctx ptr
callee_ty.ptr_type(AddressSpace::Generic).into(), // callee function address
intrinsics.i128_ptr_ty.into(), // in/out values ptr
intrinsics.ctx_ptr_ty.into(), // vmctx ptr
callee_ty.ptr_type(AddressSpace::default()).into(), // callee function address
intrinsics.i128_ptr_ty.into(), // in/out values ptr
],
false,
);

let trampoline_func = module.add_function(name, trampoline_ty, Some(Linkage::External));
trampoline_func
.as_global_value()
.set_section(FUNCTION_SECTION);
.set_section(Some(FUNCTION_SECTION));
trampoline_func
.as_global_value()
.set_linkage(Linkage::DLLExport);
Expand Down Expand Up @@ -189,7 +189,7 @@ impl FuncTrampoline {
}
trampoline_func
.as_global_value()
.set_section(FUNCTION_SECTION);
.set_section(Some(FUNCTION_SECTION));
trampoline_func
.as_global_value()
.set_linkage(Linkage::DLLExport);
Expand Down Expand Up @@ -359,7 +359,7 @@ impl FuncTrampoline {
)
};
let ptr =
builder.build_pointer_cast(ptr, v.get_type().ptr_type(AddressSpace::Generic), "");
builder.build_pointer_cast(ptr, v.get_type().ptr_type(AddressSpace::default()), "");
builder.build_store(ptr, *v);
if v.get_type() == intrinsics.i128_ty.as_basic_type_enum() {
idx += 1;
Expand Down Expand Up @@ -424,12 +424,12 @@ impl FuncTrampoline {
],
false,
)
.ptr_type(AddressSpace::Generic);
.ptr_type(AddressSpace::default());
let vmctx = self.abi.get_vmctx_ptr_param(&trampoline_func);
let callee = builder
.build_load(
builder
.build_bitcast(vmctx, callee_ty.ptr_type(AddressSpace::Generic), "")
.build_bitcast(vmctx, callee_ty.ptr_type(AddressSpace::default()), "")
.into_pointer_value(),
"",
)
Expand Down
6 changes: 3 additions & 3 deletions lib/compiler-llvm/src/translator/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl FuncTranslator {

func.add_attribute(AttributeLoc::Function, intrinsics.stack_probe);
func.set_personality_function(intrinsics.personality);
func.as_global_value().set_section(FUNCTION_SECTION);
func.as_global_value().set_section(Some(FUNCTION_SECTION));
func.set_linkage(Linkage::DLLExport);
func.as_global_value()
.set_dll_storage_class(DLLStorageClass::Export);
Expand Down Expand Up @@ -2334,7 +2334,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
// element type.
let casted_table_base = self.builder.build_pointer_cast(
table_base,
self.intrinsics.funcref_ty.ptr_type(AddressSpace::Generic),
self.intrinsics.funcref_ty.ptr_type(AddressSpace::default()),
"casted_table_base",
);

Expand Down Expand Up @@ -2503,7 +2503,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {

let typed_func_ptr = self.builder.build_pointer_cast(
func_ptr,
llvm_func_type.ptr_type(AddressSpace::Generic),
llvm_func_type.ptr_type(AddressSpace::default()),
"typed_func_ptr",
);

Expand Down
Loading