From 4b25a8add4bc16a8d2fb4e96c87014de146082fa Mon Sep 17 00:00:00 2001 From: zoltan Date: Thu, 30 Oct 2008 15:41:03 +0000 Subject: [PATCH] 2008-10-30 Zoltan Varga * CILCompiler.cs: Save and restore strpos in the Test opcode. Fixes #439947. git-svn-id: svn+ssh://mono-cvs.ximian.com/source/trunk/mcs@117484 e3ebcda4-bce8-0310-ba0a-eca2169e7518 --- class/System/System.Text.RegularExpressions/CILCompiler.cs | 11 +++++++++++ class/System/System.Text.RegularExpressions/ChangeLog | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/class/System/System.Text.RegularExpressions/CILCompiler.cs b/class/System/System.Text.RegularExpressions/CILCompiler.cs index dcc5b195a4..accb2af355 100644 --- a/class/System/System.Text.RegularExpressions/CILCompiler.cs +++ b/class/System/System.Text.RegularExpressions/CILCompiler.cs @@ -1061,6 +1061,11 @@ namespace System.Text.RegularExpressions { if (trace_compile) Console.WriteLine ("\temitting "); + // old_stros = strpos; + LocalBuilder local_old_strpos = ilgen.DeclareLocal (typeof (int)); + ilgen.Emit (OpCodes.Ldarg_1); + ilgen.Emit (OpCodes.Stloc, local_old_strpos); + Frame new_frame = new Frame (ilgen); m = EmitEvalMethodBody (m, ilgen, new_frame, program, pc + 5, target1 < target2 ? target1 : target2, false, false, out pc); if (m == null) @@ -1077,10 +1082,16 @@ namespace System.Text.RegularExpressions { // Pass ilgen.MarkLabel (new_frame.label_pass); + // strpos = old_strpos; + ilgen.Emit (OpCodes.Ldloc, local_old_strpos); + ilgen.Emit (OpCodes.Starg, 1); ilgen.Emit (OpCodes.Br, l1); // Fail ilgen.MarkLabel (new_frame.label_fail); + // strpos = old_strpos; + ilgen.Emit (OpCodes.Ldloc, local_old_strpos); + ilgen.Emit (OpCodes.Starg, 1); ilgen.Emit (OpCodes.Br, l2); // Continue at pc, which should equal to target1 diff --git a/class/System/System.Text.RegularExpressions/ChangeLog b/class/System/System.Text.RegularExpressions/ChangeLog index da20b59734..84940e5154 100644 --- a/class/System/System.Text.RegularExpressions/ChangeLog +++ b/class/System/System.Text.RegularExpressions/ChangeLog @@ -1,3 +1,8 @@ +2008-10-30 Zoltan Varga + + * CILCompiler.cs: Save and restore strpos in the Test opcode. Fixes + #439947. + 2008-10-25 Zoltan Varga * CILCompiler.cs: Implement Test opcode. -- 2.11.4.GIT