Skip to content

Commit 48f7306

Browse files
committed
Review comments
1 parent 2751736 commit 48f7306

5 files changed

Lines changed: 32 additions & 32 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ bool StackFrame::unwindPrologue(VMNMethod* nm, uintptr_t& pc, uintptr_t& sp, uin
132132
return false;
133133
}
134134

135-
bool StackFrame::unwindEpilogue(VMVMNMethodNMethod* nm, uintptr_t& pc, uintptr_t& sp, uintptr_t& fp) {
135+
bool StackFrame::unwindEpilogue(VMNMethod* nm, uintptr_t& pc, uintptr_t& sp, uintptr_t& fp) {
136136
// Not yet implemented
137137
return false;
138138
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache License (Version 2.0).
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/) Copyright 2025 Datadog, Inc.
3+
14
#ifndef _UTILS_H
25
#define _UTILS_H
36

@@ -29,7 +32,4 @@ inline size_t align_up(size_t size, size_t alignment) noexcept {
2932
return align_down(size + alignment - 1, alignment);
3033
}
3134

32-
33-
34-
3535
#endif // _UTILS_H

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ void VMStructs::ready() {
162162
}
163163

164164
bool initTypeSize(uint64_t& size, const char* type, uint64_t value, ...) {
165-
int count;
166165
va_list args;
167166
va_start(args, value);
168167
const char* match_type = nullptr;

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

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,24 @@ class GCHeapSummary;
2020
class HeapUsage;
2121

2222
#define TYPE_SIZE_NAME(name) _##name##_size
23-
#define DECL_TYPE_SIZE(name) static uint64_t TYPE_SIZE_NAME(name);
24-
#define SIZE_OF(name) VM##name::type_size()
2523

2624
template <typename T>
27-
inline T* cast_to(const void* ptr, uint64_t size) {
28-
assert(size > 0); // Ensure type size has been initialized
25+
inline T* cast_to(const void* ptr) {
26+
assert(T::type_size() > 0); // Ensure type size has been initialized
2927
assert(ptr == nullptr || SafeAccess::isReadableRange(ptr, T::type_size()));
3028
return reinterpret_cast<T*>(const_cast<void*>(ptr));
3129
}
3230

33-
#define DECL_TYPE(name) \
31+
#define DECLARE(name) \
3432
class name : VMStructs { \
3533
public: \
3634
static uint64_t type_size() { return TYPE_SIZE_NAME(name); } \
37-
static name * cast(const void* ptr) { return cast_to<name>(ptr, type_size()); } \
35+
static name * cast(const void* ptr) { return cast_to<name>(ptr); } \
3836
static name * load_then_cast(const void* ptr) { \
3937
assert(ptr != nullptr); \
4038
return cast(*(const void**)ptr); }
4139

42-
#define DECL_TYPE_END };
40+
#define DECLARE_END };
4341

4442
#define MATCH_SYMBOLS(...) __VA_ARGS__, nullptr
4543

@@ -353,7 +351,7 @@ class MethodList {
353351
class VMNMethod;
354352
class VMMethod;
355353

356-
DECL_TYPE(VMSymbol)
354+
DECLARE(VMSymbol)
357355
public:
358356
unsigned short length() {
359357
if (_symbol_length_offset >= 0) {
@@ -366,9 +364,9 @@ DECL_TYPE(VMSymbol)
366364
const char* body() {
367365
return at(_symbol_body_offset);
368366
}
369-
DECL_TYPE_END
367+
DECLARE_END
370368

371-
DECL_TYPE(VMClassLoaderData)
369+
DECLARE(VMClassLoaderData)
372370
private:
373371
void* mutex() {
374372
return *(void**) at(sizeof(uintptr_t) * 3);
@@ -386,9 +384,9 @@ DECL_TYPE(VMClassLoaderData)
386384
MethodList** methodList() {
387385
return (MethodList**) at(sizeof(uintptr_t) * 6 + 8);
388386
}
389-
DECL_TYPE_END
387+
DECLARE_END
390388

391-
DECL_TYPE(VMKlass)
389+
DECLARE(VMKlass)
392390
public:
393391
static VMKlass* fromJavaClass(JNIEnv* env, jclass cls) {
394392
if (sizeof(VMKlass*) == 8) {
@@ -440,9 +438,9 @@ DECL_TYPE(VMKlass)
440438
assert(_jmethod_ids_offset >= 0);
441439
return __atomic_load_n((jmethodID**) at(_jmethod_ids_offset), __ATOMIC_ACQUIRE);
442440
}
443-
DECL_TYPE_END
441+
DECLARE_END
444442

445-
DECL_TYPE(VMJavaFrameAnchor)
443+
DECLARE(VMJavaFrameAnchor)
446444
private:
447445
enum { MAX_CALL_WRAPPER_DISTANCE = 512 };
448446

@@ -486,7 +484,7 @@ DECL_TYPE(VMJavaFrameAnchor)
486484
}
487485
return false;
488486
}
489-
DECL_TYPE_END
487+
DECLARE_END
490488

491489
// Copied from JDK's globalDefinitions.hpp 'JavaThreadState' enum
492490
enum JVMJavaThreadState {
@@ -504,7 +502,7 @@ enum JVMJavaThreadState {
504502
_thread_max_state = 12 // maximum thread state+1 - used for statistics allocation
505503
};
506504

507-
DECL_TYPE(VMThread)
505+
DECLARE(VMThread)
508506
public:
509507
static VMThread* current();
510508

@@ -550,7 +548,7 @@ DECL_TYPE(VMThread)
550548
}
551549

552550
bool inDeopt() {
553-
assert(_thread_state_offset >= 0);
551+
assert(_thread_vframe_offset >= 0);
554552
return SafeAccess::loadPtr((void**) at(_thread_vframe_offset), nullptr) != NULL;
555553
}
556554

@@ -565,13 +563,13 @@ DECL_TYPE(VMThread)
565563
}
566564

567565
inline VMMethod* compiledMethod();
568-
DECL_TYPE_END
566+
DECLARE_END
569567

570-
DECL_TYPE(VMConstMethod)
571-
DECL_TYPE_END
568+
DECLARE(VMConstMethod)
569+
DECLARE_END
572570

573571

574-
DECL_TYPE(VMMethod)
572+
DECLARE(VMMethod)
575573
private:
576574
static bool check_jmethodID_J9(jmethodID id);
577575
static bool check_jmethodID_hotspot(jmethodID id);
@@ -598,9 +596,9 @@ DECL_TYPE(VMMethod)
598596
inline VMNMethod* code();
599597

600598
static bool check_jmethodID(jmethodID id);
601-
DECL_TYPE_END
599+
DECLARE_END
602600

603-
DECL_TYPE(VMNMethod)
601+
DECLARE(VMNMethod)
604602
public:
605603
int size() {
606604
assert(_blob_size_offset >= 0);
@@ -727,7 +725,7 @@ DECL_TYPE(VMNMethod)
727725
}
728726

729727
int findScopeOffset(const void* pc);
730-
DECL_TYPE_END
728+
DECLARE_END
731729

732730
class CodeHeap : VMStructs {
733731
private:
@@ -765,7 +763,7 @@ class CodeHeap : VMStructs {
765763
}
766764
};
767765

768-
DECL_TYPE(VMFlag)
766+
DECLARE(VMFlag)
769767
private:
770768
enum {
771769
ORIGIN_DEFAULT = 0,
@@ -825,7 +823,7 @@ DECL_TYPE(VMFlag)
825823
void set(char value) {
826824
*((char*)addr()) = value;
827825
}
828-
DECL_TYPE_END
826+
DECLARE_END
829827

830828
class PcDesc {
831829
public:

ddprof-lib/src/main/cpp/vmStructs.inline.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache License (Version 2.0).
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/) Copyright 2025 Datadog, Inc.
3+
14
#ifndef _VMSTRUCTS_INLINE_H
25
#define _VMSTRUCTS_INLINE_H
36

@@ -10,7 +13,7 @@ VMNMethod* VMMethod::code() {
1013
}
1114

1215
VMMethod* VMThread::compiledMethod() {
13-
assert(_thread_vframe_offset >= 0);
16+
assert(_comp_method_offset >= 0);
1417
assert(_comp_env_offset >= 0);
1518
assert(_comp_task_offset >= 0);
1619
const char* env = *(const char**) at(_comp_env_offset);

0 commit comments

Comments
 (0)