diff -r e6aa4a8c1b46 -r 7ae4e26cb1e0 src/share/vm/c1/c1_Runtime1.cpp --- a/src/share/vm/c1/c1_Runtime1.cpp Mon Mar 16 11:49:32 2015 -0700 +++ b/src/share/vm/c1/c1_Runtime1.cpp Thu Oct 12 21:27:07 2017 +0800 @@ -22,6 +22,12 @@ * */ +/* + * This file has been modified by Loongson Technology in 2015. These + * modifications are Copyright (c) 2015 Loongson Technology, and are made + * available on the same license terms set forth above. + */ + #include "precompiled.hpp" #include "asm/codeBuffer.hpp" #include "c1/c1_CodeStubs.hpp" @@ -969,11 +975,31 @@ // .... <-- call destination address stub_location = caller_frame.pc() + PatchingStub::patch_info_offset(); + +#if defined(MIPS32) && defined(_LP64) +/* Jin: In MIPS64, byte_skip is much larger than that in X86. It can not be contained in a byte: + * int bc = 0x20; + * int bs = 0x190; + * int bi = 0x1b0; + * + * To minimize the modification of share codes, the values are decreased 4 times when generated. + * See [mips/c1_CodeStubs_mips.cpp 307] PatchingStub::emit_code(). + */ + int bc = *(unsigned char*) (stub_location - 1) * 4; + int bs = *(unsigned char*) (stub_location - 2) * 4; + int bi = *(unsigned char*) (stub_location - 3) * 4; + + int *byte_count = &bc; + int *byte_skip = &bs; + int *being_initialized_entry_offset = &bi; +#else unsigned char* byte_count = (unsigned char*) (stub_location - 1); unsigned char* byte_skip = (unsigned char*) (stub_location - 2); unsigned char* being_initialized_entry_offset = (unsigned char*) (stub_location - 3); +#endif address copy_buff = stub_location - *byte_skip - *byte_count; address being_initialized_entry = stub_location - *being_initialized_entry_offset; + if (TracePatching) { tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT " (%s)", Bytecodes::name(code), bci, p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass");