RFR: 5043030 (reflect) unnecessary object creation in reflection

Andrej Golovnin andrej.golovnin at gmail.com
Thu May 29 08:23:33 UTC 2014

Hi Joel,

> We need you send in the patches via the mailing list. Please reply to your mail with the diffs attached directly (not zipped for example).

OK, will do that. But I always thought a webrev is
the preferred and the best way to submit a patch.

> I’ll might have time to look at this next week, but it surprises me you need to patch hotspot. Allocations before we have inflated shouldn’t be a problem.
> Also do you have any data showing that this actually makes a difference?

When you have for example following method:

public int method() {
  return 0;

And you invoke this method over the reflection API,
then the first N invocations are done via the native code. 
The returned value must be wrapped. Currently this is
done by the following call

java_lang_boxing_object::create(type, value, CHECK_NULL);

in reflection.cpp. This method allocates a new object.

As I wrote in my previous mail, the JDK patch contains
two regression tests for jtreg to verify my changes.
If you run this tests using current JDK9, than the tests will fail.
After applying my patches the tests executed without any problem.

Best regards,
Andrej Golovnin

> cheers
> /Joel
> On 28 maj 2014, at 23:44, Andrej Golovnin <andrej.golovnin at gmail.com> wrote:
>> Hi Joe,
>> I have prepared a patch for the issue JDK-5043030.
>> The patch consists of two parts: one for jdk and one for hotspot.
>> You can find the webrevs here:
>> JDK-patch: https://db.tt/7DYph0OH
>> Hotspot-patch: https://db.tt/hHsN0yn4
>> The JDK-patch has two tests to verify the changes.
>> Please review it and I hope you can sponsor it.
>> Best regards,
>> Andrej Golovnin

More information about the core-libs-dev mailing list