Closed Bug 1243815 Opened 7 years ago Closed 7 years ago

Baldr: Put hard limits to the number of sigs/args/imports etc.

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox47 --- fixed

People

(Reporter: bbouvier, Assigned: bbouvier)

Details

Attachments

(1 file)

      No description provided.
Attached patch hardlimits.patchSplinter Review
I checked DeadTrigger2, maximum number of arguments per function is 17, so 128 should be enough for everybody.
Attachment #8713301 - Flags: review?(luke)
Comment on attachment 8713301 [details] [diff] [review]
hardlimits.patch

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

Nice, thanks!

::: js/src/asmjs/AsmJS.cpp
@@ -1674,5 @@
>          return sigMap_.add(p, &mg_.sig(*sigIndex), *sigIndex);
>      }
>  
> -    // ModuleGeneratorData limits:
> -    static const unsigned MaxSigs    =   4 * 1024;

Good idea sharing these limits!

::: js/src/asmjs/Wasm.cpp
@@ +393,5 @@
>      if (!d.readVarU32(&numDecls))
>          return Fail(cx, d, "expected number of declarations");
>  
> +    if (numDecls > MaxFuncs)
> +        return Fail(cx, d, "too many function declarations");

Let's just say "too many functions" (since num-decls = num-funcs).

::: js/src/asmjs/WasmBinary.h
@@ +32,5 @@
> +static const unsigned MaxSigs        =   4 * 1024;
> +static const unsigned MaxFuncs       = 512 * 1024;
> +static const unsigned MaxImports     =   4 * 1024;
> +static const unsigned MaxExports     =   4 * 1024;
> +static const unsigned MaxArgsPerFunc = 128;

I can imagine weird generated cases arising from codegen where the number of args could be quite a lot.  How about we bump this to 4k as well?
Attachment #8713301 - Flags: review?(luke) → review+
https://hg.mozilla.org/mozilla-central/rev/9e8f89a81569
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
You need to log in before you can comment on or make changes to this bug.