<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>173908</bug_id>
          
          <creation_ts>2017-06-27 23:47:26 -0700</creation_ts>
          <short_desc>WebAssembly: don&apos;t tier up when out of executable memory</short_desc>
          <delta_ts>2017-06-28 00:50:35 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>171537</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="JF Bastien">jfbastien</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>fpizlo</cc>
    
    <cc>jfbastien</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1323457</commentid>
    <comment_count>0</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-06-27 23:47:26 -0700</bug_when>
    <thetext>In https://bugs.webkit.org/show_bug.cgi?id=171537 I made our implementation throw when instantiating a new module fails because there isn&apos;t enough executable memory. I also made it abort the installation of a tiered up function if we run out of executable memory.

I now want to make sure that the second case (tier up fail) doesn&apos;t end up in infinite recompile.

A few ideas:
  - Before compiling for tier up, check that at least $SOMETHING executable memory is available, where $SOMETHING is a heuristic we pick (percentage of total?).
  - Before compiling for tier up, check that at least $MULTIPLE * (end - start) executable memory is available, where (end - start) refer to the original binary, and $SOMETHING is a number we can measure from compiling existing code (average or max of what we typically see).
  - Connect with the GC better, maybe we can clean things up and find more executable memory (similar to what I did to WebAssembly.Memory + GC?).

We can do all or some of these, and base tier up backoff on these heuristics.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1323473</commentid>
    <comment_count>1</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-06-28 00:50:35 -0700</bug_when>
    <thetext>We won’t infinite loop today. We’ll only compile something once. That said, it might be worth avoiding a compilation all together if we don’t have X memory. That said, this scenario is pretty unlikely, so whatever we do there will mostly be untested code.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>