Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
16 changes: 16 additions & 0 deletions src/coreclr/jit/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8440,9 +8440,25 @@ void emitter::emitOutputDataSec(dataSecDsc* sec, AllocMemChunk* chunks)
BYTE* target = emitLoc->Valid() ? emitOffsetToPtr(emitLoc->CodeOffset(this)) : nullptr;
aDstRW[i].Resume = (target_size_t)(uintptr_t)emitAsyncResumeStubEntryPoint;
aDstRW[i].DiagnosticIP = (target_size_t)(uintptr_t)target;

#ifdef TARGET_ARM
// ARM32 requires the Thumb bit (bit 0) set on code pointers.
// For target (intra-code pointer), OR directly — findKnownBlock preserves it.
// For resumeStub (external handle), use addlDelta so the handle stays clean
// for HandleToObject's integer division in crossgen2.
Comment on lines +8447 to +8448
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// For resumeStub (external handle), use addlDelta so the handle stays clean
// for HandleToObject's integer division in crossgen2.
// For resumeStub (external handle), use addlDelta because we can't do math with handles.

if (target != nullptr)
{
target = (BYTE*)((size_t)target | 1);
}
Comment on lines 8440 to +8452
#endif

if (m_compiler->opts.compReloc)
{
#ifdef TARGET_ARM
emitRecordRelocationWithAddlDelta(&aDstRW[i].Resume, emitAsyncResumeStubEntryPoint, CorInfoReloc::DIRECT, 1);
#else
emitRecordRelocation(&aDstRW[i].Resume, emitAsyncResumeStubEntryPoint, CorInfoReloc::DIRECT);
#endif
if (target != nullptr)
{
emitRecordRelocation(&aDstRW[i].DiagnosticIP, target, CorInfoReloc::DIRECT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,12 @@ public IEnumerable<MethodWithGCInfo> EnumerateCompiledMethods(EcmaModule moduleT
foreach (IMethodNode methodNode in MetadataManager.GetCompiledMethods(moduleToEnumerate, methodCategory))
{
MethodDesc method = methodNode.Method;
// Async methods are not emitted in composite mode nor on ARM32
// The mutable module tokens emission is not well tested for composite mode and we should find a real solution for that problem
// ARM32 relocs require the thumb bit set, and the JIT/crossgen doesn't set it properly for the usages in async methods.
// Async methods are not emitted in composite mode.
// The mutable module tokens emission is not well tested for composite mode
// and we should find a real solution for that problem.
// https://github.com/dotnet/runtime/issues/125337
// https://github.com/dotnet/runtime/issues/125338
if ((CompilationModuleGroup.IsCompositeBuildMode || Target.Architecture == TargetArchitecture.ARM)
&& (method.IsAsyncVariant() || method.IsCompilerGeneratedILBodyForAsync()))
if (CompilationModuleGroup.IsCompositeBuildMode &&
(method.IsAsyncVariant() || method.IsCompilerGeneratedILBodyForAsync()))
{
continue;
}
Expand Down
Loading