Skip to content

Commit f36b049

Browse files
jbachorikclaude
andcommitted
Fix platform-specific ASGCT_CallFrame alignment and factor out COMMA macro
The dropped trace implementation was using inconsistent field initialization that failed on platforms with different ASGCT_CallFrame layouts. Fixed by: - Using LP64_ONLY(0 COMMA) pattern for proper 64-bit platform padding - Factoring out COMMA macro definition to arch.h headers - Simplifying dropped trace structure to match storage_overflow pattern This resolves CI test failures in MetadataNormalisationTest and ContextCpuTest while maintaining consistent cross-platform behavior. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 7fb3373 commit f36b049

File tree

3 files changed

+7
-19
lines changed

3 files changed

+7
-19
lines changed

ddprof-lib/src/main/cpp/arch_dd.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include "arch.h"
55

6+
#define COMMA ,
7+
68
#include <stddef.h>
79

810
static inline long long atomicInc(volatile long long &var,

ddprof-lib/src/main/cpp/callTraceHashTable.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
#include "callTraceHashTable.h"
77
#include "counters.h"
88
#include "os.h"
9+
#include "arch_dd.h"
910
#include <string.h>
1011

11-
#define COMMA ,
12-
1312
static const u32 INITIAL_CAPACITY = 65536;
1413
static const u32 CALL_TRACE_CHUNK = 8 * 1024 * 1024;
1514
static const u64 OVERFLOW_TRACE_ID = 0x7fffffffffffffffULL; // Max 64-bit signed value

ddprof-lib/src/main/cpp/callTraceStorage.cpp

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "counters.h"
99
#include "common.h"
1010
#include "vmEntry.h" // For BCI_ERROR constant
11+
#include "arch_dd.h" // For LP64_ONLY macro and COMMA macro
1112
#include <string.h>
1213
#include <atomic>
1314

@@ -47,24 +48,10 @@ CallTraceStorage::~CallTraceStorage() {
4748

4849
CallTrace* CallTraceStorage::getDroppedTrace() {
4950
// Static dropped trace object - created once and reused
50-
static const char dropped_method_name[] = "<dropped due to contention>";
51-
static struct {
52-
CallTrace trace;
53-
ASGCT_CallFrame frame; // Additional frame storage beyond the [1] in CallTrace
54-
} dropped_trace_storage = {
55-
.trace = {
56-
.truncated = false,
57-
.num_frames = 1,
58-
.trace_id = DROPPED_TRACE_ID,
59-
.frames = {{
60-
.bci = BCI_ERROR, // Mark as native frame with error string
61-
.method_id = (jmethodID)dropped_method_name // String name for native frame
62-
}}
63-
},
64-
.frame = {} // Unused but needed for proper alignment
65-
};
51+
// Use same pattern as storage_overflow trace for consistent platform handling
52+
static CallTrace dropped_trace = {false, 1, DROPPED_TRACE_ID, {BCI_ERROR, LP64_ONLY(0 COMMA) (jmethodID)"<dropped due to contention>"}};
6653

67-
return &dropped_trace_storage.trace;
54+
return &dropped_trace;
6855
}
6956

7057
void CallTraceStorage::registerLivenessChecker(LivenessChecker checker) {

0 commit comments

Comments
 (0)