[jruby-joni] 124/194: hoist some values
Hideki Yamane
henrich at moszumanska.debian.org
Thu Feb 1 12:04:33 UTC 2018
This is an automated email from the git hooks/post-receive script.
henrich pushed a commit to branch debian/sid
in repository jruby-joni.
commit ce70f9bd7345d3452f1cda3ca202e1c85f53357f
Author: lopex <lopx at gazeta.pl>
Date: Tue Jan 9 10:40:19 2018 +0100
hoist some values
---
src/org/joni/ByteCodeMachine.java | 35 +++++++++++------------------------
1 file changed, 11 insertions(+), 24 deletions(-)
diff --git a/src/org/joni/ByteCodeMachine.java b/src/org/joni/ByteCodeMachine.java
index 0fc7349..32460bd 100644
--- a/src/org/joni/ByteCodeMachine.java
+++ b/src/org/joni/ByteCodeMachine.java
@@ -484,26 +484,17 @@ class ByteCodeMachine extends StackMachine {
region.beg[0] = msaBegin = ((pkeep > s) ? s : pkeep) - str;
region.end[0] = msaEnd = s - str;
for (int i = 1; i <= regex.numMem; i++) {
- // opt!
- if (repeatStk[memEndStk + i] != INVALID_INDEX) {
- region.beg[i] = bsAt(regex.btMemStart, i) ?
- stack[repeatStk[memStartStk + i]].getMemPStr() - str :
- repeatStk[memStartStk + i] - str;
-
-
- region.end[i] = bsAt(regex.btMemEnd, i) ?
- stack[repeatStk[memEndStk + i]].getMemPStr() :
- repeatStk[memEndStk + i] - str;
-
+ int me = repeatStk[memEndStk + i];
+ if (me != INVALID_INDEX) {
+ int ms = repeatStk[memStartStk + i];
+ region.beg[i] = (bsAt(regex.btMemStart, i) ? stack[ms].getMemPStr() : ms) - str;
+ region.end[i] = bsAt(regex.btMemEnd, i) ? stack[me].getMemPStr() : me - str;
} else {
region.beg[i] = region.end[i] = Region.REGION_NOTPOS;
}
-
}
- if (Config.USE_CAPTURE_HISTORY) {
- if (regex.captureHistory != 0) checkCaptureHistory(region);
- }
+ if (Config.USE_CAPTURE_HISTORY && regex.captureHistory != 0) checkCaptureHistory(region);
} else {
msaBegin = ((pkeep > s) ? s : pkeep) - str;
msaEnd = s - str;
@@ -1370,13 +1361,7 @@ class ByteCodeMachine extends StackMachine {
int mem = code[ip++];
repeatStk[memEndStk + mem] = s;
int stkp = getMemStart(mem);
-
- if (BitStatus.bsAt(regex.btMemStart, mem)) {
- repeatStk[memStartStk + mem] = stkp;
- } else {
- repeatStk[memStartStk + mem] = stack[stkp].getMemPStr();
- }
-
+ repeatStk[memStartStk + mem] = bsAt(regex.btMemStart, mem) ? stkp : stack[stkp].getMemPStr();
pushMemEndMark(mem);
}
@@ -1385,11 +1370,13 @@ class ByteCodeMachine extends StackMachine {
}
private int backrefStart(int mem) {
- return bsAt(regex.btMemStart, mem) ? stack[repeatStk[memStartStk + mem]].getMemPStr() : repeatStk[memStartStk + mem];
+ int ms = repeatStk[memStartStk + mem];
+ return bsAt(regex.btMemStart, mem) ? stack[ms].getMemPStr() : ms;
}
private int backrefEnd(int mem) {
- return bsAt(regex.btMemEnd, mem) ? stack[repeatStk[memEndStk + mem]].getMemPStr() : repeatStk[memEndStk + mem];
+ int me = repeatStk[memEndStk + mem];
+ return bsAt(regex.btMemEnd, mem) ? stack[me].getMemPStr() : me;
}
private void backref(int mem) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jruby-joni.git
More information about the pkg-java-commits
mailing list