Skip to content

Commit e33499e

Browse files
committed
Improve macro
1 parent 645ccfa commit e33499e

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,21 @@ inline T* cast_to(const void* ptr, uint64_t size) {
3939

4040
#define DECL_TYPE_END };
4141

42+
#define MATCH_SYMBOLS(...) __VA_ARGS__, nullptr
43+
4244
// Define a type anme and its size symbols for VMStructs.
4345
// A type may match multiple names in different JVM versions.
4446
#define DECL_TYPES_DO(f) \
45-
f(VMClassLoaderData, "ClassLoaderData", nullptr) \
46-
f(VMConstantPool, "ConstantPool", nullptr) \
47-
f(VMConstMethod, "ConstMethod", nullptr) \
48-
f(VMFlag, "JVMFlag", "Flag", nullptr) \
49-
f(VMJavaFrameAnchor, "JavaFrameAnchor", nullptr) \
50-
f(VMKlass, "Klass", nullptr) \
51-
f(VMMethod, "Method", nullptr) \
52-
f(VMNMethod, "nmethod", nullptr) \
53-
f(VMSymbol, "Symbol", nullptr) \
54-
f(VMThread, "Thread", nullptr)
47+
f(VMClassLoaderData, MATCH_SYMBOLS("ClassLoaderData")) \
48+
f(VMConstantPool, MATCH_SYMBOLS("ConstantPool")) \
49+
f(VMConstMethod, MATCH_SYMBOLS("ConstMethod")) \
50+
f(VMFlag, MATCH_SYMBOLS("JVMFlag", "Flag")) \
51+
f(VMJavaFrameAnchor, MATCH_SYMBOLS("JavaFrameAnchor")) \
52+
f(VMKlass, MATCH_SYMBOLS("Klass")) \
53+
f(VMMethod, MATCH_SYMBOLS("Method")) \
54+
f(VMNMethod, MATCH_SYMBOLS("nmethod")) \
55+
f(VMSymbol, MATCH_SYMBOLS("Symbol")) \
56+
f(VMThread, MATCH_SYMBOLS("Thread"))
5557

5658
class VMStructs {
5759
public:

0 commit comments

Comments
 (0)