-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* begin register allocator * begin reg alloc * mutable virtual registers; basic allocation algorithm skeleton * mutable registers in allocation * pull in fuel-asm official ops * switching laptops * begin work on virtual registers and ops * daily checkpoint * add AllocatedOp abstraction * template for parsing ops * allocation algorithm progress * change op parsing logic * WIP parsing inline asm to new ops * more op parsing * finish parsing virtual ops from asm * start registers method * register allocation method * convert virtual registers to allocated ones * switch back to organizational labels for jumps * realized ops * fully allocate registers and resolve labels * print allocated registers * fill in todo!() errors in asm parsing * resolve all todosudo apt-get install vlc in core_lang * switch to ssh for fuel-asm * resolve warnings * fix git url * rustfmt * small self-code-review * resolve module * map the virtual opcodes to fuel_asm ops * code review feedback * factor finalized asm out into its own file * realize data section and instructions to bits * data section offset label * initial bytecode generation * add forc --asm command * print out the loading of the data section op * resolve warnings * begin VM tests * fix register allocater bug * cleanup * fix bad error message * some tiny tweaks * fix opcode encoding bug * fix off-by-one error * change all tests to run in the vm * proper allocation size for structs * code review feedback * use ssh for deps * undo rename * fix doctest * fix typo * reference fuel_core for register constants * new ssh key * git change rust version * wrong rust version * update lockfile * fix jump and enum instantiation bugs * fix toml * lockfile * code review feedback Co-authored-by: Alexander Hansen <alexanderhansen@Alexanders-MacBook-Pro.local>
- Loading branch information
Showing
24 changed files
with
1,645 additions
and
70 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
script; | ||
predicate; | ||
struct Rgb { | ||
red: u64, | ||
green: u64, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
use forc; | ||
|
||
use fuel_tx::Transaction; | ||
use fuel_vm_rust::interpreter::Interpreter; | ||
|
||
/// Very basic check that code does indeed run in the VM. | ||
/// `true` if it does, `false` if not. | ||
pub(crate) fn runs_in_vm(file_name: &str) { | ||
let script = compile_to_bytes(file_name); | ||
let gas_price = 10; | ||
let gas_limit = 10000; | ||
let maturity = 100; | ||
let script_data = vec![]; | ||
let inputs = vec![]; | ||
let outputs = vec![]; | ||
let witness = vec![]; | ||
let tx = Transaction::script( | ||
gas_price, | ||
gas_limit, | ||
maturity, | ||
script, | ||
script_data, | ||
inputs, | ||
outputs, | ||
witness, | ||
); | ||
let block_height = (u32::MAX >> 1) as u64; | ||
tx.validate(block_height).unwrap(); | ||
Interpreter::execute_tx(tx).unwrap(); | ||
} | ||
|
||
/// Returns `true` if a file compiled without any errors or warnings, | ||
/// and `false` if it did not. | ||
pub(crate) fn compile_to_bytes(file_name: &str) -> Vec<u8> { | ||
println!("Compiling {}", file_name); | ||
let manifest_dir = env!("CARGO_MANIFEST_DIR"); | ||
let res = forc::ops::forc_build::build(Some(format!( | ||
"{}/src/e2e_vm_tests/test_programs/{}", | ||
manifest_dir, file_name | ||
))); | ||
match res { | ||
Ok(bytes) => bytes, | ||
Err(_) => { | ||
panic!( | ||
"TEST FAILURE: Project \"{}\" failed to compile. ", | ||
file_name | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
mod harness; | ||
|
||
pub fn run() { | ||
let project_names = vec!["script_1", "script_2", "script_3"]; | ||
project_names.into_iter().for_each(|name| { | ||
crate::e2e_vm_tests::harness::runs_in_vm(name); | ||
}); | ||
} |
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...on_tests/test_programs/script_3/Forc.toml → ...vm_tests/test_programs/script_2/Forc.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...on_tests/test_programs/script_2/Forc.toml → ...vm_tests/test_programs/script_3/Forc.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.