TC: Need better vector support

VERIFIED FIXED in flash10

Status

VERIFIED FIXED
11 years ago
9 years ago

People

(Reporter: tierney, Assigned: tierney)

Tracking

unspecified
flash10
x86
Windows XP

Details

Attachments

(2 attachments)

(Assignee)

Description

11 years ago
Created attachment 312326 [details] [diff] [review]
BEtter vector support

Implement better support for Vectors.  Before Vector.<T> was translated into Vector$object, and T was supplied as an argument to the ctor.  That argument was used to do runtime checking of values placed in the vector.  However this had problems as all vectors were the same concrete type, so code like this passed without error:

var v : Vector.<T>;
var c : Vector.<R>;

v = c;  // No error, both are Vector$object

The patch included fixes this.  This involved implementing more parts of type parameters from ES4.

Added a method applyTypeArgs to ScriptObject.  This currently throws an error for all types except Vector.  When we have real parameterized types, then those types can also use this method.  applyTypeArgs takes a list of type parameters, and based on those is responsible for returning the correct instantiated type.  

Also added a new opcode, OP_applytype which triggers the applyTypeArgs method.  

Added a new Multiname type to the abc file.  It has a base name, and then a list of names that are the type parameters.  Added logic to the PoolObject so that it knows how to resolve the new TypeName to Traits ptrs.  Basically, it resolves the base name, and then the type parameters, and looks for a cached Traits for that type.  If one is not found it creates a new Traits* and stores it in the pool that the base Traits came from.  

All the instantiated vector Traits* that are generated, have the Vector$object as their base traits.  This way they all pick up the vector methods, and the various instantiated classes are all effectively derived from Vector.<*>.
Attachment #312326 - Flags: review?(edwsmith)

Comment 1

11 years ago
Created attachment 313424 [details] [diff] [review]
tests for vector typechecking patch
Attachment #313424 - Flags: review?(tierney)

Updated

11 years ago
Attachment #313424 - Attachment is patch: true

Updated

11 years ago
Attachment #313424 - Attachment description: vector typechecking patch → tests for vector typechecking patch

Comment 2

11 years ago
added patch of tests for typechecking runtime errors.  tests are in test/acceptance/es4/vector/typechecking.as
(Assignee)

Updated

11 years ago
Attachment #312326 - Flags: review?(stejohns)

Comment 3

11 years ago
Comment on attachment 312326 [details] [diff] [review]
BEtter vector support

there's a TODO in Verifier.cpp that might need attention. Otherwise looks good.
Attachment #312326 - Flags: review?(stejohns) → review+
(Assignee)

Comment 4

11 years ago
Comment on attachment 313424 [details] [diff] [review]
tests for vector typechecking patch

I'll check these in with the vector changes.
Attachment #313424 - Flags: review?(tierney) → review+

Updated

10 years ago
Attachment #312326 - Flags: review?(edwsmith)

Updated

10 years ago
Target Milestone: --- → flash10
(Assignee)

Updated

10 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED

Comment 5

9 years ago
Resolved fixed engineering / work item that has been pushed.  Setting status to
verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.