< prev index next >

src/share/vm/compiler/compileBroker.hpp

Print this page
rev 8113 : 8076475: Misuses of strncpy/strncat
Summary: Various small fixes around strncpy and strncat
Reviewed-by: dsamersoff


 155       cmname_buffer_length = 160
 156     };
 157 
 158   private:
 159 
 160     char _current_method[cmname_buffer_length];
 161     PerfStringVariable* _perf_current_method;
 162 
 163     int  _compile_type;
 164     PerfVariable* _perf_compile_type;
 165 
 166     PerfCounter* _perf_time;
 167     PerfCounter* _perf_compiles;
 168 
 169   public:
 170     CompilerCounters(const char* name, int instance, TRAPS);
 171 
 172     // these methods should be called in a thread safe context
 173 
 174     void set_current_method(const char* method) {
 175       strncpy(_current_method, method, (size_t)cmname_buffer_length);

 176       if (UsePerfData) _perf_current_method->set_value(method);
 177     }
 178 
 179     char* current_method()                  { return _current_method; }
 180 
 181     void set_compile_type(int compile_type) {
 182       _compile_type = compile_type;
 183       if (UsePerfData) _perf_compile_type->set_value((jlong)compile_type);
 184     }
 185 
 186     int compile_type()                       { return _compile_type; }
 187 
 188     PerfCounter* time_counter()              { return _perf_time; }
 189     PerfCounter* compile_counter()           { return _perf_compiles; }
 190 };
 191 
 192 // CompileQueue
 193 //
 194 // A list of CompileTasks.
 195 class CompileQueue : public CHeapObj<mtCompiler> {




 155       cmname_buffer_length = 160
 156     };
 157 
 158   private:
 159 
 160     char _current_method[cmname_buffer_length];
 161     PerfStringVariable* _perf_current_method;
 162 
 163     int  _compile_type;
 164     PerfVariable* _perf_compile_type;
 165 
 166     PerfCounter* _perf_time;
 167     PerfCounter* _perf_compiles;
 168 
 169   public:
 170     CompilerCounters(const char* name, int instance, TRAPS);
 171 
 172     // these methods should be called in a thread safe context
 173 
 174     void set_current_method(const char* method) {
 175       strncpy(_current_method, method, (size_t)cmname_buffer_length-1);
 176       _current_method[cmname_buffer_length-1] = '\0';
 177       if (UsePerfData) _perf_current_method->set_value(method);
 178     }
 179 
 180     char* current_method()                  { return _current_method; }
 181 
 182     void set_compile_type(int compile_type) {
 183       _compile_type = compile_type;
 184       if (UsePerfData) _perf_compile_type->set_value((jlong)compile_type);
 185     }
 186 
 187     int compile_type()                       { return _compile_type; }
 188 
 189     PerfCounter* time_counter()              { return _perf_time; }
 190     PerfCounter* compile_counter()           { return _perf_compiles; }
 191 };
 192 
 193 // CompileQueue
 194 //
 195 // A list of CompileTasks.
 196 class CompileQueue : public CHeapObj<mtCompiler> {


< prev index next >