block_prims.hpp

Go to the documentation of this file.
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 for blocks
00025 
00026 // The following 3 primitives are implemented in the interpreter
00027 // but we still need the interface!
00028 
00029 //%prim
00030 // <BlockWithoutArguments> primitiveValue ^<Object> =
00031 //   Internal {
00032 //     flags = #(NLR Block LastDeltaFrameNotNeeded)
00033 //     name  = 'primitiveValue0' }
00034 //%
00035 extern "C" oop primitiveValue0(oop blk);
00036 
00037 //%prim
00038 // <BlockWithOneArgument> primitiveValue: arg1 <Object> ^<Object> =
00039 //   Internal {
00040 //     flags = #(NLR Block LastDeltaFrameNotNeeded)
00041 //     name  = 'primitiveValue1' }
00042 //%
00043 extern "C" oop primitiveValue1(oop blk, oop arg1);
00044 
00045 //%prim
00046 // <BlockWithTwoArguments> primitiveValue: arg1 <Object> value: arg2 <Object> ^<Object> =
00047 //   Internal {
00048 //     flags = #(NLR Block LastDeltaFrameNotNeeded)
00049 //     name  = 'primitiveValue2' }
00050 //%
00051 extern "C" oop primitiveValue2(oop blk, oop arg1, oop arg2);
00052 
00053 //%prim
00054 // <BlockWithThreeArguments> primitiveValue: arg1 <Object> value: arg2 <Object> value: arg3 <Object> ^<Object> =
00055 //   Internal {
00056 //     flags = #(NLR Block LastDeltaFrameNotNeeded)
00057 //     name  = 'primitiveValue3' }
00058 //%
00059 extern "C" oop primitiveValue3(oop blk, oop arg1, oop arg2, oop arg3);
00060 
00061 //%prim
00062 // <BlockWithFourArguments> primitiveValue: arg1 <Object> value: arg2 <Object> value: arg3 <Object>
00063 //                                   value: arg4 <Object> ^<Object> =
00064 //   Internal {
00065 //     flags = #(NLR Block LastDeltaFrameNotNeeded)
00066 //     name  = 'primitiveValue4' }
00067 //%
00068 extern "C" oop primitiveValue4(oop blk, oop arg1, oop arg2, oop arg3, oop arg4);
00069 
00070 //%prim
00071 // <BlockWithFiveArguments> primitiveValue: arg1 <Object> value: arg2 <Object> value: arg3 <Object>
00072 //                                   value: arg4 <Object> value: arg5 <Object> ^<Object> =
00073 //   Internal {
00074 //     flags = #(NLR Block LastDeltaFrameNotNeeded)
00075 //     name  = 'primitiveValue5' }
00076 //%
00077 extern "C" oop primitiveValue5(oop blk, oop arg1, oop arg2, oop arg3, oop arg4, oop arg5);
00078 
00079 //%prim
00080 // <BlockWithSixArguments> primitiveValue: arg1 <Object> value: arg2 <Object> value: arg3 <Object>
00081 //                                  value: arg4 <Object> value: arg5 <Object> value: arg6 <Object> ^<Object> =
00082 //   Internal {
00083 //     flags = #(NLR Block LastDeltaFrameNotNeeded)
00084 //     name  = 'primitiveValue6' }
00085 //%
00086 extern "C" oop primitiveValue6(oop blk, oop arg1, oop arg2, oop arg3, oop arg4, oop arg5,
00087                                oop arg6);
00088 
00089 //%prim
00090 // <BlockWithSevenArguments> primitiveValue: arg1 <Object> value: arg2 <Object> value: arg3 <Object>
00091 //                                    value: arg4 <Object> value: arg5 <Object> value: arg6 <Object>
00092 //                                    value: arg7 <Object> ^<Object> =
00093 //   Internal {
00094 //     flags = #(NLR Block LastDeltaFrameNotNeeded)
00095 //     name  = 'primitiveValue7' }
00096 //%
00097 extern "C" oop primitiveValue7(oop blk, oop arg1, oop arg2, oop arg3, oop arg4, oop arg5,
00098                                oop arg6, oop arg7);
00099 
00100 //%prim
00101 // <BlockWithEightArguments> primitiveValue: arg1 <Object> value: arg2 <Object> value: arg3 <Object>
00102 //                                    value: arg4 <Object> value: arg5 <Object> value: arg6 <Object>
00103 //                                    value: arg7 <Object> value: arg8 <Object> ^<Object> =
00104 //   Internal {
00105 //     flags = #(NLR Block LastDeltaFrameNotNeeded)
00106 //     name  = 'primitiveValue8' }
00107 //%
00108 extern "C" oop primitiveValue8(oop blk, oop arg1, oop arg2, oop arg3, oop arg4, oop arg5,
00109                                oop arg6, oop arg7, oop arg8);
00110 
00111 //%prim
00112 // <BlockWithNineArguments> primitiveValue: arg1 <Object> value: arg2 <Object> value: arg3 <Object>
00113 //                                   value: arg4 <Object> value: arg5 <Object> value: arg6 <Object>
00114 //                                   value: arg7 <Object> value: arg8 <Object> value: arg9 <Object> ^<Object> =
00115 //   Internal {
00116 //     flags = #(NLR Block LastDeltaFrameNotNeeded)
00117 //     name  = 'primitiveValue9' }
00118 //%
00119 extern "C" oop primitiveValue9(oop blk, oop arg1, oop arg2, oop arg3, oop arg4, oop arg5,
00120                                oop arg6, oop arg7, oop arg8, oop arg9);
00121 
00122 // Instead we should come up with a
00123 // generic solution for up to 255 arguments at some point. (gri)
00124 
00125 // The following primitives are called directly by the interpreter.
00126 
00127 extern "C" blockClosureOop allocateBlock(smiOop nofArgs);
00128 //%prim
00129 // <NoReceiver> primitiveCompiledBlockAllocate: size <SmallInteger> ^<Block> =
00130 //   Internal {
00131 //     flags = #(Internal Block Allocate)
00132 //     name  = 'allocateBlock' }
00133 //%
00134 extern "C" blockClosureOop allocateTenuredBlock(smiOop nofArgs);  // for compiler
00135 
00136 
00137 extern "C" blockClosureOop allocateBlock0();
00138 //%prim
00139 // <NoReceiver> primitiveCompiledBlockAllocate0 ^<Block> =
00140 //   Internal {
00141 //     flags = #(Internal Block Allocate LastDeltaFrameNotNeeded)
00142 //     name  = 'allocateBlock0' }
00143 //%
00144 
00145 extern "C" blockClosureOop allocateBlock1();
00146 //%prim
00147 // <NoReceiver> primitiveCompiledBlockAllocate1 ^<Block> =
00148 //   Internal {
00149 //     flags = #(Internal Block Allocate LastDeltaFrameNotNeeded)
00150 //     name  = 'allocateBlock1' }
00151 //%
00152 
00153 extern "C" blockClosureOop allocateBlock2();
00154 //%prim
00155 // <NoReceiver> primitiveCompiledBlockAllocate2 ^<Block> =
00156 //   Internal {
00157 //     flags = #(Internal Block Allocate LastDeltaFrameNotNeeded)
00158 //     name  = 'allocateBlock2' }
00159 //%
00160 
00161 extern "C" blockClosureOop allocateBlock3();
00162 //%prim
00163 // <NoReceiver> primitiveCompiledBlockAllocate3 ^<Block> =
00164 //   Internal {
00165 //     flags = #(Internal Block Allocate LastDeltaFrameNotNeeded)
00166 //     name  = 'allocateBlock3' }
00167 //%
00168 
00169 extern "C" blockClosureOop allocateBlock4();
00170 //%prim
00171 // <NoReceiver> primitiveCompiledBlockAllocate4 ^<Block> =
00172 //   Internal {
00173 //     flags = #(Internal Block Allocate LastDeltaFrameNotNeeded)
00174 //     name  = 'allocateBlock4' }
00175 //%
00176 
00177 extern "C" blockClosureOop allocateBlock5();
00178 //%prim
00179 // <NoReceiver> primitiveCompiledBlockAllocate5 ^<Block> =
00180 //   Internal {
00181 //     flags = #(Internal Block Allocate LastDeltaFrameNotNeeded)
00182 //     name  = 'allocateBlock5' }
00183 //%
00184 
00185 extern "C" blockClosureOop allocateBlock6();
00186 //%prim
00187 // <NoReceiver> primitiveCompiledBlockAllocate6 ^<Block> =
00188 //   Internal {
00189 //     flags = #(Internal Block Allocate LastDeltaFrameNotNeeded)
00190 //     name  = 'allocateBlock6' }
00191 //%
00192 
00193 extern "C" blockClosureOop allocateBlock7();
00194 //%prim
00195 // <NoReceiver> primitiveCompiledBlockAllocate7 ^<Block> =
00196 //   Internal {
00197 //     flags = #(Internal Block Allocate LastDeltaFrameNotNeeded)
00198 //     name  = 'allocateBlock7' }
00199 //%
00200 
00201 extern "C" blockClosureOop allocateBlock8();
00202 //%prim
00203 // <NoReceiver> primitiveCompiledBlockAllocate8 ^<Block> =
00204 //   Internal {
00205 //     flags = #(Internal Block Allocate LastDeltaFrameNotNeeded)
00206 //     name  = 'allocateBlock8' }
00207 //%
00208 
00209 extern "C" blockClosureOop allocateBlock9();
00210 //%prim
00211 // <NoReceiver> primitiveCompiledBlockAllocate9 ^<Block> =
00212 //   Internal {
00213 //     flags = #(Internal Block Allocate LastDeltaFrameNotNeeded)
00214 //     name  = 'allocateBlock9' }
00215 //%
00216 
00217 extern "C" contextOop allocateContext(smiOop nofVars);
00218 //%prim
00219 // <NoReceiver> primitiveCompiledContextAllocate: size <SmallInteger> ^<Object> =
00220 //   Internal {
00221 //     flags = #(Internal Block Allocate LastDeltaFrameNotNeeded)
00222 //     name  = 'allocateContext' }
00223 //%
00224 
00225 extern "C" contextOop allocateContext0();
00226 //%prim
00227 // <NoReceiver> primitiveCompiledContextAllocate0 ^<Object> =
00228 //   Internal {
00229 //     flags = #(Internal Block Allocate LastDeltaFrameNotNeeded)
00230 //     name  = 'allocateContext0' }
00231 //%
00232 extern "C" contextOop allocateContext1();
00233 //%prim
00234 // <NoReceiver> primitiveCompiledContextAllocate1 ^<Object> =
00235 //   Internal {
00236 //     flags = #(Internal Block Allocate LastDeltaFrameNotNeeded)
00237 //     name  = 'allocateContext1' }
00238 //%
00239 extern "C" contextOop allocateContext2();
00240 //%prim
00241 // <NoReceiver> primitiveCompiledContextAllocate2 ^<Object> =
00242 //   Internal {
00243 //     flags = #(Internal Block Allocate LastDeltaFrameNotNeeded)
00244 //     name  = 'allocateContext2' }
00245 //%
00246 
00247 PRIM_DECL_2(unwindprotect, oop receiver, oop protectBlock);
00248 //%prim
00249 // <BlockWithoutArguments> primitiveUnwindProtect: protect   <BlockWithoutArguments> 
00250 //                                         ifFail: failBlock <PrimFailBlock> ^<Object> =
00251 //   Internal {
00252 //     doc   = 'Evaluates the receiver block and if it returns via a non-local-return'
00253 //     doc   = 'the protect block is invoked.'
00254 //     doc   = 'The original non-local-return continues after evaluation of the protect block.'
00255 //     flags = #(NLR)
00256 //     name  = 'unwindprotect' }
00257 //%
00258 
00259 PRIM_DECL_1(blockRepeat, oop receiver);
00260 //%prim
00261 // <BlockWithoutArguments> primitiveRepeat ^<BottomType> =
00262 //   Internal {
00263 //     doc   = 'Repeats evaluating the receiver block'
00264 //     flags = #(NLR)
00265 //     name  = 'blockRepeat' }
00266 //%
00267 
00268 PRIM_DECL_1(block_method, oop receiver);
00269 //%prim
00270 // <Block> primitiveBlockMethod ^<Method> =
00271 //   Internal {
00272 //     doc   = 'Returns the block method'
00273 //     name  = 'block_method' }
00274 //%
00275 
00276 PRIM_DECL_1(block_is_optimized, oop receiver);
00277 //%prim
00278 // <Block> primitiveBlockIsOptimized ^<Boolean> =
00279 //   Internal {
00280 //     doc   = 'Tells whether the block has optimized code'
00281 //     name  = 'block_is_optimized' }
00282 //%

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