The Computer Language
24.09 Benchmarks Game

regex-redux Java OpenJ9 #8 program

source code

/*
   The Computer Language Benchmarks Game
   https://salsa.debian.org/benchmarksgame-team/benchmarksgame/

   contributed by Piotr Tarsa
*/

import jextract_pcre2.pcre2_h;

import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Consumer;
import java.util.function.Function;

import static java.lang.foreign.ValueLayout.*;

public class regexredux {
    private static final ExecutorService EXECUTOR_SERVICE =
            Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());

    private static final Arena GLOBAL_ARENA = Arena.global();

    public static void main(String[] args) throws Exception {
        final byte[] rawInput = System.in.readAllBytes();
        final int initialLength = rawInput.length;

        final var sequence = GLOBAL_ARENA.allocate(initialLength);
        final int sequenceLength = withArena(arena -> {
            var rawInputBuffer = arena.allocateFrom(JAVA_BYTE, rawInput);
            var compiledPattern = compilePattern(">.*\\n|\\n");
            return substitute(compiledPattern, rawInputBuffer, initialLength,
                    pcre2_h.NULL(), sequence, initialLength, "");
        });

        var magicRegExpsCount = EXECUTOR_SERVICE.submit(() -> {
            final Map<String, String> iub = new LinkedHashMap<>();
            iub.put("tHa[Nt]", "<4>");
            iub.put("aND|caN|Ha[DS]|WaS", "<3>");
            iub.put("a[NSt]|BY", "<2>");
            iub.put("<[^>]*>", "|");
            iub.put("\\|[^|][^|]*\\|", "-");

            return withArena(arena -> {
                var currentLength = sequenceLength;
                var bufLength = currentLength * 3 / 2;
                var buf1 = arena.allocate(bufLength);
                var buf2 = arena.allocate(bufLength);
                MemorySegment.copy(sequence, 0, buf1, 0, sequenceLength);
                var flip = false;

                for (Entry<String, String> entry : iub.entrySet()) {
                    var pattern = entry.getKey();
                    var replacement = entry.getValue();

                    var compiledPattern = compilePattern(pattern);
                    currentLength = substitute(compiledPattern,
                            flip ? buf2 : buf1, currentLength,
                            pcre2_h.NULL(),
                            flip ? buf1 : buf2, bufLength,
                            replacement);
                    flip = !flip;
                }
                return currentLength;
            });
        });

        var variants = Arrays.asList("agggtaaa|tttaccct",
                "[cgt]gggtaaa|tttaccc[acg]",
                "a[act]ggtaaa|tttacc[agt]t",
                "ag[act]gtaaa|tttac[agt]ct",
                "agg[act]taaa|ttta[agt]cct",
                "aggg[acg]aaa|ttt[cgt]ccct",
                "agggt[cgt]aa|tt[acg]accct",
                "agggta[cgt]a|t[acg]taccct",
                "agggtaa[cgt]|[acg]ttaccct");

        var tasks = variants.stream().map(variant -> (Callable<String>) () -> {
            var compiledPattern = compilePattern(variant);
            var oVectorSize = 100;
            var matchData = pcre2_h
                    .pcre2_match_data_create_8(oVectorSize, pcre2_h.NULL());
            var oVectorPtr = pcre2_h
                    .pcre2_get_ovector_pointer_8(matchData)
                    .reinterpret(16 * oVectorSize);
            oVectorPtr.setAtIndex(JAVA_LONG, 1, 0);
            long count = 0;
            var result = 1;
            while ((result = pcre2_h.pcre2_jit_match_8(compiledPattern,
                    sequence, sequenceLength,
                    oVectorPtr.getAtIndex(JAVA_LONG, 2L * result - 1), 0,
                    matchData, pcre2_h.NULL())) > 0) count += result;
            if (result != pcre2_h.PCRE2_ERROR_NOMATCH()) {
                showPcre2ErrorIfAny("jit match", result);
            }
            return variant + " " + count;
        }).toList();

        for (var result : EXECUTOR_SERVICE.invokeAll(tasks)) {
            System.out.println(result.get());
        }

        System.out.println();
        System.out.println(initialLength);
        System.out.println(sequenceLength);
        System.out.println(magicRegExpsCount.get());

        EXECUTOR_SERVICE.shutdown();
    }

    private static int substitute(
            MemorySegment compiledPattern,
            MemorySegment inputBuffer, int inputLength,
            MemorySegment matchContext,
            MemorySegment outputBuffer, int outputBufferLength,
            String replacement) {
        return withArena(arena -> {
            var replacementBytes =
                    replacement.getBytes(StandardCharsets.US_ASCII);
            var replacementBuffer = arena.allocateFrom(
                    JAVA_BYTE, replacementBytes);
            var outputLengthHolder = arena.allocate(JAVA_LONG);
            outputLengthHolder.setAtIndex(JAVA_LONG, 0, outputBufferLength);
            var options = pcre2_h.PCRE2_SUBSTITUTE_GLOBAL() |
                    pcre2_h.PCRE2_NO_UTF_CHECK();
            var substitutionResult = pcre2_h.pcre2_substitute_8(
                    compiledPattern,
                    inputBuffer, inputLength,
                    0, options, pcre2_h.NULL(),
                    matchContext,
                    replacementBuffer, replacementBytes.length,
                    outputBuffer, outputLengthHolder);
            showPcre2ErrorIfAny("substitutionResult", substitutionResult);
            return substitutionResult < 0 ?
                    0 : outputLengthHolder.getAtIndex(JAVA_INT, 0);
        });
    }

    private static MemorySegment compilePattern(String pattern) {
        return withArena(arena -> {
            var patternBytes = pattern.getBytes(StandardCharsets.US_ASCII);
            var patternLength = patternBytes.length;
            var bufPattern = arena.allocateFrom(JAVA_BYTE, patternBytes);
            var bufErrorCode = arena.allocate(pcre2_h.int64_t);
            var bufErrorOffset = arena.allocate(pcre2_h.int64_t);
            var compiledPattern = pcre2_h.pcre2_compile_8(
                    bufPattern, patternLength, 0,
                    bufErrorCode, bufErrorOffset, pcre2_h.NULL());
            if (compiledPattern.equals(pcre2_h.NULL())) {
                showPcre2Error("pcre2_compile_8 failed at offset " +
                                bufErrorOffset.getAtIndex(JAVA_INT, 0),
                        bufErrorCode.getAtIndex(JAVA_INT, 0));
            }
            var jitCompileResult = pcre2_h.pcre2_jit_compile_8(
                    compiledPattern, pcre2_h.PCRE2_JIT_COMPLETE());
            showPcre2ErrorIfAny("pcre_2jit_compile_8", jitCompileResult);
            return compiledPattern;
        });
    }

    private static void showPcre2ErrorIfAny(
            String description, int resultOrErrorCode) {
        if (resultOrErrorCode < 0) {
            showPcre2Error(description, resultOrErrorCode);
        }
    }

    private static void showPcre2Error(String description, int errorCode) {
        withArena(arena -> {
            var bufSize = 1000;
            var buf = arena.allocate(bufSize);
            var errorMsgLength = pcre2_h.pcre2_get_error_message_8(
                    errorCode, buf, bufSize);
            if (errorMsgLength >= 0) {
                var errorMsgBytes = new byte[errorMsgLength];
                buf.asByteBuffer().get(errorMsgBytes);
                var errorMsg = new String(errorMsgBytes, 0, errorMsgLength,
                        StandardCharsets.US_ASCII);
                new Exception(description + " " + errorCode +
                        " = " + errorMsg).printStackTrace(System.out);
            } else {
                new Exception(description +
                        " Error during getting error message: " +
                        errorMsgLength).printStackTrace(System.out);
            }
        });
    }

    private static void withArena(Consumer<Arena> body) {
        try (var arena = Arena.ofConfined()) {
            body.accept(arena);
        }
    }

    private static <T> T withArena(Function<Arena, T> body) {
        try (var arena = Arena.ofConfined()) {
            return body.apply(arena);
        }
    }
}
    

notes, command-line, and program output

NOTES:
64-bit Ubuntu quad core
javac 21.0.2



 Thu, 18 Jul 2024 17:34:37 GMT

MAKE:
mv regexredux.openj9-8.openj9 regexredux.java
/opt/src/ibm-semeru-21.0.2.0/bin/javac -d . -cp . -sourcepath Include/java regexredux.java
regexredux.java:10: error: Arena is a preview API and is disabled by default.
import java.lang.foreign.Arena;
                        ^
  (use --enable-preview to enable preview APIs)
regexredux.java:11: error: MemorySegment is a preview API and is disabled by default.
import java.lang.foreign.MemorySegment;
                        ^
  (use --enable-preview to enable preview APIs)
regexredux.java:23: error: ValueLayout is a preview API and is disabled by default.
import static java.lang.foreign.ValueLayout.*;
                               ^
  (use --enable-preview to enable preview APIs)
regexredux.java:29: error: Arena is a preview API and is disabled by default.
    private static final Arena GLOBAL_ARENA = Arena.global();
                         ^
  (use --enable-preview to enable preview APIs)
regexredux.java:119: error: MemorySegment is a preview API and is disabled by default.
            MemorySegment compiledPattern,
            ^
  (use --enable-preview to enable preview APIs)
regexredux.java:120: error: MemorySegment is a preview API and is disabled by default.
            MemorySegment inputBuffer, int inputLength,
            ^
  (use --enable-preview to enable preview APIs)
