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

RAII Types and more #213

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

RAII Types and more #213

wants to merge 7 commits into from

Conversation

lwaern-intel
Copy link
Contributor

Besides the obvious (RAII architecture, vectors, strings), this includes:

  1. cast(initializer, ...) syntax, and rework of associated logic
  2. As a result of the above, compound literals. cast({1,2,3}, int[3]) is now supported.
  3. a += initializer syntax, and rework of associated logic. This means complex method calls can be used as RHS of +=/-=/etc.
  4. Reworked statements' toc/toc_inline family
  5. ExpressionInitializer.assign_to and Expression.write rework
  6. The addition of "addressable" and "c_lval" to Expression, and an associated rework of lvalue-ness
  7. Strict DMLType.cmp. Old implementation is still used in a few places and is called cmp_fuzzy
  8. The ability to hash DML Types in a way compatible with the new strict cmp.
  9. extern cident(blabla) as dmlident;.
  10. Improved deserialization logic for arrays; doesn't need a stack frame per dimension

This is a draft PR as it is way too massive to be merged in as-is. We should decide upon what we should split and how.
In addition, the tests in this PR are too basic -- they are touch-ups of the ad-hoc tests I made while working on this. They are not sufficient to e.g. exhaustively test the semantics of strings and vectors -- vectors in particular have some very complicated logic attached to them.

You'll spot a number of TODO(RAII)s in the implementation -- these represent particular question marks where I feel the implementation could potentially be improved, rather than unimplemented components -- this PR is feature complete.

@@ -1,2 +1,3 @@
*~
*.pyc
flycheck_*
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addition was because I got real tired of my rg taking me into files fisketur flycheck created, and adding a flycheck_* filter was the easiest way to avoid that. We may or may not want this in.

method ms(int i) -> (string) throws {
if (i > 4) throw;
return mk_string_f("%d", i);
}
Copy link
Contributor Author

@lwaern-intel lwaern-intel Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Artifact, I moved the test using this method to 1.4/types/raii/T_various.

@syssimics
Copy link
Contributor

Verification #12261598: fail

class Orphan(Expression):
"""Expressions that evaluate to a value that is allocated on the stack, but
not belonging to any local variable. Archetypical example are function
applications."""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description was written in a better time when orphans were directly tied to C concepts. What they are nowadays are not so simple (Expression.orphan has the better description)

Besides the obvious (RAII architecture, vectors, strings), this includes:
1. `cast(initializer, ...)` syntax, and rework of associated logic
3. As a result of the above, compound literals. `cast({1,2,3}, int[3])` is now supported.
4. `a += initializer` syntax, and rework of associated logic. This means complex method calls can be used as RHS of `+=`/`-=`/etc.
5. Reworked statements' `toc`/`toc_inline` family
6. ExpressionInitializer.assign_to and Expression.write rework
7. The addition of "addressable" and "c_lval" to Expression, and an associated rework of lvalue-ness
8. Strict `DMLType.cmp`. Old implementation is still used in a few places and is called `cmp_fuzzy`
9. The ability to hash DML Types in a way compatible with the new strict cmp.
10. `extern cident(blabla) as dmlident;`.
11. Improved deserialization logic for arrays; doesn't need a stack frame per dimension
@lwaern-intel
Copy link
Contributor Author

@lwaern-intel
Copy link
Contributor Author

Verification run featuring incompatibility patch (#217): https://teamcity01-ir.devtools.intel.com/viewQueued.html?itemId=12292226

@lwaern-intel
Copy link
Contributor Author

Verification without incompatibility: https://teamcity01-ir.devtools.intel.com/viewQueued.html?itemId=12292197

lwaern-intel added a commit that referenced this pull request May 27, 2024
Taken from #213, but with some refinements
lwaern-intel added a commit that referenced this pull request May 27, 2024
Taken from #213, but with some refinements
lwaern-intel added a commit that referenced this pull request May 27, 2024
Taken from #213, but with some refinements
lwaern-intel added a commit that referenced this pull request May 27, 2024
Taken from #213, but with some refinements
lwaern-intel added a commit that referenced this pull request May 27, 2024
Taken from #213, but with some refinements
lwaern-intel added a commit that referenced this pull request May 27, 2024
Taken from #213, but with some refinements
lwaern-intel added a commit that referenced this pull request May 29, 2024
Taken from #213, but with some refinements
lwaern-intel added a commit that referenced this pull request May 30, 2024
Taken from #213, but with some refinements
lwaern-intel added a commit that referenced this pull request Jun 10, 2024
Taken from #213, but with some refinements
lwaern-intel added a commit that referenced this pull request Jun 11, 2024
Taken from #213, but with some refinements
lwaern-intel added a commit that referenced this pull request Jun 11, 2024
Taken from #213, but with some refinements
lwaern-intel added a commit that referenced this pull request Jun 11, 2024
Taken from #213, but with some refinements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants