Skip to content

Commit 0023021

Browse files
authored
async-profiler#1675: Cleanup AGCT recovery tricks and remove safemode option
1 parent 444d0e6 commit 0023021

17 files changed

+27
-536
lines changed

src/arch.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ const int BREAKPOINT_OFFSET = 0;
5959

6060
const int SYSCALL_SIZE = 2;
6161
const int FRAME_PC_SLOT = 1;
62-
const int PROBE_SP_LIMIT = 4;
6362
const int PLT_HEADER_SIZE = 16;
6463
const int PLT_ENTRY_SIZE = 16;
6564
const int PERF_REG_PC = 8; // PERF_REG_X86_IP
@@ -81,7 +80,6 @@ const int BREAKPOINT_OFFSET = 0;
8180

8281
const int SYSCALL_SIZE = sizeof(instruction_t);
8382
const int FRAME_PC_SLOT = 1;
84-
const int PROBE_SP_LIMIT = 0;
8583
const int PLT_HEADER_SIZE = 20;
8684
const int PLT_ENTRY_SIZE = 12;
8785
const int PERF_REG_PC = 15; // PERF_REG_ARM_PC
@@ -102,7 +100,6 @@ const int BREAKPOINT_OFFSET = 0;
102100

103101
const int SYSCALL_SIZE = sizeof(instruction_t);
104102
const int FRAME_PC_SLOT = 1;
105-
const int PROBE_SP_LIMIT = 0;
106103
const int PLT_HEADER_SIZE = 32;
107104
const int PLT_ENTRY_SIZE = 16;
108105
const int PERF_REG_PC = 32; // PERF_REG_ARM64_PC
@@ -125,7 +122,6 @@ const int BREAKPOINT_OFFSET = 8;
125122

126123
const int SYSCALL_SIZE = sizeof(instruction_t);
127124
const int FRAME_PC_SLOT = 2;
128-
const int PROBE_SP_LIMIT = 0;
129125
const int PLT_HEADER_SIZE = 24;
130126
const int PLT_ENTRY_SIZE = 24;
131127
const int PERF_REG_PC = 32; // PERF_REG_POWERPC_NIP
@@ -150,7 +146,6 @@ const int BREAKPOINT_OFFSET = 0;
150146

151147
const int SYSCALL_SIZE = sizeof(instruction_t);
152148
const int FRAME_PC_SLOT = 1; // return address is at -1 from FP
153-
const int PROBE_SP_LIMIT = 0;
154149
const int PLT_HEADER_SIZE = 24; // Best guess from examining readelf
155150
const int PLT_ENTRY_SIZE = 24; // ...same...
156151
const int PERF_REG_PC = 0; // PERF_REG_RISCV_PC
@@ -171,7 +166,6 @@ const int BREAKPOINT_OFFSET = 0;
171166

172167
const int SYSCALL_SIZE = sizeof(instruction_t);
173168
const int FRAME_PC_SLOT = 1;
174-
const int PROBE_SP_LIMIT = 0;
175169
const int PLT_HEADER_SIZE = 32;
176170
const int PLT_ENTRY_SIZE = 16;
177171
const int PERF_REG_PC = 0; // PERF_REG_LOONGARCH_PC

src/arguments.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -249,24 +249,12 @@ Error Arguments::parse(const char* args) {
249249
if (value != NULL) {
250250
if (strstr(value, "stats")) _features.stats = 1;
251251
if (strstr(value, "jnienv")) _features.jnienv = 1;
252-
if (strstr(value, "probesp")) _features.probe_sp = 1;
253252
if (strstr(value, "mixed")) _features.mixed = 1;
254253
if (strstr(value, "vtable")) _features.vtable_target = 1;
255254
if (strstr(value, "comptask")) _features.comp_task = 1;
256255
if (strstr(value, "pcaddr")) _features.pc_addr = 1;
257256
}
258257

259-
CASE("safemode") {
260-
// Left for compatibility purpose; will be eventually migrated to 'features'
261-
int bits = value == NULL ? INT_MAX : (int)strtol(value, NULL, 0);
262-
_features.unknown_java = (bits & 1) ? 0 : 1;
263-
_features.unwind_stub = (bits & 2) ? 0 : 1;
264-
_features.unwind_comp = (bits & 4) ? 0 : 1;
265-
_features.unwind_native = (bits & 8) ? 0 : 1;
266-
_features.java_anchor = (bits & 16) ? 0 : 1;
267-
_features.gc_traces = (bits & 32) ? 0 : 1;
268-
}
269-
270258
CASE("file")
271259
if (value == NULL || value[0] == 0) {
272260
msg = "file must not be empty";

src/arguments.h

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,13 @@ enum EventMask {
105105
constexpr int EVENT_MASK_SIZE = 7;
106106

107107
struct StackWalkFeatures {
108-
// Deprecated stack recovery techniques used to workaround AsyncGetCallTrace flaws
109-
unsigned short unknown_java : 1;
110-
unsigned short unwind_stub : 1;
111-
unsigned short unwind_comp : 1;
112-
unsigned short unwind_native : 1;
113-
unsigned short java_anchor : 1;
114-
unsigned short gc_traces : 1;
115-
116-
// Common features
117-
unsigned short stats : 1; // collect stack walking duration statistics
118-
119-
// Additional HotSpot-specific features
120-
unsigned short jnienv : 1; // verify JNIEnv* obtained using VMStructs
121-
unsigned short probe_sp : 1; // when AsyncGetCallTrace fails, adjust SP and retry
122-
unsigned short mixed : 1; // mixed stack traces with Java and native frames interleaved
123-
unsigned short vtable_target : 1; // show receiver classes of vtable/itable stubs
124-
unsigned short comp_task : 1; // display current compilation task for JIT threads
125-
unsigned short pc_addr : 1; // record exact PC address for each sample
126-
unsigned short _padding : 3; // pad structure to 16 bits
108+
unsigned short stats : 1; // collect stack walking duration statistics
109+
unsigned short jnienv : 1; // verify JNIEnv* obtained using VMStructs
110+
unsigned short mixed : 1; // mixed stack traces with Java and native frames interleaved
111+
unsigned short vtable_target : 1; // show receiver classes of vtable/itable stubs
112+
unsigned short comp_task : 1; // display current compilation task for JIT threads
113+
unsigned short pc_addr : 1; // record exact PC address for each sample
114+
unsigned short _padding : 10; // pad structure to 16 bits
127115
};
128116

129117

@@ -271,7 +259,7 @@ class Arguments {
271259
_fdtransfer_path(NULL),
272260
_target_cpu(-1),
273261
_style(0),
274-
_features{1, 1, 1, 1, 1, 1},
262+
_features{},
275263
_cstack(CSTACK_DEFAULT),
276264
_clock(CLK_DEFAULT),
277265
_output(OUTPUT_NONE),

src/flightRecorder.cpp

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -539,22 +539,15 @@ class Recording {
539539
return true;
540540
}
541541

542-
static const char* getFeaturesString(char* str, size_t size, StackWalkFeatures& f) {
543-
snprintf(str, size, "%s %s %s %s %s %s %s %s %s %s %s %s %s",
544-
f.unknown_java ? "unknown_java" : "-",
545-
f.unwind_stub ? "unwind_stub" : "-",
546-
f.unwind_comp ? "unwind_comp" : "-",
547-
f.unwind_native ? "unwind_native" : "-",
548-
f.java_anchor ? "java_anchor" : "-",
549-
f.gc_traces ? "gc_traces" : "-",
550-
f.stats ? "stats" : "-",
551-
f.jnienv ? "jnienv" : "-",
552-
f.probe_sp ? "probesp" : "-",
553-
f.mixed ? "mixed" : "-",
554-
f.vtable_target ? "vtable" : "-",
555-
f.comp_task ? "comptask" : "-",
556-
f.pc_addr ? "pcaddr" : "-");
557-
return str;
542+
static const char* getFeaturesString(char* str, size_t size, StackWalkFeatures f) {
543+
int chars = snprintf(str, size, "%s%s%s%s%s%s",
544+
f.stats ? ",stats" : "",
545+
f.jnienv ? ",jnienv" : "",
546+
f.mixed ? ",mixed" : "",
547+
f.vtable_target ? ",vtable" : "",
548+
f.comp_task ? ",comptask" : "",
549+
f.pc_addr ? ",pcaddr" : "");
550+
return chars > 0 ? str + 1 : "";
558551
}
559552

560553
void flush(Buffer* buf) {

src/main/main.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,6 @@ int main(int argc, const char** argv) {
519519
} else if (arg == "--all-user") {
520520
params << ",alluser";
521521

522-
} else if (arg == "--safe-mode") {
523-
params << ",safemode=" << args.next();
524-
525522
} else if (arg == "--jfrsync" || arg == "--jfropts") {
526523
params << "," << (arg.str() + 2) << "=" << args.next();
527524
output = "jfr";

0 commit comments

Comments
 (0)