-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
More issues with "+" and other binary operators #596
Comments
Added this to the FrogEditor milestone. |
This comment was originally written by jimhug@google.com Set owner to jimhug@google.com. |
I suspect there are two issues here:
|
FWIW, I think these results can be okay, as long as it properly fails in --enable_type_checks mode. |
This comment was originally written by jimhug@google.com This bug can be easily fixed by doing the dynamic dispatch. The reason we weren't doing that dispatch currently was actually a faulty detection that num was the only type that implemented '+'. This same semi-brittle optimization will continue to work for most of the other operators - but I'm inclined to remove it for now due to the excessive brittleness. FYI - The brittleness is that adding a type in a completely unrelated part of the code that overrides one of these operators could have a surprisingly large impact on performance. |
I'm surprised those benchmarks are doing dynamic dispatch. I thought the benchmarks had type annotations everywhere? |
Marked this as blocking #595. |
This comment was originally written by jimhug@google.com I am removing the >> and << cases and putting them into a new bug. I will assign the bug to Kasper to decide if it is in this Milestone or not. Frog's current behavior matches dartc's (with good reason) and the precise semantics of this operation in a JS implementation is not well defined. |
This comment was originally written by jimhug@google.com One more comment for the record. I just ran these tests on dartc and it behaves exactly the same as frog for your examples, i.e. they are both broken for this case (unless I'm doing something really stupid this holiday morning). We will fix this in frog for the editor milestone, but it is this kind of discrepancy that makes it hard for me to understand which tests belong in this milestone and which ones don't. jimhug-macbookpro:frog$ cat t2.dart main() { } cc @kasperl. |
Thanks for investigating this, Jim. It does look like the dartc implementations of the numeric operations fail to check that the right hand side is indeed a number. I'll get this fixed. |
This comment was originally written by jimhug@google.com Fix in r3505. Added Fixed label. |
svn r1844
This is along the lines of issue #576.
f() => 77;
main() {
print(f() + "88");
}
frog produces "7788", while the VM throws:
NoSuchMethodException - receiver: '88' function name: 'addFromInteger' arguments: [77]]
0. Function: 'Object.noSuchMethod' url: 'bootstrap' line:315 col:3
1. Function: 'IntegerImplementation.+' url: 'bootstrap_impl' line:1463 col:32
2. Function: '::.main' url: '/Users/dgrove/repo/dart-bleeding/dart/frog/y.dart' line:4 col:11
You can see similar results with
print(f() & "88")
print(f() - "88")
I see a few other cases where frog is pushing onto the JS operator incorrectly. for instance,
print(foo() >> (-1)); // frog: 0, VM: unhandled exception
print(foo() << (-1));
In general, these issues are appearing because frog is being overly aggressive in pushing down onto the JS operators.
The text was updated successfully, but these errors were encountered: