Closed Bug 451644 Opened 18 years ago Closed 18 years ago

Pack commonly-used data structures more intelligently

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: stejohns, Assigned: stejohns)

Details

Attachments

(2 files)

Lots of commonly-used data structures in TC don't pay attention to alignment of fields, meaning there's a fair amount of wasted space due to compiler-inserted padding (especially on 64-bit builds). This bug will probably have several patches before we're done, each picking a few commonly-used structures and: (1) Move all data members together, at the end of the class, in a well-marked data section. Data members all go together here. (2) Sort members in large-to-small order: largeclass >= double,uint64 >= ptr,intptr >= int32 >= int16 >= int8,bool (2a) insert extra visibility directives as necessary to maintain semantics (3) insert explicit padding when necessary -- usually only at the end of a struct (to pad to 4 or 8 byte boundary), but sometimes in other odd cases (eg bitfields)
Attached patch Patch #1 — — Splinter Review
Added smart structure alignment for AbcParser, AbstractFunction, Hashtable, Exception, ExceptionHandler, ExceptionHandlerTable, ExceptionFrame, MethodEnv, ScriptEnv, FunctionEnv, MethodInfo, NativeMethod, NativeTableEntry, NativeClassInfo, NativeScriptInfo, ScopeChain, ScopeTypeChain, CallStackNode, FakeCallStackNode, Traits, VTable Saved space (4 bytes per entry) in ScopeTypeChain by recycling the lower (unused) bit of the Traits ptr as a flag. (We'll be using more of this technique elsewhere). This required tweaking a few places that examined the old data structure directly. Changed Traits::sizeofInstance to uint32_t instead of size_t. Changed MIR to account for this when we load the field. Changed NativeClassInfo, NativeScriptInfo, and NativeTableEntry to always be declared "const", since they are static data that never changes -- this rippled slight changes across a few api's that expected non-const pointers before. Normalized the various int-related type declarations in GCTypes.h and avmplusTypes.h to all be defined in terms of C99 types. For MSVC builds, pulled the C99 simulated types inline and eliminated the msc_inttypes.h file. Added a few casts here and there, and various int declaration changes, to get things to compile cleanly in 64-bit builds with MSVC's "warn about 64-bit problems" on... these were mostly innocuous housekeeping.
Assignee: nobody → stejohns
Status: NEW → ASSIGNED
Attachment #334978 - Flags: review?(edwsmith)
Attachment #334978 - Flags: review?(edwsmith) → review?(rreitmai)
Comment on attachment 334978 [details] [diff] [review] Patch #1 I noticed some use of 'int32' rather than 'int32_t' should we be using the latter?
Attachment #334978 - Flags: review?(rreitmai) → review+
we should be moving to the latter for new (or heavily revised) code -- I'm migrating code to C99 types opportunistically but not aggressively, in order to minimize the churn factor.
pushed patch #1 as changeset: 622:e3e614b3a840
Attached patch Patch #2 — — Splinter Review
Fix for previous checkin: -- remove the AVMPLUS_INTPTR_OVERLOADS mess I inserted last time. The problem is that some environments define [u]intptr_t as an int, some as a long, and these have different overload characteristics. Trying to predict is problematic, but the only use case for this was Atom, which I just reverted to our old, always-int detection logic. (Ideally Atom should be a unique pointer type, as is is in TT, for this and other reasons, but the code churn is beyond the scope of what I have time for at the moment.) -- revert PrintWriter and VectorClass to how they were prior to the previous checkin -- enable UniversalBinary compilation on XCode for 32-bit Mac builds (was Intel-only before, and so missed some PPC-specific errors), and fix the resulting minor build errors
Attachment #335115 - Flags: review?(rreitmai)
Attachment #335115 - Flags: review?(rreitmai) → review+
pushed patch #2 as changeset: 623:df812ca4c453
should we move this to resolved?
yeah, probably so, we may revisit parts of it someday but it's no longer critical
moved to resolved.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Resolved fixed engineering / work item that has been pushed. Setting status to verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: