avmplus::AbstractFunction Class Reference

#include <AbstractFunction.h>

Inheritance diagram for avmplus::AbstractFunction:

MMgc::GCObject avmplus::MethodInfo avmplus::NativeMethod List of all members.

Public Member Functions

AvmCorecore () const
uintptr iid () const
bool usesCallerContext () const
bool usesDefaultXmlNamespace () const
void initParamTypes (int count)
void initDefaultValues (int count)
void resolveSignature (const Toplevel *toplevel)
bool argcOk (int argc)
void setParamType (int index, Traits *t)
void setDefaultValue (int index, Atom defaultValue)
void makeIntoPrototypeFunction (const Toplevel *toplevel)
TraitsparamTraits (int index) const
const AtomgetDefaultValues () const
Atom getDefaultValue (int i) const
void setReturnType (Traits *t)
TraitsreturnTraits () const
int requiredParamCount () const
int allowExtraArgs () const
int hasMethodBody () const
int isFlagSet (int f) const
int hasExceptions () const
int setsDxns () const
bool makeMethodOf (Traits *type)
void boxArgs (int argc, uint32 *ap, Atom *out)
 DWB (Traits *) declaringTraits
 DWB (Traits *) activationTraits
 DWB (PoolObject *) pool

Public Attributes

const byteinfo_pos
int param_count
int optional_count
int restOffset
int flags
int method_id
AtomMethodProc impl32
DoubleMethodProc implN

Static Public Attributes

flags from .abc - limited to a BYTE
static const int NEED_ARGUMENTS = 0x00000001
static const int NEED_ACTIVATION = 0x00000002
static const int NEED_REST = 0x00000004
static const int HAS_OPTIONAL = 0x00000008
static const int IGNORE_REST = 0x00000010
static const int NATIVE = 0x00000020
static const int SETS_DXNS = 0x00000040
static const int HAS_PARAM_NAMES = 0x00000080
internal flags - upper 3 BYTES available
static const int OVERRIDE = 0x00010000
static const int NON_INTERRUPTABLE = 0x00020000
static const int UNBOX_THIS = 0x00040000
static const int NEEDS_CODECONTEXT = 0x00080000
static const int HAS_EXCEPTIONS = 0x00100000
static const int NEEDS_DXNS = 0x00400000
static const int VERIFIED = 0x00800000
static const int FINAL = 0x02000000
static const int NEED_CLOSURE = 0x04000000
static const int ABSTRACT_METHOD = 0x08000000
static const int TURBO = 0x80000000
static const int SUGGEST_INTERP = 0x40000000
static const int LINKED = 0x20000000
NativeMethod flags
These are used in the NativeMethod subclass

static const int NATIVE_COOKIE = 0x10000000

Protected Member Functions

 AbstractFunction ()

Private Member Functions

 DWB (Traits *) m_returnType
 DWB (Traits **) m_types
 DWB (Atom *) m_values

Detailed Description

AbstractFunction is the base class for all functions that can be executed by the VM: Actionscript functions, native functions, etc.

Definition at line 56 of file AbstractFunction.h.


Constructor & Destructor Documentation

avmplus::AbstractFunction::AbstractFunction  )  [protected]
 

Definition at line 45 of file AbstractFunction.cpp.

References flags, and method_id.

00046     {
00047         this->flags = 0;
00048         this->method_id = -1;
00049     }


Member Function Documentation

int avmplus::AbstractFunction::allowExtraArgs  )  const [inline]
 

Definition at line 209 of file AbstractFunction.h.

References IGNORE_REST, isFlagSet(), NEED_ARGUMENTS, and NEED_REST.

Referenced by argcOk().

00209                                    {
00210             return isFlagSet(NEED_REST|NEED_ARGUMENTS|IGNORE_REST);
00211         }

bool avmplus::AbstractFunction::argcOk int  argc  )  [inline]
 

Definition at line 169 of file AbstractFunction.h.

References allowExtraArgs(), optional_count, and param_count.

Referenced by avmplus::MethodEnv::startCoerce().

00170         {
00171             return argc >= param_count-optional_count && 
00172                 (argc <= param_count || allowExtraArgs());
00173         }

void avmplus::AbstractFunction::boxArgs int  argc,
uint32 ap,
Atom out
 

convert native args to atoms. argc is the number of args, not counting the instance which is arg[0]. the layout is [instance][arg1..argN]

Definition at line 210 of file AbstractFunction.cpp.

References AvmAssert, BOOLEAN_TYPE, core(), avmplus::AvmCore::doubleToAtom(), avmplus::AtomConstants::falseAtom, util::threadpool::i, INT_TYPE, avmplus::AvmCore::intToAtom(), NAMESPACE_TYPE, NUMBER_TYPE, OBJECT_TYPE, param_count, paramTraits(), STRING_TYPE, avmplus::AtomConstants::trueAtom, UINT_TYPE, avmplus::AvmCore::uintToAtom(), and VOID_TYPE.

Referenced by avmplus::interp().

00211     {
00212         // box the typed args, up to param_count
00213         AvmCore* core = this->core();
00214         for (int i=0; i <= argc; i++)
00215         {
00216             if (i <= param_count)
00217             {
00218                 Traits* t = paramTraits(i);
00219                 AvmAssert(t != VOID_TYPE);
00220 
00221                 if (t == NUMBER_TYPE) 
00222                 {
00223                     out[i] =  core->doubleToAtom(*(double *)ap);
00224                     ap += 2;
00225                 }
00226                 else if (t == INT_TYPE)
00227                 {
00228                     out[i] = core->intToAtom((int32)*(Atom*) ap);
00229                     ap += sizeof(Atom) / sizeof(uint32);
00230                 }
00231                 else if (t == UINT_TYPE)
00232                 {
00233                     out[i] = core->uintToAtom((uint32)*(Atom*) ap);
00234                     ap += sizeof(Atom) / sizeof(uint32);
00235                 }
00236                 else if (t == BOOLEAN_TYPE)
00237                 {
00238                     out[i] = (*(Atom*) ap) ? trueAtom : falseAtom;
00239                     ap += sizeof(Atom) / sizeof(uint32);
00240                 }
00241                 else if (!t || t == OBJECT_TYPE)
00242                 {
00243                     out[i] = *(Atom *) ap;
00244                     ap += sizeof(Atom) / sizeof(uint32);
00245                 }
00246                 else
00247                 {
00248                     // it's a pointer type, possibly null
00249 
00250                     void* p = *(void **)ap; // unknown pointer
00251                     if (t == STRING_TYPE)
00252                     {
00253                         out[i] = ((Stringp)p)->atom();
00254                     }
00255                     else if (t == NAMESPACE_TYPE)
00256                     {
00257                         out[i] = ((Namespace*)p)->atom();
00258                     }
00259                     else 
00260                     {
00261                         out[i] = ((ScriptObject*)p)->atom();
00262                     }
00263                     ap += sizeof(void *) / sizeof(uint32);
00264                 }
00265             }
00266             else
00267             {
00268                 out[i] = *(Atom *) ap;
00269                 ap += sizeof(Atom) / sizeof(uint32);
00270             }
00271         }
00272     }

AvmCore * avmplus::AbstractFunction::core  )  const [inline]
 

Definition at line 310 of file AbstractFunction.h.

Referenced by boxArgs(), avmplus::MethodEnv::core(), avmplus::MethodEnv::getpropertylate_i(), avmplus::MethodEnv::getpropertylate_u(), avmplus::MethodEnv::in(), initDefaultValues(), avmplus::ScriptEnv::initGlobal(), initParamTypes(), avmplus::interp(), makeIntoPrototypeFunction(), makeMethodOf(), avmplus::MethodEnv::nextname(), avmplus::MethodEnv::op_newobject(), resolveSignature(), setDefaultValue(), setParamType(), avmplus::MethodEnv::setpropertylate_i(), avmplus::Verifier::Verifier(), avmplus::NativeMethod::verify(), and avmplus::MethodInfo::verify().

00311     {
00312         return pool->core;
00313     }

avmplus::AbstractFunction::DWB Atom  )  [private]
 

avmplus::AbstractFunction::DWB Traits **   )  [private]
 

avmplus::AbstractFunction::DWB Traits  )  [private]
 

avmplus::AbstractFunction::DWB PoolObject  ) 
 

avmplus::AbstractFunction::DWB Traits  ) 
 

avmplus::AbstractFunction::DWB Traits  ) 
 

Atom avmplus::AbstractFunction::getDefaultValue int  i  )  const [inline]
 

Definition at line 193 of file AbstractFunction.h.

Referenced by avmplus::interp().

00193                                           {
00194             return m_values[i];
00195         }

const Atom* avmplus::AbstractFunction::getDefaultValues  )  const [inline]
 

Definition at line 189 of file AbstractFunction.h.

00189                                              {
00190             return m_values;
00191         }

int avmplus::AbstractFunction::hasExceptions  )  const [inline]
 

Definition at line 221 of file AbstractFunction.h.

References flags, and HAS_EXCEPTIONS.

00221                                   {
00222             return flags & HAS_EXCEPTIONS;
00223         }

int avmplus::AbstractFunction::hasMethodBody  )  const [inline]
 

Definition at line 213 of file AbstractFunction.h.

References ABSTRACT_METHOD, and isFlagSet().

00213                                   {
00214             return !isFlagSet(ABSTRACT_METHOD);
00215         }

uintptr avmplus::AbstractFunction::iid  )  const [inline]
 

Definition at line 153 of file AbstractFunction.h.

00154         {
00155             return ((uintptr)this)>>3;
00156         }

void avmplus::AbstractFunction::initDefaultValues int  count  ) 
 

Definition at line 57 of file AbstractFunction.cpp.

References MMgc::GC::Calloc(), core(), MMgc::GCRoot::GetGC(), MMgc::GC::kContainsPointers, MMgc::GC::kZero, and MMGC_MEM_TYPE.

Referenced by makeIntoPrototypeFunction(), and resolveSignature().

00058     {
00059         MMGC_MEM_TYPE(this);
00060         m_values = (Atom*)core()->GetGC()->Calloc(count, sizeof(Atom), GC::kContainsPointers|GC::kZero);
00061     }

void avmplus::AbstractFunction::initParamTypes int  count  ) 
 

Definition at line 51 of file AbstractFunction.cpp.

References MMgc::GC::Calloc(), core(), MMgc::GCRoot::GetGC(), MMgc::GC::kContainsPointers, MMgc::GC::kZero, and MMGC_MEM_TYPE.

00052     {
00053         MMGC_MEM_TYPE(this);
00054         m_types = (Traits**)core()->GetGC()->Calloc(count, sizeof(Traits*), GC::kContainsPointers|GC::kZero);
00055     }

int avmplus::AbstractFunction::isFlagSet int  f  )  const [inline]
 

Definition at line 217 of file AbstractFunction.h.

References flags.

Referenced by allowExtraArgs(), hasMethodBody(), and avmplus::MethodInfo::verify().

00217                                    {
00218             return (flags & f);
00219         }

void avmplus::AbstractFunction::makeIntoPrototypeFunction const Toplevel toplevel  ) 
 

Definition at line 125 of file AbstractFunction.cpp.

References AvmAssert, avmplus::AvmCore::concatStrings(), core(), avmplus::Traits::final, flags, avmplus::BuiltinTraits::function_itraits, HAS_OPTIONAL, avmplus::Traits::hashTableOffset, util::threadpool::i, IGNORE_REST, initDefaultValues(), avmplus::Traits::initTables(), avmplus::AvmCore::internString(), avmplus::AvmCore::intToString(), avmplus::Traits::itraits, avmplus::Traits::linked, method_id, avmplus::Traits::methodCount, avmplus::Traits::needsHashtable, avmplus::AvmCore::newString(), avmplus::AvmCore::newTraits(), NULL, avmplus::BuiltinTraits::object_itraits, optional_count, param_count, resolveSignature(), setDefaultValue(), avmplus::Traits::setTotalSize(), avmplus::Traits::sizeofInstance, avmplus::Traits::slotCount, toplevel, avmplus::AvmCore::traits, and avmplus::AtomConstants::undefinedAtom.

00126     {
00127         if (declaringTraits == NULL)
00128         {
00129             // make sure param & return types are fully resolved.
00130             // this does not set the verified flag, so real verification will
00131             // still happen before the function runs the first time.
00132             resolveSignature(toplevel);
00133 
00134             // ftraits = new traits, extends function
00135             // this->declaringTraits = ftraits
00136             // ftraits->call = this
00137             // ftraits->construct = create object, call this(), return obj or result
00138 
00139             AvmCore* core = this->core();
00140             int functionSlotCount = core->traits.function_itraits->slotCount;
00141             int functionMethodCount = core->traits.function_itraits->methodCount;
00142 
00143             // type of F is synthetic subclass of Function, with a unique
00144             // [[call]] property and a unique scope
00145 
00146             Traits* ftraits = core->newTraits(core->traits.function_itraits, 1, 1,
00147                                       sizeof(ClassClosure));
00148             ftraits->slotCount = functionSlotCount;
00149             ftraits->methodCount = functionMethodCount;
00150             ftraits->pool = pool;
00151             ftraits->final = true;
00152             ftraits->needsHashtable = true;
00153             ftraits->itraits = core->traits.object_itraits;
00154             this->declaringTraits = ftraits;
00155 
00156             ftraits->ns = core->publicNamespace;
00157 #ifdef AVMPLUS_VERBOSE
00158             ftraits->name = core->internString(
00159                     core->concatStrings(core->newString("Function-"), core->intToString(method_id))
00160                 );
00161 #endif
00162 
00163             ftraits->hashTableOffset = (int)ftraits->sizeofInstance; 
00164             ftraits->setTotalSize(ftraits->hashTableOffset + sizeof(Hashtable));
00165 
00166             ftraits->initTables(toplevel);
00167 
00168             AvmAssert(core->traits.function_itraits->linked);
00169             ftraits->linked = true;
00170             
00171 
00172 #ifdef AVMPLUS_UNCHECKED_HACK
00173             // HACK - compiler should do this, and only to toplevel functions
00174             // that meet the E4 criteria for being an "unchecked function"
00175             // the tests below are too loose
00176 
00177             // if all params and return types are Object then make all params optional=undefined
00178             if (param_count == 0)
00179                 flags |= IGNORE_REST;
00180             if (!(flags & HAS_OPTIONAL) && param_count > 0)
00181             {
00182                 if (m_returnType == NULL)
00183                 {
00184                     for (int i=1; i <= param_count; i++)
00185                     {
00186                         if (m_types[i] != NULL)
00187                             return;
00188                     }
00189 
00190                     // make this an unchecked function
00191                     flags |= HAS_OPTIONAL | IGNORE_REST;
00192                     optional_count = param_count;
00193                     initDefaultValues(optional_count);
00194                     for (int i=1; i <= optional_count; i++)
00195                     {
00196                         // since the type is object the default value is undefined.
00197                         setDefaultValue(i, undefinedAtom);
00198                     }
00199                 }
00200             }
00201 #endif
00202         }
00203     }

bool avmplus::AbstractFunction::makeMethodOf Traits type  ) 
 

Definition at line 98 of file AbstractFunction.cpp.

References avmplus::AvmCore::console, core(), FINAL, avmplus::Traits::final, flags, NEED_CLOSURE, and setParamType().

Referenced by avmplus::AbcParser::parseScriptInfos().

00099     {
00100         if (!m_types[0])
00101         {
00102             declaringTraits = traits;
00103             setParamType(0, traits);
00104             flags |= NEED_CLOSURE;
00105 
00106             if (traits->final)
00107             {
00108                 // all methods of a final class are final
00109                 flags |= FINAL;
00110             }
00111 
00112             return true;
00113         }
00114         else
00115         {
00116             #ifdef AVMPLUS_VERBOSE
00117             if (pool->verbose)
00118                 core()->console << "WARNING: method " << this << " was already bound to " << declaringTraits << "\n";
00119             #endif
00120 
00121             return false;
00122         }
00123     }

Traits* avmplus::AbstractFunction::paramTraits int  index  )  const [inline]
 

Definition at line 184 of file AbstractFunction.h.

References AvmAssert, and param_count.

Referenced by boxArgs(), avmplus::Traits::checkOverride(), avmplus::MethodEnv::coerceEnter(), avmplus::Verifier::findStringFunction(), and resolveSignature().

00184                                              {
00185             AvmAssert(index >= 0 && index <= param_count);
00186             return m_types[index];
00187         }

int avmplus::AbstractFunction::requiredParamCount  )  const [inline]
 

Definition at line 205 of file AbstractFunction.h.

References optional_count, and param_count.

Referenced by avmplus::MethodEnv::startCoerce().

00205                                        {
00206             return param_count-optional_count;
00207         }

void avmplus::AbstractFunction::resolveSignature const Toplevel toplevel  ) 
 

Definition at line 274 of file AbstractFunction.cpp.

References ABSTRACT_METHOD, AvmAssert, BOOLEAN_TYPE, core(), avmplus::AtomConstants::falseAtom, flags, HAS_OPTIONAL, util::threadpool::i, info_pos, initDefaultValues(), INT_TYPE, avmplus::AvmCore::isBoolean(), avmplus::AvmCore::isDouble(), avmplus::AvmCore::isInteger(), avmplus::Traits::isInterface, avmplus::AvmCore::isNamespace(), avmplus::AvmCore::isNull(), avmplus::AvmCore::isString(), avmplus::ErrorConstants::kIllegalDefaultValue, avmplus::AtomConstants::kIntegerType, LINKED, NAMESPACE_TYPE, NULL, avmplus::AtomConstants::nullNsAtom, avmplus::AtomConstants::nullObjectAtom, avmplus::AtomConstants::nullStringAtom, avmplus::AvmCore::number_d(), NUMBER_TYPE, OBJECT_TYPE, optional_count, param_count, paramTraits(), avmplus::readU30(), restOffset, setDefaultValue(), setParamType(), STRING_TYPE, toplevel, UINT_TYPE, avmplus::AtomConstants::undefinedAtom, and VOID_TYPE.

