[compiler] Use code tuple size to decide whether to create an InsertF…#12760
Conversation
…ieldsStruct or pointer
|
|
||
| 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) |
There was a problem hiding this comment.
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?)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
good question, should have clarified the reason in the initial comment!
…ieldsStruct or pointer