Skip to content
Permalink
Browse files
8263677: Improve Character.isLowerCase/isUpperCase lookups
Reviewed-by: erikj, ihse, naoto, rriggs
  • Loading branch information
cl4es committed Mar 17, 2021
1 parent b63b5d4 commit e152cc0312915d48efc67a133195b38ee9e45306
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 268 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -755,13 +755,11 @@ class CharacterData00 extends CharacterData {
}

boolean isLowerCase(int ch) {
return (getProperties(ch) & $$maskType) == Character.LOWERCASE_LETTER
|| (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
return (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
}

boolean isUpperCase(int ch) {
return (getProperties(ch) & $$maskType) == Character.UPPERCASE_LETTER
|| (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
return (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
}

boolean isWhitespace(int ch) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -493,13 +493,11 @@ class CharacterData01 extends CharacterData {
}

boolean isLowerCase(int ch) {
return (getProperties(ch) & $$maskType) == Character.LOWERCASE_LETTER
|| (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
return (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
}

boolean isUpperCase(int ch) {
return (getProperties(ch) & $$maskType) == Character.UPPERCASE_LETTER
|| (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
return (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
}

boolean isWhitespace(int ch) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -212,16 +212,13 @@ class CharacterData02 extends CharacterData {
}

boolean isLowerCase(int ch) {
return (getProperties(ch) & $$maskType) == Character.LOWERCASE_LETTER
|| (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
return (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
}

boolean isUpperCase(int ch) {
return (getProperties(ch) & $$maskType) == Character.UPPERCASE_LETTER
|| (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
return (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
}


boolean isWhitespace(int ch) {
return (getProperties(ch) & $$maskIdentifierInfo) == $$valueJavaWhitespace;
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -212,13 +212,11 @@ class CharacterData03 extends CharacterData {
}

boolean isLowerCase(int ch) {
return (getProperties(ch) & $$maskType) == Character.LOWERCASE_LETTER
|| (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
return (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
}

boolean isUpperCase(int ch) {
return (getProperties(ch) & $$maskType) == Character.UPPERCASE_LETTER
|| (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
return (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
}

boolean isWhitespace(int ch) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -212,13 +212,11 @@ class CharacterData0E extends CharacterData {
}

boolean isLowerCase(int ch) {
return (getProperties(ch) & $$maskType) == Character.LOWERCASE_LETTER
|| (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
return (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
}

boolean isUpperCase(int ch) {
return (getProperties(ch) & $$maskType) == Character.UPPERCASE_LETTER
|| (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
return (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
}

boolean isWhitespace(int ch) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -87,13 +87,12 @@ class CharacterDataLatin1 extends CharacterData {

@IntrinsicCandidate
boolean isLowerCase(int ch) {
return (getProperties(ch) & $$maskType) == Character.LOWERCASE_LETTER
|| (getPropertiesEx(ch) & $$maskOtherLowercase) != 0; // 0xaa, 0xba
return (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
}

@IntrinsicCandidate
boolean isUpperCase(int ch) {
return (getProperties(ch) & $$maskType) == Character.UPPERCASE_LETTER;
return (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
}

boolean isOtherAlphabetic(int ch) {

0 comments on commit e152cc0

Please sign in to comment.