[jruby-joni] 125/194: use singlebyte interpreter loop when passed code range in options

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 3bb4e508c574d62e7ac9bb69650e71326bc80710
Author: lopex <lopx at gazeta.pl>
Date:   Tue Jan 9 13:25:21 2018 +0100

    use singlebyte interpreter loop when passed code range in options
---
 src/org/joni/ByteCodeMachine.java |  2 +-
 src/org/joni/Option.java          | 13 ++++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/org/joni/ByteCodeMachine.java b/src/org/joni/ByteCodeMachine.java
index 32460bd..8e61512 100644
--- a/src/org/joni/ByteCodeMachine.java
+++ b/src/org/joni/ByteCodeMachine.java
@@ -185,7 +185,7 @@ class ByteCodeMachine extends StackMachine {
         bestLen = -1;
         s = _sstart;
         pkeep = _sstart;
-        return enc.isSingleByte() ? executeSb() : execute();
+        return enc.isSingleByte() || (msaOptions & Option.CR_7_BIT) != 0 ? executeSb() : execute();
     }
 
     private final int execute() throws InterruptedException {
diff --git a/src/org/joni/Option.java b/src/org/joni/Option.java
index 91d8a2a..1747738 100644
--- a/src/org/joni/Option.java
+++ b/src/org/joni/Option.java
@@ -19,8 +19,7 @@
  */
 package org.joni;
 
-public class Option {
-
+public final class Option {
     /* options */
     public static final int NONE                 = 0;
     public static final int IGNORECASE           = (1 << 0);
@@ -46,8 +45,9 @@ public class Option {
     public static final int NEWLINE_CRLF         = (1 << 15);
     public static final int NOTBOS               = (1 << 16);
     public static final int NOTEOS               = (1 << 17);
+    public static final int CR_7_BIT             = (1 << 18);
 
-    public static final int MAXBIT               = (1 << 18); /* limit */
+    public static final int MAXBIT               = (1 << 19); /* limit */
 
     public static final int DEFAULT              = NONE;
 
@@ -62,11 +62,10 @@ public class Option {
         if (isNegateSingleline(option)) options += "NEGATE_SINGLELINE";
         if (isDontCaptureGroup(option)) options += "DONT_CAPTURE_GROUP";
         if (isCaptureGroup(option)) options += "CAPTURE_GROUP";
-
         if (isNotBol(option)) options += "NOTBOL";
         if (isNotEol(option)) options += "NOTEOL";
         if (isPosixRegion(option)) options += "POSIX_REGION";
-
+        if (isCR7Bit(option)) options += "CR_7_BIT";
         return options;
     }
 
@@ -138,6 +137,10 @@ public class Option {
         return (option & NEWLINE_CRLF) != 0;
     }
 
+    public static boolean isCR7Bit(int option) {
+        return (option & CR_7_BIT) != 0;
+    }
+
     public static boolean isDynamic(int option) {
         // ignore-case and multibyte status are included in compiled code
         // return (option & (MULTILINE | IGNORECASE)) != 0;

-- 
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