Skip to content

Conversation

@davidwrighton
Copy link
Member

  • Fix the encoding

Fixes #57951

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.

Seems like that should do the trick.

Can you verify the new R2R debug info for x86 Task.WaitAll looks right?

Copy link
Member

@trylek trylek left a comment

Choose a reason for hiding this comment

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

LGTM, thanks David for fixing this so quickly!

throw new BadImageFormatException("Unexpected var loc type");
}

static void WriteEncodedStackOffset(NibbleWriter _writer, int offset, bool assume4ByteAligned)
Copy link
Member

Choose a reason for hiding this comment

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

Nit - if at some point we considered expanding this behavior to other architectures, the name of the argument (assume4ByteAligned) would probably need to change to e.g. something like encodeUsingPointerSizeUnits or some such. If we believe this to be limited to X86 forever, it's probably OK.

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 just checked to see how valuable this really is, and we could save something like 0.08% of System.Private.CoreLib.dll size if we applied a similar size optimization on X64. I don't see that as worthwhile given the complexity it would impose on the reader in the runtime.

@davidwrighton
Copy link
Member Author

@AndyAyersMS Yep. Verified the WaitAll behavior, and it looks good.

void System.Threading.Tasks.Task.WaitAll(System.Threading.Tasks.Task[])
Handle: 0x060032D8
Rid: 13016
EntryPointRuntimeFunctionId: 10598
Number of RuntimeFunctions: 1
Number of fixups: 1
    TableIndex 4, Offset 0380: System.Threading.CancellationToken (TYPE_HANDLE)

void System.Threading.Tasks.Task.WaitAll(System.Threading.Tasks.Task[])
Id: 10598
StartAddress: 0x002743C0
Size: 40 bytes
UnwindRVA: 0x000425B0

Debug Info
    Bounds:
    Native Offset: 0x0, Prolog, Source Types: StackEmpty
    Native Offset: 0xE, IL Offset: 0x0000, Source Types: StackEmpty
    Native Offset: 0x24, IL Offset: 0x0011, Source Types: StackEmpty
    Native Offset: 0x24, Epilog, Source Types: StackEmpty

    Variable Locations:
    Variable Number: 0
    Start Offset: 0x0
    End Offset: 0xE
    Loc Type: VLT_REG
    Register: ECX

    Variable Number: 0
    Start Offset: 0xE
    End Offset: 0x24
    Loc Type: VLT_STK
    Base Register: EBP
    Stack Offset: -4

    Variable Number: 1
    Start Offset: 0xE
    End Offset: 0x24
    Loc Type: VLT_STK
    Base Register: EBP
    Stack Offset: -8

@davidwrighton davidwrighton merged commit 3dd7937 into dotnet:main Aug 25, 2021
@davidwrighton
Copy link
Member Author

/backport to release/6.0-rc1

@github-actions
Copy link
Contributor

Started backporting to release/6.0-rc1: https://github.com/dotnet/runtime/actions/runs/1165066676

}

public void InitializeDebugVarInfos(NativeVarInfo[] debugVarInfos)
public void InitializeDebugVarInfos(NativeVarInfo[] debugVarInfos, TargetDetails target)
Copy link
Member

Choose a reason for hiding this comment

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

TargetDetails are available in _method.Context.Target. The additional parameter caused an unnecessary NativeAOT build break.

@ghost ghost locked as resolved and limited conversation to collaborators Sep 26, 2021
@davidwrighton davidwrighton deleted the fix57951 branch April 13, 2023 18:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debugger incorrectly resolves argument in MethodImplOptions.NoOptimization frame in Windows x86

4 participants