diff -r 1c05dd6490d9 core/AvmCore.cpp
--- a/core/AvmCore.cpp	Sat Nov 28 09:34:48 2009 -0800
+++ b/core/AvmCore.cpp	Sun Nov 29 16:34:02 2009 -0800
@@ -457,15 +457,15 @@
 	
 	static ScriptEnv* initScript(AvmCore* core, Toplevel* toplevel, AbcEnv* abcEnv, Traits* scriptTraits)
 	{
-		// [ed] 3/24/06 why do we really care if a script is dynamic or not?
-		//AvmAssert(scriptTraits->needsHashtable);
-
-		bool wasResolved = scriptTraits->isResolved();
 		VTable* scriptVTable = core->newVTable(scriptTraits, toplevel->object_ivtable, toplevel);
-		AvmAssert(scriptTraits->isResolved());
-		if (!wasResolved)
-			scriptTraits->init_declaringScopes(ScopeTypeChain::createEmpty(core->GetGC(), scriptTraits));
-		ScriptEnv* scriptEnv = new (core->GetGC()) ScriptEnv(scriptTraits->init, scriptVTable, abcEnv);
+        const ScopeTypeChain* scriptSTC = scriptTraits->declaringScope();
+        if (!scriptSTC)
+        {
+            scriptSTC = ScopeTypeChain::createEmpty(core->GetGC(), scriptTraits);
+	        scriptTraits->setDeclaringScopes(scriptSTC);
+        }
+        ScopeChain* scriptScope = ScriptEnv::createScriptScope(scriptSTC, scriptVTable, abcEnv);
+		ScriptEnv* scriptEnv = new (core->GetGC()) ScriptEnv(scriptTraits->init, scriptScope);
 		scriptVTable->init = scriptEnv;
 		core->exportDefs(scriptTraits, scriptEnv);
 		initScriptActivationTraits(core, toplevel, scriptTraits->init);
@@ -3376,7 +3376,6 @@
 	
 	VTable* AvmCore::newVTable(Traits* traits, VTable* base, Toplevel* toplevel)
 	{
-		traits->resolveSignatures(toplevel);
 		const uint32_t count = traits->getTraitsBindings()->methodCount;
 		size_t extraSize = sizeof(MethodEnv*)*(count > 0 ? count-1 : 0);
 		return new (GetGC(), extraSize) VTable(traits, base, toplevel);
@@ -4309,7 +4308,7 @@
 			while (!verifyQueue.isEmpty()) {
 				MethodInfo* f = verifyQueue.removeLast();
 				if (!f->isVerified()) {
-					if (f->hasNoScopeAndNotClassInitializer()) {
+					if (f->declaringTraits()->init != f && f->declaringScope() == NULL) {
 						verifyQueue2.add(f);
 						continue;
 					}
diff -r 1c05dd6490d9 core/MethodEnv-inlines.h
--- a/core/MethodEnv-inlines.h	Sat Nov 28 09:34:48 2009 -0800
+++ b/core/MethodEnv-inlines.h	Sun Nov 29 16:34:02 2009 -0800
@@ -160,8 +160,8 @@
     return _scope->vtable();
 }
 
-REALLY_INLINE ScriptEnv::ScriptEnv(MethodInfo* _method, VTable* _vtable, AbcEnv* _abcEnv)
-    : MethodEnv(_method, createScriptScope(_method->declaringScope(), _vtable, _abcEnv))
+REALLY_INLINE ScriptEnv::ScriptEnv(MethodInfo* _method, ScopeChain* _scope)
+    : MethodEnv(_method, _scope)
 {
     setIsScriptEnv();
 }
diff -r 1c05dd6490d9 core/MethodEnv.cpp
--- a/core/MethodEnv.cpp	Sat Nov 28 09:34:48 2009 -0800
+++ b/core/MethodEnv.cpp	Sun Nov 29 16:34:02 2009 -0800
@@ -1257,9 +1257,6 @@
 				toplevel->throwTypeError(kCorruptABCError);
 		}
 
-		ctraits->resolveSignatures(toplevel);
-		itraits->resolveSignatures(toplevel);
-
 		VTable* ivtable = core->newVTable(itraits, base ? base->ivtable() : NULL, toplevel);
 		
 		// This is a little weird, as the cvtable should have the ivtable as its base
diff -r 1c05dd6490d9 core/MethodEnv.h
--- a/core/MethodEnv.h	Sat Nov 28 09:34:48 2009 -0800
+++ b/core/MethodEnv.h	Sun Nov 29 16:34:02 2009 -0800
@@ -329,10 +329,8 @@
 	class ScriptEnv : public MethodEnv
 	{
 	public:
-		ScriptEnv(MethodInfo* _method, VTable* _vtable, AbcEnv* _abcEnv);
+		ScriptEnv(MethodInfo* _method, ScopeChain* _scope);
 		ScriptObject* initGlobal();
-	
-	private:
 		static ScopeChain* createScriptScope(const ScopeTypeChain* stc, VTable* _vtable, AbcEnv* _abcEnv);
 		
 	// ------------------------ DATA SECTION BEGIN
diff -r 1c05dd6490d9 core/MethodInfo-inlines.h
--- a/core/MethodInfo-inlines.h	Sat Nov 28 09:34:48 2009 -0800
+++ b/core/MethodInfo-inlines.h	Sun Nov 29 16:34:02 2009 -0800
@@ -39,6 +39,36 @@
 
 namespace avmplus
 {
+
+REALLY_INLINE ScopeOrTraits::ScopeOrTraits(Traits* t) : _scopeOrTraits((uintptr_t)t) 
+{ 
+}
+
+REALLY_INLINE Traits* ScopeOrTraits::getTraits() const
+{
+    return (!(_scopeOrTraits & IS_SCOPE)) ?
+            ((Traits*)(_scopeOrTraits)) :
+            ((const ScopeTypeChain*)(_scopeOrTraits & ~IS_SCOPE))->traits();
+}
+
+REALLY_INLINE const ScopeTypeChain* ScopeOrTraits::getScope() const
+{
+    return (!(_scopeOrTraits & IS_SCOPE)) ?
+            ((Traits*)(_scopeOrTraits))->declaringScope() :
+            ((const ScopeTypeChain*)(_scopeOrTraits & ~IS_SCOPE));
+}
+
+REALLY_INLINE void ScopeOrTraits::setTraits(MMgc::GC* gc, void* container, Traits* t)
+{
+	WB(gc, container, &_scopeOrTraits, uintptr_t(t)); 
+}
+
+
+REALLY_INLINE void ScopeOrTraits::setScope(MMgc::GC* gc, void* container, const ScopeTypeChain* s)
+{
+	WB(gc, container, &_scopeOrTraits, uintptr_t(s) | IS_SCOPE); 
+}
+
 #ifdef DEBUGGER
 REALLY_INLINE DebuggerMethodInfo::DebuggerMethodInfo(int32_t _local_count, uint32_t _codeSize, int32_t _max_scopes) :
     firstSourceLine(0),
@@ -336,6 +366,27 @@
     return _method_id;
 }
 
+REALLY_INLINE Traits* MethodInfo::declaringTraits() const
+{
+    return _declarer.getTraits();
+}
+
+REALLY_INLINE const ScopeTypeChain* MethodInfo::declaringScope() const
+{
+    return _declarer.getScope();
+}
+
+REALLY_INLINE Traits* MethodInfo::activationTraits() const
+{
+    return _activation.getTraits();
+}
+
+REALLY_INLINE const ScopeTypeChain* MethodInfo::activationScope() const
+{
+    return _activation.getScope();
+}
+
+
 REALLY_INLINE MethodSignaturep MethodInfo::getMethodSignature()
 {
     AvmAssert(isResolved());
diff -r 1c05dd6490d9 core/MethodInfo.cpp
--- a/core/MethodInfo.cpp	Sat Nov 28 09:34:48 2009 -0800
+++ b/core/MethodInfo.cpp	Sun Nov 29 16:34:02 2009 -0800
@@ -57,8 +57,8 @@
 	MethodInfo::MethodInfo(InitMethodStub, Traits* declTraits) :
 		MethodInfoProcHolder(verifyEnterGPR),
 		_msref(declTraits->pool->core->GetGC()->emptyWeakRef),
-		_declaringScopeOrTraits(uintptr_t(declTraits) | IS_TRAITS),
-		_activationScopeOrTraits(uintptr_t(0) | IS_TRAITS),
+		_declarer(declTraits),
+		_activation(NULL),
 		_pool(declTraits->pool),
 		_abc_info_pos(NULL),
 		_flags(RESOLVED),
@@ -70,8 +70,8 @@
     MethodInfo::MethodInfo(InitMethodStub, Traits* declTraits, const NativeMethodInfo* native_info) :
         MethodInfoProcHolder(verifyEnterGPR),
         _msref(declTraits->pool->core->GetGC()->emptyWeakRef),
-		_declaringScopeOrTraits(uintptr_t(declTraits) | IS_TRAITS),
-		_activationScopeOrTraits(uintptr_t(0) | IS_TRAITS),
+		_declarer(declTraits),
+		_activation(NULL),
         _pool(declTraits->pool),
         _abc_info_pos(NULL),
         _flags(RESOLVED),
@@ -94,14 +94,14 @@
 							const NativeMethodInfo* native_info) : 
 		MethodInfoProcHolder(verifyEnterGPR),
 		_msref(pool->core->GetGC()->emptyWeakRef),
-		_declaringScopeOrTraits(uintptr_t(0) | IS_TRAITS),
-		_activationScopeOrTraits(uintptr_t(0) | IS_TRAITS),
+		_declarer(NULL),
+		_activation(NULL),
 		_pool(pool),
 		_abc_info_pos(abc_info_pos),
 		_flags(abcFlags),
 		_method_id(method_id)
 	{
-
+        AvmAssert(method_id >= 0);
 #if !defined(MEMORY_INFO)
 		MMGC_STATIC_ASSERT(offsetof(MethodInfo, _implGPR) == 0);
 #endif
@@ -116,65 +116,10 @@
 		}
 	}
 
-    // WARNING the logic 'declaringTraits()->init' appears to imply 
-    // a class initializer, but the condition could be generated for
-    // some other combination of traits and methods - short of it is 
-    // don't trust the name of this function.
-    bool MethodInfo::hasNoScopeAndNotClassInitializer() const
-    {
-        AvmAssert(_declaringScopeOrTraits != 0);
-        bool b = ((_declaringScopeOrTraits & IS_TRAITS)==1) && declaringTraits()->init != this;
-        return b;
-    }
- 
-	Traits* MethodInfo::declaringTraits() const 
-	{ 
-		if (_declaringScopeOrTraits & IS_TRAITS)
-			return (Traits*)(_declaringScopeOrTraits & ~IS_TRAITS);
-
-		return ((const ScopeTypeChain*)(_declaringScopeOrTraits))->traits(); 
-	}
-
-	const ScopeTypeChain* MethodInfo::declaringScope() const 
-	{ 
-		AvmAssert(!(_declaringScopeOrTraits & IS_TRAITS));
-		AvmAssert(_declaringScopeOrTraits != 0);
-		return ((const ScopeTypeChain*)(_declaringScopeOrTraits)); 
-	}
-
-	void MethodInfo::init_declaringScope(const ScopeTypeChain* s) 
-	{ 
-		AvmAssert(_declaringScopeOrTraits & IS_TRAITS);
-		AvmAssert(((Traits*)(_declaringScopeOrTraits & ~IS_TRAITS)) == s->traits());
-		WB(pool()->core->GetGC(), this, &_declaringScopeOrTraits, uintptr_t(s)); 
-	}
-
-	Traits* MethodInfo::activationTraits() const 
-	{ 
-		if (_activationScopeOrTraits & IS_TRAITS)
-			return (Traits*)(_activationScopeOrTraits & ~IS_TRAITS);
-
-		return ((const ScopeTypeChain*)(_activationScopeOrTraits))->traits(); 
-	}
-
-	const ScopeTypeChain* MethodInfo::activationScope() const 
-	{ 
-		AvmAssert(!(_activationScopeOrTraits & IS_TRAITS));
-		AvmAssert(_activationScopeOrTraits != 0);
-		return ((const ScopeTypeChain*)(_activationScopeOrTraits)); 
-	}
-
 	void MethodInfo::init_activationTraits(Traits* t) 
 	{ 
-		AvmAssert(_activationScopeOrTraits == (uintptr_t(0) | IS_TRAITS));
-		WB(pool()->core->GetGC(), this, &_activationScopeOrTraits, uintptr_t(t) | IS_TRAITS); 
-	}
-
-	void MethodInfo::init_activationScope(const ScopeTypeChain* s) 
-	{ 
-		AvmAssert(_activationScopeOrTraits & IS_TRAITS);
-		AvmAssert(((Traits*)(_activationScopeOrTraits & ~IS_TRAITS)) == s->traits());
-		WB(pool()->core->GetGC(), this, &_activationScopeOrTraits, uintptr_t(s)); 
+		AvmAssert(_activation.getTraits() == NULL);
+        _activation.setTraits(pool()->core->GetGC(), this, t);
 	}
 
     void MethodInfo::setInterpImpl() 
@@ -810,10 +755,9 @@
 		AvmAssert(!(_flags & PROTOFUNC));
 // end AVMPLUS_UNCHECKED_HACK
 		
-		AvmAssert(_declaringScopeOrTraits & IS_TRAITS);
-		if (_declaringScopeOrTraits == (uintptr_t(0) | IS_TRAITS))
+		if (_declarer.getTraits() == NULL)
 		{
-			WB(pool()->core->GetGC(), this, &_declaringScopeOrTraits, uintptr_t(traits) | IS_TRAITS); 
+            _declarer.setTraits(pool()->core->GetGC(), this, traits);
 			_flags |= NEED_CLOSURE;
 			return true;
 		}
@@ -834,10 +778,10 @@
 		// to clear out data on AbstractionFunction so it can correctly be re-initialized.
 		// If our old function is ever used incorrectly, we throw an verify error in 
 		// MethodEnv::coerceEnter.
-		if (_declaringScopeOrTraits != (uintptr_t(0) | IS_TRAITS))
+		if (_declarer.getTraits() != NULL)
 		{
 			this->_flags &= ~RESOLVED;
-			this->_declaringScopeOrTraits = uintptr_t(0) | IS_TRAITS;
+            _declarer.setTraits(pool()->core->GetGC(), this, NULL);
 			this->_msref = pool()->core->GetGC()->emptyWeakRef;
 		}
 // begin AVMPLUS_UNCHECKED_HACK
@@ -854,8 +798,9 @@
 		AvmCore* core = pool()->core;
 		Traits* ftraits = fscope->traits();
 		AvmAssert(fscope->traits() == core->traits.function_itraits);
-		WB(core->GetGC(), this, &_declaringScopeOrTraits, uintptr_t(fscope)); 
+        _declarer.setScope(pool()->core->GetGC(), this, fscope);
 		
+        AvmAssert(declaringTraits() == ftraits);
 		return ftraits;
 	}
 	
@@ -1075,9 +1020,9 @@
 		const ScopeTypeChain* ascope = this->declaringScope()->cloneWithNewTraits(pool()->core->GetGC(), atraits);
 
 		atraits->resolveSignatures(toplevel);
-		atraits->init_declaringScopes(ascope);
+		atraits->setDeclaringScopes(ascope);
 
-		this->init_activationScope(ascope);
+        _activation.setScope(pool()->core->GetGC(), this, ascope);
 		
 		return atraits;
 	}
diff -r 1c05dd6490d9 core/MethodInfo.h
--- a/core/MethodInfo.h	Sat Nov 28 09:34:48 2009 -0800
+++ b/core/MethodInfo.h	Sun Nov 29 16:34:02 2009 -0800
@@ -45,6 +45,20 @@
 
 namespace avmplus
 {
+    class ScopeOrTraits
+    {
+    private:
+		static const uintptr_t IS_SCOPE = 0x01;
+    private:
+		uintptr_t _scopeOrTraits;	// if LSB clr, Traits*   if LSB set, ScopeTypeChain*
+    public:
+        explicit ScopeOrTraits(Traits* t);
+        Traits* getTraits() const;
+        const ScopeTypeChain* getScope() const;
+        void setTraits(MMgc::GC* gc, void* container, Traits* t);
+        void setScope(MMgc::GC* gc, void* container, const ScopeTypeChain* s);
+    };
+	
 	typedef uintptr_t (*GprMethodProc)(MethodEnv*, int32_t, uint32_t *);
 	typedef double (*FprMethodProc)(MethodEnv*, int32_t, uint32_t *);
 
@@ -359,12 +373,7 @@
 		Traits* activationTraits() const;
 		const ScopeTypeChain* activationScope() const;
 
-        bool hasNoScopeAndNotClassInitializer() const;
-    
-		// note, these are called "init" (rather than "set") because they 
-		// should be called exactly once per MethodInfo.
 		void init_activationTraits(Traits* t);
-		void init_declaringScope(const ScopeTypeChain* s);
 		
 		MethodSignaturep getMethodSignature();
 		void update_max_stack(int32_t max_stack);
@@ -373,8 +382,6 @@
 		MethodSignature* FASTCALL _getMethodSignature();
 		MethodSignature* FASTCALL _buildMethodSignature(const Toplevel* toplevel);
 
-		void init_activationScope(const ScopeTypeChain* s);
-
 	private:
 		struct NativeInfo
 		{
@@ -402,14 +409,11 @@
 	#endif
 		};
 
-	private:
-		static const uintptr_t IS_TRAITS = 0x01;
-	
 	// ------------------------ DATA SECTION BEGIN
 	private:
 		DWB(MMgc::GCWeakRef*)	_msref;						// our MethodSignature 
-		uintptr_t				_declaringScopeOrTraits;	// if LSB set, Traits*   if LSB clr, ScopeTypeChain*
-		uintptr_t				_activationScopeOrTraits;	// if LSB set, Traits*   if LSB clr, ScopeTypeChain*
+		ScopeOrTraits			_declarer;	
+		ScopeOrTraits			_activation;	
 		PoolObject* const		_pool;
 		const uint8_t* const	_abc_info_pos;		// pointer to abc MethodInfo record 
 		int						_flags;				// see bitmask defs above 
diff -r 1c05dd6490d9 core/ScopeChain.cpp
--- a/core/ScopeChain.cpp	Sat Nov 28 09:34:48 2009 -0800
+++ b/core/ScopeChain.cpp	Sun Nov 29 16:34:02 2009 -0800
@@ -115,7 +115,7 @@
 		Stringp r = core->kEmptyString;
 		r = r->appendLatin1("STC:[traits=");
 		r = r->append(_traits->format(core));
-		r = r->appendLatin1(",");
+		r = r->appendLatin1(";");
 		for (int32_t i = 0; i < fullsize; i++)
 		{
 			if (i > 0)
@@ -123,7 +123,8 @@
 			Traits* t = getScopeTraitsAt(i);
 			bool b = getScopeIsWithAt(i);
 			r = r->append(t->format(core));
-			r = r->appendLatin1(b?":1":":0");
+            if (b)
+                r = r->appendLatin1("(iswith)");
 		}
 		r = r->appendLatin1("]");
 		return r;
@@ -135,6 +136,7 @@
 		AvmAssert(vtable->traits == scopeTraits->traits());
 		const int32_t scopeTraitsSize = scopeTraits->size;
 		const int32_t outerSize = outer ? outer->_scopeTraits->size : 0;
+        AvmAssert(scopeTraitsSize >= outerSize);
 		const size_t padSize = scopeTraitsSize > 0 ? sizeof(Atom) * (scopeTraitsSize-1) : 0;
 		ScopeChain* nscope = new(gc, padSize) ScopeChain(vtable, abcEnv, scopeTraits, dxns);
 		for (int32_t i=0; i < outerSize; i ++)
diff -r 1c05dd6490d9 core/Toplevel.cpp
--- a/core/Toplevel.cpp	Sat Nov 28 09:34:48 2009 -0800
+++ b/core/Toplevel.cpp	Sun Nov 29 16:34:02 2009 -0800
@@ -56,20 +56,22 @@
 			// create a temp object vtable to use, since the real one isn't created yet
 			// later, in OP_newclass, we'll replace with the real Object vtable, so methods
 			// of Object and Class have the right scope.
-		object_ivtable = core->newVTable(core->traits.object_itraits, NULL, NULL);
+		object_ivtable = core->newVTable(core->traits.object_itraits, NULL, this);
 		Namespacep publicNS = core->getPublicNamespace(core->getDefaultAPI());
 		ScopeChain* object_iscope = ScopeChain::create(gc, object_ivtable, abcEnv, core->traits.object_istc, NULL, publicNS);
 		object_ivtable->resolveSignatures(object_iscope);
 
 		// global objects are subclasses of Object
-		bool wasResolved = mainTraits->isResolved();
 		VTable* mainVTable = core->newVTable(mainTraits, object_ivtable, this);
-		AvmAssert(mainTraits->isResolved());
-		if (!wasResolved)
-			mainTraits->init_declaringScopes(ScopeTypeChain::createEmpty(core->GetGC(), mainTraits));
-		ScriptEnv* main = new (gc) ScriptEnv(mainTraits->init, mainVTable, abcEnv);
+        const ScopeTypeChain* toplevel_STC = mainTraits->declaringScope();
+        if (!toplevel_STC)
+        {
+            toplevel_STC = ScopeTypeChain::createEmpty(core->GetGC(), mainTraits);
+	        mainTraits->setDeclaringScopes(toplevel_STC);
+        }
+        toplevel_scope = ScriptEnv::createScriptScope(toplevel_STC, mainVTable, abcEnv);
+		ScriptEnv* main = new (gc) ScriptEnv(mainTraits->init, toplevel_scope);
 		mainVTable->init = main;
-		toplevel_scope = ScopeChain::create(gc, mainVTable, abcEnv, mainTraits->init->declaringScope(), NULL, publicNS);
 		mainVTable->resolveSignatures(toplevel_scope);
 
 		_global = new (gc, mainVTable->getExtraSize()) ScriptObject(mainVTable, NULL);
@@ -782,9 +784,6 @@
 		Binding b = BIND_NONE;
 		if (traits && ref.isBinding())
 		{
-			if (!traits->isResolved())
-				traits->resolveSignatures(this);
-				
 			b = traits->getTraitsBindings()->findBindingAndDeclarer(ref, declarer);
 			if (b == BIND_AMBIGUOUS)
 			{
diff -r 1c05dd6490d9 core/Traits-inlines.h
--- a/core/Traits-inlines.h	Sat Nov 28 09:34:48 2009 -0800
+++ b/core/Traits-inlines.h	Sun Nov 29 16:34:02 2009 -0800
@@ -59,29 +59,34 @@
                     TraitsBindingsp _base,
                     MultinameHashtable* _bindings,
                     uint32_t _slotCount,
-                    uint32_t _methodCount) :
+                    uint32_t _methodCount,
+                    bool typesValid) :
     owner(_owner),
     base(_base),
     m_bindings(_bindings),
     slotCount(_slotCount),
     methodCount(_methodCount),
-    m_slotSize(0)
+    m_slotSize(0),
+    m_typesValid(typesValid?1:0)
 { }
 
 REALLY_INLINE Traitsp TraitsBindings::getSlotTraits(uint32_t i) const
 {
+    AvmAssert(m_typesValid);
     AvmAssert(i < slotCount);
     return getSlots()[i].type;
 }
 
 REALLY_INLINE uint32_t TraitsBindings::getSlotOffset(uint32_t i) const
 {
+    AvmAssert(m_typesValid);
     AvmAssert(i < slotCount);
     return getSlots()[i].offset();
 }
 
 REALLY_INLINE SlotStorageType TraitsBindings::calcSlotAddrAndSST(uint32_t i, void* pin, void*& pout) const
 {
+    AvmAssert(m_typesValid);
     AvmAssert(i < slotCount);
     uint32_t offsetAndSST = getSlots()[i].offsetAndSST;
     pout = (void*)(((uint32_t*)pin) + (offsetAndSST >> 3));
@@ -90,6 +95,7 @@
 
 REALLY_INLINE MethodInfo* TraitsBindings::getMethod(uint32_t i) const
 {
+    AvmAssert(m_typesValid);
     AvmAssert(i < methodCount);
     return getMethods()[i].f;
 }
@@ -116,26 +122,31 @@
 
 REALLY_INLINE TraitsBindings::SlotInfo* TraitsBindings::getSlots()
 {
+    AvmAssert(m_typesValid);
     return (SlotInfo*)(this + 1);
 }
 
 REALLY_INLINE const TraitsBindings::SlotInfo* TraitsBindings::getSlots() const
 {
+    AvmAssert(m_typesValid);
     return (const SlotInfo*)(this + 1);
 }
 
 REALLY_INLINE TraitsBindings::BindingMethodInfo* TraitsBindings::getMethods()
 {
+    AvmAssert(m_typesValid);
     return (BindingMethodInfo*)(getSlots() + slotCount);
 }
 
 REALLY_INLINE const TraitsBindings::BindingMethodInfo* TraitsBindings::getMethods() const
 {
+    AvmAssert(m_typesValid);
     return (const BindingMethodInfo*)(getSlots() + slotCount);
 }
 
 REALLY_INLINE void TraitsBindings::setSlotInfo(uint32_t i, Traits* t, SlotStorageType sst, uint32_t offset)
 {
+    AvmAssert(m_typesValid);
     AvmAssert(i < slotCount);
     // don't need WB here
     getSlots()[i].type = t;
@@ -147,6 +158,7 @@
 
 REALLY_INLINE void TraitsBindings::setMethodInfo(uint32_t i, MethodInfo* f)
 {
+    AvmAssert(m_typesValid);
     AvmAssert(i < methodCount);
     // don't need WB here
     getMethods()[i].f = f;
@@ -172,6 +184,13 @@
     return metadataPos;
 }
 
+REALLY_INLINE const ScopeTypeChain* Traits::declaringScope() const
+{
+    // don't assert, some callers need to know
+    // AvmAssert(m_declaringScope != NULL);
+    return m_declaringScope;
+}
+
 REALLY_INLINE uint16_t Traits::getSizeOfInstance() const
 {
     return m_sizeofInstance;
@@ -179,26 +198,26 @@
 
 REALLY_INLINE uint32_t Traits::getHashtableOffset() const
 {
-    AvmAssert(linked);
+    AvmAssert(m_resolved);
     return m_hashTableOffset;
 }
 
 REALLY_INLINE uint32_t Traits::getTotalSize() const
 {
-    AvmAssert(linked);
+    AvmAssert(m_resolved);
     return m_totalSize;
 }
 
 REALLY_INLINE uint32_t Traits::getSlotAreaSize() const
 {
-    AvmAssert(linked);
+    AvmAssert(m_resolved);
     return getTotalSize() - m_sizeofInstance - (m_hashTableOffset ? sizeof(InlineHashtable) : 0);
 }
 
 // in bytes. includes size for all base classes too.
 REALLY_INLINE uint32_t Traits::getExtraSize() const
 {
-    AvmAssert(linked);
+    AvmAssert(m_resolved);
     AvmAssert(getTotalSize() >= m_sizeofInstance);
     return getTotalSize() - m_sizeofInstance;
 }
@@ -223,7 +242,6 @@
 
 REALLY_INLINE TraitsBindingsp Traits::getTraitsBindings()
 {
-    AvmAssert(this->linked);
     AvmAssert(m_tbref != NULL);
     TraitsBindings* tb;
     if ((tb = (TraitsBindings*)m_tbref->get()) == NULL)
@@ -233,7 +251,6 @@
 
 REALLY_INLINE TraitsMetadatap Traits::getTraitsMetadata()
 {
-    AvmAssert(this->linked);
     AvmAssert(m_tmref != NULL);
     TraitsMetadata* tm;
     if ((tm = (TraitsMetadata*)m_tmref->get()) == NULL)
@@ -311,7 +328,7 @@
 
 REALLY_INLINE bool Traits::isResolved() const
 {
-    return linked;
+    return m_resolved;
 }
 
 REALLY_INLINE bool Traits::isActivationTraits() const
@@ -321,13 +338,13 @@
 
 REALLY_INLINE bool Traits::needsHashtable() const
 {
-    AvmAssert(linked);
+    AvmAssert(m_resolved);
     return m_needsHashtable;
 }
 
 REALLY_INLINE void Traits::set_needsHashtable(bool v)
 {
-    AvmAssert(!linked);
+    AvmAssert(!m_resolved);
     m_needsHashtable = v;
 }
 
@@ -361,10 +378,16 @@
 // essential for efficient building of IMT thunks.
 REALLY_INLINE bool Traits::implementsNewInterfaces() const
 {
-    AvmAssert(linked);
+    AvmAssert(m_resolved);
     return m_implementsNewInterfaces;
 }
 
+REALLY_INLINE void Traits::setDeclaringScopes(const ScopeTypeChain* stc) 
+{ 
+    AvmAssert(stc != NULL);
+    m_declaringScope = stc;
+}
+
 REALLY_INLINE InterfaceIterator::InterfaceIterator(Traits* t)
 {
     st = t->m_secondary_supertypes;
diff -r 1c05dd6490d9 core/Traits.cpp
--- a/core/Traits.cpp	Sat Nov 28 09:34:48 2009 -0800
+++ b/core/Traits.cpp	Sun Nov 29 16:34:02 2009 -0800
@@ -52,13 +52,15 @@
 												TraitsBindingsp _base, 
 												MultinameHashtable* _bindings, 
 												uint32_t slotCount, 
-												uint32_t methodCount)
+												uint32_t methodCount,
+                                                bool typesValid)
 	{
-		const uint32_t extra = slotCount * sizeof(SlotInfo) + 
-						methodCount * sizeof(MethodInfo);
+		const uint32_t extra = typesValid ? 
+                                slotCount * sizeof(SlotInfo) + methodCount * sizeof(MethodInfo) :
+                                0;
 
-		TraitsBindings* tb = new (gc, extra) TraitsBindings(_owner, _base, _bindings, slotCount, methodCount);
-		if (_base)
+		TraitsBindings* tb = new (gc, extra) TraitsBindings(_owner, _base, _bindings, slotCount, methodCount, typesValid);
+		if (_base && typesValid)
 		{
 			if (_base->slotCount)
 			{
@@ -333,8 +335,8 @@
 					}
 					case BKIND_METHOD:
 					{
-						MethodInfo* virt = ifcd->getMethod(AvmCore::bindingToMethodId(iBinding));
-						MethodInfo* over = this->getMethod(AvmCore::bindingToMethodId(cBinding));
+						MethodInfo* virt = ifcd->getMethods()[AvmCore::bindingToMethodId(iBinding)].f;
+						MethodInfo* over = this->getMethods()[AvmCore::bindingToMethodId(cBinding)].f;
 						if (!checkOverride(core, virt, over))
 							return false;
 						break;
@@ -349,8 +351,8 @@
 							if (!AvmCore::hasGetterBinding(cBinding))
 								return false;
 							
-							MethodInfo* virt = ifcd->getMethod(AvmCore::bindingToGetterId(iBinding));
-							MethodInfo* over = this->getMethod(AvmCore::bindingToGetterId(cBinding));
+							MethodInfo* virt = ifcd->getMethods()[AvmCore::bindingToGetterId(iBinding)].f;
+							MethodInfo* over = this->getMethods()[AvmCore::bindingToGetterId(cBinding)].f;
 							if (!checkOverride(core, virt, over))
 								return false;
 						}
@@ -376,7 +378,6 @@
 	void TraitsBindings::fixOneInterfaceBindings(Traitsp ifc)
 	{
 		AvmAssert(!owner->isInterface());
-		AvmAssert(ifc->linked);
 
 		TraitsBindingsp ifcd = ifc->getTraitsBindings();
 		StTraitsBindingsIterator iter(ifcd);
@@ -724,8 +725,7 @@
 								MultinameHashtable* bindings, 
 								uint32_t& slotCount, 
 								uint32_t& methodCount,
-								uint32_t& n32BitNonPointerSlots,
-								uint32_t& n64BitNonPointerSlots,
+								SlotSizeInfo* slotSizeInfo,
 								const Toplevel* toplevel) const
 	{
 		const uint8_t* pos = traitsPosStart();
@@ -766,9 +766,9 @@
 					uint32_t slot_id = sic.calc_id(ne.id);
 					if (toplevel)
 					{
-						AvmAssert(!this->linked);
+						AvmAssert(!this->m_resolved);
 						
-						// first time thru, we must do some additional verification checks... these were formerly 
+						// when we resolve, we must do some additional verification checks... these were formerly 
 						// done in AbcParser::parseTraits but require the base class to be resolved first, so we
 						// now defer it to here.
 						
@@ -794,19 +794,28 @@
 							toplevel->throwVerifyError(kIllegalSlotError, core->toErrorString(this));
 
 					}
-					AvmAssert(!(ne.id > nameCount));						// unhandled verify error
-					AvmAssert(!(basetb && slot_id < basetb->slotCount));	// unhandled verify error
-					AvmAssert(!(bindings->get(name, ns) != BIND_NONE));		// unhandled verify error
+                    // these assertions are commented out because the new lazy-init code can
+                    // fire them inapppriately -- they all indicate malformed ABC, but they 
+                    // *can* occur on a pre-resolve build of TraitsBindings. We'll just let
+                    // them slide by since we check for them all at resolve time.
+					// AvmAssert(!(ne.id > nameCount));						// unhandled verify error
+					// AvmAssert(!(basetb && slot_id < basetb->slotCount));	// unhandled verify error
+					// AvmAssert(!(bindings->get(name, ns) != BIND_NONE));		// unhandled verify error
 					addVersionedBindings(bindings, name, compat_nss, AvmCore::makeSlotBinding(slot_id, ne.kind==TRAIT_Slot ? BKIND_VAR : BKIND_CONST));
+                    if (slotSizeInfo != NULL)
+                    {   
+                        // only do this if we need it -- doing it too early could cause us to reference a not-yet-loaded
+                        // type which we don't need yet, causing an unnecessary verification failure
 					Traitsp slotType = (ne.kind == TRAIT_Class) ? 
 										pool->getClassTraits(ne.info) :
 										pool->resolveTypeName(ne.info, toplevel);
 					if (!isPointerSlot(slotType))
 					{
 						if (is8ByteSlot(slotType))
-							++n64BitNonPointerSlots;
+                                slotSizeInfo->nonPointer64BitSlotCount += 1;
 						else
-							++n32BitNonPointerSlots;
+                                slotSizeInfo->nonPointer32BitSlotCount += 1;
+                        }
 					}
 					break;
 				}
@@ -876,6 +885,8 @@
 			}
 		} // for i
 		slotCount = sic.slotCount();
+        if (slotSizeInfo)
+            slotSizeInfo->pointerSlotCount = slotCount - (slotSizeInfo->nonPointer32BitSlotCount + slotSizeInfo->nonPointer64BitSlotCount + baseSlotCount);
 	}
 		
 	namespace
@@ -964,10 +975,12 @@
 		}
 	}
 	
-	inline uint32_t Traits::computeSlotAreaStart(uint32_t nPointerSlots, uint32_t n32BitNonPointerSlots, uint32_t n64BitNonPointerSlots) const
+	inline uint32_t Traits::computeSlotAreaStart(const SlotSizeInfo& slotSizeInfo) const
 	{
 		// Actual size of slots can be larger because of padding inserted at beginning of slot area and between 4 byte slots and 8 byte slots.
-		uint32_t minSizeOfSlots = (nPointerSlots * sizeof(void*)) + (n32BitNonPointerSlots * 4) + (n64BitNonPointerSlots * 8);
+		uint32_t minSizeOfSlots = (slotSizeInfo.pointerSlotCount * sizeof(void*)) + 
+                                    (slotSizeInfo.nonPointer32BitSlotCount * 4) + 
+                                    (slotSizeInfo.nonPointer64BitSlotCount * 8);
         uint32_t result = 0;
 		if (base && minSizeOfSlots)
 		{
@@ -998,8 +1011,8 @@
 				//
 				// If either of these asserts fail, the slot offset calculation code in finishSlotsAndMethods
 				// will most likely produce incorrect slot offsets for 8 byte slots.
-                AvmAssert(((result % 8) == 0) || (!align8ByteSlots) || (n64BitNonPointerSlots == 0));
-                AvmAssert(((result % 8) == 0) || (!alignPointersTo8Bytes) || (nPointerSlots == 0));
+                AvmAssert(((result % 8) == 0) || (!align8ByteSlots) || (slotSizeInfo.nonPointer64BitSlotCount == 0));
+                AvmAssert(((result % 8) == 0) || (!alignPointersTo8Bytes) || (slotSizeInfo.pointerSlotCount == 0));
 			}
 		}
 		else
@@ -1014,23 +1027,20 @@
 									TraitsBindings* tb, 
 									const Toplevel* toplevel,
 									AbcGen* abcGen,
-									uint32_t n32BitNonPointerSlots,
-									uint32_t n64BitNonPointerSlots) const
+									const SlotSizeInfo& sizeInfo) const
 	{
 		const uint8_t* pos = traitsPosStart();
 		
 		SlotIdCalcer sic(basetb ? basetb->slotCount : 0, this->allowEarlyBinding());
-		uint32_t nBaseSlots = tb->base ? tb->base->slotCount : 0;
-		uint32_t nPointerSlots = tb->slotCount - (n32BitNonPointerSlots + n64BitNonPointerSlots + nBaseSlots);
 		
-		int32_t slotAreaStart = computeSlotAreaStart(nPointerSlots, n32BitNonPointerSlots, n64BitNonPointerSlots);
+		int32_t slotAreaStart = computeSlotAreaStart(sizeInfo);
 		
 		int32_t next32BitSlotOffset = slotAreaStart;
-		int32_t endOf32BitSlots = next32BitSlotOffset + (n32BitNonPointerSlots * 4);
-		int32_t nextPointerSlotOffset = alignPointersTo8Bytes && (nPointerSlots != 0) ? pad8(endOf32BitSlots) : endOf32BitSlots;
-		int32_t endOfPointerSlots = nextPointerSlotOffset + (nPointerSlots * sizeof(void*));
-		int32_t next64BitSlotOffset = align8ByteSlots && (n64BitNonPointerSlots != 0) ? pad8(endOfPointerSlots) : endOfPointerSlots;
-		int32_t endOf64BitSlots = next64BitSlotOffset + (n64BitNonPointerSlots * 8);
+		int32_t endOf32BitSlots = next32BitSlotOffset + (sizeInfo.nonPointer32BitSlotCount * 4);
+		int32_t nextPointerSlotOffset = alignPointersTo8Bytes && (sizeInfo.pointerSlotCount != 0) ? pad8(endOf32BitSlots) : endOf32BitSlots;
+		int32_t endOfPointerSlots = nextPointerSlotOffset + (sizeInfo.pointerSlotCount * sizeof(void*));
+		int32_t next64BitSlotOffset = align8ByteSlots && (sizeInfo.nonPointer64BitSlotCount != 0) ? pad8(endOfPointerSlots) : endOfPointerSlots;
+		int32_t endOf64BitSlots = next64BitSlotOffset + (sizeInfo.nonPointer64BitSlotCount * 8);
 
 		NameEntry ne;
 		const uint32_t nameCount = pos ? AvmCore::readU30(pos) : 0;
@@ -1165,8 +1175,6 @@
 
 	TraitsBindings* Traits::_buildTraitsBindings(const Toplevel* toplevel, AbcGen* abcGen)
 	{
-		// no, this can be called before the resolved bit is set
-		//AvmAssert(this->linked);
 #ifdef AVMPLUS_VERBOSE
 		if (pool->isVerbose(VB_traits))
 		{
@@ -1195,7 +1203,7 @@
 			NamespaceSetp compat_nss = nss;
 			addVersionedBindings(bindings, this->name(), compat_nss, AvmCore::makeSlotBinding(0, BKIND_VAR));
 			// bindings just need room for one slot binding
-			thisData = TraitsBindings::alloc(gc, this, /*base*/NULL, bindings, /*slotCount*/1, /*methodCount*/0);
+			thisData = TraitsBindings::alloc(gc, this, /*base*/NULL, bindings, /*slotCount*/1, /*methodCount*/0, true);
 			thisData->setSlotInfo(0, t, bt2sst(getBuiltinType(t)), this->m_sizeofInstance);
 			thisData->m_slotSize = is8ByteSlot(t) ? 8 : 4;
 		}
@@ -1217,16 +1225,18 @@
 				}
 			}
 			
+            SlotSizeInfo _slotSizeInfo;
+            SlotSizeInfo* slotSizeInfo = (m_resolved || toplevel != NULL) ? &_slotSizeInfo : NULL;
+
 			uint32_t slotCount = 0;
 			uint32_t methodCount = 0;
-			uint32_t n32BitNonPointerSlots = 0;
-			uint32_t n64BitNonPointerSlots = 0;
-			buildBindings(basetb, bindings, slotCount, methodCount, n32BitNonPointerSlots, n64BitNonPointerSlots, toplevel);
+			buildBindings(basetb, bindings, slotCount, methodCount, slotSizeInfo, toplevel);
 			
-			thisData = TraitsBindings::alloc(gc, this, basetb, bindings, slotCount, methodCount);
-			thisData->m_slotSize = finishSlotsAndMethods(basetb, thisData, toplevel, abcGen, n32BitNonPointerSlots, n64BitNonPointerSlots);
-
-			if (basetb) {
+			thisData = TraitsBindings::alloc(gc, this, basetb, bindings, slotCount, methodCount, slotSizeInfo != NULL);
+            if (slotSizeInfo)
+            {
+                thisData->m_slotSize = finishSlotsAndMethods(basetb, thisData, toplevel, abcGen, *slotSizeInfo);
+                if (basetb)
 				thisData->m_slotSize += basetb->m_slotSize;
 			}
 
@@ -1246,6 +1256,8 @@
 		// much easier to always round slotsize up unconditionally rather than
 		// only for cases with hashtable, so that's what we'll do. (MMgc currently
 		// allocate in 8-byte increments anyway, so we're not really losing any space.)
+        // (only really necessary to do this if we calced slotSizeInfo, but simpler & harmless
+        // to just do it unconditionally)
 		thisData->m_slotSize = (thisData->m_slotSize + (sizeof(uintptr_t)-1)) & ~(sizeof(uintptr_t)-1);
 		
 		// remember the cap we need
@@ -1274,8 +1286,6 @@
 
 	TraitsMetadata* Traits::_buildTraitsMetadata()
 	{
-		AvmAssert(this->linked);
-
 #ifdef AVMPLUS_VERBOSE
 		if (pool->isVerbose(VB_traits))
 		{
@@ -1345,32 +1355,6 @@
 		return tm;
 	}
 
-	void Traits::init_declaringScopes(const ScopeTypeChain* stc) 
-	{ 
-		AvmAssert(linked);
-		if (!linked)
-			return;
-		
-		if (this->init)
-			this->init->init_declaringScope(stc);
-
-		{
-			TraitsBindingsp tb = this->getTraitsBindings();
-			const TraitsBindings::BindingMethodInfo* tbm		= tb->getMethods();
-			const TraitsBindings::BindingMethodInfo* tbm_end	= tbm + tb->methodCount;
-			for ( ; tbm < tbm_end; ++tbm) 
-			{
-				if (tbm->f == NULL)
-					continue;
-					
-				if (tbm->f->declaringTraits() == this)
-				{
-					tbm->f->init_declaringScope(stc);
-				}
-			}
-		}
-	}
-
 	/**
 	 * add t to pending[] ahead of any existing entries that are
 	 * subtypes or implementers of t, so that when we iterate through
@@ -1398,7 +1382,7 @@
 	{
 		// toplevel actually can be null, when resolving the builtin classes...
 		// but they should never cause verification errors in functioning builds
-		if (linked)
+		if (m_resolved)
 			return;
 
 		List<Traits*> pending(core->gc);
@@ -1408,7 +1392,7 @@
 			Traits* t = m_primary_supertypes[i];
 			if (t == NULL || t == this)
 				break;
-			if (!t->linked)
+			if (!t->m_resolved)
 				pending.add(t);
 		}
 
@@ -1417,12 +1401,12 @@
 		// interfaces are visited before that type itself is visited.
 		for (Traits** st = m_secondary_supertypes; *st != NULL; st++) {
 			Traits* t = *st;
-			if (t != this && !t->linked)
+			if (t != this && !t->m_resolved)
 				insertSupertype(t, pending);
 		}
 
 		for (uint32_t i = 0, n = pending.size(); i < n; i++) {
-			AvmAssert(!pending[i]->linked);
+			AvmAssert(!pending[i]->m_resolved);
 			pending[i]->resolveSignaturesSelf(toplevel);
 		}
 
@@ -1440,12 +1424,12 @@
 	void Traits::resolveSignaturesSelf(const Toplevel* toplevel)
 	{
 #ifdef DEBUG
-		AvmAssert(!linked);
+		AvmAssert(!m_resolved);
 		// make sure our supertypes are resolved. (must be done before calling _buildTraitsBindings)
 		for (Traits* t = this->base; t != NULL; t = t->base)
-			AvmAssert(t->linked);
+			AvmAssert(t->m_resolved);
 		for (Traits** st = this->m_secondary_supertypes; *st != NULL; st++)
-			AvmAssert(*st == this || (*st)->linked);
+			AvmAssert(*st == this || (*st)->m_resolved);
 #endif
 
 		MMgc::GC* gc = core->GetGC();
@@ -1456,6 +1440,8 @@
 #else
          pgen = &gen;
 #endif	
+        // we might already have one -- if so, toss it
+        m_tbref = gc->emptyWeakRef;
  		TraitsBindings* tb = _buildTraitsBindings(toplevel, pgen);
 		this->genInitBody(toplevel, gen);
 
@@ -1493,6 +1479,7 @@
 		}
 
 		// make sure all the methods have resolved types
+		if (tb->methodCount)
 		{
 			const TraitsBindings::BindingMethodInfo* tbm		= tb->getMethods();
 			const TraitsBindings::BindingMethodInfo* tbm_end	= tbm + tb->methodCount;
@@ -1533,7 +1520,7 @@
 
 		if (!legal)
 		{
-			AvmAssert(!linked);
+			AvmAssert(!m_resolved);
 			Multiname qname(ns(), name());
 			if (toplevel)
 				toplevel->throwVerifyError(kIllegalOverrideError, core->toErrorString(&qname), core->toErrorString(this));
@@ -1542,7 +1529,7 @@
 
 		tb->buildSlotDestroyInfo(gc, m_slotDestroyInfo, slotAreaCount, slotAreaSize);
 
-		linked = true;
+		m_resolved = true;
 	}
     
 #ifdef VMCFG_AOT
@@ -1748,6 +1735,7 @@
 		{
 			// make one
 			this->init = new (gc) MethodInfo(MethodInfo::kInitMethodStub, this);
+            AvmAssert(this->init->declaringTraits() == this);
 
 			newMethodBody.writeInt(2); // max_stack
 			newMethodBody.writeInt(1); //local_count
@@ -1771,7 +1759,7 @@
 
 	void Traits::destroyInstance(ScriptObject* obj) const
 	{
-		AvmAssert(linked);
+		AvmAssert(m_resolved);
 
 		InlineHashtable* ht = m_hashTableOffset ? obj->getTableNoInit() : NULL;
 
@@ -1949,18 +1937,12 @@
 
 	TraitsBindings* FASTCALL Traits::_getTraitsBindings() 
 	{ 
-		AvmAssert(this->linked);
-		// note: TraitsBindings are always built the first time in resolveSignature; this is only 
-		// executed for subsequent re-buildings. Thus we pass NULL for toplevel (it's only used
-		// for verification errors, but those will have been caught prior to this) and for
-		// abcGen (since it only needs to be done once).
 		TraitsBindings* tb = _buildTraitsBindings(/*toplevel*/NULL, /*abcGen*/NULL);
 		return tb;
 	}
 
 	TraitsMetadata* FASTCALL Traits::_getTraitsMetadata() 
 	{ 
-		AvmAssert(this->linked);
 		TraitsMetadata* tm = _buildTraitsMetadata();
 		return tm;
 	}
diff -r 1c05dd6490d9 core/Traits.h
--- a/core/Traits.h	Sat Nov 28 09:34:48 2009 -0800
+++ b/core/Traits.h	Sun Nov 29 16:34:02 2009 -0800
@@ -129,14 +129,15 @@
 							TraitsBindingsp _base, 
 							MultinameHashtable* _bindings,
 							uint32_t _slotCount, 
-							uint32_t _methodCount);
+							uint32_t _methodCount,
+                            bool typesValid);
 
 	public:
 		static const uint32_t MAX_SLOT_OFFSET = (1U << 31) - 1;
 
 	public:
 		
-		static TraitsBindings* alloc(MMgc::GC* gc, Traits* _owner, TraitsBindingsp _base, MultinameHashtable* _bindings, uint32_t slotCount, uint32_t methodCount);
+		static TraitsBindings* alloc(MMgc::GC* gc, Traits* _owner, TraitsBindingsp _base, MultinameHashtable* _bindings, uint32_t slotCount, uint32_t methodCount, bool typesValid);
 
 		void buildSlotDestroyInfo(MMgc::GC* gc, FixedBitSet& slotDestroyInfo, uint32_t slotAreaCount, uint32_t sizeOfSlotArea) const;
 
@@ -179,12 +180,14 @@
 		private:    Traits**						m_interfaces;
 		public:		const uint32_t					slotCount;			// including slots in our base classes
 		public:		const uint32_t					methodCount;		// including methods in our base classes
-		private:	uint32_t						m_slotSize;			// size of slot area in bytes, including base classes
-		// plus extra at end
+		private:	uint32_t						m_slotSize;			// size of slot area in bytes, including base classes (only valid after resolveSignatures)
+        private:    const uint32_t                  m_typesValid;       // bool, just int for alignment
+        // plus extra at end, iff m_typesValid is nonzero
 	// ------------------------ DATA SECTION END
 
 	};
 
+
 	// NOTE: caller must check for null key, eg,
 	//
 	//		StTraitsBindingsIterator iter(mnht);
@@ -251,6 +254,7 @@
 
 	public:
         
+        const ScopeTypeChain* declaringScope() const;
 		uint16_t getSizeOfInstance() const;
 		uint32_t getTotalSize() const;		
 		uint32_t getHashtableOffset() const;
@@ -269,21 +273,28 @@
 
 		void computeSlotAreaCountAndSize(TraitsBindings* tb, uint32_t& slotCount, uint32_t& size) const; 
         
-		uint32_t computeSlotAreaStart(uint32_t nPointerSlots, uint32_t n32BitNonPointerSlots, uint32_t n64BitNonPointerSlots) const;
+        struct SlotSizeInfo
+        {
+            uint32_t pointerSlotCount;
+            uint32_t nonPointer32BitSlotCount;
+            uint32_t nonPointer64BitSlotCount;
+            
+            SlotSizeInfo() : pointerSlotCount(0), nonPointer32BitSlotCount(0), nonPointer64BitSlotCount(0) { }
+        };
+        
+		uint32_t computeSlotAreaStart(const SlotSizeInfo& slotSizeInfo) const;
 		
 		void buildBindings(TraitsBindingsp basetb, 
 							MultinameHashtable* bindings, 
 							uint32_t& slotCount, 
 							uint32_t& methodCount,
-							uint32_t& n32BitNonPointerSlots,
-							uint32_t& n64BitNonPointerSlots,
+							SlotSizeInfo* sizeInfo,
 							const Toplevel* toplevel) const;
 		uint32_t finishSlotsAndMethods(TraitsBindingsp basetb, 
 									TraitsBindings* tb, 
 									const Toplevel* toplevel,
 									AbcGen* abcGen,
-									uint32_t n32BitNonPointerSlots,
-									uint32_t n64BitNonPointerSlots) const;
+									const SlotSizeInfo& sizeInfo) const;
 		TraitsBindings* _buildTraitsBindings(const Toplevel* toplevel, AbcGen* abcGen);
 
 		TraitsMetadata* _buildTraitsMetadata();
