-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
memory imports #124
base: main
Are you sure you want to change the base?
memory imports #124
Conversation
Codecov ReportAttention: Patch coverage is
|
if imported_memories.len() > 1 { | ||
return Err(Error::MoreThanOneMemory); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if imported_memories.len() > 1 { | |
return Err(Error::MoreThanOneMemory); | |
} | |
#[cfg(not(multiple_memories))] // maybe without this | |
if local_memories.len() + imported_memories.len() > 1 { | |
return Err(Error::MoreThanOneMemory); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the multiple memories proposal, can you have more than 1 local memory? Or is it multiple local, multiple imported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking through the code, I disagree. We have bits in execution_info
that MUST have a single memory otherwise it panics.
if local_memories.len() > 1 { | ||
return Err(Error::MoreThanOneMemory); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if local_memories.len() > 1 { | |
return Err(Error::MoreThanOneMemory); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not under #cfg?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking through the code, I disagree. We have bits in execution_info
that MUST have a single memory otherwise it panics.
@@ -441,7 +469,7 @@ where | |||
ty: *ty, | |||
locals, | |||
code_expr, | |||
// TODO fix this ugly clone | |||
// TODO: Not used any more. Should we remove it? | |||
sidetable: sidetable.clone(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should remove this, otherwise there might be confusion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cemonem agree?
|
||
self.module_map | ||
.insert(module_name.to_string(), self.modules.len()); | ||
self.modules.push(exec_info); | ||
|
||
let local_sidetables = validation_info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Sidetables are not supposed to be modified after initialization, would it be better if we'd attach them to the FunctionDeclarations?
Mr. Titzer does the exact same thing where the Sidetable is attached to its corresponding FuncDecl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Letting them attatched to FunctionInst gives us headaches in terms of rust optimizations
What I am doing there is not to modify the sidetables, I am just shoving them in an array (and syncing it with function indexing by inserting dummy tables for imported functions which are not used anyway)
src/execution/interpreter_loop.rs
Outdated
@@ -477,9 +493,12 @@ pub(super) fn run<H: HookSet>( | |||
let mem = modules[*current_module_idx] | |||
.store | |||
.mems | |||
.first() | |||
.first_mut() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think we should shrink down the interpreter loop massively through the use of macros
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you loved +4000 lines of code changed D:
Jokes aside, I agree that we should abstract away some parts of the interpreter loop, though I'm not sure I agree with macros.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check element / look at the get_mem
function. Abstracting it any more isn't worthwhile imho. ctrl+f works fast enough
Signed-off-by: George Cosma <[email protected]>
Signed-off-by: George Cosma <[email protected]>
Signed-off-by: George Cosma <[email protected]>
3566104
to
a989fcf
Compare
Pull Request Overview
This pull request adds/changes/fixes...
Testing Strategy
This pull request was tested by...
TODO or Help Wanted
This pull request still needs...
Formatting
cargo fmt
cargo check
cargo build
cargo doc
nix fmt
Github Issue
This pull request closes <GITHUB_ISSUE>