-
Notifications
You must be signed in to change notification settings - Fork 754
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
[Task]: Generate new typedesc
instruction for record and tuple when type descriptor
resolving
#38844
[Task]: Generate new typedesc
instruction for record and tuple when type descriptor
resolving
#38844
Comments
new typedesc
instruction for record when typedesc
resolvingnew typedesc
instruction for record and tuple when type descriptor
resolving
Changes are done. 13 jballerina unit tests are filing ATM. Will send a PR soon. Below are some failing cases.
public function main() {
var input = [{name: "Saman", price: 11}];
record {|string name; int price;|}[][] res = from var {name} in input group by name
select from var {price} in input
select {name, price};
// the issue here is we create several lambda functions for the query expression and those functions
// do not have the typedesc in local variables. it seems typedesc need to be passed as a closure for those
}
|
Large method issue is due to how we create typedesc statements from the Desugar. Consider the below sample. public function main() {
[record {|string name; int age;|}, record {|string name; int age;|}, record {|string name; int age;|}] a = [{name: "apple", age: 1}, {name: "apple", age: 1}, {name: "apple", age: 1}];
} Before BIR(note the %5 is reused to create typedesc vars for all the three record types) %1(LOCAL) ($anonType$_0, $anonType$_1, $anonType$_2); bb0 { After BIRWith the typedesc creation from the Desugar phase we define the typedesc at the beginning of the block. Hence he variables cannot be reused. When there is very large tuple than the one in the sample, this will cause the method to large error
%7(SYNTHETIC) typeDesc<($anonType$_0, $anonType$_1, $anonType$_2)>; bb0 {
%7 = newType ($anonType$_0, $anonType$_1, $anonType$_2); |
Another reson that could cause large method error Consider the below sample public function main() {
[record {||}, record {||}] a = [{}, {}];
a = [{}, {}];
} We will generate local type desc statements for the above anonymous type. Consider the below BIR Dump.
When there is a large method and we try to split it. We can Just take the L#12 - L#18 to a separate function sice when we are creating a new value from that type again, we will need the %1, %2, %3. Because of that we need to pass those as arguments to the split function. When there are more than 125 arguments we dont split the method. So with this change there can be such cases where the split did not happen due to large number of arguments. Currently the limit is increased upto 220. Max is 225. Previously this did not happen becasue we create duplicate typedesc instructions for the second array literal. This does not happen for types which has a type definition since the type desc var is global |
Large method issues were fixed by Compress arguments into a tuple if the split method contains large number of args |
Description
In the current implementation, new typedesc instruction generates when value is created.
When considering the following example. we create two new typedesc instructions for
record{int k = 10;}
type.Describe your task(s)
No response
Related area
-> Compilation
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response
The text was updated successfully, but these errors were encountered: