00001 /* Copyright 1994, 1995 LongView Technologies L.L.C. $Revision: 1.21 $ */ 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 proxy 00025 00026 class proxyOopPrimitives : AllStatic { 00027 private: 00028 static void inc_calls() { number_of_calls++; } 00029 public: 00030 static int number_of_calls; 00031 00032 // Conversion 00033 00034 //%prim 00035 // <Proxy> primitiveProxyGetIfFail: failBlock <PrimFailBlock> ^<SmallInteger> = 00036 // Internal { error = #(ConversionFailed) 00037 // name = 'proxyOopPrimitives::getSmi' } 00038 //% 00039 static PRIM_DECL_1(getSmi, oop receiver); 00040 00041 //%prim 00042 // <Proxy> primitiveProxySet: value <SmallInteger|Proxy> 00043 // ifFail: failBlock <PrimFailBlock> ^<Self> = 00044 // Internal { name = 'proxyOopPrimitives::set' } 00045 //% 00046 static PRIM_DECL_2(set, oop receiver, oop value); 00047 00048 //%prim 00049 // <Proxy> primitiveProxySetHigh: high <SmallInteger> 00050 // low: low <SmallInteger> 00051 // ifFail: failBlock <PrimFailBlock> ^<Self> = 00052 // Internal { name = 'proxyOopPrimitives::setHighLow' } 00053 //% 00054 static PRIM_DECL_3(setHighLow, oop receiver, oop high, oop low); 00055 00056 //%prim 00057 // <Proxy> primitiveProxyGetHigh ^<SmallInteger> = 00058 // Internal { name = 'proxyOopPrimitives::getHigh' } 00059 //% 00060 static PRIM_DECL_1(getHigh, oop receiver); 00061 00062 //%prim 00063 // <Proxy> primitiveProxyGetLow ^<SmallInteger> = 00064 // Internal { name = 'proxyOopPrimitives::getLow' } 00065 //% 00066 static PRIM_DECL_1(getLow, oop receiver); 00067 00068 // Testing 00069 00070 //%prim 00071 // <Proxy> primitiveProxyIsNull ^<Boolean> = 00072 // Internal { name = 'proxyOopPrimitives::isNull' } 00073 //% 00074 static PRIM_DECL_1(isNull, oop receiver); 00075 00076 //%prim 00077 // <Proxy> primitiveProxyIsAllOnes ^<Boolean> = 00078 // Internal { name = 'proxyOopPrimitives::isAllOnes' } 00079 //% 00080 static PRIM_DECL_1(isAllOnes, oop receiver); 00081 00082 // Memory management 00083 00084 //%prim 00085 // <Proxy> primitiveProxyMalloc: size <SmallInteger> 00086 // ifFail: failBlock <PrimFailBlock> ^<Self> = 00087 // Internal { name = 'proxyOopPrimitives::malloc' } 00088 //% 00089 static PRIM_DECL_2(malloc, oop receiver, oop size); 00090 00091 //%prim 00092 // <Proxy> primitiveProxyCalloc: size <SmallInteger> 00093 // ifFail: failBlock <PrimFailBlock> ^<Self> = 00094 // Internal { name = 'proxyOopPrimitives::calloc' } 00095 //% 00096 static PRIM_DECL_2(calloc, oop receiver, oop size); 00097 00098 //%prim 00099 // <Proxy> primitiveProxyFree ^<Self> = 00100 // Internal { name = 'proxyOopPrimitives::free' } 00101 //% 00102 static PRIM_DECL_1(free, oop receiver); 00103 00104 // The remaining primitives are used for 00105 // dereferencing the proxy value. 00106 00107 // Byte 00108 00109 //%prim 00110 // <Proxy> primitiveProxyByteAt: offset <SmallInteger> 00111 // ifFail: failBlock <PrimFailBlock> ^<SmallInteger> = 00112 // Internal { flags = #(LastDeltaFrameNotNeeded) 00113 // name = 'proxyOopPrimitives::byteAt' } 00114 //% 00115 static PRIM_DECL_2(byteAt, oop receiver, oop offset); 00116 00117 //%prim 00118 // <Proxy> primitiveProxyByteAt: offset <SmallInteger> 00119 // put: value <SmallInteger> 00120 // ifFail: failBlock <PrimFailBlock> ^<SmallInteger> = 00121 // Internal { flags = #(LastDeltaFrameNotNeeded) 00122 // name = 'proxyOopPrimitives::byteAtPut' } 00123 //% 00124 static PRIM_DECL_3(byteAtPut, oop receiver, oop offset, oop value); 00125 00126 // Double byte 00127 00128 //%prim 00129 // <Proxy> primitiveProxyDoubleByteAt: offset <SmallInteger> 00130 // ifFail: failBlock <PrimFailBlock> ^<SmallInteger> = 00131 // Internal { name = 'proxyOopPrimitives::doubleByteAt' } 00132 //% 00133 static PRIM_DECL_2(doubleByteAt, oop receiver, oop offset); 00134 00135 //%prim 00136 // <Proxy> primitiveProxyDoubleByteAt: offset <SmallInteger> 00137 // put: value <SmallInteger> 00138 // ifFail: failBlock <PrimFailBlock> ^<SmallInteger> = 00139 // Internal { name = 'proxyOopPrimitives::doubleByteAtPut' } 00140 //% 00141 static PRIM_DECL_3(doubleByteAtPut, oop receiver, oop offset, oop value); 00142 00143 // Smi 00144 00145 //%prim 00146 // <Proxy> primitiveProxySmiAt: offset <SmallInteger> 00147 // ifFail: failBlock <PrimFailBlock> ^<SmallInteger> = 00148 // Internal { error = #(ConversionFailed) 00149 // name = 'proxyOopPrimitives::smiAt' } 00150 //% 00151 static PRIM_DECL_2(smiAt, oop receiver, oop offset); 00152 00153 //%prim 00154 // <Proxy> primitiveProxySmiAt: offset <SmallInteger> 00155 // put: value <SmallInteger> 00156 // ifFail: failBlock <PrimFailBlock> ^<SmallInteger> = 00157 // Internal { name = 'proxyOopPrimitives::smiAtPut' } 00158 //% 00159 static PRIM_DECL_3(smiAtPut, oop receiver, oop offset, oop value); 00160 00161 // Proxy 00162 00163 //%prim 00164 // <Proxy> primitiveProxySubProxyAt: offset <SmallInteger> 00165 // result: result <Proxy> 00166 // ifFail: failBlock <PrimFailBlock> ^<Proxy> = 00167 // Internal { name = 'proxyOopPrimitives::subProxyAt' } 00168 //% 00169 static PRIM_DECL_3(subProxyAt, oop receiver, oop offset, oop result); 00170 00171 //%prim 00172 // <Proxy> primitiveProxyProxyAt: offset <SmallInteger> 00173 // result: result <Proxy> 00174 // ifFail: failBlock <PrimFailBlock> ^<Proxy> = 00175 // Internal { name = 'proxyOopPrimitives::proxyAt' } 00176 //% 00177 static PRIM_DECL_3(proxyAt, oop receiver, oop offset, oop result); 00178 00179 //%prim 00180 // <Proxy> primitiveProxyProxyAt: offset <SmallInteger> 00181 // put: value <Proxy> 00182 // ifFail: failBlock <PrimFailBlock> ^<Proxy> = 00183 // Internal { name = 'proxyOopPrimitives::proxyAtPut' } 00184 //% 00185 static PRIM_DECL_3(proxyAtPut, oop receiver, oop offset, oop value); 00186 00187 // Single precision floats 00188 00189 //%prim 00190 // <Proxy> primitiveProxySinglePrecisionFloatAt: offset <SmallInteger> 00191 // ifFail: failBlock <PrimFailBlock> ^<Float> = 00192 // Internal { name = 'proxyOopPrimitives::singlePrecisionFloatAt' } 00193 //% 00194 static PRIM_DECL_2(singlePrecisionFloatAt, oop receiver, oop offset); 00195 00196 //%prim 00197 // <Proxy> primitiveProxySinglePrecisionFloatAt: offset <SmallInteger> 00198 // put: value <Float> 00199 // ifFail: failBlock <PrimFailBlock> ^<Self> = 00200 // Internal { error = #(ConversionFailed) 00201 // name = 'proxyOopPrimitives::singlePrecisionFloatAtPut' } 00202 //% 00203 static PRIM_DECL_3(singlePrecisionFloatAtPut, oop receiver, oop offset, oop value); 00204 00205 // Double precision floats 00206 00207 //%prim 00208 // <Proxy> primitiveProxyDoublePrecisionFloatAt: offset <SmallInteger> 00209 // ifFail: failBlock <PrimFailBlock> ^<Float> = 00210 // Internal { name = 'proxyOopPrimitives::doublePrecisionFloatAt' } 00211 //% 00212 static PRIM_DECL_2(doublePrecisionFloatAt, oop receiver, oop offset); 00213 00214 //%prim 00215 // <Proxy> primitiveProxyDoublePrecisionFloatAt: offset <SmallInteger> 00216 // put: value <Float> 00217 // ifFail: failBlock <PrimFailBlock> ^<Self> = 00218 // Internal { error = #(ConversionFailed) 00219 // name = 'proxyOopPrimitives::doublePrecisionFloatAtPut' } 00220 //% 00221 static PRIM_DECL_3(doublePrecisionFloatAtPut, oop receiver, oop offset, oop value); 00222 00223 // API Calls through proxies 00224 00225 //%prim 00226 // <Proxy> primitiveAPICallResult: proxy <Proxy> 00227 // ifFail: failBlock <PrimFailBlock> ^<Proxy> = 00228 // Internal { flags = #NLR 00229 // name = 'proxyOopPrimitives::callOut0' } 00230 //% 00231 static PRIM_DECL_2(callOut0, oop receiver, oop result); 00232 00233 //%prim 00234 // <Proxy> primitiveAPICallValue: arg1 <Proxy|SmallInteger> 00235 // result: proxy <Proxy> 00236 // ifFail: failBlock <PrimFailBlock> ^<Proxy> = 00237 // Internal { flags = #NLR 00238 // name = 'proxyOopPrimitives::callOut1' } 00239 //% 00240 static PRIM_DECL_3(callOut1, oop receiver, oop arg1, oop result); 00241 00242 //%prim 00243 // <Proxy> primitiveAPICallValue: arg1 <Proxy|SmallInteger> 00244 // value: arg2 <Proxy|SmallInteger> 00245 // result: proxy <Proxy> 00246 // ifFail: failBlock <PrimFailBlock> ^<Proxy> = 00247 // Internal { flags = #NLR 00248 // name = 'proxyOopPrimitives::callOut2' } 00249 //% 00250 static PRIM_DECL_4(callOut2, oop receiver, oop arg1, oop arg2, oop result); 00251 00252 //%prim 00253 // <Proxy> primitiveAPICallValue: arg1 <Proxy|SmallInteger> 00254 // value: arg2 <Proxy|SmallInteger> 00255 // value: arg3 <Proxy|SmallInteger> 00256 // result: proxy <Proxy> 00257 // ifFail: failBlock <PrimFailBlock> ^<Proxy> = 00258 // Internal { flags = #NLR 00259 // name = 'proxyOopPrimitives::callOut3' } 00260 //% 00261 static PRIM_DECL_5(callOut3, oop receiver, oop arg1, oop arg2, oop arg3, oop result); 00262 00263 //%prim 00264 // <Proxy> primitiveAPICallValue: arg1 <Proxy|SmallInteger> 00265 // value: arg2 <Proxy|SmallInteger> 00266 // value: arg3 <Proxy|SmallInteger> 00267 // value: arg4 <Proxy|SmallInteger> 00268 // result: proxy <Proxy> 00269 // ifFail: failBlock <PrimFailBlock> ^<Proxy> = 00270 // Internal { flags = #NLR 00271 // name = 'proxyOopPrimitives::callOut4' } 00272 //% 00273 static PRIM_DECL_6(callOut4, oop receiver, oop arg1, oop arg2, oop arg3, oop arg4, oop result); 00274 00275 //%prim 00276 // <Proxy> primitiveAPICallValue: arg1 <Proxy|SmallInteger> 00277 // value: arg2 <Proxy|SmallInteger> 00278 // value: arg3 <Proxy|SmallInteger> 00279 // value: arg4 <Proxy|SmallInteger> 00280 // value: arg5 <Proxy|SmallInteger> 00281 // result: proxy <Proxy> 00282 // ifFail: failBlock <PrimFailBlock> ^<Proxy> = 00283 // Internal { flags = #NLR 00284 // name = 'proxyOopPrimitives::callOut5' } 00285 //% 00286 static PRIM_DECL_7(callOut5, oop receiver, oop arg1, oop arg2, oop arg3, oop arg4, oop arg5, oop result); 00287 00288 00289 };