Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8246377: [PPC64] Further improvements for assembler stop function
Reviewed-by: goetz, xliu
  • Loading branch information
TheRealMDoerr committed Jun 2, 2020
1 parent 6c3bc71 commit 5f0f4d75e09d95e9e8f753b0dd1a2a9da839d85b
@@ -192,7 +192,10 @@ void Disassembler::annotate(address here, outputStream* st) {
st->fill_to(aligned_pos + tabspacing);
st->print(";trap: ic miss check");
} else if ((stop_type = MacroAssembler::tdi_get_si16(instruction, Assembler::traptoUnconditional, 0)) != -1) {
bool msg_present = (stop_type & MacroAssembler::stop_msg_present);
stop_type = (stop_type &~ MacroAssembler::stop_msg_present);
const char **detail_msg_ptr = (const char**)(here + 4);
st->fill_to(aligned_pos + tabspacing);
st->print(";trap: stop type %d", stop_type);
st->print(";trap: stop type %d: %s", stop_type, msg_present ? *detail_msg_ptr : "no details provided");
}
}
@@ -4432,17 +4432,21 @@ void MacroAssembler::verify_oop_addr(RegisterOrConstant offs, Register base, con

// Call a C-function that prints output.
void MacroAssembler::stop(int type, const char* msg) {
bool msg_present = (msg != NULL);

#ifndef PRODUCT
block_comment(err_msg("stop(type %d): %s {", type, msg));
block_comment(err_msg("stop(type %d): %s {", type, msg_present ? msg : "null"));
#else
block_comment("stop {");
#endif

if (type != stop_shouldnotreachhere) {
// Use R0 to pass msg. "shouldnotreachhere" preserves R0.
load_const_optimized(R0, (void*)msg);
if (msg_present) {
type |= stop_msg_present;
}
tdi_unchecked(traptoUnconditional, 0/*reg 0*/, type);
if (msg_present) {
emit_int64((uintptr_t)msg);
}

block_comment("} stop;");
}
@@ -901,17 +901,18 @@ class MacroAssembler: public Assembler {

public:
enum {
stop_stop = 0,
stop_untested = 1,
stop_unimplemented = 2,
stop_shouldnotreachhere = 3
stop_stop = 0,
stop_untested = 1,
stop_unimplemented = 2,
stop_shouldnotreachhere = 3,
stop_msg_present = -0x8000
};

// Prints msg, dumps registers and stops execution.
void stop (const char* msg = NULL) { stop(stop_stop, msg ); }
void untested (const char* msg = NULL) { stop(stop_untested, msg ); }
void unimplemented(const char* msg = NULL) { stop(stop_unimplemented, msg ); }
void should_not_reach_here() { stop(stop_shouldnotreachhere, NULL); }
void stop (const char* msg = NULL) { stop(stop_stop, msg); }
void untested (const char* msg = NULL) { stop(stop_untested, msg); }
void unimplemented (const char* msg = NULL) { stop(stop_unimplemented, msg); }
void should_not_reach_here(const char* msg = NULL) { stop(stop_shouldnotreachhere, msg); }

void zap_from_to(Register low, int before, Register high, int after, Register val, Register addr) PRODUCT_RETURN;
};
@@ -438,25 +438,28 @@ JVM_handle_aix_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrec

// stop on request
else if (sig == SIGTRAP && (stop_type = nativeInstruction_at(pc)->get_stop_type()) != -1) {
const char *msg = NULL,
*detail_msg = (const char*)(uc->uc_mcontext.jmp_context.gpr[0]);
bool msg_present = (stop_type & MacroAssembler::stop_msg_present);
stop_type = (stop_type &~ MacroAssembler::stop_msg_present);

const char *msg = NULL;
switch (stop_type) {
case MacroAssembler::stop_stop : msg = "stop"; break;
case MacroAssembler::stop_untested : msg = "untested"; break;
case MacroAssembler::stop_unimplemented : msg = "unimplemented"; break;
case MacroAssembler::stop_shouldnotreachhere: msg = "shouldnotreachhere"; detail_msg = NULL; break;
case MacroAssembler::stop_stop : msg = "stop"; break;
case MacroAssembler::stop_untested : msg = "untested"; break;
case MacroAssembler::stop_unimplemented : msg = "unimplemented"; break;
case MacroAssembler::stop_shouldnotreachhere: msg = "shouldnotreachhere"; break;
default: msg = "unknown"; break;
}
if (detail_msg == NULL) {
detail_msg = "no details provided";
}

const char **detail_msg_ptr = (const char**)(pc + 4);
const char *detail_msg = msg_present ? *detail_msg_ptr : "no details provided";

if (TraceTraps) {
tty->print_cr("trap: %s: %s (SIGTRAP, stop type %d)", msg, detail_msg, stop_type);
}

va_list detail_args;
VMError::report_and_die(t, ucVoid, NULL, 0, msg, detail_msg, detail_args);
VMError::report_and_die(INTERNAL_ERROR, msg, detail_msg, detail_args, thread,
pc, info, ucVoid, NULL, 0, 0);
va_end(detail_args);
}

@@ -468,25 +468,28 @@ JVM_handle_linux_signal(int sig,

// stop on request
else if (sig == SIGTRAP && (stop_type = nativeInstruction_at(pc)->get_stop_type()) != -1) {
const char *msg = NULL,
*detail_msg = (const char*)(uc->uc_mcontext.regs->gpr[0]);
bool msg_present = (stop_type & MacroAssembler::stop_msg_present);
stop_type = (stop_type &~ MacroAssembler::stop_msg_present);

const char *msg = NULL;
switch (stop_type) {
case MacroAssembler::stop_stop : msg = "stop"; break;
case MacroAssembler::stop_untested : msg = "untested"; break;
case MacroAssembler::stop_unimplemented : msg = "unimplemented"; break;
case MacroAssembler::stop_shouldnotreachhere: msg = "shouldnotreachhere"; detail_msg = NULL; break;
case MacroAssembler::stop_stop : msg = "stop"; break;
case MacroAssembler::stop_untested : msg = "untested"; break;
case MacroAssembler::stop_unimplemented : msg = "unimplemented"; break;
case MacroAssembler::stop_shouldnotreachhere: msg = "shouldnotreachhere"; break;
default: msg = "unknown"; break;
}
if (detail_msg == NULL) {
detail_msg = "no details provided";
}

const char **detail_msg_ptr = (const char**)(pc + 4);
const char *detail_msg = msg_present ? *detail_msg_ptr : "no details provided";

if (TraceTraps) {
tty->print_cr("trap: %s: %s (SIGTRAP, stop type %d)", msg, detail_msg, stop_type);
}

va_list detail_args;
VMError::report_and_die(t, ucVoid, NULL, 0, msg, detail_msg, detail_args);
VMError::report_and_die(INTERNAL_ERROR, msg, detail_msg, detail_args, thread,
pc, info, ucVoid, NULL, 0, 0);
va_end(detail_args);
}

0 comments on commit 5f0f4d7

Please sign in to comment.