Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add amemory.grow handler in the RT#2755

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
CountBleck wants to merge2 commits intoAssemblyScript:main
base:main
Choose a base branch
Loading
fromCountBleck:memory-grow-handler

Conversation

CountBleck
Copy link
Member

Changes proposed in this pull request:
⯈ Add an optional handler for calls tomemory.grow() in the RT.
⯈ Unrelatedly, skip fixture comparisons in tests if compiling them failed.

The question remains whether this could somehow be used within ESM bindings.

  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

This handler can be used with an import for users not using ESM bindingsto recreate views into memory only when necessary.
If the test is supposed to compile, but compilation fails instead,there's no point in diffing fixtures (unless you like a wall of red inyour terminal). It also turns out that execution never reaches thediffing section, since writing the non-existent debug Wasm binary fails.
@MaxGraey
Copy link
Member

User can directly callmemory.grow(N) intrinsic at some place. So I guess better to patch this built-in intrinsic (in compiler) instead add this handler to all memory runtimes

@CountBleck
Copy link
MemberAuthor

Good point, although I thought that would be a niche case in comparison to the RT growing memory.

Do you think a handler can/should be integrated with ESM/raw bindings to reduce the use oftry-catch and repeatedly creating views?

@MaxGraey
Copy link
Member

Do you think a handler can/should be integrated with ESM/raw bindings to reduce the use of try-catch and repeatedly creating views?

I'm not sure what is a better solution. Previously, we used similar approach (without try-catch + views) and that was may be a little less code but slower. I would do a some simple PoC and bench this first

Copy link
Member

@HerrCai0907HerrCai0907 left a comment
edited
Loading

Choose a reason for hiding this comment

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

Do you think it is more convenient for developer if we have a functionmemory_grow which will callmemory.grow. Then developer can replace this function just like replacingtrace.
It can give more freedom to hook memory grow. They can hook before and after memory grow.

@CountBleck
Copy link
MemberAuthor

It can give more freedom to hook memory grow.

Honestly the only use case I'm targeting is handling views of the Wasm memory being detached onmemory.grow() in JS.
Someone (who does not use ESM bindings) in the AS Discord wanted some way to detect when memory has been grown for that same use case.

I want to expand that into something that works with ESM bindings as well. I don't see the point in widening it to anything more general.

Therefore, it's probably better to scrap what I have in this PR right now and figure out something that works for detecting grow events in at least ESM bindings.

@CountBleckCountBleck marked this pull request as draftOctober 1, 2023 01:18
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@HerrCai0907HerrCai0907HerrCai0907 left review comments

@dcodeIOdcodeIOAwaiting requested review from dcodeIO

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@CountBleck@MaxGraey@HerrCai0907

[8]ページ先頭

©2009-2025 Movatter.jp