Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make DependentHandle public #54246

Merged
merged 30 commits into from
Jun 26, 2021

Commits on Jun 18, 2021

  1. Configuration menu
    Copy the full SHA
    57fe91c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b1f54b5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b331b8f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a96fa3f View commit details
    Browse the repository at this point in the history
  5. Add allocation checks to DependentHandle APIs

    This avoids throwing ExecutionEngineException-s if one of the public APIs is called on a non-allocated DependentHandle instance
    Sergio0694 committed Jun 18, 2021
    Configuration menu
    Copy the full SHA
    16fdf0e View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    748d88e View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    247fa5a View commit details
    Browse the repository at this point in the history
  8. Naming improvements to Ephemeron type

    The ephemeron type is checked in the Mono runtime in "object.c" as follows:
    
    m_class_get_image (klass) == mono_defaults.corlib && !strcmp ("Ephemeron", m_class_get_name (klass))
    
    As such, the namespace it belongs to in the managed runtime doesn't matter: the VM will just check
    that the type name matches, and that the type is in fact defined in corelib. This means we can
    just move it to System.Runtime without worrying about it being properly managed in the VM.
    Additionally, the type is defined in "sgen-mono.c" as follows:
    
    typedef struct {
        GCObject* key;
        GCObject* value;
    } Ephemeron;
    
    So as long as the layout matches the one of the type defined in C# (which it does), we're also free
    to rename the fields to better follow the naming guidelines, and the VM will have no issues with it.
    Sergio0694 committed Jun 18, 2021
    Configuration menu
    Copy the full SHA
    66d2ac5 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    4067ac3 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    1670339 View commit details
    Browse the repository at this point in the history
  11. Add default Dispose test for DependentHandle

    Co-authored-by: Stephen Toub <stoub@microsoft.com>
    Sergio0694 and stephentoub committed Jun 18, 2021
    Configuration menu
    Copy the full SHA
    96cfc91 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    6a8db56 View commit details
    Browse the repository at this point in the history
  13. Optimize DependentHandle.nGetPrimary on CoreCLR

    Removed internal call, same optimization as GCHandle
    Sergio0694 committed Jun 18, 2021
    Configuration menu
    Copy the full SHA
    1601d88 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    359938b View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    312851a View commit details
    Browse the repository at this point in the history
  16. Minor code style tweaks

    Sergio0694 committed Jun 18, 2021
    Configuration menu
    Copy the full SHA
    0145a76 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    4925877 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    1664a95 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    ca515b6 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    08df598 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    4e2b624 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    4e03297 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    25b34c2 View commit details
    Browse the repository at this point in the history
  24. Reintroduce DependentHandle.GetTargetAndDependent()

    This fixes a bug due to a race condition in ConditionalWeakTable<K, V>, which relies on this method which atomically retrieves both target and dependent with respect to target being set to null concurrently by other threads. This also exposes the same API publically to allow consumers to potentially implement custom conditional weak tables in the same manner.
    Sergio0694 committed Jun 18, 2021
    Configuration menu
    Copy the full SHA
    01f32a3 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    b3963f2 View commit details
    Browse the repository at this point in the history

Commits on Jun 21, 2021

  1. Add DependentHandle.StopTracking() API

    This also fixes two potential GC holes when setting DependentHandle.Target (see conversation from dotnet#54246 (comment) onwards)
    Sergio0694 committed Jun 21, 2021
    Configuration menu
    Copy the full SHA
    34e1bcb View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9fd1da4 View commit details
    Browse the repository at this point in the history
  3. Remove FCUnique from InternalStopTracking

    This was added in dotnet#39810 to avoid a collision with MarshalNative::GCHandleInternalSet, as the two FCalls had identical implementations and their entry points were not unique. This should no longer be needed after 099fc478551f46cc54e7a18a32d9a9ac73727c73, as that changed both the signature and the implementation of this FCall.
    Sergio0694 committed Jun 21, 2021
    Configuration menu
    Copy the full SHA
    d7146e0 View commit details
    Browse the repository at this point in the history

Commits on Jun 22, 2021

  1. Configuration menu
    Copy the full SHA
    c9c6325 View commit details
    Browse the repository at this point in the history

Commits on Jun 23, 2021

  1. Configuration menu
    Copy the full SHA
    c463d54 View commit details
    Browse the repository at this point in the history