From ee046f95b8a85b04dc831f3806f53698f431f24d Mon Sep 17 00:00:00 2001 From: Tommy Reilly Date: Fri, 25 Feb 2011 13:03:02 -0500 Subject: [PATCH] Bug 636438 - fix exact tracing for Dictionary (r=lhansen) --- core/ScriptObject.cpp | 12 +----------- extensions/DictionaryGlue.h | 14 +++++++++++++- generated/extensions-tracers.hh | 1 + 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/core/ScriptObject.cpp b/core/ScriptObject.cpp index 88102400..e8fb119f 100644 --- a/core/ScriptObject.cpp +++ b/core/ScriptObject.cpp @@ -114,18 +114,8 @@ namespace avmplus // Avoid initializing the hash table here InlineHashtable* iht = getTableNoInit(); iht->gcTrace(gc); - - if (vtable->traits->isDictionary()) - { - // This code was ripped out of ScriptObject::getTableNoInit - union { - uint8_t* p; - HeapHashtable** hht; - }; - p = (uint8_t*)this + vtable->traits->getHashtableOffset(); - gc->TraceLocation(hht); - } } + return false; } diff --git a/extensions/DictionaryGlue.h b/extensions/DictionaryGlue.h index 81e8dafb..5a5f0648 100644 --- a/extensions/DictionaryGlue.h +++ b/extensions/DictionaryGlue.h @@ -43,7 +43,7 @@ namespace avmplus { - class GC_AS3_EXACT(DictionaryObject, ScriptObject) + class GC_AS3_EXACT_WITH_HOOK(DictionaryObject, ScriptObject) { protected: DictionaryObject(VTable *vtable, ScriptObject *delegate); @@ -69,6 +69,18 @@ namespace avmplus bool isUsingWeakKeys() const { return getHeapHashtable()->weakKeys(); } private: + + REALLY_INLINE void gcTraceHook_DictionaryObject(MMgc::GC *gc) + { + // This code was ripped out of ScriptObject::getTableNoInit + union { + uint8_t* p; + HeapHashtable** hht; + }; + p = (uint8_t*)this + vtable->traits->getHashtableOffset(); + gc->TraceLocation(hht); + } + inline HeapHashtable* getHeapHashtable() const { // uintptr_t (rather than char*) to avoid "increases required alignment" warning diff --git a/generated/extensions-tracers.hh b/generated/extensions-tracers.hh index 787c1ba2..7bc7dd28 100644 --- a/generated/extensions-tracers.hh +++ b/generated/extensions-tracers.hh @@ -60,6 +60,7 @@ bool DictionaryObject::gcTrace(MMgc::GC* gc, size_t _xact_cursor) #endif ScriptObject::gcTrace(gc, 0); (void)(avmplus_ScriptObject_isExactInterlock != 0); + gcTraceHook_DictionaryObject(gc); return false; } -- 2.11.4.GIT