Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add slangc flag to -zero-initialize all variables #3987

Merged

Commits on Apr 19, 2024

  1. Default (zero'd) values with -zero-initialize flag

    Adds `-zero-initialize` flag to set values to a __default() expression if they are missing a initExpr.
    ArielG-NV committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    ee02d85 View commit details
    Browse the repository at this point in the history
  2. Merge branch 'master' of https://github.com/ArielG-NV/slang into opti…

    …on-to-zero-initialize-all-variables
    ArielG-NV committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    6cba6a5 View commit details
    Browse the repository at this point in the history

Commits on Apr 21, 2024

  1. address review and ensure __default calls ctor + zero's fields.

    1. We must keep zero-initialize in SemanticsDeclHeaderVisitor. This is done because else a ctor will be initialized before we can set struct fields to `__default`.
    2. IRDefaultCtorDecoration was added to track default ctor's with parent struct.
    3. ParentAggTypeModifier was added to track ChildOfStruct->IRType for sharing data such as with functions. This is required to ensure we associate a lowered function with a lowered struct type
    ArielG-NV committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    e8d161a View commit details
    Browse the repository at this point in the history
  2. Merge branch 'master' of https://github.com/ArielG-NV/slang into opti…

    …on-to-zero-initialize-all-variables
    ArielG-NV committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    2ac4760 View commit details
    Browse the repository at this point in the history
  3. Removed decoration to track defaultCtor in favor of field.

    This was done since decorations are checked for IR objects, storing auxillary info does not work here as a result if usable object.
    ArielG-NV committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    d8e28a4 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    dda55ff View commit details
    Browse the repository at this point in the history
  5. Merge branch 'option-to-zero-initialize-all-variables' of https://git…

    …hub.com/ArielG-NV/slang into option-to-zero-initialize-all-variables
    ArielG-NV committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    65f3b23 View commit details
    Browse the repository at this point in the history

Commits on Apr 22, 2024

  1. address some review comments

    Since `IDefaultInitializable` is taking a considerabley larger amount of time than anticipated I am pushing some of the other fixes requested. I did not remove the "IRStruct storing a default Ctor" hack yet.
    
    mostly renamed/adjusted tests to work as intended
    
    added test to ensure we don't synthisize a junk `= 0` when not in `zero initialize` mode
    
    removed member in favor of sharedContext+dictionary.
    ArielG-NV committed Apr 22, 2024
    Configuration menu
    Copy the full SHA
    cbc26a6 View commit details
    Browse the repository at this point in the history

Commits on Apr 26, 2024

  1. Merge branch 'master' of https://github.com/ArielG-NV/slang into opti…

    …on-to-zero-initialize-all-variables
    ArielG-NV committed Apr 26, 2024
    Configuration menu
    Copy the full SHA
    7eed93e View commit details
    Browse the repository at this point in the history

Commits on Apr 28, 2024

  1. Configuration menu
    Copy the full SHA
    481a3f9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    788d838 View commit details
    Browse the repository at this point in the history

Commits on Apr 29, 2024

  1. Finish zero init code

    1. IDefaultInitializer interface was added. If conforming, your type may be zero-initialized. To Conform a `__init()` is required
    2. `[OnlyAutoInitIfForced]` was added. This attribute states that a default initializer should only be implicitly called if forced by the compiler (`zero-initialize` for example). This allows types which implicitly/explicitly conform to IDefaultInitialize to have optional auto-init behavior (which is Slang's default for user structs) to be disabled.
    
    * note about `[OnlyAutoInitIfForced]`. This is required for std-lib to not automatically resolve init-expressions for std-lib, but it has the added benifit of allowing user made structs/classes to control the default behavior of initializing
    ArielG-NV committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    8a0efcc View commit details
    Browse the repository at this point in the history
  2. fix ErrType assumption

    ArielG-NV committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    d9ab0a8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6ac2b36 View commit details
    Browse the repository at this point in the history
  4. Merge branch 'master' of https://github.com/ArielG-NV/slang into opti…

    …on-to-zero-initialize-all-variables
    ArielG-NV committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    cd9161e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    6a0a8e6 View commit details
    Browse the repository at this point in the history

Commits on Apr 30, 2024

  1. Configuration menu
    Copy the full SHA
    40ead4f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1453fff View commit details
    Browse the repository at this point in the history
  3. fix field-init expressions with structs initializers

    don't init a static in a ctor. This would be illegal code and wrong code (init list in lower-to-ir)
    ArielG-NV committed Apr 30, 2024
    Configuration menu
    Copy the full SHA
    a0dfa9e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9110af7 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    909ce56 View commit details
    Browse the repository at this point in the history
  6. Merge branch 'option-to-zero-initialize-all-variables' of https://git…

    …hub.com/ArielG-NV/slang into option-to-zero-initialize-all-variables
    ArielG-NV committed Apr 30, 2024
    Configuration menu
    Copy the full SHA
    e97b7c1 View commit details
    Browse the repository at this point in the history
  7. fix

    ArielG-NV committed Apr 30, 2024
    Configuration menu
    Copy the full SHA
    8e38e95 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    f337f90 View commit details
    Browse the repository at this point in the history

Commits on May 16, 2024

  1. Configuration menu
    Copy the full SHA
    b1cb7bd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1ff34fb View commit details
    Browse the repository at this point in the history
  3. Merge branch 'option-to-zero-initialize-all-variables' of https://git…

    …hub.com/ArielG-NV/slang into option-to-zero-initialize-all-variables
    ArielG-NV committed May 16, 2024
    Configuration menu
    Copy the full SHA
    a09a5ec View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d6fbb87 View commit details
    Browse the repository at this point in the history
  5. fix type checking error

    should be checking if a valid type is `Type`, not `BasicExpressionType`
    ArielG-NV committed May 16, 2024
    Configuration menu
    Copy the full SHA
    b93f236 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    bf4cb40 View commit details
    Browse the repository at this point in the history
  7. fix langguage server error

    ArielG-NV committed May 16, 2024
    Configuration menu
    Copy the full SHA
    afef320 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    1199dcc View commit details
    Browse the repository at this point in the history
  9. remove return false

    verified the issue was `findInheritance`
    ArielG-NV committed May 16, 2024
    Configuration menu
    Copy the full SHA
    cbc526f View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    f58a7bf View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    69f686a View commit details
    Browse the repository at this point in the history

Commits on May 17, 2024

  1. Configuration menu
    Copy the full SHA
    4ec3988 View commit details
    Browse the repository at this point in the history
  2. added extension support, remove redundant code

    Did not address all review comments yet, want to see if CI also passes my changes
    ArielG-NV committed May 17, 2024
    Configuration menu
    Copy the full SHA
    126abbd View commit details
    Browse the repository at this point in the history

Commits on May 18, 2024

  1. Configuration menu
    Copy the full SHA
    8f9286d View commit details
    Browse the repository at this point in the history
  2. change logic + DefaultConstructExpr

    setup code to use defaultConstructExpr when possible to construct a default without overhead of invoke/related
    
    also changed code so parent's defaultInitializable propegates to derived member
    ArielG-NV committed May 18, 2024
    Configuration menu
    Copy the full SHA
    94651a0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    479c8cd View commit details
    Browse the repository at this point in the history
  4. 1. fix error in isSubtype 2. add flag to isSubtype

    `subtypeInheritanceIsNotFullyResolved` was added since we may not be done the lookup stage but still require `isSubtype` checking to verify usage of inheritance while working with inheritance. In This case we will just skip `ensureLookup` and "caching" (since we don't have a cache invalidation system, nor need)
    ArielG-NV committed May 18, 2024
    Configuration menu
    Copy the full SHA
    b776ec5 View commit details
    Browse the repository at this point in the history
  5. Merge branch 'option-to-zero-initialize-all-variables' of https://git…

    …hub.com/ArielG-NV/slang into option-to-zero-initialize-all-variables
    ArielG-NV committed May 18, 2024
    Configuration menu
    Copy the full SHA
    6425cc3 View commit details
    Browse the repository at this point in the history

Commits on May 21, 2024

  1. Configuration menu
    Copy the full SHA
    40f742c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c0b391b View commit details
    Browse the repository at this point in the history

Commits on May 22, 2024

  1. Configuration menu
    Copy the full SHA
    f6729e0 View commit details
    Browse the repository at this point in the history
  2. Merge branch 'option-to-zero-initialize-all-variables' of https://git…

    …hub.com/ArielG-NV/slang into option-to-zero-initialize-all-variables
    ArielG-NV committed May 22, 2024
    Configuration menu
    Copy the full SHA
    576cdb3 View commit details
    Browse the repository at this point in the history

Commits on May 23, 2024

  1. fix wrong code adjustment

    I checked on the CI and realized I caused a failure, mistake was made not negating some code
    ArielG-NV committed May 23, 2024
    Configuration menu
    Copy the full SHA
    ce9593a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f6e44d9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    918ebf8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1dda8ff View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d8adeb2 View commit details
    Browse the repository at this point in the history
  6. Merge branch 'option-to-zero-initialize-all-variables' of https://git…

    …hub.com/ArielG-NV/slang into option-to-zero-initialize-all-variables
    ArielG-NV committed May 23, 2024
    Configuration menu
    Copy the full SHA
    e40237a View commit details
    Browse the repository at this point in the history

Commits on May 24, 2024

  1. remove redundant code + fix defaultConstruct emitting

    previously defaultConstruct emitting was crashing due to having generics unresolved. By not resolving the default construct immediately, everything works.
    ArielG-NV committed May 24, 2024
    Configuration menu
    Copy the full SHA
    35eeeb9 View commit details
    Browse the repository at this point in the history
  2. remove a coment

    ArielG-NV committed May 24, 2024
    Configuration menu
    Copy the full SHA
    4fcf274 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b2dc0cd View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e110a8b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    922d301 View commit details
    Browse the repository at this point in the history
  6. Merge branch 'option-to-zero-initialize-all-variables' of https://git…

    …hub.com/ArielG-NV/slang into option-to-zero-initialize-all-variables
    ArielG-NV committed May 24, 2024
    Configuration menu
    Copy the full SHA
    40e0a0e View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    8404332 View commit details
    Browse the repository at this point in the history

Commits on Jun 11, 2024

  1. Configuration menu
    Copy the full SHA
    7f53eb3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d5288a6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b7e5375 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a41cad5 View commit details
    Browse the repository at this point in the history

Commits on Jun 12, 2024

  1. address review and add -zero-initialize test

    `-zero-initialize` test was added to be sure debug pointers are not broken with default init values
    ArielG-NV committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    095fa8a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1cf893e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9966baf View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    210805f View commit details
    Browse the repository at this point in the history