Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8263677: Improve Character.isLowerCase/isUpperCase lookups
Reviewed-by: erikj, ihse, naoto, rriggs
  • Loading branch information
cl4es committed Mar 17, 2021
1 parent b63b5d4 commit e152cc0
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 268 deletions.
8 changes: 3 additions & 5 deletions make/data/characterdata/CharacterData00.java.template
@@ -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
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 3 additions & 5 deletions make/data/characterdata/CharacterData01.java.template
@@ -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
Expand Down Expand Up @@ -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) {
Expand Down
9 changes: 3 additions & 6 deletions make/data/characterdata/CharacterData02.java.template
@@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 3 additions & 5 deletions make/data/characterdata/CharacterData03.java.template
@@ -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
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 3 additions & 5 deletions make/data/characterdata/CharacterData0E.java.template
@@ -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
Expand Down Expand Up @@ -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) {
Expand Down
7 changes: 3 additions & 4 deletions make/data/characterdata/CharacterDataLatin1.java.template
@@ -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
Expand Down Expand Up @@ -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) {
Expand Down

1 comment on commit e152cc0

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.