reflection.hpp

Go to the documentation of this file.
00001 /* Copyright 1994, 1995 LongView Technologies L.L.C. $Revision: 1.3 $ */
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 class memConverter;
00026 class ClassChange;
00027 
00028 class Reflection : AllStatic {
00029  private:
00030   // Variables used for schema change
00031   static GrowableArray<ClassChange*> *class_changes; // Class changes
00032   static GrowableArray<memOop>       *converted;     // Converted objects
00033 
00034   static int invocations_offset() { return 3; }
00035  private:
00036   // registers all changes in 'class_changes'
00037   static void register_class_changes(mixinOop new_mixin, objArrayOop invocations);
00038 
00039   // sets or resets the invalid bit in the header for old_klass in class_changes
00040   static void invalidate_classes(bool value);
00041 
00042   // find the change structure for a given class
00043   static ClassChange* find_change_for(klassOop klass);
00044 
00045   // computes if a schema change is necessary
00046   static bool needs_schema_change();
00047 
00048   // FOR NO SCHEMA CHANFES
00049   static void update_classes(bool class_vars_changed, bool instance_methods_changed, bool class_methods_changed);
00050 
00051   // FOR SCHEMA CHANGES
00052  
00053   // builds the new classes and converters
00054   static void setup_schema_change();
00055 
00056   static void update_class(klassOop klass,
00057                            mixinOop new_mixin, 
00058                            mixinOop old_mixin,
00059                            bool     instance_methods_changed,
00060                            bool     class_methods_changed,
00061                            bool     class_vars_changed);
00062 
00063 
00064   static bool has_methods_changed(mixinOop new_mixin, mixinOop old_mixin);
00065   static bool has_class_vars_changed(mixinOop new_mixin, mixinOop old_mixin);
00066 
00067   static void apply_change(mixinOop    new_mixin,
00068                           mixinOop    old_mixin,
00069                           objArrayOop invocations);
00070 
00071   static memOop convert_object(memOop obj);
00072 
00073  public:
00074   // Entry for primitiveApplyChange:ifFail:
00075   static oop apply_change(objArrayOop change);
00076 
00077   // Converts an object if necessary (used when scanning the object heap)
00078   static void convert(oop* p);
00079 
00080   // place forward pointer and 
00081   static void forward(memOop old_obj, memOop new_obj);
00082 };

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