[IronPython] irc.rb

KE hellosticky at gmail.com
Sat Sep 6 14:07:39 CEST 2008


It's coming from the call stack -> CompileLambda -> AnalyzeLambda. The
LambdaExpression is "($scope, $language) => [Scope]" but AnalyzeLambda
passes a null CompilerScope to VariableBinder.Bind. Somehow this same
VariableBinder is used during a ExpressionType.Call to:

//
// AST: MethodCallExpression
//

(RubyOps.CreateTopLevelScope)(
    .localScope (
    )
    ,
    (.arg #globalScope),
    (.arg #language),
    (.var #self_5_0),
    (.var #rfc_nonlifted_5_2),
)

It is using the VariableBinder with a null parent CompilerScope on the ".arg
#globalScope" evaluation

-----Original Message-----
From: KE [mailto:hellosticky at gmail.com] 
Sent: Saturday, September 06, 2008 7:25 AM
To: 'Tomas Matousek'; 'IronRuby'; IronPython
Subject: RE: [IronPython] irc.rb

Okay, well I found two code problems in two IR implementations of
IExpressionSerializable:

/ironruby/Runtime/Calls/rubycallaction.cs CreateExpression() is passing the
wrong second Type parameter. It should be typeof(RubyCallSignature)

/ironruby/Runtime/Calls/rubycallsignature.cs CreateExpression() is not
passing enough parameters. typeof(bool) and Ast.Constant(_hasRhsArgument)
should be added to find the right Constructor.

The next problem is:

Variable '#globalScope' referenced from lambda
'C:\work\ironruby\co\svn\trunk\build\release\test.rb', but it is not defined
in an outer scope

In
Microsoft.Scripting.Core.dll!System.Linq.Expressions.Compiler.VariableBinder
.Reference(System.Linq.Expressions.Expression variable = {#globalScope},
bool hoist = false) Line 238	C#

I'm guessing I haven't initialized some global context?

Thanks,

-----Original Message-----
From: KE [mailto:hellosticky at gmail.com] 
Sent: Saturday, September 06, 2008 6:50 AM
To: 'Tomas Matousek'; 'Discussion of IronPython'; 'IronRuby'
Subject: RE: [IronPython] irc.rb

Thanks! I've also created a bug report:

http://rubyforge.org/tracker/index.php?func=detail&aid=21839&group_id=4359&a
tid=16798

This includes the irc.rb which I think IronRuby will be interested in
including in the IronRuby distribution as well..

I'll try to step through into this bug and understand what's going on,
although I have no clue what I'm looking at :)
Thanks,

-----Original Message-----
From: Tomas Matousek [mailto:Tomas.Matousek at microsoft.com] 
Sent: Saturday, September 06, 2008 12:49 AM
To: hellosticky at gmail.com; Discussion of IronPython; IronRuby
Subject: RE: [IronPython] irc.rb

Right. This is the error Dino overheard me talking about :) As you can see
from the stack trac, something seems to be broken in DLR. I'll look at it
and see whether I can come with a simple fix. Precompilation is currently P2
on our task list though, so I'm afraid any more complex work would need to
wait until P1's are done.

Tomas

-----Original Message-----
From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of KE
Sent: Friday, September 05, 2008 5:24 PM
To: IronRuby
Cc: IronPython
Subject: [IronPython] irc.rb

Hi, I've created an irc.rb (attached) which mimics IronPython's pyc.py. It
is failing on this line:

Microsoft::Scripting::ScriptCode.save_to_assembly(outfile, codes.to_array())

With the following exception... Any help would be greatly appreciated. The
test file I'm trying to compile is also attached. I am building on revision
140. I have also tried with the Microsoft.Scripting and
Microsoft.Scripting.Core dlls from IronPython with the same result.

C:\work\ironruby\co\svn\trunk\build\release>.\ir.exe irc.rb -target:dll
-verbose test.rb Compiling
C:\work\ironruby\co\svn\trunk\build\release\test.rb...
Creating output file C:\work\ironruby\co\svn\trunk\build\release\test.dll...
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\NewExpression
.cs:88:in `New': Value cannot be null.
Parameter name: constructor (System::ArgumentNullException)
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\NewExpression
.cs:83:in `New'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.Generated.cs:294:in `DefaultVisitDynamicExpression'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.Generated.cs:191:in `VisitNode'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.cs:40:in `VisitNodes'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.cs:108:in `Visit'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.Generated.cs:264:in `DefaultVisitBlock'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.Generated.cs:176:in `VisitNode'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.cs:40:in `VisitNodes'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.cs:108:in `Visit'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.Generated.cs:264:in `DefaultVisitBlock'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.Generated.cs:176:in `VisitNode'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.cs:40:in `VisitNodes'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.cs:108:in `Visit'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.Generated.cs:264:in `DefaultVisitBlock'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.Generated.cs:176:in `VisitNode'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.cs:40:in `VisitNodes'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.cs:108:in `Visit'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.Generated.cs:264:in `DefaultVisitBlock'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.Generated.cs:176:in `VisitNode'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.cs:272:in `Visit'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.Generated.cs:374:in `DefaultVisitScopeExpression'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.Generated.cs:218:in `VisitNode'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Ast\ExpressionTre
eVisitor.cs:189:in `Visit'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Actions\MatchCall
er.Generated.cs:40:in `Call4'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Actions\CallSite.
cs:275:in `UpdateAndExecute'
        from
C:\work\ironruby\co\svn\trunk\src\Microsoft.Scripting.Core\Actions\UpdateDel
egates.Generated.cs:52:in `Update4'
        from :0




More information about the Ironpython-users mailing list