<?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>270376</bug_id>
          
          <creation_ts>2024-03-01 13:43:49 -0800</creation_ts>
          <short_desc>[JSC] Decode local indices at runtime in WASM in-place interpreter</short_desc>
          <delta_ts>2024-03-07 17:48:20 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebAssembly</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="David Degazio">d_degazio</reporter>
          <assigned_to name="David Degazio">d_degazio</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2018103</commentid>
    <comment_count>0</comment_count>
    <who name="David Degazio">d_degazio</who>
    <bug_when>2024-03-01 13:43:49 -0800</bug_when>
    <thetext>rdar://123720682

Local indices are encoded using ULEB128 in WebAssembly. In the work-in-progress in-place interpreter, we currently handle (U)LEB128 decoding during validation, and generate fully decoded indices in the metadata. Most functions, however, have very few locals in WebAssembly - WASM binaries that have gone through optimizations tend to treat locals like registers, and in all of JetStream 2 there is no local index that takes more than two bytes to encode. Since it&apos;s extremely common local indices will be single-byte, then it makes a lot of sense to skip the metadata entirely for all local instructions, instead having a single-byte fast path combined with an infrequently-taken ULEB128 decode at runtime. Since getting and setting locals makes up something like 1/3 of all WASM instructions in typical binaries, this should substantially reduce the size of the metadata generated for the in-place interpreter, and hopefully improve runtime performance as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2019441</commentid>
    <comment_count>1</comment_count>
    <who name="David Degazio">d_degazio</who>
    <bug_when>2024-03-07 13:21:37 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/25596</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2019510</commentid>
    <comment_count>2</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-03-07 17:48:18 -0800</bug_when>
    <thetext>Committed 275815@main (bfe017002276): &lt;https://commits.webkit.org/275815@main&gt;

Reviewed commits have been landed. Closing PR #25596 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>