Skip to content

capi: imported and exported memory#631

Merged
axic merged 3 commits intomasterfrom
capi-external-memory
Nov 5, 2020
Merged

capi: imported and exported memory#631
axic merged 3 commits intomasterfrom
capi-external-memory

Conversation

@gumb0
Copy link
Copy Markdown
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
@gumb0 gumb0 force-pushed the capi-external-memory branch from 645d83f to f848f1b Compare November 2, 2020 15:58
@codecov
Copy link
Copy Markdown

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 force-pushed the capi-external-memory branch from f848f1b to e89ffb5 Compare November 2, 2020 17:14
@gumb0 gumb0 marked this pull request as ready for review November 2, 2020 17:16
@gumb0 gumb0 force-pushed the capi-external-table branch from 036b86a to d8a6174 Compare November 3, 2020 11:31
@gumb0 gumb0 force-pushed the capi-external-memory branch from e89ffb5 to d06b3be Compare November 3, 2020 11:40
@gumb0 gumb0 requested review from axic and chfast November 3, 2020 11:41
@gumb0 gumb0 force-pushed the capi-external-memory branch from d06b3be to e2350d8 Compare November 3, 2020 12:31
@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
@gumb0 gumb0 force-pushed the capi-external-memory branch from e2350d8 to cd307cc Compare November 3, 2020 18:20
Comment thread include/fizzy/fizzy.h
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
Copy Markdown
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
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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.

Comment thread include/fizzy/fizzy.h Outdated
/// @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
Copy Markdown
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
Copy Markdown
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.

Comment thread include/fizzy/fizzy.h Outdated
Comment thread include/fizzy/fizzy.h Outdated
{
// Opaque pointer to memory data.
FizzyMemory* memory;
// Memory limits.
Copy link
Copy Markdown
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.

@gumb0 gumb0 force-pushed the capi-external-memory branch from 6c42874 to 5293b84 Compare November 4, 2020 15:12
Comment thread test/unittests/capi_test.cpp
@gumb0 gumb0 force-pushed the capi-external-memory branch from 5293b84 to 773ec2a Compare November 4, 2020 17:33
@gumb0 gumb0 requested a review from axic November 4, 2020 17:51
Comment thread include/fizzy/fizzy.h
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
Copy Markdown
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
@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

None yet

Development

Successfully merging this pull request may close these issues.

3 participants