associationKlass.cpp

Go to the documentation of this file.
00001 /* Copyright 1994, 1995 LongView Technologies L.L.C. $Revision: 1.24 $ */
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 # include "incls/_precompiled.incl"
00025 # include "incls/_associationKlass.cpp.incl"
00026 
00027 void set_associationKlass_vtbl(Klass* k) {
00028   associationKlass o;
00029   k->set_vtbl_value(o.vtbl_value());
00030 }
00031 
00032 oop associationKlass::allocateObject() {
00033   klassOop k    = as_klassOop();
00034   int      size = non_indexable_size();
00035   // allocate
00036   associationOop obj = as_associationOop(Universe::allocate_tenured(size));
00037   // header
00038   memOop(obj)->initialize_header(has_untagged_contents(), k);
00039   obj->set_key(symbolOop(nilObj));
00040   obj->set_value(nilObj);
00041   obj->set_is_constant(false);
00042   // instance variables
00043   obj->initialize_body(associationOopDesc::header_size(), size);
00044   return obj;
00045 }
00046 
00047 klassOop associationKlass::create_subclass(mixinOop mixin, Format format) {
00048   if (format == mem_klass || format == association_klass) {
00049     return associationKlass::create_class(as_klassOop(), mixin);
00050   }
00051   return NULL;
00052 }
00053 
00054 klassOop associationKlass::create_class(klassOop super_class, mixinOop mixin) {
00055   associationKlass o;
00056   return create_generic_class(super_class, mixin, o.vtbl_value());
00057 }
00058 
00059 bool associationKlass::oop_verify(oop obj) {
00060   bool flag = memOop(obj)->verify();
00061   return flag;
00062 }
00063 
00064 void associationKlass::oop_short_print_on(oop obj, outputStream* st) {
00065   associationOop assoc = associationOop(obj);
00066   st->print("{"); 
00067   assoc->key()->print_symbol_on(st);
00068   st->print(", "); 
00069   assoc->value()->print_value_on(st);
00070   if (assoc->is_constant()) {
00071     st->print(" (constant)");
00072   }
00073   st->print("} "); 
00074 }
00075 
00076 void associationKlass::oop_print_value_on(oop obj, outputStream* st) {
00077   associationOop assoc = associationOop(obj);
00078   if (PrintObjectID) {
00079     memOop(obj)->print_id_on(st);
00080     st->print("-");
00081   }
00082   print_name_on(st);
00083   st->print(" {"); 
00084   assoc->key()->print_symbol_on(st);
00085   st->print(", "); 
00086   assoc->value()->print_value_on(st);
00087   if (assoc->is_constant()) {
00088     st->print(" (constant)");
00089   }
00090   st->print("}");
00091   if (PrintOopAddress) st->print(" (%#x)", this);
00092 }
00093 
00094 int associationKlass::oop_scavenge_contents(oop obj) {
00095   int size = non_indexable_size();
00096   // header + instance variables
00097   memOop(obj)->scavenge_header();
00098   memOop(obj)->scavenge_body(memOopDesc::header_size(), size);
00099   return size;  
00100 }
00101 
00102 int associationKlass::oop_scavenge_tenured_contents(oop obj) {
00103   int size = non_indexable_size();
00104   // header + instance variables
00105   memOop(obj)->scavenge_tenured_header();
00106   memOop(obj)->scavenge_tenured_body(memOopDesc::header_size(), size);
00107   return size;
00108 }
00109 
00110 void associationKlass::oop_follow_contents(oop obj) {
00111   // header + instance variables
00112   memOop(obj)->follow_header();
00113   memOop(obj)->follow_body(memOopDesc::header_size(), non_indexable_size());
00114 }
00115 
00116 void associationKlass::oop_layout_iterate(oop obj, ObjectLayoutClosure* blk) {
00117   // header
00118   memOop(obj)->layout_iterate_header(blk);
00119   associationOop assoc = associationOop(obj);
00120   blk->do_oop("key",         (oop*) &assoc->addr()->_key);
00121   blk->do_oop("value",       (oop*) &assoc->addr()->_value);
00122   blk->do_oop("is_constant", (oop*) &assoc->addr()->_is_constant);
00123   // instance variables
00124   memOop(obj)->layout_iterate_body(blk, associationOopDesc::header_size(), non_indexable_size());
00125 }
00126 
00127 void associationKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
00128   // header
00129   memOop(obj)->oop_iterate_header(blk);
00130   associationOop assoc = associationOop(obj);
00131   blk->do_oop((oop*) &assoc->addr()->_key);
00132   blk->do_oop((oop*) &assoc->addr()->_value);
00133   blk->do_oop((oop*) &assoc->addr()->_is_constant);
00134   // instance variables
00135   memOop(obj)->oop_iterate_body(blk, associationOopDesc::header_size(), non_indexable_size());
00136 }

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