Closed Bug 1064493 Opened 10 years ago Closed 10 years ago

OdinMonkey: Confusing error message for SIMD import

Categories

(Core :: JavaScript Engine: JIT, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla35
Tracking Status
firefox32 --- unaffected
firefox33 --- unaffected
firefox34 --- fixed
firefox35 --- fixed

People

(Reporter: sunfish, Assigned: bbouvier)

References

Details

Attachments

(3 files, 1 obsolete file)

Attached file test.js
On the attached testcase, the asm.js validator says this:

test.js:5:14 warning: asm.js type error: expecting m.*:
test.js:5:14 warning:   var i4add = global.SIMD.int32x4.add;
test.js:5:14 warning: ..............^

It's unclear what "m.*" is referring to.

Also, it's unclear whether this line should be a warning at all, since similar code:

  var i4 = global.SIMD.int32x4;
  var add = i4.add;

compiles without complaint.
Well, the latter is the form we picked as the way to import SIMD ops.  We could allow the other too, if you felt like this was important.  Definitely should improve the error message, though.
Thanks for this bug! Indeed the error message is really not talkative at all. Regarding the forms, we've chosen the latter as it is shorter (in terms of code size) to reuse i4 (which is needed either in coercive form or in constructor form for having typex4 at all and thus using typex4.add). It could be added if necessary, but compilers-to-asmjs would probably prefer reducing code size.
Flags: needinfo?(benj)
Assignee: nobody → benj
Status: NEW → ASSIGNED
Attempt at a better explanation of what's really going on. Here, we should
never have more than 3 accessors uses (which is the case in the above test
case), so if we consider the particular case of global being a DOT, we can show
a better error message.

This error makes it look like an implementation detail,
although it's more a fact that can be deduced from the spec. Any ideas for a
better wording?
Attachment #8486520 - Flags: review?(luke)
Flags: needinfo?(benj)
Comment on attachment 8486490 [details] [diff] [review]
Use failName rather than failf when validating asm.js globals

Oops!
Attachment #8486490 - Flags: review?(luke) → review+
Comment on attachment 8486520 [details] [diff] [review]
Better wording for globals validation errors in asm.js

Review of attachment 8486520 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/asmjs/AsmJSValidate.cpp
@@ +3595,5 @@
>          PropertyName *mathOrSimd = DotMember(base);
>  
> +        if (!IsUseOfName(global, m.module().globalArgumentName())) {
> +            if (global->isKind(PNK_DOT))
> +                return m.fail(base, "maximum subscript depth should be not greater than 3 names");

How about: "imports can have at most two dot accesses (e.g., %s.Math.sin)" ?  (With failName and m.module().globalArgumentName().)
Attachment #8486520 - Flags: review?(luke) → review+
https://hg.mozilla.org/mozilla-central/rev/60219948cf27
https://hg.mozilla.org/mozilla-central/rev/989a7811d91b
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
Comment on attachment 8486490 [details] [diff] [review]
Use failName rather than failf when validating asm.js globals

Approval Request Comment
[Feature/regressing bug #]: bug 992267
[User impact if declined]: unexpected behaviour (best case: confusing error messages, worst case: crashes)
[Describe test coverage new/current, TBPL]: all tests have been passing, locally and on TBPL, for a few days
[Risks and why]: no risk -- need uplift of patch in bug 1065883 as well
[String/UUID change made/needed]: n/a
Attachment #8486490 - Flags: approval-mozilla-aurora?
Comment on attachment 8486520 [details] [diff] [review]
Better wording for globals validation errors in asm.js

Approval Request Comment
[Feature/regressing bug #]: same bug
[User impact if declined]: worse error message
[Describe test coverage new/current, TBPL]: all green
[Risks and why]: no risk -- would help uplifting the patch in the dependent bug without having to rebase.
[String/UUID change made/needed]: n/a
Attachment #8486520 - Flags: approval-mozilla-aurora?
Approval Request Comment
[Feature/regressing bug #]: same bug
[User impact if declined]: worse error message in case code isn't valid asm.js
[Describe test coverage new/current, TBPL]: all tests green
[Risks and why]: no risk -- would help uplifting in the dependent bug
[String/UUID change made/needed]: n/a
Attachment #8486520 - Attachment is obsolete: true
Attachment #8486520 - Flags: approval-mozilla-aurora?
Attachment #8489289 - Flags: review+
Attachment #8489289 - Flags: approval-mozilla-aurora?
Comment on attachment 8489289 [details] [diff] [review]
better-error-message.patch

Aurora+
Attachment #8489289 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment on attachment 8486490 [details] [diff] [review]
Use failName rather than failf when validating asm.js globals

Aurora+
Attachment #8486490 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: