8255049: Remove support for the hsdis decode_instructions entry point in hotspot

Reviewed-by: neliasso, kvn
This commit is contained in:
Claes Redestad 2020-10-23 07:59:31 +00:00
parent c1524c59ad
commit 107fb9ccf8
2 changed files with 6 additions and 37 deletions

View file

@ -48,12 +48,9 @@ bool Disassembler::_library_usable = false;
// This routine is in the shared library: // This routine is in the shared library:
Disassembler::decode_func_virtual Disassembler::_decode_instructions_virtual = NULL; Disassembler::decode_func_virtual Disassembler::_decode_instructions_virtual = NULL;
Disassembler::decode_func Disassembler::_decode_instructions = NULL;
static const char hsdis_library_name[] = "hsdis-" HOTSPOT_LIB_ARCH; static const char hsdis_library_name[] = "hsdis-" HOTSPOT_LIB_ARCH;
static const char decode_instructions_virtual_name[] = "decode_instructions_virtual"; static const char decode_instructions_virtual_name[] = "decode_instructions_virtual";
static const char decode_instructions_name[] = "decode_instructions";
static bool use_new_version = true;
#define COMMENT_COLUMN 52 LP64_ONLY(+8) /*could be an option*/ #define COMMENT_COLUMN 52 LP64_ONLY(+8) /*could be an option*/
#define BYTES_COMMENT ";..." /* funky byte display comment */ #define BYTES_COMMENT ";..." /* funky byte display comment */
@ -736,34 +733,22 @@ address decode_env::decode_instructions(address start, address end, address orig
// This is mainly for debugging the library itself. // This is mainly for debugging the library itself.
FILE* out = stdout; FILE* out = stdout;
FILE* xmlout = (_print_raw > 1 ? out : NULL); FILE* xmlout = (_print_raw > 1 ? out : NULL);
return use_new_version ? return
(address) (address)
(*Disassembler::_decode_instructions_virtual)((uintptr_t)start, (uintptr_t)end, (*Disassembler::_decode_instructions_virtual)((uintptr_t)start, (uintptr_t)end,
start, end - start, start, end - start,
NULL, (void*) xmlout, NULL, (void*) xmlout,
NULL, (void*) out, NULL, (void*) out,
options(), 0/*nice new line*/) options(), 0/*nice new line*/);
:
(address)
(*Disassembler::_decode_instructions)(start, end,
NULL, (void*) xmlout,
NULL, (void*) out,
options());
} }
return use_new_version ? return
(address) (address)
(*Disassembler::_decode_instructions_virtual)((uintptr_t)start, (uintptr_t)end, (*Disassembler::_decode_instructions_virtual)((uintptr_t)start, (uintptr_t)end,
start, end - start, start, end - start,
&event_to_env, (void*) this, &event_to_env, (void*) this,
&printf_to_env, (void*) this, &printf_to_env, (void*) this,
options(), 0/*nice new line*/) options(), 0/*nice new line*/);
:
(address)
(*Disassembler::_decode_instructions)(start, end,
&event_to_env, (void*) this,
&printf_to_env, (void*) this,
options());
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -853,21 +838,13 @@ bool Disassembler::load_library(outputStream* st) {
_library = os::dll_load(buf, ebuf, sizeof ebuf); _library = os::dll_load(buf, ebuf, sizeof ebuf);
} }
// load the decoder function to use (new or old version). // load the decoder function to use.
if (_library != NULL) { if (_library != NULL) {
_decode_instructions_virtual = CAST_TO_FN_PTR(Disassembler::decode_func_virtual, _decode_instructions_virtual = CAST_TO_FN_PTR(Disassembler::decode_func_virtual,
os::dll_lookup(_library, decode_instructions_virtual_name)); os::dll_lookup(_library, decode_instructions_virtual_name));
} }
if (_decode_instructions_virtual == NULL && _library != NULL) {
// could not spot in new version, try old version
_decode_instructions = CAST_TO_FN_PTR(Disassembler::decode_func,
os::dll_lookup(_library, decode_instructions_name));
use_new_version = false;
} else {
use_new_version = true;
}
_tried_to_load_library = true; _tried_to_load_library = true;
_library_usable = _decode_instructions_virtual != NULL || _decode_instructions != NULL; _library_usable = _decode_instructions_virtual != NULL;
// Create a dummy environment to initialize PrintAssemblyOptions. // Create a dummy environment to initialize PrintAssemblyOptions.
// The PrintAssemblyOptions must be known for abstract disassemblies as well. // The PrintAssemblyOptions must be known for abstract disassemblies as well.

View file

@ -52,13 +52,6 @@ class Disassembler : public AbstractDisassembler {
void* printf_stream, void* printf_stream,
const char* options, const char* options,
int newline); int newline);
// this is the type of the dll entry point for old version:
typedef void* (*decode_func)(void* start_va, void* end_va,
void* (*event_callback)(void*, const char*, void*),
void* event_stream,
int (*printf_callback)(void*, const char*, ...),
void* printf_stream,
const char* options);
// points to the library. // points to the library.
static void* _library; static void* _library;
// bailout // bailout
@ -66,7 +59,6 @@ class Disassembler : public AbstractDisassembler {
static bool _library_usable; static bool _library_usable;
// points to the decode function. // points to the decode function.
static decode_func_virtual _decode_instructions_virtual; static decode_func_virtual _decode_instructions_virtual;
static decode_func _decode_instructions;
// tries to load library and return whether it succeeded. // tries to load library and return whether it succeeded.
// Allow (diagnostic) output redirection. // Allow (diagnostic) output redirection.