@@ -394,9 +405,7 @@
 		Stringp format(AvmCore* core, bool includeAllNamespaces = false) const;
 #endif
 
-		// call init_declaringScope for each method that we own. this should be
-		// called exactly once per Traits, *after* the Traits has been resolved.
-		void init_declaringScopes(const ScopeTypeChain* stc);
+		void setDeclaringScopes(const ScopeTypeChain* stc);
 		
 		Namespacep ns() const;
 		Stringp name() const;
@@ -518,6 +527,8 @@
 	private:	FixedBitSet				m_slotDestroyInfo;	
 	private:	DWB(MMgc::GCWeakRef*)	m_tbref;				// our TraitsBindings 
 	private:	DWB(MMgc::GCWeakRef*)	m_tmref;				// our TraitsMetadata
+	private:	DWB(const ScopeTypeChain*)	
+                                        m_declaringScope;
 #ifdef VMCFG_CACHE_GQCN
 	private:	DRCWB(Stringp)			_fullname;		// value returned by formatClassName
 #endif
@@ -531,7 +542,7 @@
 	private:    uint8_t					m_supertype_offset;			// if this traits is primary, == offset in primary_supertypes array; otherwise == offset of supertype_cache
 	// 7 bits follow
 	private:	uint32_t				m_needsHashtable:1;			// If true, the class needs a hash table. Typically true for dynamic classes, but will be false for XML
-	private:	uint32_t				linked:1;					// set once signature types have been resolved */
+	private:	uint32_t				m_resolved:1;				// set once signature types have been resolved */
 	public:		uint32_t				final:1;					// set when the class cannot be extended */
 	public:		uint32_t				commonBase:1;				// used for Verify::findCommonBase */
 	public:		uint32_t				isDictionary:1;				// how we implement dictionary or strict style lookups
diff -r 1c05dd6490d9 core/VTable.cpp
--- a/core/VTable.cpp	Sat Nov 28 09:34:48 2009 -0800
+++ b/core/VTable.cpp	Sun Nov 29 16:34:02 2009 -0800
@@ -305,7 +305,7 @@
 		if (!traits->isResolved())
 		{
 			traits->resolveSignatures(toplevel());
-			traits->init_declaringScopes(scope->scopeTraits());
+			traits->setDeclaringScopes(scope->scopeTraits());
 		}
 
 #if defined(DEBUG) || defined(_DEBUG)
@@ -450,8 +450,6 @@
 		}
 
 		AvmAssert(itraits != NULL);
-		itraits->resolveSignatures(toplevel);
-		ctraits->resolveSignatures(toplevel);
 
 		VTable* objVecVTable = toplevel->objectVectorClass->vtable;
 		AbcEnv* objVecAbcEnv = toplevel->vectorobj_cscope->abcEnv();
diff -r 1c05dd6490d9 core/Verifier.cpp
--- a/core/Verifier.cpp	Sat Nov 28 09:34:48 2009 -0800
+++ b/core/Verifier.cpp	Sun Nov 29 16:34:02 2009 -0800
@@ -250,7 +250,7 @@
         // initial scope chain types 
         int outer_depth = 0;
 
-        if (info->hasNoScopeAndNotClassInitializer())
+        if (info->declaringTraits()->init != info && info->declaringScope() == NULL)
         {
             // this can occur when an activation scope inside a class instance method
             // contains a nested getter, setter, or method.  In that case the scope 
@@ -785,8 +785,10 @@
 				ctraits->resolveSignatures(toplevel);
 				itraits->resolveSignatures(toplevel);
 
-				ctraits->init_declaringScopes(cscope);
-				itraits->init_declaringScopes(iscope);
+                // we must always set the scopes here, whether or not they have been set yet and
+                // whether or not the traits were resolved already.
+                ctraits->setDeclaringScopes(cscope);
+                itraits->setDeclaringScopes(iscope);
 
 				emitCoerce(CLASS_TYPE, state->sp()); 
 				coder->writeOp1(state, pc, opcode, imm30, ctraits);
diff -r 1c05dd6490d9 core/instr.cpp
--- a/core/instr.cpp	Sat Nov 28 09:34:48 2009 -0800
+++ b/core/instr.cpp	Sun Nov 29 16:34:02 2009 -0800
@@ -92,8 +92,7 @@
     Binding b = BIND_NONE;
     if (traits && ref->isBinding())
     {
-        if (!traits->isResolved())
-            traits->resolveSignatures(env->toplevel());
+        // note, you no longer must resolve the traits in order to find the binding!
 
         TraitsBindingsp tb = traits->getTraitsBindings();
         if (!ref->isNsset())
diff -r 1c05dd6490d9 extensions/SamplerScript.cpp
--- a/extensions/SamplerScript.cpp	Sat Nov 28 09:34:48 2009 -0800
+++ b/extensions/SamplerScript.cpp	Sun Nov 29 16:34:02 2009 -0800
@@ -230,6 +230,7 @@
 	static VTable* _newVT(Toplevel* toplevel, PoolObject* pool, uint16_t sz)
 	{
 		Traits* t = Traits::newTraits(pool, NULL, sz, 0, 0, TRAITSTYPE_RT);
+        t->resolveSignatures(toplevel);
 		return toplevel->core()->newVTable(t, NULL, toplevel);
 	}
 #endif
