Convert pointers in a couple tables to relative#78801
Conversation
`EmbeddedPointerIndirection` is used in: * Array of pointers to dispatch maps * Array of pointers to GC static infos * Array of pointers to eager constructors I'm also updating array of module initializers emission since the code to interpret this table at runtime is the same as eager constructors.
|
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue Details
I'm also updating array of module initializers emission since the code to interpret this table at runtime is the same as eager constructors. I'd guess this saves another ~1% on Linux. I didn't measure Windows this time. There will a couple kilobytes of savings for hello world on Windows for sure. Cc @dotnet/ilc-contrib
|
|
|
||
| for (byte* pCurrent = pInitializers; | ||
| pCurrent < (pInitializers + length); | ||
| pCurrent += MethodTable.SupportsRelativePointers ? sizeof(int) : sizeof(nint)) |
There was a problem hiding this comment.
Extracting this logic into a property instead of c&p?
There was a problem hiding this comment.
Hmm, we still need to switch on the size of the element later in the loop, so while it would be fewer characters, whoever is reading the code would now need to scroll to the definition to match it with the inner logic.
The ultimate improvement would be to split the code that reads the data structures from the code that interprets it with a struct iterator. But this is code that we only touch once every few years and mostly just forget it exists, so I didn't spend time to make it pretty.
|
Opened dotnet/arcade#11723 on the test failures |
EmbeddedPointerIndirectionis used in:I'm also updating array of module initializers emission since the code to interpret this table at runtime is the same as eager constructors.
I'd guess this saves another ~1% on Linux. I didn't measure Windows this time. There will a couple kilobytes of savings for hello world on Windows for sure.
Cc @dotnet/ilc-contrib