src/hotspot/share/compiler/disassembler.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File open Sdiff src/hotspot/share/compiler

src/hotspot/share/compiler/disassembler.cpp

Print this page


   1 /*
   2  * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 655   if (!load_library())  return;
 656   decode_env env(CodeCache::find_blob_unsafe(start), st, c, offset);
 657   env.decode_instructions(start, end);
 658 }
 659 
 660 void Disassembler::decode(nmethod* nm, outputStream* st) {
 661   ttyLocker ttyl;
 662   if (!load_library())  return;
 663   decode_env env(nm, st);
 664   env.output()->print_cr("----------------------------------------------------------------------");
 665 
 666   unsigned char* p   = nm->code_begin();
 667   unsigned char* end = nm->code_end();
 668 
 669   nm->method()->method_holder()->name()->print_symbol_on(env.output());
 670   env.output()->print(".");
 671   nm->method()->name()->print_symbol_on(env.output());
 672   nm->method()->signature()->print_symbol_on(env.output());
 673 #if INCLUDE_JVMCI
 674   {
 675     char buffer[O_BUFLEN];
 676     char* jvmciName = nm->jvmci_installed_code_name(buffer, O_BUFLEN);
 677     if (jvmciName != NULL) {
 678       env.output()->print(" (%s)", jvmciName);
 679     }
 680   }
 681 #endif
 682   env.output()->print_cr("  [" PTR_FORMAT ", " PTR_FORMAT "]  " JLONG_FORMAT " bytes", p2i(p), p2i(end), ((jlong)(end - p)));
 683 
 684   // Print constant table.
 685   if (nm->consts_size() > 0) {
 686     nm->print_nmethod_labels(env.output(), nm->consts_begin());
 687     int offset = 0;
 688     for (address p = nm->consts_begin(); p < nm->consts_end(); p += 4, offset += 4) {
 689       if ((offset % 8) == 0) {
 690         env.output()->print_cr("  " PTR_FORMAT " (offset: %4d): " PTR32_FORMAT "   " PTR64_FORMAT, p2i(p), offset, *((int32_t*) p), *((int64_t*) p));
 691       } else {
 692         env.output()->print_cr("  " PTR_FORMAT " (offset: %4d): " PTR32_FORMAT,                    p2i(p), offset, *((int32_t*) p));
 693       }
 694     }
 695   }
 696 
   1 /*
   2  * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 655   if (!load_library())  return;
 656   decode_env env(CodeCache::find_blob_unsafe(start), st, c, offset);
 657   env.decode_instructions(start, end);
 658 }
 659 
 660 void Disassembler::decode(nmethod* nm, outputStream* st) {
 661   ttyLocker ttyl;
 662   if (!load_library())  return;
 663   decode_env env(nm, st);
 664   env.output()->print_cr("----------------------------------------------------------------------");
 665 
 666   unsigned char* p   = nm->code_begin();
 667   unsigned char* end = nm->code_end();
 668 
 669   nm->method()->method_holder()->name()->print_symbol_on(env.output());
 670   env.output()->print(".");
 671   nm->method()->name()->print_symbol_on(env.output());
 672   nm->method()->signature()->print_symbol_on(env.output());
 673 #if INCLUDE_JVMCI
 674   {
 675     const char* jvmciName = nm->jvmci_name();

 676     if (jvmciName != NULL) {
 677       env.output()->print(" (%s)", jvmciName);
 678     }
 679   }
 680 #endif
 681   env.output()->print_cr("  [" PTR_FORMAT ", " PTR_FORMAT "]  " JLONG_FORMAT " bytes", p2i(p), p2i(end), ((jlong)(end - p)));
 682 
 683   // Print constant table.
 684   if (nm->consts_size() > 0) {
 685     nm->print_nmethod_labels(env.output(), nm->consts_begin());
 686     int offset = 0;
 687     for (address p = nm->consts_begin(); p < nm->consts_end(); p += 4, offset += 4) {
 688       if ((offset % 8) == 0) {
 689         env.output()->print_cr("  " PTR_FORMAT " (offset: %4d): " PTR32_FORMAT "   " PTR64_FORMAT, p2i(p), offset, *((int32_t*) p), *((int64_t*) p));
 690       } else {
 691         env.output()->print_cr("  " PTR_FORMAT " (offset: %4d): " PTR32_FORMAT,                    p2i(p), offset, *((int32_t*) p));
 692       }
 693     }
 694   }
 695 
src/hotspot/share/compiler/disassembler.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File