00001 /* Copyright 1994, 1995 LongView Technologies L.L.C. $Revision: 1.19 $ */ 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 // Primitives applying to all objects 00025 00026 class oopPrimitives : AllStatic { 00027 private: 00028 static void inc_calls() { number_of_calls++; } 00029 public: 00030 static int number_of_calls; 00031 00032 //%prim 00033 // <Object> primitiveBecome: anObject <Object> 00034 // ifFail: failBlock <PrimFailBlock> ^<Object> = 00035 // Internal { error = #(RecieverHasWrongType) 00036 // name = 'oopPrimitives::become' } 00037 //% 00038 static PRIM_DECL_2(become, oop receiver, oop argument); 00039 00040 //%prim 00041 // <Object> primitiveInstVarAt: index <SmallInteger> 00042 // ifFail: failBlock <PrimFailBlock> ^<Object> = 00043 // Internal { error = #(OutOfBounds) 00044 // name = 'oopPrimitives::instVarAt' } 00045 //% 00046 static PRIM_DECL_2(instVarAt, oop receiver, oop index); 00047 00048 //%prim 00049 // <Reciever> primitiveInstVarNameFor: obj <Object> 00050 // at: index <SmallInteger> 00051 // ifFail: failBlock <PrimFailBlock> ^<Symbol> = 00052 // Internal { error = #(OutOfBounds) 00053 // name = 'oopPrimitives::instance_variable_name_at' } 00054 //% 00055 static PRIM_DECL_2(instance_variable_name_at, oop obj, oop index); 00056 00057 //%prim 00058 // <Object> primitiveInstVarAt: index <SmallInteger> 00059 // put: contents <Object> 00060 // ifFail: failBlock <PrimFailBlock> ^<Object> = 00061 // Internal { error = #(OutOfBounds) 00062 // name = 'oopPrimitives::instVarAtPut' } 00063 //% 00064 static PRIM_DECL_3(instVarAtPut, oop receiver, oop index, oop value); 00065 00066 //%prim 00067 // <Object> primitiveHash ^<SmallInteger> = 00068 // Internal { name = 'oopPrimitives::hash' } 00069 //% 00070 static PRIM_DECL_1(hash, oop receiver); 00071 00072 //%prim 00073 // <NoReceiver> primitiveHashOf: obj <Object> ^<SmallInteger> = 00074 // Internal { name = 'oopPrimitives::hash_of' } 00075 //% 00076 static PRIM_DECL_1(hash_of, oop obj); 00077 00078 //%prim 00079 // <Object> primitiveShallowCopyIfFail: failBlock <PrimFailBlock> ^<Object> = 00080 // Internal { error = #(ReceiverHasWrongType) 00081 // name = 'oopPrimitives::shallowCopy' } 00082 //% 00083 static PRIM_DECL_1(shallowCopy, oop receiver); 00084 00085 //%prim 00086 // <Object> primitiveCopyTenuredIfFail: failBlock <PrimFailBlock> ^<Object> = 00087 // Internal { error = #(NotOops) 00088 // name = 'oopPrimitives::copy_tenured' } 00089 //% 00090 static PRIM_DECL_1(copy_tenured, oop receiver); 00091 00092 //%prim 00093 // <Object> primitiveEqual: anObject <Object> ^<Boolean> = 00094 // Internal { flags = #Pure 00095 // name = 'oopPrimitives::equal' } 00096 //% 00097 static PRIM_DECL_2(equal, oop receiver, oop argument); 00098 00099 //%prim 00100 // <Object> primitiveNotEqual: anObject <Object> ^<Boolean> = 00101 // Internal { flags = #Pure 00102 // name = 'oopPrimitives::not_equal' } 00103 //% 00104 static PRIM_DECL_2(not_equal, oop receiver, oop argument); 00105 00106 //%prim 00107 // <Object> primitiveOopSize ^<SmallInteger> = 00108 // Internal { 00109 // flags = #Pure 00110 // name = 'oopPrimitives::oop_size'} 00111 //% 00112 static PRIM_DECL_1(oop_size, oop receiver); 00113 00114 //%prim 00115 // <Object> primitiveClass ^<Self class> = 00116 // Internal { 00117 // flags = #(Pure LastDeltaFrameNotNeeded) 00118 // name = 'oopPrimitives::klass'} 00119 //% 00120 static PRIM_DECL_1(klass, oop receiver); 00121 00122 //%prim 00123 // <NoReceiver> primitiveClassOf: obj <Object> ^<Behavior> = 00124 // Internal { 00125 // flags = #(Pure LastDeltaFrameNotNeeded) 00126 // name = 'oopPrimitives::klass_of'} 00127 //% 00128 static PRIM_DECL_1(klass_of, oop obj); 00129 00130 //%prim 00131 // <Object> primitivePrint ^<Self> = 00132 // Internal { name = 'oopPrimitives::print'} 00133 //% 00134 static PRIM_DECL_1(print, oop receiver); 00135 00136 //%prim 00137 // <Object> primitivePrintValue ^<Self> = 00138 // Internal { name = 'oopPrimitives::printValue'} 00139 //% 00140 static PRIM_DECL_1(printValue, oop receiver); 00141 00142 //%prim 00143 // <Object> primitiveAsObjectID ^<SmallInteger> = 00144 // Internal { name = 'oopPrimitives::asObjectID'} 00145 //% 00146 static PRIM_DECL_1(asObjectID, oop receiver); 00147 00148 //%prim 00149 // <Object> primitivePerform: selector <CompressedSymbol> 00150 // ifFail: failBlock <PrimFailBlock> ^<Object> = 00151 // Internal { name = 'oopPrimitives::perform' 00152 // error = #(SelectorHasWrongNumberOfArguments) 00153 // } 00154 //% 00155 static PRIM_DECL_2(perform, oop receiver, oop selector); 00156 00157 //%prim 00158 // <Object> primitivePerform: selector <CompressedSymbol> 00159 // with: arg1 <Object> 00160 // ifFail: failBlock <PrimFailBlock> ^<Object> = 00161 // Internal { name = 'oopPrimitives::performWith' 00162 // error = #(SelectorHasWrongNumberOfArguments) 00163 // flags = #(NLR) 00164 // } 00165 //% 00166 static PRIM_DECL_3(performWith, oop receiver, oop selector, oop arg1); 00167 00168 //%prim 00169 // <Object> primitivePerform: selector <CompressedSymbol> 00170 // with: arg1 <Object> 00171 // with: arg2 <Object> 00172 // ifFail: failBlock <PrimFailBlock> ^<Object> = 00173 // Internal { name = 'oopPrimitives::performWithWith' 00174 // error = #(SelectorHasWrongNumberOfArguments) 00175 // flags = #(NLR) 00176 // } 00177 //% 00178 static PRIM_DECL_4(performWithWith, oop receiver, oop selector, oop arg1, oop arg2); 00179 00180 //%prim 00181 // <Object> primitivePerform: selector <CompressedSymbol> 00182 // with: arg1 <Object> 00183 // with: arg2 <Object> 00184 // with: arg3 <Object> 00185 // ifFail: failBlock <PrimFailBlock> ^<Object> = 00186 // Internal { name = 'oopPrimitives::performWithWithWith' 00187 // error = #(SelectorHasWrongNumberOfArguments) 00188 // flags = #(NLR) 00189 // } 00190 //% 00191 static PRIM_DECL_5(performWithWithWith, oop receiver, oop selector, oop arg1, oop arg2, oop arg3); 00192 00193 //%prim 00194 // <Object> primitivePerform: selector <CompressedSymbol> 00195 // arguments: args <Array> 00196 // ifFail: failBlock <PrimFailBlock> ^<Object> = 00197 // Internal { name = 'oopPrimitives::performArguments' 00198 // error = #(SelectorHasWrongNumberOfArguments) 00199 // flags = #(NLR) 00200 // } 00201 //% 00202 static PRIM_DECL_3(performArguments, oop receiver, oop selector, oop args); 00203 };