Repository navigation
runtime: ignore blank fields when comparing structs in interfaces - #5880
Open
davecheney wants to merge 1 commit into
Open
davecheney wants to merge 1 commit into
davecheney wants to merge 1 commit into
Conversation
davecheney
marked this pull request as draft
October 14, 2026 12:28
davecheney
added a commit
to davecheney/tinygo
that referenced
this pull request
Oct 14, 2026
…data The blank-field equality fix in PR tinygo-org#5880 used Field to check each field name. That call returned metadata that the comparison did not need and increased stack use enough to cause a stack overflow on AVR. A field name lookup should not require the same stack space as a full metadata lookup. Keep this prerequisite separate from the equality fix so each change can be reviewed on its own. This commit does not change interface equality. The runtime caller and its equality regression tests remain separate work.
davecheney
force-pushed
the
fix-blank-field-interface-equal
branch
from
October 14, 2026 14:45
7833b4d to
aaf1cb5
Compare
davecheney
force-pushed
the
fix-blank-field-interface-equal
branch
from
October 14, 2026 14:48
aaf1cb5 to
8e3bc78
Compare
davecheney
force-pushed
the
fix-blank-field-interface-equal
branch
from
October 14, 2026 14:56
8e3bc78 to
e865bdb
Compare
The Go spec says that two struct values are equal if their corresponding non-blank fields are equal. The compiler already skips blank fields for a direct struct comparison, but the runtime compared all fields when the struct values were held in interfaces. This came from the upstream test/blank.go test, where two struct values that differ only in a blank field compared as not equal.
davecheney
force-pushed
the
fix-blank-field-interface-equal
branch
from
October 18, 2026 01:38
e865bdb to
bc49622
Compare
davecheney
marked this pull request as ready for review
October 18, 2026 01:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Go spec says that two struct values are equal if their corresponding non-blank fields are equal. The compiler already skips blank fields for a direct struct comparison, but the runtime compared all fields when the struct values were held in interfaces. This came from the upstream test/blank.go test, where two struct values that differ only in a blank field compared as not equal.
The struct comparison in the runtime is recursive and gets the name of each field from RawType.Field. Before #5884, TestBuild/AVR/interface.go failed with "goroutine stack overflow" on the 384-byte simavr goroutine stack. #5884 has merged and this PR is rebased on dev.
RawType.Field still allocates its one-element Index slice, so each struct field in an interface comparison causes one allocation. If this is a problem, a separate change can remove it.