/* * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
// The disassembler prints out assembly code annotated // with Java specific information.
// Disassembler inherits from AbstractDisassembler class Disassembler : public AbstractDisassembler { friendclass decode_env; private: // this is the type of the dll entry point: typedefvoid* (*decode_func_virtual)(uintptr_t start_va, uintptr_t end_va, unsignedchar* buffer, uintptr_t length, void* (*event_callback)(void*, constchar*, void*), void* event_stream, int (*printf_callback)(void*, constchar*, ...), void* printf_stream, constchar* options, int newline); // points to the library. staticvoid* _library; // bailout staticbool _tried_to_load_library; staticbool _library_usable; // points to the decode function. static decode_func_virtual _decode_instructions_virtual;
// tries to load library and return whether it succeeded. // Allow (diagnostic) output redirection. // No output at all if stream is NULL. Can be overridden // with -Verbose flag, in which case output goes to tty. staticbool load_library(outputStream* st = NULL); staticvoid* dll_load(char* buf, int buflen, int offset, char* ebuf, int ebuflen, outputStream* st);
// Check if the two addresses are on the same page. staticbool is_same_page(address a1, address a2) { return (((uintptr_t)a1 ^ (uintptr_t)a2) & (~0x0fffUL)) == 0L;
}
public: // We can always decode code blobs. // Either we have a disassembler library available (successfully loaded) // or we will resort to the abstract disassembler. This method informs // about which decoding format is used. // We can also enforce using the abstract disassembler. staticbool is_abstract() { if (!_tried_to_load_library) {
load_library();
} return ! _library_usable;
}
// Check out if we are doing a live disassembly or a post-mortem // disassembly where the binary data was loaded from a hs_err file. staticbool is_decode_error_file() { // Activate once post-mortem disassembly (from hs-err file) is available. #if 0 return DecodeErrorFile && (strlen(DecodeErrorFile) != 0); #else returnfalse; #endif
}
staticvoid _hook(constchar* file, int line, class MacroAssembler* masm);
// This functions makes it easy to generate comments in the generated // interpreter code, by riding on the customary __ macro in the interpreter generator. // See templateTable_x86.cpp for an example. template<class T> inlinestatic T* hook(constchar* file, int line, T* masm) { if (PrintInterpreter) {
_hook(file, line, masm);
} return masm;
}
};
#endif// SHARE_COMPILER_DISASSEMBLER_HPP
¤ Dauer der Verarbeitung: 0.22 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.