Skip to content
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

Large numbers of Pinvoke stubs created on startup #22212

Closed
benaadams opened this issue Jan 25, 2019 · 7 comments

Comments

@benaadams
Copy link
Collaborator

commented Jan 25, 2019

Using checked Jit and JitDasm (on Windows)

set COMPlus_JitDisasm=*

This program on current .NET Core 3.0

public class Program
{
    public static void Main(string[] args)
    {
        Console.WriteLine("Hello World!");
    }
}

Outputs 27 ILStubClass:IL_STUB_PInvoke

; Assembly listing for method ILStubClass:IL_STUB_PInvoke(struct,struct,bool)
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(struct,long,int,struct)
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(long,long,long)
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(struct)
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(ref,bool,struct)
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(ref,struct)
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(ref,struct)
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(ref,byref,byref,byref,byref)
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(ref,byref):bool
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(ref,long,int):int
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(ref):int
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(ref):int
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(ref,byref,byref)
; Assembly listing for method ILStubClass:IL_STUB_PInvoke():int
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(byref,int,byref,long):int
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(int,byref):bool
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(ref,int,byref):bool
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(long,int,ubyte):long
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(byref,int,long):bool
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(byref):bool
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(int,int):ref
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(int):long
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(long,long,int,byref,long):int
; Assembly listing for method ILStubClass:IL_STUB_PInvoke():int
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(long):int
; Assembly listing for method ILStubClass:IL_STUB_PInvoke():bool
; Assembly listing for method ILStubClass:IL_STUB_PInvoke(ref,int,long,int):int

Not sure if this is expected, am sure it was less?

/cc @jkotas

Is it Tiered Jit related? /cc @kouvel

@benaadams

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 25, 2019

Looks like it was 5 IL_STUB_PInvoke previously on Windows rather than 27 (according to this issue #13129) /cc @AndyAyersMS

@jkotas

This comment has been minimized.

Copy link
Member

commented Jan 25, 2019

This is side-effect of #21497. The PInvoke stubs are on the list of follow-up work. cc @fadimounir

@sandreenko

This comment has been minimized.

Copy link
Member

commented Jan 25, 2019

#22077 looks like the same issue.

@jkotas

This comment has been minimized.

Copy link
Member

commented Jan 25, 2019

#22077 looks like the same issue.

Why do you think so? A method takes between ~0.1ms to compile on fast hardware and 1ms on slow hardware. So the times you are talking about here are between 5ms and 50ms. Orders of magnitude different from the times in #22077.

@sandreenko

This comment has been minimized.

Copy link
Member

commented Jan 25, 2019

Why do you think so? A method takes between ~0.1ms to compile on fast hardware and 1ms on slow hardware. So the times you are talking about here are between 5ms and 50ms. Orders of magnitude different from the times in #22077.

Answered in #22077 (in case if this is a different issue).

@AndyAyersMS

This comment has been minimized.

Copy link
Member

commented Jan 25, 2019

Stubs are pretty small, I would not expect having to jit a few more to matter very much.

Also don't CoreFX tests all run in one process (or maybe a handful of processes at best)? If so presumably any "fixed cost" jit overhead washes out.

@fadimounir

This comment has been minimized.

Copy link
Member

commented Apr 19, 2019

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.