Skip to content
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

capi: imported and exported memory #631

Merged
merged 3 commits into from
Nov 5, 2020
Merged

capi: imported and exported memory #631

merged 3 commits into from
Nov 5, 2020

Conversation

gumb0
Copy link
Collaborator

@gumb0 gumb0 commented Nov 2, 2020

No description provided.

@gumb0 gumb0 changed the base branch from master to capi-external-table November 2, 2020 15:51
@codecov
Copy link

codecov bot commented Nov 2, 2020

Codecov Report

Merging #631 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #631      +/-   ##
==========================================
+ Coverage   98.36%   98.37%   +0.01%     
==========================================
  Files          69       69              
  Lines        9592     9654      +62     
==========================================
+ Hits         9435     9497      +62     
  Misses        157      157              

@gumb0 gumb0 marked this pull request as ready for review November 2, 2020 17:16
@axic axic added this to In progress in 0.6.0 via automation Nov 2, 2020
@gumb0 gumb0 requested review from chfast and axic November 3, 2020 11:41
@gumb0 gumb0 mentioned this pull request Nov 3, 2020
49 tasks
@gumb0 gumb0 force-pushed the capi-external-table branch 3 times, most recently from aca8ba0 to 3b51d9f Compare November 3, 2020 17:13
Base automatically changed from capi-external-table to master November 3, 2020 18:08
@@ -190,8 +204,8 @@ bool fizzy_find_exported_function(
/// module, behaviour is undefined.
FizzyInstance* fizzy_instantiate(const FizzyModule* module,
const FizzyExternalFunction* imported_functions, size_t imported_functions_size,
const FizzyExternalTable* imported_table, const FizzyExternalGlobal* imported_globals,
size_t imported_globals_size);
const FizzyExternalTable* imported_table, const FizzyExternalMemory* imported_memory,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The C++ API supports a vector of tables and memories, while the C API only supports a singular for both. While both can be at most one in wasm 1.0, there is a discrepancy between the two APIs.

Perhaps should also comment about this, as it may be confused to those familiar with the wasm spec.

In short: I think we should support a single table/memory in the C API as we can make a breaking API release if we do start supporting newer wasm versions. I would be inclined to say the same restriction would make sense in C++. Perhaps just open a tracking issue about this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree on having single table/memory.

/// @param name The table name. NULL-terminated string. Cannot be NULL.
/// @param out_memory Pointer to output struct to store found memory. Cannot be NULL.
/// @returns true if memory was found, false otherwise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should leave a comment this support a singular exported memory as per wasm 1.0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this function would support several memories just fine, because it finds them by name.

include/fizzy/fizzy.h Outdated Show resolved Hide resolved
{
// Opaque pointer to memory data.
FizzyMemory* memory;
// Memory limits.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Memory limits.
/// Memory limits.

0.6.0 automation moved this from In progress to Reviewer approved Nov 4, 2020
@@ -190,8 +204,8 @@ bool fizzy_find_exported_function(
/// module, behaviour is undefined.
FizzyInstance* fizzy_instantiate(const FizzyModule* module,
const FizzyExternalFunction* imported_functions, size_t imported_functions_size,
const FizzyExternalTable* imported_table, const FizzyExternalGlobal* imported_globals,
size_t imported_globals_size);
const FizzyExternalTable* imported_table, const FizzyExternalMemory* imported_memory,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree on having single table/memory.

@axic axic merged commit 9abcdfb into master Nov 5, 2020
0.6.0 automation moved this from Reviewer approved to Done Nov 5, 2020
@axic axic deleted the capi-external-memory branch November 5, 2020 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
0.6.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants