RFR: 8274329: Fix non-portable HotSpot code in MethodMatcher::parse_method_pattern

Jie Fu jiefu at openjdk.java.net
Thu Sep 30 08:34:34 UTC 2021


On Wed, 29 Sep 2021 19:40:20 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

> `RANGEBASE` was added by [JDK-6500501](https://bugs.openjdk.java.net/browse/JDK-6500501) and later was modified by [JDK-8027829](https://bugs.openjdk.java.net/browse/JDK-8027829)
> 
> Note the original comment from 6500501:
> 
> ```
> // The characters allowed in a class or method name.  All characters > 0x7f
> // are allowed in order to handle obfuscated class files (e.g. Volano)
> ```

Thanks @vnkozlov for your very helpful comments.

I have one question: how can we specify (non-ascii chars) and (non-printable ascii chars) through `-XX:CompileCommand`?


I just learned from https://bugs.openjdk.java.net/browse/JDK-8027829 that we can use unicode like `\uxxxx`.
But it doesn't work in my experiments.

My example was made from: https://bugs.openjdk.java.net/secure/attachment/17128/UnicodeIdentifierTest.java

public class UnicodeIdentifierTest {
    public static void main(String args[]) {
        System.out.println("Can I use \\u0001 in identifier name? " +
                           (Character.isJavaIdentifierPart(1) ? "yes" : "no"));
        for (int i = 0; i < 100000; i++ )
        methodWithUnicode\u0001Char();

        System.out.println("Can I use \\u00aa in identifier name? " +
                           (Character.isJavaIdentifierPart(0xaa) ? "yes" : "no"));
        for (int i = 0; i < 100000; i++ )
        methodWithUnicode\u00aaChar();

        System.out.println("Can I use \\u006b in identifier name? " +
                           (Character.isJavaIdentifierPart(0x6b) ? "yes" : "no"));
        for (int i = 0; i < 100000; i++ )
        methodWithUnicode\u006bChar();

    }
    public static int a = 0;
    public static void methodWithUnicode\u0001Char() {
        a++;
    }

    public static void methodWithUnicode\u00aaChar() {
        a++;
    }

    public static void methodWithUnicode\u006bChar() {
        a++;
    }
}


And I tried to exclude some specific methods like this

${JDK}/bin/java \
   -XX:+PrintCompilation \
   -XX:CompileCommand=exclude,`echo -e "UnicodeIdentifierTest::methodWithUnicode\u0001Char"` \
   -XX:CompileCommand=exclude,`echo -e "UnicodeIdentifierTest.methodWithUnicode\u0001Char"` \
   -XX:CompileCommand=exclude,"UnicodeIdentifierTest.methodWithUnicode\u0001Char" \
   -XX:CompileCommand=exclude,'UnicodeIdentifierTest.methodWithUnicode\u0001Char' \
   -XX:CompileCommand=exclude,UnicodeIdentifierTest.methodWithUnicode\u0001Char \
   -XX:CompileCommand=exclude,`echo -e "UnicodeIdentifierTest::methodWithUnicode\u00aaChar"` \
   -XX:CompileCommand=exclude,`echo -e "UnicodeIdentifierTest.methodWithUnicode\u00aaChar"` \
   -XX:CompileCommand=exclude,"UnicodeIdentifierTest.methodWithUnicode\u00aaChar" \
   -XX:CompileCommand=exclude,'UnicodeIdentifierTest.methodWithUnicode\u00aaChar' \
   -XX:CompileCommand=exclude,UnicodeIdentifierTest.methodWithUnicode\u00aaChar \
   -XX:CompileCommand=exclude,`echo -e "UnicodeIdentifierTest::methodWithUnicode\u006bChar"` \
   -XX:CompileCommand=exclude,`echo -e "UnicodeIdentifierTest.methodWithUnicode\u006bChar"` \
   -XX:CompileCommand=exclude,"UnicodeIdentifierTest.methodWithUnicode\u006bChar" \
   -XX:CompileCommand=exclude,'UnicodeIdentifierTest.methodWithUnicode\u006bChar' \
   -XX:CompileCommand=exclude,UnicodeIdentifierTest.methodWithUnicode\u006bChar \
   ${TEST}


But none of them worked.

So if there is no other way to specify a non-ascii chars, it seems safe to remove the non-ascii code.

If I miss something, please let me know.
Thanks.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5704



More information about the build-dev mailing list