Closed
Bug 952114
Opened 12 years ago
Closed 5 years ago
TypedObject: revisit strategy for enforcing invariant declaredTypes == inferredTypes
Categories
(Core :: JavaScript Engine: JIT, defect, P5)
Core
JavaScript Engine: JIT
Tracking
()
RESOLVED
INVALID
People
(Reporter: pnkfelix, Unassigned)
References
Details
Attachments
(1 file)
|
4.56 KB,
patch
|
nmatsakis
:
review-
|
Details | Diff | Splinter Review |
Summary: When declared-types != inferred-types, it would be good to do something smarter than bailing out.
Explanation:
For TypedObject JIT integration, the JIT requires that we maintain the invariant that the types predicted from the structural type declarations (e.g. that a getElem on a float32 array produces a float32, or that a struct has a particular layout) "corresponds to" [*] the types predicted from the type-inference system.
E.g. consider the case where every observed time the getElem has executed, it produced an int; then the type-inference system will build up a type-set for int, not float32. This scenario generalizes to more complex type structures.
The short-term plan that Niko and I plan is to enforce the invariant by bailing out on the JIT-compilation attempt when the two sets do not correspond. The longer term plan is to put in something smarter. That's what this bug is meant to track. (An example of something smarter: within the JIT, update inferred-types as necessary so that the two correspond.)
[*] I have put "corresponds to" in quotes above. I think from a theoretical point-of-view we need to ensure that declared-types subseteq inferred-types (that is after you map the two into some common abstraction where they can be compared), while from a practical point of view that really means that we need to ensure declared-types == inferred-types (since if I understand correctly, it should not be possible to ever have inferred-types proper-subset-of declared-types).
| Reporter | ||
Updated•12 years ago
|
Blocks: harmony:typedobjects
| Reporter | ||
Comment 1•12 years ago
|
||
Decided to go ahead and implement the more intelligent strategy, because I was disturbed by the regressions I observed when trying to implement the proposed "short term" strategy.
Attachment #8350608 -
Flags: review?(nmatsakis)
Comment 2•12 years ago
|
||
Comment on attachment 8350608 [details] [diff] [review]
bug952114-pCv1-followup-fix-for-complex-case.patch
Review of attachment 8350608 [details] [diff] [review]:
-----------------------------------------------------------------
I think this is the right idea but the specifics are incorrect, in that you're adding
the wrong TI type objects to the typeset. Unfortunately, I'm not sure how to find the
*right* TI type objects. It may be that some refactoring is needed to make them accessible.
::: js/src/jit/TypeRepresentationSet.cpp
@@ +230,5 @@
> +TypeRepresentationSet::addAllTo(types::TypeSet *type_set, LifoAlloc *alloc)
> +{
> + for (uint32_t i=0; i < this->length(); i++) {
> + TypeRepresentation *trep = this->get(i);
> + types::TypeObject *typeObj = trep->typeObject();
Sadly this is not the TI type object you're looking for. This TI type object is, I think, currently unused, the patch that was going to make use of it hasn't landed, but it was intended to represent the (binary data) type objects themselves.
Attachment #8350608 -
Flags: review?(nmatsakis) → review-
Updated•10 years ago
|
Priority: -- → P5
Comment 3•5 years ago
|
||
No longer valid TI-related bug.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•