00001 /* Copyright 1994 - 1996 LongView Technologies L.L.C. $Revision: 1.25 $ */ 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 doubles 00025 // 00026 // alias PrimFailBlock : <[Symbol, ^BottomType]> 00027 00028 class doubleOopPrimitives : AllStatic { 00029 private: 00030 static void inc_calls() { number_of_calls++; } 00031 public: 00032 static int number_of_calls; 00033 00034 //%prim 00035 // <Float> primitiveFloatLessThan: aNumber <Float> 00036 // ifFail: failBlock <PrimFailBlock> ^<Boolean> = 00037 // Internal { doc = 'Returns whether the receiver is less than the argument' 00038 // flags = #(Pure DoubleCompare LastDeltaFrameNotNeeded) 00039 // name = 'doubleOopPrimitives::lessThan' } 00040 //% 00041 static PRIM_DECL_2(lessThan, oop receiver, oop argument); 00042 00043 //%prim 00044 // <Float> primitiveFloatGreaterThan: aNumber <Float> 00045 // ifFail: failBlock <PrimFailBlock> ^<Boolean> = 00046 // Internal { doc = 'Returns whether the receiver is greater than the argument' 00047 // flags = #(Pure DoubleCompare LastDeltaFrameNotNeeded) 00048 // name = 'doubleOopPrimitives::greaterThan' } 00049 //% 00050 static PRIM_DECL_2(greaterThan, oop receiver, oop argument); 00051 00052 //%prim 00053 // <Float> primitiveFloatLessThanOrEqual: aNumber <Float> 00054 // ifFail: failBlock <PrimFailBlock> ^<Boolean> = 00055 // Internal { doc = 'Returns whether the receiver is less than or equal to the argument' 00056 // flags = #(Pure DoubleCompare LastDeltaFrameNotNeeded) 00057 // name = 'doubleOopPrimitives::lessThanOrEqual' } 00058 //% 00059 static PRIM_DECL_2(lessThanOrEqual, oop receiver, oop argument); 00060 00061 //%prim 00062 // <Float> primitiveFloatGreaterThanOrEqual: aNumber <Float> 00063 // ifFail: failBlock <PrimFailBlock> ^<Boolean> = 00064 // Internal { doc = 'Returns whether the receiver is greater than or equal to the argument' 00065 // flags = #(Pure DoubleCompare LastDeltaFrameNotNeeded) 00066 // name = 'doubleOopPrimitives::greaterThanOrEqual' } 00067 //% 00068 static PRIM_DECL_2(greaterThanOrEqual, oop receiver, oop argument); 00069 00070 //%prim 00071 // <Float> primitiveFloatEqual: aNumber <Float> 00072 // ifFail: failBlock <PrimFailBlock> ^<Boolean> = 00073 // Internal { doc = 'Returns whether the receiver is equal to the argument' 00074 // flags = #(Pure DoubleCompare LastDeltaFrameNotNeeded) 00075 // name = 'doubleOopPrimitives::equal' } 00076 //% 00077 static PRIM_DECL_2(equal, oop receiver, oop argument); 00078 00079 //%prim 00080 // <Float> primitiveFloatNotEqual: aNumber <Float> 00081 // ifFail: failBlock <PrimFailBlock> ^<Boolean> = 00082 // Internal { doc = 'Returns whether the receiver is not equal to the argument' 00083 // flags = #(Pure DoubleCompare LastDeltaFrameNotNeeded) 00084 // name = 'doubleOopPrimitives::notEqual' } 00085 //% 00086 static PRIM_DECL_2(notEqual, oop receiver, oop argument); 00087 00088 //%prim 00089 // <Float> primitiveFloatMod: aNumber <Float> 00090 // ifFail: failBlock <PrimFailBlock> ^<Float> = 00091 // Internal { doc = 'Returns the result of dividing the receiver by the argument' 00092 // flags = #(Pure DoubleArith) 00093 // name = 'doubleOopPrimitives::mod' } 00094 //% 00095 static PRIM_DECL_2(mod, oop receiver, oop argument); 00096 00097 //%prim 00098 // <Float> primitiveFloatCosine ^<Float> = 00099 // Internal { doc = 'Returns the cosine of the receiver' 00100 // flags = #(Pure DoubleArith) 00101 // name = 'doubleOopPrimitives::cosine' } 00102 //% 00103 static PRIM_DECL_1(cosine, oop receiver); 00104 00105 //%prim 00106 // <Float> primitiveFloatSine ^<Float> = 00107 // Internal { doc = 'Returns the sine of the receiver' 00108 // flags = #(Pure DoubleArith) 00109 // name = 'doubleOopPrimitives::sine' } 00110 //% 00111 static PRIM_DECL_1(sine, oop receiver); 00112 00113 //%prim 00114 // <Float> primitiveFloatTangentIfFail: failBlock <PrimFailBlock> ^<Float> = 00115 // Internal { doc = 'Returns the tangent of the receiver' 00116 // flags = #(Pure DoubleArith) 00117 // name = 'doubleOopPrimitives::tangent' } 00118 //% 00119 static PRIM_DECL_1(tangent, oop receiver); 00120 00121 //%prim 00122 // <Float> primitiveFloatArcCosineIfFail: failBlock <PrimFailBlock> ^<Float> = 00123 // Internal { doc = 'Returns the arc-cosine of the receiver' 00124 // flags = #(Pure DoubleArith) 00125 // name = 'doubleOopPrimitives::arcCosine' } 00126 //% 00127 static PRIM_DECL_1(arcCosine, oop receiver); 00128 00129 //%prim 00130 // <Float> primitiveFloatArcSineIfFail: failBlock <PrimFailBlock> ^<Float> = 00131 // Internal { doc = 'Returns the arc-sine of the receiver' 00132 // flags = #(Pure DoubleArith) 00133 // name = 'doubleOopPrimitives::arcSine' } 00134 //% 00135 static PRIM_DECL_1(arcSine, oop receiver); 00136 00137 //%prim 00138 // <Float> primitiveFloatArcTangentIfFail: failBlock <PrimFailBlock> ^<Float> = 00139 // Internal { doc = 'Returns the arc-tangent of the receiver' 00140 // flags = #(Pure DoubleArith) 00141 // name = 'doubleOopPrimitives::arcTangent' } 00142 //% 00143 static PRIM_DECL_1(arcTangent, oop receiver); 00144 00145 //%prim 00146 // <Float> primitiveFloatHyperbolicCosineIfFail: failBlock <PrimFailBlock> ^<Float> = 00147 // Internal { doc = 'Returns the hyperbolic-cosine of the receiver' 00148 // flags = #(Pure DoubleArith) 00149 // name = 'doubleOopPrimitives::hyperbolicCosine' } 00150 //% 00151 static PRIM_DECL_1(hyperbolicCosine, oop receiver); 00152 00153 //%prim 00154 // <Float> primitiveFloatHyperbolicSineIfFail: failBlock <PrimFailBlock> ^<Float> = 00155 // Internal { doc = 'Returns the hyperbolic-sine of the receiver' 00156 // flags = #(Pure DoubleArith) 00157 // name = 'doubleOopPrimitives::hyperbolicSine' } 00158 //% 00159 static PRIM_DECL_1(hyperbolicSine, oop receiver); 00160 00161 //%prim 00162 // <Float> primitiveFloatHyperbolicTangentIfFail: failBlock <PrimFailBlock> ^<Float> = 00163 // Internal { doc = 'Returns the hyperbolic-tangent of the receiver' 00164 // flags = #(Pure DoubleArith) 00165 // name = 'doubleOopPrimitives::hyperbolicTangent' } 00166 //% 00167 static PRIM_DECL_1(hyperbolicTangent, oop receiver); 00168 00169 //%prim 00170 // <Float> primitiveFloatSqrtIfFail: failBlock <PrimFailBlock> ^<Float> = 00171 // Internal { doc = 'Returns the square root of the receiver' 00172 // error = #(ReceiverNegative) 00173 // flags = #(Pure DoubleArith) 00174 // name = 'doubleOopPrimitives::sqrt' } 00175 //% 00176 static PRIM_DECL_1(sqrt, oop receiver); 00177 00178 //%prim 00179 // <Float> primitiveFloatSquared ^<Float> = 00180 // Internal { doc = 'Returns the result of multiplying the receiver by it self' 00181 // flags = #(Pure DoubleArith) 00182 // name = 'doubleOopPrimitives::squared' } 00183 //% 00184 static PRIM_DECL_1(squared, oop receiver); 00185 00186 //%prim 00187 // <Float> primitiveFloatLnIfFail: failBlock <PrimFailBlock> ^<Float> = 00188 // Internal { doc = 'Returns the logarithm of the receiver' 00189 // error = #(ReceiverNotStrictlyPositive) 00190 // flags = #(Pure DoubleArith) 00191 // name = 'doubleOopPrimitives::ln' } 00192 //% 00193 static PRIM_DECL_1(ln, oop receiver); 00194 00195 //%prim 00196 // <Float> primitiveFloatExp ^<Float> = 00197 // Internal { doc = 'Returns the exponential value of the receiver' 00198 // flags = #(Pure DoubleArith) 00199 // name = 'doubleOopPrimitives::exp' } 00200 //% 00201 static PRIM_DECL_1(exp, oop receiver); 00202 00203 //%prim 00204 // <Float> primitiveFloatLog10IfFail: failBlock <PrimFailBlock> ^<Float> = 00205 // Internal { doc = 'Returns the base 10 logarithm of the receiver' 00206 // error = #(ReceiverNotStrictlyPositive) 00207 // flags = #(Pure DoubleArith) 00208 // name = 'doubleOopPrimitives::log10' } 00209 //% 00210 static PRIM_DECL_1(log10, oop receiver); 00211 00212 //%prim 00213 // <Float> primitiveFloatIsNan ^<Boolean> = 00214 // Internal { doc = 'Returns whether the receiver is NaN (Not a Number)' 00215 // flags = #(Pure DoubleArith) 00216 // name = 'doubleOopPrimitives::isNan' } 00217 //% 00218 static PRIM_DECL_1(isNan, oop receiver); 00219 00220 //%prim 00221 // <Float> primitiveFloatIsFinite ^<Boolean> = 00222 // Internal { doc = 'Returns whether the receiver is finite (not NaN)' 00223 // flags = #(Pure DoubleArith) 00224 // name = 'doubleOopPrimitives::isFinite' } 00225 //% 00226 static PRIM_DECL_1(isFinite, oop receiver); 00227 00228 //%prim 00229 // <Float> primitiveFloatFloor ^<Float> = 00230 // Internal { doc = 'Returns the largest integral Float that is less than or equal to the receiver' 00231 // flags = #(Pure DoubleArith) 00232 // name = 'doubleOopPrimitives::floor' } 00233 //% 00234 static PRIM_DECL_1(floor, oop receiver); 00235 00236 //%prim 00237 // <Float> primitiveFloatSmallIntegerFloorIfFail: failBlock <PrimFailBlock> ^<SmallInteger> = 00238 // Internal { doc = 'Returns the largest SmallInteger that is less than or equal to the receiver' 00239 // flags = #(Pure DoubleArith LastDeltaFrameNotNeeded) 00240 // error = #(ConversionFailed) 00241 // name = 'doubleOopPrimitives::smi_floor' } 00242 //% 00243 static PRIM_DECL_1(smi_floor, oop receiver); 00244 00245 //%prim 00246 // <Float> primitiveFloatCeiling ^<Float> = 00247 // Internal { doc = 'Returns the smallest integral Float that is greater than or equal to the receiver' 00248 // flags = #(Pure DoubleArith) 00249 // name = 'doubleOopPrimitives::ceiling' } 00250 //% 00251 static PRIM_DECL_1(ceiling, oop receiver); 00252 00253 //%prim 00254 // <Float> primitiveFloatExponent ^<SmallInteger> = 00255 // Internal { doc = 'Returns the exponent part of the receiver' 00256 // flags = #(Pure DoubleArith) 00257 // name = 'doubleOopPrimitives::exponent' } 00258 //% 00259 static PRIM_DECL_1(exponent, oop receiver); 00260 00261 //%prim 00262 // <Float> primitiveFloatMantissa ^<Float> = 00263 // Internal { doc = 'Returns the mantissa part of the receiver' 00264 // flags = #(Pure DoubleArith) 00265 // name = 'doubleOopPrimitives::mantissa' } 00266 //% 00267 static PRIM_DECL_1(mantissa, oop receiver); 00268 00269 //%prim 00270 // <Float> primitiveFloatTruncated ^<Float> = 00271 // Internal { doc = 'Returns the receiver truncated' 00272 // flags = #(Pure DoubleArith) 00273 // name = 'doubleOopPrimitives::truncated' } 00274 //% 00275 static PRIM_DECL_1(truncated, oop receiver); 00276 00277 //%prim 00278 // <Float> primitiveFloatTimesTwoPower: aNumber <SmallInteger> 00279 // ifFail: failBlock <PrimFailBlock> ^<Float> = 00280 // Internal { doc = 'Returns the receiver multiplied with 2 to the power of aNumber' 00281 // error = #(RangeError) 00282 // flags = #(Pure DoubleArith) 00283 // name = 'doubleOopPrimitives::timesTwoPower' } 00284 //% 00285 static PRIM_DECL_2(timesTwoPower, oop receiver, oop argument); 00286 00287 //%prim 00288 // <Float> primitiveFloatRoundedAsSmallIntegerIfFail: failBlock <PrimFailBlock> ^<SmallInteger> = 00289 // Internal { doc = 'Returns the receiver converted to a SmallInteger' 00290 // error = #(SmallIntegerConversionFailed) 00291 // flags = #(Pure DoubleArith) 00292 // name = 'doubleOopPrimitives::roundedAsSmallInteger' } 00293 //% 00294 static PRIM_DECL_1(roundedAsSmallInteger, oop receiver); 00295 00296 //%prim 00297 // <Float> primitiveFloatAsSmallIntegerIfFail: failBlock <PrimFailBlock> ^<SmallInteger> = 00298 // Internal { doc = 'Returns the receiver as a SmallInteger' 00299 // error = #(SmallIntegerConversionFailed) 00300 // flags = #(Pure DoubleArith) 00301 // name = 'doubleOopPrimitives::asSmallInteger' } 00302 //% 00303 static PRIM_DECL_1(asSmallInteger, oop receiver); 00304 00305 //%prim 00306 // <Float> primitiveFloatPrintFormat: format <IndexedByteInstanceVariables> 00307 // ifFail: failBlock <PrimFailBlock> ^<Self> = 00308 // Internal { doc = 'Prints the receiver using the format and returns the recever' 00309 // flags = #Function 00310 // name = 'doubleOopPrimitives::printFormat' } 00311 //% 00312 static PRIM_DECL_2(printFormat, oop receiver, oop argument); 00313 00314 //%prim 00315 // <Float> primitiveFloatPrintString ^<IndexedByteInstanceVariables> = 00316 // Internal { doc = 'Returns the print string for the receiver' 00317 // flags = #Function 00318 // name = 'doubleOopPrimitives::printString' } 00319 //% 00320 static PRIM_DECL_1(printString, oop receiver); 00321 00322 //%prim 00323 // <NoReceiver> primitiveFloatMaxValue ^<Float> = 00324 // Internal { doc = 'Returns the maximum Float value' 00325 // flags = #(Pure) 00326 // name = 'doubleOopPrimitives::min_positive_value' } 00327 //% 00328 static PRIM_DECL_0(max_value); 00329 00330 //%prim 00331 // <NoReceiver> primitiveFloatMinPositiveValue ^<Float> = 00332 // Internal { doc = 'Returns the minimum positive Float value' 00333 // flags = #(Pure) 00334 // name = 'doubleOopPrimitives::min_positive_value' } 00335 //% 00336 static PRIM_DECL_0(min_positive_value); 00337 00338 //%prim 00339 // <Float> primitiveFloatStoreString ^<ByteArray> = 00340 // Internal { flags = #(Function) 00341 // name = 'doubleOopPrimitives::store_string' } 00342 //% 00343 static PRIM_DECL_1(store_string, oop receiver); 00344 00345 //%prim 00346 // <NoReceiver> primitiveMandelbrotAtRe: re <Float> 00347 // im: im <Float> 00348 // iterate: n <SmallInteger> 00349 // ifFail: failBlock <PrimFailBlock> ^<SmallInteger> = 00350 // Internal { doc = 'Returns no. of iterations used for Mandelbrot value at (re, im)' 00351 // flags = #(Pure LastDeltaFrameNotNeeded) 00352 // name = 'doubleOopPrimitives::mandelbrot' } 00353 //% 00354 static PRIM_DECL_3(mandelbrot, oop re, oop im, oop n); 00355 }; 00356 00357 //%prim 00358 // <Float> primitiveFloatSubtract: aNumber <Float> 00359 // ifFail: failBlock <PrimFailBlock> ^<Float> = 00360 // Internal { doc = 'Returns the result of subtracting the argument from the receiver' 00361 // flags = #(Pure DoubleArith LastDeltaFrameNotNeeded) 00362 // name = 'double_subtract' } 00363 //% 00364 extern "C" oop double_subtract(oop receiver, oop argument); 00365 00366 //%prim 00367 // <Float> primitiveFloatDivide: aNumber <Float> 00368 // ifFail: failBlock <PrimFailBlock> ^<Float> = 00369 // Internal { doc = 'Returns the modulus of the receiver by the argument' 00370 // flags = #(Pure DoubleArith LastDeltaFrameNotNeeded) 00371 // name = 'double_divide' } 00372 //% 00373 extern "C" oop double_divide(oop receiver, oop argument); 00374 00375 //%prim 00376 // <Float> primitiveFloatAdd: aNumber <Float> 00377 // ifFail: failBlock <PrimFailBlock> ^<Float> = 00378 // Internal { doc = 'Returns the sum of the receiver and the argument' 00379 // flags = #(Pure DoubleArith LastDeltaFrameNotNeeded) 00380 // name = 'double_add' } 00381 //% 00382 extern "C" oop double_add(oop receiver, oop argument); 00383 00384 //%prim 00385 // <Float> primitiveFloatMultiply: aNumber <Float> 00386 // ifFail: failBlock <PrimFailBlock> ^<Float> = 00387 // Internal { doc = 'Returns the multiply of the receiver and the argument' 00388 // flags = #(Pure DoubleArith LastDeltaFrameNotNeeded) 00389 // name = 'double_multiply' } 00390 //% 00391 extern "C" oop double_multiply(oop receiver, oop argument); 00392