src/share/vm/code/nmethod.cpp

changeset 8604
04d83ba48607
parent 8185
5cece4584b8e
parent 7535
7ae4e26cb1e0
child 8856
ac27a9c85bea
equal deleted inserted replaced
8603:e134dc1879b7 8604:04d83ba48607
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"
1168 // first few bytes. If an oop in the old code was there, that oop 1174 // first few bytes. If an oop in the old code was there, that oop
1169 // should not get GC'd. Skip the first few bytes of oops on 1175 // should not get GC'd. Skip the first few bytes of oops on
1170 // not-entrant methods. 1176 // not-entrant methods.
1171 address low_boundary = verified_entry_point(); 1177 address low_boundary = verified_entry_point();
1172 if (!is_in_use()) { 1178 if (!is_in_use()) {
1173 low_boundary += NativeJump::instruction_size; 1179 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size;
1174 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. 1180 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump.
1175 // This means that the low_boundary is going to be a little too high. 1181 // This means that the low_boundary is going to be a little too high.
1176 // This shouldn't matter, since oops of non-entrant methods are never used. 1182 // This shouldn't matter, since oops of non-entrant methods are never used.
1177 // In fact, why are we bothering to look at oops in a non-entrant method?? 1183 // In fact, why are we bothering to look at oops in a non-entrant method??
1178 } 1184 }
1216 // first few bytes. If an oop in the old code was there, that oop 1222 // first few bytes. If an oop in the old code was there, that oop
1217 // should not get GC'd. Skip the first few bytes of oops on 1223 // should not get GC'd. Skip the first few bytes of oops on
1218 // not-entrant methods. 1224 // not-entrant methods.
1219 address low_boundary = verified_entry_point(); 1225 address low_boundary = verified_entry_point();
1220 if (!is_in_use()) { 1226 if (!is_in_use()) {
1221 low_boundary += NativeJump::instruction_size; 1227 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size;
1222 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. 1228 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump.
1223 // This means that the low_boundary is going to be a little too high. 1229 // This means that the low_boundary is going to be a little too high.
1224 // This shouldn't matter, since oops of non-entrant methods are never used. 1230 // This shouldn't matter, since oops of non-entrant methods are never used.
1225 // In fact, why are we bothering to look at oops in a non-entrant method?? 1231 // In fact, why are we bothering to look at oops in a non-entrant method??
1226 } 1232 }
1461 } 1467 }
1462 1468
1463 // The caller can be calling the method statically or through an inline 1469 // The caller can be calling the method statically or through an inline
1464 // cache call. 1470 // cache call.
1465 if (!is_osr_method() && !is_not_entrant()) { 1471 if (!is_osr_method() && !is_not_entrant()) {
1466 NativeJump::patch_verified_entry(entry_point(), verified_entry_point(), 1472 NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::patch_verified_entry(entry_point(), verified_entry_point(),
1467 SharedRuntime::get_handle_wrong_method_stub()); 1473 SharedRuntime::get_handle_wrong_method_stub());
1468 } 1474 }
1469 1475
1470 if (is_in_use()) { 1476 if (is_in_use()) {
1471 // It's a true state change, so mark the method as decompiled. 1477 // It's a true state change, so mark the method as decompiled.
1788 // first few bytes. If an oop in the old code was there, that oop 1794 // first few bytes. If an oop in the old code was there, that oop
1789 // should not get GC'd. Skip the first few bytes of oops on 1795 // should not get GC'd. Skip the first few bytes of oops on
1790 // not-entrant methods. 1796 // not-entrant methods.
1791 address low_boundary = verified_entry_point(); 1797 address low_boundary = verified_entry_point();
1792 if (is_not_entrant()) { 1798 if (is_not_entrant()) {
1793 low_boundary += NativeJump::instruction_size; 1799 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size;
1794 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. 1800 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump.
1795 // (See comment above.) 1801 // (See comment above.)
1796 } 1802 }
1797 1803
1798 // The RedefineClasses() API can cause the class unloading invariant 1804 // The RedefineClasses() API can cause the class unloading invariant
1944 // first few bytes. If an oop in the old code was there, that oop 1950 // first few bytes. If an oop in the old code was there, that oop
1945 // should not get GC'd. Skip the first few bytes of oops on 1951 // should not get GC'd. Skip the first few bytes of oops on
1946 // not-entrant methods. 1952 // not-entrant methods.
1947 address low_boundary = verified_entry_point(); 1953 address low_boundary = verified_entry_point();
1948 if (is_not_entrant()) { 1954 if (is_not_entrant()) {
1949 low_boundary += NativeJump::instruction_size; 1955 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size;
1950 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. 1956 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump.
1951 // (See comment above.) 1957 // (See comment above.)
1952 } 1958 }
1953 1959
1954 // The RedefineClasses() API can cause the class unloading invariant 1960 // The RedefineClasses() API can cause the class unloading invariant
2047 // first few bytes. If an oop in the old code was there, that oop 2053 // first few bytes. If an oop in the old code was there, that oop
2048 // should not get GC'd. Skip the first few bytes of oops on 2054 // should not get GC'd. Skip the first few bytes of oops on
2049 // not-entrant methods. 2055 // not-entrant methods.
2050 address low_boundary = verified_entry_point(); 2056 address low_boundary = verified_entry_point();
2051 if (is_not_entrant()) { 2057 if (is_not_entrant()) {
2052 low_boundary += NativeJump::instruction_size; 2058 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size;
2053 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. 2059 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump.
2054 // (See comment above.) 2060 // (See comment above.)
2055 } 2061 }
2056 2062
2057 RelocIterator iter(this, low_boundary); 2063 RelocIterator iter(this, low_boundary);
2148 2154
2149 // Iterate over metadata calling this function. Used by RedefineClasses 2155 // Iterate over metadata calling this function. Used by RedefineClasses
2150 void nmethod::metadata_do(void f(Metadata*)) { 2156 void nmethod::metadata_do(void f(Metadata*)) {
2151 address low_boundary = verified_entry_point(); 2157 address low_boundary = verified_entry_point();
2152 if (is_not_entrant()) { 2158 if (is_not_entrant()) {
2153 low_boundary += NativeJump::instruction_size; 2159 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size;
2154 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. 2160 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump.
2155 // (See comment above.) 2161 // (See comment above.)
2156 } 2162 }
2157 { 2163 {
2158 // Visit all immediate references that are embedded in the instruction stream. 2164 // Visit all immediate references that are embedded in the instruction stream.
2207 // first few bytes. If an oop in the old code was there, that oop 2213 // first few bytes. If an oop in the old code was there, that oop
2208 // should not get GC'd. Skip the first few bytes of oops on 2214 // should not get GC'd. Skip the first few bytes of oops on
2209 // not-entrant methods. 2215 // not-entrant methods.
2210 address low_boundary = verified_entry_point(); 2216 address low_boundary = verified_entry_point();
2211 if (is_not_entrant()) { 2217 if (is_not_entrant()) {
2212 low_boundary += NativeJump::instruction_size; 2218 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size;
2213 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. 2219 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump.
2214 // (See comment above.) 2220 // (See comment above.)
2215 } 2221 }
2216 2222
2217 RelocIterator iter(this, low_boundary); 2223 RelocIterator iter(this, low_boundary);
2713 2719
2714 if (is_zombie() || is_not_entrant() || is_unloaded()) 2720 if (is_zombie() || is_not_entrant() || is_unloaded())
2715 return; 2721 return;
2716 2722
2717 // Make sure all the entry points are correctly aligned for patching. 2723 // Make sure all the entry points are correctly aligned for patching.
2718 NativeJump::check_verified_entry_alignment(entry_point(), verified_entry_point()); 2724 NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::check_verified_entry_alignment(entry_point(), verified_entry_point());
2719 2725
2720 // assert(method()->is_oop(), "must be valid"); 2726 // assert(method()->is_oop(), "must be valid");
2721 2727
2722 ResourceMark rm; 2728 ResourceMark rm;
2723 2729

mercurial