regexredux.java:121: error: MemorySegment is a preview API and is disabled by default.
            MemorySegment matchContext,
            ^
  (use --enable-preview to enable preview APIs)
regexredux.java:122: error: MemorySegment is a preview API and is disabled by default.
            MemorySegment outputBuffer, int outputBufferLength,
            ^
  (use --enable-preview to enable preview APIs)
regexredux.java:146: error: MemorySegment is a preview API and is disabled by default.
    private static MemorySegment compilePattern(String pattern) {
                   ^
  (use --enable-preview to enable preview APIs)
regexredux.java:196: error: Arena is a preview API and is disabled by default.
    private static void withArena(Consumer<Arena> body) {
                                           ^
  (use --enable-preview to enable preview APIs)
regexredux.java:202: error: Arena is a preview API and is disabled by default.
    private static <T> T withArena(Function<Arena, T> body) {
                                            ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:12: error: ValueLayout is a preview API and is disabled by default.
import static java.lang.foreign.ValueLayout.*;
                               ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:13: error: MemoryLayout is a preview API and is disabled by default.
import static java.lang.foreign.MemoryLayout.PathElement.*;
                               ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:13: error: PathElement is a preview API and is disabled by default.
import static java.lang.foreign.MemoryLayout.PathElement.*;
                                            ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h_1.java:12: error: ValueLayout is a preview API and is disabled by default.
import static java.lang.foreign.ValueLayout.*;
                               ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h_1.java:13: error: MemoryLayout is a preview API and is disabled by default.
import static java.lang.foreign.MemoryLayout.PathElement.*;
                               ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h_1.java:13: error: PathElement is a preview API and is disabled by default.
import static java.lang.foreign.MemoryLayout.PathElement.*;
                                            ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:25: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment PRIuPTR() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:37: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment PRIxPTR() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:49: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment PRIXPTR() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:61: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNd8() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:73: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNd16() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:85: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNd32() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:97: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNd64() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:109: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNdLEAST8() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:121: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNdLEAST16() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:133: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNdLEAST32() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:145: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNdLEAST64() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:157: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNdFAST8() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:169: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNdFAST16() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:181: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNdFAST32() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:193: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNdFAST64() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:205: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNi8() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:217: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNi16() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:229: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNi32() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:241: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNi64() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:253: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNiLEAST8() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:265: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNiLEAST16() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:277: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNiLEAST32() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:289: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNiLEAST64() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:301: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNiFAST8() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:313: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNiFAST16() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:325: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNiFAST32() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:337: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNiFAST64() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:349: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNu8() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:361: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNu16() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:373: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNu32() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:385: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNu64() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:397: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNuLEAST8() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:409: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNuLEAST16() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:421: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNuLEAST32() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:433: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNuLEAST64() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:445: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNuFAST8() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:457: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNuFAST16() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:469: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNuFAST32() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:481: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNuFAST64() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:493: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNo8() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:505: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNo16() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:517: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNo32() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:529: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNo64() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:541: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNoLEAST8() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:553: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNoLEAST16() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:565: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNoLEAST32() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:577: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNoLEAST64() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:589: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNoFAST8() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:601: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNoFAST16() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:613: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNoFAST32() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:625: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNoFAST64() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:637: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNx8() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:649: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNx16() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:661: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNx32() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:673: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNx64() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:685: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNxLEAST8() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:697: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNxLEAST16() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:709: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNxLEAST32() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:721: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNxLEAST64() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:733: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNxFAST8() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:745: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNxFAST16() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:757: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNxFAST32() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:769: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNxFAST64() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:781: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNdMAX() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:793: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNiMAX() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:805: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNoMAX() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:817: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNuMAX() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:829: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNxMAX() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:841: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNdPTR() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:853: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNiPTR() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:865: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNoPTR() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:877: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNuPTR() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h.java:889: error: MemorySegment is a preview API and is disabled by default.
    public static MemorySegment SCNxPTR() {
                  ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h_1.java:21: error: Arena is a preview API and is disabled by default.
    static final Arena LIBRARY_ARENA = Arena.ofAuto();
                 ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h_1.java:31: error: MemorySegment is a preview API and is disabled by default.
    static MemorySegment findOrThrow(String symbol) {
           ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h_1.java:36: error: FunctionDescriptor is a preview API and is disabled by default.
    static MethodHandle upcallHandle(Class<?> fi, String name, FunctionDescriptor fdesc) {
                                                               ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h_1.java:44: error: MemoryLayout is a preview API and is disabled by default.
    static MemoryLayout align(MemoryLayout layout, long align) {
                              ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h_1.java:44: error: MemoryLayout is a preview API and is disabled by default.
    static MemoryLayout align(MemoryLayout layout, long align) {
           ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h_1.java:58: error: SymbolLookup is a preview API and is disabled by default.
    static final SymbolLookup SYMBOL_LOOKUP = SymbolLookup.libraryLookup(System.mapLibraryName("pcre2-8"), LIBRARY_ARENA)
                 ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h_1.java:62: error: ValueLayout is a preview API and is disabled by default.
    public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN;
                        ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h_1.java:62: error: OfBoolean is a preview API and is disabled by default.
    public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN;
                                   ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h_1.java:63: error: ValueLayout is a preview API and is disabled by default.
    public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE;
                        ^
  (use --enable-preview to enable preview APIs)
Include/java/jextract_pcre2/pcre2_h_1.java:63: error: OfByte is a preview API and is disabled by default.
    public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE;
                                   ^
  (use --enable-preview to enable preview APIs)
100 errors
only showing the first 100 errors, of 3436 total; use -Xmaxerrs if you would like to see more
make: [/home/dunham/all-benchmarksgame/2000-benchmarksgame/nanobench/makefiles/u64q.programs.Makefile:298: regexredux.openj9-8.openj9_run] Error 1 (ignored)

3.01s to complete and log all make actions

COMMAND LINE:
 /opt/src/ibm-semeru-21.0.2.0/bin/java -Xshareclasses -XX:SharedCacheHardLimit=200m -Xscmx60m -Xtune:virtualized  -cp . regexredux 0 < regexredux-input50000.txt

PROGRAM FAILED 


PROGRAM OUTPUT:

Error: Could not find or load main class regexredux
Caused by: java.lang.ClassNotFoundException: regexredux