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

Report RhpInitialDynamicInterfaceDispatch reference in gfids #103948

Merged
merged 5 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/coreclr/jit/hwintrinsicxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,17 +267,17 @@ static CORINFO_InstructionSet lookupInstructionSet(const char* className)
{
if (strncmp(className + 6, "128", 3) == 0)
{
assert((className[9] == '\0') || (strcmp(className + 9, "`1") == 0));
//assert((className[9] == '\0') || (strcmp(className + 9, "`1") == 0));
Copy link
Member

Choose a reason for hiding this comment

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

Unintended change?

Copy link
Member Author

Choose a reason for hiding this comment

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

See commit title f71b073

Outerloop is on the floor again and I'm getting really tired being the janitor.

Copy link
Member

Choose a reason for hiding this comment

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

GitHub UI only showed me the first two commits in the list and thus I didn't see the title. Must have been some glitch.

Copy link
Member

Choose a reason for hiding this comment

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

A fix for this up here: https://github.com/dotnet/runtime/pull/103995/files

However, the fact that the assert triggered looks to be a bug in NAOT, as there are types being marked as [Intrinsic] which should not be marked [Intrinsic] and which are not marked as such in the actual managed implementation.

return InstructionSet_Vector128;
}
else if (strncmp(className + 6, "256", 3) == 0)
{
assert((className[9] == '\0') || (strcmp(className + 9, "`1") == 0));
//assert((className[9] == '\0') || (strcmp(className + 9, "`1") == 0));
return InstructionSet_Vector256;
}
else if (strncmp(className + 6, "512", 3) == 0)
{
assert((className[9] == '\0') || (strcmp(className + 9, "`1") == 0));
//assert((className[9] == '\0') || (strcmp(className + 9, "`1") == 0));
return InstructionSet_Vector512;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ The .NET Foundation licenses this file to you under the MIT license.

<!-- Set defaults for unspecified properties -->
<PropertyGroup>
<ControlFlowGuard>Guard</ControlFlowGuard>

<StripSymbols Condition="'$(StripSymbols)' == '' and '$(_targetOS)' != 'win'">true</StripSymbols>
<NativeLib Condition="'$(OutputType)' == 'Library' and '$(NativeLib)' == '' and '$(IlcMultiModule)' != 'true'">Shared</NativeLib>
<NativeIntermediateOutputPath Condition="'$(NativeIntermediateOutputPath)' == ''">$(IntermediateOutputPath)native\</NativeIntermediateOutputPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,12 @@ public override string ToString()
return _name.ToString();
}
}

public class AddressTakenExternSymbolNode : ExternSymbolNode
{
public AddressTakenExternSymbolNode(Utf8String name)
: base(name) { }

public override int ClassCode => -45645737;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,7 @@ public override IEnumerable<DependencyListEntry> GetStaticDependencies(NodeFacto

factory.MetadataManager.GetDependenciesDueToVirtualMethodReflectability(ref result, factory, _targetMethod);

TargetArchitecture targetArchitecture = factory.Target.Architecture;
if (targetArchitecture == TargetArchitecture.ARM)
{
result.Add(factory.InitialInterfaceDispatchStub, "Initial interface dispatch stub");
}
else
{
result.Add(factory.ExternSymbol("RhpInitialDynamicInterfaceDispatch"), "Initial interface dispatch stub");
}
result.Add(factory.InitialInterfaceDispatchStub, "Initial interface dispatch stub");

// We counter-intuitively ask for a constructed type symbol. This is needed due to IDynamicInterfaceCastable.
// If this dispatch cell is ever used with an object that implements IDynamicIntefaceCastable, user code will
Expand All @@ -81,15 +73,7 @@ public override IEnumerable<DependencyListEntry> GetStaticDependencies(NodeFacto

public override void EncodeData(ref ObjectDataBuilder objData, NodeFactory factory, bool relocsOnly)
{
TargetArchitecture targetArchitecture = factory.Target.Architecture;
if (targetArchitecture == TargetArchitecture.ARM)
{
objData.EmitPointerReloc(factory.InitialInterfaceDispatchStub);
}
else
{
objData.EmitPointerReloc(factory.ExternSymbol("RhpInitialDynamicInterfaceDispatch"));
}
objData.EmitPointerReloc(factory.InitialInterfaceDispatchStub);

// We counter-intuitively ask for a constructed type symbol. This is needed due to IDynamicInterfaceCastable.
// If this dispatch cell is ever used with an object that implements IDynamicIntefaceCastable, user code will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public NodeFactory(
ObjectDataInterner dataInterner)
{
_target = context.Target;

InitialInterfaceDispatchStub = _target.Architecture == TargetArchitecture.ARM
? new InitialInterfaceDispatchStubNode()
Copy link
Member

Choose a reason for hiding this comment

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

I am wondering whether the special ARM dispatch stub wrapper is still necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can try to delete that in a different PR and see what the CI says, but I don't have hardware to test it on.

Copy link
Member

Choose a reason for hiding this comment

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

Testing it in CI should be good enough if you would like to give it a try.

I think this was only needed for multi-.dll Windows arm32 support that we do not have anymore.

: new AddressTakenExternSymbolNode("RhpInitialDynamicInterfaceDispatch");

_context = context;
_compilationModuleGroup = compilationModuleGroup;
_vtableSliceProvider = vtableSliceProvider;
Expand Down Expand Up @@ -102,6 +107,11 @@ public NameMangler NameMangler
get;
}

public ISymbolNode InitialInterfaceDispatchStub
{
get;
}

public PreinitializationManager PreinitializationManager
{
get;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ private void EmitObject(string objectFilePath, IReadOnlyCollection<DependencyNod
relocTarget.Offset);

if (_options.HasFlag(ObjectWritingOptions.ControlFlowGuard) &&
relocTarget is IMethodNode or AssemblyStubNode)
relocTarget is IMethodNode or AssemblyStubNode or AddressTakenExternSymbolNode)
{
// For now consider all method symbols address taken.
// We could restrict this in the future to those that are referenced from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,6 @@
<Compile Include="Compiler\DependencyAnalysis\StringAllocatorMethodNode.cs" />
<Compile Include="Compiler\DependencyAnalysis\Target_X64\X64ReadyToRunGenericHelperNode.cs" />
<Compile Include="Compiler\DependencyAnalysis\Target_ARM\ARMInitialInterfaceDispatchStubNode.cs" />
<Compile Include="Compiler\DependencyAnalysis\Target_ARM\ARMNodeFactory.cs" />
<Compile Include="Compiler\DependencyAnalysis\VTableSliceNode.cs" />
<Compile Include="Compiler\DependencyAnalysis\EETypeOptionalFieldsNode.cs" />
<Compile Include="Compiler\DependencyAnalysis\EmbeddedObjectNode.cs" />
Expand Down
Loading