-
Notifications
You must be signed in to change notification settings - Fork 271
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
Refactors store and adds ReleaseModuleInstance. #294
Conversation
note to myself: move refcounters to store |
I will rework a bit so that we have refcount per moduleInstance rather than per each instance (memory, function, etc) as the latter needlessly makes the code complex while we benefit a little |
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.
thanks for the work so far!
782fc21
to
5e091d6
Compare
so I need to do backfilling tests a lot.. |
36470cc
to
55e635f
Compare
some assert_invalid failing but almost there |
ok passed spectests.. will polish |
so I will stop caring about concurrency in this PR as it bloats further more |
|
||
func (m *Module) validateTables(tables []*TableType, globals []*GlobalType) error { | ||
if len(tables) > 1 { | ||
return fmt.Errorf("multiple tables are not supported") |
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.
@codefromthecrypt fyi now this is the place we enforce at most one table (before instantiation phase)
ok needs to fix amd64 then.. |
some of the funcs lacks godoc but eagerly mark this ready for review |
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.
adding some comments because the uint64 thing shouldn't survive another PR
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.
Good work!
I would probably move validate* functions to validate.go and validate_test.go even if they have a module target. At some point we will export more of these to ensure source context is correct on failure.
for codeIndex := range m.FunctionSection { | ||
funcIdx := Index(importCount + uint32(len(functions))) | ||
// Seek to see if there's a better name than "unknown" | ||
name := "unknown" |
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.
probably better to default to $funcIdx and set that after the loop so we don't allocate unless we found no name.
Signed-off-by: Takeshi Yoneda <[email protected]>
edd9295
to
9596183
Compare
Thanks for the look! |
This PR refactors store.go and adds store.ReleaseModuleInstance.
Notably, this removes the "rollback" functions in InstantiateModule
which we had used to rollback the mutated state when we encounter
the initialization failure. Instead, we separate out the validation from
initialization and migrate most of the validation logics into module.go
As for ReleaseModuleInstance, that is necessary to complete #293,
will be leveraged to make it possible for store to be used for long-running
processes and environment.