Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
beyaz committed Nov 2, 2024
1 parent 3db79a9 commit 5388a97
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions ReactWithDotNet.WebSite/wwwroot/clr.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,9 @@ function Interpret(thread)
case 40: // Calli
nextInstruction = instructions[++currentStackFrame.Line];
break;

case 41: // Ret

if (currentStackFrame.Prev === null)
{
return;
Expand All @@ -326,27 +328,31 @@ function Interpret(thread)

thread.LastFrame = currentStackFrame = currentStackFrame.Prev;



// arrange fast access variables
instructions = currentStackFrame.Method.Body.Instructions;
operands = currentStackFrame.Method.Body.Operands;

evaluationStack = currentStackFrame.EvaluationStack;
localVariables = currentStackFrame.LocalVariables;
methodArguments = currentStackFrame.MethodArguments;
// arrange fast access variables
evaluationStack = currentStackFrame.EvaluationStack;
localVariables = currentStackFrame.LocalVariables;
methodArguments = currentStackFrame.MethodArguments;
methodArgumentsOfset = currentStackFrame.MethodArgumentsOfset;

for (var i = 0; i < previousStackFrame.Method.Parameters.length; i++)
// remove parameters
length = previousStackFrame.Method.Parameters.length;
while(length-- > 0)
{
evaluationStack.pop();
}

// remove instance
if (previousStackFrame.Method.IsStatic === false)
{
evaluationStack.pop();
}

if(previousStackFrame.EvaluationStack.length > 0)
// check has any return value
if(previousStackFrame.EvaluationStack.length === 1)
{
evaluationStack.push(previousStackFrame.EvaluationStack.pop());
}
Expand Down

0 comments on commit 5388a97

Please sign in to comment.