Thibaut Barrère
2009-Feb-26 22:41 UTC
[Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)"
Hi again, I''m using Mono 2.4 to run the binaries at http://nightlybuilds.cloudapp.net/rss.ashx?project=dlr(DLR.xxxxx.release.zip) - (not sure if it supposed to work, but it did until today). Everything I tried worked fine with DLR.10606.release.zip. Switching to the latest DLR.12211.release.zip makes "require ''mscorlib''" throw the following error: mscorlib:0:in `CreateDelegate'': Invalid IL code in (wrapper dynamic-method) object:CallSite.Target (Microsoft.Runtime.CompilerServices.Closure,Microsoft.Runtime.CompilerServices.CallSite,IronRuby.Runtime.RubyContext,IronRuby.Builtins.MutableString): IL_0024: pop (System::InvalidProgramException) from mscorlib:0:in `CreateDelegate'' from mscorlib:0:in `CreateDelegate'' from Microsoft.Scripting.Core:0:in `CreateDelegate'' from Microsoft.Scripting.Core:0:in `Compile'' from Microsoft.Scripting.Core:0:in `Compile'' from Microsoft.Scripting.Core:0:in `SetTarget'' Is it a know issue ? (I''m staying on previous builds for the moment). -- Thibaut -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090226/f54c7dee/attachment.html>
Ivan Porto Carrero
2009-Feb-27 06:41 UTC
[Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)"
I can confirm this but from git. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim On Thu, Feb 26, 2009 at 11:41 PM, Thibaut Barr?re <thibaut.barrere at gmail.com> wrote:> Hi again, > I''m using Mono 2.4 to run the binaries at > http://nightlybuilds.cloudapp.net/rss.ashx?project=dlr(DLR.xxxxx.release.zip) - (not sure if it supposed to work, but it did until > today). > > Everything I tried worked fine with DLR.10606.release.zip. Switching to the > latest DLR.12211.release.zip makes "require ''mscorlib''" throw the following > error: > > mscorlib:0:in `CreateDelegate'': Invalid IL code in (wrapper dynamic-method) > object:CallSite.Target > (Microsoft.Runtime.CompilerServices.Closure,Microsoft.Runtime.CompilerServices.CallSite,IronRuby.Runtime.RubyContext,IronRuby.Builtins.MutableString): > IL_0024: pop > > (System::InvalidProgramException) > from mscorlib:0:in `CreateDelegate'' > from mscorlib:0:in `CreateDelegate'' > from Microsoft.Scripting.Core:0:in `CreateDelegate'' > from Microsoft.Scripting.Core:0:in `Compile'' > from Microsoft.Scripting.Core:0:in `Compile'' > from Microsoft.Scripting.Core:0:in `SetTarget'' > > Is it a know issue ? (I''m staying on previous builds for the moment). > > -- Thibaut > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090227/d66e6e9f/attachment.html>
Jim Deville
2009-Feb-27 07:42 UTC
[Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)"
Can anyone confirm if this is only a Mono problem? Also, what platform x86 or x64 (doubt it makes a difference, but I want to be certain)? I can?t repro on .NET. JD From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Thursday, February 26, 2009 10:42 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)" I can confirm this but from git. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim On Thu, Feb 26, 2009 at 11:41 PM, Thibaut Barr?re <thibaut.barrere at gmail.com<mailto:thibaut.barrere at gmail.com>> wrote: Hi again, I''m using Mono 2.4 to run the binaries at http://nightlybuilds.cloudapp.net/rss.ashx?project=dlr (DLR.xxxxx.release.zip) - (not sure if it supposed to work, but it did until today). Everything I tried worked fine with DLR.10606.release.zip. Switching to the latest DLR.12211.release.zip makes "require ''mscorlib''" throw the following error: mscorlib:0:in `CreateDelegate'': Invalid IL code in (wrapper dynamic-method) object:CallSite.Target (Microsoft.Runtime.CompilerServices.Closure,Microsoft.Runtime.CompilerServices.CallSite,IronRuby.Runtime.RubyContext,IronRuby.Builtins.MutableString): IL_0024: pop (System::InvalidProgramException) from mscorlib:0:in `CreateDelegate'' from mscorlib:0:in `CreateDelegate'' from Microsoft.Scripting.Core:0:in `CreateDelegate'' from Microsoft.Scripting.Core:0:in `Compile'' from Microsoft.Scripting.Core:0:in `Compile'' from Microsoft.Scripting.Core:0:in `SetTarget'' Is it a know issue ? (I''m staying on previous builds for the moment). -- Thibaut _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090226/bc8437e1/attachment-0001.html>
Ivan Porto Carrero
2009-Feb-27 07:52 UTC
[Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)"
It seems that it''s only a mono problem. I use mono from trunk. and to repro it I built Michaels linux branch Then I just enter a console and do require ''rubygems'' that did it for me. On Fri, Feb 27, 2009 at 8:42 AM, Jim Deville <jdeville at microsoft.com> wrote:> Can anyone confirm if this is only a Mono problem? Also, what platform > x86 or x64 (doubt it makes a difference, but I want to be certain)? I can?t > repro on .NET. > > > > JD > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Thursday, February 26, 2009 10:42 PM > *To:* ironruby-core at rubyforge.org > *Subject:* Re: [Ironruby-core] Regression ? "Invalid IL code in (wrapper > dynamic-method)" > > > > I can confirm this but from git. > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > GSM: +32.486.787.582 > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > > > On Thu, Feb 26, 2009 at 11:41 PM, Thibaut Barr?re < > thibaut.barrere at gmail.com> wrote: > > Hi again, > > > > I''m using Mono 2.4 to run the binaries at > http://nightlybuilds.cloudapp.net/rss.ashx?project=dlr(DLR.xxxxx.release.zip) - (not sure if it supposed to work, but it did until > today). > > > > Everything I tried worked fine with DLR.10606.release.zip. Switching to the > latest DLR.12211.release.zip makes "require ''mscorlib''" throw the following > error: > > > > mscorlib:0:in `CreateDelegate'': Invalid IL code in (wrapper dynamic-method) > object:CallSite.Target > (Microsoft.Runtime.CompilerServices.Closure,Microsoft.Runtime.CompilerServices.CallSite,IronRuby.Runtime.RubyContext,IronRuby.Builtins.MutableString): > IL_0024: pop > > > > (System::InvalidProgramException) > > from mscorlib:0:in `CreateDelegate'' > > from mscorlib:0:in `CreateDelegate'' > > from Microsoft.Scripting.Core:0:in `CreateDelegate'' > > from Microsoft.Scripting.Core:0:in `Compile'' > > from Microsoft.Scripting.Core:0:in `Compile'' > > from Microsoft.Scripting.Core:0:in `SetTarget'' > > > > Is it a know issue ? (I''m staying on previous builds for the moment). > > > > -- Thibaut > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090227/79a3464f/attachment.html>
Jb Evain
2009-Feb-27 08:08 UTC
[Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)"
Hey Jim, On 2/27/09, Jim Deville <jdeville at microsoft.com> wrote:> Can anyone confirm if this is only a Mono problem? Also, what platform x86 > or x64 (doubt it makes a difference, but I want to be certain)? I can?t > repro on .NET.Let say it''s a shared problem :) The issue comes from our verifier, which, well, verifies the whole method body. It''s shocking on a dynamic method which looks like: ldc.i4.1 brfalse target ldarg.3 call foo ret pop target: ldarg.1 call bar bla bla bla ... The issue is the pop, in between the ret and the jump target. .net''s JIT will optimize it away, and not even verify it, as it will never be executed. But our verifier, well, verifies the whole method body, hence the InvalidProgramException. We''ve had this issue already with some obfuscators injecting plain non sense, so I guess at some point we''ll fix it on our side. It would be nice if IronRuby could emit nice and verifiable code though. -- Jb Evain <jb at nurv.fr>
Ivan Porto Carrero
2009-Feb-27 08:42 UTC
[Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)"
It isn''t relevant to this problem but is there a reference or a good book for IL generation? Or some links? On Fri, Feb 27, 2009 at 9:08 AM, Jb Evain <jb at nurv.fr> wrote:> Hey Jim, > > On 2/27/09, Jim Deville <jdeville at microsoft.com> wrote: > > Can anyone confirm if this is only a Mono problem? Also, what platform > x86 > > or x64 (doubt it makes a difference, but I want to be certain)? I can?t > > repro on .NET. > > Let say it''s a shared problem :) > > The issue comes from our verifier, which, well, verifies the whole > method body. It''s shocking on a dynamic method which looks like: > > ldc.i4.1 > brfalse target > ldarg.3 > call foo > ret > pop > > target: > > ldarg.1 > call bar > bla bla bla > ... > > The issue is the pop, in between the ret and the jump target. .net''s > JIT will optimize it away, and not even verify it, as it will never be > executed. > > But our verifier, well, verifies the whole method body, hence the > InvalidProgramException. > > We''ve had this issue already with some obfuscators injecting plain non > sense, so I guess at some point we''ll fix it on our side. It would be > nice if IronRuby could emit nice and verifiable code though. > > -- > Jb Evain <jb at nurv.fr> > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090227/6bc417fc/attachment.html>
Brad Wilson
2009-Feb-27 08:52 UTC
[Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)"
Serge Liden''s book is probably the bible for MSIL 2.0. http://www.amazon.com/Expert-NET-2-0-IL-Assembler/dp/1590596463 IL generation is the trivial part, once you actually understand IL. :) On Fri, Feb 27, 2009 at 12:42 AM, Ivan Porto Carrero <ivan at flanders.co.nz>wrote:> It isn''t relevant to this problem but is there a reference or a good book > for IL generation? > Or some links? >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090227/9e9050b8/attachment.html>
Jb Evain
2009-Feb-27 09:15 UTC
[Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)"
On 2/27/09, Jb Evain <jb at nurv.fr> wrote:> The issue is the pop, in between the ret and the jump target. .net''s > JIT will optimize it away, and not even verify it, as it will never be > executed.It''s definitely a common pattern: push condition brfalse target ldarg 3 // action on the RubyContext ret pop target: bla bla bla I guess it shouldn''t be too hard for you guys to bisect where the issues comes from between 10606:12221. -- Jb Evain <jb at nurv.fr>
Ivan Porto Carrero
2009-Feb-27 10:44 UTC
[Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)"
Great thanks, ordered it :) On Fri, Feb 27, 2009 at 9:52 AM, Brad Wilson <dotnetguy at gmail.com> wrote:> Serge Liden''s book is probably the bible for MSIL 2.0. > http://www.amazon.com/Expert-NET-2-0-IL-Assembler/dp/1590596463 > > IL generation is the trivial part, once you actually understand IL. :) > > On Fri, Feb 27, 2009 at 12:42 AM, Ivan Porto Carrero <ivan at flanders.co.nz>wrote: > >> It isn''t relevant to this problem but is there a reference or a good book >> for IL generation? >> Or some links? >> > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090227/a4486d68/attachment.html>
Tomas Matousek
2009-Feb-27 17:08 UTC
[Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)"
If this is true we should fix it. I''ll investigate. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jb Evain Sent: Friday, February 27, 2009 12:09 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)" Hey Jim, On 2/27/09, Jim Deville <jdeville at microsoft.com> wrote:> Can anyone confirm if this is only a Mono problem? Also, what platform x86 > or x64 (doubt it makes a difference, but I want to be certain)? I can''t > repro on .NET.Let say it''s a shared problem :) The issue comes from our verifier, which, well, verifies the whole method body. It''s shocking on a dynamic method which looks like: ldc.i4.1 brfalse target ldarg.3 call foo ret pop target: ldarg.1 call bar bla bla bla ... The issue is the pop, in between the ret and the jump target. .net''s JIT will optimize it away, and not even verify it, as it will never be executed. But our verifier, well, verifies the whole method body, hence the InvalidProgramException. We''ve had this issue already with some obfuscators injecting plain non sense, so I guess at some point we''ll fix it on our side. It would be nice if IronRuby could emit nice and verifiable code though. -- Jb Evain <jb at nurv.fr> _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Tomas Matousek
2009-Feb-27 17:40 UTC
[Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)"
Jim, could you push the latest sources to GIT? Jb, could you try again using the latest source code (after Jim pushes it) and if it fails send me please full stack trace and complete IL of the offending method? Thanks, Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jb Evain Sent: Friday, February 27, 2009 12:09 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)" Hey Jim, On 2/27/09, Jim Deville <jdeville at microsoft.com> wrote:> Can anyone confirm if this is only a Mono problem? Also, what platform x86 > or x64 (doubt it makes a difference, but I want to be certain)? I can''t > repro on .NET.Let say it''s a shared problem :) The issue comes from our verifier, which, well, verifies the whole method body. It''s shocking on a dynamic method which looks like: ldc.i4.1 brfalse target ldarg.3 call foo ret pop target: ldarg.1 call bar bla bla bla ... The issue is the pop, in between the ret and the jump target. .net''s JIT will optimize it away, and not even verify it, as it will never be executed. But our verifier, well, verifies the whole method body, hence the InvalidProgramException. We''ve had this issue already with some obfuscators injecting plain non sense, so I guess at some point we''ll fix it on our side. It would be nice if IronRuby could emit nice and verifiable code though. -- Jb Evain <jb at nurv.fr> _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Jim Deville
2009-Feb-27 17:59 UTC
[Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)"
I have just pushed the latest. JD> -----Original Message----- > From: Tomas Matousek > Sent: Friday, February 27, 2009 9:40 AM > To: Jim Deville; ironruby-core at rubyforge.org > Subject: RE: [Ironruby-core] Regression ? "Invalid IL code in (wrapper > dynamic-method)" > > Jim, could you push the latest sources to GIT? > Jb, could you try again using the latest source code (after Jim pushes > it) and if it fails send me please full stack trace and complete IL of > the offending method? > > Thanks, > Tomas > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Jb Evain > Sent: Friday, February 27, 2009 12:09 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Regression ? "Invalid IL code in (wrapper > dynamic-method)" > > Hey Jim, > > On 2/27/09, Jim Deville <jdeville at microsoft.com> wrote: > > Can anyone confirm if this is only a Mono problem? Also, what > platform x86 > > or x64 (doubt it makes a difference, but I want to be certain)? I > can''t > > repro on .NET. > > Let say it''s a shared problem :) > > The issue comes from our verifier, which, well, verifies the whole > method body. It''s shocking on a dynamic method which looks like: > > ldc.i4.1 > brfalse target > ldarg.3 > call foo > ret > pop > > target: > > ldarg.1 > call bar > bla bla bla > ... > > The issue is the pop, in between the ret and the jump target. .net''s > JIT will optimize it away, and not even verify it, as it will never be > executed. > > But our verifier, well, verifies the whole method body, hence the > InvalidProgramException. > > We''ve had this issue already with some obfuscators injecting plain non > sense, so I guess at some point we''ll fix it on our side. It would be > nice if IronRuby could emit nice and verifiable code though. > > -- > Jb Evain <jb at nurv.fr> > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core
Jb Evain
2009-Feb-27 19:47 UTC
[Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)"
Hey Tomas, On 2/27/09, Tomas Matousek <Tomas.Matousek at microsoft.com> wrote:> Jb, could you try again using the latest source code (after Jim pushes it) and if it fails send me please full stack trace and complete IL of the offending method?Sure. So, after building from source the updated git repo, we have a different error, but similar error. I''m simply executing mono ir.exe test.rb, where test.rb only contains a call to `require "mscorlib"`. The stacktrace looks like this: (gdb) bt #0 mono_method_to_ir (cfg=0x8ec0ac0, method=0x8ecbce8, start_bblock=0x8ec48b4, end_bblock=0x8ec494c, return_var=0x0, dont_inline=0x8ec9a60, inline_args=0x0, inline_offset=0, is_virtual_call=0)at method-to-ir.c:4606 #1 0x0806124d in mini_method_compile (method=0x8ecbce8, opts=64055807, domain=0x25ee0, run_cctors=<value optimized out>, compile_aot=<value optimized out>, parts=0) at mini.c:3208 #2 0x08062b19 in mono_jit_compile_method (method=0x8ecbce8) at mini.c:3847 #3 0x0818ef88 in ves_icall_System_Delegate_CreateDelegate_internal (type=0xc6960, target=0x1f27b0, info=0x2e0a0) at icall.c:5988 #4 0xb6c9ae43 in (wrapper managed-to-native) System.Delegate:CreateDelegate_internal (param0=0xc6960, param1=0x1f27b0, param2=0x2e0a0) at xdb.il:7790 #5 0xb6c9ab34 in System.Delegate:CreateDelegate (type=0xc6960, firstArgument=0x1f27b0, method=0x2e0a0, throwOnBindFailure=true)at /home/jbevain/sources/mcs/class/corlib/System/Delegate.cs:256 #6 0xb6c9a6e6 in System.Delegate:CreateDelegate (type=0xc6960, firstArgument=0x1f27b0, method=0x2e0a0) at /home/jbevain/sources/mcs/class/corlib/System/Delegate.cs:263 #7 0xb6bc152b in System.Reflection.Emit.DynamicMethod:CreateDelegate (this=0x2e0a0, delegateType=0xc6960, target=0x1f27b0) at /home/jbevain/sources/mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs:189 #8 0xb6bc14c8 in System.Dynamic.Utils.TypeExtensions:CreateDelegate (methodInfo=0x2e0a0, delegateType=0xc6960, target=0x1f27b0) at xdb.il:44617 #9 0xb6bc13d7 in System.Linq.Expressions.Compiler.LambdaCompiler:CreateDelegate (this=0x1f17e0) at xdb.il:44564 #10 0xb6bcb61f in System.Linq.Expressions.Compiler.LambdaCompiler:Compile (lambda=0x1f0ca0) at xdb.il:34475 #11 0xb6bcb57c in System.Linq.Expressions.Expression`1<object>:Compile (this=0x1f0ca0) #12 0xb6b722ba in System.Dynamic.SmallRuleSet`1<object>:MakeTarget (this=0x1f3c60) #13 0xb6b72235 in System.Dynamic.SmallRuleSet`1<object>:GetTarget (this=0x1f3c60) #14 0xb6b721ea in System.Runtime.CompilerServices.CallSiteOps:SetTarget<object>(site=1120512, rule=2047096) #15 0xb6bc293b in System.Dynamic.UpdateDelegates:UpdateAndExecute3<object, object, object, object> (site=0xe9940, arg0=0x5ab80, arg1=0x50cf0, arg2=0x111528) #16 0xb6bbe81c in (wrapper static-rgctx-invoke) System.Dynamic.UpdateDelegates:static_rgctx_invoke_object_CallSite_RubyScope_object_MutableString (param0=0x111900, param1=0x5ab80, param2=0x50cf0, param3=0x111528)at xdb.il:43447 #17 0xb6ba3120 in (wrapper dynamic-method) object:IR;#;test.rb;0; (param0=0xe9ab0, param1=0x111d50, param2=0x25aa0) at xdb.il:44669 #18 0xb6bcb2b8 in Microsoft.Scripting.ScriptCode:InvokeTarget (this=0x111d68, code=0x4e700, scope=0x111d50) at xdb.il:34374 #19 0xb6bcb279 in Microsoft.Scripting.ScriptCode:Run (this=0x111d68, scope=0x111d50) at xdb.il:34361 #20 0xb6bcb1f3 in Microsoft.Scripting.ScriptCode:Run (this=0x111d68) at xdb.il:34331 #21 0xb6beac36 in IronRuby.Runtime.RubyContext:ExecuteProgram (this=0x25aa0, program=0xe2eb0) at xdb.il:17847 #22 0xb6beab8d in Microsoft.Scripting.Hosting.ScriptSource:ExecuteProgram (this=0x8b978) at xdb.il:17816 #23 0xb6beab2c in (wrapper remoting-invoke-with-check) Microsoft.Scripting.Hosting.ScriptSource:ExecuteProgram (this=0x8b978) at xdb.il:17807 #24 0xb6beaa4e in Microsoft.Scripting.Hosting.Shell.CommandLine:RunFile (this=0xe2f00, source=0x8b978) at xdb.il:17749 #25 0xb6bea389 in IronRuby.Hosting.RubyCommandLine:RunFile (this=0xe2f00, fileName=0x48fe0) at xdb.il:17406 #26 0xb6bea2d2 in Microsoft.Scripting.Hosting.Shell.CommandLine:Run (this=0xe2f00) at xdb.il:17363 #27 0xb6bea103 in Microsoft.Scripting.Hosting.Shell.CommandLine:Run (this=0xe2f00, engine=0x4e880, console=0xe2ed8, options=0x4b320) at xdb.il:17265 #28 0xb6be5570 in Microsoft.Scripting.Hosting.Shell.ConsoleHost:RunCommandLine(this=0x4bfc8) at xdb.il:16737 #29 0xb6be5370 in Microsoft.Scripting.Hosting.Shell.ConsoleHost:ExecuteInternal(this=0x4bfc8) at xdb.il:16638 #30 0xb6be520e in Microsoft.Scripting.Hosting.Shell.ConsoleHost:Execute (this=0x4bfc8) at xdb.il:16568 #31 0xb780b81b in Microsoft.Scripting.Hosting.Shell.ConsoleHost:Run (this=0x4bfc8, args=0x29f48) at xdb.il:276 #32 0xb780b2ca in RubyConsoleHost:Main (args=0x29f48) at xdb.il:79 #33 0xb780b203 in (wrapper runtime-invoke) RubyConsoleHost:runtime_invoke_int_object (param0=<value optimized out>, param1=-1073746312, param2=0, param3=-1216302424) at xdb.il:53 #34 0x0814551e in mono_runtime_exec_main (method=0x82cdde4, args=0x29f48, exc=0x0) at object.c:3335 #35 0x08145c3b in mono_runtime_run_main (method=0x82cdde4, argc=1, argv=0xbffff0d8, exc=0x0) at object.c:3123 #36 0x080b1b0a in mono_main (argc=3, argv=0xbffff0d4) at driver.c:969 #37 0x0805aff1 in main (argc=149723456, argv=0x0) at main.c:34 (gdb) And most importantly, the code that is trying to be emitted by the DynamicMethod is as follows: (gdb) p mono_method_get_header(method)->code $1 = (const unsigned char *) 0x8ec15e0 "\005\002{\001" (gdb) p mono_method_get_header(method)->code_size $2 = 198 (gdb) p mono_disasm_code (0, method, 0x8ec15e0, 0x8ec15e0 + 198) IL_0000: ldarg.3 IL_0001: ldarg.0 IL_0002: ldfld <System.Runtime.CompilerServices.Closure:Constants> IL_0007: ldc.i4.0 IL_0008: ldelem.ref IL_0009: ceq IL_000b: brfalse IL_00a3 IL_0010: ldarg.2 IL_0011: call <IronRuby.Runtime.RubyOps:GetContextFromScope (IronRuby.Runtime.RubyScope)> IL_0016: ldarg.0 IL_0017: ldfld <System.Runtime.CompilerServices.Closure:Constants> IL_001c: ldc.i4.1 IL_001d: ldelem.ref IL_001e: castclass <RubyContext> IL_0023: ceq IL_0025: brfalse IL_00a3 IL_002a: ldarg.s 4 IL_002c: brfalse IL_00a3 IL_0031: ldarg.s 4 IL_0033: castclass <Object> IL_0038: callvirt <object:GetType ()> IL_003d: ldtoken <IronRuby.Builtins.MutableString> IL_0042: call <System.Type:GetTypeFromHandle (System.RuntimeTypeHandle)> IL_0047: ceq IL_0049: brfalse IL_00a3 IL_004e: ldarg.0 IL_004f: ldfld <System.Runtime.CompilerServices.Closure:Constants> IL_0054: ldc.i4.2 IL_0055: ldelem.ref IL_0056: castclass <StrongBox`1> IL_005b: ldfld <System.Runtime.CompilerServices.StrongBox`1:Value> IL_0060: ldc.i4 189 IL_0065: ceq IL_0067: brfalse IL_009d IL_006c: ldarg.2 IL_006d: ldarg.3 IL_006e: ldarg.0 IL_006f: ldfld <System.Runtime.CompilerServices.Closure:Constants> IL_0074: ldc.i4.3 IL_0075: ldelem.ref IL_0076: castclass <CallSite`1> IL_007b: dup IL_007c: stloc.0 IL_007d: ldfld <System.Runtime.CompilerServices.CallSite`1:Target> IL_0082: ldloc.0 IL_0083: ldarg.2 IL_0084: call <IronRuby.Runtime.RubyOps:GetContextFromScope (IronRuby.Runtime.RubyScope)> IL_0089: ldarg.s 4 IL_008b: callvirt <System.Func`4<System.Runtime.CompilerServices.CallSite, IronRuby.Runtime.RubyContext, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>:Invoke (System.Runtime.CompilerServices.CallSite,IronRuby.Runtime.RubyContext,IronRuby.Builtins.MutableString)> IL_0090: call <IronRuby.Builtins.KernelOps:Require (IronRuby.Runtime.RubyScope,object,IronRuby.Builtins.MutableString)> IL_0095: tail. IL_0097: call <Microsoft.Scripting.Runtime.ScriptingRuntimeHelpers:BooleanToObject (bool)> IL_009c: ret IL_009d: br IL_00a3 IL_00a2: ret IL_00a3: ldarg.1 IL_00a4: call <System.Runtime.CompilerServices.CallSiteOps:NeedsUpdate (System.Runtime.CompilerServices.CallSite)> IL_00a9: brfalse IL_00b0 IL_00ae: ldnull IL_00af: ret IL_00b0: ldarg.1 IL_00b1: castclass <CallSite`1> IL_00b6: callvirt <System.Runtime.CompilerServices.CallSite`1<System.Func`5<System.Runtime.CompilerServices.CallSite, IronRuby.Runtime.RubyScope, object, IronRuby.Builtins.MutableString, object>>:get_Update ()> IL_00bb: ldarg.1 IL_00bc: ldarg.2 IL_00bd: ldarg.3 IL_00be: ldarg.s 4 IL_00c0: callvirt <System.Func`5<System.Runtime.CompilerServices.CallSite, IronRuby.Runtime.RubyScope, object, IronRuby.Builtins.MutableString, object>:Invoke (System.Runtime.CompilerServices.CallSite,IronRuby.Runtime.RubyScope,object,IronRuby.Builtins.MutableString)> IL_00c5: ret The issue here is the instruction: IL_00a2: ret With is right after an unconditional branch, thus will be executed, but the IL is still wrong. -- Jb Evain <jb at nurv.fr>
Tomas Matousek
2009-Feb-27 22:53 UTC
[Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)"
There is a bug in DLR compiler. We are working on a fix. Thanks for great report, Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jb Evain Sent: Friday, February 27, 2009 11:47 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)" Hey Tomas, On 2/27/09, Tomas Matousek <Tomas.Matousek at microsoft.com> wrote:> Jb, could you try again using the latest source code (after Jim pushes it) and if it fails send me please full stack trace and complete IL of the offending method?Sure. So, after building from source the updated git repo, we have a different error, but similar error. I''m simply executing mono ir.exe test.rb, where test.rb only contains a call to `require "mscorlib"`. The stacktrace looks like this: (gdb) bt #0 mono_method_to_ir (cfg=0x8ec0ac0, method=0x8ecbce8, start_bblock=0x8ec48b4, end_bblock=0x8ec494c, return_var=0x0, dont_inline=0x8ec9a60, inline_args=0x0, inline_offset=0, is_virtual_call=0)at method-to-ir.c:4606 #1 0x0806124d in mini_method_compile (method=0x8ecbce8, opts=64055807, domain=0x25ee0, run_cctors=<value optimized out>, compile_aot=<value optimized out>, parts=0) at mini.c:3208 #2 0x08062b19 in mono_jit_compile_method (method=0x8ecbce8) at mini.c:3847 #3 0x0818ef88 in ves_icall_System_Delegate_CreateDelegate_internal (type=0xc6960, target=0x1f27b0, info=0x2e0a0) at icall.c:5988 #4 0xb6c9ae43 in (wrapper managed-to-native) System.Delegate:CreateDelegate_internal (param0=0xc6960, param1=0x1f27b0, param2=0x2e0a0) at xdb.il:7790 #5 0xb6c9ab34 in System.Delegate:CreateDelegate (type=0xc6960, firstArgument=0x1f27b0, method=0x2e0a0, throwOnBindFailure=true)at /home/jbevain/sources/mcs/class/corlib/System/Delegate.cs:256 #6 0xb6c9a6e6 in System.Delegate:CreateDelegate (type=0xc6960, firstArgument=0x1f27b0, method=0x2e0a0) at /home/jbevain/sources/mcs/class/corlib/System/Delegate.cs:263 #7 0xb6bc152b in System.Reflection.Emit.DynamicMethod:CreateDelegate (this=0x2e0a0, delegateType=0xc6960, target=0x1f27b0) at /home/jbevain/sources/mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs:189 #8 0xb6bc14c8 in System.Dynamic.Utils.TypeExtensions:CreateDelegate (methodInfo=0x2e0a0, delegateType=0xc6960, target=0x1f27b0) at xdb.il:44617 #9 0xb6bc13d7 in System.Linq.Expressions.Compiler.LambdaCompiler:CreateDelegate (this=0x1f17e0) at xdb.il:44564 #10 0xb6bcb61f in System.Linq.Expressions.Compiler.LambdaCompiler:Compile (lambda=0x1f0ca0) at xdb.il:34475 #11 0xb6bcb57c in System.Linq.Expressions.Expression`1<object>:Compile (this=0x1f0ca0) #12 0xb6b722ba in System.Dynamic.SmallRuleSet`1<object>:MakeTarget (this=0x1f3c60) #13 0xb6b72235 in System.Dynamic.SmallRuleSet`1<object>:GetTarget (this=0x1f3c60) #14 0xb6b721ea in System.Runtime.CompilerServices.CallSiteOps:SetTarget<object>(site=1120512, rule=2047096) #15 0xb6bc293b in System.Dynamic.UpdateDelegates:UpdateAndExecute3<object, object, object, object> (site=0xe9940, arg0=0x5ab80, arg1=0x50cf0, arg2=0x111528) #16 0xb6bbe81c in (wrapper static-rgctx-invoke) System.Dynamic.UpdateDelegates:static_rgctx_invoke_object_CallSite_RubyScope_object_MutableString (param0=0x111900, param1=0x5ab80, param2=0x50cf0, param3=0x111528)at xdb.il:43447 #17 0xb6ba3120 in (wrapper dynamic-method) object:IR;#;test.rb;0; (param0=0xe9ab0, param1=0x111d50, param2=0x25aa0) at xdb.il:44669 #18 0xb6bcb2b8 in Microsoft.Scripting.ScriptCode:InvokeTarget (this=0x111d68, code=0x4e700, scope=0x111d50) at xdb.il:34374 #19 0xb6bcb279 in Microsoft.Scripting.ScriptCode:Run (this=0x111d68, scope=0x111d50) at xdb.il:34361 #20 0xb6bcb1f3 in Microsoft.Scripting.ScriptCode:Run (this=0x111d68) at xdb.il:34331 #21 0xb6beac36 in IronRuby.Runtime.RubyContext:ExecuteProgram (this=0x25aa0, program=0xe2eb0) at xdb.il:17847 #22 0xb6beab8d in Microsoft.Scripting.Hosting.ScriptSource:ExecuteProgram (this=0x8b978) at xdb.il:17816 #23 0xb6beab2c in (wrapper remoting-invoke-with-check) Microsoft.Scripting.Hosting.ScriptSource:ExecuteProgram (this=0x8b978) at xdb.il:17807 #24 0xb6beaa4e in Microsoft.Scripting.Hosting.Shell.CommandLine:RunFile (this=0xe2f00, source=0x8b978) at xdb.il:17749 #25 0xb6bea389 in IronRuby.Hosting.RubyCommandLine:RunFile (this=0xe2f00, fileName=0x48fe0) at xdb.il:17406 #26 0xb6bea2d2 in Microsoft.Scripting.Hosting.Shell.CommandLine:Run (this=0xe2f00) at xdb.il:17363 #27 0xb6bea103 in Microsoft.Scripting.Hosting.Shell.CommandLine:Run (this=0xe2f00, engine=0x4e880, console=0xe2ed8, options=0x4b320) at xdb.il:17265 #28 0xb6be5570 in Microsoft.Scripting.Hosting.Shell.ConsoleHost:RunCommandLine(this=0x4bfc8) at xdb.il:16737 #29 0xb6be5370 in Microsoft.Scripting.Hosting.Shell.ConsoleHost:ExecuteInternal(this=0x4bfc8) at xdb.il:16638 #30 0xb6be520e in Microsoft.Scripting.Hosting.Shell.ConsoleHost:Execute (this=0x4bfc8) at xdb.il:16568 #31 0xb780b81b in Microsoft.Scripting.Hosting.Shell.ConsoleHost:Run (this=0x4bfc8, args=0x29f48) at xdb.il:276 #32 0xb780b2ca in RubyConsoleHost:Main (args=0x29f48) at xdb.il:79 #33 0xb780b203 in (wrapper runtime-invoke) RubyConsoleHost:runtime_invoke_int_object (param0=<value optimized out>, param1=-1073746312, param2=0, param3=-1216302424) at xdb.il:53 #34 0x0814551e in mono_runtime_exec_main (method=0x82cdde4, args=0x29f48, exc=0x0) at object.c:3335 #35 0x08145c3b in mono_runtime_run_main (method=0x82cdde4, argc=1, argv=0xbffff0d8, exc=0x0) at object.c:3123 #36 0x080b1b0a in mono_main (argc=3, argv=0xbffff0d4) at driver.c:969 #37 0x0805aff1 in main (argc=149723456, argv=0x0) at main.c:34 (gdb) And most importantly, the code that is trying to be emitted by the DynamicMethod is as follows: (gdb) p mono_method_get_header(method)->code $1 = (const unsigned char *) 0x8ec15e0 "\005\002{\001" (gdb) p mono_method_get_header(method)->code_size $2 = 198 (gdb) p mono_disasm_code (0, method, 0x8ec15e0, 0x8ec15e0 + 198) IL_0000: ldarg.3 IL_0001: ldarg.0 IL_0002: ldfld <System.Runtime.CompilerServices.Closure:Constants> IL_0007: ldc.i4.0 IL_0008: ldelem.ref IL_0009: ceq IL_000b: brfalse IL_00a3 IL_0010: ldarg.2 IL_0011: call <IronRuby.Runtime.RubyOps:GetContextFromScope (IronRuby.Runtime.RubyScope)> IL_0016: ldarg.0 IL_0017: ldfld <System.Runtime.CompilerServices.Closure:Constants> IL_001c: ldc.i4.1 IL_001d: ldelem.ref IL_001e: castclass <RubyContext> IL_0023: ceq IL_0025: brfalse IL_00a3 IL_002a: ldarg.s 4 IL_002c: brfalse IL_00a3 IL_0031: ldarg.s 4 IL_0033: castclass <Object> IL_0038: callvirt <object:GetType ()> IL_003d: ldtoken <IronRuby.Builtins.MutableString> IL_0042: call <System.Type:GetTypeFromHandle (System.RuntimeTypeHandle)> IL_0047: ceq IL_0049: brfalse IL_00a3 IL_004e: ldarg.0 IL_004f: ldfld <System.Runtime.CompilerServices.Closure:Constants> IL_0054: ldc.i4.2 IL_0055: ldelem.ref IL_0056: castclass <StrongBox`1> IL_005b: ldfld <System.Runtime.CompilerServices.StrongBox`1:Value> IL_0060: ldc.i4 189 IL_0065: ceq IL_0067: brfalse IL_009d IL_006c: ldarg.2 IL_006d: ldarg.3 IL_006e: ldarg.0 IL_006f: ldfld <System.Runtime.CompilerServices.Closure:Constants> IL_0074: ldc.i4.3 IL_0075: ldelem.ref IL_0076: castclass <CallSite`1> IL_007b: dup IL_007c: stloc.0 IL_007d: ldfld <System.Runtime.CompilerServices.CallSite`1:Target> IL_0082: ldloc.0 IL_0083: ldarg.2 IL_0084: call <IronRuby.Runtime.RubyOps:GetContextFromScope (IronRuby.Runtime.RubyScope)> IL_0089: ldarg.s 4 IL_008b: callvirt <System.Func`4<System.Runtime.CompilerServices.CallSite, IronRuby.Runtime.RubyContext, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>:Invoke (System.Runtime.CompilerServices.CallSite,IronRuby.Runtime.RubyContext,IronRuby.Builtins.MutableString)> IL_0090: call <IronRuby.Builtins.KernelOps:Require (IronRuby.Runtime.RubyScope,object,IronRuby.Builtins.MutableString)> IL_0095: tail. IL_0097: call <Microsoft.Scripting.Runtime.ScriptingRuntimeHelpers:BooleanToObject (bool)> IL_009c: ret IL_009d: br IL_00a3 IL_00a2: ret IL_00a3: ldarg.1 IL_00a4: call <System.Runtime.CompilerServices.CallSiteOps:NeedsUpdate (System.Runtime.CompilerServices.CallSite)> IL_00a9: brfalse IL_00b0 IL_00ae: ldnull IL_00af: ret IL_00b0: ldarg.1 IL_00b1: castclass <CallSite`1> IL_00b6: callvirt <System.Runtime.CompilerServices.CallSite`1<System.Func`5<System.Runtime.CompilerServices.CallSite, IronRuby.Runtime.RubyScope, object, IronRuby.Builtins.MutableString, object>>:get_Update ()> IL_00bb: ldarg.1 IL_00bc: ldarg.2 IL_00bd: ldarg.3 IL_00be: ldarg.s 4 IL_00c0: callvirt <System.Func`5<System.Runtime.CompilerServices.CallSite, IronRuby.Runtime.RubyScope, object, IronRuby.Builtins.MutableString, object>:Invoke (System.Runtime.CompilerServices.CallSite,IronRuby.Runtime.RubyScope,object,IronRuby.Builtins.MutableString)> IL_00c5: ret The issue here is the instruction: IL_00a2: ret With is right after an unconditional branch, thus will be executed, but the IL is still wrong. -- Jb Evain <jb at nurv.fr> _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Tomas Matousek
2009-Mar-03 05:45 UTC
[Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)"
This issue is now fixed in the GIT repo. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tomas Matousek Sent: Friday, February 27, 2009 2:53 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)" There is a bug in DLR compiler. We are working on a fix. Thanks for great report, Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jb Evain Sent: Friday, February 27, 2009 11:47 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Regression ? "Invalid IL code in (wrapper dynamic-method)" Hey Tomas, On 2/27/09, Tomas Matousek <Tomas.Matousek at microsoft.com> wrote:> Jb, could you try again using the latest source code (after Jim pushes it) and if it fails send me please full stack trace and complete IL of the offending method?Sure. So, after building from source the updated git repo, we have a different error, but similar error. I''m simply executing mono ir.exe test.rb, where test.rb only contains a call to `require "mscorlib"`. The stacktrace looks like this: (gdb) bt #0 mono_method_to_ir (cfg=0x8ec0ac0, method=0x8ecbce8, start_bblock=0x8ec48b4, end_bblock=0x8ec494c, return_var=0x0, dont_inline=0x8ec9a60, inline_args=0x0, inline_offset=0, is_virtual_call=0)at method-to-ir.c:4606 #1 0x0806124d in mini_method_compile (method=0x8ecbce8, opts=64055807, domain=0x25ee0, run_cctors=<value optimized out>, compile_aot=<value optimized out>, parts=0) at mini.c:3208 #2 0x08062b19 in mono_jit_compile_method (method=0x8ecbce8) at mini.c:3847 #3 0x0818ef88 in ves_icall_System_Delegate_CreateDelegate_internal (type=0xc6960, target=0x1f27b0, info=0x2e0a0) at icall.c:5988 #4 0xb6c9ae43 in (wrapper managed-to-native) System.Delegate:CreateDelegate_internal (param0=0xc6960, param1=0x1f27b0, param2=0x2e0a0) at xdb.il:7790 #5 0xb6c9ab34 in System.Delegate:CreateDelegate (type=0xc6960, firstArgument=0x1f27b0, method=0x2e0a0, throwOnBindFailure=true)at /home/jbevain/sources/mcs/class/corlib/System/Delegate.cs:256 #6 0xb6c9a6e6 in System.Delegate:CreateDelegate (type=0xc6960, firstArgument=0x1f27b0, method=0x2e0a0) at /home/jbevain/sources/mcs/class/corlib/System/Delegate.cs:263 #7 0xb6bc152b in System.Reflection.Emit.DynamicMethod:CreateDelegate (this=0x2e0a0, delegateType=0xc6960, target=0x1f27b0) at /home/jbevain/sources/mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs:189 #8 0xb6bc14c8 in System.Dynamic.Utils.TypeExtensions:CreateDelegate (methodInfo=0x2e0a0, delegateType=0xc6960, target=0x1f27b0) at xdb.il:44617 #9 0xb6bc13d7 in System.Linq.Expressions.Compiler.LambdaCompiler:CreateDelegate (this=0x1f17e0) at xdb.il:44564 #10 0xb6bcb61f in System.Linq.Expressions.Compiler.LambdaCompiler:Compile (lambda=0x1f0ca0) at xdb.il:34475 #11 0xb6bcb57c in System.Linq.Expressions.Expression`1<object>:Compile (this=0x1f0ca0) #12 0xb6b722ba in System.Dynamic.SmallRuleSet`1<object>:MakeTarget (this=0x1f3c60) #13 0xb6b72235 in System.Dynamic.SmallRuleSet`1<object>:GetTarget (this=0x1f3c60) #14 0xb6b721ea in System.Runtime.CompilerServices.CallSiteOps:SetTarget<object>(site=1120512, rule=2047096) #15 0xb6bc293b in System.Dynamic.UpdateDelegates:UpdateAndExecute3<object, object, object, object> (site=0xe9940, arg0=0x5ab80, arg1=0x50cf0, arg2=0x111528) #16 0xb6bbe81c in (wrapper static-rgctx-invoke) System.Dynamic.UpdateDelegates:static_rgctx_invoke_object_CallSite_RubyScope_object_MutableString (param0=0x111900, param1=0x5ab80, param2=0x50cf0, param3=0x111528)at xdb.il:43447 #17 0xb6ba3120 in (wrapper dynamic-method) object:IR;#;test.rb;0; (param0=0xe9ab0, param1=0x111d50, param2=0x25aa0) at xdb.il:44669 #18 0xb6bcb2b8 in Microsoft.Scripting.ScriptCode:InvokeTarget (this=0x111d68, code=0x4e700, scope=0x111d50) at xdb.il:34374 #19 0xb6bcb279 in Microsoft.Scripting.ScriptCode:Run (this=0x111d68, scope=0x111d50) at xdb.il:34361 #20 0xb6bcb1f3 in Microsoft.Scripting.ScriptCode:Run (this=0x111d68) at xdb.il:34331 #21 0xb6beac36 in IronRuby.Runtime.RubyContext:ExecuteProgram (this=0x25aa0, program=0xe2eb0) at xdb.il:17847 #22 0xb6beab8d in Microsoft.Scripting.Hosting.ScriptSource:ExecuteProgram (this=0x8b978) at xdb.il:17816 #23 0xb6beab2c in (wrapper remoting-invoke-with-check) Microsoft.Scripting.Hosting.ScriptSource:ExecuteProgram (this=0x8b978) at xdb.il:17807 #24 0xb6beaa4e in Microsoft.Scripting.Hosting.Shell.CommandLine:RunFile (this=0xe2f00, source=0x8b978) at xdb.il:17749 #25 0xb6bea389 in IronRuby.Hosting.RubyCommandLine:RunFile (this=0xe2f00, fileName=0x48fe0) at xdb.il:17406 #26 0xb6bea2d2 in Microsoft.Scripting.Hosting.Shell.CommandLine:Run (this=0xe2f00) at xdb.il:17363 #27 0xb6bea103 in Microsoft.Scripting.Hosting.Shell.CommandLine:Run (this=0xe2f00, engine=0x4e880, console=0xe2ed8, options=0x4b320) at xdb.il:17265 #28 0xb6be5570 in Microsoft.Scripting.Hosting.Shell.ConsoleHost:RunCommandLine(this=0x4bfc8) at xdb.il:16737 #29 0xb6be5370 in Microsoft.Scripting.Hosting.Shell.ConsoleHost:ExecuteInternal(this=0x4bfc8) at xdb.il:16638 #30 0xb6be520e in Microsoft.Scripting.Hosting.Shell.ConsoleHost:Execute (this=0x4bfc8) at xdb.il:16568 #31 0xb780b81b in Microsoft.Scripting.Hosting.Shell.ConsoleHost:Run (this=0x4bfc8, args=0x29f48) at xdb.il:276 #32 0xb780b2ca in RubyConsoleHost:Main (args=0x29f48) at xdb.il:79 #33 0xb780b203 in (wrapper runtime-invoke) RubyConsoleHost:runtime_invoke_int_object (param0=<value optimized out>, param1=-1073746312, param2=0, param3=-1216302424) at xdb.il:53 #34 0x0814551e in mono_runtime_exec_main (method=0x82cdde4, args=0x29f48, exc=0x0) at object.c:3335 #35 0x08145c3b in mono_runtime_run_main (method=0x82cdde4, argc=1, argv=0xbffff0d8, exc=0x0) at object.c:3123 #36 0x080b1b0a in mono_main (argc=3, argv=0xbffff0d4) at driver.c:969 #37 0x0805aff1 in main (argc=149723456, argv=0x0) at main.c:34 (gdb) And most importantly, the code that is trying to be emitted by the DynamicMethod is as follows: (gdb) p mono_method_get_header(method)->code $1 = (const unsigned char *) 0x8ec15e0 "\005\002{\001" (gdb) p mono_method_get_header(method)->code_size $2 = 198 (gdb) p mono_disasm_code (0, method, 0x8ec15e0, 0x8ec15e0 + 198) IL_0000: ldarg.3 IL_0001: ldarg.0 IL_0002: ldfld <System.Runtime.CompilerServices.Closure:Constants> IL_0007: ldc.i4.0 IL_0008: ldelem.ref IL_0009: ceq IL_000b: brfalse IL_00a3 IL_0010: ldarg.2 IL_0011: call <IronRuby.Runtime.RubyOps:GetContextFromScope (IronRuby.Runtime.RubyScope)> IL_0016: ldarg.0 IL_0017: ldfld <System.Runtime.CompilerServices.Closure:Constants> IL_001c: ldc.i4.1 IL_001d: ldelem.ref IL_001e: castclass <RubyContext> IL_0023: ceq IL_0025: brfalse IL_00a3 IL_002a: ldarg.s 4 IL_002c: brfalse IL_00a3 IL_0031: ldarg.s 4 IL_0033: castclass <Object> IL_0038: callvirt <object:GetType ()> IL_003d: ldtoken <IronRuby.Builtins.MutableString> IL_0042: call <System.Type:GetTypeFromHandle (System.RuntimeTypeHandle)> IL_0047: ceq IL_0049: brfalse IL_00a3 IL_004e: ldarg.0 IL_004f: ldfld <System.Runtime.CompilerServices.Closure:Constants> IL_0054: ldc.i4.2 IL_0055: ldelem.ref IL_0056: castclass <StrongBox`1> IL_005b: ldfld <System.Runtime.CompilerServices.StrongBox`1:Value> IL_0060: ldc.i4 189 IL_0065: ceq IL_0067: brfalse IL_009d IL_006c: ldarg.2 IL_006d: ldarg.3 IL_006e: ldarg.0 IL_006f: ldfld <System.Runtime.CompilerServices.Closure:Constants> IL_0074: ldc.i4.3 IL_0075: ldelem.ref IL_0076: castclass <CallSite`1> IL_007b: dup IL_007c: stloc.0 IL_007d: ldfld <System.Runtime.CompilerServices.CallSite`1:Target> IL_0082: ldloc.0 IL_0083: ldarg.2 IL_0084: call <IronRuby.Runtime.RubyOps:GetContextFromScope (IronRuby.Runtime.RubyScope)> IL_0089: ldarg.s 4 IL_008b: callvirt <System.Func`4<System.Runtime.CompilerServices.CallSite, IronRuby.Runtime.RubyContext, IronRuby.Builtins.MutableString, IronRuby.Builtins.MutableString>:Invoke (System.Runtime.CompilerServices.CallSite,IronRuby.Runtime.RubyContext,IronRuby.Builtins.MutableString)> IL_0090: call <IronRuby.Builtins.KernelOps:Require (IronRuby.Runtime.RubyScope,object,IronRuby.Builtins.MutableString)> IL_0095: tail. IL_0097: call <Microsoft.Scripting.Runtime.ScriptingRuntimeHelpers:BooleanToObject (bool)> IL_009c: ret IL_009d: br IL_00a3 IL_00a2: ret IL_00a3: ldarg.1 IL_00a4: call <System.Runtime.CompilerServices.CallSiteOps:NeedsUpdate (System.Runtime.CompilerServices.CallSite)> IL_00a9: brfalse IL_00b0 IL_00ae: ldnull IL_00af: ret IL_00b0: ldarg.1 IL_00b1: castclass <CallSite`1> IL_00b6: callvirt <System.Runtime.CompilerServices.CallSite`1<System.Func`5<System.Runtime.CompilerServices.CallSite, IronRuby.Runtime.RubyScope, object, IronRuby.Builtins.MutableString, object>>:get_Update ()> IL_00bb: ldarg.1 IL_00bc: ldarg.2 IL_00bd: ldarg.3 IL_00be: ldarg.s 4 IL_00c0: callvirt <System.Func`5<System.Runtime.CompilerServices.CallSite, IronRuby.Runtime.RubyScope, object, IronRuby.Builtins.MutableString, object>:Invoke (System.Runtime.CompilerServices.CallSite,IronRuby.Runtime.RubyScope,object,IronRuby.Builtins.MutableString)> IL_00c5: ret The issue here is the instruction: IL_00a2: ret With is right after an unconditional branch, thus will be executed, but the IL is still wrong. -- Jb Evain <jb at nurv.fr> _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core