From 4ed215ff1becf7d1880b4546853ae0ddb8884628 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Wed, 21 Jun 2023 10:26:53 +0000 Subject: [PATCH 1/7] Enable DD JDK integration tests --- .github/workflows/dd-sync.yml | 34 ++++++++++++++++++++++++++++++++++ .gitlab-ci.yml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/dd-sync.yml create mode 100644 .gitlab-ci.yml diff --git a/.github/workflows/dd-sync.yml b/.github/workflows/dd-sync.yml new file mode 100644 index 0000000000000..e30ce9b2118c1 --- /dev/null +++ b/.github/workflows/dd-sync.yml @@ -0,0 +1,34 @@ +# .github/workflows/sync-upstream.yml +name: Sync Upstream + +on: + schedule: + - cron: '22 14 * * *' # Runs every day at 14:15 UTC + workflow_dispatch: + +jobs: + sync: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + persist-credentials: false + fetch-depth: 0 + + - name: Pull latest changes from upstream + run: | + git config --global user.email "sync@datadoghq.com" + git config --global user.name "Datadog Syncup Service" + git remote add upstream https://github.com/openjdk/jdk.git + git fetch upstream + git checkout -b upstream-master upstream/master + git checkout master + git merge upstream-master + + - name: Push changes to downstream + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GH_PAT }} + branch: master diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000..5e37e5e05e659 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,30 @@ +image: alpine + +stages: [trigger] + +build: + stage: trigger + variables: + JDK_VERSION: "22" + DEBUG_LEVEL: "fastdebug" + HASH: "${CI_COMMIT_SHORT_SHA}" + trigger: + project: DataDog/openjdk-build + strategy: depend + branch: main + forward: + pipeline_variables: true + +test: + stage: trigger + needs: [build] + variables: + JDK_VERSION: "22" + DEBUG_LEVEL: "fastdebug" + HASH: "${CI_COMMIT_SHORT_SHA}" + trigger: + project: DataDog/apm-reliability/async-profiler-build + strategy: depend + branch: main + forward: + pipeline_variables: true \ No newline at end of file From a91c4a5e603aa4715d9604d2560360f3bac794c5 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Mon, 4 Mar 2024 16:44:57 +0100 Subject: [PATCH 2/7] Trigger Gitlab CI for 'latest' JDK --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5e37e5e05e659..8d886aa1fa020 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ stages: [trigger] build: stage: trigger variables: - JDK_VERSION: "22" + JDK_VERSION: "latest" DEBUG_LEVEL: "fastdebug" HASH: "${CI_COMMIT_SHORT_SHA}" trigger: @@ -19,7 +19,7 @@ test: stage: trigger needs: [build] variables: - JDK_VERSION: "22" + JDK_VERSION: "latest" DEBUG_LEVEL: "fastdebug" HASH: "${CI_COMMIT_SHORT_SHA}" trigger: From 53bb10f1b6984b6381ef3716e1d6337a62d40d48 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Mon, 4 Mar 2024 17:05:28 +0100 Subject: [PATCH 3/7] Trigger Gitlab CI for JDK 23 instead of 'latest' --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8d886aa1fa020..7a22a25179f95 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ stages: [trigger] build: stage: trigger variables: - JDK_VERSION: "latest" + JDK_VERSION: "23" DEBUG_LEVEL: "fastdebug" HASH: "${CI_COMMIT_SHORT_SHA}" trigger: @@ -19,7 +19,7 @@ test: stage: trigger needs: [build] variables: - JDK_VERSION: "latest" + JDK_VERSION: "23" DEBUG_LEVEL: "fastdebug" HASH: "${CI_COMMIT_SHORT_SHA}" trigger: From 4413fdcf8e444238a2abae146122f3b52e101978 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Mon, 4 Mar 2024 17:22:57 +0100 Subject: [PATCH 4/7] Trigger Gitlab CI for 'latest' JDK build only --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7a22a25179f95..1bca008d8aa27 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ stages: [trigger] build: stage: trigger variables: - JDK_VERSION: "23" + JDK_VERSION: "latest" DEBUG_LEVEL: "fastdebug" HASH: "${CI_COMMIT_SHORT_SHA}" trigger: From 4973227cfb31c37394e92cad2e8c0f6897c80194 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Mon, 17 Jun 2024 11:21:32 +0200 Subject: [PATCH 5/7] Do not fix JDK version in gitlab script --- .gitlab-ci.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1bca008d8aa27..2374fa4481d59 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,9 +1,22 @@ image: alpine -stages: [trigger] +stages: [prepare, trigger] + +prepare: + stage: prepare + image: "486234852809.dkr.ecr.us-east-1.amazonaws.com/images/docker:24.0.4-gbi-focal" + tags: [ "arch:arm64" ] + script: + - echo "Preparing to trigger the build pipeline" + - echo "FEATURE_VERSION=$(cat make/conf/version-numbers.conf | grep 'DEFAULT_VERSION_FEATURE=' | cut -d '=' -f 2)" > build.env + artifacts: + reports: + dotenv: build.env + expire_in: 1 day build: stage: trigger + needs: [prepare] variables: JDK_VERSION: "latest" DEBUG_LEVEL: "fastdebug" @@ -17,9 +30,9 @@ build: test: stage: trigger - needs: [build] + needs: [prepare, build] variables: - JDK_VERSION: "23" + JDK_VERSION: "${FEATURE_VERSION}" DEBUG_LEVEL: "fastdebug" HASH: "${CI_COMMIT_SHORT_SHA}" trigger: From dc4a6b89eabd13dc30118efcd1137498f59c6ce4 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Tue, 27 Aug 2024 11:32:50 +0200 Subject: [PATCH 6/7] Add GHA permissions to dd-sync.yml --- .github/workflows/dd-sync.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/dd-sync.yml b/.github/workflows/dd-sync.yml index e30ce9b2118c1..c94e4f63a0184 100644 --- a/.github/workflows/dd-sync.yml +++ b/.github/workflows/dd-sync.yml @@ -6,6 +6,10 @@ on: - cron: '22 14 * * *' # Runs every day at 14:15 UTC workflow_dispatch: +permissions: + contents: write + actions: read + jobs: sync: runs-on: ubuntu-latest From 686b8454e1f99b7d75ceb9af6c5b68dbb49e9ffd Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Mon, 19 Aug 2024 16:11:58 +0000 Subject: [PATCH 7/7] USDT event for JVMTI object allocation sample --- src/hotspot/os/posix/dtrace/hotspot_jvmti.d | 9 +++++++++ src/hotspot/share/runtime/threadHeapSampler.cpp | 5 +++++ src/hotspot/share/utilities/dtrace.hpp | 1 + src/hotspot/share/utilities/dtrace_disabled.hpp | 3 +++ 4 files changed, 18 insertions(+) create mode 100644 src/hotspot/os/posix/dtrace/hotspot_jvmti.d diff --git a/src/hotspot/os/posix/dtrace/hotspot_jvmti.d b/src/hotspot/os/posix/dtrace/hotspot_jvmti.d new file mode 100644 index 0000000000000..d2c15fee59b67 --- /dev/null +++ b/src/hotspot/os/posix/dtrace/hotspot_jvmti.d @@ -0,0 +1,9 @@ +provider hotspot_jvmti { + probe AllocObject__sample(char*, size_t, size_t); +}; + +#pragma D attributes Standard/Standard/Common provider hotspot_jvmti provider +#pragma D attributes Private/Private/Unknown provider hotspot_jvmti module +#pragma D attributes Private/Private/Unknown provider hotspot_jvmti function +#pragma D attributes Standard/Standard/Common provider hotspot_jvmti name +#pragma D attributes Evolving/Evolving/Common provider hotspot_jvmti args diff --git a/src/hotspot/share/runtime/threadHeapSampler.cpp b/src/hotspot/share/runtime/threadHeapSampler.cpp index 04f3f8b220a30..1c39dd6138be7 100644 --- a/src/hotspot/share/runtime/threadHeapSampler.cpp +++ b/src/hotspot/share/runtime/threadHeapSampler.cpp @@ -32,6 +32,9 @@ #include "runtime/threadHeapSampler.hpp" #include "utilities/checkedCast.hpp" +#include "oops/oop.inline.hpp" +#include "utilities/dtrace.hpp" + // Cheap random number generator. uint64_t ThreadHeapSampler::_rnd; // Default is 512kb. @@ -424,6 +427,8 @@ void ThreadHeapSampler::check_for_sampling(oop obj, size_t allocation_size, size return; } + HOTSPOT_JVMTI_ALLOCOBJECT_SAMPLE(obj->klass()->name()->as_C_string(), allocation_size, bytes_since_allocation); + JvmtiExport::sampled_object_alloc_event_collector(obj); size_t overflow_bytes = total_allocated_bytes - _bytes_until_sample; diff --git a/src/hotspot/share/utilities/dtrace.hpp b/src/hotspot/share/utilities/dtrace.hpp index d6fa51efbeaa1..47bf302dfdefc 100644 --- a/src/hotspot/share/utilities/dtrace.hpp +++ b/src/hotspot/share/utilities/dtrace.hpp @@ -36,6 +36,7 @@ #include "dtracefiles/hotspot.h" #include "dtracefiles/hotspot_jni.h" +#include "dtracefiles/hotspot_jvmti.h" #include "dtracefiles/hs_private.h" #else /* defined(DTRACE_ENABLED) */ diff --git a/src/hotspot/share/utilities/dtrace_disabled.hpp b/src/hotspot/share/utilities/dtrace_disabled.hpp index 6cbd79326ac1f..3c6dd1abbb843 100644 --- a/src/hotspot/share/utilities/dtrace_disabled.hpp +++ b/src/hotspot/share/utilities/dtrace_disabled.hpp @@ -1080,6 +1080,9 @@ #define HOTSPOT_JNI_UNREGISTERNATIVES_RETURN(arg0) #define HOTSPOT_JNI_UNREGISTERNATIVES_RETURN_ENABLED() 0 +/* JVMTI */ +#define HOTSPOT_JVMTI_ALLOCOBJECT_SAMPLE(arg0, arg1, arg2) + /* Modules */ #define HOTSPOT_JNI_GETMODULE_ENTRY(arg0, arg1) #define HOTSPOT_JNI_GETMODULE_ENTRY_ENABLED() 0