1 /* |
1 /* |
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
992 if (FreeChunk::indicatesFreeChunk(p)) { |
992 if (FreeChunk::indicatesFreeChunk(p)) { |
993 assert(res != 0, "Block size should not be 0"); |
993 assert(res != 0, "Block size should not be 0"); |
994 return res; |
994 return res; |
995 } |
995 } |
996 } else { |
996 } else { |
|
997 // The barrier is required to prevent reordering of the free chunk check |
|
998 // and the klass read. |
|
999 OrderAccess::loadload(); |
|
1000 |
997 // must read from what 'p' points to in each loop. |
1001 // must read from what 'p' points to in each loop. |
998 Klass* k = ((volatile oopDesc*)p)->klass_or_null(); |
1002 Klass* k = ((volatile oopDesc*)p)->klass_or_null(); |
999 if (k != NULL) { |
1003 if (k != NULL) { |
1000 assert(k->is_klass(), "Should really be klass oop."); |
1004 assert(k->is_klass(), "Should really be klass oop."); |
1001 oop o = (oop)p; |
1005 oop o = (oop)p; |
1047 assert(res != 0, "Block size should not be 0"); |
1051 assert(res != 0, "Block size should not be 0"); |
1048 assert(loops == 0, "Should be 0"); |
1052 assert(loops == 0, "Should be 0"); |
1049 return res; |
1053 return res; |
1050 } |
1054 } |
1051 } else { |
1055 } else { |
|
1056 // The barrier is required to prevent reordering of the free chunk check |
|
1057 // and the klass read. |
|
1058 OrderAccess::loadload(); |
|
1059 |
1052 // must read from what 'p' points to in each loop. |
1060 // must read from what 'p' points to in each loop. |
1053 Klass* k = ((volatile oopDesc*)p)->klass_or_null(); |
1061 Klass* k = ((volatile oopDesc*)p)->klass_or_null(); |
1054 // We trust the size of any object that has a non-NULL |
1062 // We trust the size of any object that has a non-NULL |
1055 // klass and (for those in the perm gen) is parsable |
1063 // klass and (for those in the perm gen) is parsable |
1056 // -- irrespective of its conc_safe-ty. |
1064 // -- irrespective of its conc_safe-ty. |
1109 // and those objects (if garbage) may have been modified to hold |
1117 // and those objects (if garbage) may have been modified to hold |
1110 // live range information. |
1118 // live range information. |
1111 // assert(CollectedHeap::use_parallel_gc_threads() || _bt.block_start(p) == p, |
1119 // assert(CollectedHeap::use_parallel_gc_threads() || _bt.block_start(p) == p, |
1112 // "Should be a block boundary"); |
1120 // "Should be a block boundary"); |
1113 if (FreeChunk::indicatesFreeChunk(p)) return false; |
1121 if (FreeChunk::indicatesFreeChunk(p)) return false; |
|
1122 |
|
1123 // The barrier is required to prevent reordering of the free chunk check |
|
1124 // and the klass read. |
|
1125 OrderAccess::loadload(); |
|
1126 |
1114 Klass* k = oop(p)->klass_or_null(); |
1127 Klass* k = oop(p)->klass_or_null(); |
1115 if (k != NULL) { |
1128 if (k != NULL) { |
1116 // Ignore mark word because it may have been used to |
1129 // Ignore mark word because it may have been used to |
1117 // chain together promoted objects (the last one |
1130 // chain together promoted objects (the last one |
1118 // would have a null value). |
1131 // would have a null value). |