1 /*
2 * Copyright (c) 2002, 2015, 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 *
65 }
66
67 assert(this->top() <= this->end(), "pointers out of order");
68 }
69
70 // Fill all remaining lab space with an unreachable object.
71 // The goal is to leave a contiguous parseable span of objects.
72 void PSPromotionLAB::flush() {
73 assert(_state != flushed, "Attempt to flush PLAB twice");
74 assert(top() <= end(), "pointers out of order");
75
76 // If we were initialized to a zero sized lab, there is
77 // nothing to flush
78 if (_state == zero_size)
79 return;
80
81 // PLAB's never allocate the last aligned_header_size
82 // so they can always fill with an array.
83 HeapWord* tlab_end = end() + filler_header_size;
84 typeArrayOop filler_oop = (typeArrayOop) top();
85 filler_oop->set_mark(markOopDesc::prototype());
86 filler_oop->set_klass(Universe::intArrayKlassObj());
87 const size_t array_length =
88 pointer_delta(tlab_end, top()) - typeArrayOopDesc::header_size(T_INT);
89 assert( (array_length * (HeapWordSize/sizeof(jint))) < (size_t)max_jint, "array too big in PSPromotionLAB");
90 filler_oop->set_length((int)(array_length * (HeapWordSize/sizeof(jint))));
91
92 #ifdef ASSERT
93 // Note that we actually DO NOT want to use the aligned header size!
94 HeapWord* elt_words = ((HeapWord*)filler_oop) + typeArrayOopDesc::header_size(T_INT);
95 Copy::fill_to_words(elt_words, array_length, 0xDEAABABE);
96 #endif
97
98 set_bottom(NULL);
99 set_end(NULL);
100 set_top(NULL);
101
102 _state = flushed;
103 }
104
105 bool PSPromotionLAB::unallocate_object(HeapWord* obj, size_t obj_size) {
|
1 /*
2 * Copyright (c) 2002, 2018, 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 *
65 }
66
67 assert(this->top() <= this->end(), "pointers out of order");
68 }
69
70 // Fill all remaining lab space with an unreachable object.
71 // The goal is to leave a contiguous parseable span of objects.
72 void PSPromotionLAB::flush() {
73 assert(_state != flushed, "Attempt to flush PLAB twice");
74 assert(top() <= end(), "pointers out of order");
75
76 // If we were initialized to a zero sized lab, there is
77 // nothing to flush
78 if (_state == zero_size)
79 return;
80
81 // PLAB's never allocate the last aligned_header_size
82 // so they can always fill with an array.
83 HeapWord* tlab_end = end() + filler_header_size;
84 typeArrayOop filler_oop = (typeArrayOop) top();
85 filler_oop->set_mark_raw(markOopDesc::prototype());
86 filler_oop->set_klass(Universe::intArrayKlassObj());
87 const size_t array_length =
88 pointer_delta(tlab_end, top()) - typeArrayOopDesc::header_size(T_INT);
89 assert( (array_length * (HeapWordSize/sizeof(jint))) < (size_t)max_jint, "array too big in PSPromotionLAB");
90 filler_oop->set_length((int)(array_length * (HeapWordSize/sizeof(jint))));
91
92 #ifdef ASSERT
93 // Note that we actually DO NOT want to use the aligned header size!
94 HeapWord* elt_words = ((HeapWord*)filler_oop) + typeArrayOopDesc::header_size(T_INT);
95 Copy::fill_to_words(elt_words, array_length, 0xDEAABABE);
96 #endif
97
98 set_bottom(NULL);
99 set_end(NULL);
100 set_top(NULL);
101
102 _state = flushed;
103 }
104
105 bool PSPromotionLAB::unallocate_object(HeapWord* obj, size_t obj_size) {
|