Disconnects Store state fields from Compiler (#1761)

*  Moves CodeMemory, VMInterrupts and SignatureRegistry from Compiler
*  CompiledModule holds CodeMemory and GdbJitImageRegistration
*  Store keeps track of its JIT code
*  Makes "jit_int.rs" stuff Send+Sync
*  Adds the threads example.
This commit is contained in:
Yury Delendik
2020-06-02 13:44:39 -05:00
committed by GitHub
parent b41330393d
commit 15c68f2cc1
61 changed files with 982 additions and 663 deletions

View File

@@ -90,8 +90,8 @@ mod tests {
fn test_custom_signal_handler_single_instance() -> Result<()> {
let engine = Engine::new(&Config::default());
let store = Store::new(&engine);
let module = Module::new(&store, WAT1)?;
let instance = Instance::new(&module, &[])?;
let module = Module::new(&engine, WAT1)?;
let instance = Instance::new(&store, &module, &[])?;
let (base, length) = set_up_memory(&instance);
unsafe {
@@ -150,11 +150,11 @@ mod tests {
fn test_custom_signal_handler_multiple_instances() -> Result<()> {
let engine = Engine::new(&Config::default());
let store = Store::new(&engine);
let module = Module::new(&store, WAT1)?;
let module = Module::new(&engine, WAT1)?;
// Set up multiple instances
let instance1 = Instance::new(&module, &[])?;
let instance1 = Instance::new(&store, &module, &[])?;
let instance1_handler_triggered = Rc::new(AtomicBool::new(false));
unsafe {
@@ -196,7 +196,7 @@ mod tests {
);
}
let instance2 = Instance::new(&module, &[]).expect("failed to instantiate module");
let instance2 = Instance::new(&store, &module, &[]).expect("failed to instantiate module");
let instance2_handler_triggered = Rc::new(AtomicBool::new(false));
unsafe {
@@ -244,8 +244,8 @@ mod tests {
let store = Store::new(&engine);
// instance1 which defines 'read'
let module1 = Module::new(&store, WAT1)?;
let instance1 = Instance::new(&module1, &[])?;
let module1 = Module::new(&engine, WAT1)?;
let instance1 = Instance::new(&store, &module1, &[])?;
let (base1, length1) = set_up_memory(&instance1);
unsafe {
store.set_signal_handler(move |signum, siginfo, _| {
@@ -258,8 +258,8 @@ mod tests {
let instance1_read = instance1_exports.next().unwrap();
// instance2 which calls 'instance1.read'
let module2 = Module::new(&store, WAT2)?;
let instance2 = Instance::new(&module2, &[instance1_read.into_extern()])?;
let module2 = Module::new(&engine, WAT2)?;
let instance2 = Instance::new(&store, &module2, &[instance1_read.into_extern()])?;
// since 'instance2.run' calls 'instance1.read' we need to set up the signal handler to handle
// SIGSEGV originating from within the memory of instance1
unsafe {