00001 /* Copyright 1994, 1995 LongView Technologies L.L.C. $Revision: 1.37 $ */ 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 00025 inline klassOop oopDesc::klass() const { 00026 if (is_mem()) return memOop(this)->klass_field(); 00027 assert(is_smi(), "tag must be smi"); 00028 return smiKlassObj; 00029 } 00030 00031 inline Klass* oopDesc::blueprint() const { return klass()->klass_part(); } 00032 00033 inline smi oopDesc::identity_hash() { 00034 if (is_smi()) return smiOop(this)->identity_hash(); 00035 assert(is_mem(), "tag must be mem"); 00036 return memOop(this)->identity_hash(); 00037 } 00038 00039 inline oop oopDesc::scavenge() { 00040 return is_mem() ? memOop(this)->scavenge() : this; 00041 } 00042 00043 inline oop oopDesc::relocate() { 00044 // FIX LATER 00045 return this; 00046 } 00047 00048 // generation testers 00049 inline bool oopDesc::is_old() const { return is_mem() && memOop(this)->is_old(); } 00050 inline bool oopDesc::is_new() const { return is_mem() && memOop(this)->is_new(); } 00051 00052 inline generation* oopDesc::my_generation() { 00053 return Universe::generation_containing(this); 00054 } 00055 00056 // type test operations 00057 inline bool oopDesc::is_double() const { return is_mem() && memOop(this)->klass_field() == doubleKlassObj; } 00058 inline bool oopDesc::is_block() const { return is_mem() && memOop(this)->blueprint()->oop_is_block(); } 00059 inline bool oopDesc::is_byteArray() const { return is_mem() && memOop(this)->blueprint()->oop_is_byteArray(); } 00060 inline bool oopDesc::is_doubleByteArray() const { return is_mem() && memOop(this)->blueprint()->oop_is_doubleByteArray(); } 00061 inline bool oopDesc::is_doubleValueArray() const { return is_mem() && memOop(this)->blueprint()->oop_is_doubleValueArray();} 00062 inline bool oopDesc::is_symbol() const { return is_mem() && memOop(this)->blueprint()->oop_is_symbol(); } 00063 inline bool oopDesc::is_objArray() const { return is_mem() && memOop(this)->blueprint()->oop_is_objArray(); } 00064 inline bool oopDesc::is_weakArray() const { return is_mem() && memOop(this)->blueprint()->oop_is_weakArray(); } 00065 inline bool oopDesc::is_association() const { return is_mem() && memOop(this)->blueprint()->oop_is_association(); } 00066 inline bool oopDesc::is_context() const { return is_mem() && memOop(this)->blueprint()->oop_is_context(); } 00067 inline bool oopDesc::is_klass() const { return is_mem() && memOop(this)->blueprint()->oop_is_klass(); } 00068 inline bool oopDesc::is_proxy() const { return is_mem() && memOop(this)->blueprint()->oop_is_proxy(); } 00069 inline bool oopDesc::is_mixin() const { return is_mem() && memOop(this)->blueprint()->oop_is_mixin(); } 00070 inline bool oopDesc::is_process() const { return is_mem() && memOop(this)->blueprint()->oop_is_process(); } 00071 inline bool oopDesc::is_vframe() const { return is_mem() && memOop(this)->blueprint()->oop_is_vframe(); } 00072 inline bool oopDesc::is_method() const { return is_mem() && memOop(this)->blueprint()->oop_is_method(); } 00073 inline bool oopDesc::is_indexable() const { return is_mem() && memOop(this)->blueprint()->oop_is_indexable(); } 00074 00075 // Primitives 00076 inline bool oopDesc::verify() { 00077 return blueprint()->oop_verify(this); 00078 } 00079 00080 inline oop oopDesc::primitive_allocate() { 00081 return blueprint()->oop_primitive_allocate(this); 00082 } 00083 00084 inline oop oopDesc::primitive_allocate_size(int size) { 00085 return blueprint()->oop_primitive_allocate_size(this, size); 00086 } 00087 00088 inline oop oopDesc::shallow_copy(bool tenured) { 00089 return blueprint()->oop_shallow_copy(this, tenured); 00090 }