-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create skeleton to plan for 'alloc' var logic * Support 'alloc' variables in the parser * Add some comments to plan and panic on special_decl_init * add some more todos
- Loading branch information
1 parent
f0aec46
commit 0e5a32c
Showing
18 changed files
with
313 additions
and
53 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub mod rewriting; | ||
pub mod wizard; |
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,19 @@ | ||
use crate::parser::types::DataType; | ||
use crate::verifier::types::VarAddr; | ||
use std::collections::HashMap; | ||
|
||
pub fn allocate_vars(_to_alloc: Vec<(String, DataType)>) -> HashMap<String, (VarAddr, DataType)> { | ||
// Called once per probe match point with `alloc` OR `report` vars. | ||
|
||
// result: The new global variables: name -> (addr, ty) | ||
// as a hashmap to enable caller to place in SymbolTable and handle report variables | ||
// Add these VarAddrs to the symbol table. | ||
// Can now emit the rest of the probe body logic as normal. | ||
|
||
// NOTE: `decl_init` statements should be run ONCE | ||
|
||
// See utils.rs/`emit_report_decl_stmt` | ||
// basically want to do just refactor to call out to THIS function instead (more modular) | ||
// this function will also handle if the var is a report variable | ||
todo!() | ||
} |
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,49 @@ | ||
use crate::parser::types::DataType; | ||
use crate::verifier::types::VarAddr; | ||
use orca_wasm::ir::id::FunctionID; | ||
use std::collections::HashMap; | ||
|
||
pub fn create_alloc_func(_to_alloc: Vec<DataType>) -> FunctionID { | ||
// Called once per probe definition with `alloc` OR `report` vars. | ||
|
||
// $alloc description: | ||
// Will generate a function that allocates the memory required. | ||
// The order of the data will go in the order of the `to_alloc` param. | ||
// The function will return the memory offset to use by the probe logic. | ||
// Will also need to update some global value that keeps track of the already (use memory allocator?) | ||
// allocated memory space. Make sure to check that memory size is big enough! | ||
|
||
// NOTE: `decl_init` statements should be run ONCE (can be in $alloc func) | ||
todo!() | ||
} | ||
|
||
pub fn load_alloc_vars( | ||
_alloc_mem_offset: VarAddr, | ||
_alloc_vars: Vec<(String, DataType)>, | ||
) -> HashMap<String, (VarAddr, DataType)> { | ||
// increment by bytes used by each var's DataType as we load them | ||
// will be used to load the next variable AND to save in the VarAddr! | ||
let _used_bytes = 0; | ||
|
||
// alloc_mem_offset: parameter that specifies the result of calling $alloc (should be wasm local var) | ||
// alloc_vars: Vec<(var_name, var_ty)>, in the order they should appear in memory starting at | ||
// the offset `alloc_mem_offset` | ||
// result: The new local variables: name -> (addr, ty) | ||
// as a hashmap to enable caller to place in SymbolTable and handle report variables | ||
// the new VarAddr will be a pointer into memory with an offset (real addr should be alloc_mem_offset + len_of_prev_vars) | ||
|
||
// At start of probe logic, pull the current values of the 'alloc' variables from memory. | ||
// Add these VarAddrs to the symbol table. | ||
// Can now emit the rest of the probe body logic as normal. | ||
|
||
todo!() | ||
} | ||
|
||
pub fn save_alloc_vars( | ||
_alloc_mem_offset: VarAddr, | ||
_allocated_vars: HashMap<String, (VarAddr, DataType)>, | ||
) { | ||
// At end of probe logic, save the values of 'alloc' variables back into memory. | ||
|
||
todo!() | ||
} |
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 +1,2 @@ | ||
pub mod alloc_vars; | ||
pub mod libraries; |
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
Oops, something went wrong.