src/share/vm/compiler/disassembler.hpp

Fri, 29 Apr 2016 00:06:10 +0800

author
aoqi
date
Fri, 29 Apr 2016 00:06:10 +0800
changeset 1
2d8a650513c2
parent 0
f90c822e73f8
child 433
bd82ffa08941
child 6876
710a3c8b516e
permissions
-rw-r--r--

Added MIPS 64-bit port.

     1 /*
     2  * Copyright (c) 2008, 2013, 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  *
    23  */
    25 /*
    26  * This file has been modified by Loongson Technology in 2015. These
    27  * modifications are Copyright (c) 2015 Loongson Technology, and are made
    28  * available on the same license terms set forth above.
    29  */
    31 #ifndef SHARE_VM_COMPILER_DISASSEMBLER_HPP
    32 #define SHARE_VM_COMPILER_DISASSEMBLER_HPP
    34 #include "asm/codeBuffer.hpp"
    35 #include "compiler/disassemblerEnv.hpp"
    36 #include "runtime/globals.hpp"
    37 #ifdef TARGET_OS_FAMILY_linux
    38 # include "os_linux.inline.hpp"
    39 #endif
    40 #ifdef TARGET_OS_FAMILY_solaris
    41 # include "os_solaris.inline.hpp"
    42 #endif
    43 #ifdef TARGET_OS_FAMILY_windows
    44 # include "os_windows.inline.hpp"
    45 #endif
    46 #ifdef TARGET_OS_FAMILY_aix
    47 # include "os_aix.inline.hpp"
    48 #endif
    49 #ifdef TARGET_OS_FAMILY_bsd
    50 # include "os_bsd.inline.hpp"
    51 #endif
    53 class decode_env;
    54 #ifdef MIPS64
    55  # include "disassembler_mips.hpp"
    56 #else
    57 // The disassembler prints out assembly code annotated
    58 // with Java specific information.
    60 class Disassembler {
    61   friend class decode_env;
    62  private:
    63   // this is the type of the dll entry point:
    64   typedef void* (*decode_func_virtual)(uintptr_t start_va, uintptr_t end_va,
    65                                unsigned char* buffer, uintptr_t length,
    66                                void* (*event_callback)(void*, const char*, void*),
    67                                void* event_stream,
    68                                int (*printf_callback)(void*, const char*, ...),
    69                                void* printf_stream,
    70                                const char* options,
    71                                int newline);
    72   // this is the type of the dll entry point for old version:
    73   typedef void* (*decode_func)(void* start_va, void* end_va,
    74                                void* (*event_callback)(void*, const char*, void*),
    75                                void* event_stream,
    76                                int (*printf_callback)(void*, const char*, ...),
    77                                void* printf_stream,
    78                                const char* options);
    79   // points to the library.
    80   static void*    _library;
    81   // bailout
    82   static bool     _tried_to_load_library;
    83   // points to the decode function.
    84   static decode_func_virtual _decode_instructions_virtual;
    85   static decode_func _decode_instructions;
    86   // tries to load library and return whether it succedded.
    87   static bool load_library();
    88 #ifdef MIPS64
    89   // decodes one instruction and return the start of the next instruction.
    90    static address decode_instruction(address start, DisassemblerEnv* env);
    91 #endif
    92   // Machine dependent stuff
    93 #ifdef TARGET_ARCH_x86
    94 # include "disassembler_x86.hpp"
    95 #endif
    96 #ifdef TARGET_ARCH_sparc
    97 # include "disassembler_sparc.hpp"
    98 #endif
    99 #ifdef TARGET_ARCH_zero
   100 # include "disassembler_zero.hpp"
   101 #endif
   102 #ifdef TARGET_ARCH_arm
   103 # include "disassembler_arm.hpp"
   104 #endif
   105 #ifdef TARGET_ARCH_ppc
   106 # include "disassembler_ppc.hpp"
   107 #endif
   109  public:
   110   static bool can_decode() {
   111     return (_decode_instructions_virtual != NULL) ||
   112            (_decode_instructions != NULL) ||
   113            load_library();
   114   }
   115   static void decode(CodeBlob *cb,               outputStream* st = NULL);
   116   static void decode(nmethod* nm,                outputStream* st = NULL);
   117   static void decode(address begin, address end, outputStream* st = NULL, CodeStrings c = CodeStrings());
   118 };
   120 #endif //MIPS64 has its own disassembler implements. 2013/02/25
   122 #endif // SHARE_VM_COMPILER_DISASSEMBLER_HPP

mercurial