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

Use jit interface thunkgen tech for more files #45044

Merged
merged 3 commits into from
Dec 2, 2020

Conversation

davidwrighton
Copy link
Member

@davidwrighton davidwrighton commented Nov 21, 2020

  • Reduce the boilerplate logic when modifying the jit ee interface
  • 3 new files in superpmi are now autogenerated as well as 2 files in the jit directory are now autogenerated
  • Reduce to only having one copy of the jit-ee interface guid

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 21, 2020
@davidwrighton
Copy link
Member Author

@dotnet/jit-contrib

Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

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

Thanks! I had been thinking we should do something like this for a long time.

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

// DO NOT EDIT THIS FILE! It IS AUTOGENERATED
Copy link
Member

Choose a reason for hiding this comment

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

Can you leave breadcrumbs here and in the other newly auto-generated files to hiht at how they can be regenerated?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, please include pointers to the instructions for re-generation

Copy link
Member

Choose a reason for hiding this comment

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

@AndyAyersMS
Copy link
Member

@BruceForstall @sandreenko think you should look this over too.

@jkotas
Copy link
Member

jkotas commented Nov 21, 2020

Unfortunately requires compiling the libjitinterface with the PAL

Why is that? That's very unfortunate.

I think depending on the PAL headers would be ok, but it would be really nice to avoid linking with the PAL. I was hoping that the number of places we link the PAL will decrease over time...

Copy link
Member

@BruceForstall BruceForstall left a comment

Choose a reason for hiding this comment

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

This should make updating the JIT-EE interface easier, which is much appreciated.

{
tw.Write($"\n{decl.ReturnType.NativeTypeName} WrapICorJitInfo::{ decl.FunctionName}(");
bool isFirst = true;
foreach (Parameter param in decl.Parameters)
Copy link
Member

Choose a reason for hiding this comment

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

nit? Looks like you could save lots of duplicated code by extracting a function to output function signatures, and function argument call lists

WriteManagedThunkInterface(tw, functions);
}
using (TextWriter tw = new StreamWriter(args[2]))

Copy link
Member

Choose a reason for hiding this comment

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

Seems like you should have at least minimal argument validation here, like checking the number of arguments, and a "usage" message that would also serve as a short description of what this tool is doing.

Copy link
Contributor

@sandreenko sandreenko left a comment

Choose a reason for hiding this comment

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

looks good, I like the simplified jit ee interface changes.

@@ -1,4 +1,4 @@
pushd %~dp0
call ..\..\..\..\..\..\..\dotnet.cmd run -- ThunkInput.txt ..\CorInfoBase.cs ..\..\..\aot\jitinterface\jitinterface.h
call ..\..\..\..\..\..\..\dotnet.cmd run -- ThunkInput.txt ..\CorInfoBase.cs ..\..\..\aot\jitinterface\jitinterface.h ..\..\..\..\jit\ICorJitInfo_API_names.h ..\..\..\..\jit\ICorJitInfo_API_wrapper.hpp ..\..\..\..\ToolBox\superpmi\superpmi-shared\icorjitinfoimpl.h ..\..\..\..\ToolBox\superpmi\superpmi-shim-counter\icorjitinfo.cpp ..\..\..\..\ToolBox\superpmi\superpmi-shim-simple\icorjitinfo.cpp
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: name these paths like ..\..\..\..\..\..\..\ etc?

@@ -9,17 +9,17 @@ typedef char16_t WCHAR;
typedef wchar_t WCHAR;
#endif

class CorInfoException
Copy link
Contributor

Choose a reason for hiding this comment

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

question: why was it renamed?

Copy link
Member Author

Choose a reason for hiding this comment

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

CorInfoException is an enum type in corinfo.h

- Removes duplicate copy of jit ee api version guid
- Sets up for making jit interface wrapper actually implement the jit interface

Update generater to match previous manual modification

Use ICorJitInfo interface for jit thunk directly instead of relying on parallel definition to match up
- Found a bug in handling of TryResolveToken

Generate api names

Generate jit api wrapper from thunk generator

Generate icorjitinfoimpl.h

spmi counter shim icorjitinfo

superpmi-shim-simple

Update linux script

Fix utf8 char out marshalling

Builds on Linux but doesn't work

Compile with PAL

Respond to code review feedback
@davidwrighton
Copy link
Member Author

Updated with code review feedback. I've stepped back from requiring the PAL, as that was causing odd problems. I may address that in a future change.

}
virtual unsigned int getMethodAttribs(
void* ftn)
{
Copy link
Member

Choose a reason for hiding this comment

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

Nit: The indentation is off.

Copy link
Member Author

Choose a reason for hiding this comment

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

The generator is ugly enough as it is. Unless there is pushback, I'd prefer to leave the indentation.

Copy link
Member

@BruceForstall BruceForstall left a comment

Choose a reason for hiding this comment

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

A few comment-related comments

@@ -0,0 +1,28 @@

Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this file also need a license notice?

0x65a1,
0x487a,
{0x85, 0x53, 0xc8, 0x45, 0x49, 0x6d, 0xa9, 0x01}
};
Copy link
Member

Choose a reason for hiding this comment

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

nit: missing trailing end-of-line character?

{0x85, 0x53, 0xc8, 0x45, 0x49, 0x6d, 0xa9, 0x01}
};

#include "jiteeversionguid.h"
//////////////////////////////////////////////////////////////////////////////////////////////////////////
Copy link
Member

Choose a reason for hiding this comment

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

Seems like the "END JITEEVersionIdentifier" comment needs to be in the jiteeversionguid.h file.

We probably should have big, unmiss-able, comments at the top of all the JIT-EE interface files pointing to the JIT-EE version, but that's somewhat unrelated; this system only works when code reviewers know to ask for an interface GUID change.

Maybe the jiteeversionguid.h file should also point to the updating-jitinterface.md documentation.

@davidwrighton davidwrighton merged commit e9a47b7 into dotnet:master Dec 2, 2020
BruceForstall added a commit to BruceForstall/runtime that referenced this pull request Dec 4, 2020
With dotnet#45044 it moved from corinfo.h to jiteeversionguid.h
BruceForstall added a commit to BruceForstall/runtime that referenced this pull request Dec 4, 2020
With dotnet#45044 it moved from corinfo.h to jiteeversionguid.h
BruceForstall added a commit that referenced this pull request Dec 4, 2020
jkotas pushed a commit that referenced this pull request Dec 4, 2020
With #45044 it moved from corinfo.h to jiteeversionguid.h
@ghost ghost locked as resolved and limited conversation to collaborators Jan 1, 2021
@davidwrighton davidwrighton deleted the better_thunk_gen branch April 20, 2021 17:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants