00001 /* Copyright 1994, 1995 LongView Technologies L.L.C. $Revision: 1.16 $ */ 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 methods 00025 00026 class methodOopPrimitives : AllStatic { 00027 private: 00028 static void inc_calls() { number_of_calls++; } 00029 public: 00030 static int number_of_calls; 00031 00032 //%prim 00033 // <Method> primitiveMethodSelector ^<Symbol> = 00034 // Internal { name = 'methodOopPrimitives::selector' } 00035 //% 00036 static PRIM_DECL_1(selector, oop receiver); 00037 00038 //%prim 00039 // <Method> primitiveMethodSelector: name <Symbol> 00040 // ifFail: failBlock <PrimFailBlock> ^<Symbol> = 00041 // Internal { name = 'methodOopPrimitives::setSelector' } 00042 //% 00043 static PRIM_DECL_2(setSelector, oop receiver, oop name); 00044 00045 //%prim 00046 // <Method> primitiveMethodNumberOfArguments ^<SmallInteger> = 00047 // Internal { name = 'methodOopPrimitives::numberOfArguments' } 00048 //% 00049 static PRIM_DECL_1(numberOfArguments, oop receiver); 00050 00051 //%prim 00052 // <Method> primitiveMethodOuterIfFail: failBlock <PrimFailBlock> ^<Method> = 00053 // Internal { error = #(ReceiverNotBlockMethod) 00054 // name = 'methodOopPrimitives::outer' } 00055 //% 00056 static PRIM_DECL_1(outer, oop receiver); 00057 00058 //%prim 00059 // <Method> primitiveMethodOuter: method <Method> 00060 // ifFail: failBlock <PrimFailBlock> ^<Symbol> = 00061 // Internal { name = 'methodOopPrimitives::setOuter' } 00062 //% 00063 static PRIM_DECL_2(setOuter, oop receiver, oop method); 00064 00065 //%prim 00066 // <Method> primitiveMethodReferencedInstVarNamesMixin: mixin <Mixin> 00067 // ifFail: failBlock <PrimFailBlock> ^<IndexedInstanceVariables> = 00068 // Internal { name = 'methodOopPrimitives::referenced_instance_variable_names' } 00069 //% 00070 static PRIM_DECL_2(referenced_instance_variable_names, oop receiver, oop mixin); 00071 00072 //%prim 00073 // <Method> primitiveMethodReferencedClassVarNames ^<IndexedInstanceVariables> = 00074 // Internal { name = 'methodOopPrimitives::referenced_class_variable_names' } 00075 //% 00076 static PRIM_DECL_1(referenced_class_variable_names, oop receiver); 00077 00078 //%prim 00079 // <Method> primitiveMethodReferencedGlobalNames ^<IndexedInstanceVariables> = 00080 // Internal { name = 'methodOopPrimitives::referenced_global_names' } 00081 //% 00082 static PRIM_DECL_1(referenced_global_names, oop receiver); 00083 00084 //%prim 00085 // <Method> primitiveMethodSenders ^<IndexedInstanceVariables> = 00086 // Internal { name = 'methodOopPrimitives::senders' } 00087 //% 00088 static PRIM_DECL_1(senders, oop receiver); 00089 00090 //%prim 00091 // <Method> primitiveMethodPrettyPrintKlass: klass <Object> 00092 // ifFail: failBlock <PrimFailBlock> ^<Method> = 00093 // Internal { name = 'methodOopPrimitives::prettyPrint' } 00094 //% 00095 static PRIM_DECL_2(prettyPrint, oop receiver, oop klass); 00096 00097 //%prim 00098 // <Method> primitiveMethodPrettyPrintSourceKlass: klass <Object> 00099 // ifFail: failBlock <PrimFailBlock> ^<ByteIndexedInstanceVariables> = 00100 // Internal { name = 'methodOopPrimitives::prettyPrintSource' } 00101 //% 00102 static PRIM_DECL_2(prettyPrintSource, oop receiver, oop klass); 00103 00104 //%prim 00105 // <Method> primitiveMethodPrintCodes ^<Symbol> = 00106 // Internal { name = 'methodOopPrimitives::printCodes' } 00107 //% 00108 static PRIM_DECL_1(printCodes, oop receiver); 00109 00110 //%prim 00111 // <Method> primitiveMethodDebugInfo ^<Object> = 00112 // Internal { name = 'methodOopPrimitives::debug_info' } 00113 //% 00114 static PRIM_DECL_1(debug_info, oop receiver); 00115 00116 //%prim 00117 // <Method> primitiveMethodSizeAndFlags ^<Object> = 00118 // Internal { name = 'methodOopPrimitives::size_and_flags' } 00119 //% 00120 static PRIM_DECL_1(size_and_flags, oop receiver); 00121 00122 //%prim 00123 // <Method> primitiveMethodBody ^<Object> = 00124 // Internal { name = 'methodOopPrimitives::fileout_body' } 00125 //% 00126 static PRIM_DECL_1(fileout_body, oop receiver); 00127 00128 //%prim 00129 // <NoReceiver> primitiveConstructMethod: selector_or_method <Object> 00130 // flags: flags <SmallInteger> 00131 // nofArgs: nofArgs <SmallInteger> 00132 // debugInfo: debugInfo <Array> 00133 // bytes: bytes <ByteArray> 00134 // oops: oops <Array> 00135 // ifFail: failBlock <PrimFailBlock> ^<Method> = 00136 // Internal { name = 'methodOopPrimitives::constructMethod' } 00137 //% 00138 static PRIM_DECL_6(constructMethod, oop selector_or_method, oop flags, oop nofArgs, oop debugInfo, oop bytes, oop oops); 00139 00140 //%prim 00141 // <Method> primitiveMethodAllocateBlockIfFail: failBlock <PrimFailBlock> ^<Block> = 00142 // Internal { 00143 // name = 'methodOopPrimitives::allocate_block' } 00144 //% 00145 static PRIM_DECL_1(allocate_block, oop receiver); 00146 00147 //%prim 00148 // <Method> primitiveMethodAllocateBlock: receiver <Object> ifFail: failBlock <PrimFailBlock> ^<Block> = 00149 // Internal { 00150 // name = 'methodOopPrimitives::allocate_block_self' } 00151 //% 00152 static PRIM_DECL_2(allocate_block_self, oop receiver, oop self); 00153 00154 //%prim 00155 // <Method> primitiveMethodSetInliningInfo: info <Symbol> 00156 // ifFail: failBlock <PrimFailBlock> ^<Symbol> = 00157 // Internal { doc = 'Sets the inlining info for the method (#Normal, #Never, or #Always)' 00158 // error = #(ArgumentIsInvalid) 00159 // name = 'methodOopPrimitives::set_inlining_info' } 00160 //% 00161 static PRIM_DECL_2(set_inlining_info, oop receiver, oop info); 00162 00163 00164 //%prim 00165 // <Method> primitiveMethodInliningInfo ^<Symbol> = 00166 // Internal { doc = 'Returns #Normal, #Never, or #Always' 00167 // name = 'methodOopPrimitives::inlining_info' } 00168 //% 00169 static PRIM_DECL_1(inlining_info, oop receiver); 00170 };