Mercurial > hg > graal-jvmci-8
comparison src/share/vm/oops/markOop.inline.hpp @ 2044:06f017f7daa7
Merge.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Fri, 07 Jan 2011 18:18:08 +0100 |
parents | 74ee0db180fa |
children | da91efe96a93 |
comparison
equal
deleted
inserted
replaced
1942:00bc9eaf0e24 | 2044:06f017f7daa7 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2006, 2010, 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. |
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 */ | 23 */ |
24 | 24 |
25 // Should this header be preserved during GC? | 25 #ifndef SHARE_VM_OOPS_MARKOOP_INLINE_HPP |
26 #define SHARE_VM_OOPS_MARKOOP_INLINE_HPP | |
27 | |
28 #include "oops/klass.hpp" | |
29 #include "oops/klassOop.hpp" | |
30 #include "oops/markOop.hpp" | |
31 #include "runtime/globals.hpp" | |
32 | |
33 // Should this header be preserved during GC (when biased locking is enabled)? | |
26 inline bool markOopDesc::must_be_preserved_with_bias(oop obj_containing_mark) const { | 34 inline bool markOopDesc::must_be_preserved_with_bias(oop obj_containing_mark) const { |
27 assert(UseBiasedLocking, "unexpected"); | 35 assert(UseBiasedLocking, "unexpected"); |
28 if (has_bias_pattern()) { | 36 if (has_bias_pattern()) { |
29 // Will reset bias at end of collection | 37 // Will reset bias at end of collection |
30 // Mark words of biased and currently locked objects are preserved separately | 38 // Mark words of biased and currently locked objects are preserved separately |
37 return true; | 45 return true; |
38 } | 46 } |
39 return (!is_unlocked() || !has_no_hash()); | 47 return (!is_unlocked() || !has_no_hash()); |
40 } | 48 } |
41 | 49 |
50 // Should this header be preserved during GC? | |
42 inline bool markOopDesc::must_be_preserved(oop obj_containing_mark) const { | 51 inline bool markOopDesc::must_be_preserved(oop obj_containing_mark) const { |
43 if (!UseBiasedLocking) | 52 if (!UseBiasedLocking) |
44 return (!is_unlocked() || !has_no_hash()); | 53 return (!is_unlocked() || !has_no_hash()); |
45 return must_be_preserved_with_bias(obj_containing_mark); | 54 return must_be_preserved_with_bias(obj_containing_mark); |
46 } | 55 } |
47 | 56 |
48 // Should this header (including its age bits) be preserved in the | 57 // Should this header be preserved in the case of a promotion failure |
49 // case of a promotion failure during scavenge? | 58 // during scavenge (when biased locking is enabled)? |
50 inline bool markOopDesc::must_be_preserved_with_bias_for_promotion_failure(oop obj_containing_mark) const { | 59 inline bool markOopDesc::must_be_preserved_with_bias_for_promotion_failure(oop obj_containing_mark) const { |
51 assert(UseBiasedLocking, "unexpected"); | 60 assert(UseBiasedLocking, "unexpected"); |
52 // We don't explicitly save off the mark words of biased and | 61 // We don't explicitly save off the mark words of biased and |
53 // currently-locked objects during scavenges, so if during a | 62 // currently-locked objects during scavenges, so if during a |
54 // promotion failure we encounter either a biased mark word or a | 63 // promotion failure we encounter either a biased mark word or a |
60 // of a scavenge when a promotion failure has first been detected. | 69 // of a scavenge when a promotion failure has first been detected. |
61 if (has_bias_pattern() || | 70 if (has_bias_pattern() || |
62 prototype_for_object(obj_containing_mark)->has_bias_pattern()) { | 71 prototype_for_object(obj_containing_mark)->has_bias_pattern()) { |
63 return true; | 72 return true; |
64 } | 73 } |
65 return (this != prototype()); | 74 return (!is_unlocked() || !has_no_hash()); |
66 } | 75 } |
67 | 76 |
77 // Should this header be preserved in the case of a promotion failure | |
78 // during scavenge? | |
68 inline bool markOopDesc::must_be_preserved_for_promotion_failure(oop obj_containing_mark) const { | 79 inline bool markOopDesc::must_be_preserved_for_promotion_failure(oop obj_containing_mark) const { |
69 if (!UseBiasedLocking) | 80 if (!UseBiasedLocking) |
70 return (this != prototype()); | 81 return (!is_unlocked() || !has_no_hash()); |
71 return must_be_preserved_with_bias_for_promotion_failure(obj_containing_mark); | 82 return must_be_preserved_with_bias_for_promotion_failure(obj_containing_mark); |
72 } | 83 } |
73 | 84 |
74 | 85 |
75 // Should this header (including its age bits) be preserved in the | 86 // Same as must_be_preserved_with_bias_for_promotion_failure() except that |
76 // case of a scavenge in which CMS is the old generation? | 87 // it takes a klassOop argument, instead of the object of which this is the mark word. |
77 inline bool markOopDesc::must_be_preserved_with_bias_for_cms_scavenge(klassOop klass_of_obj_containing_mark) const { | 88 inline bool markOopDesc::must_be_preserved_with_bias_for_cms_scavenge(klassOop klass_of_obj_containing_mark) const { |
78 assert(UseBiasedLocking, "unexpected"); | 89 assert(UseBiasedLocking, "unexpected"); |
79 // CMS scavenges preserve mark words in similar fashion to promotion failures; see above | 90 // CMS scavenges preserve mark words in similar fashion to promotion failures; see above |
80 if (has_bias_pattern() || | 91 if (has_bias_pattern() || |
81 klass_of_obj_containing_mark->klass_part()->prototype_header()->has_bias_pattern()) { | 92 klass_of_obj_containing_mark->klass_part()->prototype_header()->has_bias_pattern()) { |
82 return true; | 93 return true; |
83 } | 94 } |
84 return (this != prototype()); | 95 return (!is_unlocked() || !has_no_hash()); |
85 } | 96 } |
97 | |
98 // Same as must_be_preserved_for_promotion_failure() except that | |
99 // it takes a klassOop argument, instead of the object of which this is the mark word. | |
86 inline bool markOopDesc::must_be_preserved_for_cms_scavenge(klassOop klass_of_obj_containing_mark) const { | 100 inline bool markOopDesc::must_be_preserved_for_cms_scavenge(klassOop klass_of_obj_containing_mark) const { |
87 if (!UseBiasedLocking) | 101 if (!UseBiasedLocking) |
88 return (this != prototype()); | 102 return (!is_unlocked() || !has_no_hash()); |
89 return must_be_preserved_with_bias_for_cms_scavenge(klass_of_obj_containing_mark); | 103 return must_be_preserved_with_bias_for_cms_scavenge(klass_of_obj_containing_mark); |
90 } | 104 } |
91 | 105 |
92 inline markOop markOopDesc::prototype_for_object(oop obj) { | 106 inline markOop markOopDesc::prototype_for_object(oop obj) { |
93 #ifdef ASSERT | 107 #ifdef ASSERT |
94 markOop prototype_header = obj->klass()->klass_part()->prototype_header(); | 108 markOop prototype_header = obj->klass()->klass_part()->prototype_header(); |
95 assert(prototype_header == prototype() || prototype_header->has_bias_pattern(), "corrupt prototype header"); | 109 assert(prototype_header == prototype() || prototype_header->has_bias_pattern(), "corrupt prototype header"); |
96 #endif | 110 #endif |
97 return obj->klass()->klass_part()->prototype_header(); | 111 return obj->klass()->klass_part()->prototype_header(); |
98 } | 112 } |
113 | |
114 #endif // SHARE_VM_OOPS_MARKOOP_INLINE_HPP |