-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
NativeAOT: Type is not pre-initialized #83043
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch, @kunalspathak Issue Detailsinternal class Program
{
struct MyStruct
{
public string Name;
}
static readonly MyStruct MyStr = new() { Name = "Hey!" };
[MethodImpl(MethodImplOptions.NoInlining)]
static MyStruct Test() => MyStr;
} Codegen for ; Method Program:Test():Program+MyStruct
G_M41189_IG01: ;; offset=0000H
4883EC28 sub rsp, 40
G_M41189_IG02: ;; offset=0004H
E800000000 call CORINFO_HELP_READYTORUN_GCSTATIC_BASE
488B4010 mov rax, gword ptr [rax+10H]
G_M41189_IG03: ;; offset=000DH
4883C428 add rsp, 40
C3 ret
; Total bytes of code: 18 It seems that
|
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue Detailsinternal class Program
{
struct MyStruct
{
public string Name;
}
static readonly MyStruct MyStr = new() { Name = "Hey!" };
[MethodImpl(MethodImplOptions.NoInlining)]
static MyStruct Test() => MyStr;
} Codegen for ; Method Program:Test():Program+MyStruct
G_M41189_IG01: ;; offset=0000H
4883EC28 sub rsp, 40
G_M41189_IG02: ;; offset=0004H
E800000000 call CORINFO_HELP_READYTORUN_GCSTATIC_BASE
488B4010 mov rax, gword ptr [rax+10H]
G_M41189_IG03: ;; offset=000DH
4883C428 add rsp, 40
C3 ret
; Total bytes of code: 18 It seems that
|
Value types are represented as byte arrays within the interpreter. It's hard to add object references to it. The features the interpreter supports follow the pareto principle. |
Similar issue for initialization of reference types: #82993 |
Codegen for
Test()
:It seems that
_compilation.HasLazyStaticConstructor(field.OwningType)
returns true forProgram
soMyStr
field is not pre-computed despite being a simple struct + frozen string literal.cc @MichalStrehovsky
The text was updated successfully, but these errors were encountered: