src/hotspot/share/compiler/disassembler.cpp
changeset 55593 963924f1c891
parent 55329 03af124751f5
child 58679 9c3209ff7550
child 59309 be238525d240
equal deleted inserted replaced
55592:fd1a4c4b7616 55593:963924f1c891
   313       }
   313       }
   314     }
   314     }
   315   }
   315   }
   316 }
   316 }
   317 
   317 
   318 decode_env::decode_env(CodeBuffer* code, outputStream* output) {
   318 decode_env::decode_env(CodeBuffer* code, outputStream* output) :
   319   memset(this, 0, sizeof(*this));
   319   _output(output ? output : tty),
   320   _output = output ? output : tty;
   320   _codeBuffer(code),
   321   _codeBlob    = NULL;
   321   _codeBlob(NULL),
   322   _codeBuffer  = code;
   322   _nm(NULL),
   323   _helpPrinted = false;
   323   _strings(),
   324 
   324   _start(NULL),
       
   325   _end(NULL),
       
   326   _option_buf(),
       
   327   _print_raw(0),
       
   328   _cur_insn(NULL),
       
   329   _bytes_per_line(0),
       
   330   _pre_decode_alignment(0),
       
   331   _post_decode_alignment(0),
       
   332   _print_file_name(false),
       
   333   _print_help(false),
       
   334   _helpPrinted(false) {
       
   335 
       
   336   memset(_option_buf, 0, sizeof(_option_buf));
   325   process_options(_output);
   337   process_options(_output);
   326 }
   338 }
   327 
   339 
   328 decode_env::decode_env(CodeBlob* code, outputStream* output, CodeStrings c) {
   340 decode_env::decode_env(CodeBlob* code, outputStream* output, CodeStrings c) :
   329    memset(this, 0, sizeof(*this)); // Beware, this zeroes bits of fields.
   341   _output(output ? output : tty),
   330    _output = output ? output : tty;
   342   _codeBuffer(NULL),
   331   _codeBlob    = code;
   343   _codeBlob(code),
   332   _codeBuffer  = NULL;
   344   _nm(_codeBlob != NULL && _codeBlob->is_nmethod() ? (nmethod*) code : NULL),
   333   _helpPrinted = false;
   345   _strings(),
   334   if (_codeBlob != NULL && _codeBlob->is_nmethod()) {
   346   _start(NULL),
   335     _nm = (nmethod*) code;
   347   _end(NULL),
   336   }
   348   _option_buf(),
       
   349   _print_raw(0),
       
   350   _cur_insn(NULL),
       
   351   _bytes_per_line(0),
       
   352   _pre_decode_alignment(0),
       
   353   _post_decode_alignment(0),
       
   354   _print_file_name(false),
       
   355   _print_help(false),
       
   356   _helpPrinted(false) {
       
   357 
       
   358   memset(_option_buf, 0, sizeof(_option_buf));
   337   _strings.copy(c);
   359   _strings.copy(c);
   338 
       
   339   process_options(_output);
   360   process_options(_output);
   340 }
   361 }
   341 
   362 
   342 decode_env::decode_env(nmethod* code, outputStream* output, CodeStrings c) {
   363 decode_env::decode_env(nmethod* code, outputStream* output, CodeStrings c) :
   343   memset(this, 0, sizeof(*this)); // Beware, this zeroes bits of fields.
   364   _output(output ? output : tty),
   344   _output = output ? output : tty;
   365   _codeBuffer(NULL),
   345   _codeBlob    = NULL;
   366   _codeBlob(NULL),
   346   _codeBuffer  = NULL;
   367   _nm(code),
   347   _nm          = code;
   368   _strings(),
   348   _start       = _nm->code_begin();
   369   _start(_nm->code_begin()),
   349   _end         = _nm->code_end();
   370   _end(_nm->code_end()),
   350   _helpPrinted = false;
   371   _option_buf(),
       
   372   _print_raw(0),
       
   373   _cur_insn(NULL),
       
   374   _bytes_per_line(0),
       
   375   _pre_decode_alignment(0),
       
   376   _post_decode_alignment(0),
       
   377   _print_file_name(false),
       
   378   _print_help(false),
       
   379   _helpPrinted(false) {
       
   380 
       
   381   memset(_option_buf, 0, sizeof(_option_buf));
   351   _strings.copy(c);
   382   _strings.copy(c);
   352 
       
   353   process_options(_output);
   383   process_options(_output);
   354 }
   384 }
   355 
   385 
   356 // Constructor for a 'decode_env' to decode a memory range [start, end)
   386 // Constructor for a 'decode_env' to decode a memory range [start, end)
   357 // of unknown origin, assuming it contains code.
   387 // of unknown origin, assuming it contains code.
   358 decode_env::decode_env(address start, address end, outputStream* output) {
   388 decode_env::decode_env(address start, address end, outputStream* output) :
       
   389   _output(output ? output : tty),
       
   390   _codeBuffer(NULL),
       
   391   _codeBlob(NULL),
       
   392   _nm(NULL),
       
   393   _strings(),
       
   394   _start(start),
       
   395   _end(end),
       
   396   _option_buf(),
       
   397   _print_raw(0),
       
   398   _cur_insn(NULL),
       
   399   _bytes_per_line(0),
       
   400   _pre_decode_alignment(0),
       
   401   _post_decode_alignment(0),
       
   402   _print_file_name(false),
       
   403   _print_help(false),
       
   404   _helpPrinted(false) {
       
   405 
   359   assert(start < end, "Range must have a positive size, [" PTR_FORMAT ".." PTR_FORMAT ").", p2i(start), p2i(end));
   406   assert(start < end, "Range must have a positive size, [" PTR_FORMAT ".." PTR_FORMAT ").", p2i(start), p2i(end));
   360   memset(this, 0, sizeof(*this));
   407   memset(_option_buf, 0, sizeof(_option_buf));
   361   _output = output ? output : tty;
       
   362   _codeBlob    = NULL;
       
   363   _codeBuffer  = NULL;
       
   364   _start       = start;
       
   365   _end         = end;
       
   366   _helpPrinted = false;
       
   367 
       
   368   process_options(_output);
   408   process_options(_output);
   369 }
   409 }
   370 
   410 
   371 void decode_env::process_options(outputStream* ost) {
   411 void decode_env::process_options(outputStream* ost) {
   372   // by default, output pc but not bytes:
   412   // by default, output pc but not bytes: