• Show log

    Commit

  • Hash : 94bbed1e
    Author : Olli Etuaho
    Date : 2018-03-20T14:44:53

    Collect static use information during parsing
    
    We now collect metadata for variables in the symbol table. The
    metadata is stored in a map using the variable unique id as a key, so
    we can store the variables themselves as constexpr while still having
    dynamic metadata.
    
    For now we collect whether a variable is statically read or written.
    This can be used to more accurately determine whether a variable is
    statically used, but can also enable more optimizations in the future,
    such as pruning variables that are never read or folding variables
    that are never written after initialization. The collection is done
    during parsing, so that nothing is pruned from the AST before the
    static use is recorded.
    
    Static writes are flagged in ParseContext::checkCanBeLValue, as that
    function is already called for all variables that are written.
    
    Static reads are flagged whenever there's an operation that requires
    a variable to be read. This includes:
    * Unary and binary math ops
    * Comma ops
    * Ternary ops
    * Assignments
    * Returning the variable
    * Passing the variable as an in or inout argument to a function
    * Using the variable as a constructor argument
    * Using the variable as an if statement condition
    * Using the variable as a loop condition or expression
    * Using the variable as an index
    * Using the variable as a switch statement init expression
    
    In case there are statements that simply refer to a variable without
    doing operations on it, the variable is being treated as statically
    read. Examples of such statements:
    
    my_var;
    my_arr[2];
    
    These are a bit of a corner case, but it makes sense to treat them as
    static use for validation purposes.
    
    Collecting correct static use information costs us a bit of compiler
    performance, but the regression is on the order of just a few percent
    in the compiler perf tests.
    
    BUG=angleproject:2262
    TEST=angle_unittests, angle_end2end_tests
    
    Change-Id: Ib0d7add7e4a7d11bffeb2a4861eeea982c562234
    Reviewed-on: https://chromium-review.googlesource.com/977964
    Reviewed-by: Corentin Wallez <cwallez@chromium.org>
    Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
    

  • Properties

  • Git HTTP https://git.kmx.io/kc3-lang/angle.git
    Git SSH git@git.kmx.io:kc3-lang/angle.git
    Public access ? public
    Description

    A conformant OpenGL ES implementation for Windows, Mac, Linux, iOS and Android.

    Homepage

    Github

    Users
    kc3_lang_org thodg_w www_kmx_io thodg_l thodg thodg_m
    Tags