symbolKlass.cpp

Go to the documentation of this file.
00001 /* Copyright 1994, 1995 LongView Technologies L.L.C. $Revision: 1.22 $ */
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 # include "incls/_precompiled.incl"
00026 # include "incls/_symbolKlass.cpp.incl"
00027 # include <ctype.h>
00028 
00029 symbolOop symbolKlass::allocateSymbol(char* value, int len) {
00030   symbolOop sym = as_symbolOop(Universe::allocate_tenured(object_size(len)));
00031   sym->init_untagged_contents_mark();
00032   sym->set_klass_field(Universe::symbolKlassObj());
00033   sym->set_length(len);
00034   initialize_object(sym, value, len);
00035   return sym;
00036 }
00037 
00038 klassOop symbolKlass::create_subclass(mixinOop mixin, Format format) {
00039   if (format == mem_klass || format == symbol_klass) {
00040     return symbolKlass::create_class(as_klassOop(), mixin);
00041   }
00042   return NULL;
00043 }
00044 
00045 klassOop symbolKlass::create_class(klassOop super_class, mixinOop mixin) {
00046   symbolKlass o;
00047   return create_generic_class(super_class, mixin, o.vtbl_value());
00048 }
00049 
00050 void set_symbolKlass_vtbl(Klass* k) {
00051   symbolKlass o;
00052   k->set_vtbl_value(o.vtbl_value());
00053 }
00054 
00055 oop symbolKlass::scavenge(oop obj) {
00056   Unused(obj);
00057   ShouldNotCallThis(); // shouldn't need to scavenge canonical symbols
00058                        // (should be tenured)
00059   return NULL;
00060 }
00061 
00062 bool symbolKlass::verify(oop obj) {
00063   return symbolOop(obj)->verify();
00064 }
00065 
00066 void symbolKlass::oop_print_value_on(oop obj, outputStream* st) {
00067   assert_symbol(obj, "dispatch check");
00068   symbolOop array = symbolOop(obj);
00069   int len = array->length();
00070   int n   = min(MaxElementPrintSize, len);
00071   st->print("#");
00072   for(int index = 1; index <= n; index++) {
00073     char c = array->byte_at(index);
00074     if (isprint(c)) st->print("%c",   c);
00075     else            st->print("\\%o", c);
00076   }
00077  if (n < len) st->print("...");
00078 }
00079 
00080 void symbolKlass::print(oop obj) {
00081   assert_symbol(obj, "dispatch check");
00082   std->print("'");
00083   symbolOop(obj)->print_symbol_on();
00084   std->print("' ");
00085 }
00086 
00087 oop symbolKlass::oop_shallow_copy(oop obj, bool tenured) {
00088   assert_symbol(obj, "dispatch check");
00089   return obj;
00090 }

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