SOMns icon indicating copy to clipboard operation
SOMns copied to clipboard

Optimize lexically bound dispatches in interpreter

Open smarr opened this issue 7 years ago • 0 comments

Currently, lexically bound dispatch is handled uniformly with other dispatches via a LexicallyBoundDispatchNode.

However, I noticed during debugging a stack overflow problem that it could potentially be replaced by a new subclass for AbstractMessageSendNode. The idea would be to transition the GenericMessageSendNode subtree into a LexicallyBoundSendNode, which doesn't require a separate LexicallyBoundDispatchNode anymore.

This could give a bit of a speedup in the interpreter, and might reduce stack pressure a little. However, this is likely going to interfere with instrumentation and other things.

This could be a good getting started issue. It would give you some familiarity with the idea of self-optimizing AST interpreters, the relevant node rewriting, SOMns' basic structure, and interpreter optimizations.

Stack trace of the bit that might benefit from optimization:

at som.interpreter.nodes.dispatch.LexicallyBoundDispatchNode.executeDispatch(LexicallyBoundDispatchNode.java:34)
at som.interpreter.nodes.MessageSendNode$GenericMessageSendNode.doPreEvaluated(MessageSendNode.java:313)
at som.interpreter.nodes.MessageSendNode$AbstractMessageSendNode.executeGeneric(MessageSendNode.java:128)

smarr avatar Dec 28 '17 12:12 smarr