Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/jdk/21/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@ packages:

modules:
install:
- name: jboss.container.openjdk.jre
version: *jdkver
- name: jboss.container.user
- name: jboss.container.openjdk
2 changes: 2 additions & 0 deletions modules/jdk/25/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@ packages:

modules:
install:
- name: jboss.container.openjdk.jre
version: *jdkver
- name: jboss.container.user
- name: jboss.container.openjdk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# this is a script library and is intended to be sourced, not executed.

# OPENJDK-4106
jvm_specific_options() {
if [ "$JAVA_COMPACT_OBJECT_HEADERS" != "false" ]; then
echo "-XX:+UseCompactObjectHeaders"
fi
}
7 changes: 7 additions & 0 deletions modules/jre/25/configure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR=$(dirname $0)
ARTIFACTS_DIR=${SCRIPT_DIR}/artifacts

install -m 0644 -D {${ARTIFACTS_DIR},}${JBOSS_CONTAINER_OPENJDK_JRE_MODULE}/jvm-options
6 changes: 6 additions & 0 deletions modules/jre/25/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ envs:
value: *jdkver
- name: JBOSS_CONTAINER_OPENJDK_JRE_MODULE
value: /opt/jboss/container/openjdk/jre
- name: JAVA_COMPACT_OBJECT_HEADERS
description: Whether to enable compact object headers (JEP519) for JDK25 and newer. Enabled by default.
example: "false"

packages:
install:
Expand All @@ -30,3 +33,6 @@ modules:
install:
- name: jboss.container.user
- name: jboss.container.openjdk

execute:
- script: configure.sh
15 changes: 15 additions & 0 deletions modules/jre/25/tests/features/openjdk.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Feature: Tests around compact object headers

@ubi10/openjdk-25
@ubi10/openjdk-25-runtime
Scenario: UseCompactObjectHeaders is on by default
When container is ready
Then available container log should contain -XX:+UseCompactObjectHeaders

@ubi10/openjdk-25
@ubi10/openjdk-25-runtime
Scenario: UseCompactObjectHeaders can be disabled
Given container is started with env
| variable | value |
| JAVA_COMPACT_OBJECT_HEADERS | false |
Then available container log should not contain -XX:+UseCompactObjectHeaders
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jvm_specific_options() {
}

# Include overridden jvm_specific_*() functions
if [ -f "${JBOSS_CONTAINER_OPENJDK_JDK_MODULE}/jvm-options" ]; then
source "${JBOSS_CONTAINER_OPENJDK_JDK_MODULE}/jvm-options"
if [ -f "${JBOSS_CONTAINER_OPENJDK_JRE_MODULE}/jvm-options" ]; then
source "${JBOSS_CONTAINER_OPENJDK_JRE_MODULE}/jvm-options"
fi

# Check for memory options and calculate a sane default if not given
Expand Down Expand Up @@ -60,7 +60,7 @@ gc_config() {
fi
fi

local allOptions="$(jvm_specific_options) "
local allOptions=""
allOptions+="${gcOptions} "
allOptions+="-XX:MinHeapFreeRatio=${minHeapFreeRatio} "
allOptions+="-XX:MaxHeapFreeRatio=${maxHeapFreeRatio} "
Expand All @@ -81,5 +81,7 @@ error_handling() {
echo "-XX:+ExitOnOutOfMemoryError"
}

## Echo options, trimming trailing and multiple spaces
echo "$(max_memory) $(gc_config) $(diagnostics) $(error_handling)" | awk '$1=$1'
echo "$(max_memory) $(gc_config) $(diagnostics) $(error_handling)\
$(jvm_specific_options)

" | awk '$1=$1' # trim leading/trailing spaces and squash multiple spaces
Loading