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

Do not allocate MemorySegments for memory.data(i32, i32?)#2831

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

Open
CountBleck wants to merge1 commit intoAssemblyScript:main
base:main
Choose a base branch
Loading
fromCountBleck:fix-large-memory-crash

Conversation

CountBleck
Copy link
Member

Fixes#2827.

Changes proposed in this pull request:
⯈ BumpCompiler#memoryOffset instead of allocating zero-filled segments.

There is an issue with theinitialPages calculation ininitDefaultMemory, however. The existing condition to run that calculation depends onmemorySegments.length, which is now zero if onlymemory.data(n: i32) is called, as in the memory-config-errors test.
Making that calculation occur regardless of the number of memory segments would cause a separate issue: due to the default memory offsets ofoptions.memoryBase,1024, or8, modules that previously compiled with an initial memory of 0 pages would compile with a minimum of 1 page.

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

@dcodeIO
Copy link
Member

Would this perhaps become simpler if we'd keep tracking such segments asMemorySegments but allowed the buffer to benull, indicating all zeroes?

More generally, when not indicating the presence of the segment to Binaryen, we'd always have to assume that memory is zeroed, as the zeroes won't be in the(memory ...). Might well be a non-issue in practice, though.

@CountBleck
Copy link
MemberAuthor

Would this perhaps become simpler[...]?

Oh, that's...a much better idea. Thanks and sorry about that.

@CountBleck
Copy link
MemberAuthor

CountBleck commentedMar 25, 2024
edited
Loading

Might well be a non-issue in practice, though.

@dcodeIO hmm, would this conflict when--importMemory is specified without--zeroFilledMemory?

@CountBleckCountBleck marked this pull request as ready for reviewMarch 25, 2024 03:00
@CountBleckCountBleckforce-pushed thefix-large-memory-crash branch 3 times, most recently fromed50aef to4465767CompareApril 3, 2024 01:46
MemorySegments can now hold null buffers, which signifies that memory isin fact used in the compiled program, for programs that only reservezero-filled memories. Using null buffers avoids passing zero-filledbuffers to Binaryen, which isn't necessary since Wasm memories areinitialized with zeroes when a (data ...) segment isn't present.This change is breaking in that modules using imported memories thatcontain non-zero values in such memory ranges at the time ofinstantiation will retain those values, as opposed to being filled.This shouldn't affect most users, however, and it could possibly bedesirable.FixesAssemblyScript#2827.
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.

LGTM.
A tip: Please avoid to force push after someone has already reviewed PR. This makes it difficult for reviewers to track.

@CountBleck
Copy link
MemberAuthor

@HerrCai0907 I changed the commit message; this is technically a breaking change.

romdotdog and msqr1 reacted with thumbs down emoji

@HerrCai0907
Copy link
Member

@HerrCai0907 I changed the commit message; this is technically a breaking change.

You can modify it when click squash and merge😆 . Actually the message in commit is meaningless.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@HerrCai0907HerrCai0907HerrCai0907 approved these changes

@dcodeIOdcodeIOAwaiting requested review from dcodeIO

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

as crash when try to alloc large data
3 participants
@CountBleck@dcodeIO@HerrCai0907

[8]ページ先頭

©2009-2025 Movatter.jp