Skip to content

Commit

Permalink
Orca maps (#123)
Browse files Browse the repository at this point in the history
* parsing and verifier tests passing for maps

* map_knower

* cargo changed

* cargo changed

* adding mapknower to main

* map creation working

* added no-mangles to lib

* map inserts working

* factored out map_info and rename target_imp_name to target_fn_name

* targeting local functions working

* rename map_knower to map_lib_adapter

* cargo fmt :(

* decoupled map_lib_adapter and report_metadata

* report_metadata to report_var_metadata

* cargo fmt :(

* probe tracking for metadata

* current version

* I love friday commits

* stable and trying to get to display output

* cargo fmt

* get fn name

* mm changes

* Map updates for metadata

* add_map working

* reworked where report_decl is visited

* comment out print_meta() for now

* cargo fmt :(

* removed unused fn

* applied cargo clippy fixes

* cargo clippy again :)

* removed unused import

* no more panic

* renamed lib fn

* fixed error message

* finshed the refactoring

* compiles and runs post-merge

* fixed wast test compatibility

* cargo fmt

* abstracted some functionality in map_lib_adapter

* cargo fmt :(

* new errs

* stop breaking the ST

* minor code changes

* minor test changes

* clippy and fmt

---------

Co-authored-by: ahuoguo <[email protected]>
Co-authored-by: ahuoguo <[email protected]>
Co-authored-by: Elizabeth Gilbert <[email protected]>
  • Loading branch information
4 people authored Aug 2, 2024
1 parent cf07437 commit 1afb0f8
Show file tree
Hide file tree
Showing 43 changed files with 3,397 additions and 218 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ tests/apps/handwritten/*.wasm
output/

# Ignore the wasm playground files
wasm_playground/*.wasm
wasm_playground/**/*.wat
wasm_playground/**/*.wasm

# Ignore mac files
.DS_Store
Expand Down
4 changes: 2 additions & 2 deletions docs/src/devs/emitting.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Take the following probe definition for example:
wasm:bytecode:call:alt /
target_fn_type == "import" &&
target_imp_module == "ic0" &&
target_imp_name == "call_perform"
target_fn_name == "call_perform"
/ { ... }
```

Expand All @@ -80,7 +80,7 @@ Now, take the next probe definition example:
wasm:bytecode:call:alt /
target_fn_type == "import" &&
target_imp_module == "ic0" &&
target_imp_name == "call_new" &&
target_fn_name == "call_new" &&
strcmp((arg0, arg1), "bookings") &&
strcmp((arg2, arg3), "record")
/ { ... }
Expand Down
16 changes: 14 additions & 2 deletions src/common/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,16 @@ impl ErrorGen {
};
self.add_warn(warn);
}
pub fn add_compiler_warn(&mut self, message: String) {
let warn = WhammWarning {
ty: WarnType::CompilerWarning { message },
warn_loc: None,
info_loc: None,
};
self.add_warn(warn);
}
}

#[derive(Clone)]
pub struct CodeLocation {
// True if this is an error-causing code location, false if not (just informational)
pub is_err: bool,
Expand Down Expand Up @@ -587,7 +595,7 @@ impl CodeLocation {
}
}
}

#[derive(Clone)]
pub struct WhammError {
pub fatal: bool,
/// The location within the input string causing the error
Expand Down Expand Up @@ -805,18 +813,21 @@ impl WhammError {
}
pub enum WarnType {
TypeCheckWarning { message: String },
CompilerWarning { message: String },
Warning { message: Option<String> },
}
impl WarnType {
pub fn name(&self) -> &str {
match self {
WarnType::TypeCheckWarning { .. } => "TypeCheckWarning",
WarnType::CompilerWarning { .. } => "CompilerWarning",
WarnType::Warning { .. } => "GeneralWarning",
}
}
pub fn message(&self) -> Cow<'_, str> {
match self {
WarnType::TypeCheckWarning { ref message } => Cow::Borrowed(message),
WarnType::CompilerWarning { ref message } => Cow::Borrowed(message),
WarnType::Warning { ref message } => {
if let Some(msg) = message {
Cow::Borrowed(msg)
Expand All @@ -827,6 +838,7 @@ impl WarnType {
}
}
}
#[derive(Clone)]
pub enum ErrorType {
InstrumentationError {
message: String,
Expand Down
Loading

0 comments on commit 1afb0f8

Please sign in to comment.