Fix bug in handling of jsr instruction.

This commit is contained in:
jfrijters 2008-11-14 07:54:11 +00:00
Родитель c9b373d85a
Коммит 93fc80927d
2 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -2686,7 +2686,8 @@ namespace IKVM.Internal
{
Reachable = 1,
Processed = 2,
BranchTarget = 4
BranchTarget = 4,
JsrHasRet = 8,
}
internal struct Instruction

Просмотреть файл

@ -26,7 +26,11 @@ using System;
using System.IO;
using System.Collections.Generic;
using System.Diagnostics;
#if IKVM_REF_EMIT
using IKVM.Reflection.Emit;
#else
using System.Reflection.Emit;
#endif
using IKVM.Internal;
using InstructionFlags = IKVM.Internal.ClassFile.Method.InstructionFlags;
@ -2599,6 +2603,10 @@ class MethodAnalyzer
break;
case NormalizedByteCode.__jsr:
{
if((instr.flags & InstructionFlags.JsrHasRet) != 0)
{
state[i + 1] += s;
}
int index = method.PcIndexMap[instr.PC + instr.Arg1];
s.SetSubroutineId(index);
TypeWrapper retAddressType;
@ -2623,6 +2631,7 @@ class MethodAnalyzer
for(int j = 0; j < cs.Length; j++)
{
state[cs[j] + 1] = InstructionState.Merge(state[cs[j] + 1], s, locals_modified, state[cs[j]]);
instructions[cs[j]].flags |= InstructionFlags.JsrHasRet;
}
break;
}