Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
A
angle
  • Project
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Chen Yisong
  • angle
  • Repository

Switch branch/tag
  • angle
  • src
  • compiler
  • translator
  • ImmutableString.cpp
Find file
BlameHistoryPermalink
  • Olli Etuaho's avatar
    Avoid mangled name comparisons of 3-parameter functions · 89398b65
    Olli Etuaho authored Mar 21, 2018
    The hash values used for looking up built-ins now encode whether the
    mangled name contains arrays, structs or interface blocks in its
    parameters list. This is written in the most significant bit of the
    hash value.
    
    We check this bit at the start of built-in lookup and if the bit is
    set we exit early. After that we know that the lookup name doesn't
    contain array, struct or interface block parameters.
    
    When we find a hash that matches a hash of a built-in function, we now
    know 3 things:
    1) the length of the mangled name matches
    2) the open parentheses in the mangled name matches
    3) the lookup doesn't contain array, struct or block parameters.
    
    Additionally, we have an if statement checking whether the function
    name matches. Collisions are only possible with functions that
    1) have the same name
    2) have the same number of parameters
    
    With these preconditions we can check beforehand whether collisions
    are possible for 3-parameter functions. If there are no collisions, we
    don't need to compare the full mangled name. This is similar to what
    was already being done with functions that had 0 to 2 parameters.
    
    This reduces shader_translator binary size by around 4 KB on Windows.
    
    Besides increased complexity, the tradeoff is that an exhaustive
    search of hash values for possible 3-parameter combinations is costly,
    so the gen_builtin_functions.py code generation script now takes
    around one minute to run on a high-end workstation. Due to this, the
    script now exits early if it detects it has already been run with the
    same inputs based on a hash value stored in
    builtin_symbols_hash_autogen.txt.
    
    BUG=angleproject:2267
    BUG=chromium:823856
    TEST=angle_unittests
    
    Change-Id: I3ff8c6eb85b90d3c4971ac8d73ee171a07a7e55f
    Reviewed-on: https://chromium-review.googlesource.com/973372Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
    Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
    89398b65
ImmutableString.cpp 2.24 KB
EditWeb IDE
×

Replace ImmutableString.cpp

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.