Mercurial > hg > truffle
comparison src/share/vm/oops/objArrayKlass.cpp @ 879:494244ae0171
Merge
author | coleenp |
---|---|
date | Mon, 27 Jul 2009 17:23:52 -0400 |
parents | 1413494da700 df6caf649ff7 |
children | 6aa7255741f3 |
comparison
equal
deleted
inserted
replaced
878:abe076e3636f | 879:494244ae0171 |
---|---|
83 | 83 |
84 // Either oop or narrowOop depending on UseCompressedOops. | 84 // Either oop or narrowOop depending on UseCompressedOops. |
85 template <class T> void objArrayKlass::do_copy(arrayOop s, T* src, | 85 template <class T> void objArrayKlass::do_copy(arrayOop s, T* src, |
86 arrayOop d, T* dst, int length, TRAPS) { | 86 arrayOop d, T* dst, int length, TRAPS) { |
87 | 87 |
88 const size_t word_len = objArrayOopDesc::array_size(length); | |
89 | |
90 BarrierSet* bs = Universe::heap()->barrier_set(); | 88 BarrierSet* bs = Universe::heap()->barrier_set(); |
91 // For performance reasons, we assume we are that the write barrier we | 89 // For performance reasons, we assume we are that the write barrier we |
92 // are using has optimized modes for arrays of references. At least one | 90 // are using has optimized modes for arrays of references. At least one |
93 // of the asserts below will fail if this is not the case. | 91 // of the asserts below will fail if this is not the case. |
94 assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); | 92 assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); |
95 assert(bs->has_write_ref_array_pre_opt(), "For pre-barrier as well."); | 93 assert(bs->has_write_ref_array_pre_opt(), "For pre-barrier as well."); |
96 | 94 |
97 MemRegion dst_mr = MemRegion((HeapWord*)dst, word_len); | |
98 if (s == d) { | 95 if (s == d) { |
99 // since source and destination are equal we do not need conversion checks. | 96 // since source and destination are equal we do not need conversion checks. |
100 assert(length > 0, "sanity check"); | 97 assert(length > 0, "sanity check"); |
101 bs->write_ref_array_pre(dst_mr); | 98 bs->write_ref_array_pre(dst, length); |
102 Copy::conjoint_oops_atomic(src, dst, length); | 99 Copy::conjoint_oops_atomic(src, dst, length); |
103 } else { | 100 } else { |
104 // We have to make sure all elements conform to the destination array | 101 // We have to make sure all elements conform to the destination array |
105 klassOop bound = objArrayKlass::cast(d->klass())->element_klass(); | 102 klassOop bound = objArrayKlass::cast(d->klass())->element_klass(); |
106 klassOop stype = objArrayKlass::cast(s->klass())->element_klass(); | 103 klassOop stype = objArrayKlass::cast(s->klass())->element_klass(); |
107 if (stype == bound || Klass::cast(stype)->is_subtype_of(bound)) { | 104 if (stype == bound || Klass::cast(stype)->is_subtype_of(bound)) { |
108 // elements are guaranteed to be subtypes, so no check necessary | 105 // elements are guaranteed to be subtypes, so no check necessary |
109 bs->write_ref_array_pre(dst_mr); | 106 bs->write_ref_array_pre(dst, length); |
110 Copy::conjoint_oops_atomic(src, dst, length); | 107 Copy::conjoint_oops_atomic(src, dst, length); |
111 } else { | 108 } else { |
112 // slow case: need individual subtype checks | 109 // slow case: need individual subtype checks |
113 // note: don't use obj_at_put below because it includes a redundant store check | 110 // note: don't use obj_at_put below because it includes a redundant store check |
114 T* from = src; | 111 T* from = src; |
136 return; | 133 return; |
137 } | 134 } |
138 } | 135 } |
139 } | 136 } |
140 } | 137 } |
138 const size_t word_len = objArrayOopDesc::array_size(length); | |
141 bs->write_ref_array(MemRegion((HeapWord*)dst, word_len)); | 139 bs->write_ref_array(MemRegion((HeapWord*)dst, word_len)); |
142 } | 140 } |
143 | 141 |
144 void objArrayKlass::copy_array(arrayOop s, int src_pos, arrayOop d, | 142 void objArrayKlass::copy_array(arrayOop s, int src_pos, arrayOop d, |
145 int dst_pos, int length, TRAPS) { | 143 int dst_pos, int length, TRAPS) { |