зеркало из https://github.com/mono/ikvm-fork.git
Fix bug in handling of jsr instruction.
This commit is contained in:
Родитель
c9b373d85a
Коммит
93fc80927d
|
@ -2686,7 +2686,8 @@ namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
Reachable = 1,
|
Reachable = 1,
|
||||||
Processed = 2,
|
Processed = 2,
|
||||||
BranchTarget = 4
|
BranchTarget = 4,
|
||||||
|
JsrHasRet = 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
internal struct Instruction
|
internal struct Instruction
|
||||||
|
|
|
@ -26,7 +26,11 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
#if IKVM_REF_EMIT
|
||||||
|
using IKVM.Reflection.Emit;
|
||||||
|
#else
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
|
#endif
|
||||||
using IKVM.Internal;
|
using IKVM.Internal;
|
||||||
using InstructionFlags = IKVM.Internal.ClassFile.Method.InstructionFlags;
|
using InstructionFlags = IKVM.Internal.ClassFile.Method.InstructionFlags;
|
||||||
|
|
||||||
|
@ -2599,6 +2603,10 @@ class MethodAnalyzer
|
||||||
break;
|
break;
|
||||||
case NormalizedByteCode.__jsr:
|
case NormalizedByteCode.__jsr:
|
||||||
{
|
{
|
||||||
|
if((instr.flags & InstructionFlags.JsrHasRet) != 0)
|
||||||
|
{
|
||||||
|
state[i + 1] += s;
|
||||||
|
}
|
||||||
int index = method.PcIndexMap[instr.PC + instr.Arg1];
|
int index = method.PcIndexMap[instr.PC + instr.Arg1];
|
||||||
s.SetSubroutineId(index);
|
s.SetSubroutineId(index);
|
||||||
TypeWrapper retAddressType;
|
TypeWrapper retAddressType;
|
||||||
|
@ -2623,6 +2631,7 @@ class MethodAnalyzer
|
||||||
for(int j = 0; j < cs.Length; j++)
|
for(int j = 0; j < cs.Length; j++)
|
||||||
{
|
{
|
||||||
state[cs[j] + 1] = InstructionState.Merge(state[cs[j] + 1], s, locals_modified, state[cs[j]]);
|
state[cs[j] + 1] = InstructionState.Merge(state[cs[j] + 1], s, locals_modified, state[cs[j]]);
|
||||||
|
instructions[cs[j]].flags |= InstructionFlags.JsrHasRet;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче