lookupTypes.hpp

Go to the documentation of this file.
00001 /* Copyright 1994, 1995 LongView Technologies L.L.C. $Revision: 1.4 $ */
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 #ifdef junk
00025 
00026 enum BaseLookupType {
00027   NormalLookupType,  SelfLookupType, SuperLookupType
00028 };
00029 
00030 enum CountType {
00031   NonCounting,          // no counting at all
00032   Counting,             // incrementing a counter
00033   Comparing             // increment & test for reaching limit (recompilation)
00034 };
00035 
00036 
00037 typedef int LookupType;
00038 
00039 const int LookupTypeSize = 2;
00040 const int LookupTypeMask = 3;
00041 
00042 const int CountTypeMask = NonCounting | Counting | Comparing;
00043 const int CountTypeSize = 2;
00044 const int CountSendBit  = LookupTypeSize + 1;
00045 
00046 // the dirty bit records whether the inline cache has ever made a transition 
00047 // from non-empty to empty (e.g. through flushing)
00048 const int DirtySendBit  = CountSendBit + CountTypeSize;
00049 const int DirtySendMask = 1 << DirtySendBit;
00050 
00051 // the optimized bit says that if no callee nmethod exists, an optimized
00052 // method should be created immediately rather than going through an
00053 // unoptimized version first
00054 const int OptimizedSendBit  = DirtySendBit + 1;
00055 const int OptimizedSendMask = 1 << OptimizedSendBit;
00056 
00057 // the uninlinable bit says that the SIC has decided it's not worth
00058 // inlining this send no matter how often it is executed.
00059 const int UninlinableSendBit  = OptimizedSendBit + 1;
00060 const int UninlinableSendMask = 1 << UninlinableSendBit;
00061 
00062 inline LookupType withoutExtraBits(LookupType lookupType) {
00063   return lookupType & LookupTypeMask;
00064 }
00065 inline LookupType withCountBits(LookupType l, CountType t) {
00066   return LookupType((int(l) & ~(CountTypeMask << CountSendBit))
00067                     | (t << CountSendBit));
00068 }
00069 
00070 inline CountType countType(LookupType l) {
00071   return CountType((int(l) >> CountSendBit) & CountTypeMask);
00072 }
00073 
00074 extern "C" {
00075   void printLookupType(LookupType lookupType);
00076   char* lookupTypeName(LookupType lookupType);
00077 }
00078 #endif

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