Closed
Bug 582817
Opened 14 years ago
Closed 6 years ago
Asynchronous XML parsing
Categories
(Tamarin Graveyard :: Library, defect, P3)
Tamarin Graveyard
Library
Tracking
(Not tracked)
RESOLVED
WONTFIX
Q3 12 - Dolores
People
(Reporter: siwilkin, Assigned: gchaney)
References
Details
Attachments
(4 files, 2 obsolete files)
30.67 KB,
patch
|
Details | Diff | Splinter Review | |
2.15 KB,
patch
|
Details | Diff | Splinter Review | |
8.99 KB,
patch
|
Details | Diff | Splinter Review | |
300.28 KB,
patch
|
Details | Diff | Splinter Review |
This patch tests the notion that exploiting concurrency within the VM can be relatively painless, given the support of: - A thread-safe GC (bug 582770) - Thread-safe exceptions (bug 582782) - Thread-safe interning (bug 582776) - A thread-pool executor service that supports futures (bug 582772) ActionScript XML parsing and object-tree construction is currently performed synchronously within the constructor of an XML object (or the top-level XML() function). This patch introduces a new builtin ActionScript class, XMLAsync, which uses the same parsing algorithm, but builds the object-tree asynchronously to the application-thread. Usage within ActionScript looks like: var xmlAsync:XMLAsync = XMLAsync.parse(str); // Returns immediately The returned XMLAsync object now acts like a future which can be claimed anytime via the take() function; this will block the claiming thread until the parse is complete. The progress of the parse can also be checked with peek(), which returns NULL if the parse is not complete rather than blocking: var xml:XML = xmlAsync.take(); // blocks until the parse is complete var xml:XML = xmlAsync.peek(); // returns NULL if the parse is not complete XMLAsync also supports exceptions. If an exception is thrown during parsing, then this will propagate to the application-thread by being thrown from the take() or peek() functions. Implementation: The XMLAsyncObject implementation of the above functionality is relatively simple, based on the enhancement bugs listed above. The AS3 XMLAsync constructor calls the C++ XMLAsyncObject::init() method, which creates a new ExecutorFuture object. This object is passed a function pointer to the VM's XML parsing method, and a pointer to the String to be parsed. The ExecutorFuture is then submitted to the AvmCore's ExecutorService for dispatch to a worker thread. The XML object tree is build using a GC shared with the application thread, so the resulting structure can be handed-off with no marshaling. Both the AS3 XMLAsync.take() and peek() methods query the progress of the ExecutorFuture and reflect its blocking semantics. ExecutorFutures record uncaught Exceptions and rethrow these when the future is claimed, hence, no further work is required to implement the AS3 exception semantics of XMLAsync.
Reporter | ||
Updated•14 years ago
|
Reporter | ||
Comment 1•14 years ago
|
||
Most of this patch is boiler-plate builtin wrangling. See XMLAsyncGlue.h/.cpp for the actual implementation.
Reporter | ||
Comment 2•14 years ago
|
||
(In reply to comment #0) Enable the above via AVMFEATURE_XMLASYNC. Note: If the XMLAsync builtin is built into the VM but AVMFEATURE_XMLASYNC is not enabled, then XMLAsync parsing is performed synchronously.
Reporter | ||
Updated•13 years ago
|
Assignee: nobody → gchaney
Updated•13 years ago
|
Flags: flashplayer-qrb+
Flags: flashplayer-bug-
Target Milestone: --- → Q1 12 - Brannan
Updated•13 years ago
|
Priority: -- → P3
Reporter | ||
Comment 3•13 years ago
|
||
Attachment #461098 -
Attachment is obsolete: true
Reporter | ||
Comment 4•13 years ago
|
||
Reporter | ||
Comment 5•13 years ago
|
||
Reporter | ||
Comment 6•13 years ago
|
||
Reporter | ||
Comment 7•13 years ago
|
||
The current patches are based on: TR rev 6090. Patch queue rev 280.
Reporter | ||
Comment 8•13 years ago
|
||
Attachment #526085 -
Attachment is obsolete: true
Updated•6 years ago
|
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•