Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dart2js: get rid of 'holders' #9556

Closed
rakudrama opened this issue Mar 31, 2013 · 20 comments
Closed

dart2js: get rid of 'holders' #9556

rakudrama opened this issue Mar 31, 2013 · 20 comments
Assignees
Labels
P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js

Comments

@rakudrama
Copy link
Member

Types that are not instantiated but are used in type tests have 'holders'.
Instead of holders, the type should be generated. The generated type will be really small since it has no methods.

The interceptors should be used for primitive types.

@rakudrama
Copy link
Member Author

Added Area-Dart2JS label.

@rakudrama
Copy link
Member Author

Marked this as blocking #9577.

@rakudrama
Copy link
Member Author

Marked this as blocking #9728.

@rakudrama
Copy link
Member Author

I'm increasing the priority since this is blocking

Note 1.
Interceptors should be used for primitive and DOM types. This means that

  $asIterableBase: function () { return [$.String]; },

becomes

  $asIterableBase: function () { return [$.JSString]; },

Note 2.

I have noticed that sometimes values are put in the class definition, and also on holders / classes in emitRuntimeTypeSupport.

It seems to me that we should be able to get rid of emitRuntimeTypeSupport entirely. Anything patched onto a class in emitRuntimeTypeSupport should have been emitted as part of the type.

test html/node_test (compiled without --checked) contains the following inconsistent lines.
Notice that Node.$isNode has a function @­A that is overwritten with 'true' @­B
I have no idea why this is working.

   test.js:7319:$$.main___anon2 = {"": "Closure;",
   test.js:7321: return typeof n === "object" && n !== null && $.getInterceptor(n).$isNode();
   test.js:8934:$$.InputElement = {"": "Element;height},src},type},width}",
   test.js:8947: $isNode: function() {
   test.js:9412:$$.Node = {"": "EventTarget;text:textContent=",
@A test.js:9493: $isNode: function() {
   test.js:15979:$.TableCellElement.$isNode = true;
   test.js:15980:$.TableRowElement.$isNode = true;
   test.js:15981:$.TableSectionElement.$isNode = true;
@b test.js:15982:$.Node.$isNode = true;
   test.js:15983:$.Element.$isNode = true;
   test.js:16559: $isNode: function() {


Removed Priority-Medium label.
Added Priority-High label.

@kasperl
Copy link

kasperl commented Apr 22, 2013

Added this to the Later milestone.

@karlklose
Copy link
Contributor

Fixed in r22172.


Added Fixed label.

@peter-ahe-google
Copy link
Contributor

Seems like there are left-over TODOs remaining for this bug.

In particular a TODO(9556) in emitter.dart which looks like some code should be changed.


Added Triaged label.

@kasperl
Copy link

kasperl commented May 23, 2013

Added TriageForM5 label.

@kasperl
Copy link

kasperl commented May 28, 2013

Have this been fixed already?

@kasperl
Copy link

kasperl commented May 28, 2013

Removed TriageForM5 label.

@karlklose
Copy link
Contributor

I have removed the holders when I closed the issue, so that part is fixed. I am investigating the TODOs.


Removed this from the Later milestone.
Added this to the M6 milestone.

@rakudrama
Copy link
Member Author

Marked this as blocking #11263.

@peter-ahe-google
Copy link
Contributor

Removed Priority-High label.
Added Priority-Medium label.

@larsbak
Copy link

larsbak commented Aug 28, 2013

Removed this from the M6 milestone.
Added this to the M7 milestone.

@karlklose
Copy link
Contributor

Assigning to Stephen to update the comments referencing this bug.


Set owner to @rakudrama.

@kasperl
Copy link

kasperl commented Oct 2, 2013

Removed this from the M7 milestone.
Added this to the M8 milestone.

@rakudrama
Copy link
Member Author

I'm moving this to 'later'.

There is little that can be done without at least some reworking of the representations used by type checks.

The three places marked with TODO(9556) serve to ensure a native class is defined for marking the constructor as a token representing the type, similar to Duration:

P.Duration.$isDuration = true;
P.Duration.$isComparable = true;
P.Duration.$asComparable = [P.Duration];
P.Duration.$isObject = true;

I would like to see is this information moved away from these assignments to the constructor, preferably to the class definition. However, that will require changes to the representation, since we cannot directly reference P.Duration until after init.finishClasses

There is some redundancy between this information and what is visible on an instance, and also this information is redundant with respect to metadata that would be needed for reflection.

Duration: {"": "Object;_duration<",
  ...
  $isDuration: true,
  $isComparable: true,
  $asComparable: function() {
    return [P.Duration];
  },
  static: { ... }
}

The metadata fact that Duration implements Comparable (type parameters for now) could be used to generate the $isComparable properties on both constructor and prototype.


Removed this from the M8 milestone.
Added this to the Later milestone.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the Later milestone.
Added Oldschool-Milestone-Later label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-Later label.

@karlklose
Copy link
Contributor

@rakudrama The comments containing TODOs refering to this bug seem to be completely out of sync - for example, there is no emitRuntimeTypeSupport anymore. I would like to close this issue and file a new one for the problem mentioned in your last comment (if that still is a problem).

@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed triaged labels Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js
Projects
None yet
Development

No branches or pull requests

6 participants