Wed, 24 Apr 2019 17:09:24 +0900
8219566: JFR did not collect call stacks when MaxJavaStackTraceDepth is set to zero
Reviewed-by: egahlin, mgronlun, neugens, andrew
1.1 --- a/src/share/vm/jfr/periodic/sampling/jfrCallTrace.cpp Mon May 05 19:53:00 2014 -0400 1.2 +++ b/src/share/vm/jfr/periodic/sampling/jfrCallTrace.cpp Wed Apr 24 17:09:24 2019 +0900 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -27,6 +27,7 @@ 1.11 #include "code/nmethod.hpp" 1.12 #include "code/pcDesc.hpp" 1.13 #include "jfr/periodic/sampling/jfrCallTrace.hpp" 1.14 +#include "jfr/utilities/jfrTypes.hpp" 1.15 #include "oops/method.hpp" 1.16 #include "runtime/javaCalls.hpp" 1.17 #include "runtime/frame.inline.hpp" 1.18 @@ -37,7 +38,7 @@ 1.19 assert(top_frame.cb() != NULL, "invariant"); 1.20 RegisterMap map(_thread, false); 1.21 frame candidate = top_frame; 1.22 - for (int i = 0; i < MaxJavaStackTraceDepth * 2; ++i) { 1.23 + for (u4 i = 0; i < MAX_STACK_DEPTH * 2; ++i) { 1.24 if (candidate.is_entry_frame()) { 1.25 JavaCallWrapper *jcw = candidate.entry_frame_call_wrapper_if_safe(_thread); 1.26 if (jcw == NULL || jcw->is_first_frame()) {
2.1 --- a/src/share/vm/jfr/recorder/service/jfrOptionSet.cpp Mon May 05 19:53:00 2014 -0400 2.2 +++ b/src/share/vm/jfr/recorder/service/jfrOptionSet.cpp Wed Apr 24 17:09:24 2019 +0900 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -27,6 +27,7 @@ 2.11 #include "jfr/recorder/service/jfrMemorySizer.hpp" 2.12 #include "jfr/recorder/service/jfrOptionSet.hpp" 2.13 #include "jfr/utilities/jfrAllocation.hpp" 2.14 +#include "jfr/utilities/jfrTypes.hpp" 2.15 #include "memory/allocation.inline.hpp" 2.16 #include "memory/resourceArea.hpp" 2.17 #include "runtime/java.hpp" 2.18 @@ -105,10 +106,6 @@ 2.19 return _stack_depth; 2.20 } 2.21 2.22 -static const u4 STACK_DEPTH_DEFAULT = 64; 2.23 -static const u4 MIN_STACK_DEPTH = 1; 2.24 -static const u4 MAX_STACK_DEPTH = 2048; 2.25 - 2.26 void JfrOptionSet::set_stackdepth(u4 depth) { 2.27 if (depth < MIN_STACK_DEPTH) { 2.28 _stack_depth = MIN_STACK_DEPTH;
3.1 --- a/src/share/vm/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp Mon May 05 19:53:00 2014 -0400 3.2 +++ b/src/share/vm/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp Wed Apr 24 17:09:24 2019 +0900 3.3 @@ -69,8 +69,8 @@ 3.4 } 3.5 3.6 // handle general case 3.7 - int loop_count = 0; 3.8 - int loop_max = MaxJavaStackTraceDepth * 2; 3.9 + u4 loop_count = 0; 3.10 + u4 loop_max = MAX_STACK_DEPTH * 2; 3.11 do { 3.12 loop_count++; 3.13 // By the time we get here we should never see unsafe but better safe then segv'd
4.1 --- a/src/share/vm/jfr/utilities/jfrTypes.hpp Mon May 05 19:53:00 2014 -0400 4.2 +++ b/src/share/vm/jfr/utilities/jfrTypes.hpp Wed Apr 24 17:09:24 2019 +0900 4.3 @@ -33,6 +33,9 @@ 4.4 typedef int fio_fd; 4.5 const int invalid_fd = -1; 4.6 const jlong invalid_offset = -1; 4.7 +const u4 STACK_DEPTH_DEFAULT = 64; 4.8 +const u4 MIN_STACK_DEPTH = 1; 4.9 +const u4 MAX_STACK_DEPTH = 2048; 4.10 4.11 enum EventStartTime { 4.12 UNTIMED,