jdk.nashorn.internal.runtime.regexp.joni.constants.OPSize Java Examples

The following examples show how to use jdk.nashorn.internal.runtime.regexp.joni.constants.OPSize. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArrayCompiler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static int compileLengthCClassNode(final CClassNode cc) {
    if (cc.isShare()) {
        return OPSize.OPCODE + OPSize.POINTER;
    }

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
 
Example #2
Source File: ArrayCompiler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static int compileLengthCClassNode(final CClassNode cc) {
    if (cc.isShare()) {
        return OPSize.OPCODE + OPSize.POINTER;
    }

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
 
Example #3
Source File: ArrayCompiler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void compileRangeRepeatNode(final QuantifierNode qn, final int targetLen, final int emptyInfo) {
    final int numRepeat = regex.numRepeat;
    addOpcode(qn.greedy ? OPCode.REPEAT : OPCode.REPEAT_NG);
    addMemNum(numRepeat); /* OP_REPEAT ID */
    regex.numRepeat++;
    addRelAddr(targetLen + OPSize.REPEAT_INC);

    entryRepeatRange(numRepeat, qn.lower, qn.upper);

    compileTreeEmptyCheck(qn.target, emptyInfo);

    if (qn.isInRepeat()) {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
    } else {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
    }

    addMemNum(numRepeat); /* OP_REPEAT ID */
}
 
Example #4
Source File: ArrayCompiler.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
private void compileRangeRepeatNode(QuantifierNode qn, int targetLen, int emptyInfo) {
    int numRepeat = regex.numRepeat;
    addOpcode(qn.greedy ? OPCode.REPEAT : OPCode.REPEAT_NG);
    addMemNum(numRepeat); /* OP_REPEAT ID */
    regex.numRepeat++;
    addRelAddr(targetLen + OPSize.REPEAT_INC);

    entryRepeatRange(numRepeat, qn.lower, qn.upper);

    compileTreeEmptyCheck(qn.target, emptyInfo);

    if (qn.isInRepeat()) {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
    } else {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
    }

    addMemNum(numRepeat); /* OP_REPEAT ID */
}
 
Example #5
Source File: ArrayCompiler.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static int compileLengthCClassNode(final CClassNode cc) {
    if (cc.isShare()) {
        return OPSize.OPCODE + OPSize.POINTER;
    }

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
 
Example #6
Source File: ArrayCompiler.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
private int compileLengthCClassNode(CClassNode cc) {
    if (cc.isShare()) return OPSize.OPCODE + OPSize.POINTER;

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
 
Example #7
Source File: ArrayCompiler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static int compileLengthCClassNode(final CClassNode cc) {
    if (cc.isShare()) {
        return OPSize.OPCODE + OPSize.POINTER;
    }

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
 
Example #8
Source File: ArrayCompiler.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private int compileLengthCClassNode(CClassNode cc) {
    if (cc.isShare()) return OPSize.OPCODE + OPSize.POINTER;

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
 
Example #9
Source File: ArrayCompiler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void compileRangeRepeatNode(final QuantifierNode qn, final int targetLen, final int emptyInfo) {
    final int numRepeat = regex.numRepeat;
    addOpcode(qn.greedy ? OPCode.REPEAT : OPCode.REPEAT_NG);
    addMemNum(numRepeat); /* OP_REPEAT ID */
    regex.numRepeat++;
    addRelAddr(targetLen + OPSize.REPEAT_INC);

    entryRepeatRange(numRepeat, qn.lower, qn.upper);

    compileTreeEmptyCheck(qn.target, emptyInfo);

    if (qn.isInRepeat()) {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
    } else {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
    }

    addMemNum(numRepeat); /* OP_REPEAT ID */
}
 
Example #10
Source File: ArrayCompiler.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void compileRangeRepeatNode(QuantifierNode qn, int targetLen, int emptyInfo) {
    int numRepeat = regex.numRepeat;
    addOpcode(qn.greedy ? OPCode.REPEAT : OPCode.REPEAT_NG);
    addMemNum(numRepeat); /* OP_REPEAT ID */
    regex.numRepeat++;
    addRelAddr(targetLen + OPSize.REPEAT_INC);

    entryRepeatRange(numRepeat, qn.lower, qn.upper);

    compileTreeEmptyCheck(qn.target, emptyInfo);

    if (qn.isInRepeat()) {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
    } else {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
    }

    addMemNum(numRepeat); /* OP_REPEAT ID */
}
 
Example #11
Source File: ArrayCompiler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static int compileLengthCClassNode(final CClassNode cc) {
    if (cc.isShare()) {
        return OPSize.OPCODE + OPSize.POINTER;
    }

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
 
Example #12
Source File: ArrayCompiler.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void compileRangeRepeatNode(final QuantifierNode qn, final int targetLen, final int emptyInfo) {
    final int numRepeat = regex.numRepeat;
    addOpcode(qn.greedy ? OPCode.REPEAT : OPCode.REPEAT_NG);
    addMemNum(numRepeat); /* OP_REPEAT ID */
    regex.numRepeat++;
    addRelAddr(targetLen + OPSize.REPEAT_INC);

    entryRepeatRange(numRepeat, qn.lower, qn.upper);

    compileTreeEmptyCheck(qn.target, emptyInfo);

    if (qn.isInRepeat()) {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
    } else {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
    }

    addMemNum(numRepeat); /* OP_REPEAT ID */
}
 
Example #13
Source File: ArrayCompiler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private int compileLengthEncloseNode(EncloseNode node) {
    if (node.isOption()) {
        return compileLengthOptionNode(node);
    }

    int tlen;
    if (node.target != null) {
        tlen = compileLengthTree(node.target);
    } else {
        tlen = 0;
    }

    int len;
    switch (node.type) {
    case EncloseType.MEMORY:
        if (bsAt(regex.btMemStart, node.regNum)) {
            len = OPSize.MEMORY_START_PUSH;
        } else {
            len = OPSize.MEMORY_START;
        }
        len += tlen + (bsAt(regex.btMemEnd, node.regNum) ? OPSize.MEMORY_END_PUSH : OPSize.MEMORY_END);
        break;

    case EncloseType.STOP_BACKTRACK:
        if (node.isStopBtSimpleRepeat()) {
            QuantifierNode qn = (QuantifierNode)node.target;
            tlen = compileLengthTree(qn.target);
            len = tlen * qn.lower + OPSize.PUSH + tlen + OPSize.POP + OPSize.JUMP;
        } else {
            len = OPSize.PUSH_STOP_BT + tlen + OPSize.POP_STOP_BT;
        }
        break;

    default:
        newInternalException(ERR_PARSER_BUG);
        return 0; // not reached
    } // switch
    return len;
}
 
Example #14
Source File: ArrayCompiler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private int compileLengthAnchorNode(AnchorNode node) {
    int tlen;
    if (node.target != null) {
        tlen = compileLengthTree(node.target);
    } else {
        tlen = 0;
    }

    int len;
    switch (node.type) {
    case AnchorType.PREC_READ:
        len = OPSize.PUSH_POS + tlen + OPSize.POP_POS;
        break;

    case AnchorType.PREC_READ_NOT:
        len = OPSize.PUSH_POS_NOT + tlen + OPSize.FAIL_POS;
        break;

    case AnchorType.LOOK_BEHIND:
        len = OPSize.LOOK_BEHIND + tlen;
        break;

    case AnchorType.LOOK_BEHIND_NOT:
        len = OPSize.PUSH_LOOK_BEHIND_NOT + tlen + OPSize.FAIL_LOOK_BEHIND_NOT;
        break;

    default:
        len = OPSize.OPCODE;
        break;
    } // switch
    return len;
}
 
Example #15
Source File: ArrayCompiler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private int compileLengthOptionNode(EncloseNode node) {
    int prev = regex.options;
    regex.options = node.option;
    int tlen = compileLengthTree(node.target);
    regex.options = prev;

    if (isDynamic(prev ^ node.option)) {
        return OPSize.SET_OPTION_PUSH + OPSize.SET_OPTION + OPSize.FAIL + tlen + OPSize.SET_OPTION;
    } else {
        return tlen;
    }
}
 
Example #16
Source File: ArrayCompiler.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
private static int addCompileStringlength(final char[] chars, final int p, final int strLength, final boolean ignoreCase) {
    final int op = selectStrOpcode(strLength, ignoreCase);
    int len = OPSize.OPCODE;

    if (Config.USE_STRING_TEMPLATES && opTemplated(op)) {
        // string length, template index, template string pointer
        len += OPSize.LENGTH + OPSize.INDEX + OPSize.INDEX;
    } else {
        if (isNeedStrLenOpExact(op)) {
            len += OPSize.LENGTH;
        }
        len += strLength;
    }
    return len;
}
 
Example #17
Source File: ArrayCompiler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void compileAltNode(ConsAltNode node) {
    ConsAltNode aln = node;
    int len = 0;

    do {
        len += compileLengthTree(aln.car);
        if (aln.cdr != null) {
            len += OPSize.PUSH + OPSize.JUMP;
        }
    } while ((aln = aln.cdr) != null);

    int pos = codeLength + len;  /* goal position */

    aln = node;
    do {
        len = compileLengthTree(aln.car);
        if (aln.cdr != null) {
            addOpcodeRelAddr(OPCode.PUSH, len + OPSize.JUMP);
        }
        compileTree(aln.car);
        if (aln.cdr != null) {
            len = pos - (codeLength + OPSize.JUMP);
            addOpcodeRelAddr(OPCode.JUMP, len);
        }
    } while ((aln = aln.cdr) != null);
}
 
Example #18
Source File: ArrayCompiler.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
private int compileLengthOptionNode(final EncloseNode node) {
    final int prev = regex.options;
    regex.options = node.option;
    final int tlen = compileLengthTree(node.target);
    regex.options = prev;

    if (isDynamic(prev ^ node.option)) {
        return OPSize.SET_OPTION_PUSH + OPSize.SET_OPTION + OPSize.FAIL + tlen + OPSize.SET_OPTION;
    }
    return tlen;
}
 
Example #19
Source File: ArrayCompiler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static int addCompileStringlength(final char[] chars, final int p, final int strLength, final boolean ignoreCase) {
    final int op = selectStrOpcode(strLength, ignoreCase);
    int len = OPSize.OPCODE;

    if (Config.USE_STRING_TEMPLATES && opTemplated(op)) {
        // string length, template index, template string pointer
        len += OPSize.LENGTH + OPSize.INDEX + OPSize.INDEX;
    } else {
        if (isNeedStrLenOpExact(op)) {
            len += OPSize.LENGTH;
        }
        len += strLength;
    }
    return len;
}
 
Example #20
Source File: ArrayCompiler.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private int compileLengthEncloseNode(EncloseNode node) {
    if (node.isOption()) {
        return compileLengthOptionNode(node);
    }

    int tlen;
    if (node.target != null) {
        tlen = compileLengthTree(node.target);
    } else {
        tlen = 0;
    }

    int len;
    switch (node.type) {
    case EncloseType.MEMORY:
        if (bsAt(regex.btMemStart, node.regNum)) {
            len = OPSize.MEMORY_START_PUSH;
        } else {
            len = OPSize.MEMORY_START;
        }
        len += tlen + (bsAt(regex.btMemEnd, node.regNum) ? OPSize.MEMORY_END_PUSH : OPSize.MEMORY_END);
        break;

    case EncloseType.STOP_BACKTRACK:
        if (node.isStopBtSimpleRepeat()) {
            QuantifierNode qn = (QuantifierNode)node.target;
            tlen = compileLengthTree(qn.target);
            len = tlen * qn.lower + OPSize.PUSH + tlen + OPSize.POP + OPSize.JUMP;
        } else {
            len = OPSize.PUSH_STOP_BT + tlen + OPSize.POP_STOP_BT;
        }
        break;

    default:
        newInternalException(ERR_PARSER_BUG);
        return 0; // not reached
    } // switch
    return len;
}
 
Example #21
Source File: ArrayCompiler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private int compileLengthOptionNode(final EncloseNode node) {
    final int prev = regex.options;
    regex.options = node.option;
    final int tlen = compileLengthTree(node.target);
    regex.options = prev;

    if (isDynamic(prev ^ node.option)) {
        return OPSize.SET_OPTION_PUSH + OPSize.SET_OPTION + OPSize.FAIL + tlen + OPSize.SET_OPTION;
    }
    return tlen;
}
 
Example #22
Source File: ArrayCompiler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private int addCompileStringlength(char[] chars, int p, int strLength, boolean ignoreCase) {
    int op = selectStrOpcode(strLength, ignoreCase);
    int len = OPSize.OPCODE;

    if (Config.USE_STRING_TEMPLATES && opTemplated(op)) {
        // string length, template index, template string pointer
        len += OPSize.LENGTH + OPSize.INDEX + OPSize.INDEX;
    } else {
        if (isNeedStrLenOpExact(op)) len += OPSize.LENGTH;
        len += strLength;
    }
    return len;
}
 
Example #23
Source File: ArrayCompiler.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
private int compileLengthEncloseNode(final EncloseNode node) {
    if (node.isOption()) {
        return compileLengthOptionNode(node);
    }

    int tlen;
    if (node.target != null) {
        tlen = compileLengthTree(node.target);
    } else {
        tlen = 0;
    }

    int len;
    switch (node.type) {
    case EncloseType.MEMORY:
        if (bsAt(regex.btMemStart, node.regNum)) {
            len = OPSize.MEMORY_START_PUSH;
        } else {
            len = OPSize.MEMORY_START;
        }
        len += tlen + (bsAt(regex.btMemEnd, node.regNum) ? OPSize.MEMORY_END_PUSH : OPSize.MEMORY_END);
        break;

    case EncloseType.STOP_BACKTRACK:
        if (node.isStopBtSimpleRepeat()) {
            final QuantifierNode qn = (QuantifierNode)node.target;
            tlen = compileLengthTree(qn.target);
            len = tlen * qn.lower + OPSize.PUSH + tlen + OPSize.POP + OPSize.JUMP;
        } else {
            len = OPSize.PUSH_STOP_BT + tlen + OPSize.POP_STOP_BT;
        }
        break;

    default:
        newInternalException(ERR_PARSER_BUG);
        return 0; // not reached
    } // switch
    return len;
}
 
Example #24
Source File: ArrayCompiler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private int compileLengthEncloseNode(final EncloseNode node) {
    if (node.isOption()) {
        return compileLengthOptionNode(node);
    }

    int tlen;
    if (node.target != null) {
        tlen = compileLengthTree(node.target);
    } else {
        tlen = 0;
    }

    int len;
    switch (node.type) {
    case EncloseType.MEMORY:
        if (bsAt(regex.btMemStart, node.regNum)) {
            len = OPSize.MEMORY_START_PUSH;
        } else {
            len = OPSize.MEMORY_START;
        }
        len += tlen + (bsAt(regex.btMemEnd, node.regNum) ? OPSize.MEMORY_END_PUSH : OPSize.MEMORY_END);
        break;

    case EncloseType.STOP_BACKTRACK:
        if (node.isStopBtSimpleRepeat()) {
            final QuantifierNode qn = (QuantifierNode)node.target;
            tlen = compileLengthTree(qn.target);
            len = tlen * qn.lower + OPSize.PUSH + tlen + OPSize.POP + OPSize.JUMP;
        } else {
            len = OPSize.PUSH_STOP_BT + tlen + OPSize.POP_STOP_BT;
        }
        break;

    default:
        newInternalException(ERR_PARSER_BUG);
        return 0; // not reached
    } // switch
    return len;
}
 
Example #25
Source File: ArrayCompiler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private int compileLengthOptionNode(final EncloseNode node) {
    final int prev = regex.options;
    regex.options = node.option;
    final int tlen = compileLengthTree(node.target);
    regex.options = prev;

    if (isDynamic(prev ^ node.option)) {
        return OPSize.SET_OPTION_PUSH + OPSize.SET_OPTION + OPSize.FAIL + tlen + OPSize.SET_OPTION;
    }
    return tlen;
}
 
Example #26
Source File: ArrayCompiler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static int addCompileStringlength(final char[] chars, final int p, final int strLength, final boolean ignoreCase) {
    final int op = selectStrOpcode(strLength, ignoreCase);
    int len = OPSize.OPCODE;

    if (Config.USE_STRING_TEMPLATES && opTemplated(op)) {
        // string length, template index, template string pointer
        len += OPSize.LENGTH + OPSize.INDEX + OPSize.INDEX;
    } else {
        if (isNeedStrLenOpExact(op)) {
            len += OPSize.LENGTH;
        }
        len += strLength;
    }
    return len;
}
 
Example #27
Source File: ArrayCompiler.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private int compileLengthOptionNode(EncloseNode node) {
    int prev = regex.options;
    regex.options = node.option;
    int tlen = compileLengthTree(node.target);
    regex.options = prev;

    if (isDynamic(prev ^ node.option)) {
        return OPSize.SET_OPTION_PUSH + OPSize.SET_OPTION + OPSize.FAIL + tlen + OPSize.SET_OPTION;
    } else {
        return tlen;
    }
}
 
Example #28
Source File: ArrayCompiler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private int compileLengthEncloseNode(final EncloseNode node) {
    if (node.isOption()) {
        return compileLengthOptionNode(node);
    }

    int tlen;
    if (node.target != null) {
        tlen = compileLengthTree(node.target);
    } else {
        tlen = 0;
    }

    int len;
    switch (node.type) {
    case EncloseType.MEMORY:
        if (bsAt(regex.btMemStart, node.regNum)) {
            len = OPSize.MEMORY_START_PUSH;
        } else {
            len = OPSize.MEMORY_START;
        }
        len += tlen + (bsAt(regex.btMemEnd, node.regNum) ? OPSize.MEMORY_END_PUSH : OPSize.MEMORY_END);
        break;

    case EncloseType.STOP_BACKTRACK:
        if (node.isStopBtSimpleRepeat()) {
            final QuantifierNode qn = (QuantifierNode)node.target;
            tlen = compileLengthTree(qn.target);
            len = tlen * qn.lower + OPSize.PUSH + tlen + OPSize.POP + OPSize.JUMP;
        } else {
            len = OPSize.PUSH_STOP_BT + tlen + OPSize.POP_STOP_BT;
        }
        break;

    default:
        newInternalException(ERR_PARSER_BUG);
        return 0; // not reached
    } // switch
    return len;
}
 
Example #29
Source File: ArrayCompiler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private int compileLengthOptionNode(final EncloseNode node) {
    final int prev = regex.options;
    regex.options = node.option;
    final int tlen = compileLengthTree(node.target);
    regex.options = prev;

    if (isDynamic(prev ^ node.option)) {
        return OPSize.SET_OPTION_PUSH + OPSize.SET_OPTION + OPSize.FAIL + tlen + OPSize.SET_OPTION;
    }
    return tlen;
}
 
Example #30
Source File: ArrayCompiler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static int addCompileStringlength(final char[] chars, final int p, final int strLength, final boolean ignoreCase) {
    final int op = selectStrOpcode(strLength, ignoreCase);
    int len = OPSize.OPCODE;

    if (Config.USE_STRING_TEMPLATES && opTemplated(op)) {
        // string length, template index, template string pointer
        len += OPSize.LENGTH + OPSize.INDEX + OPSize.INDEX;
    } else {
        if (isNeedStrLenOpExact(op)) {
            len += OPSize.LENGTH;
        }
        len += strLength;
    }
    return len;
}