Search in sources :

Example 1 with CallSiteTreeNode

use of org.jikesrvm.compilers.opt.inlining.CallSiteTreeNode in project JikesRVM by JikesRVM.

the class OptEncodedCallSiteTree method getEncoding.

@Interruptible
static int getEncoding(CallSiteTreeNode current, int offset, int parent, int[] encoding) {
    int i = offset;
    if (parent != -1) {
        encoding[i++] = parent - offset;
    }
    CallSiteTreeNode x = current;
    int j = i;
    while (x != null) {
        x.encodedOffset = j;
        int byteCodeIndex = x.callSite.getBcIndex();
        encoding[j++] = (byteCodeIndex >= 0) ? byteCodeIndex : -1;
        encoding[j++] = x.callSite.getMethod().getId();
        x = (CallSiteTreeNode) x.getRightSibling();
    }
    x = current;
    int thisParent = i;
    while (x != null) {
        if (x.getLeftChild() != null) {
            j = getEncoding((CallSiteTreeNode) x.getLeftChild(), j, thisParent, encoding);
        }
        thisParent += 2;
        x = (CallSiteTreeNode) x.getRightSibling();
    }
    return j;
}
Also used : CallSiteTreeNode(org.jikesrvm.compilers.opt.inlining.CallSiteTreeNode) Interruptible(org.vmmagic.pragma.Interruptible)

Example 2 with CallSiteTreeNode

use of org.jikesrvm.compilers.opt.inlining.CallSiteTreeNode in project JikesRVM by JikesRVM.

the class OptEncodedCallSiteTree method getEncoding.

@Interruptible
public static int[] getEncoding(CallSiteTree tree) {
    int size = 0;
    if (tree.isEmpty()) {
        return null;
    } else {
        Enumeration<TreeNode> e = tree.elements();
        while (e.hasMoreElements()) {
            TreeNode x = e.nextElement();
            if (x.getLeftChild() == null) {
                size += 2;
            } else {
                size += 3;
            }
        }
        int[] encoding = new int[size];
        getEncoding((CallSiteTreeNode) tree.getRoot(), 0, -1, encoding);
        return encoding;
    }
}
Also used : TreeNode(org.jikesrvm.compilers.opt.util.TreeNode) CallSiteTreeNode(org.jikesrvm.compilers.opt.inlining.CallSiteTreeNode) Interruptible(org.vmmagic.pragma.Interruptible)

Aggregations

CallSiteTreeNode (org.jikesrvm.compilers.opt.inlining.CallSiteTreeNode)2 Interruptible (org.vmmagic.pragma.Interruptible)2 TreeNode (org.jikesrvm.compilers.opt.util.TreeNode)1