8219566: JFR did not collect call stacks when MaxJavaStackTraceDepth is set to zero
authorysuenaga
Wed, 24 Apr 2019 17:09:24 +0900
changeset 54603 cb8e16d6ff1e
parent 54602 848a2f381e2c
child 54604 367d9cc2b35e
8219566: JFR did not collect call stacks when MaxJavaStackTraceDepth is set to zero Reviewed-by: egahlin, mgronlun
src/hotspot/share/jfr/periodic/sampling/jfrCallTrace.cpp
src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp
src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp
src/hotspot/share/jfr/utilities/jfrTypes.hpp
--- a/src/hotspot/share/jfr/periodic/sampling/jfrCallTrace.cpp	Tue Apr 23 14:56:39 2019 -0700
+++ b/src/hotspot/share/jfr/periodic/sampling/jfrCallTrace.cpp	Wed Apr 24 17:09:24 2019 +0900
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 #include "code/nmethod.hpp"
 #include "code/pcDesc.hpp"
 #include "jfr/periodic/sampling/jfrCallTrace.hpp"
+#include "jfr/utilities/jfrTypes.hpp"
 #include "oops/method.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/frame.inline.hpp"
@@ -37,7 +38,7 @@
   assert(top_frame.cb() != NULL, "invariant");
   RegisterMap map(_thread, false);
   frame candidate = top_frame;
-  for (int i = 0; i < MaxJavaStackTraceDepth * 2; ++i) {
+  for (u4 i = 0; i < MAX_STACK_DEPTH * 2; ++i) {
     if (candidate.is_entry_frame()) {
       JavaCallWrapper *jcw = candidate.entry_frame_call_wrapper_if_safe(_thread);
       if (jcw == NULL || jcw->is_first_frame()) {
--- a/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp	Tue Apr 23 14:56:39 2019 -0700
+++ b/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp	Wed Apr 24 17:09:24 2019 +0900
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 #include "jfr/recorder/service/jfrMemorySizer.hpp"
 #include "jfr/recorder/service/jfrOptionSet.hpp"
 #include "jfr/utilities/jfrAllocation.hpp"
+#include "jfr/utilities/jfrTypes.hpp"
 #include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
@@ -106,10 +107,6 @@
   return _stack_depth;
 }
 
-static const u4 STACK_DEPTH_DEFAULT = 64;
-static const u4 MIN_STACK_DEPTH = 1;
-static const u4 MAX_STACK_DEPTH = 2048;
-
 void JfrOptionSet::set_stackdepth(u4 depth) {
   if (depth < MIN_STACK_DEPTH) {
     _stack_depth = MIN_STACK_DEPTH;
--- a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp	Tue Apr 23 14:56:39 2019 -0700
+++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp	Wed Apr 24 17:09:24 2019 +0900
@@ -69,8 +69,8 @@
   }
 
   // handle general case
-  int loop_count = 0;
-  int loop_max = MaxJavaStackTraceDepth * 2;
+  u4 loop_count = 0;
+  u4 loop_max = MAX_STACK_DEPTH * 2;
   do {
     loop_count++;
     // By the time we get here we should never see unsafe but better safe then segv'd
--- a/src/hotspot/share/jfr/utilities/jfrTypes.hpp	Tue Apr 23 14:56:39 2019 -0700
+++ b/src/hotspot/share/jfr/utilities/jfrTypes.hpp	Wed Apr 24 17:09:24 2019 +0900
@@ -33,6 +33,9 @@
 typedef int fio_fd;
 const int invalid_fd = -1;
 const jlong invalid_offset = -1;
+const u4 STACK_DEPTH_DEFAULT = 64;
+const u4 MIN_STACK_DEPTH = 1;
+const u4 MAX_STACK_DEPTH = 2048;
 
 enum EventStartTime {
   UNTIMED,