RFR: 8209120: Archive the Integer.IntegerCache

Jiangli Zhou jiangli.zhou at oracle.com
Fri Aug 10 17:15:29 UTC 2018


Hi Claes,

The updated Integer.java looks good. The test also looks good to me. I'd 
suggest adding some checks in CheckIntegerCacheApp test for the cached 
Integers using WhiteBox API, WhiteBox.isShared(object) to make sure that 
they are archived. Checking all cached Integers is probably too 
excessive and unnecessary. Select a few values within [-128, 127] range 
would be good enough, I think.

As archived java heap data mapping may fail in some cases at runtime, 
and there is no need to continue the test execution when that happens as 
it would not exercise any of the archived java objects. The following 
can be done at the beginning of CheckIntegerCacheApp:

         WhiteBox wb = WhiteBox.getWhiteBox();

         if (!wb.areOpenArchiveHeapObjectsMapped()) {
             return;
         }

Thanks!

Jiangli

On 8/10/18 8:44 AM, Claes Redestad wrote:
> On 2018-08-10 16:10, Ioi Lam wrote:
>>> I've verified all cases I can think of manually, but would like to 
>>> defer the creation of a sanity test to a follow-up RFE to allow time 
>>> to think through and discussing how to best go about that (do we 
>>> need to verify in depth, can we reuse some existing test etc..)
>>>
>> I think it’s better to include a good test case in this REF, 
>> especially since object archiving is a new feature.
>
> Well, I'm not sure about "good", but I have a test case I've tinkered 
> with that simply tests that identity of Integer.valueOf behaves as 
> expected w.r.t. Object identity around the break-off point. I'm 
> pondering if we need to inspect the archived values more deeply, but 
> perhaps it's good enough as a sanity test for now:
>
> http://cr.openjdk.java.net/~redestad/8209120/open.02/
>
> WDYT?
>
> /Claes



More information about the core-libs-dev mailing list