memOop.inline.hpp

Go to the documentation of this file.
00001 /* Copyright 1994, 1995 LongView Technologies L.L.C. $Revision: 1.20 $ */
00002 /* Copyright (c) 2006, Sun Microsystems, Inc.
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 
00006 following conditions are met:
00007 
00008     * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
00009     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following 
00010           disclaimer in the documentation and/or other materials provided with the distribution.
00011     * Neither the name of Sun Microsystems nor the names of its contributors may be used to endorse or promote products derived 
00012           from this software without specific prior written permission.
00013 
00014 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 
00015 NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
00016 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
00017 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00018 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
00019 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
00020 
00021 
00022 */
00023 
00024 inline smi memOopDesc::identity_hash() {
00025   // don't clean up the addr()->_mark below to mark(), 
00026   // since hash_markOop can modify its argument
00027   return hash_markOop(addr()->_mark);
00028 }
00029 
00030 inline void memOopDesc::scavenge_header() { 
00031   // Not needed since klas is in old space
00032   //   scavenge_oop(klass_addr());
00033 }
00034 
00035 inline void memOopDesc::scavenge_body(int begin, int end) { 
00036   oop* p = (oop*) addr();
00037   oop* q = p + end;
00038   p     += begin;
00039   while (p < q) scavenge_oop(p++);
00040 }
00041 
00042 inline void memOopDesc::scavenge_tenured_body(int begin, int end) {
00043   oop* p = (oop*) addr();
00044   oop* q = p + end;
00045   p     += begin;
00046   while (p < q) scavenge_tenured_oop(p++);
00047 }
00048 
00049 inline void memOopDesc::follow_header() { 
00050   MarkSweep::reverse_and_push(klass_addr());
00051 }
00052 
00053 inline void memOopDesc::follow_body(int begin, int end) { 
00054   oop* p = (oop*) addr();
00055   oop* q = p + end;
00056   p     += begin;
00057   while (p < q) MarkSweep::reverse_and_push(p++);
00058 }
00059 
00060 inline void memOopDesc::layout_iterate_header(ObjectLayoutClosure* blk) {
00061   blk->do_mark(&addr()->_mark);
00062   blk->do_oop("klass", (oop*) &addr()->_klass_field);
00063 }
00064 
00065 inline void memOopDesc::oop_iterate_header(OopClosure* blk) {
00066   blk->do_oop((oop*) &addr()->_klass_field);
00067 }
00068 
00069 inline void memOopDesc::oop_iterate_body(OopClosure* blk,  int begin, int end) {
00070   oop* p = (oop*) addr();
00071   oop* q = p + end;
00072   p     += begin;
00073   while (p < q) blk->do_oop(p++); 
00074 }
00075 
00076 inline void memOopDesc::initialize_header(bool has_untagged_contents, klassOop klass) {
00077   set_klass_field(klass);
00078   if (has_untagged_contents)
00079     init_untagged_contents_mark();
00080   else
00081     init_mark();
00082 }
00083 
00084 inline void memOopDesc::initialize_body(int begin, int end) {
00085   oop value = nilObj;
00086   oop* p = (oop*) addr();
00087   oop* q = p + end;
00088   p     += begin;
00089   while (p < q) Universe::store(p++, value, false);
00090 }
00091 
00092 inline void memOopDesc::raw_at_put(int which, oop contents, bool cs) {
00093   Universe::store(oops(which), contents, cs); }
00094 
00095 inline int memOopDesc::size() const {
00096   return blueprint()->oop_size(memOop(this));
00097 }
00098 
00099 inline int memOopDesc::scavenge_contents() {
00100  return blueprint()->oop_scavenge_contents(this);
00101 }
00102 
00103 inline int memOopDesc::scavenge_tenured_contents() {
00104   return blueprint()->oop_scavenge_tenured_contents(this);
00105 }
00106 
00107 // Store object size in age field and remembered set
00108 inline void memOopDesc::gc_store_size() {
00109   int s = size();
00110   if (s < markOopDesc::max_age) {
00111     // store size in age field
00112     set_mark(mark()->set_age(s));
00113     assert(mark()->age() == s, "Check size");
00114   } else {
00115     // store size in remembered set
00116     // first set overflow value in age field
00117     set_mark(mark()->set_age(0));
00118     assert(mark()->age() == 0, "Check size");
00119 
00120     Universe::remembered_set->set_size(this, s);
00121     assert(Universe::remembered_set->get_size(this) == s, "Check size");
00122   }
00123 }
00124 
00125 // Retrieve object size from age field and remembered set       
00126 inline int memOopDesc::gc_retrieve_size() {
00127   if (mark()->age() == 0)
00128     return Universe::remembered_set->get_size(this);
00129   return mark()->age();
00130 }

Generated on Mon Oct 9 13:37:14 2006 for Strongtalk VM by  doxygen 1.4.7