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

Feature/misc optimizations #47

Merged
merged 3 commits into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
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
26 changes: 18 additions & 8 deletions ILRuntime/CLR/TypeSystem/ILType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,16 @@ public bool IsArray
get; private set;
}

private bool? isValueType;

public bool IsValueType
{
get
{
return definition.IsValueType;
if (isValueType == null)
isValueType = definition.IsValueType;

return isValueType.Value;
}
}

Expand Down Expand Up @@ -549,14 +554,18 @@ void InitializeMethods()
public IMethod GetVirtualMethod(IMethod method)
{
IType[] genericArguments = null;
if (method is ILMethod)
{
genericArguments = ((ILMethod)method).GenericArugmentsArray;
}
else
if (method.IsGenericInstance)
{
genericArguments = ((CLRMethod)method).GenericArguments;
if (method is ILMethod)
{
genericArguments = ((ILMethod)method).GenericArugmentsArray;
}
else
{
genericArguments = ((CLRMethod)method).GenericArguments;
}
}

var m = GetMethod(method.Name, method.Parameters, genericArguments, method.ReturnType);
if (m == null)
{
Expand All @@ -581,8 +590,9 @@ public IMethod GetMethod(string name, List<IType> param, IType[] genericArgument
IMethod genericMethod = null;
if (methods.TryGetValue(name, out lst))
{
foreach (var i in lst)
for (var idx = 0; idx < lst.Count; idx++)
{
var i = lst[idx];
int pCnt = param != null ? param.Count : 0;
if (i.ParameterCount == pCnt)
{
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 @@ -76,11 +76,12 @@ public void PushFrame(ref StackFrame frame)
else
throw new NotSupportedException();
StackObject* returnVal = esp - 1;
StackObject* ret = frame.LocalVarPointer - frame.Method.ParameterCount;
var method = frame.Method;
StackObject* ret = frame.LocalVarPointer - method.ParameterCount;
int mStackBase = frame.ManagedStackBase;
if (frame.Method.HasThis)
if (method.HasThis)
ret--;
if(frame.Method.ReturnType != intepreter.AppDomain.VoidType)
if(method.ReturnType != intepreter.AppDomain.VoidType)
{
*ret = *returnVal;
if(ret->ObjectType == ObjectTypes.Object)
Expand Down