Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[truffle] WIP work on calling method
Argument less method call on type object works
- Loading branch information
Showing
14 changed files
with
301 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 14 additions & 3 deletions
17
src/vm/jvm/runtime/org/perl6/nqp/truffle/nodes/expression/NQPCreatescNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,35 @@ | ||
package org.perl6.nqp.truffle.nodes.expression; | ||
import com.oracle.truffle.api.frame.VirtualFrame; | ||
import com.oracle.truffle.api.nodes.NodeInfo; | ||
import java.util.HashMap; | ||
import org.perl6.nqp.truffle.nodes.NQPNode; | ||
import org.perl6.nqp.truffle.nodes.NQPObjNode; | ||
import org.perl6.nqp.truffle.NQPScope; | ||
|
||
import org.perl6.nqp.truffle.sixmodel.SerializationContext; | ||
|
||
import org.perl6.nqp.dsl.Deserializer; | ||
|
||
@NodeInfo(shortName = "createsc") | ||
public final class NQPCreatescNode extends NQPObjNode { | ||
private final HashMap<String, SerializationContext> scs; | ||
@Child private NQPNode handleNode; | ||
|
||
@Deserializer | ||
public NQPCreatescNode(NQPNode handleNode) { | ||
public NQPCreatescNode(HashMap<String, SerializationContext> scs, NQPNode handleNode) { | ||
this.scs = scs; | ||
this.handleNode = handleNode; | ||
} | ||
|
||
@Deserializer("createsc") | ||
public static NQPCreatescNode deserialize(NQPScope scope, NQPNode handleNode) { | ||
return new NQPCreatescNode(scope.getGlobalContext().scs, handleNode); | ||
} | ||
|
||
@Override | ||
public Object execute(VirtualFrame frame) { | ||
return new SerializationContext(handleNode.executeStr(frame)); | ||
String handle = handleNode.executeStr(frame); | ||
SerializationContext sc = new SerializationContext(handle); | ||
scs.put(handle, sc); | ||
return sc; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 19 additions & 6 deletions
25
src/vm/jvm/runtime/org/perl6/nqp/truffle/nodes/expression/NQPWValNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,37 @@ | ||
package org.perl6.nqp.truffle.nodes.expression; | ||
import com.oracle.truffle.api.frame.VirtualFrame; | ||
import com.oracle.truffle.api.nodes.NodeInfo; | ||
import java.util.HashMap; | ||
import org.perl6.nqp.dsl.Deserializer; | ||
import org.perl6.nqp.truffle.nodes.NQPNode; | ||
import org.perl6.nqp.truffle.nodes.NQPObjNode; | ||
import org.perl6.nqp.truffle.runtime.NQPNull; | ||
import org.perl6.nqp.truffle.NQPScope; | ||
import org.perl6.nqp.truffle.sixmodel.SerializationContext; | ||
|
||
@NodeInfo(shortName = "wval") | ||
public final class NQPWValNode extends NQPObjNode { | ||
private final String handle; | ||
private final long idx; | ||
private final int index; | ||
|
||
@Deserializer | ||
public NQPWValNode(String handle, long idx) { | ||
public HashMap<String, SerializationContext> scs; | ||
|
||
public NQPWValNode(HashMap<String, SerializationContext> scs, String handle, int index) { | ||
this.scs = scs; | ||
this.handle = handle; | ||
this.idx = idx; | ||
this.index = index; | ||
} | ||
|
||
@Deserializer("wval") | ||
public static NQPWValNode deserialize(NQPScope scope, String handle, long index) { | ||
return new NQPWValNode(scope.getGlobalContext().scs, handle, (int) index); | ||
} | ||
|
||
/* TODO - do the lookup only once*/ | ||
@Override | ||
public Object execute(VirtualFrame frame) { | ||
return NQPNull.SINGLETON; | ||
if (scs.get(handle) == null) { | ||
System.out.println("no sc:" + handle); | ||
} | ||
return scs.get(handle).getObject(index); | ||
} | ||
} |
Oops, something went wrong.