Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
57fe91c
Move DependentHandle to System.Runtime
Sergio0694 Jun 15, 2021
b1f54b5
Update DependentHandle APIs to follow review
Sergio0694 Jun 15, 2021
b331b8f
Make DependentHandle type public
Sergio0694 Jun 15, 2021
a96fa3f
Update DependentHandle on Mono runtime
Sergio0694 Jun 15, 2021
16fdf0e
Add allocation checks to DependentHandle APIs
Sergio0694 Jun 15, 2021
748d88e
Add more unit tests for new public DependentHandle APIs
Sergio0694 Jun 16, 2021
247fa5a
Add faster, unsafe internal APIs versions to DependentHandle
Sergio0694 Jun 16, 2021
66d2ac5
Naming improvements to Ephemeron type
Sergio0694 Jun 16, 2021
4067ac3
Code style tweaks, improved nullability annotations
Sergio0694 Jun 16, 2021
1670339
Remove incorrect DependentHandle comment on Mono
Sergio0694 Jun 16, 2021
96cfc91
Add default Dispose test for DependentHandle
Sergio0694 Jun 16, 2021
6a8db56
Fix race condition in DependentHandle on Mono
Sergio0694 Jun 16, 2021
1601d88
Optimize DependentHandle.nGetPrimary on CoreCLR
Sergio0694 Jun 16, 2021
359938b
Small IL codegen improvement in DependentHandle.nGetPrimary
Sergio0694 Jun 16, 2021
312851a
Simplify comments, add #ifdef for using directive
Sergio0694 Jun 16, 2021
0145a76
Minor code style tweaks
Sergio0694 Jun 16, 2021
4925877
Change nGetPrimaryAndSecondary to nGetSecondary
Sergio0694 Jun 16, 2021
1664a95
Minor code refactoring to DependentHandle on Mono
Sergio0694 Jun 16, 2021
ca515b6
Rename DependentHandle FCalls
Sergio0694 Jun 16, 2021
08df598
Remove DependentHandle.UnsafeGetTargetAndDependent
Sergio0694 Jun 16, 2021
4e2b624
Remove DependentHandle.GetTargetAndDependent
Sergio0694 Jun 16, 2021
4e03297
Fix FCall path for internal DependentHandle APIs
Sergio0694 Jun 16, 2021
25b34c2
Add more DependentHandle unit tests
Sergio0694 Jun 17, 2021
01f32a3
Reintroduce DependentHandle.GetTargetAndDependent()
Sergio0694 Jun 17, 2021
b3963f2
Minor IL tweaks to produce smaller IR in the JIT
Sergio0694 Jun 18, 2021
34e1bcb
Add DependentHandle.StopTracking() API
Sergio0694 Jun 21, 2021
9fd1da4
Rename InternalSetTarget to StopTracking, remove redundant param
Sergio0694 Jun 21, 2021
d7146e0
Remove FCUnique from InternalStopTracking
Sergio0694 Jun 21, 2021
c9c6325
Update API surface to match approved specs from API review
Sergio0694 Jun 22, 2021
c463d54
Update DependentHandle XML docs
Sergio0694 Jun 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename InternalSetTarget to StopTracking, remove redundant param
  • Loading branch information
Sergio0694 committed Jun 21, 2021
commit 9fd1da4a759b3eb4f6ba2c62e895a048875151cb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public void StopTracking()
ThrowHelper.ThrowInvalidOperationException();
}

InternalSetTarget(handle, null);
InternalStopTracking(handle);
}

/// <summary>
Expand Down Expand Up @@ -213,7 +213,7 @@ internal void UnsafeSetDependent(object? dependent)
/// <remarks>This method mirrors <see cref="StopTracking"/>, but without the allocation check.</remarks>
internal void UnsafeStopTracking()
{
InternalSetTarget(_handle, null);
InternalStopTracking(_handle);
}

/// <inheritdoc cref="IDisposable.Dispose"/>
Expand Down Expand Up @@ -255,10 +255,10 @@ public void Dispose()
private static extern object? InternalGetTargetAndDependent(IntPtr dependentHandle, out object? dependent);

[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void InternalSetTarget(IntPtr dependentHandle, object? target);
private static extern void InternalSetDependent(IntPtr dependentHandle, object? dependent);

[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void InternalSetDependent(IntPtr dependentHandle, object? dependent);
private static extern void InternalStopTracking(IntPtr dependentHandle);

[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void InternalFree(IntPtr dependentHandle);
Expand Down
22 changes: 11 additions & 11 deletions src/coreclr/vm/comdependenthandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,18 @@ FCIMPL2(Object*, DependentHandle::InternalGetTargetAndDependent, OBJECTHANDLE ha
}
FCIMPLEND

FCIMPL1(VOID, DependentHandle::InternalFree, OBJECTHANDLE handle)
FCIMPL2(VOID, DependentHandle::InternalSetDependent, OBJECTHANDLE handle, Object *_dependent)
{
FCALL_CONTRACT;

_ASSERTE(handle != NULL);

HELPER_METHOD_FRAME_BEGIN_0();

DestroyDependentHandle(handle);

HELPER_METHOD_FRAME_END();
IGCHandleManager *mgr = GCHandleUtilities::GetGCHandleManager();
mgr->SetDependentHandleSecondary(handle, _dependent);
}
FCIMPLEND

FCIMPL2(VOID, DependentHandle::InternalSetTarget, OBJECTHANDLE handle, Object *_target)
FCIMPL1(VOID, DependentHandle::InternalStopTracking, OBJECTHANDLE handle)
{
FCALL_CONTRACT;

Expand All @@ -99,17 +96,20 @@ FCIMPL2(VOID, DependentHandle::InternalSetTarget, OBJECTHANDLE handle, Object *_
FCUnique(0x12);

IGCHandleManager *mgr = GCHandleUtilities::GetGCHandleManager();
mgr->StoreObjectInHandle(handle, _target);
mgr->StoreObjectInHandle(handle, NULL);
}
FCIMPLEND

FCIMPL2(VOID, DependentHandle::InternalSetDependent, OBJECTHANDLE handle, Object *_dependent)
FCIMPL1(VOID, DependentHandle::InternalFree, OBJECTHANDLE handle)
{
FCALL_CONTRACT;

_ASSERTE(handle != NULL);

IGCHandleManager *mgr = GCHandleUtilities::GetGCHandleManager();
mgr->SetDependentHandleSecondary(handle, _dependent);
HELPER_METHOD_FRAME_BEGIN_0();

DestroyDependentHandle(handle);

HELPER_METHOD_FRAME_END();
}
FCIMPLEND
4 changes: 2 additions & 2 deletions src/coreclr/vm/comdependenthandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class DependentHandle
static FCDECL1(Object *, InternalGetTarget, OBJECTHANDLE handle);
static FCDECL1(Object *, InternalGetDependent, OBJECTHANDLE handle);
static FCDECL2(Object *, InternalGetTargetAndDependent, OBJECTHANDLE handle, Object **outDependent);
static FCDECL1(VOID, InternalFree, OBJECTHANDLE handle);
static FCDECL2(VOID, InternalSetTarget, OBJECTHANDLE handle, Object *target);
static FCDECL2(VOID, InternalSetDependent, OBJECTHANDLE handle, Object *dependent);
static FCDECL1(VOID, InternalStopTracking, OBJECTHANDLE handle);
static FCDECL1(VOID, InternalFree, OBJECTHANDLE handle);
};

#endif
4 changes: 2 additions & 2 deletions src/coreclr/vm/ecalllist.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ FCFuncStart(gDependentHandleFuncs)
FCFuncElement("InternalGetTarget", DependentHandle::InternalGetTarget)
FCFuncElement("InternalGetDependent", DependentHandle::InternalGetDependent)
FCFuncElement("InternalGetTargetAndDependent", DependentHandle::InternalGetTargetAndDependent)
FCFuncElement("InternalFree", DependentHandle::InternalFree)
FCFuncElement("InternalSetTarget", DependentHandle::InternalSetTarget)
FCFuncElement("InternalSetDependent", DependentHandle::InternalSetDependent)
FCFuncElement("InternalStopTracking", DependentHandle::InternalStopTracking)
FCFuncElement("InternalFree", DependentHandle::InternalFree)
FCFuncEnd()


Expand Down