Skip to content
Merged
Changes from all commits
Commits
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
13 changes: 1 addition & 12 deletions src/tests/GC/API/Frozen/Frozen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,9 @@ internal class Node

internal static class Program
{
private static unsafe IntPtr GetMethodTablePointer(object obj)
{
GCHandle gch = GCHandle.Alloc(obj);
IntPtr pointerToPointerToObject = GCHandle.ToIntPtr(gch);
IntPtr pointerToObject = *((IntPtr*)pointerToPointerToObject);
IntPtr methodTable = *((IntPtr*)pointerToObject);
gch.Free();
return methodTable;
}

private static unsafe int Main(string[] args)
{
Node template = new Node();
IntPtr methodTable = GetMethodTablePointer(template);
IntPtr methodTable = typeof(Node).TypeHandle.Value;

FrozenSegmentBuilder frozenSegmentBuilder = new FrozenSegmentBuilder(1000);
IntPtr node1Ptr = frozenSegmentBuilder.Allocate(methodTable);
Expand Down