Skip to content

Commit e152cc0

Browse files
committed
8263677: Improve Character.isLowerCase/isUpperCase lookups
Reviewed-by: erikj, ihse, naoto, rriggs
1 parent b63b5d4 commit e152cc0

File tree

8 files changed

+146
-268
lines changed

8 files changed

+146
-268
lines changed

make/data/characterdata/CharacterData00.java.template

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -755,13 +755,11 @@ class CharacterData00 extends CharacterData {
755755
}
756756

757757
boolean isLowerCase(int ch) {
758-
return (getProperties(ch) & $$maskType) == Character.LOWERCASE_LETTER
759-
|| (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
758+
return (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
760759
}
761760

762761
boolean isUpperCase(int ch) {
763-
return (getProperties(ch) & $$maskType) == Character.UPPERCASE_LETTER
764-
|| (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
762+
return (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
765763
}
766764

767765
boolean isWhitespace(int ch) {

make/data/characterdata/CharacterData01.java.template

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -493,13 +493,11 @@ class CharacterData01 extends CharacterData {
493493
}
494494

495495
boolean isLowerCase(int ch) {
496-
return (getProperties(ch) & $$maskType) == Character.LOWERCASE_LETTER
497-
|| (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
496+
return (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
498497
}
499498

500499
boolean isUpperCase(int ch) {
501-
return (getProperties(ch) & $$maskType) == Character.UPPERCASE_LETTER
502-
|| (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
500+
return (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
503501
}
504502

505503
boolean isWhitespace(int ch) {

make/data/characterdata/CharacterData02.java.template

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -212,16 +212,13 @@ class CharacterData02 extends CharacterData {
212212
}
213213

214214
boolean isLowerCase(int ch) {
215-
return (getProperties(ch) & $$maskType) == Character.LOWERCASE_LETTER
216-
|| (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
215+
return (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
217216
}
218217

219218
boolean isUpperCase(int ch) {
220-
return (getProperties(ch) & $$maskType) == Character.UPPERCASE_LETTER
221-
|| (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
219+
return (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
222220
}
223221

224-
225222
boolean isWhitespace(int ch) {
226223
return (getProperties(ch) & $$maskIdentifierInfo) == $$valueJavaWhitespace;
227224
}

make/data/characterdata/CharacterData03.java.template

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -212,13 +212,11 @@ class CharacterData03 extends CharacterData {
212212
}
213213

214214
boolean isLowerCase(int ch) {
215-
return (getProperties(ch) & $$maskType) == Character.LOWERCASE_LETTER
216-
|| (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
215+
return (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
217216
}
218217

219218
boolean isUpperCase(int ch) {
220-
return (getProperties(ch) & $$maskType) == Character.UPPERCASE_LETTER
221-
|| (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
219+
return (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
222220
}
223221

224222
boolean isWhitespace(int ch) {

make/data/characterdata/CharacterData0E.java.template

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -212,13 +212,11 @@ class CharacterData0E extends CharacterData {
212212
}
213213

214214
boolean isLowerCase(int ch) {
215-
return (getProperties(ch) & $$maskType) == Character.LOWERCASE_LETTER
216-
|| (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
215+
return (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
217216
}
218217

219218
boolean isUpperCase(int ch) {
220-
return (getProperties(ch) & $$maskType) == Character.UPPERCASE_LETTER
221-
|| (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
219+
return (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
222220
}
223221

224222
boolean isWhitespace(int ch) {

make/data/characterdata/CharacterDataLatin1.java.template

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -87,13 +87,12 @@ class CharacterDataLatin1 extends CharacterData {
8787

8888
@IntrinsicCandidate
8989
boolean isLowerCase(int ch) {
90-
return (getProperties(ch) & $$maskType) == Character.LOWERCASE_LETTER
91-
|| (getPropertiesEx(ch) & $$maskOtherLowercase) != 0; // 0xaa, 0xba
90+
return (getPropertiesEx(ch) & $$maskOtherLowercase) != 0;
9291
}
9392

9493
@IntrinsicCandidate
9594
boolean isUpperCase(int ch) {
96-
return (getProperties(ch) & $$maskType) == Character.UPPERCASE_LETTER;
95+
return (getPropertiesEx(ch) & $$maskOtherUppercase) != 0;
9796
}
9897

9998
boolean isOtherAlphabetic(int ch) {

0 commit comments

Comments
 (0)