Closed Bug 643375 Opened 14 years ago Closed 6 years ago

nativegen.py should look to the C++ code for GC information

Categories

(Tamarin Graveyard :: Tools, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX
Future

People

(Reporter: lhansen, Unassigned)

References

Details

Currently w annotate the AS3 classes with information about whether a class should be traced exactly, and nativegen.py picks up that information to generate tracers for the native slot areas. Those slot areas should go away in their current form, but even so we're going to start adding annotations about finalization, and because the createInstanceProc is generated by nativegen.py, nativegen.py must know whether a class is finalized or not. Yet finalization is a C++-centric idea, for the most part, it should not have to be specified in AS3 code. I conclude that GC information should be gotten from annotations in the C++ code, not from annotations in the AS3 code. Suitable annotations would be in the form of macros that boil away. Clearly we already have GC_CPP_EXACT and GC_AS3_EXACT as annotations for exact GC. For a finalizer, we'd add something like the first line here to what's already present: GC_FINALIZED(ByteArrayObject) class GC_AS3_EXACT(ByteArrayObject, ScriptObject) { ... } A problem may be performance, but perhaps nativegen.py could lean on the exact tracer generator to summarize information for it into some convenient form.
I need to push back here: (1) this greatly increases the scope of what nativegen.py must do; it currently depends only on a few input .abcs; you are proposing changing it do depend on several hundred C++ files as well. (2) finalization is indeed a C++-centric idea, but so are other things that have (of necessity) leaked into the AS3 source for builtins (eg, the C++ class/instance names). I fail to see what advantage this gives us (aside perhaps from conceptual purity), but the downside is likely to be nontrivial build time and complexity.
(In reply to comment #1) > I fail to see what advantage this gives us (aside perhaps from conceptual > purity), but the downside is likely to be nontrivial build time and > complexity. Your points are well taken, but it's not about conceptual purity, it is about keeping things together so that it's easy to remember (hard to forget?) to add annotations that will be necessary for correctness. A finalizer annotation will be needed if the class has a destructor /or/ there is a member variable that requires destruction /or/ there is a base class that needs to be finalized. (Probably this will apply only to AvmPlusScriptableObject subclasses.) Aren't we currently running the exact tracer generator for /every/ build and doing so on /every/ file? We'd almost have to, to ensure correctness. Anyway, I will keep your points in mind. Maybe I'll do what I did with the tracer annotations: require the annotation both places. The exactgc script can check the C++ side, and the nativegen script only needs deal with the as3 side.
(In reply to comment #2) > Aren't we currently running the exact tracer generator for /every/ build and > doing so on /every/ file? We'd almost have to, to ensure correctness. Your point is also well taken. If this step improves robustness, then let's do it, but the scope creep of moving C++ parsing into nativegen.py makes my spidey-sense tingle. nativegen.py is complex enough now that it probably needs a formal spec as it is...
Assignee: lhansen → nobody
Status: ASSIGNED → NEW
Severity: normal → enhancement
Flags: flashplayer-qrb+
Target Milestone: --- → Future
Tamarin isn't maintained anymore. WONTFIX remaining bugs.
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.