1 Star 0 Fork 81

fuowang/openjdk-1.8.0

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
8140594-Various-minor-code-improvements-compiler.patch 21.76 KB
一键复制 编辑 原始数据 按行查看 历史
eapen 提交于 2023-01-11 10:00 . I69W1Y: Add feature and bug fix for 8u352
From 39f5104db20a569e361c0300756e35ab7e6ac296 Mon Sep 17 00:00:00 2001
From: eapen <zhangyipeng7@huawei.com>
Date: Fri, 16 Dec 2022 16:06:02 +0000
Subject: [PATCH 30/33] I68TO2: 8140594: Various minor code improvements (compiler)
---
hotspot/src/os/linux/vm/os_linux.cpp | 5 +-
hotspot/src/os/linux/vm/vmError_linux.cpp | 16 ++---
hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp | 2 +-
hotspot/src/share/vm/adlc/formssel.cpp | 13 ++--
hotspot/src/share/vm/c1/c1_LinearScan.cpp | 7 +-
hotspot/src/share/vm/classfile/classFileParser.cpp | 11 +--
.../src/share/vm/classfile/systemDictionary.cpp | 6 +-
hotspot/src/share/vm/compiler/compileBroker.cpp | 84 +++++++---------------
hotspot/src/share/vm/compiler/compileBroker.hpp | 11 +--
hotspot/src/share/vm/compiler/compileLog.cpp | 3 +-
hotspot/src/share/vm/compiler/disassembler.cpp | 6 +-
hotspot/src/share/vm/oops/generateOopMap.cpp | 8 ++-
hotspot/src/share/vm/opto/block.cpp | 2 +-
hotspot/src/share/vm/opto/graphKit.cpp | 2 +-
hotspot/src/share/vm/opto/matcher.cpp | 9 ++-
hotspot/src/share/vm/runtime/relocator.cpp | 4 +-
16 files changed, 84 insertions(+), 105 deletions(-)
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index ab28ee3..b82352c 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -2159,9 +2159,10 @@ static bool _print_ascii_file(const char* filename, outputStream* st) {
return false;
}
- char buf[32];
+ char buf[33];
int bytes;
- while ((bytes = ::read(fd, buf, sizeof(buf))) > 0) {
+ buf[32] = '\0';
+ while ((bytes = ::read(fd, buf, sizeof(buf) - 1)) > 0) {
st->print_raw(buf, bytes);
}
diff --git a/hotspot/src/os/linux/vm/vmError_linux.cpp b/hotspot/src/os/linux/vm/vmError_linux.cpp
index fca239c..52ca40b 100644
--- a/hotspot/src/os/linux/vm/vmError_linux.cpp
+++ b/hotspot/src/os/linux/vm/vmError_linux.cpp
@@ -42,19 +42,19 @@ void VMError::show_message_box(char *buf, int buflen) {
char *p = &buf[len];
jio_snprintf(p, buflen - len,
- "\n\n"
- "Do you want to debug the problem?\n\n"
- "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " UINTX_FORMAT " (" INTPTR_FORMAT ")\n"
- "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n"
- "Otherwise, press RETURN to abort...",
- os::current_process_id(), os::current_process_id(),
- os::current_thread_id(), os::current_thread_id());
+ "\n\n"
+ "Do you want to debug the problem?\n\n"
+ "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " UINTX_FORMAT " (" INTPTR_FORMAT ")\n"
+ "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n"
+ "Otherwise, press RETURN to abort...",
+ os::current_process_id(), os::current_process_id(),
+ os::current_thread_id(), os::current_thread_id());
yes = os::message_box("Unexpected Error", buf);
if (yes) {
// yes, user asked VM to launch debugger
- jio_snprintf(buf, buflen, "gdb /proc/%d/exe %d",
+ jio_snprintf(buf, sizeof(char)*buflen, "gdb /proc/%d/exe %d",
os::current_process_id(), os::current_process_id());
os::fork_and_exec(buf);
diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
index 4775dc8..fba3d28 100644
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
@@ -813,7 +813,7 @@ void os::print_context(outputStream *st, void *context) {
intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp);
- print_hex_dump(st, (address)sp, (address)(sp + 8*sizeof(intptr_t)), sizeof(intptr_t));
+ print_hex_dump(st, (address)sp, (address)(sp + 8), sizeof(intptr_t));
st->cr();
// Note: it may be unsafe to inspect memory near pc. For example, pc may
diff --git a/hotspot/src/share/vm/adlc/formssel.cpp b/hotspot/src/share/vm/adlc/formssel.cpp
index 23fa1bb..6d57ff2 100644
--- a/hotspot/src/share/vm/adlc/formssel.cpp
+++ b/hotspot/src/share/vm/adlc/formssel.cpp
@@ -1496,7 +1496,8 @@ void MachNodeForm::output(FILE *fp) {
// twice, we need to check that the operands are pointer-eequivalent in
// the DFA during the labeling process.
Predicate *InstructForm::build_predicate() {
- char buf[1024], *s=buf;
+ const int buflen = 1024;
+ char buf[buflen], *s=buf;
Dict names(cmpstr,hashstr,Form::arena); // Map Names to counts
MatchNode *mnode =
@@ -1505,12 +1506,12 @@ Predicate *InstructForm::build_predicate() {
uint first = 1;
// Start with the predicate supplied in the .ad file.
- if( _predicate ) {
- if( first ) first=0;
- strcpy(s,"("); s += strlen(s);
- strcpy(s,_predicate->_pred);
+ if(_predicate) {
+ if(first) first = 0;
+ strcpy(s, "("); s += strlen(s);
+ strncpy(s, _predicate->_pred, buflen - strlen(s) - 1);
s += strlen(s);
- strcpy(s,")"); s += strlen(s);
+ strcpy(s, ")"); s += strlen(s);
}
for( DictI i(&names); i.test(); ++i ) {
uintptr_t cnt = (uintptr_t)i._value;
diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.cpp b/hotspot/src/share/vm/c1/c1_LinearScan.cpp
index ec4a67e..d754aa9 100644
--- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp
+++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp
@@ -5484,7 +5484,7 @@ int LinearScanWalker::find_locked_double_reg(int reg_needed_until, int interval_
}
}
- if (_block_pos[max_reg] <= interval_to || _block_pos[max_reg + 1] <= interval_to) {
+ if (max_reg != any_reg && (_block_pos[max_reg] <= interval_to || _block_pos[max_reg + 1] <= interval_to)) {
*need_split = true;
}
@@ -6443,8 +6443,9 @@ void LinearScanStatistic::print(const char* title) {
if (_counters_sum[i] > 0 || _counters_max[i] >= 0) {
tty->print("%25s: %8d", counter_name(i), _counters_sum[i]);
- if (base_counter(i) != invalid_counter) {
- tty->print(" (%5.1f%%) ", _counters_sum[i] * 100.0 / _counters_sum[base_counter(i)]);
+ LinearScanStatistic::Counter cntr = base_counter(i);
+ if (cntr != invalid_counter) {
+ tty->print(" (%5.1f%%) ", _counters_sum[i] * 100.0 / _counters_sum[cntr]);
} else {
tty->print(" ");
}
diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp
index 51ab4f5..d8e99e6 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp
@@ -1085,9 +1085,11 @@ class FieldAllocationCount: public ResourceObj {
FieldAllocationType update(bool is_static, BasicType type) {
FieldAllocationType atype = basic_type_to_atype(is_static, type);
- // Make sure there is no overflow with injected fields.
- assert(count[atype] < 0xFFFF, "More than 65535 fields");
- count[atype]++;
+ if (atype != BAD_ALLOCATION_TYPE) {
+ // Make sure there is no overflow with injected fields.
+ assert(count[atype] < 0xFFFF, "More than 65535 fields");
+ count[atype]++;
+ }
return atype;
}
};
@@ -3087,8 +3089,9 @@ void ClassFileParser::parse_classfile_attributes(ClassFileParser::ClassAnnotatio
}
} else if (tag == vmSymbols::tag_bootstrap_methods() &&
_major_version >= Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
- if (parsed_bootstrap_methods_attribute)
+ if (parsed_bootstrap_methods_attribute) {
classfile_parse_error("Multiple BootstrapMethods attributes in class file %s", CHECK);
+ }
parsed_bootstrap_methods_attribute = true;
parse_classfile_bootstrap_methods_attribute(attribute_length, CHECK);
} else if (tag == vmSymbols::tag_runtime_visible_type_annotations()) {
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp
index d02ed31..9089a76 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp
@@ -1195,10 +1195,10 @@ Klass* SystemDictionary::resolve_from_stream(Symbol* class_name,
while ((index = strchr(name, '/')) != NULL) {
*index = '.'; // replace '/' with '.' in package name
}
- const char* fmt = "Prohibited package name: %s";
- size_t len = strlen(fmt) + strlen(name);
+ const char* msg_text = "Prohibited package name: ";
+ size_t len = strlen(msg_text) + strlen(name) + 1;
char* message = NEW_RESOURCE_ARRAY(char, len);
- jio_snprintf(message, len, fmt, name);
+ jio_snprintf(message, len, "%s%s", msg_text, name);
Exceptions::_throw_msg(THREAD_AND_LOCATION,
vmSymbols::java_lang_SecurityException(), message);
}
diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp
index 0e9af0d..7963625 100644
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp
@@ -136,11 +136,6 @@ AbstractCompiler* CompileBroker::_compilers[2];
volatile jint CompileBroker::_compilation_id = 0;
volatile jint CompileBroker::_osr_compilation_id = 0;
-// Debugging information
-int CompileBroker::_last_compile_type = no_compile;
-int CompileBroker::_last_compile_level = CompLevel_none;
-char CompileBroker::_last_method_compiled[CompileBroker::name_buffer_length];
-
// Performance counters
PerfCounter* CompileBroker::_perf_total_compilation = NULL;
PerfCounter* CompileBroker::_perf_osr_compilation = NULL;
@@ -882,8 +877,6 @@ CompilerCounters::CompilerCounters(const char* thread_name, int instance, TRAPS)
//
// Initialize the Compilation object
void CompileBroker::compilation_init() {
- _last_method_compiled[0] = '\0';
-
// No need to initialize compilation system if we do not use it.
if (!UseCompiler) {
return;
@@ -1964,8 +1957,10 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
}
assert(!method->is_native(), "no longer compile natives");
- // Save information about this method in case of failure.
- set_last_compile(thread, method, is_osr, task_level);
+ // Update compile information when using perfdata.
+ if (UsePerfData) {
+ update_compile_perf_data(thread, method, is_osr);
+ }
DTRACE_METHOD_COMPILE_BEGIN_PROBE(method, compiler_name(task_level));
}
@@ -2180,52 +2175,44 @@ void CompileBroker::handle_full_code_cache() {
// CompileBroker::set_last_compile
//
// Record this compilation for debugging purposes.
-void CompileBroker::set_last_compile(CompilerThread* thread, methodHandle method, bool is_osr, int comp_level) {
+void CompileBroker::update_compile_perf_data(CompilerThread* thread, const methodHandle& method, bool is_osr) {
ResourceMark rm;
char* method_name = method->name()->as_C_string();
- strncpy(_last_method_compiled, method_name, CompileBroker::name_buffer_length);
- _last_method_compiled[CompileBroker::name_buffer_length - 1] = '\0'; // ensure null terminated
char current_method[CompilerCounters::cmname_buffer_length];
size_t maxLen = CompilerCounters::cmname_buffer_length;
- if (UsePerfData) {
- const char* class_name = method->method_holder()->name()->as_C_string();
+ const char* class_name = method->method_holder()->name()->as_C_string();
- size_t s1len = strlen(class_name);
- size_t s2len = strlen(method_name);
+ size_t s1len = strlen(class_name);
+ size_t s2len = strlen(method_name);
- // check if we need to truncate the string
- if (s1len + s2len + 2 > maxLen) {
+ // check if we need to truncate the string
+ if (s1len + s2len + 2 > maxLen) {
- // the strategy is to lop off the leading characters of the
- // class name and the trailing characters of the method name.
+ // the strategy is to lop off the leading characters of the
+ // class name and the trailing characters of the method name.
- if (s2len + 2 > maxLen) {
- // lop of the entire class name string, let snprintf handle
- // truncation of the method name.
- class_name += s1len; // null string
- }
- else {
- // lop off the extra characters from the front of the class name
- class_name += ((s1len + s2len + 2) - maxLen);
- }
+ if (s2len + 2 > maxLen) {
+ // lop of the entire class name string, let snprintf handle
+ // truncation of the method name.
+ class_name += s1len; // null string
+ }
+ else {
+ // lop off the extra characters from the front of the class name
+ class_name += ((s1len + s2len + 2) - maxLen);
}
-
- jio_snprintf(current_method, maxLen, "%s %s", class_name, method_name);
}
+ jio_snprintf(current_method, maxLen, "%s %s", class_name, method_name);
+
+ int last_compile_type = normal_compile;
if (CICountOSR && is_osr) {
- _last_compile_type = osr_compile;
- } else {
- _last_compile_type = normal_compile;
+ last_compile_type = normal_compile;
}
- _last_compile_level = comp_level;
- if (UsePerfData) {
- CompilerCounters* counters = thread->counters();
- counters->set_current_method(current_method);
- counters->set_compile_type((jlong)_last_compile_type);
- }
+ CompilerCounters* counters = thread->counters();
+ counters->set_current_method(current_method);
+ counters->set_compile_type((jlong) last_compile_type);
}
@@ -2417,23 +2404,6 @@ void CompileBroker::print_times() {
tty->print_cr(" nmethod total size : %6d bytes", CompileBroker::_sum_nmethod_size);
}
-// Debugging output for failure
-void CompileBroker::print_last_compile() {
- if ( _last_compile_level != CompLevel_none &&
- compiler(_last_compile_level) != NULL &&
- _last_method_compiled != NULL &&
- _last_compile_type != no_compile) {
- if (_last_compile_type == osr_compile) {
- tty->print_cr("Last parse: [osr]%d+++(%d) %s",
- _osr_compilation_id, _last_compile_level, _last_method_compiled);
- } else {
- tty->print_cr("Last parse: %d+++(%d) %s",
- _compilation_id, _last_compile_level, _last_method_compiled);
- }
- }
-}
-
-
void CompileBroker::print_compiler_threads_on(outputStream* st) {
#ifndef PRODUCT
st->print_cr("Compiler thread printing unimplemented.");
diff --git a/hotspot/src/share/vm/compiler/compileBroker.hpp b/hotspot/src/share/vm/compiler/compileBroker.hpp
index 16e0ba3..96d5e81 100644
--- a/hotspot/src/share/vm/compiler/compileBroker.hpp
+++ b/hotspot/src/share/vm/compiler/compileBroker.hpp
@@ -265,7 +265,7 @@ class CompileBroker: AllStatic {
name_buffer_length = 100
};
- // Compile type Information for print_last_compile() and CompilerCounters
+ // Compile type Information for CompilerCounters
enum { no_compile, normal_compile, osr_compile, native_compile };
static int assign_compile_id (methodHandle method, int osr_bci);
@@ -284,10 +284,6 @@ class CompileBroker: AllStatic {
static volatile jint _compilation_id;
static volatile jint _osr_compilation_id;
- static int _last_compile_type;
- static int _last_compile_level;
- static char _last_method_compiled[name_buffer_length];
-
static CompileQueue* _c2_compile_queue;
static CompileQueue* _c1_compile_queue;
@@ -356,7 +352,7 @@ class CompileBroker: AllStatic {
static void wait_for_completion(CompileTask* task);
static void invoke_compiler_on_method(CompileTask* task);
- static void set_last_compile(CompilerThread *thread, methodHandle method, bool is_osr, int comp_level);
+ static void update_compile_perf_data(CompilerThread *thread, const methodHandle& method, bool is_osr);
static void push_jni_handle_block();
static void pop_jni_handle_block();
static bool check_break_at(methodHandle method, int compile_id, bool is_osr);
@@ -454,9 +450,6 @@ class CompileBroker: AllStatic {
// Print a detailed accounting of compilation time
static void print_times();
- // Debugging output for failure
- static void print_last_compile();
-
static void print_compiler_threads_on(outputStream* st);
// compiler name for debugging
diff --git a/hotspot/src/share/vm/compiler/compileLog.cpp b/hotspot/src/share/vm/compiler/compileLog.cpp
index 0637fd0..7dd9b46 100644
--- a/hotspot/src/share/vm/compiler/compileLog.cpp
+++ b/hotspot/src/share/vm/compiler/compileLog.cpp
@@ -221,7 +221,8 @@ void CompileLog::finish_log_on_error(outputStream* file, char* buf, int buflen)
// Copy any remaining data inside a quote:
bool saw_slop = false;
int end_cdata = 0; // state machine [0..2] watching for too many "]]"
- while ((nr = read(partial_fd, buf, buflen)) > 0) {
+ while ((nr = read(partial_fd, buf, buflen-1)) > 0) {
+ buf[buflen-1] = '\0';
if (!saw_slop) {
file->print_raw_cr("<fragment>");
file->print_raw_cr("<![CDATA[");
diff --git a/hotspot/src/share/vm/compiler/disassembler.cpp b/hotspot/src/share/vm/compiler/disassembler.cpp
index dfdd5f7..063f86a 100644
--- a/hotspot/src/share/vm/compiler/disassembler.cpp
+++ b/hotspot/src/share/vm/compiler/disassembler.cpp
@@ -92,7 +92,7 @@ bool Disassembler::load_library() {
const char* p = strrchr(buf, *os::file_separator());
if (p != NULL) lib_offset = p - base + 1;
p = strstr(p ? p : base, "jvm");
- if (p != NULL) jvm_offset = p - base;
+ if (p != NULL) jvm_offset = p - base;
}
// Find the disassembler shared library.
// Search for several paths derived from libjvm, in this order:
@@ -105,13 +105,13 @@ bool Disassembler::load_library() {
strcpy(&buf[jvm_offset], hsdis_library_name);
strcat(&buf[jvm_offset], os::dll_file_extension());
_library = os::dll_load(buf, ebuf, sizeof ebuf);
- if (_library == NULL) {
+ if (_library == NULL && lib_offset >= 0) {
// 2. <home>/jre/lib/<arch>/<vm>/hsdis-<arch>.so
strcpy(&buf[lib_offset], hsdis_library_name);
strcat(&buf[lib_offset], os::dll_file_extension());
_library = os::dll_load(buf, ebuf, sizeof ebuf);
}
- if (_library == NULL) {
+ if (_library == NULL && lib_offset > 0) {
// 3. <home>/jre/lib/<arch>/hsdis-<arch>.so
buf[lib_offset - 1] = '\0';
const char* p = strrchr(buf, *os::file_separator());
diff --git a/hotspot/src/share/vm/oops/generateOopMap.cpp b/hotspot/src/share/vm/oops/generateOopMap.cpp
index bb951f8..8452f96 100644
--- a/hotspot/src/share/vm/oops/generateOopMap.cpp
+++ b/hotspot/src/share/vm/oops/generateOopMap.cpp
@@ -1684,7 +1684,13 @@ void GenerateOopMap::ppdupswap(int poplen, const char *out) {
assert(poplen < 5, "this must be less than length of actual vector");
// pop all arguments
- for(int i = 0; i < poplen; i++) actual[i] = pop();
+ for (int i = 0; i < poplen; i++) {
+ actual[i] = pop();
+ }
+ // Field _state is uninitialized when calling push.
+ for (int i = poplen; i < 5; i++) {
+ actual[i] = CellTypeState::uninit;
+ }
// put them back
char push_ch = *out++;
diff --git a/hotspot/src/share/vm/opto/block.cpp b/hotspot/src/share/vm/opto/block.cpp
index 245ce42..1789d49 100644
--- a/hotspot/src/share/vm/opto/block.cpp
+++ b/hotspot/src/share/vm/opto/block.cpp
@@ -1430,7 +1430,7 @@ void PhaseBlockLayout::find_edges() {
if (n->num_preds() != 1) break;
i++;
- assert(n = _cfg.get_block(i), "expecting next block");
+ assert(n == _cfg.get_block(i), "expecting next block");
tr->append(n);
uf->map(n->_pre_order, tr->id());
traces[n->_pre_order] = NULL;
diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp
index f7c1009..dfadd3e 100644
--- a/hotspot/src/share/vm/opto/graphKit.cpp
+++ b/hotspot/src/share/vm/opto/graphKit.cpp
@@ -1074,7 +1074,7 @@ bool GraphKit::compute_stack_effects(int& inputs, int& depth) {
case Bytecodes::_freturn:
case Bytecodes::_dreturn:
case Bytecodes::_areturn:
- assert(rsize = -depth, "");
+ assert(rsize == -depth, "");
inputs = rsize;
break;
diff --git a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp
index b26015c..11e11e0 100644
--- a/hotspot/src/share/vm/opto/matcher.cpp
+++ b/hotspot/src/share/vm/opto/matcher.cpp
@@ -659,11 +659,14 @@ void Matcher::Fixup_Save_On_Entry( ) {
uint reth_edge_cnt = TypeFunc::Parms+1;
RegMask *reth_rms = init_input_masks( reth_edge_cnt + soe_cnt, _return_addr_mask, c_frame_ptr_mask );
// Rethrow takes exception oop only, but in the argument 0 slot.
- reth_rms[TypeFunc::Parms] = mreg2regmask[find_receiver(false)];
+ OptoReg::Name reg = find_receiver(false);
+ if (reg >= 0) {
+ reth_rms[TypeFunc::Parms] = mreg2regmask[reg];
#ifdef _LP64
- // Need two slots for ptrs in 64-bit land
- reth_rms[TypeFunc::Parms].Insert(OptoReg::add(OptoReg::Name(find_receiver(false)),1));
+ // Need two slots for ptrs in 64-bit land
+ reth_rms[TypeFunc::Parms].Insert(OptoReg::add(OptoReg::Name(reg), 1));
#endif
+ }
// Input RegMask array shared by all TailCalls
uint tail_call_edge_cnt = TypeFunc::Parms+2;
diff --git a/hotspot/src/share/vm/runtime/relocator.cpp b/hotspot/src/share/vm/runtime/relocator.cpp
index 450bcf2..2bbb8db 100644
--- a/hotspot/src/share/vm/runtime/relocator.cpp
+++ b/hotspot/src/share/vm/runtime/relocator.cpp
@@ -612,8 +612,8 @@ bool Relocator::relocate_code(int bci, int ilen, int delta) {
// In case we have shrunken a tableswitch/lookupswitch statement, we store the last
// bytes that get overwritten. We have to copy the bytes after the change_jumps method
// has been called, since it is likly to update last offset in a tableswitch/lookupswitch
- if (delta < 0) {
- assert(delta>=-3, "we cannot overwrite more than 3 bytes");
+ assert(delta >= -3, "We cannot overwrite more than 3 bytes.");
+ if (delta < 0 && delta >= -3) {
memcpy(_overwrite, addr_at(bci + ilen + delta), -delta);
}
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fuowang/openjdk-1.8.0.git
git@gitee.com:fuowang/openjdk-1.8.0.git
fuowang
openjdk-1.8.0
openjdk-1.8.0
master

搜索帮助