Closed
Bug 532098
Opened 16 years ago
Closed 16 years ago
Sampler API needs new edge
Categories
(Tamarin Graveyard :: Virtual Machine, defect, P2)
Tracking
(Not tracked)
VERIFIED
FIXED
flash10.1
People
(Reporter: treilly, Assigned: treilly)
Details
Attachments
(1 file, 1 obsolete file)
6.57 KB,
patch
|
edwsmith
:
superreview+
|
Details | Diff | Splinter Review |
The sample API needs to make a connection between a function closure and its activation so the heap graph makes sense, as it is activation objects show up as gc roots since the root definition FB uses is "no one else points at me"
Assignee | ||
Updated•16 years ago
|
Assignee: nobody → treilly
Status: NEW → ASSIGNED
Assignee | ||
Comment 1•16 years ago
|
||
psuedo code solution:
ScriptObject o
if(o is Function)
{
MethodEnv *env = (FunctionScriptObject*)o->_call;
ScopeChain *sc = env->scope();
for(int i=scope.getSize()-1; i <= 0; i--) {
if(sc.getScope(i)->vtable() == env->getActivationVTable()) {
addFakeHeapGraphEdge(sc.getScope(i), o, ".activation");
break;
}
}
}
Assignee | ||
Comment 2•16 years ago
|
||
Not happy with the extra trait in Function but otherwise this works. Is that okay since its private?
Attachment #420665 -
Flags: superreview?(edwsmith)
Attachment #420665 -
Flags: review?(stejohns)
Comment 3•16 years ago
|
||
Is there a reason the sampler cannot "see" the real edges from Function -> MethodEnv -> ScopeChain -> Activation?
Assignee | ||
Comment 4•16 years ago
|
||
The sampler only sees edges at the AS level not the C++ level, this patch surfaces the hidden C++ edges to AS.
Comment 5•16 years ago
|
||
At the AS level, there is such a thing as lexical scope, and objects that are only reachable as lexical scope. The sampler needs a way to express that. Lexical scope is a true aspect of ActionScript, not a magic behind the scenes C++ thing, and not like a root like things on the stack. Is it feasible? Sounds like the sampler can express roots, so perhaps it can express lexically scoped objects too? (every function has a set of objects in its lexical scope).
Another example would be with objects:
with (new C()) {
return function () {
/* C is alive as long as this function instance is */
}
}
Assignee | ||
Comment 6•16 years ago
|
||
Attachment #420665 -
Attachment is obsolete: true
Attachment #420736 -
Flags: superreview?(edwsmith)
Attachment #420665 -
Flags: superreview?(edwsmith)
Attachment #420665 -
Flags: review?(stejohns)
Assignee | ||
Updated•16 years ago
|
Priority: -- → P2
Target Milestone: --- → flash10.1
Comment 7•16 years ago
|
||
Comment on attachment 420736 [details] [diff] [review]
updated patch with no Function traits pollution
As an afterthought, it might have been better to use a Vector<Object> instead of Array. But, I don't see anything obviously wrong with the patch as-is.
Attachment #420736 -
Flags: superreview?(edwsmith) → superreview+
Assignee | ||
Updated•16 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 8•16 years ago
|
||
changeset: 3487:64c09a458735
Comment 10•15 years ago
|
||
It seems wrong to me that getLexicalScopes() can return null instead of an empty array in some cases:
ArrayObject* MethodEnv::getLexicalScopes()
{
if(_scope->getSize() == 0)
return NULL;
...
Wouldn't it make more sense to return an empty array? (For that matter, can _scope->getSize() actually return zero?)
Comment 11•15 years ago
|
||
(In reply to comment #10)
> It seems wrong to me that getLexicalScopes() can return null instead of an
> empty array in some cases:
>
> ArrayObject* MethodEnv::getLexicalScopes()
> {
> if(_scope->getSize() == 0)
> return NULL;
> ...
>
> Wouldn't it make more sense to return an empty array? (For that matter, can
> _scope->getSize() actually return zero?)
Agree this seems dodgy, could be an optimization for a common case (avoids allocation) and not sloppy coding though.
You need to log in
before you can comment on or make changes to this bug.
Description
•