close to working

This commit is contained in:
Lachlan Sneff
2019-02-19 09:58:01 -08:00
parent e381bbd07b
commit 3c7dc200fa
10 changed files with 239 additions and 206 deletions

View File

@ -2,15 +2,41 @@ use crate::relocation::{ExternalRelocation, TrapSink};
use hashbrown::HashMap;
use wasmer_runtime_core::{
backend::sys::Memory,
backend::{
sys::Memory,
CacheGen,
},
cache::{Cache, Error},
module::ModuleInfo,
module::{ModuleInfo, ModuleInner},
structures::Map,
types::{LocalFuncIndex, SigIndex},
};
use std::{
sync::Arc,
cell::UnsafeCell,
};
use serde_bench::{deserialize, serialize};
pub struct CacheGenerator {
backend_cache: BackendCache,
memory: Arc<Memory>,
}
impl CacheGenerator {
pub fn new(backend_cache: BackendCache, memory: Arc<Memory>) -> Self {
Self { backend_cache, memory }
}
}
impl CacheGen for CacheGenerator {
fn generate_cache(&self, module: &ModuleInner) -> Result<(Box<ModuleInfo>, Box<[u8]>, Arc<Memory>), Error> {
let info = Box::new(module.info.clone());
Err(Error::Unknown("".to_string()))
}
}
#[derive(Serialize, Deserialize)]
pub struct TrampolineCache {
#[serde(with = "serde_bytes")]
@ -22,7 +48,7 @@ pub struct TrampolineCache {
pub struct BackendCache {
pub external_relocs: Map<LocalFuncIndex, Box<[ExternalRelocation]>>,
pub offsets: Map<LocalFuncIndex, usize>,
pub trap_sink: TrapSink,
pub trap_sink: Arc<TrapSink>,
pub trampolines: TrampolineCache,
}