Skip to content
Snippets Groups Projects
Commit a27a4e6e authored by Lukas Stadler's avatar Lukas Stadler
Browse files

use RTypes for fast paths, additional type profile in SetDiffFastPath

parent 64c37d61
Branches
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@
*/
package com.oracle.truffle.r.nodes.builtin.base.fastpaths;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.r.runtime.data.RDataFactory;
......@@ -31,15 +32,17 @@ import com.oracle.truffle.r.runtime.nodes.RFastPathNode;
public abstract class SetDiffFastPath extends RFastPathNode {
@Specialization(guards = "x.getStride() == 1")
protected Object setdiff(RIntSequence x, RAbstractIntVector y) {
@Specialization(guards = {"x.getStride() == 1", "y.getClass() == yClass"})
protected Object setdiff(RIntSequence x, RAbstractIntVector y,
@Cached("y.getClass()") Class<? extends RAbstractIntVector> yClass) {
RAbstractIntVector profiledY = yClass.cast(y);
int xLength = x.getLength();
int xStart = x.getStart();
int yLength = y.getLength();
int yLength = profiledY.getLength();
boolean[] excluded = new boolean[xLength];
for (int i = 0; i < yLength; i++) {
int element = y.getDataAt(i);
int element = profiledY.getDataAt(i);
int index = element - xStart;
if (index >= 0 && index < xLength) {
excluded[index] = true;
......
......@@ -22,8 +22,11 @@
*/
package com.oracle.truffle.r.runtime.nodes;
import com.oracle.truffle.api.dsl.TypeSystemReference;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.r.runtime.data.RTypes;
@TypeSystemReference(RTypes.class)
public abstract class RFastPathNode extends RBaseNode {
public abstract Object execute(VirtualFrame frame, Object... args);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment