Skip to content

[Master] Generate new typedesc instruction for record and tuple when type descriptor resolving #43596

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

Open
wants to merge 120 commits into
base: master
Choose a base branch
from

Conversation

rdulmina
Copy link
Contributor

@rdulmina rdulmina commented Nov 18, 2024

Purpose

In this PR, I have generated a new 'typedesc' (type descriptor) only once for the tuple and record.
For example:

type Foo record {||};
public function main() {
    Foo f = {};
    record {|int a;|} r = {a: 1};
}

We have desugared the above program as follows:

type Foo record {||};
typedesc<Foo> $typedesc$Foo = Foo;
public function main() {
    Foo f = {};
    typedesc<record {| int a; |}> $typedesc$$anonType$_0 = record {| int a; |}
    record {|int a;|} r = {a: 1};
}

We then use the generated 'typedesc' when creating a map value using that type.

Fixes #38844, #41946, #43311, #43715, #43741

chiranSachintha and others added 30 commits August 16, 2024 17:05
Add closures before the dependent node in the top-level node list in `ClosureGenerator.java`
Exclude field generation for typedesc when generating fields for user defined types since those fields will be generated when visiting global variables
Add typedesc statement before the var declaration in the init function body
Copy link

sonarqubecloud bot commented Jan 8, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@rdulmina rdulmina force-pushed the typeDesc-stmt branch 2 times, most recently from 4b7e401 to d06359f Compare April 25, 2025 02:34
@@ -120,6 +120,12 @@ jobs:
done
shell: bash

# - name: Checkout non-default branch
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lets keep this commented since we frequently need this to be enabled

@@ -0,0 +1,227 @@
================ Emitting Module ================
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this is the assert file for TypeDescBIRTest

Copy link
Contributor

@ravinperera00 ravinperera00 left a comment

Choose a reason for hiding this comment

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

Some minor suggestions

Address review suggestions and do type constraint equality check to identity the typedesc in different packages
@rdulmina rdulmina requested a review from gimantha May 9, 2025 06:25
Copy link

sonarqubecloud bot commented May 9, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Generate new typedesc instruction for record and tuple when type descriptor resolving
6 participants