RFR: 8265711: C1: Canonicalize Class.getModifier intrinsic method
Tobias Hartmann
thartmann at openjdk.java.net
Mon Apr 26 10:00:52 UTC 2021
On Thu, 22 Apr 2021 07:02:29 GMT, Yi Yang <yyang at openjdk.org> wrote:
> It's relatively a common case to get modifiers from a constant Class instance, i.e. ThirdPartyClass.class.getModifiers(). Currently, C1 Canonicalizer missed the opportunity of replacing Class.getModifiers intrinsic calls with compile-time constants.
Changes requested by thartmann (Reviewer).
src/hotspot/share/c1/c1_Canonicalizer.cpp line 551:
> 549: break;
> 550: }
> 551: case vmIntrinsics::_getModifiers : {
Although old code below has this weird style, please change this to `_getModifiers: {`
src/hotspot/share/c1/c1_Canonicalizer.cpp line 558:
> 556: if (c != NULL && !c->value()->is_null_object()) {
> 557: ciType* t = c->value()->java_mirror_type();
> 558: if (t->is_klass()) {
Shouldn't `t->is_primitive_type()` be handled as well?
test/hotspot/jtreg/compiler/c1/CanonicalizeGetModifiers.java line 94:
> 92:
> 93: public static void main(String... args) {
> 94: for (int i = 0; i < 1_0000; i++) {
The thousand separator is at the wrong place, should be `10_000`.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3616
More information about the hotspot-compiler-dev
mailing list