Truffle: executeCached, get, and other abstract methods? And a little generator bug.

Stefan Marr java at stefan-marr.de
Mon Nov 4 04:24:10 PST 2013


Hi:

I found another useful abstract method in truffle node classes: executeCachedGeneric, which allows me to execute the code of a specialized node after replacing a more general one.
After inspecting the generator code, I also found that executeCached* is probably working also for other kind of specializations.

And since there are also the accessors for node children (get$childName),
I was wondering whether the TruffleDSL has other similar gems hidden in it, which might be useful?

As a related note, I also saw a null pointer exception that can be reproduced with the code snippet below.

Best regards
Stefan


package som.interpreter.nodes.specialized;

import som.interpreter.Types;
import som.interpreter.nodes.ExpressionNode;
import som.vmobjects.SAbstractObject;

import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.dsl.TypeSystemReference;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.Node;

@TypeSystemReference(Types.class)
@NodeChild(value = "receiver", type = ExpressionNode.class)
public abstract class TestNode extends Node {
 public abstract SAbstractObject executeCachedGeneric(final VirtualFrame frame, final Object receiver);

 @Specialization
 public SAbstractObject doGeneric(final VirtualFrame frame,
     final SAbstractObject receiver) {
   return null;
 }
}

-- 
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax:   +32 2 629 3525



More information about the graal-dev mailing list