1 /*
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
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 *
645 return (oop) mark()->decode_pointer();
646 }
647
648 // The following method needs to be MT safe.
649 uint oopDesc::age() const {
650 assert(!is_forwarded(), "Attempt to read age from forwarded mark");
651 if (has_displaced_mark()) {
652 return displaced_mark()->age();
653 } else {
654 return mark()->age();
655 }
656 }
657
658 void oopDesc::incr_age() {
659 assert(!is_forwarded(), "Attempt to increment age of forwarded mark");
660 if (has_displaced_mark()) {
661 set_displaced_mark(displaced_mark()->incr_age());
662 } else {
663 set_mark(mark()->incr_age());
664 }
665 }
666
667 int oopDesc::ms_adjust_pointers() {
668 debug_only(int check_size = size());
669 int s = klass()->oop_ms_adjust_pointers(this);
670 assert(s == check_size, "should be the same");
671 return s;
672 }
673
674 #if INCLUDE_ALL_GCS
675 void oopDesc::pc_follow_contents(ParCompactionManager* cm) {
676 klass()->oop_pc_follow_contents(this, cm);
677 }
678
679 void oopDesc::pc_update_contents(ParCompactionManager* cm) {
680 Klass* k = klass();
681 if (!k->is_typeArray_klass()) {
682 // It might contain oops beyond the header, so take the virtual call.
683 k->oop_pc_update_pointers(this, cm);
684 }
685 // Else skip it. The TypeArrayKlass in the header never needs scavenging.
686 }
687
688 void oopDesc::ps_push_contents(PSPromotionManager* pm) {
689 Klass* k = klass();
690 if (!k->is_typeArray_klass()) {
691 // It might contain oops beyond the header, so take the virtual call.
|
1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
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 *
645 return (oop) mark()->decode_pointer();
646 }
647
648 // The following method needs to be MT safe.
649 uint oopDesc::age() const {
650 assert(!is_forwarded(), "Attempt to read age from forwarded mark");
651 if (has_displaced_mark()) {
652 return displaced_mark()->age();
653 } else {
654 return mark()->age();
655 }
656 }
657
658 void oopDesc::incr_age() {
659 assert(!is_forwarded(), "Attempt to increment age of forwarded mark");
660 if (has_displaced_mark()) {
661 set_displaced_mark(displaced_mark()->incr_age());
662 } else {
663 set_mark(mark()->incr_age());
664 }
665 }
666
667 #if INCLUDE_ALL_GCS
668 void oopDesc::pc_follow_contents(ParCompactionManager* cm) {
669 klass()->oop_pc_follow_contents(this, cm);
670 }
671
672 void oopDesc::pc_update_contents(ParCompactionManager* cm) {
673 Klass* k = klass();
674 if (!k->is_typeArray_klass()) {
675 // It might contain oops beyond the header, so take the virtual call.
676 k->oop_pc_update_pointers(this, cm);
677 }
678 // Else skip it. The TypeArrayKlass in the header never needs scavenging.
679 }
680
681 void oopDesc::ps_push_contents(PSPromotionManager* pm) {
682 Klass* k = klass();
683 if (!k->is_typeArray_klass()) {
684 // It might contain oops beyond the header, so take the virtual call.
|