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