Skip to content

Commit

Permalink
conitue with wasmer
Browse files Browse the repository at this point in the history
  • Loading branch information
victoryang00 committed Jan 14, 2024
1 parent 99dfd4f commit 97dd5aa
Show file tree
Hide file tree
Showing 13 changed files with 341 additions and 193 deletions.
492 changes: 319 additions & 173 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ getrandom = {version = "0.2", features = ["js"]}
wasm-bindgen = "0.2"
wasm-bindgen-test = "0.3.30"
# wasmer = {git = "https://github.com/Multi-V-VM/wasmer"}
wasmer-compiler-cranelift = {path = "../wasmer/lib/compiler-cranelift"}
wasmer = "4.2.5"
zero = "0.1.2"

wasmer-compiler-cranelift = "4.2.5"
[lib]
crate-type = ["cdylib", "rlib"]

Expand Down
2 changes: 1 addition & 1 deletion examples/doublejit-runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ fn main(){
)))
.unwrap();
// middle end, invoke native and have lock to prevent execution

// let mut middleend = MiddleEnd::new();
}
1 change: 0 additions & 1 deletion src/cache/mod.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/codegen/optimizer.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@

// passes
4 changes: 2 additions & 2 deletions src/frontend/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ impl<'a> Binary<'a> {
);
section_iter.next();
for sh in section_iter {
dbg!(" {}", sh.get_data(&elf));
dbg!(" {},", sh.get_data(&elf));
}

Ok(Self { pages })
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ impl CodeCache {
}
pub fn set(&mut self, addr: u64, instruction: Instruction) {
self.cache.insert(addr, instruction);
}
} // cache for function and cache for instruction
}
4 changes: 2 additions & 2 deletions src/frontend/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ impl ProgramHeader32 {
}
}
pub fn get_data<'a>(&self, elf: &ElfFile<'a>) -> ParseResult<SegmentData<'a>> {
self.get_type().map(|typ| match typ {
let _ = self.get_type().map(|typ| match typ {
ProgramHeaderType::Null => SegmentData::Empty,
ProgramHeaderType::Dynamic => {
let data = self.raw_data(elf);
Expand Down Expand Up @@ -1273,7 +1273,7 @@ impl ProgramHeader64 {
}
}
pub fn get_data<'a>(&self, elf: &ElfFile<'a>) -> ParseResult<SegmentData<'a>> {
self.get_type().map(|typ| match typ {
let _ = self.get_type().map(|typ| match typ {
ProgramHeaderType::Null => SegmentData::Empty,
ProgramHeaderType::Dynamic => {
let data = self.raw_data(elf);
Expand Down
14 changes: 7 additions & 7 deletions src/frontend/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2253,10 +2253,10 @@ impl Instruction {
0b01 => Some(r4!(rv32_no_e, RV32D, FNMSUB_D, bit_u32, fp)),
_ => None,
},
0b0000111 => {
#[rustfmt::skip]
match bit_u32 {
x if x & 0b11111111111100000111000001111111 == 0b00000010101100000000000000000111 => Some(r4!(rv32_v, RV32V, VLM_V, bit_u32, fp)),
// 0b0000111 => {
// #[rustfmt::skip]
// match bit_u32 {
// x if x & 0b11111111111100000111000001111111 == 0b00000010101100000000000000000111 => Some(r4!(rv32_v, RV32V, VLM_V, bit_u32, fp)),
// x if x & 0b00011101111100000111000001111111 == 0b00000000000000000000000000000111 => Some(VLE8_V),
// x if x & 0b00011101111100000111000001111111 == 0b00000000000000000101000000000111 => Some(VLE16_V),
// x if x & 0b00011101111100000111000001111111 == 0b00000000000000000110000000000111 => Some(VLE32_V),
Expand Down Expand Up @@ -2305,9 +2305,9 @@ impl Instruction {
// x if x & 0b11111111111100000111000001111111 == 0b_11100010100000000101000000000111 => Some(VL8RE16_V),
// x if x & 0b11111111111100000111000001111111 == 0b_11100010100000000110000000000111 => Some(VL8RE32_V),
// x if x & 0b11111111111100000111000001111111 == 0b_11100010100000000111000000000111 => Some(VL8RE64_V),
_ => None,
}
},
// _ => None,
// }
// },
// 0b0100111 => {
// #[rustfmt::skip]
// match bit_u32 {
Expand Down
1 change: 1 addition & 0 deletions src/frontend/v.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::frontend::VLEN;
use crate::frontend::ELEN;

pub struct V {
vstart: u64,
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ extern crate alloc;
#[cfg(any(test, feature = "std"))]
extern crate std;

mod cache;
mod codegen;
mod frontend;
mod middleend;
Expand Down
3 changes: 2 additions & 1 deletion src/middleend/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
mod address_map;
mod address_map;
mod wasm_module;
4 changes: 3 additions & 1 deletion src/wasm/wasm_builder.rs
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
use wasmer_compiler_cranelift::CraneliftCompiler;
use wasmer::{Memory, MemoryType, Pages, Store, Type, Value, WASM_MAX_PAGES};
use wasmer::Engine;
use wasmer_compiler_cranelift::Cranelift;

0 comments on commit 97dd5aa

Please sign in to comment.