Skip to content

Async resume info has unaligned pointers #121779

@MichalStrehovsky

Description

@MichalStrehovsky

With runtime async, I'm hitting this assert in the object emitter:

Debug.Assert(reloc.Offset % _nodeFactory.Target.PointerSize == 0);

We guard against unaligned pointer-sized relocs because on Windows things get inefficient when a reloc straddles a page boundary.

RyuJIT is generating read only data blobs that have an unaligned pointer-size reloc in them. Example I'm looking at:

Emitting data sections: 160 total bytes
  section   0, size 16, RWD 0:	46 00 72 00 61 00 6d 00 65 00 20 00 30 00 3a 00 
  section 1, size 44, block relative addr
  BB23: 0x89f
  BB22: 0x86a
  BB25: 0x7a5
  BB28: 0x780
  BB24: 0x758
  BB21: 0x903
  BB26: 0x730
  BB29: 0x708
  BB27: 0x6e0
  BB21: 0x903
  BB30: 0x6b8
  section 2, size 80, async resume info
recordRelocation: 0000021E908D1794 (rw: 0000021E908D1794) => 4000000000952108, type 10 (relocType), delta 0
recordRelocation: 0000021E908D179C (rw: 0000021E908D179C) => 0000021E908D0FFB, type 10 (relocType), delta 0
  Resume=4000000000952108, FinalResumeIP=0000021E908D0FFB
recordRelocation: 0000021E908D17A4 (rw: 0000021E908D17A4) => 4000000000952108, type 10 (relocType), delta 0
recordRelocation: 0000021E908D17AC (rw: 0000021E908D17AC) => 0000021E908D10A5, type 10 (relocType), delta 0
  Resume=4000000000952108, FinalResumeIP=0000021E908D10A5
recordRelocation: 0000021E908D17B4 (rw: 0000021E908D17B4) => 4000000000952108, type 10 (relocType), delta 0
recordRelocation: 0000021E908D17BC (rw: 0000021E908D17BC) => 0000021E908D1159, type 10 (relocType), delta 0
  Resume=4000000000952108, FinalResumeIP=0000021E908D1159
recordRelocation: 0000021E908D17C4 (rw: 0000021E908D17C4) => 4000000000952108, type 10 (relocType), delta 0
recordRelocation: 0000021E908D17CC (rw: 0000021E908D17CC) => 0000021E908D120D, type 10 (relocType), delta 0
  Resume=4000000000952108, FinalResumeIP=0000021E908D120D
recordRelocation: 0000021E908D17D4 (rw: 0000021E908D17D4) => 4000000000952108, type 10 (relocType), delta 0
recordRelocation: 0000021E908D17DC (rw: 0000021E908D17DC) => 0000021E908D12C1, type 10 (relocType), delta 0
  Resume=4000000000952108, FinalResumeIP=0000021E908D12C1
  section 3, size 20, block relative addr
  BB252: 0xd5a
  BB257: 0xdbd
  BB262: 0xe12
  BB267: 0xe6e
  BB272: 0xed5

It's not visible from the JitDump for some reason, but these relocs are just:

  • Full pointer relocation to the resumption stub of the method that owns the blob
  • Full pointer relocation to the method that owns the blob (with some delta that is different for each entry)

Repeated 5 times.

I wonder if:

  1. The pointers could be aligned
  2. We track looking into the efficiency of this representation

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIruntime-async

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions