mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-29 08:31:32 +00:00
Make wasmer work with stable Rust
This commit is contained in:
@ -52,7 +52,7 @@ fn get_function_addr(
|
||||
let func_pointer = if index < len {
|
||||
import_functions[index]
|
||||
} else {
|
||||
(&functions[func_index.index() - len]).as_ptr()
|
||||
(functions[index - len]).as_ptr()
|
||||
};
|
||||
func_pointer
|
||||
}
|
||||
@ -432,7 +432,7 @@ impl Instance {
|
||||
.info
|
||||
.start_func
|
||||
.or_else(|| match module.info.exports.get("main") {
|
||||
Some(Export::Function(index)) => Some(index.to_owned()),
|
||||
Some(Export::Function(index)) => Some(*index),
|
||||
_ => None,
|
||||
});
|
||||
|
||||
@ -627,40 +627,56 @@ extern "C" fn current_memory(memory_index: u32, instance: &mut Instance) -> u32
|
||||
// Because of this bug https://github.com/rust-lang/rust/issues/34123
|
||||
// We create internal functions for it
|
||||
|
||||
use std::intrinsics::{
|
||||
ceilf32, ceilf64, floorf32, floorf64, nearbyintf32, nearbyintf64, truncf32, truncf64,
|
||||
};
|
||||
// use std::intrinsics::{
|
||||
// ceilf32, ceilf64, floorf32, floorf64, nearbyintf32, nearbyintf64, truncf32, truncf64,
|
||||
// };
|
||||
|
||||
// F32
|
||||
unsafe extern "C" fn _ceilf32(x: f32) -> f32 {
|
||||
ceilf32(x)
|
||||
#[inline]
|
||||
extern "C" fn _ceilf32(x: f32) -> f32 {
|
||||
// ceilf32(x)
|
||||
x.ceil()
|
||||
}
|
||||
|
||||
unsafe extern "C" fn _floorf32(x: f32) -> f32 {
|
||||
floorf32(x)
|
||||
#[inline]
|
||||
extern "C" fn _floorf32(x: f32) -> f32 {
|
||||
// floorf32(x)
|
||||
x.floor()
|
||||
}
|
||||
|
||||
unsafe extern "C" fn _truncf32(x: f32) -> f32 {
|
||||
truncf32(x)
|
||||
#[inline]
|
||||
extern "C" fn _truncf32(x: f32) -> f32 {
|
||||
// truncf32(x)
|
||||
x.trunc()
|
||||
}
|
||||
|
||||
unsafe extern "C" fn _nearbyintf32(x: f32) -> f32 {
|
||||
nearbyintf32(x)
|
||||
#[inline]
|
||||
extern "C" fn _nearbyintf32(x: f32) -> f32 {
|
||||
// nearbyintf32(x)
|
||||
x.round()
|
||||
}
|
||||
|
||||
// F64
|
||||
unsafe extern "C" fn _ceilf64(x: f64) -> f64 {
|
||||
ceilf64(x)
|
||||
#[inline]
|
||||
extern "C" fn _ceilf64(x: f64) -> f64 {
|
||||
// ceilf64(x)
|
||||
x.ceil()
|
||||
}
|
||||
|
||||
unsafe extern "C" fn _floorf64(x: f64) -> f64 {
|
||||
floorf64(x)
|
||||
#[inline]
|
||||
extern "C" fn _floorf64(x: f64) -> f64 {
|
||||
// floorf64(x)
|
||||
x.floor()
|
||||
}
|
||||
|
||||
unsafe extern "C" fn _truncf64(x: f64) -> f64 {
|
||||
truncf64(x)
|
||||
#[inline]
|
||||
extern "C" fn _truncf64(x: f64) -> f64 {
|
||||
// truncf64(x)
|
||||
x.trunc()
|
||||
}
|
||||
|
||||
unsafe extern "C" fn _nearbyintf64(x: f64) -> f64 {
|
||||
nearbyintf64(x)
|
||||
#[inline]
|
||||
extern "C" fn _nearbyintf64(x: f64) -> f64 {
|
||||
// nearbyintf64(x)
|
||||
x.round()
|
||||
}
|
||||
|
Reference in New Issue
Block a user