Make more code work with no_std. (#407)

* Make more code work with no_std.

no_std support is still incomplete, but this patch takes care of the
bulk of the straightforward parts.
This commit is contained in:
Dan Gohman
2019-10-08 16:53:32 -07:00
committed by GitHub
parent c0b37bb713
commit 8e1b44b29c
100 changed files with 380 additions and 270 deletions

View File

@@ -1,9 +1,11 @@
use alloc::boxed::Box;
use alloc::vec::Vec;
use core::ptr;
use cranelift_codegen::isa::TargetFrontendConfig;
use cranelift_entity::EntityRef;
use cranelift_wasm::GlobalInit;
use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::ptr;
use wasmtime_environ::{Module, TargetSharedSignatureIndex, VMOffsets};
pub struct TableRelocation {
@@ -28,7 +30,7 @@ pub fn layout_vmcontext(
let target_index = match signature_registry.entry(sig) {
Entry::Occupied(o) => *o.get(),
Entry::Vacant(v) => {
assert!(signature_registry_len <= ::std::u32::MAX as usize);
assert!(signature_registry_len <= ::core::u32::MAX as usize);
let id = TargetSharedSignatureIndex::new(signature_registry_len as u32);
signature_registry_len += 1;
*v.insert(id)

View File

@@ -1,3 +1,5 @@
use alloc::string::String;
use alloc::vec::Vec;
use faerie::{Artifact, Decl};
use wasmtime_environ::DataInitializer;

View File

@@ -1,3 +1,4 @@
use alloc::string::String;
use cranelift_codegen::settings;
use cranelift_codegen::settings::Configurable;
use cranelift_entity::EntityRef;

View File

@@ -26,6 +26,8 @@
)
)]
extern crate alloc;
mod context;
mod data_segment;
mod function;

View File

@@ -2,6 +2,7 @@ use crate::context::layout_vmcontext;
use crate::data_segment::{declare_data_segment, emit_data_segment};
use crate::function::{declare_functions, emit_functions};
use crate::table::{declare_table, emit_table};
use alloc::string::String;
use cranelift_codegen::isa::TargetFrontendConfig;
use faerie::{Artifact, Decl, Link};
use wasmtime_environ::{Compilation, DataInitializer, Module, Relocations};

View File

@@ -1,3 +1,5 @@
use alloc::string::String;
use alloc::vec::Vec;
use faerie::{Artifact, Decl};
/// Declares data segment symbol