15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
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
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHFORWARDING_INLINE_HPP
26 #define SHARE_GC_SHENANDOAH_SHENANDOAHFORWARDING_INLINE_HPP
27
28 #include "gc/shenandoah/shenandoahForwarding.hpp"
29
30 #include "gc/shenandoah/shenandoahAsserts.hpp"
31 #include "oops/markWord.hpp"
32 #include "runtime/javaThread.hpp"
33
34 inline oop ShenandoahForwarding::get_forwardee_raw(oop obj) {
35 shenandoah_assert_in_heap(nullptr, obj);
36 return get_forwardee_raw_unchecked(obj);
37 }
38
39 inline oop ShenandoahForwarding::get_forwardee_raw_unchecked(oop obj) {
40 // JVMTI and JFR code use mark words for marking objects for their needs.
41 // On this path, we can encounter the "marked" object, but with null
42 // fwdptr. That object is still not forwarded, and we need to return
43 // the object itself.
44 markWord mark = obj->mark();
45 if (mark.is_marked()) {
46 HeapWord* fwdptr = (HeapWord*) mark.clear_lock_bits().to_pointer();
47 if (fwdptr != nullptr) {
48 return cast_to_oop(fwdptr);
49 }
50 }
51 return obj;
52 }
53
54 inline oop ShenandoahForwarding::get_forwardee_mutator(oop obj) {
55 // Same as above, but mutator thread cannot ever see null forwardee.
|
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
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
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHFORWARDING_INLINE_HPP
26 #define SHARE_GC_SHENANDOAH_SHENANDOAHFORWARDING_INLINE_HPP
27
28 #include "gc/shenandoah/shenandoahForwarding.hpp"
29
30 #include "gc/shenandoah/shenandoahAsserts.hpp"
31 #include "oops/markWord.hpp"
32 #include "runtime/javaThread.hpp"
33
34 inline oop ShenandoahForwarding::get_forwardee_raw(oop obj) {
35 shenandoah_assert_in_heap_bounds(nullptr, obj);
36 return get_forwardee_raw_unchecked(obj);
37 }
38
39 inline oop ShenandoahForwarding::get_forwardee_raw_unchecked(oop obj) {
40 // JVMTI and JFR code use mark words for marking objects for their needs.
41 // On this path, we can encounter the "marked" object, but with null
42 // fwdptr. That object is still not forwarded, and we need to return
43 // the object itself.
44 markWord mark = obj->mark();
45 if (mark.is_marked()) {
46 HeapWord* fwdptr = (HeapWord*) mark.clear_lock_bits().to_pointer();
47 if (fwdptr != nullptr) {
48 return cast_to_oop(fwdptr);
49 }
50 }
51 return obj;
52 }
53
54 inline oop ShenandoahForwarding::get_forwardee_mutator(oop obj) {
55 // Same as above, but mutator thread cannot ever see null forwardee.
|