Skip to content

The x86 path for UnmanagedCallersOnlyAttribute should be improved. #33582

Closed

Description

@AaronRobinsonMSFT

The making public of NativeCallableAttribute UnmanagedCallersOnlyAttribute done in #33005, provided some additional optimizations. However the Windows-x86 path was deemed lower priority so wasn't optimized. There are various locations where the Windows-x86 platform opted out of the optimization.

Examples:

#if defined(TARGET_X86) && defined(TARGET_WINDOWS) && !defined(CROSSGEN_COMPILE)
// Deferring X86 support until a need is observed or
// time permits investigation into all the potential issues.
if (pMD->HasNativeCallableAttribute())
{
pResult->addr = (void*)COMDelegate::ConvertToCallback(pMD);
}
else
{
pResult->addr = (void*)pMD->GetMultiCallableAddrOfCode();
}
#else

#if !defined(TARGET_X86) || !defined(TARGET_WINDOWS)
if (ftn->HasNativeCallableAttribute())
flags.Set(CORJIT_FLAGS::CORJIT_FLAG_REVERSE_PINVOKE);
#endif // !TARGET_X86 || !TARGET_WINDOWS

if (targetArchitecture == TargetArchitecture.X86
&& _compilation.TypeSystemContext.Target.OperatingSystem == TargetOS.Windows)
{
throw new RequiresRuntimeJitException("ReadyToRun: Methods with NativeCallableAttribute not implemented");
}

var targetDetails = _compilation.TypeSystemContext.Target;
if (targetDetails.Architecture == TargetArchitecture.X86
&& targetDetails.OperatingSystem == TargetOS.Windows
&& targetMethod.IsNativeCallable)
{
throw new RequiresRuntimeJitException("ReadyToRun: References to methods with NativeCallableAttribute not implemented");
}

Activity

  1. changed the title [-]The Windows x86 path for NativeCallableAttribute should be improved.[/-] [+]The x86 path for NativeCallableAttribute should be improved.[/+] on Mar 29, 2020
  2. jkotas commented on Mar 29, 2020

    @jkotas
    Member

    Generalizing the issue to both Windows and Linux. It turns our both Windows x86 and Linux x86 need work.

  3. AaronRobinsonMSFT commented on Mar 30, 2020

    @AaronRobinsonMSFT
    MemberAuthor

    See #34251 (comment) for Linux x86 issues.

  4. removed
    untriagedNew issue has not been triaged by the area owner
    on Apr 2, 2020
  5. added this to the 5.0 milestone on Apr 2, 2020
  6. jkotas commented on Apr 6, 2020

    @jkotas
    Member

    See #34548 for (subset of) places that are affected.

  7. changed the title [-]The x86 path for NativeCallableAttribute should be improved.[/-] [+]The x86 path for UnmanagedCallersOnlyAttribute should be improved.[/+] on May 3, 2020
  8. modified the milestones: 5.0.0, 6.0.0 on Aug 12, 2020
  9. AaronRobinsonMSFT commented on Dec 5, 2020

    @AaronRobinsonMSFT
    MemberAuthor

    @jkoritzinsky I assume some of the work you are doing is addressing this.

  10. jkoritzinsky commented on Dec 5, 2020

    @jkoritzinsky
    Member

    Kind of. I’ll make sure to link to this issue as I do the work related to it.

  11. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Dec 19, 2020
  12. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Jan 20, 2021
  13. jkoritzinsky commented on Apr 5, 2021

    @jkoritzinsky
    Member

    Fixed by #46238

  14. ghost locked as resolved and limited conversation to collaborators on May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions