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

[compiler] Use code tuple size to decide whether to create an InsertF… #12760

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

tpoterba
Copy link
Contributor

@tpoterba tpoterba commented Mar 7, 2023

…ieldsStruct or pointer

@@ -110,7 +110,7 @@ trait SBaseStructValue extends SValue {
}

def insert(cb: EmitCodeBuilder, region: Value[Region], newType: TStruct, fields: (String, EmitValue)*): SBaseStructValue = {
if (newType.size < 64 || fields.length < 16)
if (st.settableTupleTypes().length + fields.map(_._2.emitType.settableTupleTypes.length).sum < 64)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Besides changing to measure struct size by code tuple size, this also changes from "new struct is small, or added fields are small" to just "new struct is small". Can you explain that change? Do we not want to use an InsertFieldsStruct when adding a few fields to a big struct? (Actually, why does the size of the original struct matter at all?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The original behavior was really intended to control the settable tuple size, but obviously ineffectively. We don't have a way to call methods where the scode args have more than 255 code members right now, and the general fix is to support that, but I don't know when we'll get to that. Leo's hitting an issue where encoder methods have too many params: #12533 #12532 #12531

Copy link
Collaborator

Choose a reason for hiding this comment

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

Makes sense, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good question, should have clarified the reason in the initial comment!

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