src/share/vm/oops/objArrayKlass.inline.hpp

Thu, 27 May 2010 19:08:38 -0700

author
trims
date
Thu, 27 May 2010 19:08:38 -0700
changeset 1907
c18cbe5936b8
parent 1746
2a1472c30599
child 2314
f95d63e2154a
permissions
-rw-r--r--

6941466: Oracle rebranding changes for Hotspot repositories
Summary: Change all the Sun copyrights to Oracle copyright
Reviewed-by: ohair

     1 /*
     2  * Copyright (c) 2010, 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  *
    23  */
    25 void objArrayKlass::oop_follow_contents(oop obj, int index) {
    26   if (UseCompressedOops) {
    27     objarray_follow_contents<narrowOop>(obj, index);
    28   } else {
    29     objarray_follow_contents<oop>(obj, index);
    30   }
    31 }
    33 template <class T>
    34 void objArrayKlass::objarray_follow_contents(oop obj, int index) {
    35   objArrayOop a = objArrayOop(obj);
    36   const size_t len = size_t(a->length());
    37   const size_t beg_index = size_t(index);
    38   assert(beg_index < len || len == 0, "index too large");
    40   const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
    41   const size_t end_index = beg_index + stride;
    42   T* const base = (T*)a->base();
    43   T* const beg = base + beg_index;
    44   T* const end = base + end_index;
    46   // Push the non-NULL elements of the next stride on the marking stack.
    47   for (T* e = beg; e < end; e++) {
    48     MarkSweep::mark_and_push<T>(e);
    49   }
    51   if (end_index < len) {
    52     MarkSweep::push_objarray(a, end_index); // Push the continuation.
    53   }
    54 }
    56 #ifndef SERIALGC
    57 void objArrayKlass::oop_follow_contents(ParCompactionManager* cm, oop obj,
    58                                         int index) {
    59   if (UseCompressedOops) {
    60     objarray_follow_contents<narrowOop>(cm, obj, index);
    61   } else {
    62     objarray_follow_contents<oop>(cm, obj, index);
    63   }
    64 }
    66 template <class T>
    67 void objArrayKlass::objarray_follow_contents(ParCompactionManager* cm, oop obj,
    68                                              int index) {
    69   objArrayOop a = objArrayOop(obj);
    70   const size_t len = size_t(a->length());
    71   const size_t beg_index = size_t(index);
    72   assert(beg_index < len || len == 0, "index too large");
    74   const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
    75   const size_t end_index = beg_index + stride;
    76   T* const base = (T*)a->base();
    77   T* const beg = base + beg_index;
    78   T* const end = base + end_index;
    80   // Push the non-NULL elements of the next stride on the marking stack.
    81   for (T* e = beg; e < end; e++) {
    82     PSParallelCompact::mark_and_push<T>(cm, e);
    83   }
    85   if (end_index < len) {
    86     cm->push_objarray(a, end_index); // Push the continuation.
    87   }
    88 }
    89 #endif // #ifndef SERIALGC

mercurial