00001 /* Copyright 1994 - 1996 LongView Technologies L.L.C. $Revision: 1.24 $ */ 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 // Primitives for byte arrays 00026 00027 class byteArrayPrimitives : AllStatic { 00028 private: 00029 static void inc_calls() { number_of_calls++; } 00030 public: 00031 static int number_of_calls; 00032 00033 //%prim 00034 // <IndexedByteInstanceVariables class> 00035 // primitiveIndexedByteNew: size <SmallInteger> 00036 // ifFail: failBlock <PrimFailBlock> ^<Object> = 00037 // Internal { error = #(NegativeSize) 00038 // flags = #(Allocate) 00039 // name = 'byteArrayPrimitives::allocateSize' } 00040 //% 00041 static PRIM_DECL_2(allocateSize, oop receiver, oop argument); 00042 00043 //%prim 00044 // <IndexedByteInstanceVariables> 00045 // primitiveIndexedByteSize ^<SmallInteger> = 00046 // Internal { flags = #(Pure IndexedByte) 00047 // name = 'byteArrayPrimitives::size' } 00048 //% 00049 static PRIM_DECL_1(size, oop receiver); 00050 00051 //%prim 00052 // <IndexedByteInstanceVariables> 00053 // primitiveIndexedByteAt: index <SmallInteger> 00054 // ifFail: failBlock <PrimFailBlock> ^<SmallInteger> = 00055 // Internal { error = #(OutOfBounds) 00056 // flags = #(Function IndexedByte) 00057 // name = 'byteArrayPrimitives::at' } 00058 //% 00059 static PRIM_DECL_2(at, oop receiver, oop index); 00060 00061 //%prim 00062 // <IndexedByteInstanceVariables> 00063 // primitiveIndexedByteAt: index <SmallInteger> 00064 // put: c <SmallInteger> 00065 // ifFail: failBlock <PrimFailBlock> ^<SmallInteger> = 00066 // Internal { error = #(OutOfBounds ValueOutOfBounds) 00067 // flags = #(Function IndexedByte) 00068 // name = 'byteArrayPrimitives::atPut' } 00069 //% 00070 static PRIM_DECL_3(atPut, oop receiver, oop index, oop value); 00071 00072 //%prim 00073 // <IndexedByteInstanceVariables> 00074 // primitiveIndexedByteCompare: index <String> 00075 // ifFail: failBlock <PrimFailBlock> ^<SmallInteger> = 00076 // Internal { name = 'byteArrayPrimitives::compare' } 00077 //% 00078 static PRIM_DECL_2(compare, oop receiver, oop argument); 00079 00080 //%prim 00081 // <IndexedByteInstanceVariables> 00082 // primitiveIndexedByteInternIfFail: failBlock <PrimFailBlock> ^<CompressedSymbol> = 00083 // Internal { error = #(ValueOutOfBounds) 00084 // name = 'byteArrayPrimitives::intern' } 00085 //% 00086 static PRIM_DECL_1(intern, oop receiver); 00087 00088 //%prim 00089 // <IndexedByteInstanceVariables> 00090 // primitiveIndexedByteCharacterAt: index <SmallInteger> 00091 // ifFail: failBlock <PrimFailBlock> ^<SmallInteger> = 00092 // Internal { error = #(OutOfBounds) 00093 // flags = #(Function IndexedByte) 00094 // name = 'byteArrayPrimitives::characterAt' } 00095 //% 00096 static PRIM_DECL_2(characterAt, oop receiver, oop index); 00097 00098 //%prim 00099 // <IndexedByteInstanceVariables> 00100 // primitiveIndexedByteAtAllPut: c <SmallInteger> 00101 // ifFail: failBlock <PrimFailBlock> ^<Self> = 00102 // Internal { name = 'byteArrayPrimitives::at_all_put' } 00103 //% 00104 static PRIM_DECL_2(at_all_put, oop receiver, oop c); 00105 00106 00107 // SUPPORT FOR LARGE INTEGER 00108 00109 //%prim 00110 // <IndexedByteInstanceVariables class> 00111 // primitiveIndexedByteLargeIntegerFromSmallInteger: number <SmallInteger> 00112 // ifFail: failBlock <PrimFailBlock> ^<IndexedByteInstanceVariables> = 00113 // Internal { flags = #(Function) 00114 // name = 'byteArrayPrimitives::largeIntegerFromSmallInteger' } 00115 //% 00116 static PRIM_DECL_2(largeIntegerFromSmallInteger, oop receiver, oop number); 00117 00118 //%prim 00119 // <IndexedByteInstanceVariables class> 00120 // primitiveIndexedByteLargeIntegerFromFloat: number <Float> 00121 // ifFail: failBlock <PrimFailBlock> ^<IndexedByteInstanceVariables> = 00122 // Internal { flags = #(Function) 00123 // name = 'byteArrayPrimitives::largeIntegerFromDouble' } 00124 //% 00125 static PRIM_DECL_2(largeIntegerFromDouble, oop receiver, oop number); 00126 00127 //%prim 00128 // <IndexedByteInstanceVariables class> 00129 // primitiveIndexedByteLargeIntegerFromString: argument <String> 00130 // base: base <Integer> 00131 // ifFail: failBlock <PrimFailBlock> ^<IndexedByteInstanceVariables> = 00132 // Internal { error = #(ConversionFailed) 00133 // flags = #(Function IndexedByte) 00134 // name = 'byteArrayPrimitives::largeIntegerFromString' } 00135 //% 00136 static PRIM_DECL_3(largeIntegerFromString, oop receiver, oop argument, oop base); 00137 00138 //%prim 00139 // <IndexedByteInstanceVariables> 00140 // primitiveIndexedByteLargeIntegerAdd: argument <IndexedByteInstanceVariables> 00141 // ifFail: failBlock <PrimFailBlock> ^<IndexedByteInstanceVariables|SmallInteger> = 00142 // Internal { error = #(ArgumentIsInvalid) 00143 // flags = #(Function IndexedByte) 00144 // name = 'byteArrayPrimitives::largeIntegerAdd' } 00145 //% 00146 static PRIM_DECL_2(largeIntegerAdd, oop receiver, oop argument); 00147 00148 //%prim 00149 // <IndexedByteInstanceVariables> 00150 // primitiveIndexedByteLargeIntegerSubtract: argument <IndexedByteInstanceVariables> 00151 // ifFail: failBlock <PrimFailBlock> ^<IndexedByteInstanceVariables|SmallInteger> = 00152 // Internal { error = #(ArgumentIsInvalid) 00153 // flags = #(Function IndexedByte) 00154 // name = 'byteArrayPrimitives::largeIntegerSubtract' } 00155 //% 00156 static PRIM_DECL_2(largeIntegerSubtract, oop receiver, oop argument); 00157 00158 //%prim 00159 // <IndexedByteInstanceVariables> 00160 // primitiveIndexedByteLargeIntegerMultiply: argument <IndexedByteInstanceVariables> 00161 // ifFail: failBlock <PrimFailBlock> ^<IndexedByteInstanceVariables|SmallInteger> = 00162 // Internal { error = #(ArgumentIsInvalid) 00163 // flags = #(Function IndexedByte) 00164 // name = 'byteArrayPrimitives::largeIntegerMultiply' } 00165 //% 00166 static PRIM_DECL_2(largeIntegerMultiply, oop receiver, oop argument); 00167 00168 //%prim 00169 // <IndexedByteInstanceVariables> 00170 // primitiveIndexedByteLargeIntegerDiv: argument <IndexedByteInstanceVariables> 00171 // ifFail: failBlock <PrimFailBlock> ^<IndexedByteInstanceVariables|SmallInteger> = 00172 // Internal { error = #(ArgumentIsInvalid DivisionByZero) 00173 // flags = #(Function IndexedByte) 00174 // name = 'byteArrayPrimitives::largeIntegerDiv' } 00175 //% 00176 static PRIM_DECL_2(largeIntegerDiv, oop receiver, oop argument); 00177 00178 00179 //%prim 00180 // <IndexedByteInstanceVariables> 00181 // primitiveIndexedByteLargeIntegerMod: argument <IndexedByteInstanceVariables> 00182 // ifFail: failBlock <PrimFailBlock> ^<IndexedByteInstanceVariables|SmallInteger> = 00183 // Internal { error = #(ArgumentIsInvalid DivisionByZero) 00184 // flags = #(Function IndexedByte) 00185 // name = 'byteArrayPrimitives::largeIntegerMod' } 00186 //% 00187 static PRIM_DECL_2(largeIntegerMod, oop receiver, oop argument); 00188 00189 //%prim 00190 // <IndexedByteInstanceVariables> 00191 // primitiveIndexedByteLargeIntegerCompare: argument <IndexedByteInstanceVariables> 00192 // ifFail: failBlock <PrimFailBlock> ^<SmallInteger> = 00193 // Internal { flags = #(Function IndexedByte) 00194 // name = 'byteArrayPrimitives::largeIntegerCompare' } 00195 //% 00196 static PRIM_DECL_2(largeIntegerCompare, oop receiver, oop argument); 00197 00198 //%prim 00199 // <IndexedByteInstanceVariables> 00200 // primitiveIndexedByteLargeIntegerAsFloatIfFail: failBlock <PrimFailBlock> ^<Float> = 00201 // Internal { flags = #(Function IndexedByte) 00202 // name = 'byteArrayPrimitives::largeIntegerToFloat' } 00203 //% 00204 static PRIM_DECL_1(largeIntegerToFloat, oop receiver); 00205 00206 //%prim 00207 // <IndexedByteInstanceVariables> 00208 // primitiveIndexedByteLargeIntegerToStringBase: base <SmallInteger> 00209 // ifFail: failBlock <PrimFailBlock> ^<String> = 00210 // Internal { flags = #(Function IndexedByte) 00211 // name = 'byteArrayPrimitives::largeIntegerToString' } 00212 //% 00213 static PRIM_DECL_2(largeIntegerToString, oop receiver, oop base); 00214 00215 //%prim 00216 // <IndexedByteInstanceVariables> 00217 // primitiveIndexedByteHash ^<SmallInteger> = 00218 // Internal { flags = #(Pure IndexedByte) 00219 // name = 'byteArrayPrimitives::hash' } 00220 //% 00221 static PRIM_DECL_1(hash, oop receiver); 00222 }; 00223