18 * |
18 * |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 * |
22 * |
|
23 */ |
|
24 |
|
25 /* |
|
26 * This file has been modified by Loongson Technology in 2015. These |
|
27 * modifications are Copyright (c) 2015 Loongson Technology, and are made |
|
28 * available on the same license terms set forth above. |
23 */ |
29 */ |
24 |
30 |
25 #include "precompiled.hpp" |
31 #include "precompiled.hpp" |
26 #include "asm/codeBuffer.hpp" |
32 #include "asm/codeBuffer.hpp" |
27 #include "c1/c1_CodeStubs.hpp" |
33 #include "c1/c1_CodeStubs.hpp" |
970 // instr byte n-1 |
976 // instr byte n-1 |
971 // n |
977 // n |
972 // .... <-- call destination |
978 // .... <-- call destination |
973 |
979 |
974 address stub_location = caller_frame.pc() + PatchingStub::patch_info_offset(); |
980 address stub_location = caller_frame.pc() + PatchingStub::patch_info_offset(); |
|
981 |
|
982 #if defined(MIPS32) && defined(_LP64) |
|
983 /* Jin: In MIPS64, byte_skip is much larger than that in X86. It can not be contained in a byte: |
|
984 * int bc = 0x20; |
|
985 * int bs = 0x190; |
|
986 * int bi = 0x1b0; |
|
987 * |
|
988 * To minimize the modification of share codes, the values are decreased 4 times when generated. |
|
989 * See [mips/c1_CodeStubs_mips.cpp 307] PatchingStub::emit_code(). |
|
990 */ |
|
991 int bc = *(unsigned char*) (stub_location - 1) * 4; |
|
992 int bs = *(unsigned char*) (stub_location - 2) * 4; |
|
993 int bi = *(unsigned char*) (stub_location - 3) * 4; |
|
994 |
|
995 int *byte_count = &bc; |
|
996 int *byte_skip = &bs; |
|
997 int *being_initialized_entry_offset = &bi; |
|
998 #else |
975 unsigned char* byte_count = (unsigned char*) (stub_location - 1); |
999 unsigned char* byte_count = (unsigned char*) (stub_location - 1); |
976 unsigned char* byte_skip = (unsigned char*) (stub_location - 2); |
1000 unsigned char* byte_skip = (unsigned char*) (stub_location - 2); |
977 unsigned char* being_initialized_entry_offset = (unsigned char*) (stub_location - 3); |
1001 unsigned char* being_initialized_entry_offset = (unsigned char*) (stub_location - 3); |
|
1002 #endif |
978 address copy_buff = stub_location - *byte_skip - *byte_count; |
1003 address copy_buff = stub_location - *byte_skip - *byte_count; |
979 address being_initialized_entry = stub_location - *being_initialized_entry_offset; |
1004 address being_initialized_entry = stub_location - *being_initialized_entry_offset; |
|
1005 |
980 if (TracePatching) { |
1006 if (TracePatching) { |
981 tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT " (%s)", Bytecodes::name(code), bci, |
1007 tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT " (%s)", Bytecodes::name(code), bci, |
982 p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass"); |
1008 p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass"); |
983 nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc()); |
1009 nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc()); |
984 assert(caller_code != NULL, "nmethod not found"); |
1010 assert(caller_code != NULL, "nmethod not found"); |