Skip to content
Permalink
Browse files
8255049: Remove support for the hsdis decode_instructions entry point…
… in hotspot

Reviewed-by: neliasso, kvn
  • Loading branch information
cl4es committed Oct 23, 2020
1 parent c1524c5 commit 107fb9ccf81c5c840004c56a7f19490c37b7a4a6
Showing with 6 additions and 37 deletions.
  1. +6 −29 src/hotspot/share/compiler/disassembler.cpp
  2. +0 −8 src/hotspot/share/compiler/disassembler.hpp
@@ -48,12 +48,9 @@ bool Disassembler::_library_usable = false;

// This routine is in the shared library:
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 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 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.
FILE* out = stdout;
FILE* xmlout = (_print_raw > 1 ? out : NULL);
return use_new_version ?
return
(address)
(*Disassembler::_decode_instructions_virtual)((uintptr_t)start, (uintptr_t)end,
start, end - start,
NULL, (void*) xmlout,
NULL, (void*) out,
options(), 0/*nice new line*/)
:
(address)
(*Disassembler::_decode_instructions)(start, end,
NULL, (void*) xmlout,
NULL, (void*) out,
options());
options(), 0/*nice new line*/);
}

return use_new_version ?
return
(address)
(*Disassembler::_decode_instructions_virtual)((uintptr_t)start, (uintptr_t)end,
start, end - start,
&event_to_env, (void*) this,
&printf_to_env, (void*) this,
options(), 0/*nice new line*/)
:
(address)
(*Disassembler::_decode_instructions)(start, end,
&event_to_env, (void*) this,
&printf_to_env, (void*) this,
options());
options(), 0/*nice new line*/);
}

// ----------------------------------------------------------------------------
@@ -853,21 +838,13 @@ bool Disassembler::load_library(outputStream* st) {
_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) {
_decode_instructions_virtual = CAST_TO_FN_PTR(Disassembler::decode_func_virtual,
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;
_library_usable = _decode_instructions_virtual != NULL || _decode_instructions != NULL;
_library_usable = _decode_instructions_virtual != NULL;

// Create a dummy environment to initialize PrintAssemblyOptions.
// The PrintAssemblyOptions must be known for abstract disassemblies as well.
@@ -52,21 +52,13 @@ class Disassembler : public AbstractDisassembler {
void* printf_stream,
const char* options,
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.
static void* _library;
// bailout
static bool _tried_to_load_library;
static bool _library_usable;
// points to the decode function.
static decode_func_virtual _decode_instructions_virtual;
static decode_func _decode_instructions;

// tries to load library and return whether it succeeded.
// Allow (diagnostic) output redirection.

1 comment on commit 107fb9c

@bridgekeeper

This comment has been minimized.

Copy link

@bridgekeeper bridgekeeper bot commented on 107fb9c Oct 23, 2020

Please sign in to comment.