United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6679708 No_Safepoint_Verifier and BacktraceBuilder have uninitialized fields
JDK-6679708 : No_Safepoint_Verifier and BacktraceBuilder have uninitialized fields

Details
Type:
Bug
Submit Date:
2008-03-25
Status:
Closed
Updated Date:
2012-10-08
Project Name:
JDK
Resolved Date:
2008-06-25
Component:
hotspot
OS:
solaris_9
Sub-Component:
runtime
CPU:
sparc
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
hs13 (b01)

Related Reports
Backport:
Backport:

Sub Tasks

Description
While doing some testing with valgrind I tripped across a couple uninitialized fields.  BacktraceBuilder has an extra field which is uninitialized and is benignly useless.  No_Safepoint_Verifier doesn't properly initialize the _activated field.  Normally it should be true and garbage on the stack is more likely to be non-zero so mostly I think this doesn't matter either.

                                    

Comments
EVALUATION

Remove the extra field from BacktraceBuilder and initialize the field in No_Safepoint_Verifier.
                                     
2008-03-25
SUGGESTED FIX

--- old/src/share/vm/classfile/javaClasses.cpp	Tue Mar 25 10:04:30 2008
+++ new/src/share/vm/classfile/javaClasses.cpp	Tue Mar 25 10:04:30 2008
@@ -1015,7 +1015,6 @@
   typeArrayOop    _bcis;
   int             _index;
   bool            _dirty;
-  bool            _done;
   No_Safepoint_Verifier _nsv;
 
  public:
@@ -1029,12 +1028,10 @@
   };
 
   // constructor for new backtrace
-  BacktraceBuilder(TRAPS): _methods(NULL), _bcis(NULL), _head(NULL) {
+  BacktraceBuilder(TRAPS): _methods(NULL), _bcis(NULL), _head(NULL), _dirty(false) {
     expand(CHECK);
     _backtrace = _head;
     _index = 0;
-    _dirty = false;
-    _done = false;
   }
 
   void flush() {
--- old/src/share/vm/memory/gcLocker.hpp	Tue Mar 25 10:04:32 2008
+++ new/src/share/vm/memory/gcLocker.hpp	Tue Mar 25 10:04:32 2008
@@ -184,7 +184,9 @@
   Thread *_thread;
  public:
 #ifdef ASSERT
-  No_Safepoint_Verifier(bool activated = true, bool verifygc = true ) : No_GC_Verifier(verifygc) {
+  No_Safepoint_Verifier(bool activated = true, bool verifygc = true ) :
+    No_GC_Verifier(verifygc),
+    _activated(activated) {
     _thread = Thread::current();
     if (_activated) {
       _thread->_allow_allocation_count++;
                                     
2008-03-27



Hardware and Software, Engineered to Work Together