Referenced by makeIntoPrototypeFunction(), avmplus::NativeMethod::verify(), and avmplus::MethodInfo::verify().

00275     {
00276         if (!(flags & LINKED))
00277         {
00278             AvmCore* core = this->core();
00279             AvmAssert(info_pos != NULL);
00280 
00281             const byte* pos = info_pos;
00282 
00283             Traits* t = pool->resolveTypeName(pos, toplevel, /*allowVoid=*/true);
00284 
00285             m_returnType = t;
00286 
00287             restOffset = 0;
00288 
00289             // param 0 is contextual
00290             t = m_types[0];
00291             if (!t)
00292             {
00293                 setParamType(0, OBJECT_TYPE);
00294                 restOffset += sizeof(Atom);
00295             }
00296             else
00297             {
00298                 if (t == NUMBER_TYPE)
00299                     restOffset += sizeof(double);
00300                 else
00301                     restOffset += sizeof(Atom);
00302                 if (t->isInterface)
00303                     flags |= ABSTRACT_METHOD;
00304             }
00305 
00306             // param types 1..N come from abc stream
00307             for (int i=1, n=param_count; i <= n; i++)
00308             {
00309                 t = pool->resolveTypeName(pos, toplevel);
00310                 setParamType(i, t);
00311                 if (t == NUMBER_TYPE)
00312                     restOffset += sizeof(double);
00313                 else
00314                     restOffset += sizeof(Atom);
00315             }
00316 
00317             AvmCore::readU30(pos); // name_index;
00318             pos++; // skip flags
00319 
00320             if (flags & HAS_OPTIONAL)
00321             {
00322                 AvmCore::readU30(pos); // optional_count
00323 
00324                 initDefaultValues(optional_count);
00325 
00326                 for (int j=0,n=optional_count; j < n; j++)
00327                 {
00328                     int param = param_count-optional_count+1+j;
00329                     int index = AvmCore::readU30(pos);
00330                     CPoolKind kind = (CPoolKind)*(pos++);
00331 
00332                     // check that the default value is legal for the param type
00333                     Traits* t = this->paramTraits(param);
00334                     AvmAssert(t != VOID_TYPE);
00335 
00336                     Atom value;
00337                     if (t == NULL)
00338                     {
00339                         value = !index ? undefinedAtom : pool->getDefaultValue(toplevel, index, kind, t);
00340                     }
00341                     else if (t == OBJECT_TYPE)
00342                     {
00343                         value = !index ? nullObjectAtom : pool->getDefaultValue(toplevel, index, kind, t);
00344                         if (value == undefinedAtom)
00345                         {
00346                             Multiname qname(t->ns, t->name);
00347                             toplevel->throwVerifyError(kIllegalDefaultValue, core->toErrorString(&qname));
00348                         }
00349                     }
00350                     else if (t == NUMBER_TYPE)
00351                     {
00352                         value = !index ? core->kNaN : pool->getDefaultValue(toplevel, index, kind, t);
00353                         if (!(AvmCore::isInteger(value)||AvmCore::isDouble(value)))
00354                         {
00355                             Multiname qname(t->ns, t->name);
00356                             toplevel->throwVerifyError(kIllegalDefaultValue, core->toErrorString(&qname));
00357                         }
00358                     }
00359                     else if (t == BOOLEAN_TYPE)
00360                     {
00361                         value = !index ? falseAtom : pool->getDefaultValue(toplevel, index, kind, t);
00362                         if (!AvmCore::isBoolean(value))
00363                         {
00364                             Multiname qname(t->ns, t->name);
00365                             toplevel->throwVerifyError(kIllegalDefaultValue, core->toErrorString(&qname));
00366                         }
00367                     }
00368                     else if (t == UINT_TYPE)
00369                     {
00370                         value = !index ? 0|kIntegerType : pool->getDefaultValue(toplevel, index, kind, t);
00371                         if (!AvmCore::isInteger(value) && !AvmCore::isDouble(value)) 
00372                         {
00373                             Multiname qname(t->ns, t->name);
00374                             toplevel->throwVerifyError(kIllegalDefaultValue, core->toErrorString(&qname));
00375                         }
00376                         double d = AvmCore::number_d(value);
00377                         if (d != (uint32)d) 
00378                         {                               
00379                             Multiname qname(t->ns, t->name);
00380                             toplevel->throwVerifyError(kIllegalDefaultValue, core->toErrorString(&qname));
00381                         }
00382                     }
00383                     else if (t == INT_TYPE)
00384                     {
00385                         value = !index ? 0|kIntegerType : pool->getDefaultValue(toplevel, index, kind, t);
00386                         if (!AvmCore::isInteger(value) && !AvmCore::isDouble(value)) 
00387                         {
00388                             Multiname qname(t->ns, t->name);
00389                             toplevel->throwVerifyError(kIllegalDefaultValue, core->toErrorString(&qname));
00390                         }
00391                         double d = AvmCore::number_d(value);
00392                         if (d != (int)d)
00393                         {                               
00394                             Multiname qname(t->ns, t->name);
00395                             toplevel->throwVerifyError(kIllegalDefaultValue, core->toErrorString(&qname));
00396                         }
00397                     }
00398                     else if (t == STRING_TYPE)
00399                     {
00400                         value = !index ? nullStringAtom : pool->getDefaultValue(toplevel, index, kind, t);
00401                         if (!(AvmCore::isNull(value) || AvmCore::isString(value)))
00402                         {
00403                             Multiname qname(t->ns, t->name);
00404                             toplevel->throwVerifyError(kIllegalDefaultValue, core->toErrorString(&qname));
00405                         }
00406                     }
00407                     else if (t == NAMESPACE_TYPE)
00408                     {
00409                         value = !index ? nullNsAtom : pool->getDefaultValue(toplevel, index, kind, t);
00410                         if (!(AvmCore::isNull(value) || AvmCore::isNamespace(value)))
00411                         {
00412                             Multiname qname(t->ns, t->name);
00413                             toplevel->throwVerifyError(kIllegalDefaultValue, core->toErrorString(&qname));
00414                         }
00415                     }
00416                     else
00417                     {
00418                         // any other type: only allow null default value
00419                         value = !index ? nullObjectAtom : pool->getDefaultValue(toplevel, index, kind, t);
00420                         if (!AvmCore::isNull(value))
00421                         {
00422                             Multiname qname(t->ns, t->name);
00423                             toplevel->throwVerifyError(kIllegalDefaultValue, core->toErrorString(&qname));
00424                         }
00425                     }
00426                     
00427                     setDefaultValue(param, value);
00428                 }
00429             }
00430 
00431             /*
00432             // Don't need this for anything yet, so no point in wasting time parsing it.  Here just so we don't
00433             // forget about it if we add any sections after this one, and need to skip past it.  
00434             if( flags & AbstractFunction::HAS_PARAM_NAMES)
00435             {
00436                 // AVMPlus doesn't care about the param names, just skip past them
00437                 for( int j = 0; j < param_count; ++j )
00438                 {
00439                     readU30(pos);
00440                 }
00441             }
00442             */
00443             flags |= LINKED;
00444         }
00445     }

Traits* avmplus::AbstractFunction::returnTraits  )  const [inline]
 

Definition at line 201 of file AbstractFunction.h.

Referenced by avmplus::Traits::checkOverride(), avmplus::MethodEnv::endCoerce(), avmplus::interp32(), and avmplus::MethodInfo::verify().

00201                                      {
00202             return m_returnType;
00203         }

void avmplus::AbstractFunction::setDefaultValue int  index,
Atom  defaultValue
 

Definition at line 69 of file AbstractFunction.cpp.

References AvmAssert, core(), util::threadpool::i, optional_count, param_count, and WBATOM.

Referenced by makeIntoPrototypeFunction(), and resolveSignature().

00070     {
00071         AvmAssert(index > (param_count-optional_count) && index <= param_count);
00072         int i = index-(param_count-optional_count)-1;
00073         AvmAssert(i >= 0 && i < optional_count);
00074         WBATOM(core()->GetGC(), m_values, &m_values[i], value);
00075     }

void avmplus::AbstractFunction::setParamType int  index,
Traits t
 

Definition at line 63 of file AbstractFunction.cpp.

References AvmAssert, core(), param_count, and WB.

Referenced by makeMethodOf(), and resolveSignature().

00064     {
00065         AvmAssert(index >= 0 && index <= param_count);
00066         WB(core()->GetGC(), m_types, &m_types[index], t);
00067     }

void avmplus::AbstractFunction::setReturnType Traits t  )  [inline]
 

Definition at line 197 of file AbstractFunction.h.

00197                                       {
00198             m_returnType = t;
00199         }

int avmplus::AbstractFunction::setsDxns  )  const [inline]
 

Definition at line 225 of file AbstractFunction.h.

References flags, and SETS_DXNS.

Referenced by avmplus::interp().

00225                              {
00226             return flags & SETS_DXNS;
00227         }

bool avmplus::AbstractFunction::usesCallerContext  )  const [inline]
 

Definition at line 315 of file AbstractFunction.h.

References flags, NATIVE, and NEEDS_CODECONTEXT.

00316     {
00317         return pool->isBuiltin && (!(flags & NATIVE) || (flags & NEEDS_CODECONTEXT));
00318     }

bool avmplus::AbstractFunction::usesDefaultXmlNamespace  )  const [inline]
 

Definition at line 322 of file AbstractFunction.h.

References flags, NATIVE, and NEEDS_DXNS.

00323     {
00324         return pool->isBuiltin && (!(flags & NATIVE) || (flags & NEEDS_DXNS));
00325     }


Member Data Documentation

const int avmplus::AbstractFunction::ABSTRACT_METHOD = 0x08000000 [static]
 

set to indicate that a function has no bytecode body.

Definition at line 118 of file AbstractFunction.h.

Referenced by hasMethodBody(), and resolveSignature().

const int avmplus::AbstractFunction::FINAL = 0x02000000 [static]
 

indicates method is final, no overrides allowed

Definition at line 111 of file AbstractFunction.h.

Referenced by makeMethodOf().

int avmplus::AbstractFunction::flags
 

Definition at line 287 of file AbstractFunction.h.

Referenced by AbstractFunction(), avmplus::Traits::checkOverride(), avmplus::MethodEnv::createArguments(), hasExceptions(), avmplus::interp(), isFlagSet(), makeIntoPrototypeFunction(), makeMethodOf(), avmplus::MethodEnv::MethodEnv(), avmplus::AbcParser::parseMethodBodies(), avmplus::AbcParser::parseScriptInfos(), resolveSignature(), setsDxns(), usesCallerContext(), usesDefaultXmlNamespace(), and avmplus::Verifier::Verifier().

const int avmplus::AbstractFunction::HAS_EXCEPTIONS = 0x00100000 [static]
 

Definition at line 97 of file AbstractFunction.h.

Referenced by hasExceptions(), and avmplus::AbcParser::parseMethodBodies().

const int avmplus::AbstractFunction::HAS_OPTIONAL = 0x00000008 [static]
 

has optional parameters

Definition at line 71 of file AbstractFunction.h.

Referenced by avmplus::interp(), makeIntoPrototypeFunction(), and resolveSignature().

const int avmplus::AbstractFunction::HAS_PARAM_NAMES = 0x00000080 [static]
 

method has table for parameter names

Definition at line 83 of file AbstractFunction.h.

const int avmplus::AbstractFunction::IGNORE_REST = 0x00000010 [static]
 

allow extra args, but dont capture them

Definition at line 74 of file AbstractFunction.h.

Referenced by allowExtraArgs(), and makeIntoPrototypeFunction().

AtomMethodProc avmplus::AbstractFunction::impl32
 

Definition at line 280 of file AbstractFunction.h.

Referenced by avmplus::MethodEnv::delegateInvoke(), avmplus::MethodEnv::endCoerce(), avmplus::AvmCore::findExceptionHandlerNoRethrow(), avmplus::MethodInfo::MethodInfo(), avmplus::NativeMethod::verify(), and avmplus::MethodInfo::verify().

DoubleMethodProc avmplus::AbstractFunction::implN
 

Definition at line 281 of file AbstractFunction.h.

Referenced by avmplus::MethodEnv::endCoerce(), avmplus::AvmCore::findExceptionHandlerNoRethrow(), and avmplus::MethodInfo::verify().

const byte* avmplus::AbstractFunction::info_pos
 

Definition at line 283 of file AbstractFunction.h.

Referenced by resolveSignature().

const int avmplus::AbstractFunction::LINKED = 0x20000000 [static]
 

set once the signature types have been resolved and override signatures have been checked.

Definition at line 137 of file AbstractFunction.h.

Referenced by resolveSignature().

int avmplus::AbstractFunction::method_id
 

Definition at line 288 of file AbstractFunction.h.

Referenced by AbstractFunction(), makeIntoPrototypeFunction(), and avmplus::VTable::makeMethodEnv().

const int avmplus::AbstractFunction::NATIVE = 0x00000020 [static]
 

method is native

Definition at line 77 of file AbstractFunction.h.

Referenced by usesCallerContext(), and usesDefaultXmlNamespace().

const int avmplus::AbstractFunction::NATIVE_COOKIE = 0x10000000 [static]
 

cookie int passed into C++ code

Definition at line 147 of file AbstractFunction.h.

const int avmplus::AbstractFunction::NEED_ACTIVATION = 0x00000002 [static]
 

need activation object

Definition at line 65 of file AbstractFunction.h.

Referenced by avmplus::MethodEnv::MethodEnv().

const int avmplus::AbstractFunction::NEED_ARGUMENTS = 0x00000001 [static]
 

need arguments[0..argc]

Definition at line 62 of file AbstractFunction.h.

Referenced by allowExtraArgs(), and avmplus::interp().

const int avmplus::AbstractFunction::NEED_CLOSURE = 0x04000000 [static]
 

indicates the function is a method, that pushes the receiver object onto the scope chain at method entry

Definition at line 115 of file AbstractFunction.h.

Referenced by avmplus::MethodEnv::createArguments(), and makeMethodOf().

const int avmplus::AbstractFunction::NEED_REST = 0x00000004 [static]
 

need arguments[param_count+1..argc]

Definition at line 68 of file AbstractFunction.h.

Referenced by allowExtraArgs(), and avmplus::interp().

const int avmplus::AbstractFunction::NEEDS_CODECONTEXT = 0x00080000 [static]
 

Definition at line 95 of file AbstractFunction.h.

Referenced by usesCallerContext().

const int avmplus::AbstractFunction::NEEDS_DXNS = 0x00400000 [static]
 

Definition at line 103 of file AbstractFunction.h.

Referenced by usesDefaultXmlNamespace().

const int avmplus::AbstractFunction::NON_INTERRUPTABLE = 0x00020000 [static]
 

Definition at line 91 of file AbstractFunction.h.

Referenced by avmplus::AvmCore::initBuiltinPool().

int avmplus::AbstractFunction::optional_count
 

Definition at line 285 of file AbstractFunction.h.

Referenced by argcOk(), avmplus::Traits::checkOverride(), avmplus::Verifier::findStringFunction(), avmplus::interp(), makeIntoPrototypeFunction(), requiredParamCount(), resolveSignature(), and setDefaultValue().

const int avmplus::AbstractFunction::OVERRIDE = 0x00010000 [static]
 

Definition at line 89 of file AbstractFunction.h.

int avmplus::AbstractFunction::param_count
 

Definition at line 284 of file AbstractFunction.h.

Referenced by argcOk(), boxArgs(), avmplus::Traits::checkOverride(), avmplus::MethodEnv::createRest(), avmplus::Verifier::findMathFunction(), avmplus::Verifier::findStringFunction(), avmplus::interp(), makeIntoPrototypeFunction(), paramTraits(), requiredParamCount(), resolveSignature(), setDefaultValue(), and setParamType().

int avmplus::AbstractFunction::restOffset
 

Definition at line 286 of file AbstractFunction.h.

Referenced by avmplus::MethodEnv::coerceEnter(), and resolveSignature().

const int avmplus::AbstractFunction::SETS_DXNS = 0x00000040 [static]
 

method sets default namespace

Definition at line 80 of file AbstractFunction.h.

Referenced by setsDxns().

const int avmplus::AbstractFunction::SUGGEST_INTERP = 0x40000000 [static]
 

set to indictate that a function has been recommended to be interpreted.

Definition at line 131 of file AbstractFunction.h.

Referenced by avmplus::AbcParser::parseScriptInfos(), and avmplus::MethodInfo::verify().

const int avmplus::AbstractFunction::TURBO = 0x80000000 [static]
 

set to indicate that a function has been compiled to native code. In release mode we always compile so we don't need the flag.

Definition at line 125 of file AbstractFunction.h.

const int avmplus::AbstractFunction::UNBOX_THIS = 0x00040000 [static]
 

Definition at line 93 of file AbstractFunction.h.

Referenced by avmplus::Traits::checkOverride().

const int avmplus::AbstractFunction::VERIFIED = 0x00800000 [static]
 

Definition at line 105 of file AbstractFunction.h.

Referenced by avmplus::NativeMethod::verifyEnter(), and avmplus::MethodInfo::verifyEnter().


The documentation for this class was generated from the following files:
Generated on Sun Oct 12 18:51:01 2008 for Tamarin by  doxygen 1.4.6