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 "code/codeCache.hpp" |
32 #include "code/codeCache.hpp" |
27 #include "code/compiledIC.hpp" |
33 #include "code/compiledIC.hpp" |
1173 // first few bytes. If an oop in the old code was there, that oop |
1179 // first few bytes. If an oop in the old code was there, that oop |
1174 // should not get GC'd. Skip the first few bytes of oops on |
1180 // should not get GC'd. Skip the first few bytes of oops on |
1175 // not-entrant methods. |
1181 // not-entrant methods. |
1176 address low_boundary = verified_entry_point(); |
1182 address low_boundary = verified_entry_point(); |
1177 if (!is_in_use()) { |
1183 if (!is_in_use()) { |
1178 low_boundary += NativeJump::instruction_size; |
1184 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size; |
1179 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
1185 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
1180 // This means that the low_boundary is going to be a little too high. |
1186 // This means that the low_boundary is going to be a little too high. |
1181 // This shouldn't matter, since oops of non-entrant methods are never used. |
1187 // This shouldn't matter, since oops of non-entrant methods are never used. |
1182 // In fact, why are we bothering to look at oops in a non-entrant method?? |
1188 // In fact, why are we bothering to look at oops in a non-entrant method?? |
1183 } |
1189 } |
1221 // first few bytes. If an oop in the old code was there, that oop |
1227 // first few bytes. If an oop in the old code was there, that oop |
1222 // should not get GC'd. Skip the first few bytes of oops on |
1228 // should not get GC'd. Skip the first few bytes of oops on |
1223 // not-entrant methods. |
1229 // not-entrant methods. |
1224 address low_boundary = verified_entry_point(); |
1230 address low_boundary = verified_entry_point(); |
1225 if (!is_in_use()) { |
1231 if (!is_in_use()) { |
1226 low_boundary += NativeJump::instruction_size; |
1232 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size; |
1227 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
1233 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
1228 // This means that the low_boundary is going to be a little too high. |
1234 // This means that the low_boundary is going to be a little too high. |
1229 // This shouldn't matter, since oops of non-entrant methods are never used. |
1235 // This shouldn't matter, since oops of non-entrant methods are never used. |
1230 // In fact, why are we bothering to look at oops in a non-entrant method?? |
1236 // In fact, why are we bothering to look at oops in a non-entrant method?? |
1231 } |
1237 } |
1466 } |
1472 } |
1467 |
1473 |
1468 // The caller can be calling the method statically or through an inline |
1474 // The caller can be calling the method statically or through an inline |
1469 // cache call. |
1475 // cache call. |
1470 if (!is_osr_method() && !is_not_entrant()) { |
1476 if (!is_osr_method() && !is_not_entrant()) { |
1471 NativeJump::patch_verified_entry(entry_point(), verified_entry_point(), |
1477 NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::patch_verified_entry(entry_point(), verified_entry_point(), |
1472 SharedRuntime::get_handle_wrong_method_stub()); |
1478 SharedRuntime::get_handle_wrong_method_stub()); |
1473 } |
1479 } |
1474 |
1480 |
1475 if (is_in_use()) { |
1481 if (is_in_use()) { |
1476 // It's a true state change, so mark the method as decompiled. |
1482 // It's a true state change, so mark the method as decompiled. |
1793 // first few bytes. If an oop in the old code was there, that oop |
1799 // first few bytes. If an oop in the old code was there, that oop |
1794 // should not get GC'd. Skip the first few bytes of oops on |
1800 // should not get GC'd. Skip the first few bytes of oops on |
1795 // not-entrant methods. |
1801 // not-entrant methods. |
1796 address low_boundary = verified_entry_point(); |
1802 address low_boundary = verified_entry_point(); |
1797 if (is_not_entrant()) { |
1803 if (is_not_entrant()) { |
1798 low_boundary += NativeJump::instruction_size; |
1804 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size; |
1799 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
1805 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
1800 // (See comment above.) |
1806 // (See comment above.) |
1801 } |
1807 } |
1802 |
1808 |
1803 // The RedefineClasses() API can cause the class unloading invariant |
1809 // The RedefineClasses() API can cause the class unloading invariant |
1949 // first few bytes. If an oop in the old code was there, that oop |
1955 // first few bytes. If an oop in the old code was there, that oop |
1950 // should not get GC'd. Skip the first few bytes of oops on |
1956 // should not get GC'd. Skip the first few bytes of oops on |
1951 // not-entrant methods. |
1957 // not-entrant methods. |
1952 address low_boundary = verified_entry_point(); |
1958 address low_boundary = verified_entry_point(); |
1953 if (is_not_entrant()) { |
1959 if (is_not_entrant()) { |
1954 low_boundary += NativeJump::instruction_size; |
1960 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size; |
1955 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
1961 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
1956 // (See comment above.) |
1962 // (See comment above.) |
1957 } |
1963 } |
1958 |
1964 |
1959 // The RedefineClasses() API can cause the class unloading invariant |
1965 // The RedefineClasses() API can cause the class unloading invariant |
2052 // first few bytes. If an oop in the old code was there, that oop |
2058 // first few bytes. If an oop in the old code was there, that oop |
2053 // should not get GC'd. Skip the first few bytes of oops on |
2059 // should not get GC'd. Skip the first few bytes of oops on |
2054 // not-entrant methods. |
2060 // not-entrant methods. |
2055 address low_boundary = verified_entry_point(); |
2061 address low_boundary = verified_entry_point(); |
2056 if (is_not_entrant()) { |
2062 if (is_not_entrant()) { |
2057 low_boundary += NativeJump::instruction_size; |
2063 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size; |
2058 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
2064 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
2059 // (See comment above.) |
2065 // (See comment above.) |
2060 } |
2066 } |
2061 |
2067 |
2062 RelocIterator iter(this, low_boundary); |
2068 RelocIterator iter(this, low_boundary); |
2153 |
2159 |
2154 // Iterate over metadata calling this function. Used by RedefineClasses |
2160 // Iterate over metadata calling this function. Used by RedefineClasses |
2155 void nmethod::metadata_do(void f(Metadata*)) { |
2161 void nmethod::metadata_do(void f(Metadata*)) { |
2156 address low_boundary = verified_entry_point(); |
2162 address low_boundary = verified_entry_point(); |
2157 if (is_not_entrant()) { |
2163 if (is_not_entrant()) { |
2158 low_boundary += NativeJump::instruction_size; |
2164 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size; |
2159 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
2165 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
2160 // (See comment above.) |
2166 // (See comment above.) |
2161 } |
2167 } |
2162 { |
2168 { |
2163 // Visit all immediate references that are embedded in the instruction stream. |
2169 // Visit all immediate references that are embedded in the instruction stream. |
2212 // first few bytes. If an oop in the old code was there, that oop |
2218 // first few bytes. If an oop in the old code was there, that oop |
2213 // should not get GC'd. Skip the first few bytes of oops on |
2219 // should not get GC'd. Skip the first few bytes of oops on |
2214 // not-entrant methods. |
2220 // not-entrant methods. |
2215 address low_boundary = verified_entry_point(); |
2221 address low_boundary = verified_entry_point(); |
2216 if (is_not_entrant()) { |
2222 if (is_not_entrant()) { |
2217 low_boundary += NativeJump::instruction_size; |
2223 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size; |
2218 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
2224 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. |
2219 // (See comment above.) |
2225 // (See comment above.) |
2220 } |
2226 } |
2221 |
2227 |
2222 RelocIterator iter(this, low_boundary); |
2228 RelocIterator iter(this, low_boundary); |
2718 |
2724 |
2719 if (is_zombie() || is_not_entrant() || is_unloaded()) |
2725 if (is_zombie() || is_not_entrant() || is_unloaded()) |
2720 return; |
2726 return; |
2721 |
2727 |
2722 // Make sure all the entry points are correctly aligned for patching. |
2728 // Make sure all the entry points are correctly aligned for patching. |
2723 NativeJump::check_verified_entry_alignment(entry_point(), verified_entry_point()); |
2729 NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::check_verified_entry_alignment(entry_point(), verified_entry_point()); |
2724 |
2730 |
2725 // assert(method()->is_oop(), "must be valid"); |
2731 // assert(method()->is_oop(), "must be valid"); |
2726 |
2732 |
2727 ResourceMark rm; |
2733 ResourceMark rm; |
2728 |
2734 |