-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WASM] Add clinit to factories instead of ctors
Currently we inject clinit calls to ctor functions however they are not the external entry points. They are either called from factories or child class (child class is already guaranteed to call clinit). This patch generate these calls in factory methods instead. This also simplifies the optimization of clinit calls when cycles exists between constructors and static fields (like Enums). PiperOrigin-RevId: 582048512
- Loading branch information
1 parent
7f10820
commit 4721673
Showing
164 changed files
with
1,298 additions
and
1,446 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,6 +158,8 @@ | |
;;@ abstractinnerclass/InnerClasses.java:18:13 | ||
(local $$instance (ref null $abstractinnerclass.InnerClasses)) | ||
(block | ||
;;@ abstractinnerclass/InnerClasses.java:18:13 | ||
(call [email protected] ) | ||
;;@ abstractinnerclass/InnerClasses.java:18:13 | ||
(local.set $$instance (struct.new $abstractinnerclass.InnerClasses (ref.as_non_null (global.get $abstractinnerclass.InnerClasses.vtable)) (ref.as_non_null (global.get $itable.empty)) (i32.const 0))) | ||
;;@ abstractinnerclass/InnerClasses.java:18:13 | ||
|
@@ -172,8 +174,6 @@ | |
(param $this (ref null $abstractinnerclass.InnerClasses)) | ||
;;@ abstractinnerclass/InnerClasses.java:18:13 | ||
(block | ||
;;@ abstractinnerclass/InnerClasses.java:18:13 | ||
(call [email protected] ) | ||
;;@ abstractinnerclass/InnerClasses.java:18:13 | ||
(call [email protected] (ref.as_non_null (local.get $this))) | ||
) | ||
|
@@ -243,8 +243,6 @@ | |
(param $this (ref null $abstractinnerclass.InnerClasses.B)) | ||
;;@ abstractinnerclass/InnerClasses.java:23:24 | ||
(block | ||
;;@ abstractinnerclass/InnerClasses.java:23:24 | ||
(call [email protected] ) | ||
;;@ abstractinnerclass/InnerClasses.java:23:24 | ||
(call [email protected] (ref.as_non_null (local.get $this))) | ||
) | ||
|
@@ -316,8 +314,6 @@ | |
(param $$outer_this (ref null $abstractinnerclass.InnerClasses)) | ||
;;@ abstractinnerclass/InnerClasses.java:29:17 | ||
(block | ||
;;@ abstractinnerclass/InnerClasses.java:29:17 | ||
(call [email protected] ) | ||
;;@ abstractinnerclass/InnerClasses.java:29:17 | ||
(struct.set $abstractinnerclass.InnerClasses.C $$outer_this__abstractinnerclass_InnerClasses_C (local.get $this) (local.get $$outer_this)) | ||
;;@ abstractinnerclass/InnerClasses.java:29:17 | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,8 +91,6 @@ | |
(param $this (ref null $abstractinterfaceimpl.AbstractInterfaceImpl)) | ||
;;@ abstractinterfaceimpl/AbstractInterfaceImpl.java:22:22 | ||
(block | ||
;;@ abstractinterfaceimpl/AbstractInterfaceImpl.java:22:22 | ||
(call [email protected] ) | ||
;;@ abstractinterfaceimpl/AbstractInterfaceImpl.java:22:22 | ||
(call [email protected] (ref.as_non_null (local.get $this))) | ||
) | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -294,6 +294,8 @@ | |
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:18:13 | ||
(local $$instance (ref null $abstractmethodoverridedefault.AbstractMethodOverrideDefault)) | ||
(block | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:18:13 | ||
(call $$clinit__void@abstractmethodoverridedefault.AbstractMethodOverrideDefault ) | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:18:13 | ||
(local.set $$instance (struct.new $abstractmethodoverridedefault.AbstractMethodOverrideDefault (ref.as_non_null (global.get $abstractmethodoverridedefault.AbstractMethodOverrideDefault.vtable)) (ref.as_non_null (global.get $itable.empty)) (i32.const 0))) | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:18:13 | ||
|
@@ -308,8 +310,6 @@ | |
(param $this (ref null $abstractmethodoverridedefault.AbstractMethodOverrideDefault)) | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:18:13 | ||
(block | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:18:13 | ||
(call $$clinit__void@abstractmethodoverridedefault.AbstractMethodOverrideDefault ) | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:18:13 | ||
(call [email protected] (ref.as_non_null (local.get $this))) | ||
) | ||
|
@@ -379,8 +379,6 @@ | |
(param $this (ref null $abstractmethodoverridedefault.AbstractMethodOverrideDefault.A)) | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:31:24 | ||
(block | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:31:24 | ||
(call $$clinit__void@abstractmethodoverridedefault.AbstractMethodOverrideDefault.A ) | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:31:24 | ||
(call [email protected] (ref.as_non_null (local.get $this))) | ||
) | ||
|
@@ -453,8 +451,6 @@ | |
(param $this (ref null $abstractmethodoverridedefault.AbstractMethodOverrideDefault.B)) | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:36:24 | ||
(block | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:36:24 | ||
(call $$clinit__void@abstractmethodoverridedefault.AbstractMethodOverrideDefault.B ) | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:36:24 | ||
(call $$ctor__void_$p_abstractmethodoverridedefault_AbstractMethodOverrideDefault_A@abstractmethodoverridedefault.AbstractMethodOverrideDefault.A (ref.as_non_null (local.get $this))) | ||
) | ||
|
@@ -535,6 +531,8 @@ | |
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:46:15 | ||
(local $$instance (ref null $abstractmethodoverridedefault.AbstractMethodOverrideDefault.C)) | ||
(block | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:46:15 | ||
(call $$clinit__void@abstractmethodoverridedefault.AbstractMethodOverrideDefault.C ) | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:46:15 | ||
(local.set $$instance (struct.new $abstractmethodoverridedefault.AbstractMethodOverrideDefault.C (ref.as_non_null (global.get $abstractmethodoverridedefault.AbstractMethodOverrideDefault.C.vtable)) (ref.as_non_null (global.get $abstractmethodoverridedefault.AbstractMethodOverrideDefault.C.itable)) (i32.const 0))) | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:46:15 | ||
|
@@ -549,8 +547,6 @@ | |
(param $this (ref null $abstractmethodoverridedefault.AbstractMethodOverrideDefault.C)) | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:46:15 | ||
(block | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:46:15 | ||
(call $$clinit__void@abstractmethodoverridedefault.AbstractMethodOverrideDefault.C ) | ||
;;@ abstractmethodoverridedefault/AbstractMethodOverrideDefault.java:46:15 | ||
(call $$ctor__void_$p_abstractmethodoverridedefault_AbstractMethodOverrideDefault_A@abstractmethodoverridedefault.AbstractMethodOverrideDefault.A (ref.as_non_null (local.get $this))) | ||
) | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -219,6 +219,8 @@ | |
;;@ accidentaloverride/AccidentalOverride.java:18:6 | ||
(local $$instance (ref null $accidentaloverride.Parent)) | ||
(block | ||
;;@ accidentaloverride/AccidentalOverride.java:18:6 | ||
(call [email protected] ) | ||
;;@ accidentaloverride/AccidentalOverride.java:18:6 | ||
(local.set $$instance (struct.new $accidentaloverride.Parent (ref.as_non_null (global.get $accidentaloverride.Parent.vtable)) (ref.as_non_null (global.get $itable.empty)) (i32.const 0))) | ||
;;@ accidentaloverride/AccidentalOverride.java:18:6 | ||
|
@@ -233,8 +235,6 @@ | |
(param $this (ref null $accidentaloverride.Parent)) | ||
;;@ accidentaloverride/AccidentalOverride.java:18:6 | ||
(block | ||
;;@ accidentaloverride/AccidentalOverride.java:18:6 | ||
(call [email protected] ) | ||
;;@ accidentaloverride/AccidentalOverride.java:18:6 | ||
(call [email protected] (ref.as_non_null (local.get $this))) | ||
) | ||
|
@@ -318,6 +318,8 @@ | |
;;@ accidentaloverride/AccidentalOverride.java:31:6 | ||
(local $$instance (ref null $accidentaloverride.AnotherAccidentalOverride)) | ||
(block | ||
;;@ accidentaloverride/AccidentalOverride.java:31:6 | ||
(call [email protected] ) | ||
;;@ accidentaloverride/AccidentalOverride.java:31:6 | ||
(local.set $$instance (struct.new $accidentaloverride.AnotherAccidentalOverride (ref.as_non_null (global.get $accidentaloverride.AnotherAccidentalOverride.vtable)) (ref.as_non_null (global.get $accidentaloverride.AnotherAccidentalOverride.itable)) (i32.const 0))) | ||
;;@ accidentaloverride/AccidentalOverride.java:31:6 | ||
|
@@ -332,8 +334,6 @@ | |
(param $this (ref null $accidentaloverride.AnotherAccidentalOverride)) | ||
;;@ accidentaloverride/AccidentalOverride.java:31:6 | ||
(block | ||
;;@ accidentaloverride/AccidentalOverride.java:31:6 | ||
(call [email protected] ) | ||
;;@ accidentaloverride/AccidentalOverride.java:31:6 | ||
(call $$ctor__void_$p_accidentaloverride_Parent@accidentaloverride.Parent (ref.as_non_null (local.get $this))) | ||
) | ||
|
@@ -434,6 +434,8 @@ | |
;;@ accidentaloverride/AccidentalOverride.java:41:13 | ||
(local $$instance (ref null $accidentaloverride.AccidentalOverride)) | ||
(block | ||
;;@ accidentaloverride/AccidentalOverride.java:41:13 | ||
(call [email protected] ) | ||
;;@ accidentaloverride/AccidentalOverride.java:41:13 | ||
(local.set $$instance (struct.new $accidentaloverride.AccidentalOverride (ref.as_non_null (global.get $accidentaloverride.AccidentalOverride.vtable)) (ref.as_non_null (global.get $accidentaloverride.AccidentalOverride.itable)) (i32.const 0))) | ||
;;@ accidentaloverride/AccidentalOverride.java:41:13 | ||
|
@@ -448,8 +450,6 @@ | |
(param $this (ref null $accidentaloverride.AccidentalOverride)) | ||
;;@ accidentaloverride/AccidentalOverride.java:41:13 | ||
(block | ||
;;@ accidentaloverride/AccidentalOverride.java:41:13 | ||
(call [email protected] ) | ||
;;@ accidentaloverride/AccidentalOverride.java:41:13 | ||
(call $$ctor__void_$p_accidentaloverride_Parent@accidentaloverride.Parent (ref.as_non_null (local.get $this))) | ||
) | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,6 +182,8 @@ | |
;;@ annotation/Main.java:18:13 | ||
(local $$instance (ref null $annotation.Main)) | ||
(block | ||
;;@ annotation/Main.java:18:13 | ||
(call [email protected] ) | ||
;;@ annotation/Main.java:18:13 | ||
(local.set $$instance (struct.new $annotation.Main (ref.as_non_null (global.get $annotation.Main.vtable)) (ref.as_non_null (global.get $itable.empty)) (i32.const 0))) | ||
;;@ annotation/Main.java:18:13 | ||
|
@@ -196,8 +198,6 @@ | |
(param $this (ref null $annotation.Main)) | ||
;;@ annotation/Main.java:18:13 | ||
(block | ||
;;@ annotation/Main.java:18:13 | ||
(call [email protected] ) | ||
;;@ annotation/Main.java:18:13 | ||
(call [email protected] (ref.as_non_null (local.get $this))) | ||
) | ||
|
@@ -269,6 +269,8 @@ | |
;;@ annotation/Main.java:30:8 | ||
(local $$instance (ref null $annotation.Main.Bar)) | ||
(block | ||
;;@ annotation/Main.java:30:8 | ||
(call [email protected] ) | ||
;;@ annotation/Main.java:30:8 | ||
(local.set $$instance (struct.new $annotation.Main.Bar (ref.as_non_null (global.get $annotation.Main.Bar.vtable)) (ref.as_non_null (global.get $itable.empty)) (i32.const 0) (ref.null $annotation.Main))) | ||
;;@ annotation/Main.java:30:8 | ||
|
@@ -284,8 +286,6 @@ | |
(param $$outer_this (ref null $annotation.Main)) | ||
;;@ annotation/Main.java:30:8 | ||
(block | ||
;;@ annotation/Main.java:30:8 | ||
(call [email protected] ) | ||
;;@ annotation/Main.java:30:8 | ||
(struct.set $annotation.Main.Bar $$outer_this__annotation_Main_Bar (local.get $this) (local.get $$outer_this)) | ||
;;@ annotation/Main.java:30:8 | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -251,8 +251,6 @@ | |
(param $i i32) | ||
;;@ anonymousclass/AnonymousClass.java:21:2 | ||
(block | ||
;;@ anonymousclass/AnonymousClass.java:21:19 | ||
(call [email protected] ) | ||
;;@ anonymousclass/AnonymousClass.java:21:19 | ||
(call [email protected] (ref.as_non_null (local.get $this))) | ||
) | ||
|
@@ -310,8 +308,6 @@ | |
(param $i i32) | ||
;;@ anonymousclass/AnonymousClass.java:27:2 | ||
(block | ||
;;@ anonymousclass/AnonymousClass.java:27:36 | ||
(call [email protected] ) | ||
;;@ anonymousclass/AnonymousClass.java:27:36 | ||
(call [email protected] (ref.as_non_null (local.get $this))) | ||
) | ||
|
@@ -378,6 +374,8 @@ | |
;;@ anonymousclass/AnonymousClass.java:32:13 | ||
(local $$instance (ref null $anonymousclass.AnonymousClass)) | ||
(block | ||
;;@ anonymousclass/AnonymousClass.java:32:13 | ||
(call [email protected] ) | ||
;;@ anonymousclass/AnonymousClass.java:32:13 | ||
(local.set $$instance (struct.new $anonymousclass.AnonymousClass (ref.as_non_null (global.get $anonymousclass.AnonymousClass.vtable)) (ref.as_non_null (global.get $itable.empty)) (i32.const 0) (i32.const 0))) | ||
;;@ anonymousclass/AnonymousClass.java:32:13 | ||
|
@@ -392,8 +390,6 @@ | |
(param $this (ref null $anonymousclass.AnonymousClass)) | ||
;;@ anonymousclass/AnonymousClass.java:32:13 | ||
(block | ||
;;@ anonymousclass/AnonymousClass.java:32:13 | ||
(call [email protected] ) | ||
;;@ anonymousclass/AnonymousClass.java:32:13 | ||
(call [email protected] (ref.as_non_null (local.get $this))) | ||
) | ||
|
@@ -484,6 +480,8 @@ | |
;;@ anonymousclass/AnonymousClass.java:37:25 | ||
(local $$instance (ref null $anonymousclass.AnonymousClass.1)) | ||
(block | ||
;;@ anonymousclass/AnonymousClass.java:37:25 | ||
(call [email protected] ) | ||
;;@ anonymousclass/AnonymousClass.java:37:25 | ||
(local.set $$instance (struct.new $anonymousclass.AnonymousClass.1 (ref.as_non_null (global.get $anonymousclass.AnonymousClass.1.vtable)) (ref.as_non_null (global.get $itable.empty)) (i32.const 0) (ref.null $anonymousclass.AnonymousClass) (ref.null $java.lang.Object) (ref.null $java.lang.Object))) | ||
;;@ anonymousclass/AnonymousClass.java:37:25 | ||
|
@@ -500,8 +498,6 @@ | |
(param $$_0 i32) | ||
;;@ anonymousclass/AnonymousClass.java:37:25 | ||
(block | ||
;;@ anonymousclass/AnonymousClass.java:37:25 | ||
(call [email protected] ) | ||
;;@ anonymousclass/AnonymousClass.java:37:25 | ||
(struct.set $anonymousclass.AnonymousClass.1 $$outer_this__anonymousclass_AnonymousClass_1 (local.get $this) (local.get $$outer_this)) | ||
;;@ anonymousclass/AnonymousClass.java:37:25 | ||
|
@@ -618,6 +614,8 @@ | |
;;@ anonymousclass/AnonymousClass.java:48:42 | ||
(local $$instance (ref null $anonymousclass.AnonymousClass.2)) | ||
(block | ||
;;@ anonymousclass/AnonymousClass.java:48:42 | ||
(call [email protected] ) | ||
;;@ anonymousclass/AnonymousClass.java:48:42 | ||
(local.set $$instance (struct.new $anonymousclass.AnonymousClass.2 (ref.as_non_null (global.get $anonymousclass.AnonymousClass.2.vtable)) (ref.as_non_null (global.get $itable.empty)) (i32.const 0) (ref.null $anonymousclass.AnonymousClass) (ref.null $java.lang.Object) (ref.null $java.lang.Object))) | ||
;;@ anonymousclass/AnonymousClass.java:48:42 | ||
|
@@ -634,8 +632,6 @@ | |
(param $$_0 i32) | ||
;;@ anonymousclass/AnonymousClass.java:48:42 | ||
(block | ||
;;@ anonymousclass/AnonymousClass.java:48:42 | ||
(call [email protected] ) | ||
;;@ anonymousclass/AnonymousClass.java:48:42 | ||
(struct.set $anonymousclass.AnonymousClass.2 $$outer_this__anonymousclass_AnonymousClass_2 (local.get $this) (local.get $$outer_this)) | ||
;;@ anonymousclass/AnonymousClass.java:48:42 | ||
|
@@ -738,6 +734,8 @@ | |
;;@ anonymousclass/AnonymousClass.java:61:23 | ||
(local $$instance (ref null $anonymousclass.SomeInterface.1)) | ||
(block | ||
;;@ anonymousclass/AnonymousClass.java:61:23 | ||
(call [email protected] ) | ||
;;@ anonymousclass/AnonymousClass.java:61:23 | ||
(local.set $$instance (struct.new $anonymousclass.SomeInterface.1 (ref.as_non_null (global.get $anonymousclass.SomeInterface.1.vtable)) (ref.as_non_null (global.get $itable.empty)) (i32.const 0))) | ||
;;@ anonymousclass/AnonymousClass.java:61:23 | ||
|
@@ -753,8 +751,6 @@ | |
(param $$_0 i32) | ||
;;@ anonymousclass/AnonymousClass.java:61:23 | ||
(block | ||
;;@ anonymousclass/AnonymousClass.java:61:23 | ||
(call [email protected] ) | ||
;;@ anonymousclass/AnonymousClass.java:61:23 | ||
(call $$ctor__int__void_$p_anonymousclass_SomeClass@anonymousclass.SomeClass (ref.as_non_null (local.get $this))(local.get $$_0)) | ||
) | ||
|
Oops, something went wrong.