Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/compiler/disassembler.hpp
32285 views
/*1* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_COMPILER_DISASSEMBLER_HPP25#define SHARE_VM_COMPILER_DISASSEMBLER_HPP2627#include "asm/codeBuffer.hpp"28#include "runtime/globals.hpp"29#ifdef TARGET_OS_FAMILY_linux30# include "os_linux.inline.hpp"31#endif32#ifdef TARGET_OS_FAMILY_solaris33# include "os_solaris.inline.hpp"34#endif35#ifdef TARGET_OS_FAMILY_windows36# include "os_windows.inline.hpp"37#endif38#ifdef TARGET_OS_FAMILY_aix39# include "os_aix.inline.hpp"40#endif41#ifdef TARGET_OS_FAMILY_bsd42# include "os_bsd.inline.hpp"43#endif4445class decode_env;4647// The disassembler prints out assembly code annotated48// with Java specific information.4950class Disassembler {51friend class decode_env;52private:53// this is the type of the dll entry point:54typedef void* (*decode_func_virtual)(uintptr_t start_va, uintptr_t end_va,55unsigned char* buffer, uintptr_t length,56void* (*event_callback)(void*, const char*, void*),57void* event_stream,58int (*printf_callback)(void*, const char*, ...),59void* printf_stream,60const char* options,61int newline);62// this is the type of the dll entry point for old version:63typedef void* (*decode_func)(void* start_va, void* end_va,64void* (*event_callback)(void*, const char*, void*),65void* event_stream,66int (*printf_callback)(void*, const char*, ...),67void* printf_stream,68const char* options);69// points to the library.70static void* _library;71// bailout72static bool _tried_to_load_library;73// points to the decode function.74static decode_func_virtual _decode_instructions_virtual;75static decode_func _decode_instructions;76// tries to load library and return whether it succedded.77static bool load_library();7879// Machine dependent stuff80#ifdef TARGET_ARCH_x8681# include "disassembler_x86.hpp"82#endif83#ifdef TARGET_ARCH_aarch3284# include "disassembler_aarch32.hpp"85#endif86#ifdef TARGET_ARCH_aarch6487# include "disassembler_aarch64.hpp"88#endif89#ifdef TARGET_ARCH_sparc90# include "disassembler_sparc.hpp"91#endif92#ifdef TARGET_ARCH_zero93# include "disassembler_zero.hpp"94#endif95#ifdef TARGET_ARCH_arm96# include "disassembler_arm.hpp"97#endif98#ifdef TARGET_ARCH_ppc99# include "disassembler_ppc.hpp"100#endif101102103public:104static bool can_decode() {105return (_decode_instructions_virtual != NULL) ||106(_decode_instructions != NULL) ||107load_library();108}109static void decode(CodeBlob *cb, outputStream* st = NULL);110static void decode(nmethod* nm, outputStream* st = NULL);111static void decode(address begin, address end, outputStream* st = NULL, CodeStrings c = CodeStrings());112};113114#endif // SHARE_VM_COMPILER_DISASSEMBLER_HPP115116117