[Ironruby-core] Interrupt Execution

Tomas Matousek Tomas.Matousek at microsoft.com
Sun Jul 12 23:27:17 EDT 2009

There is currently no support for execution interruption in DLR or IronRuby.
It is not sufficient to insert termination checks in DLR interpreter. You need to add checks on other places too. And it's better not to do it in the interpreter because interpreted code gets compiled after a while (or even immediately if it contains loops) and then your checks are gone. It is also not sufficient to look for loops in DLR trees produced by IronRuby (e.g. "loop" method performs the looping inside C# code).

The easiest way how to make this work is to place check into
- WhileLoopExpression.cs: inside the infinite loop (AstFactory.Infinite...) - this ensures that all while loops in Ruby code are can be interrupted.
- BlockDefinition.cs: right after Ast.Label(redoLabel). This makes any block-based loops interruptible. 

This should allow you to interrupt any Ruby loop. 

Note that interrupting Ruby code can corrupt the state of the VM (ScriptRuntime) so you should probably not reuse that Runtime for other executions.


-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Aaron Clauson
Sent: Thursday, July 09, 2009 4:44 PM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Interrupt Execution

After spending a few hours delving into the DLR source I suspect the "interrupt execution" implementation is more related to the DLR core than IronRuby so I've posted a question over there http://dlr.codeplex.com/Thread/View.aspx?ThreadId=62052.


Posted via http://www.ruby-forum.com/.
Ironruby-core mailing list
Ironruby-core at rubyforge.org

More information about the Ironruby-core mailing list