Closed Bug 646541 Opened 9 years ago Closed 8 years ago

OP_applytype is not documented

Categories

(Tamarin Graveyard :: Documentation, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED
Q1 12 - Brannan

People

(Reporter: edwsmith, Assigned: lhansen)

References

Details

Attachments

(1 file)

Applytype is used to instantiate Vector class instances.

From Interpreter.cpp

  i1 = (intptr_t)U30ARG;  // argc
  // stack in: factory, arg1, ... argN
  // stack out: result

from opcodes.tbl

  ABC_OP(    1,       1,     0,     0,    applytype)  // 0x53

runtime behavior (excluding numerous error conditions)

* it takes one U30 arg-count value as an operand.
* pops an object that is used as a factory. if the factory object
  is not an Object then you get TypeError(kTypeAppOfNonParamType)
* pops |argc| more argument values which are parameters to the factory.
* the internal applyTypeArgs function is called on the factory.
* the resulting parameterized class object is pushed on the stack.

VectorClass's applyTypeArgs():
* argc must == 1 or you get Error(kWrongTypeArgCountError)
* the single argument value must be a Class instance or you get
  VerifyError(kCorruptABCError)  (weird to get VerifyError at runtime!)
* finally you get a new (or pre-existing) class object for the Vector<T>.
Assignee: nobody → edwsmith
Flags: flashplayer-qrb+
Priority: -- → P4
Target Milestone: --- → Q1 12 - Brannan
Taking this, as I'm doing PACMAN work around the instruction right now.
Assignee: edwsmith → lhansen
Status: NEW → ASSIGNED
Priority: P4 → P2
The description above is slightly buggy; the factory is underneath and the parameters are on top.  Also, for Vector the error thrown for argc==1 is TypeError.
Attached patch PatchSplinter Review
Also includes the generated HTML; the dox file is at the end of the patch.
Attachment #560193 - Flags: review?(edwsmith)
Blocks: 685899
No longer blocks: 685899
Depends on: 685899
Comment on attachment 560193 [details] [diff] [review]
Patch

It would be good to create a bug to track the problem of VerifyError 
being thrown at runtime, since we claim its a bug (I agree).
Attachment #560193 - Flags: review?(edwsmith) → review+
(In reply to Edwin Smith from comment #4)

> It would be good to create a bug to track the problem of VerifyError 
> being thrown at runtime, since we claim its a bug (I agree).

Recorded as bug #686746, will also add this reference in the doc.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
changeset: 6582:ecae7c4f1a85
user:      Lars T Hansen <lhansen@adobe.com>
summary:   Fix 646541 - OP_applytype is not documented (r=edwsmith)

http://hg.mozilla.org/tamarin-redux/rev/ecae7c4f1a85
You need to log in before you can comment on or make changes to this bug.