Closed Bug 440478 Opened 17 years ago Closed 17 years ago

Improve modularity and make nanojit and the tracer less dependent on the VM core.

Categories

(Tamarin Graveyard :: Tracing Virtual Machine, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gal, Assigned: maschang)

Details

Attachments

(1 file, 11 obsolete files)

875 bytes, patch
edwsmith
: review+
Details | Diff | Splinter Review
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.20 Build Identifier: Title says it all. Make sure nanojit and the tracing engine have a well defined interface to the VM core in order to allow them to be used with other JavaScript VMs. Reproducible: Always Steps to Reproduce: 1. 2. 3.
Attachment #325792 - Attachment is patch: true
Attachment #325792 - Attachment mime type: application/octet-stream → text/plain
Comment on attachment 325792 [details] [diff] [review] Don't assume nanojit is the default namespace and remove unnecessary include. patch looks like just two lines changed, is that really all?
These are the must-haves I couldn't work around with a custom avmplus.h. I will try to get the debug code to run next, that will require a bigger patch. Last step will be cleanup. Some stuff is in the global name space that shouldn't be there and such. Breaking out the tracer will be a lot more difficult. Nanojit seems pretty well compartmentalized.
So should we wait and accumulate the changes to one big patch then?
Ok, we landed nanojit in tracemonkey. Basically I can work around pretty much everything with some nasty glue code. If you look at the glue you can see which parts should be refactored: http://ssllab.org/hg/tracemonkey/file/d7f7e6fe6ebe/js/src/nanojit/avmplus.h I think all references to AvmCore should go and nanojit should have its only configuration data structure (eliminating AvmConfiguration). The allocation code is Fragmento is somewhat ugly. I think Rick mentioned he wants to improve that anyway (GCHeap). I think we can keep class GC in general , thats easy to mimic. core->console is used only in one spot. A nicer interface without the stream syntax would be probably an improvement. OSDep::getDate() gets called somewhere. That could move somewhere else I assume. Most of this looks like very small changes to me. Any comments?
All those changes sounds spot-on to me.
I like the idea of having a nanojit config structure (it should probably reside in Fragmento; maybe time for a name change?) I think we should be able to create a MemMgr interface that we can use to tie into the GC (or some other mem manager) pretty cleanly. We should also probably move the _pages related code out of Fragmento into a helper class that interfaces with MemMgr. One thing I've been thinking about is to move the page linked-lists off page. That is, have the list reside in an external data structure. This would mean that we could use the GC for collecting the LIR and code pages. It also means that we could share code pages with different fragments. I'm not sure whether this would make it harder or easier for your work.
A MemMgr sounds great. That would definitively clean up our glue code. We will not be collecting any parts of TT through our GC, but if the MemMgr gets told when pages go dead we can do some thin reference counting on them in our code base so I am all for it.
Attachment #325792 - Flags: review?(edwsmith)
Comment on attachment 325792 [details] [diff] [review] Don't assume nanojit is the default namespace and remove unnecessary include. pushed, too. trivial change.
Attachment #325792 - Flags: review?(edwsmith) → review+
Wishlist in order of preference. To vote on the order just copy the list and re-order and say why you want it that way. Things that help tamarin primarily should go first, followed by stuff that helps other users but also cleans up tamarin, and user specific stuff should go last (IMO). Big items (takes time): 1. SideExit restructuring. Create a mechanism to attach VM-specific information to a side exit. Ideally this should also be used to eliminate most of the current information in struct SideExit. IMO, the VM knows how to side exit and recover its interpreter state. Nanojit should only do the basics and spot the VM. Updating pointers (sp_adj, pc_adj) etc seems more efficient when done from C, but the trace has to provide/store the information in the LIR. The side exit could return the address to a VM-custom buffer embedded in the LIR that tells the side exit handling code in the VM how to fix up the state. This will reduce the code size of traces so TT might win as well. 2. Clean way to attach VM-custom data to the entry point of a tree. Our trees are type-specialized. This data has to be attached to the tree and should be stored in the LIR (LIR_skip). TT might do similar things and could use a similar mechanism. 4. Move tracker and load/store elimination into nanojit. 5. Move state reconstruction at side exits into nanojit. Depends on (1). Little things (one liners and such): 1. Add operator (gc*) delete to avmplus.h so we can start doing explicit deallocation in nanojit (we will provide the patch to add the deallocations over time). 2. Move verbose filter into nanojit.
If you guys want to make nanojit the global name spaces I would be ok with that too. We just have to make a decision and stick to it :) 99.9% of the code does not depend on it and uses explicit namespaces, thats why I keep harping on this one (and now 2) case(s).
Attachment #325792 - Attachment is obsolete: true
Previous patch was reverse. This one should apply directly.
Attachment #326633 - Attachment is obsolete: true
Another little thing * give nanojit its own configuration object, dont depend on core
Attachment #326635 - Attachment is obsolete: true
Attachment #326692 - Flags: review?(gal)
Attachment #326692 - Flags: review?(danderson)
Looks like the patch didn't attach right again
fixed the patch
Attachment #326692 - Attachment is obsolete: true
Attachment #326700 - Flags: review?(gal)
Attachment #326692 - Flags: review?(gal)
Attachment #326692 - Flags: review?(danderson)
Attachment #326700 - Flags: review?(danderson)
Comment on attachment 326700 [details] [diff] [review] ns fixes, move VerboseFilter->nanojit, add insImmPtr and use it. Looks great.
Attachment #326700 - Flags: review?(gal) → review+
Attachment #326700 - Flags: review?(danderson) → review+
Please review. I will push if +.
Attachment #327728 - Flags: review?(edwsmith)
Attachment #327728 - Flags: review?(edwsmith) → review+
This is the minimal infrastructure I need to hook in my typemaps in case the big patch can't land.
Attachment #327865 - Flags: review?(edwsmith)
Comment on attachment 327728 [details] [diff] [review] Add a VM-private field to Fragment. pushed
Attachment #327728 - Attachment is obsolete: true
Should not affect code size. Cleans up the interface in Fragmento and makes it independent of InterpStruct, which is VM-specific. masonchang will push to sandbox and to tree if approved.
Attachment #327876 - Flags: review?(edwsmith)
Comment on attachment 327876 [details] [diff] [review] Pass ip for fragment lookup instead of entire InterpStruct is FOpcode vm specific? i think so. i've used const void *. either is fine with me but if you agree, just change the interface to const void* instead of FOpcode* I also think FragID is obsolete at this point, could be optionally cleaned up. (frid is just an address like ip).
Attachment #327876 - Flags: review?(edwsmith) → review+
I will redo the patch with void* and submit a separate one for review to remove fragid.
Assignee: nobody → gal
Attachment #327876 - Attachment is obsolete: true
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #327972 - Flags: review?
Attachment #327972 - Attachment is patch: true
Attachment #327972 - Attachment mime type: application/octet-stream → text/plain
Attachment #327972 - Flags: review? → review?(edwsmith)
Mason, if ed reviews the two pending patches favorably, please push to sandbox and then to the repository if there are no issues.
Attachment #327972 - Flags: review?(edwsmith) → review+
Comment on attachment 327865 [details] [diff] [review] Add a vmprivate field to guard record. this is fine, i want to unblock you, we can still strive for cleanup as we go.
Attachment #327865 - Flags: review?(edwsmith) → review+
Attachment #328036 - Attachment description: Andreas patch working with Debug builds versus TIP. → VM Private field + pass IP patches rolled into one. Changes so DEBUG builds work.
Looks good. Thanks mason. Assigning to david to push into TT.
Assignee: gal → danderson
Status: ASSIGNED → NEW
Attachment #328036 - Flags: review?(gal)
Attachment #328036 - Flags: review?(gal) → review+
Attachment #327972 - Attachment is obsolete: true
Attachment #327865 - Attachment is obsolete: true
Comment on attachment 328036 [details] [diff] [review] VM Private field + pass IP patches rolled into one. Changes so DEBUG builds work. pushed as changeset 59a1b730661a
Attachment #328036 - Attachment is obsolete: true
Attached patch Rename POP() to POPr(). (obsolete) — Splinter Review
This renames POP() to POPr(), which is more consistent (IMO), and at the same time avoids a name clash in tracemonkey.
Comment on attachment 328087 [details] [diff] [review] Rename POP() to POPr(). I can work around it differently if needed, but this seems to be a general clarification. Let me know what you think.
Attachment #328087 - Flags: review?(edwsmith)
Attachment #328087 - Flags: review?(edwsmith) → review+
Mason, please sandbox https://bugzilla.mozilla.org/attachment.cgi?id=328087 and assign it back to me when its ready to be pushed. Thanks.
Assignee: danderson → mason.chang
Attachment #328087 - Attachment is obsolete: true
Attachment #328264 - Flags: review?(edwsmith) → review+
Mason, you know the drill. I will try to find out whats happening to your repository access request so you can push it yourself after sandboxing it.
Just FYI, we find one bug per landed patch much better for back-out and hg blame issue tracking and general project management hygiene. More of a pain, until the pain of overloading one bug with many landed patches bites. YMMV, let me know. /be
Ed suggested one bug to track these changes. I don't mind separate reports. Would facilitate workflow. I just assign them to mason when we are ready to push and he sandboxes, pushes and closes it. As long Ed is ok with it I am game.
works for me. we could move the todo list to tamarin wiki.
Ok, mason when you are done testing & pushing, please close this bug.
Status: NEW → ASSIGNED
Pushed by mason as http://hg.mozilla.org/index.cgi/tamarin-tracing/rev/c47936dce08a As per brendan closing this uber bug and we will open individual ones for future issues in this area.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: