Skip to content

Commit

Permalink
Fixed a bug with rare hash collision
Browse files Browse the repository at this point in the history
  • Loading branch information
liiir1985 committed Jul 14, 2022
1 parent 81bf7e5 commit 2ae204b
Show file tree
Hide file tree
Showing 10 changed files with 483 additions and 5 deletions.
Binary file modified Dependencies/ILRuntime.Mono.Cecil.dll
Binary file not shown.
Binary file modified Dependencies/ILRuntime.Mono.Cecil.pdb
Binary file not shown.
Binary file modified Dependencies/netstandard2.0/ILRuntime.Mono.Cecil.dll
Binary file not shown.
Binary file modified Dependencies/netstandard2.0/ILRuntime.Mono.Cecil.pdb
Binary file not shown.
17 changes: 16 additions & 1 deletion ILRuntime/Runtime/Intepreter/ILIntepreter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4913,7 +4913,11 @@ void StLocSub(StackObject* esp, StackObject* v, int idx, AutoList mStack)
break;
}
}

[Obsolete]
public object RetriveObject(StackObject* esp, IList<object> mStack)
{
return RetriveObject(esp, (AutoList)mStack);
}
public object RetriveObject(StackObject* esp, AutoList mStack)
{
StackObject* objRef = GetObjectAndResolveReference(esp);
Expand Down Expand Up @@ -5728,6 +5732,12 @@ internal static object CheckAndCloneValueType(object obj, Enviorment.AppDomain d
return esp + 1;
}

[Obsolete]
public static void UnboxObject(StackObject* esp, object obj, IList<object> mStack = null, Enviorment.AppDomain domain = null)
{
UnboxObject(esp, obj, (AutoList)mStack, domain);
}

public static void UnboxObject(StackObject* esp, object obj, AutoList mStack = null, Enviorment.AppDomain domain = null)
{
if (esp->ObjectType == ObjectTypes.ValueTypeObjectReference && domain != null)
Expand Down Expand Up @@ -5825,6 +5835,11 @@ public static void UnboxObject(StackObject* esp, object obj, AutoList mStack = n
throw new NotImplementedException();
}

[Obsolete]
public static StackObject* PushObject(StackObject* esp, IList<object> mStack, object obj, bool isBox = false)
{
return PushObject(esp, (AutoList)mStack, obj, isBox);
}
public static StackObject* PushObject(StackObject* esp, AutoList mStack, object obj, bool isBox = false)
{
if (obj != null)
Expand Down
7 changes: 4 additions & 3 deletions ILRuntime/Runtime/Stack/RuntimeStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,11 @@ public void AllocValueType(StackObject* ptr, IType type, bool register = false,

internal void InitializeValueTypeObject(IType type, StackObject* ptr, bool register, ref int managedIdx, bool noInitialize)
{
var tFCnt = type.TotalFieldCount;
ptr->ObjectType = ObjectTypes.ValueTypeDescriptor;
ptr->Value = type.TypeIndex;
ptr->ValueLow = type.TotalFieldCount;
StackObject* endPtr = ptr - (type.TotalFieldCount + 1);
ptr->ValueLow = tFCnt;
StackObject* endPtr = ptr - (tFCnt + 1);
if (noInitialize)
return;
if (type is ILType)
Expand Down Expand Up @@ -469,7 +470,7 @@ internal void InitializeValueTypeObject(IType type, StackObject* ptr, bool regis
else
{
CLRType t = (CLRType)type;
var cnt = t.TotalFieldCount;
var cnt = tFCnt;
var arr = t.OrderedFieldTypes;
for (int i = 0; i < cnt; i++)
{
Expand Down
5 changes: 5 additions & 0 deletions ILRuntime/Runtime/Stack/StackObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public struct StackObject
return (a.ObjectType != b.ObjectType) || (a.Value != b.Value) || (a.ValueLow == b.ValueLow);
}

[Obsolete]
public static unsafe object ToObject(StackObject* esp, ILRuntime.Runtime.Enviorment.AppDomain appdomain, IList<object> mStack)
{
return ToObject(esp, appdomain, (AutoList)mStack);
}
//IL2CPP can't process esp->ToObject() properly, so I can only use static function for this
public static unsafe object ToObject(StackObject* esp, ILRuntime.Runtime.Enviorment.AppDomain appdomain, AutoList mStack)
{
Expand Down
Loading

0 comments on commit 2ae204b

Please sign in to comment.