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" |
967 // instr byte n-1 |
973 // instr byte n-1 |
968 // n |
974 // n |
969 // .... <-- call destination |
975 // .... <-- call destination |
970 |
976 |
971 address stub_location = caller_frame.pc() + PatchingStub::patch_info_offset(); |
977 address stub_location = caller_frame.pc() + PatchingStub::patch_info_offset(); |
|
978 |
|
979 #if defined(MIPS32) && defined(_LP64) |
|
980 /* Jin: In MIPS64, byte_skip is much larger than that in X86. It can not be contained in a byte: |
|
981 * int bc = 0x20; |
|
982 * int bs = 0x190; |
|
983 * int bi = 0x1b0; |
|
984 * |
|
985 * To minimize the modification of share codes, the values are decreased 4 times when generated. |
|
986 * See [mips/c1_CodeStubs_mips.cpp 307] PatchingStub::emit_code(). |
|
987 */ |
|
988 int bc = *(unsigned char*) (stub_location - 1) * 4; |
|
989 int bs = *(unsigned char*) (stub_location - 2) * 4; |
|
990 int bi = *(unsigned char*) (stub_location - 3) * 4; |
|
991 |
|
992 int *byte_count = &bc; |
|
993 int *byte_skip = &bs; |
|
994 int *being_initialized_entry_offset = &bi; |
|
995 #else |
972 unsigned char* byte_count = (unsigned char*) (stub_location - 1); |
996 unsigned char* byte_count = (unsigned char*) (stub_location - 1); |
973 unsigned char* byte_skip = (unsigned char*) (stub_location - 2); |
997 unsigned char* byte_skip = (unsigned char*) (stub_location - 2); |
974 unsigned char* being_initialized_entry_offset = (unsigned char*) (stub_location - 3); |
998 unsigned char* being_initialized_entry_offset = (unsigned char*) (stub_location - 3); |
|
999 #endif |
975 address copy_buff = stub_location - *byte_skip - *byte_count; |
1000 address copy_buff = stub_location - *byte_skip - *byte_count; |
976 address being_initialized_entry = stub_location - *being_initialized_entry_offset; |
1001 address being_initialized_entry = stub_location - *being_initialized_entry_offset; |
|
1002 |
977 if (TracePatching) { |
1003 if (TracePatching) { |
978 tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT " (%s)", Bytecodes::name(code), bci, |
1004 tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT " (%s)", Bytecodes::name(code), bci, |
979 p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass"); |
1005 p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass"); |
980 nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc()); |
1006 nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc()); |
981 assert(caller_code != NULL, "nmethod not found"); |
1007 assert(caller_code != NULL, "nmethod not found"); |