RFR: 8300732: Whitebox functions for Metaspace test should use byte size

Thomas Stuefe stuefe at openjdk.org
Thu Jul 4 15:58:18 UTC 2024


On Thu, 4 Jul 2024 15:53:17 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Hi all, 
>> 
>> This PR addresses [8300732](https://bugs.openjdk.org/browse/JDK-8300732) switching Whitebox Metaspace test functions to use bytes as opposed to words. 
>> 
>> Testing: 
>> - [x] `test/hotspot/jtreg/runtime/Metaspace` tests pass. 
>> 
>> Thanks, 
>> Sonia
>
> src/hotspot/share/prims/whitebox.cpp line 1715:
> 
>> 1713: // MetaspaceTestContext and MetaspaceTestArena
>> 1714: WB_ENTRY(jlong, WB_CreateMetaspaceTestContext(JNIEnv* env, jobject wb, jlong commit_limit, jlong reserve_limit))
>> 1715:   if (commit_limit % BytesPerWord != 0) {
> 
> Use is_aligned() from utilities/align.hpp

And I think you can just assert() here. If this happens, a test written by us is using the whitebox function wrong, and since its all internal, no need to propagate a java exception.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20039#discussion_r1665875957


More information about the hotspot-dev mailing list