src/share/vm/code/nmethod.cpp

changeset 9041
95a08233f46c
parent 8997
f8a45a60bc6b
parent 8856
ac27a9c85bea
child 9203
53eec13fbaa5
equal deleted inserted replaced
9040:69aec2ca5d90 9041:95a08233f46c
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.
1792 // first few bytes. If an oop in the old code was there, that oop 1798 // first few bytes. If an oop in the old code was there, that oop
1793 // should not get GC'd. Skip the first few bytes of oops on 1799 // should not get GC'd. Skip the first few bytes of oops on
1794 // not-entrant methods. 1800 // not-entrant methods.
1795 address low_boundary = verified_entry_point(); 1801 address low_boundary = verified_entry_point();
1796 if (is_not_entrant()) { 1802 if (is_not_entrant()) {
1797 low_boundary += NativeJump::instruction_size; 1803 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size;
1798 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. 1804 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump.
1799 // (See comment above.) 1805 // (See comment above.)
1800 } 1806 }
1801 1807
1802 // The RedefineClasses() API can cause the class unloading invariant 1808 // The RedefineClasses() API can cause the class unloading invariant
1948 // first few bytes. If an oop in the old code was there, that oop 1954 // first few bytes. If an oop in the old code was there, that oop
1949 // should not get GC'd. Skip the first few bytes of oops on 1955 // should not get GC'd. Skip the first few bytes of oops on
1950 // not-entrant methods. 1956 // not-entrant methods.
1951 address low_boundary = verified_entry_point(); 1957 address low_boundary = verified_entry_point();
1952 if (is_not_entrant()) { 1958 if (is_not_entrant()) {
1953 low_boundary += NativeJump::instruction_size; 1959 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size;
1954 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. 1960 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump.
1955 // (See comment above.) 1961 // (See comment above.)
1956 } 1962 }
1957 1963
1958 // The RedefineClasses() API can cause the class unloading invariant 1964 // The RedefineClasses() API can cause the class unloading invariant
2051 // first few bytes. If an oop in the old code was there, that oop 2057 // first few bytes. If an oop in the old code was there, that oop
2052 // should not get GC'd. Skip the first few bytes of oops on 2058 // should not get GC'd. Skip the first few bytes of oops on
2053 // not-entrant methods. 2059 // not-entrant methods.
2054 address low_boundary = verified_entry_point(); 2060 address low_boundary = verified_entry_point();
2055 if (is_not_entrant()) { 2061 if (is_not_entrant()) {
2056 low_boundary += NativeJump::instruction_size; 2062 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size;
2057 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. 2063 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump.
2058 // (See comment above.) 2064 // (See comment above.)
2059 } 2065 }
2060 2066
2061 RelocIterator iter(this, low_boundary); 2067 RelocIterator iter(this, low_boundary);
2152 2158
2153 // Iterate over metadata calling this function. Used by RedefineClasses 2159 // Iterate over metadata calling this function. Used by RedefineClasses
2154 void nmethod::metadata_do(void f(Metadata*)) { 2160 void nmethod::metadata_do(void f(Metadata*)) {
2155 address low_boundary = verified_entry_point(); 2161 address low_boundary = verified_entry_point();
2156 if (is_not_entrant()) { 2162 if (is_not_entrant()) {
2157 low_boundary += NativeJump::instruction_size; 2163 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size;
2158 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. 2164 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump.
2159 // (See comment above.) 2165 // (See comment above.)
2160 } 2166 }
2161 { 2167 {
2162 // Visit all immediate references that are embedded in the instruction stream. 2168 // Visit all immediate references that are embedded in the instruction stream.
2211 // first few bytes. If an oop in the old code was there, that oop 2217 // first few bytes. If an oop in the old code was there, that oop
2212 // should not get GC'd. Skip the first few bytes of oops on 2218 // should not get GC'd. Skip the first few bytes of oops on
2213 // not-entrant methods. 2219 // not-entrant methods.
2214 address low_boundary = verified_entry_point(); 2220 address low_boundary = verified_entry_point();
2215 if (is_not_entrant()) { 2221 if (is_not_entrant()) {
2216 low_boundary += NativeJump::instruction_size; 2222 low_boundary += NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::instruction_size;
2217 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. 2223 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump.
2218 // (See comment above.) 2224 // (See comment above.)
2219 } 2225 }
2220 2226
2221 RelocIterator iter(this, low_boundary); 2227 RelocIterator iter(this, low_boundary);
2717 2723
2718 if (is_zombie() || is_not_entrant() || is_unloaded()) 2724 if (is_zombie() || is_not_entrant() || is_unloaded())
2719 return; 2725 return;
2720 2726
2721 // Make sure all the entry points are correctly aligned for patching. 2727 // Make sure all the entry points are correctly aligned for patching.
2722 NativeJump::check_verified_entry_alignment(entry_point(), verified_entry_point()); 2728 NOT_MIPS64(NativeJump)MIPS64_ONLY(NativeGeneralJump)::check_verified_entry_alignment(entry_point(), verified_entry_point());
2723 2729
2724 // assert(method()->is_oop(), "must be valid"); 2730 // assert(method()->is_oop(), "must be valid");
2725 2731
2726 ResourceMark rm; 2732 ResourceMark rm;
2727 2733

mercurial