Closed Bug 436215 Opened 16 years ago Closed 15 years ago

TT needs an abstracted hosting API

Categories

(Tamarin Graveyard :: Tracing Virtual Machine, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED WONTFIX

People

(Reporter: stejohns, Assigned: stejohns)

Details

Attachments

(2 files, 1 obsolete file)

In TC (and current versions of TC), an application is exposed to many internal details of the VM that aren't necessary -- this makes transitioning a codebase that used TC much harder than it could have been, and also makes it more painful to restructure the VM in the future without rewriting unnecessary parts of the host.
Attached patch Patch (obsolete) — Splinter Review
(NOTE, THIS PATCH REQUIRES A NEW ASC.JAR -- it will not build with the existing one.)

Lots of changes to start implementing a Hosting API for TT. In TC (and previous versions of TC), an application was exposed to many internal details of the VM that weren't necessary -- this makes transitioning a codebase that used TC much harder than it could have been. This patch implements a first version of an API that is intended to expose the smallest surface area necessary (in terms of types and API) needed to use TT.

Basically, the premise is that an app using TT (eg, avmshell) only needs to include avm.h to get its work done -- avmplus.h is now considered a "private" include and should only be used by the VM itself. The API is intended to (eventually) be C-friendly, though it currently uses C++ features.

The API currently exposes no data structures to the host (except AvmConfiguration); in particular, Atom is no longer publicly visible (as far as the host is concern, only Box exists). Further, the internal structure of Box is opaque.

This patch is definitely incomplete; in particular, avmplusDebugger isn't usable at all yet. This will be added in a subsequent patch. Also, it includes just enough API to implement avmshell; I'm sure we'll need to add more to support Flash and other hosts.

Note that in the long-term, an API that is modeled after SpiderMonkey's is probably desirable. This API doesn't attempt to model SpiderMonkey at all; it's a short-term fix to allow some work to proceed on Flash. (If someone would like to undertake a project to put SpiderMonkey API on TT I'd be very happy :-)

A few other changes found their way in:
-- most (but not all) of the changes from bug 433629 (better Box helpers) were migrated in.
-- rearranged describeType to live in its own file (rather than System, which was avmshell-specific), but only in full builds (it is excluded from MINBUILD)
-- moved Dictionary from extensions into core; it's tiny and really belongs in core anyway. (It's still only in full builds, not MINBUILD)
-- removed the junk about "lastStackTrace" from main/shell/Error/etc; it was only put in place for bug-compatibility with TC on some sanities that aren't in use anymore.
-- the part of asc.jar (GlobalOptimizer) that emits the various glue files was rewritten to use opaque types (eg, AvmObject instead of ScriptObject*) and also to exclude unnecessary native types from being propagated into the host's glue files (eg, internal types necessary for VM implementation but not for host usage). To repeat, THIS PATCH REQUIRES A NEW ASC.JAR -- it will not build with the existing one.
Attachment #322878 - Flags: review?(treilly)
Comment on attachment 322878 [details] [diff] [review]
Patch

Tasty
Attachment #322878 - Flags: review?(treilly) → review+
Attached patch PatchSplinter Review
Updated patch (rel to changeset 396:660aafb4488f)... aside from merging with current tip, this

-- fixes a bug in getQualifiedSuperclassname (and the acceptance test for it)
-- adds AVM hosting apis to make a string from UTF16 and retrieve a UTF16 string
Attachment #322878 - Attachment is obsolete: true
Attachment #324708 - Flags: review?(treilly)
Attachment #324708 - Flags: review?(treilly) → review+
pushed as changeset 397:0a677bccb615 (but leaving as OPEN for now because there will probably be subsequent fixes and additions)

you will need to get a new version of asc.jar in order to rebuild any native classes (either in the VM itself or in any client that uses TT, such as avmshell or Flash)

You should be able to get a pre-built version from
ftp://ftp.mozilla.org/pub/js/tamarin/builds/asc

Alternately, you can pull the source vis Subversion at
http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/modules/asc/ if
you want to build it yourself.

Either way, just drop the new asc.jar into the utils folder and you're good
to go.
Status: NEW → ASSIGNED
Attachment #324986 - Flags: review?(stejohns)
Comment on attachment 324986 [details] [diff] [review]
couple more changes

should AvmBoxGCObject/AvmUnboxGCObject use GCObject* instead of void*?
Attachment #324986 - Flags: review?(stejohns) → review+
I started out that way but went back b/c sometimes these hold non-GC objects (pcreInst).
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → WONTFIX
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: