Skip to content

Commit

Permalink
Fix Unity5.5 compile error
Browse files Browse the repository at this point in the history
Unity5.5 move  UnityEngine.Profiler to UnityEngine.Profiling.Profiler
  • Loading branch information
oyji1992 authored and liiir1985 committed May 5, 2017
1 parent 2a525fc commit 91033ec
Showing 1 changed file with 33 additions and 13 deletions.
46 changes: 33 additions & 13 deletions ILRuntime/Runtime/Intepreter/ILIntepreter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,14 @@ public object Run(ILMethod method, object instance, object[] p)
if (method == null)
throw new NullReferenceException();
#if UNITY_EDITOR
if(System.Threading.Thread.CurrentThread.ManagedThreadId == AppDomain.UnityMainThreadID)
if (System.Threading.Thread.CurrentThread.ManagedThreadId == AppDomain.UnityMainThreadID)

#if UNITY_5_5_OR_NEWER
UnityEngine.Profiling.Profiler.BeginSample(method.ToString());
#else
UnityEngine.Profiler.BeginSample(method.ToString());
#endif

#endif
OpCode[] body = method.Body;
StackFrame frame;
Expand Down Expand Up @@ -1723,13 +1729,23 @@ public object Run(ILMethod method, object instance, object[] p)
throw new NotSupportedException(cm.ToString() + " is not bound!");
#endif
#if UNITY_EDITOR
if(System.Threading.Thread.CurrentThread.ManagedThreadId == AppDomain.UnityMainThreadID)
if (System.Threading.Thread.CurrentThread.ManagedThreadId == AppDomain.UnityMainThreadID)

#if UNITY_5_5_OR_NEWER
UnityEngine.Profiling.Profiler.BeginSample(cm.ToString());
#else
UnityEngine.Profiler.BeginSample(cm.ToString());
#endif
#endif
object result = cm.Invoke(this, esp, mStack);
#if UNITY_EDITOR
if(System.Threading.Thread.CurrentThread.ManagedThreadId == AppDomain.UnityMainThreadID)
if (System.Threading.Thread.CurrentThread.ManagedThreadId == AppDomain.UnityMainThreadID)
#if UNITY_5_5_OR_NEWER
UnityEngine.Profiling.Profiler.EndSample();
#else
UnityEngine.Profiler.EndSample();
#endif

#endif
if (result is CrossBindingAdaptorType)
result = ((CrossBindingAdaptorType)result).ILInstance;
Expand Down Expand Up @@ -1762,7 +1778,7 @@ public object Run(ILMethod method, object instance, object[] p)
{
var objRef = GetObjectAndResolveReference(esp - 1 - 1);
object obj = RetriveObject(objRef, mStack);

if (obj != null)
{
if (obj is ILTypeInstance)
Expand Down Expand Up @@ -1835,7 +1851,7 @@ public object Run(ILMethod method, object instance, object[] p)
case OpCodeEnum.Ldfld:
{
StackObject* objRef = GetObjectAndResolveReference(esp - 1);
object obj = RetriveObject(objRef, mStack);
object obj = RetriveObject(objRef, mStack);
Free(esp - 1);
if (obj != null)
{
Expand Down Expand Up @@ -1869,7 +1885,7 @@ public object Run(ILMethod method, object instance, object[] p)
{
StackObject* objRef = GetObjectAndResolveReference(esp - 1);
object obj = RetriveObject(objRef, mStack);

Free(esp - 1);
if (obj != null)
{
Expand Down Expand Up @@ -2385,7 +2401,7 @@ public object Run(ILMethod method, object instance, object[] p)
{
esp = PushObject(esp - 1, mStack, Enum.ToObject(tt, StackObject.ToObject(obj, AppDomain, mStack)));
}
else if(tt.IsPrimitive)
else if (tt.IsPrimitive)
{
esp = PushObject(esp - 1, mStack, tt.CheckCLRTypes(StackObject.ToObject(obj, AppDomain, mStack)));
}
Expand Down Expand Up @@ -2952,7 +2968,7 @@ public object Run(ILMethod method, object instance, object[] p)
break;
case ObjectTypes.Long:
{
if(arr is long[])
if (arr is long[])
{
((long[])arr)[idx->Value] = *(long*)&val->Value;
}
Expand Down Expand Up @@ -3703,8 +3719,12 @@ public object Run(ILMethod method, object instance, object[] p)
}
}
#if UNITY_EDITOR
if(System.Threading.Thread.CurrentThread.ManagedThreadId == AppDomain.UnityMainThreadID)
if (System.Threading.Thread.CurrentThread.ManagedThreadId == AppDomain.UnityMainThreadID)
#if UNITY_5_5_OR_NEWER
UnityEngine.Profiling.Profiler.EndSample();
#else
UnityEngine.Profiler.EndSample();
#endif
#endif
//ClearStack
return stack.PopFrame(ref frame, esp, mStack);
Expand Down Expand Up @@ -3784,7 +3804,7 @@ void StoreIntValueToArray(Array arr, StackObject* val, StackObject* idx)
}
{
short[] tmp = arr as short[];
if(tmp != null)
if (tmp != null)
{
tmp[idx->Value] = (short)val->Value;
return;
Expand Down Expand Up @@ -3869,7 +3889,7 @@ ExceptionHandler GetCorrespondingExceptionHandler(ILMethod method, object obj, i

void LoadFromFieldReference(object obj, int idx, StackObject* dst, List<object> mStack)
{
if(obj is ILTypeInstance)
if (obj is ILTypeInstance)
{
((ILTypeInstance)obj).PushToStack(idx, dst, AppDomain, mStack);
}
Expand All @@ -3896,7 +3916,7 @@ void StoreValueToFieldReference(object obj, int idx, StackObject* val, List<obje
}
}

void LoadFromArrayReference(object obj,int idx, StackObject* objRef, IType t, List<object> mStack)
void LoadFromArrayReference(object obj, int idx, StackObject* objRef, IType t, List<object> mStack)
{
var nT = t.TypeForCLR;
LoadFromArrayReference(obj, idx, objRef, nT, mStack);
Expand Down Expand Up @@ -3987,7 +4007,7 @@ void StoreValueToArrayReference(StackObject* objRef, StackObject* val, IType t,
var nT = t.TypeForCLR;
StoreValueToArrayReference(objRef, val, nT, mStack);
}

void StoreValueToArrayReference(StackObject* objRef, StackObject* val, Type nT, List<object> mStack)
{
if (nT.IsPrimitive)
Expand Down

0 comments on commit 91033ec

Please sign in to comment.