From 0e424883836c8390d1d5ef04edb2a48f5d522145 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 13 Jul 2022 13:25:05 -0400 Subject: [PATCH 01/36] start updating --- book/docs/dyn_tutorial/class.md | 71 ++++++++++++++------------------- book/docs/dyn_tutorial/index.md | 6 ++- 2 files changed, 34 insertions(+), 43 deletions(-) diff --git a/book/docs/dyn_tutorial/class.md b/book/docs/dyn_tutorial/class.md index 97a47285..122c45e1 100644 --- a/book/docs/dyn_tutorial/class.md +++ b/book/docs/dyn_tutorial/class.md @@ -11,70 +11,59 @@ import Caveat from '../caveat.md' The main data structures in Dada are classes. The full class syntax has various bells and whistles, but let's start off with the simplest form. We'll define a class `Point` for storing `(x, y)` values. It will have two fields, `x` and `y`: ``` -class Point(our x, our y) -# ^^^^^ ^^^ ^ -# | | | -# | | Field name -# | Permission +class Point(x, y) +# ^^^^^ ^ ^ +# | | | +# | | Field name +# | Field name # Class name ``` -## The `our` permission - -You can see that the fields are declared with an *permission* -- `our` in this case. There are several permissions (`my`, `our`, `leased`, and `shleased`); these permissions are a key part of how Dada works, and we'll be covering them throughout this tutorial. For now, it's enough to say that an `our` field stores an object that may be referenced by other fields or variables as well (it belongs to everyone, hence `our`). For points, we are expecting to store integers like `22` and `44`, so this is a good fit. - ## Constructor functions -The `class Point(..)` syntax also creates a constructor function that creates an instance of `Point` when called. Try executing the following code: +The `class Point(..)` syntax also creates a constructor function that creates an instance of `Point` when called. To get a feel for how classes work in practice, work with the following code. Feel free to make changes and see what happens! You'll also notice that when you move your cursor, the code executes up until the line you selected. -``` -class Point(our x, our y) +```dada ide +class Point(x, y) # This function is declared as `async` because it # awaits the result of print. async fn print_point(p) { + # Note that you can use `{...}` to embed an expression + # into the value of a string (in this case, the + # variable `p`). print("The point is: {p}").await } -# This function is not declared as `async` because it -# doesn't await anything. The `->` indicates that it -# returns a value. +# Declares a function that computes a new value. +# (It doesn't await anything, so the function is not `async`.) fn compute_new_value() -> { + # ^^ this `->` indicates that + # the function returns a value. 33 } -my p = Point(22, 44) +# Writing `p = ...` declares a new variable `p` +# and assigns its initial value (`Point(22, 44)`) +p = Point(22, 44) + +# Invoke `print_point`; it's an `async` function, +# so await the result print_point(p).await + +# The `:=` operator is used to modify an existing +# field (remember, `=` declares a new variable). p.x := compute_new_value() + +# You can also use `+=` to modify an existing field +# (this time by adding to it). Other operators, like +# `-=`, `*=`, `/=`, also work. p.x += 1 + +# Print the new value. print_point(p).await # prints: # The point is: Point(x: 22, y: 44) # The point is: Point(x: 34, y: 44) ``` - -Some things to note here: - -* Comments are written `#`, like Python or Ruby, not `//` like JavaScript or Rust. -* The `my p = ...` statement declares a local variable `p` using another permission, `my`. - * `my` declares a variable that has *unique* access to its object: in this case, we just created the `Point`, so nobody else could possibly be referencing it, so that makes sense. If that doesn't make sense yet, don't worry, we're going to talk all about `my` in the next section. -* You create a class by invoking its constructor function `Point(22, 44)`. -* Strings can embed expressions with `{}`, and they get "stringified", so `"The point is {p}"` embeds `p` into the string. - * The default stringifier prints the values of each field. -* You write `:=` to reassign variables or fields (just `=` is for declaring a new variable). - * You can also use the `+=`, `-=`, `*=`, `/=`, `%=` operators you may be familiar with from other languages. -* Declaring a function with `async fn` means that it can await thunks, like the one from calling `print`. -* Declaring a function with `->` means that it returns a value; as in Rust, the final expression in the function is its return value. - * In this case, `compute_new_value()` returns `33`. - -## Summary and key differences - -So far, everything hopefully feels fairly familiar, except for the [permissions](./permissions.md), which we'll cover next. Some highlights: - -* Declaring a class like `class Point(x, y)` also gives a constructor function `Point` that can be called (e.g., `Point(22, 44)`) to create an instance of the class. -* You can use `"{p}"` in strings to print the values of things. -* Use `=` to declare a new variable and `:=` or `+=` to update an existing one. -* Dada is based on async-await: - * When you `print` something (or do any I/O), you must `await` the result for it to take effect (`print("Hi").await`). - * You can only `await` things from inside an `async` fn. diff --git a/book/docs/dyn_tutorial/index.md b/book/docs/dyn_tutorial/index.md index bfe094fa..b8816b87 100644 --- a/book/docs/dyn_tutorial/index.md +++ b/book/docs/dyn_tutorial/index.md @@ -7,6 +7,7 @@ import Caveat from '../caveat.md' The classic “Hello, World” program in Dada should be quite familiar: ```dada ide +# Print a classic quote print(" I have forced myself to contradict myself in order to avoid conforming to my own taste. @@ -24,5 +25,6 @@ in order to avoid conforming to my own taste. There are a few interesting things to note: -* Dada, like JavaScript, is based exclusively on **async-await**. This means that operations that perform I/O, like `print`, don't execute immediately. Instead, they return a *thunk*, which is basically "code waiting to run" (but not running yet). The thunk doesn't execute until you *await* it by using the `.await` operation. -* Strings in Dada can spread over multiple lines. Leading and trailing whitespace is stripped by default, and we also remove any common indentation from each line. +- Comments in Dada are written with `#`, like Python or Ruby, not `//` like JavaScript or Rust. +- Dada, like JavaScript, is based exclusively on **async-await**. This means that operations that perform I/O, like `print`, don't execute immediately. Instead, they return a _thunk_, which is basically "code waiting to run" (but not running yet). The thunk doesn't execute until you _await_ it by using the `.await` operation. +- Strings in Dada can spread over multiple lines. Leading and trailing whitespace is stripped by default, and we also remove any common indentation from each line. From f2b49466376d8ff311eb9c64994a566ac1d080fc Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 13 Jul 2022 14:14:44 -0400 Subject: [PATCH 02/36] adjust number of lines based on source text --- book/src/components/Ide/index.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/book/src/components/Ide/index.tsx b/book/src/components/Ide/index.tsx index b99c68a0..6c07f37b 100644 --- a/book/src/components/Ide/index.tsx +++ b/book/src/components/Ide/index.tsx @@ -125,6 +125,12 @@ function Ide(props: { mini: boolean; sourceText: string }) { const [queue] = useState(() => new Queue()); const [outputMode, setOutputMode] = useState(OutputMode.EXECUTE); + // Guess an appropriate number of lines based on the initial + // source. + let numSourceLines = props.sourceText.split(/\n|\r/).length; + let minLines = Math.min(Math.max(numSourceLines, 5), 50); + console.log(`numSourceLines = ${numSourceLines}, minLines = ${minLines}`); + // First pass: we have to initialize the webassembly and "DCW" // instance. useEffect(() => { @@ -183,8 +189,8 @@ function Ide(props: { mini: boolean; sourceText: string }) { source={source} onCursorChange={setCursor} onSourceChange={setSource} - minLines={3} - maxLines={10} + minLines={minLines} + maxLines={minLines} /> From 2c9707f0a2ddb735c0173a8c53853f01cf7b743a Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 14 Jul 2022 15:39:51 +0300 Subject: [PATCH 03/36] remove the `my` specifier --- components/dada-execute/src/step.rs | 1 - components/dada-ir/src/storage.rs | 6 ++---- components/dada-parse/src/parser/parameter.rs | 4 +--- components/dada-validate/src/validate/validator.rs | 6 +++--- .../house-parties/house-parties-are-not-enough.dada | 4 ++-- .../house-parties-are-not-fair-to-the-tenant.dada | 4 ++-- dada_tests/permissions/revokation/lease-vs-shlease-1.dada | 2 +- dada_tests/permissions/revokation/lease-vs-shlease-2.dada | 2 +- dada_tests/reservations/our-to-our-leased-assign-field.dada | 2 +- dada_tests/reservations/our-to-our-leased-field.dada | 2 +- dada_tests/specifier/field-leased-mode-leases.dada | 6 +++--- dada_tests/specifier/field-our-mode-moves.dada | 6 +++--- dada_tests/specifier/local-my.dada | 2 +- dada_tests/specifier/need-leased-got-my-lvalue.dada | 2 +- dada_tests/specifier/need-my-got-leased.dada | 5 ----- dada_tests/specifier/need-my-got-leased/compiler-output.ref | 0 dada_tests/specifier/need-my-got-leased/stdout.ref | 0 dada_tests/specifier/need-my-got-my.dada | 5 ----- dada_tests/specifier/need-my-got-my/compiler-output.ref | 0 dada_tests/specifier/need-my-got-my/stdout.ref | 0 dada_tests/specifier/need-my-got-our.dada | 5 ----- dada_tests/specifier/need-my-got-our/compiler-output.ref | 0 dada_tests/specifier/need-my-got-our/stdout.ref | 0 dada_tests/specifier/need-my-got-shleased.dada | 5 ----- .../specifier/need-my-got-shleased/compiler-output.ref | 0 dada_tests/specifier/need-my-got-shleased/stdout.ref | 0 dada_tests/validate/op-eq/lhs_field.dada | 2 +- dada_tests/validate/op-eq/lhs_field_of_func_call.dada | 2 +- dada_tests/validate/op-eq/lhs_func_call.dada | 2 +- dada_tests/validate/op-eq/lhs_local_variable.dada | 2 +- 30 files changed, 26 insertions(+), 51 deletions(-) delete mode 100644 dada_tests/specifier/need-my-got-leased.dada delete mode 100644 dada_tests/specifier/need-my-got-leased/compiler-output.ref delete mode 100644 dada_tests/specifier/need-my-got-leased/stdout.ref delete mode 100644 dada_tests/specifier/need-my-got-my.dada delete mode 100644 dada_tests/specifier/need-my-got-my/compiler-output.ref delete mode 100644 dada_tests/specifier/need-my-got-my/stdout.ref delete mode 100644 dada_tests/specifier/need-my-got-our.dada delete mode 100644 dada_tests/specifier/need-my-got-our/compiler-output.ref delete mode 100644 dada_tests/specifier/need-my-got-our/stdout.ref delete mode 100644 dada_tests/specifier/need-my-got-shleased.dada delete mode 100644 dada_tests/specifier/need-my-got-shleased/compiler-output.ref delete mode 100644 dada_tests/specifier/need-my-got-shleased/stdout.ref diff --git a/components/dada-execute/src/step.rs b/components/dada-execute/src/step.rs index 3090ff1f..8302ec85 100644 --- a/components/dada-execute/src/step.rs +++ b/components/dada-execute/src/step.rs @@ -284,7 +284,6 @@ impl<'me> Stepper<'me> { tracing::debug!(?specifier); let value = match specifier { - Specifier::My => self.give_place(table, source_place)?, Specifier::Our => self.share_place(table, source_place)?, Specifier::Leased => self.lease_place(table, source_place)?, Specifier::Shleased => self.shlease_place(table, source_place)?, diff --git a/components/dada-ir/src/storage.rs b/components/dada-ir/src/storage.rs index 50dcc20f..c6461ccb 100644 --- a/components/dada-ir/src/storage.rs +++ b/components/dada-ir/src/storage.rs @@ -25,7 +25,6 @@ impl SpannedSpecifier { #[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash, Debug)] pub enum Specifier { - My, Our, Leased, Shleased, @@ -39,7 +38,7 @@ impl Specifier { /// [`Specifier::Any`] returns false. pub fn must_be_unique(self) -> bool { match self { - Specifier::My | Specifier::Leased => true, + Specifier::Leased => true, Specifier::Our | Specifier::Shleased => false, Specifier::Any => false, } @@ -51,7 +50,7 @@ impl Specifier { /// [`Specifier::Any`] returns false. pub fn must_be_owned(self) -> bool { match self { - Specifier::Our | Specifier::My => true, + Specifier::Our => true, Specifier::Shleased | Specifier::Leased => false, Specifier::Any => false, } @@ -62,7 +61,6 @@ impl std::fmt::Display for Specifier { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Specifier::Our => write!(f, "our"), - Specifier::My => write!(f, "my"), Specifier::Shleased => write!(f, "shleased"), Specifier::Leased => write!(f, "leased"), Specifier::Any => write!(f, "any"), diff --git a/components/dada-parse/src/parser/parameter.rs b/components/dada-parse/src/parser/parameter.rs index 51945ff4..4c346580 100644 --- a/components/dada-parse/src/parser/parameter.rs +++ b/components/dada-parse/src/parser/parameter.rs @@ -87,9 +87,7 @@ impl<'db> Parser<'db> { span.in_file(filename), )) }; - if let Some((my_span, _)) = self.eat(Keyword::My) { - some_specifier(Specifier::My, my_span) - } else if let Some((our_span, _)) = self.eat(Keyword::Our) { + if let Some((our_span, _)) = self.eat(Keyword::Our) { some_specifier(Specifier::Our, our_span) } else if let Some((shleased_span, _)) = self.eat(Keyword::Shleased) { some_specifier(Specifier::Shleased, shleased_span) diff --git a/components/dada-validate/src/validate/validator.rs b/components/dada-validate/src/validate/validator.rs index bfe49f96..5e00e692 100644 --- a/components/dada-validate/src/validate/validator.rs +++ b/components/dada-validate/src/validate/validator.rs @@ -48,7 +48,7 @@ pub enum ExprMode { impl ExprMode { fn give() -> Self { - Self::Specifier(Specifier::My) + Self::Specifier(Specifier::Any) } fn leased() -> Self { @@ -443,7 +443,7 @@ impl<'me> Validator<'me> { let validated_body_expr = self .subscope() .with_loop_expr(loop_expr) - .validate_expr_and_exit(*body_expr, ExprMode::Specifier(Specifier::My)); + .validate_expr_and_exit(*body_expr, ExprMode::give()); self.tables[loop_expr] = validated::ExprData::Loop(validated_body_expr); @@ -815,7 +815,7 @@ impl<'me> Validator<'me> { ) -> validated::Expr { match data { Ok((opt_assign_expr, place)) => match mode { - ExprMode::Specifier(Specifier::My) | ExprMode::Specifier(Specifier::Any) => { + ExprMode::Specifier(Specifier::Any) => { let place_expr = self.add(validated::ExprData::Give(place), origin); self.seq(opt_assign_expr, place_expr) } diff --git a/dada_tests/permissions/house-parties/house-parties-are-not-enough.dada b/dada_tests/permissions/house-parties/house-parties-are-not-enough.dada index 52da92d4..a1e11842 100644 --- a/dada_tests/permissions/house-parties/house-parties-are-not-enough.dada +++ b/dada_tests/permissions/house-parties/house-parties-are-not-enough.dada @@ -4,7 +4,7 @@ # isn't enough to truly capture the flexibility of # Rust's shared borrows. -class Accumulator(my list) +class Accumulator(any list) class List() # This function takes a `shleased` accumulator and returns a @@ -22,7 +22,7 @@ async fn main() { # // works fine! # ``` - my a = Accumulator(list: List()) + any a = Accumulator(list: List()) l1 = get_list(a) l2 = get_list(a) print(l2).await #! OUTPUT List\(\) diff --git a/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada b/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada index 4fd44dbb..a8be5fb2 100644 --- a/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada +++ b/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada @@ -10,7 +10,7 @@ # atomic fields etc, it's hard to demonstrate this danger. =) # But I'm pretty sure it's there. -class Accumulator(my atomic list) +class Accumulator(any atomic list) class List(our field) fn foo(leased accumulator) -> # shleased List @@ -20,7 +20,7 @@ fn foo(leased accumulator) -> # shleased List } async fn main() { - my a = Accumulator(list: List(22)) + any a = Accumulator(list: List(22)) # get a shared lease to the list, # but it is still owned by `a` diff --git a/dada_tests/permissions/revokation/lease-vs-shlease-1.dada b/dada_tests/permissions/revokation/lease-vs-shlease-1.dada index 86a9ae6b..4f0b1294 100644 --- a/dada_tests/permissions/revokation/lease-vs-shlease-1.dada +++ b/dada_tests/permissions/revokation/lease-vs-shlease-1.dada @@ -1,7 +1,7 @@ class Data(our field) async fn main() { - my m = Data(22) + any m = Data(22) leased l = m shleased s = l print(m.field).await #! OUTPUT 22 diff --git a/dada_tests/permissions/revokation/lease-vs-shlease-2.dada b/dada_tests/permissions/revokation/lease-vs-shlease-2.dada index cf73d7b7..c0c3f538 100644 --- a/dada_tests/permissions/revokation/lease-vs-shlease-2.dada +++ b/dada_tests/permissions/revokation/lease-vs-shlease-2.dada @@ -1,7 +1,7 @@ class Data(our field) async fn main() { - my m = Data(22) + any m = Data(22) shleased s = m print(m.field).await #! OUTPUT 22 print(s.field).await #! OUTPUT 22 diff --git a/dada_tests/reservations/our-to-our-leased-assign-field.dada b/dada_tests/reservations/our-to-our-leased-assign-field.dada index 29825a01..4b4b2cc2 100644 --- a/dada_tests/reservations/our-to-our-leased-assign-field.dada +++ b/dada_tests/reservations/our-to-our-leased-assign-field.dada @@ -4,7 +4,7 @@ class OurLeased(shleased f) async fn main() { our p = Point(22, 44) # create a shared point `(22, 44)` - my q = OurLeased(p) # `q.f` becomes 2nd owner of `(22, 44)` + any q = OurLeased(p) # `q.f` becomes 2nd owner of `(22, 44)` print(q.lease).await #! OUTPUT OurLeased\(our Point\(22, 44\)\) p := Point(44, 66) # `p` is shared owner of `(44, 66)` diff --git a/dada_tests/reservations/our-to-our-leased-field.dada b/dada_tests/reservations/our-to-our-leased-field.dada index f312a757..f2373a7e 100644 --- a/dada_tests/reservations/our-to-our-leased-field.dada +++ b/dada_tests/reservations/our-to-our-leased-field.dada @@ -5,7 +5,7 @@ class OurLeased(shleased f) async fn main() { our p = Point(22, 44) # create `(22, 44)` with shared ownership print(p.lease).await #! OUTPUT Point\(22, 44\) - my q = OurLeased(p) # `OurLeased` takes 2nd ownership of `(22, 44)` + any q = OurLeased(p) # `OurLeased` takes 2nd ownership of `(22, 44)` print(q.lease).await #! OUTPUT OurLeased\(our Point\(22, 44\)\) p := Point(44, 66) # reassigning `p` doesn't invalidate `q.f` diff --git a/dada_tests/specifier/field-leased-mode-leases.dada b/dada_tests/specifier/field-leased-mode-leases.dada index 519b88e8..5218287c 100644 --- a/dada_tests/specifier/field-leased-mode-leases.dada +++ b/dada_tests/specifier/field-leased-mode-leases.dada @@ -8,9 +8,9 @@ class Widget( ) async fn main() { - my w1 = Widget("w1") - my w2 = Widget("w2") - my p = Modes(w1, w2) + any w1 = Widget("w1") + any w2 = Widget("w2") + any p = Modes(w1, w2) print(p.l).await #! OUTPUT Widget\(w1\) print(w1).await #! OUTPUT Widget\(w1\) print(p.l).await #! RUN ERROR your lease to this object was cancelled diff --git a/dada_tests/specifier/field-our-mode-moves.dada b/dada_tests/specifier/field-our-mode-moves.dada index 350686f4..069135d6 100644 --- a/dada_tests/specifier/field-our-mode-moves.dada +++ b/dada_tests/specifier/field-our-mode-moves.dada @@ -8,8 +8,8 @@ class Widget( ) async fn main() { - my w1 = Widget("w1") - my w2 = Widget("w2") - my p = Modes(w1, w2) + any w1 = Widget("w1") + any w2 = Widget("w2") + any p = Modes(w1, w2) print(w2).await #! RUN ERROR your lease to this object was cancelled } diff --git a/dada_tests/specifier/local-my.dada b/dada_tests/specifier/local-my.dada index f011f1f6..7ff7cb6d 100644 --- a/dada_tests/specifier/local-my.dada +++ b/dada_tests/specifier/local-my.dada @@ -1,7 +1,7 @@ class Pair(any a, any b) async fn main() { - my pair = Pair(22, 44) + any pair = Pair(22, 44) print(pair.lease).await #! OUTPUT Pair\(22, 44\) our pair1 = pair diff --git a/dada_tests/specifier/need-leased-got-my-lvalue.dada b/dada_tests/specifier/need-leased-got-my-lvalue.dada index 9c9492b6..c08ffa3e 100644 --- a/dada_tests/specifier/need-leased-got-my-lvalue.dada +++ b/dada_tests/specifier/need-leased-got-my-lvalue.dada @@ -1,7 +1,7 @@ class Point() async fn main() { - my p = Point() + any p = Point() leased q = p # Check that the leased value can be used until `p` is used again diff --git a/dada_tests/specifier/need-my-got-leased.dada b/dada_tests/specifier/need-my-got-leased.dada deleted file mode 100644 index e655e184..00000000 --- a/dada_tests/specifier/need-my-got-leased.dada +++ /dev/null @@ -1,5 +0,0 @@ -class Point() - -async fn main() { - my p = Point().lease #! RUN ERROR more permissions needed -} \ No newline at end of file diff --git a/dada_tests/specifier/need-my-got-leased/compiler-output.ref b/dada_tests/specifier/need-my-got-leased/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-my-got-leased/stdout.ref b/dada_tests/specifier/need-my-got-leased/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-my-got-my.dada b/dada_tests/specifier/need-my-got-my.dada deleted file mode 100644 index f7faa919..00000000 --- a/dada_tests/specifier/need-my-got-my.dada +++ /dev/null @@ -1,5 +0,0 @@ -class Point() - -async fn main() { - my p = Point() -} \ No newline at end of file diff --git a/dada_tests/specifier/need-my-got-my/compiler-output.ref b/dada_tests/specifier/need-my-got-my/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-my-got-my/stdout.ref b/dada_tests/specifier/need-my-got-my/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-my-got-our.dada b/dada_tests/specifier/need-my-got-our.dada deleted file mode 100644 index 596d277f..00000000 --- a/dada_tests/specifier/need-my-got-our.dada +++ /dev/null @@ -1,5 +0,0 @@ -class Point() - -async fn main() { - my p = Point().share #! RUN ERROR more permissions needed -} \ No newline at end of file diff --git a/dada_tests/specifier/need-my-got-our/compiler-output.ref b/dada_tests/specifier/need-my-got-our/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-my-got-our/stdout.ref b/dada_tests/specifier/need-my-got-our/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-my-got-shleased.dada b/dada_tests/specifier/need-my-got-shleased.dada deleted file mode 100644 index 7d803503..00000000 --- a/dada_tests/specifier/need-my-got-shleased.dada +++ /dev/null @@ -1,5 +0,0 @@ -class Point() - -async fn main() { - my p = Point().lease.share #! RUN ERROR more permissions needed -} \ No newline at end of file diff --git a/dada_tests/specifier/need-my-got-shleased/compiler-output.ref b/dada_tests/specifier/need-my-got-shleased/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-my-got-shleased/stdout.ref b/dada_tests/specifier/need-my-got-shleased/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/validate/op-eq/lhs_field.dada b/dada_tests/validate/op-eq/lhs_field.dada index 8e951777..acd6e144 100644 --- a/dada_tests/validate/op-eq/lhs_field.dada +++ b/dada_tests/validate/op-eq/lhs_field.dada @@ -1,7 +1,7 @@ class Point(our x, our y) async fn main() { - my p = Point(22, 44) + any p = Point(22, 44) p.x += 1 print(p).await #! OUTPUT Point\(23, 44\) } diff --git a/dada_tests/validate/op-eq/lhs_field_of_func_call.dada b/dada_tests/validate/op-eq/lhs_field_of_func_call.dada index 0d5ea925..e6428d7a 100644 --- a/dada_tests/validate/op-eq/lhs_field_of_func_call.dada +++ b/dada_tests/validate/op-eq/lhs_field_of_func_call.dada @@ -1,7 +1,7 @@ class Point(our x, our y) async fn main() { - my p = Point(22, 44) + any p = Point(22, 44) test(p).await.x += 1 print(p).await #! OUTPUT Point\(23, 44\) } diff --git a/dada_tests/validate/op-eq/lhs_func_call.dada b/dada_tests/validate/op-eq/lhs_func_call.dada index 31e60469..b2157600 100644 --- a/dada_tests/validate/op-eq/lhs_func_call.dada +++ b/dada_tests/validate/op-eq/lhs_func_call.dada @@ -1,7 +1,7 @@ class Point(our x, our y) async fn main() { - my p = Point(22, 44) + any p = Point(22, 44) test(p) += 1 #! ERROR you can only assign to local variables and fields, not arbitrary expressions #! RUN ERROR compilation error encountered diff --git a/dada_tests/validate/op-eq/lhs_local_variable.dada b/dada_tests/validate/op-eq/lhs_local_variable.dada index b0d5ca6f..2b78425e 100644 --- a/dada_tests/validate/op-eq/lhs_local_variable.dada +++ b/dada_tests/validate/op-eq/lhs_local_variable.dada @@ -3,6 +3,6 @@ class Point(our x, our y) async fn main() { our x = 22 x += 1 - my p = Point(x, 44) + any p = Point(x, 44) print(p).await #! OUTPUT Point\(23, 44\) } From bbf5c3b95d6e58ab01105dd0531c35c96dc87fe3 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 14 Jul 2022 16:11:29 +0300 Subject: [PATCH 04/36] remove the `our` specifier --- components/dada-execute/src/step.rs | 1 - components/dada-ir/src/storage.rs | 7 +- components/dada-parse/src/parser/parameter.rs | 4 +- .../dada-validate/src/validate/validator.rs | 5 - .../bad-parse-not-expression.dada | 4 +- .../compiler-output.ref | 6 +- .../complex-expr-in-format-string.dada | 4 +- .../field-access-in-format-string.dada | 4 +- dada_tests/format-strings/strip-margin.dada | 4 +- dada_tests/gc/stringify.dada | 6 +- dada_tests/gc/stringify/stdout.ref | 2 +- dada_tests/heap-graph/cursor-position.dada | 6 +- .../cursor-position/HeapGraph-0.bir.ref | 140 +++++++++------ .../cursor-position/HeapGraph-0.ref | 7 +- .../cursor-position/HeapGraph-1.bir.ref | 154 +++++++++------- .../cursor-position/HeapGraph-1.ref | 5 +- .../cursor-position/HeapGraph-2.bir.ref | 160 ++++++++++------- .../cursor-position/HeapGraph-2.ref | 14 +- .../cursor-position/HeapGraph-3.bir.ref | 168 ++++++++++-------- .../cursor-position/HeapGraph-3.ref | 16 +- dada_tests/heap-graph/dag/HeapGraph-0.ref | 2 +- .../heap-graph/leased-point/HeapGraph-0.ref | 6 +- .../heap-graph/line-start/HeapGraph-1.ref | 2 +- dada_tests/heap-graph/mid-increment.dada | 4 +- .../nested-functions/HeapGraph-0.ref | 17 +- .../heap-graph/nested-points/HeapGraph-1.ref | 2 +- .../heap-graph/nested-points/HeapGraph-2.ref | 19 +- .../heap-graph/tutorial-1/HeapGraph-2.ref | 2 +- .../heap-graph/tutorial-1/HeapGraph-3.ref | 2 +- .../heap-graph/tutorial-1/HeapGraph-4.ref | 4 +- .../module_main/ref_class_before_decl.dada | 2 +- .../module_main/with_fn_interspersed.dada | 4 +- .../dyn_tutorial/tutorial-give-10.dada | 4 +- .../tutorial-give-10/HeapGraph-0.ref | 8 +- .../tutorial-give-10/HeapGraph-1.ref | 8 +- .../dyn_tutorial/tutorial-lease-10.dada | 4 +- .../dyn_tutorial/tutorial-lease-20.dada | 6 +- .../dyn_tutorial/tutorial-lease-30.dada | 4 +- .../exhaustive/give-var-field-my.dada | 4 +- .../exhaustive/give-var-leased.dada | 4 +- .../permissions/exhaustive/give-var-my.dada | 4 +- .../exhaustive/lease-var-field-my.dada | 4 +- .../permissions/exhaustive/lease-var-my.dada | 4 +- .../exhaustive/share-var-field-my.dada | 4 +- .../exhaustive/share-var-leased.dada | 4 +- .../permissions/exhaustive/share-var-my.dada | 4 +- .../house-parties-are-not-enough.dada | 8 +- ...se-parties-are-not-fair-to-the-tenant.dada | 6 +- .../revokation/lease-vs-shlease-1.dada | 4 +- .../revokation/lease-vs-shlease-2.dada | 4 +- .../revokation/overwrite-lease-share.dada | 6 +- .../revokation/overwrite-leased.dada | 6 +- .../revokation/overwrite-our-leased.dada | 6 +- .../revokation/overwrite-our-shared.dada | 4 +- .../revokation/overwrite-owned.dada | 4 +- .../overwrite-shared-separate-root.dada | 6 +- .../revokation/overwrite-shared.dada | 4 +- .../revokation/write-field-of-leased.dada | 4 +- .../write-shared-traverse.dada | 2 +- .../our-to-our-leased-assign-field.dada | 8 +- .../our-to-our-leased-assign-field/stdout.ref | 2 +- .../our-to-our-leased-assign.dada | 6 +- .../our-to-our-leased-assign/stdout.ref | 2 +- .../reservations/our-to-our-leased-field.dada | 6 +- .../our-to-our-leased-field/stdout.ref | 2 +- .../reservations/our-to-our-leased-var.dada | 4 +- .../our-to-our-leased-var/stdout.ref | 2 +- .../specifier/field-leased-mode-leases.dada | 17 -- .../compiler-output.ref | 0 .../field-leased-mode-leases/stdout.ref | 2 - .../specifier/field-our-mode-moves.dada | 15 -- .../field-our-mode-moves/compiler-output.ref | 0 .../specifier/field-our-mode-moves/stdout.ref | 0 .../leased-from-rvalue-assign-in-loop.dada | 2 +- dada_tests/specifier/leased-from-rvalue.dada | 2 +- ...sed-from-shared-rvalue-assign-in-loop.dada | 2 +- dada_tests/specifier/local-my.dada | 6 +- dada_tests/specifier/need-any-got-leased.dada | 2 +- dada_tests/specifier/need-any-got-my.dada | 2 +- dada_tests/specifier/need-any-got-our.dada | 2 +- .../specifier/need-any-got-shleased.dada | 2 +- .../specifier/need-leased-got-my-lvalue.dada | 2 +- dada_tests/specifier/need-our-got-leased.dada | 5 - .../need-our-got-leased/compiler-output.ref | 0 .../specifier/need-our-got-leased/stdout.ref | 0 dada_tests/specifier/need-our-got-my.dada | 5 - .../need-our-got-my/compiler-output.ref | 0 .../specifier/need-our-got-my/stdout.ref | 0 dada_tests/specifier/need-our-got-our.dada | 5 - .../need-our-got-our/compiler-output.ref | 0 .../specifier/need-our-got-our/stdout.ref | 0 .../specifier/need-our-got-shleased.dada | 5 - .../need-our-got-shleased/compiler-output.ref | 0 .../need-our-got-shleased/stdout.ref | 0 .../our-lease-does-not-yield-leased.dada | 4 +- .../specifier/our-lease-yields-our.dada | 6 +- .../specifier/our-shlease-yields-our.dada | 6 +- ...sed-from-shared-rvalue-assign-in-loop.dada | 2 +- .../specifier/shleased-got-my-then-copy.dada | 4 +- .../shleased-got-my-then-copy/stdout.ref | 2 +- .../temporary-lifetime/call-argument.dada | 2 +- .../if-then-else-leased.dada | 4 +- dada_tests/validate/op-eq/lhs_field.dada | 4 +- .../op-eq/lhs_field_of_func_call.dada | 4 +- dada_tests/validate/op-eq/lhs_func_call.dada | 4 +- .../validate/op-eq/lhs_local_variable.dada | 6 +- .../validate/op-eq/lhs_shared_field.dada | 4 +- .../op-eq/lhs_shared_field_of_func_call.dada | 4 +- 108 files changed, 571 insertions(+), 506 deletions(-) delete mode 100644 dada_tests/specifier/field-leased-mode-leases.dada delete mode 100644 dada_tests/specifier/field-leased-mode-leases/compiler-output.ref delete mode 100644 dada_tests/specifier/field-leased-mode-leases/stdout.ref delete mode 100644 dada_tests/specifier/field-our-mode-moves.dada delete mode 100644 dada_tests/specifier/field-our-mode-moves/compiler-output.ref delete mode 100644 dada_tests/specifier/field-our-mode-moves/stdout.ref delete mode 100644 dada_tests/specifier/need-our-got-leased.dada delete mode 100644 dada_tests/specifier/need-our-got-leased/compiler-output.ref delete mode 100644 dada_tests/specifier/need-our-got-leased/stdout.ref delete mode 100644 dada_tests/specifier/need-our-got-my.dada delete mode 100644 dada_tests/specifier/need-our-got-my/compiler-output.ref delete mode 100644 dada_tests/specifier/need-our-got-my/stdout.ref delete mode 100644 dada_tests/specifier/need-our-got-our.dada delete mode 100644 dada_tests/specifier/need-our-got-our/compiler-output.ref delete mode 100644 dada_tests/specifier/need-our-got-our/stdout.ref delete mode 100644 dada_tests/specifier/need-our-got-shleased.dada delete mode 100644 dada_tests/specifier/need-our-got-shleased/compiler-output.ref delete mode 100644 dada_tests/specifier/need-our-got-shleased/stdout.ref diff --git a/components/dada-execute/src/step.rs b/components/dada-execute/src/step.rs index 8302ec85..0711dc4d 100644 --- a/components/dada-execute/src/step.rs +++ b/components/dada-execute/src/step.rs @@ -284,7 +284,6 @@ impl<'me> Stepper<'me> { tracing::debug!(?specifier); let value = match specifier { - Specifier::Our => self.share_place(table, source_place)?, Specifier::Leased => self.lease_place(table, source_place)?, Specifier::Shleased => self.shlease_place(table, source_place)?, Specifier::Any => self.give_place(table, source_place)?, diff --git a/components/dada-ir/src/storage.rs b/components/dada-ir/src/storage.rs index c6461ccb..f92b67a5 100644 --- a/components/dada-ir/src/storage.rs +++ b/components/dada-ir/src/storage.rs @@ -19,13 +19,12 @@ impl SpannedSpecifier { /// Creates a new `SpannedSpecifier` for a variable/field that didn't /// have an explicit specifier. pub fn new_defaulted(db: &dyn crate::Db, name_span: FileSpan) -> Self { - Self::new(db, Specifier::Shleased, true, name_span) + Self::new(db, Specifier::Any, true, name_span) } } #[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash, Debug)] pub enum Specifier { - Our, Leased, Shleased, Any, @@ -39,7 +38,7 @@ impl Specifier { pub fn must_be_unique(self) -> bool { match self { Specifier::Leased => true, - Specifier::Our | Specifier::Shleased => false, + Specifier::Shleased => false, Specifier::Any => false, } } @@ -50,7 +49,6 @@ impl Specifier { /// [`Specifier::Any`] returns false. pub fn must_be_owned(self) -> bool { match self { - Specifier::Our => true, Specifier::Shleased | Specifier::Leased => false, Specifier::Any => false, } @@ -60,7 +58,6 @@ impl Specifier { impl std::fmt::Display for Specifier { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Specifier::Our => write!(f, "our"), Specifier::Shleased => write!(f, "shleased"), Specifier::Leased => write!(f, "leased"), Specifier::Any => write!(f, "any"), diff --git a/components/dada-parse/src/parser/parameter.rs b/components/dada-parse/src/parser/parameter.rs index 4c346580..5c32fda5 100644 --- a/components/dada-parse/src/parser/parameter.rs +++ b/components/dada-parse/src/parser/parameter.rs @@ -87,9 +87,7 @@ impl<'db> Parser<'db> { span.in_file(filename), )) }; - if let Some((our_span, _)) = self.eat(Keyword::Our) { - some_specifier(Specifier::Our, our_span) - } else if let Some((shleased_span, _)) = self.eat(Keyword::Shleased) { + if let Some((shleased_span, _)) = self.eat(Keyword::Shleased) { some_specifier(Specifier::Shleased, shleased_span) } else if let Some((leased_span, _)) = self.eat(Keyword::Leased) { some_specifier(Specifier::Leased, leased_span) diff --git a/components/dada-validate/src/validate/validator.rs b/components/dada-validate/src/validate/validator.rs index 5e00e692..7e2b4ee1 100644 --- a/components/dada-validate/src/validate/validator.rs +++ b/components/dada-validate/src/validate/validator.rs @@ -827,11 +827,6 @@ impl<'me> Validator<'me> { let place_expr = self.add(validated::ExprData::Reserve(place), origin); self.seq(opt_assign_expr, place_expr) } - ExprMode::Specifier(Specifier::Our) => { - let given_expr = self.add(validated::ExprData::Give(place), origin); - let shared_expr = self.add(validated::ExprData::Share(given_expr), origin); - self.seq(opt_assign_expr, shared_expr) - } ExprMode::Specifier(Specifier::Shleased) => { let place_expr = self.add(validated::ExprData::Shlease(place), origin); self.seq(opt_assign_expr, place_expr) diff --git a/dada_tests/format-strings/bad-parse-not-expression.dada b/dada_tests/format-strings/bad-parse-not-expression.dada index 0ef36814..f9ee74c1 100644 --- a/dada_tests/format-strings/bad-parse-not-expression.dada +++ b/dada_tests/format-strings/bad-parse-not-expression.dada @@ -1,4 +1,4 @@ -p = "{class Point(our a, our b)}" -#! ^^^^^^^^^^^^^^^^^^^^^^^^^ ERROR expected expression here +p = "{class Point(a, b)}" +#! ^^^^^^^^^^^^^^^^^ ERROR expected expression here print(p).await #! RUN ERROR compilation error encountered \ No newline at end of file diff --git a/dada_tests/format-strings/bad-parse-not-expression/compiler-output.ref b/dada_tests/format-strings/bad-parse-not-expression/compiler-output.ref index 10dd0696..92c7213a 100644 --- a/dada_tests/format-strings/bad-parse-not-expression/compiler-output.ref +++ b/dada_tests/format-strings/bad-parse-not-expression/compiler-output.ref @@ -1,7 +1,7 @@ Error: expected expression here ╭─[dada_tests/format-strings/bad-parse-not-expression.dada:1:7] │ - 1 │ p = "{class Point(our a, our b)}" - · ────────────┬──────────── - · ╰────────────── here + 1 │ p = "{class Point(a, b)}" + · ────────┬──────── + · ╰────────── here ───╯ diff --git a/dada_tests/format-strings/complex-expr-in-format-string.dada b/dada_tests/format-strings/complex-expr-in-format-string.dada index 437b6177..3adfa2fc 100644 --- a/dada_tests/format-strings/complex-expr-in-format-string.dada +++ b/dada_tests/format-strings/complex-expr-in-format-string.dada @@ -1,6 +1,6 @@ -class Point(our x, our y) +class Point(x, y) -our p = Point(22, 44) +p = Point(22, 44).share print("{{ z = p.x + p.y z diff --git a/dada_tests/format-strings/field-access-in-format-string.dada b/dada_tests/format-strings/field-access-in-format-string.dada index 72cc3c09..2912e49d 100644 --- a/dada_tests/format-strings/field-access-in-format-string.dada +++ b/dada_tests/format-strings/field-access-in-format-string.dada @@ -1,5 +1,5 @@ -class Point(our x, our y) +class Point(any x, any y) -our p = Point(22, 44) +p = Point(22, 44).share print("({p.x}, {p.y})").await #! OUTPUT \(22, 44\) diff --git a/dada_tests/format-strings/strip-margin.dada b/dada_tests/format-strings/strip-margin.dada index 2614dff8..770ea0dc 100644 --- a/dada_tests/format-strings/strip-margin.dada +++ b/dada_tests/format-strings/strip-margin.dada @@ -1,6 +1,6 @@ async fn main() { - our x = "Hello, world" - our y = " + x = "Hello, world" + y = " Hello, world " print(x == y).await #! OUTPUT true diff --git a/dada_tests/gc/stringify.dada b/dada_tests/gc/stringify.dada index 3b582584..7fcf013f 100644 --- a/dada_tests/gc/stringify.dada +++ b/dada_tests/gc/stringify.dada @@ -1,9 +1,9 @@ -class Point(our x, our y) +class Point(x, y) async fn main() { - any p = Point(Point(22, 44), 66) + p = Point(Point(22, 44), 66) print(p).await - #! OUTPUT Point\(our Point\(22, 44\), 66\) + #! OUTPUT Point\(my Point\(22, 44\), 66\) print(22 + 44i).await #! OUTPUT 66_i print(22i + 44).await #! OUTPUT 66_i diff --git a/dada_tests/gc/stringify/stdout.ref b/dada_tests/gc/stringify/stdout.ref index dade2727..63677fe9 100644 --- a/dada_tests/gc/stringify/stdout.ref +++ b/dada_tests/gc/stringify/stdout.ref @@ -1,4 +1,4 @@ -my Point(our Point(22, 44), 66) +my Point(my Point(22, 44), 66) 66_i 66_i 66_u diff --git a/dada_tests/heap-graph/cursor-position.dada b/dada_tests/heap-graph/cursor-position.dada index 968b956d..de836fe0 100644 --- a/dada_tests/heap-graph/cursor-position.dada +++ b/dada_tests/heap-graph/cursor-position.dada @@ -1,9 +1,9 @@ -class Point(our x, our y) +class Point(x, y) async fn main() { - our p = Point(22, 44) + p = Point(22, 44).share #? ^ HeapGraph - our q = Point(p, 66) + q = Point(p, 66).share #? ^ HeapGraph #? ^ HeapGraph #? ^ HeapGraph diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref index aafacbdd..b8acff2a 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{6}, + temp{7}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{7}, + temp{8}, 22, ), Expr(1), ), ( AssignExpr( - temp{8}, + temp{9}, 44, ), Expr(2), ), ], Assign( - temp{1}, + temp{6}, Call( - temp{6}, + temp{7}, [ - temp{7}, temp{8}, + temp{9}, ], [ None, @@ -45,19 +45,19 @@ [ ( Clear( - temp{8}, + temp{9}, ), Expr(2), ), ( Clear( - temp{7}, + temp{8}, ), Expr(1), ), ( Clear( - temp{6}, + temp{7}, ), Expr(0), ), @@ -69,9 +69,9 @@ Expr(4), ), ( - AssignPlace( - p{0}, + AssignExpr( temp{1}, + temp{6}.share, ), Expr(4), ), @@ -80,52 +80,67 @@ "class", 0, Expr(4), - None, + Some( + temp{1}, + ), ), Expr(4), ), + ( + Clear( + temp{6}, + ), + Expr(3), + ), + ( + AssignPlace( + p{0}, + temp{1}, + ), + Expr(5), + ), ( AssignExpr( temp{5}, (), ), - Expr(4), + Expr(5), ), ( Clear( temp{5}, ), - Expr(4), + Expr(5), ), ( AssignExpr( - temp{10}, + temp{12}, Class(Id { value: 1 }).reserve, ), - Expr(5), + Expr(6), ), ( AssignExpr( - temp{11}, + temp{13}, p{0}.reserve, ), - Expr(6), + Expr(7), ), ( AssignExpr( - temp{12}, + temp{14}, 66, ), - Expr(7), + Expr(8), ), ], Assign( - temp{3}, + temp{11}, Call( - temp{10}, + temp{12}, [ - temp{11}, - temp{12}, + temp{13}, + temp{14}, ], [ None, @@ -139,76 +154,89 @@ [ ( Clear( - temp{12}, + temp{14}, + ), + Expr(8), + ), + ( + Clear( + temp{13}, ), Expr(7), ), ( Clear( - temp{11}, + temp{12}, ), Expr(6), ), + ( + AssignExpr( + temp{3}, + temp{11}.share, + ), + Expr(10), + ), ( Clear( - temp{10}, + temp{11}, ), - Expr(5), + Expr(9), ), ( AssignPlace( q{2}, temp{3}, ), - Expr(9), + Expr(11), ), ( AssignExpr( - temp{9}, + temp{10}, (), ), - Expr(9), + Expr(11), ), ( Clear( - temp{9}, + temp{10}, ), - Expr(9), + Expr(11), ), ( AssignExpr( - temp{15}, + temp{17}, Print.reserve, ), - Expr(10), + Expr(12), ), ( AssignExpr( - temp{17}, + temp{19}, "Hi", ), - Expr(11), + Expr(13), ), ( AssignExpr( - temp{16}, - Concatenate(temp{17}), + temp{18}, + Concatenate(temp{19}), ), - Expr(12), + Expr(14), ), ( Clear( - temp{17}, + temp{19}, ), - Expr(11), + Expr(13), ), ], Assign( - temp{14}, + temp{16}, Call( - temp{15}, + temp{17}, [ - temp{16}, + temp{18}, ], [ None, @@ -221,21 +249,21 @@ [ ( Clear( - temp{16}, + temp{18}, ), - Expr(12), + Expr(14), ), ( Clear( - temp{15}, + temp{17}, ), - Expr(10), + Expr(12), ), ], Assign( - temp{13}, + temp{15}, Await( - temp{14}, + temp{16}, ), BasicBlock(4), ), @@ -244,22 +272,22 @@ [ ( Clear( - temp{14}, + temp{16}, ), - Expr(13), + Expr(15), ), ( Clear( - temp{13}, + temp{15}, ), - Expr(14), + Expr(16), ), ( AssignExpr( temp{4}, (), ), - Expr(15), + Expr(17), ), ], Return( diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-0.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-0.ref index 773f97ee..8cd222a4 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-0.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-0.ref @@ -1,4 +1,4 @@ -# Breakpoint: Expr(4) at class:4:9:4:26 +# Breakpoint: Expr(4) at class:4:9:4:28 digraph { node[shape = "note"]; rankdir = "LR"; @@ -12,8 +12,9 @@ digraph { label=< - + +
main
p
p
q
(in-flight)
>; ]; @@ -27,7 +28,7 @@ digraph { y: "44" > ]; - "afterstack":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; + "stack":20 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; } subgraph cluster_before { label=<before> diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref index f8a24758..13f01e80 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{6}, + temp{7}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{7}, + temp{8}, 22, ), Expr(1), ), ( AssignExpr( - temp{8}, + temp{9}, 44, ), Expr(2), ), ], Assign( - temp{1}, + temp{6}, Call( - temp{6}, + temp{7}, [ - temp{7}, temp{8}, + temp{9}, ], [ None, @@ -45,89 +45,102 @@ [ ( Clear( - temp{8}, + temp{9}, ), Expr(2), ), ( Clear( - temp{7}, + temp{8}, ), Expr(1), ), ( Clear( - temp{6}, + temp{7}, ), Expr(0), ), + ( + AssignExpr( + temp{1}, + temp{6}.share, + ), + Expr(4), + ), + ( + Clear( + temp{6}, + ), + Expr(3), + ), ( AssignPlace( p{0}, temp{1}, ), - Expr(4), + Expr(5), ), ( AssignExpr( temp{5}, (), ), - Expr(4), + Expr(5), ), ( Clear( temp{5}, ), - Expr(4), + Expr(5), ), ( AssignExpr( - temp{10}, + temp{12}, Class(Id { value: 1 }).reserve, ), - Expr(5), + Expr(6), + ), + ( + AssignExpr( + temp{13}, + p{0}.reserve, + ), + Expr(7), ), ( BreakpoingStart( "class", 0, ), - Expr(6), + Expr(8), ), ( AssignExpr( - temp{11}, - p{0}.reserve, + temp{14}, + 66, ), - Expr(6), + Expr(8), ), ( BreakpointEnd( "class", 0, - Expr(6), + Expr(8), Some( - temp{11}, + temp{14}, ), ), - Expr(6), - ), - ( - AssignExpr( - temp{12}, - 66, - ), - Expr(7), + Expr(8), ), ], Assign( - temp{3}, + temp{11}, Call( - temp{10}, + temp{12}, [ - temp{11}, - temp{12}, + temp{13}, + temp{14}, ], [ None, @@ -141,76 +154,89 @@ [ ( Clear( - temp{12}, + temp{14}, + ), + Expr(8), + ), + ( + Clear( + temp{13}, ), Expr(7), ), ( Clear( - temp{11}, + temp{12}, ), Expr(6), ), + ( + AssignExpr( + temp{3}, + temp{11}.share, + ), + Expr(10), + ), ( Clear( - temp{10}, + temp{11}, ), - Expr(5), + Expr(9), ), ( AssignPlace( q{2}, temp{3}, ), - Expr(9), + Expr(11), ), ( AssignExpr( - temp{9}, + temp{10}, (), ), - Expr(9), + Expr(11), ), ( Clear( - temp{9}, + temp{10}, ), - Expr(9), + Expr(11), ), ( AssignExpr( - temp{15}, + temp{17}, Print.reserve, ), - Expr(10), + Expr(12), ), ( AssignExpr( - temp{17}, + temp{19}, "Hi", ), - Expr(11), + Expr(13), ), ( AssignExpr( - temp{16}, - Concatenate(temp{17}), + temp{18}, + Concatenate(temp{19}), ), - Expr(12), + Expr(14), ), ( Clear( - temp{17}, + temp{19}, ), - Expr(11), + Expr(13), ), ], Assign( - temp{14}, + temp{16}, Call( - temp{15}, + temp{17}, [ - temp{16}, + temp{18}, ], [ None, @@ -223,21 +249,21 @@ [ ( Clear( - temp{16}, + temp{18}, ), - Expr(12), + Expr(14), ), ( Clear( - temp{15}, + temp{17}, ), - Expr(10), + Expr(12), ), ], Assign( - temp{13}, + temp{15}, Await( - temp{14}, + temp{16}, ), BasicBlock(4), ), @@ -246,22 +272,22 @@ [ ( Clear( - temp{14}, + temp{16}, ), - Expr(13), + Expr(15), ), ( Clear( - temp{13}, + temp{15}, ), - Expr(14), + Expr(16), ), ( AssignExpr( temp{4}, (), ), - Expr(15), + Expr(17), ), ], Return( diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-1.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-1.ref index 204c1cf3..01b194cc 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-1.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-1.ref @@ -1,4 +1,4 @@ -# Breakpoint: Expr(6) at class:6:19:6:20 +# Breakpoint: Expr(8) at class:6:18:6:20 digraph { node[shape = "note"]; rankdir = "LR"; @@ -14,7 +14,7 @@ digraph { main p q - (in-flight) + (in-flight): "66" >; ]; @@ -29,7 +29,6 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; - "stack":18 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; } subgraph cluster_before { label=<before> diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref index f8a24758..96ff0f76 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{6}, + temp{7}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{7}, + temp{8}, 22, ), Expr(1), ), ( AssignExpr( - temp{8}, + temp{9}, 44, ), Expr(2), ), ], Assign( - temp{1}, + temp{6}, Call( - temp{6}, + temp{7}, [ - temp{7}, temp{8}, + temp{9}, ], [ None, @@ -45,47 +45,53 @@ [ ( Clear( - temp{8}, + temp{9}, ), Expr(2), ), ( Clear( - temp{7}, + temp{8}, ), Expr(1), ), ( Clear( - temp{6}, + temp{7}, ), Expr(0), ), + ( + AssignExpr( + temp{1}, + temp{6}.share, + ), + Expr(4), + ), + ( + Clear( + temp{6}, + ), + Expr(3), + ), ( AssignPlace( p{0}, temp{1}, ), - Expr(4), + Expr(5), ), ( AssignExpr( temp{5}, (), ), - Expr(4), + Expr(5), ), ( Clear( temp{5}, ), - Expr(4), - ), - ( - AssignExpr( - temp{10}, - Class(Id { value: 1 }).reserve, - ), Expr(5), ), ( @@ -93,41 +99,37 @@ "class", 0, ), - Expr(6), + Expr(9), ), ( AssignExpr( - temp{11}, - p{0}.reserve, + temp{12}, + Class(Id { value: 1 }).reserve, ), Expr(6), ), ( - BreakpointEnd( - "class", - 0, - Expr(6), - Some( - temp{11}, - ), + AssignExpr( + temp{13}, + p{0}.reserve, ), - Expr(6), + Expr(7), ), ( AssignExpr( - temp{12}, + temp{14}, 66, ), - Expr(7), + Expr(8), ), ], Assign( - temp{3}, + temp{11}, Call( - temp{10}, + temp{12}, [ - temp{11}, - temp{12}, + temp{13}, + temp{14}, ], [ None, @@ -139,78 +141,102 @@ ), BasicBlock(2): BasicBlockData( [ + ( + BreakpointEnd( + "class", + 0, + Expr(9), + Some( + temp{11}, + ), + ), + Expr(9), + ), ( Clear( - temp{12}, + temp{14}, + ), + Expr(8), + ), + ( + Clear( + temp{13}, ), Expr(7), ), ( Clear( - temp{11}, + temp{12}, ), Expr(6), ), + ( + AssignExpr( + temp{3}, + temp{11}.share, + ), + Expr(10), + ), ( Clear( - temp{10}, + temp{11}, ), - Expr(5), + Expr(9), ), ( AssignPlace( q{2}, temp{3}, ), - Expr(9), + Expr(11), ), ( AssignExpr( - temp{9}, + temp{10}, (), ), - Expr(9), + Expr(11), ), ( Clear( - temp{9}, + temp{10}, ), - Expr(9), + Expr(11), ), ( AssignExpr( - temp{15}, + temp{17}, Print.reserve, ), - Expr(10), + Expr(12), ), ( AssignExpr( - temp{17}, + temp{19}, "Hi", ), - Expr(11), + Expr(13), ), ( AssignExpr( - temp{16}, - Concatenate(temp{17}), + temp{18}, + Concatenate(temp{19}), ), - Expr(12), + Expr(14), ), ( Clear( - temp{17}, + temp{19}, ), - Expr(11), + Expr(13), ), ], Assign( - temp{14}, + temp{16}, Call( - temp{15}, + temp{17}, [ - temp{16}, + temp{18}, ], [ None, @@ -223,21 +249,21 @@ [ ( Clear( - temp{16}, + temp{18}, ), - Expr(12), + Expr(14), ), ( Clear( - temp{15}, + temp{17}, ), - Expr(10), + Expr(12), ), ], Assign( - temp{13}, + temp{15}, Await( - temp{14}, + temp{16}, ), BasicBlock(4), ), @@ -246,22 +272,22 @@ [ ( Clear( - temp{14}, + temp{16}, ), - Expr(13), + Expr(15), ), ( Clear( - temp{13}, + temp{15}, ), - Expr(14), + Expr(16), ), ( AssignExpr( temp{4}, (), ), - Expr(15), + Expr(17), ), ], Return( diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-2.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-2.ref index 204c1cf3..3d9d2f0c 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-2.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-2.ref @@ -1,4 +1,4 @@ -# Breakpoint: Expr(6) at class:6:19:6:20 +# Breakpoint: Expr(9) at class:6:9:6:21 digraph { node[shape = "note"]; rankdir = "LR"; @@ -14,11 +14,18 @@ digraph { main p q - (in-flight) + (in-flight) >; ]; } + afternode1 [ + label = < + + + +
Point
x
y: "66"
> + ]; afternode0 [ color = "slategray", fontcolor = "slategray", @@ -29,7 +36,8 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; - "stack":18 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; + "stack":20 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "afternode1":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; } subgraph cluster_before { label=<before> diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref index f8a24758..b3e8ccfb 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{6}, + temp{7}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{7}, + temp{8}, 22, ), Expr(1), ), ( AssignExpr( - temp{8}, + temp{9}, 44, ), Expr(2), ), ], Assign( - temp{1}, + temp{6}, Call( - temp{6}, + temp{7}, [ - temp{7}, temp{8}, + temp{9}, ], [ None, @@ -45,89 +45,84 @@ [ ( Clear( - temp{8}, + temp{9}, ), Expr(2), ), ( Clear( - temp{7}, + temp{8}, ), Expr(1), ), ( Clear( - temp{6}, + temp{7}, ), Expr(0), ), + ( + AssignExpr( + temp{1}, + temp{6}.share, + ), + Expr(4), + ), + ( + Clear( + temp{6}, + ), + Expr(3), + ), ( AssignPlace( p{0}, temp{1}, ), - Expr(4), + Expr(5), ), ( AssignExpr( temp{5}, (), ), - Expr(4), + Expr(5), ), ( Clear( temp{5}, ), - Expr(4), + Expr(5), ), ( AssignExpr( - temp{10}, + temp{12}, Class(Id { value: 1 }).reserve, ), - Expr(5), - ), - ( - BreakpoingStart( - "class", - 0, - ), Expr(6), ), ( AssignExpr( - temp{11}, + temp{13}, p{0}.reserve, ), - Expr(6), - ), - ( - BreakpointEnd( - "class", - 0, - Expr(6), - Some( - temp{11}, - ), - ), - Expr(6), + Expr(7), ), ( AssignExpr( - temp{12}, + temp{14}, 66, ), - Expr(7), + Expr(8), ), ], Assign( - temp{3}, + temp{11}, Call( - temp{10}, + temp{12}, [ - temp{11}, - temp{12}, + temp{13}, + temp{14}, ], [ None, @@ -141,76 +136,107 @@ [ ( Clear( - temp{12}, + temp{14}, + ), + Expr(8), + ), + ( + Clear( + temp{13}, ), Expr(7), ), ( Clear( - temp{11}, + temp{12}, ), Expr(6), ), + ( + BreakpoingStart( + "class", + 0, + ), + Expr(10), + ), + ( + AssignExpr( + temp{3}, + temp{11}.share, + ), + Expr(10), + ), + ( + BreakpointEnd( + "class", + 0, + Expr(10), + Some( + temp{3}, + ), + ), + Expr(10), + ), ( Clear( - temp{10}, + temp{11}, ), - Expr(5), + Expr(9), ), ( AssignPlace( q{2}, temp{3}, ), - Expr(9), + Expr(11), ), ( AssignExpr( - temp{9}, + temp{10}, (), ), - Expr(9), + Expr(11), ), ( Clear( - temp{9}, + temp{10}, ), - Expr(9), + Expr(11), ), ( AssignExpr( - temp{15}, + temp{17}, Print.reserve, ), - Expr(10), + Expr(12), ), ( AssignExpr( - temp{17}, + temp{19}, "Hi", ), - Expr(11), + Expr(13), ), ( AssignExpr( - temp{16}, - Concatenate(temp{17}), + temp{18}, + Concatenate(temp{19}), ), - Expr(12), + Expr(14), ), ( Clear( - temp{17}, + temp{19}, ), - Expr(11), + Expr(13), ), ], Assign( - temp{14}, + temp{16}, Call( - temp{15}, + temp{17}, [ - temp{16}, + temp{18}, ], [ None, @@ -223,21 +249,21 @@ [ ( Clear( - temp{16}, + temp{18}, ), - Expr(12), + Expr(14), ), ( Clear( - temp{15}, + temp{17}, ), - Expr(10), + Expr(12), ), ], Assign( - temp{13}, + temp{15}, Await( - temp{14}, + temp{16}, ), BasicBlock(4), ), @@ -246,22 +272,22 @@ [ ( Clear( - temp{14}, + temp{16}, ), - Expr(13), + Expr(15), ), ( Clear( - temp{13}, + temp{15}, ), - Expr(14), + Expr(16), ), ( AssignExpr( temp{4}, (), ), - Expr(15), + Expr(17), ), ], Return( diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-3.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-3.ref index 204c1cf3..ff0d6146 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-3.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-3.ref @@ -1,4 +1,4 @@ -# Breakpoint: Expr(6) at class:6:19:6:20 +# Breakpoint: Expr(10) at class:6:9:6:27 digraph { node[shape = "note"]; rankdir = "LR"; @@ -14,11 +14,20 @@ digraph { main p q - (in-flight) + (in-flight) >; ]; } + afternode1 [ + color = "slategray", + fontcolor = "slategray", + label = < + + + +
Point
x
y: "66"
> + ]; afternode0 [ color = "slategray", fontcolor = "slategray", @@ -29,7 +38,8 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; - "stack":18 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; + "stack":20 -> "afternode1" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; + "afternode1":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; } subgraph cluster_before { label=<before> diff --git a/dada_tests/heap-graph/dag/HeapGraph-0.ref b/dada_tests/heap-graph/dag/HeapGraph-0.ref index 39b33482..af12e268 100644 --- a/dada_tests/heap-graph/dag/HeapGraph-0.ref +++ b/dada_tests/heap-graph/dag/HeapGraph-0.ref @@ -34,7 +34,7 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; - "afterstack":2 -> "afternode1" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + "afterstack":2 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; "afternode1":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; "afternode1":1 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; } diff --git a/dada_tests/heap-graph/leased-point/HeapGraph-0.ref b/dada_tests/heap-graph/leased-point/HeapGraph-0.ref index fd3134b0..758a4c05 100644 --- a/dada_tests/heap-graph/leased-point/HeapGraph-0.ref +++ b/dada_tests/heap-graph/leased-point/HeapGraph-0.ref @@ -33,9 +33,9 @@ digraph { y: "44" > ]; - "afterstack":0 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; - "afterstack":2 -> "afternode1" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; - "afternode1":0 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + "afterstack":0 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; + "afterstack":2 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "afternode1":0 -> "afternode0" [label="leased", style="solid", penwidth=1.0, arrowtype="empty", color="red"]; } subgraph cluster_before { label=<before> diff --git a/dada_tests/heap-graph/line-start/HeapGraph-1.ref b/dada_tests/heap-graph/line-start/HeapGraph-1.ref index f878b67a..6c8c4f2f 100644 --- a/dada_tests/heap-graph/line-start/HeapGraph-1.ref +++ b/dada_tests/heap-graph/line-start/HeapGraph-1.ref @@ -27,7 +27,7 @@ digraph { y: "44" > ]; - "afterstack":0 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + "afterstack":0 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; } subgraph cluster_before { label=<before> diff --git a/dada_tests/heap-graph/mid-increment.dada b/dada_tests/heap-graph/mid-increment.dada index 1354135d..b88e3bbb 100644 --- a/dada_tests/heap-graph/mid-increment.dada +++ b/dada_tests/heap-graph/mid-increment.dada @@ -1,8 +1,8 @@ class Point(any x, any y) async fn main() { - any p = Point(22, 44) - any q = p.lease + p = Point(22, 44) + q = p.lease #? @ +1:10 HeapGraph q.x += 1 print(q).await diff --git a/dada_tests/heap-graph/nested-functions/HeapGraph-0.ref b/dada_tests/heap-graph/nested-functions/HeapGraph-0.ref index 9890d36f..cf9fbd2b 100644 --- a/dada_tests/heap-graph/nested-functions/HeapGraph-0.ref +++ b/dada_tests/heap-graph/nested-functions/HeapGraph-0.ref @@ -14,21 +14,21 @@ digraph { main name: "Fellow Dadaist" helper - p + p q (in-flight) >; ]; } - afternode1 [ + afternode0 [ label = < - +
Point
x
x
y: "66"
> ]; - afternode0 [ + afternode1 [ color = "slategray", fontcolor = "slategray", label = < @@ -37,9 +37,8 @@ digraph {
y: "44"
> ]; - "afterstack":17 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; - "stack":30 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; - "afternode1":0 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + "stack":30 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "afternode0":0 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; } subgraph cluster_before { label=<before> @@ -53,7 +52,7 @@ digraph { main name: "Fellow Dadaist" helper - p + p q >; @@ -68,7 +67,7 @@ digraph { y: "44" > ]; - "beforestack":17 -> "beforenode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + "beforestack":17 -> "beforenode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; } } Hello diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-1.ref b/dada_tests/heap-graph/nested-points/HeapGraph-1.ref index 17b4fef8..1361e3fa 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-1.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-1.ref @@ -27,7 +27,7 @@ digraph { y: "44" > ]; - "afterstack":0 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + "afterstack":0 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; } subgraph cluster_before { label=<before> diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-2.ref b/dada_tests/heap-graph/nested-points/HeapGraph-2.ref index 9a8bc510..cf7c9f81 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-2.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-2.ref @@ -12,13 +12,19 @@ digraph { label=< - + - +
main
p
p
q
(in-flight)
(in-flight)
>; ]; } + afternode1 [ + label = < + + +
(reservation)
reserved
> + ]; afternode0 [ color = "slategray", fontcolor = "slategray", @@ -28,8 +34,9 @@ digraph { y: "44" > ]; - "afterstack":0 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; - "stack":13 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + "afterstack":0 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "stack":13 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "afternode1":0 -> "afternode0" [label="reserved", style="solid", penwidth=1.0, arrowtype="odot", color="grey"]; } subgraph cluster_before { label=<before> @@ -41,7 +48,7 @@ digraph { label=< - +
main
p
p
q
>; @@ -56,6 +63,6 @@ digraph { y: "44" > ]; - "beforestack":0 -> "beforenode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + "beforestack":0 -> "beforenode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; } } diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-2.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-2.ref index c73503ba..4ddd15d0 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-2.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-2.ref @@ -26,7 +26,7 @@ digraph { y: "44" > ]; - "afterstack":0 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + "afterstack":0 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; } subgraph cluster_before { label=<before> diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-3.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-3.ref index c73503ba..4ddd15d0 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-3.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-3.ref @@ -26,7 +26,7 @@ digraph { y: "44" > ]; - "afterstack":0 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + "afterstack":0 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; } subgraph cluster_before { label=<before> diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-4.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-4.ref index 137ad00a..7617515c 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-4.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-4.ref @@ -27,7 +27,7 @@ digraph { y: "44" > ]; - "afterstack":0 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + "afterstack":0 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; } subgraph cluster_before { label=<before> @@ -53,7 +53,7 @@ digraph { y: "44" > ]; - "beforestack":0 -> "beforenode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + "beforestack":0 -> "beforenode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; } } The point is FIXME diff --git a/dada_tests/module_main/ref_class_before_decl.dada b/dada_tests/module_main/ref_class_before_decl.dada index e418a5f1..cb29874b 100644 --- a/dada_tests/module_main/ref_class_before_decl.dada +++ b/dada_tests/module_main/ref_class_before_decl.dada @@ -1,4 +1,4 @@ -any p = Pair(22, 44) +p = Pair(22, 44) print(p).await #! OUTPUT Pair\(22, 44\) class Pair(any a, any b) diff --git a/dada_tests/module_main/with_fn_interspersed.dada b/dada_tests/module_main/with_fn_interspersed.dada index 3fcc29c2..ddbe5476 100644 --- a/dada_tests/module_main/with_fn_interspersed.dada +++ b/dada_tests/module_main/with_fn_interspersed.dada @@ -2,13 +2,13 @@ async fn test() { print("test").await #! OUTPUT test } -any x = test() +x = test() async fn test2() { print("test2").await #! OUTPUT test2 } -any y = test2() +y = test2() x.await y.await diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada b/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada index 6b0359fe..ce9f3425 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada @@ -1,9 +1,9 @@ class Point(any x, any y) async fn main() { - any p = Point(x: 22, y: 44) + p = Point(x: 22, y: 44) #? ^ HeapGraph - any q = p + q = p #? ^ HeapGraph x = p.x diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.ref b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.ref index b111409f..73be0b13 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.ref @@ -1,4 +1,4 @@ -# Breakpoint: Expr(4) at class:4:9:4:32 +# Breakpoint: Expr(4) at class:4:5:4:28 digraph { node[shape = "note"]; rankdir = "LR"; @@ -52,9 +52,9 @@ digraph { Error: your lease to this object was cancelled ╭─[class:9:9] │ - 6 │     any q = p -  · ──┬── -  · ╰──── lease was cancelled here + 6 │     q = p +  · ──┬── +  · ╰──── lease was cancelled here 9 │     x = p.x  · ┬  · ╰── cancelled lease used here diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.ref b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.ref index 6fa944bd..b33130a7 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.ref @@ -1,4 +1,4 @@ -# Breakpoint: Expr(6) at class:6:9:6:14 +# Breakpoint: Expr(6) at class:6:5:6:10 digraph { node[shape = "note"]; rankdir = "LR"; @@ -62,9 +62,9 @@ digraph { Error: your lease to this object was cancelled ╭─[class:9:9] │ - 6 │     any q = p -  · ──┬── -  · ╰──── lease was cancelled here + 6 │     q = p +  · ──┬── +  · ╰──── lease was cancelled here 9 │     x = p.x  · ┬  · ╰── cancelled lease used here diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10.dada b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10.dada index da8deb2e..cd7dae9f 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10.dada +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10.dada @@ -1,8 +1,8 @@ class Point(any x, any y) async fn main() { - any p = Point(x: 22, y: 44) - any q = p.lease + p = Point(x: 22, y: 44) + q = p.lease q.x += 1 #? ^ HeapGraph #? ^ HeapGraph diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20.dada b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20.dada index 81857374..a3cd0711 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20.dada +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20.dada @@ -1,9 +1,9 @@ class Point(any x, any y) async fn main() { - any p = Point(x: 22, y: 44) - any q = p.lease - any r = q.lease + p = Point(x: 22, y: 44) + q = p.lease + r = q.lease r.x += 1 #? ^ HeapGraph # diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30.dada b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30.dada index dbbf3549..d146c651 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30.dada +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30.dada @@ -1,8 +1,8 @@ class Point(any x, any y) async fn main() { - any p = Point(x: 22, y: 44) - any q = p.lease + p = Point(x: 22, y: 44) + q = p.lease q.x += 1 x = p.x #? ^ HeapGraph diff --git a/dada_tests/permissions/exhaustive/give-var-field-my.dada b/dada_tests/permissions/exhaustive/give-var-field-my.dada index 7960f8fc..1641edf0 100644 --- a/dada_tests/permissions/exhaustive/give-var-field-my.dada +++ b/dada_tests/permissions/exhaustive/give-var-field-my.dada @@ -2,10 +2,10 @@ class Pair(any a, any b) async fn main() { # Here we have an owned point, but in a shared field - any p = Pair(Pair(22, 44), 66) + p = Pair(Pair(22, 44), 66) # Giving that makes a my result - any q = p.a.give + q = p.a.give print(p).await #! OUTPUT my Pair\(\(expired\), 66\) print(q).await #! OUTPUT my Pair\(22, 44\) diff --git a/dada_tests/permissions/exhaustive/give-var-leased.dada b/dada_tests/permissions/exhaustive/give-var-leased.dada index 4bbd8fd6..1f403afc 100644 --- a/dada_tests/permissions/exhaustive/give-var-leased.dada +++ b/dada_tests/permissions/exhaustive/give-var-leased.dada @@ -1,8 +1,8 @@ class Pair(any a, any b) async fn main() { - any p = Pair(22, 44).lease - any q = p.give # Giving a leased thing: subleases + p = Pair(22, 44).lease + q = p.give # Giving a leased thing: subleases # Accessing `q`: ok print(q).await #! OUTPUT leased Pair\(22, 44\) diff --git a/dada_tests/permissions/exhaustive/give-var-my.dada b/dada_tests/permissions/exhaustive/give-var-my.dada index 5b8d8bc9..8e3fef3b 100644 --- a/dada_tests/permissions/exhaustive/give-var-my.dada +++ b/dada_tests/permissions/exhaustive/give-var-my.dada @@ -1,8 +1,8 @@ class Pair(any a, any b) async fn main() { - any p = Pair(22, 44) - any q = p.give + p = Pair(22, 44) + q = p.give print(p).await #! RUN ERROR your lease to this object was cancelled } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/lease-var-field-my.dada b/dada_tests/permissions/exhaustive/lease-var-field-my.dada index 0b0db51f..648507d2 100644 --- a/dada_tests/permissions/exhaustive/lease-var-field-my.dada +++ b/dada_tests/permissions/exhaustive/lease-var-field-my.dada @@ -1,8 +1,8 @@ class Pair(any a, any b) async fn main() { - any p = Pair(Pair(22, 44), 66) - any q = p.a.lease + p = Pair(Pair(22, 44), 66) + q = p.a.lease print(q).await #! OUTPUT leased Pair\(22, 44\) print(p).await #! OUTPUT my Pair\(my Pair\(22, 44\), 66\) print(q).await #! RUN ERROR your lease to this object was cancelled diff --git a/dada_tests/permissions/exhaustive/lease-var-my.dada b/dada_tests/permissions/exhaustive/lease-var-my.dada index 80e82cea..847fd30c 100644 --- a/dada_tests/permissions/exhaustive/lease-var-my.dada +++ b/dada_tests/permissions/exhaustive/lease-var-my.dada @@ -1,8 +1,8 @@ class Pair(any a, any b) async fn main() { - any p = Pair(22, 44) - any q = p.lease + p = Pair(22, 44) + q = p.lease print(q).await #! OUTPUT leased Pair\(22, 44\) print(p).await #! OUTPUT my Pair\(22, 44\) print(q).await #! RUN ERROR your lease to this object was cancelled diff --git a/dada_tests/permissions/exhaustive/share-var-field-my.dada b/dada_tests/permissions/exhaustive/share-var-field-my.dada index 145f72d8..bd08894a 100644 --- a/dada_tests/permissions/exhaustive/share-var-field-my.dada +++ b/dada_tests/permissions/exhaustive/share-var-field-my.dada @@ -1,8 +1,8 @@ class Pair(any a, any b) async fn main() { - any p = Pair(Pair(22, 44), 66) - any q = p.a.share + p = Pair(Pair(22, 44), 66) + q = p.a.share print(p).await #! OUTPUT my Pair\(\(expired\), 66\) print(q).await #! OUTPUT our Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/share-var-leased.dada b/dada_tests/permissions/exhaustive/share-var-leased.dada index da399fee..18f3defb 100644 --- a/dada_tests/permissions/exhaustive/share-var-leased.dada +++ b/dada_tests/permissions/exhaustive/share-var-leased.dada @@ -1,10 +1,10 @@ class Pair(any a, any b) async fn main() { - any p = Pair(22, 44).lease + p = Pair(22, 44).lease # Sharing a leased thing: creates a shared sublease - any q = p.share + q = p.share # Accessing `q`: ok print(q).await #! OUTPUT shleased Pair\(22, 44\) diff --git a/dada_tests/permissions/exhaustive/share-var-my.dada b/dada_tests/permissions/exhaustive/share-var-my.dada index 492c7072..668dc2b9 100644 --- a/dada_tests/permissions/exhaustive/share-var-my.dada +++ b/dada_tests/permissions/exhaustive/share-var-my.dada @@ -1,8 +1,8 @@ class Pair(any a, any b) async fn main() { - any p = Pair(22, 44) - any q = p.share + p = Pair(22, 44) + q = p.share print(q).await #! OUTPUT our Pair\(22, 44\) print(p).await #! RUN ERROR your lease to this object was cancelled } \ No newline at end of file diff --git a/dada_tests/permissions/house-parties/house-parties-are-not-enough.dada b/dada_tests/permissions/house-parties/house-parties-are-not-enough.dada index a1e11842..7275b241 100644 --- a/dada_tests/permissions/house-parties/house-parties-are-not-enough.dada +++ b/dada_tests/permissions/house-parties/house-parties-are-not-enough.dada @@ -4,7 +4,7 @@ # isn't enough to truly capture the flexibility of # Rust's shared borrows. -class Accumulator(any list) +class Accumulator(list) class List() # This function takes a `shleased` accumulator and returns a @@ -22,9 +22,9 @@ async fn main() { # // works fine! # ``` - any a = Accumulator(list: List()) - l1 = get_list(a) - l2 = get_list(a) + a = Accumulator(list: List()) + l1 = get_list(a.shlease) + l2 = get_list(a.shlease) print(l2).await #! OUTPUT List\(\) print(l1).await #! OUTPUT shleased List print(l2).await #! OUTPUT shleased List diff --git a/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada b/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada index a8be5fb2..9455baee 100644 --- a/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada +++ b/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada @@ -11,7 +11,7 @@ # But I'm pretty sure it's there. class Accumulator(any atomic list) -class List(our field) +class List(field) fn foo(leased accumulator) -> # shleased List { @@ -20,7 +20,7 @@ fn foo(leased accumulator) -> # shleased List } async fn main() { - any a = Accumulator(list: List(22)) + a = Accumulator(list: List(22)) # get a shared lease to the list, # but it is still owned by `a` @@ -29,7 +29,7 @@ async fn main() { # share `a`, which currently revokes # the lease `a`, and hence `l` # becomes inaccessible - our s = a + s = a.share print(l).await #! RUN ERROR your lease to this object was cancelled diff --git a/dada_tests/permissions/revokation/lease-vs-shlease-1.dada b/dada_tests/permissions/revokation/lease-vs-shlease-1.dada index 4f0b1294..8eaa0920 100644 --- a/dada_tests/permissions/revokation/lease-vs-shlease-1.dada +++ b/dada_tests/permissions/revokation/lease-vs-shlease-1.dada @@ -1,7 +1,7 @@ -class Data(our field) +class Data(field) async fn main() { - any m = Data(22) + m = Data(22) leased l = m shleased s = l print(m.field).await #! OUTPUT 22 diff --git a/dada_tests/permissions/revokation/lease-vs-shlease-2.dada b/dada_tests/permissions/revokation/lease-vs-shlease-2.dada index c0c3f538..9c0ff022 100644 --- a/dada_tests/permissions/revokation/lease-vs-shlease-2.dada +++ b/dada_tests/permissions/revokation/lease-vs-shlease-2.dada @@ -1,7 +1,7 @@ -class Data(our field) +class Data(field) async fn main() { - any m = Data(22) + m = Data(22) shleased s = m print(m.field).await #! OUTPUT 22 print(s.field).await #! OUTPUT 22 diff --git a/dada_tests/permissions/revokation/overwrite-lease-share.dada b/dada_tests/permissions/revokation/overwrite-lease-share.dada index eb7a37c9..09784aef 100644 --- a/dada_tests/permissions/revokation/overwrite-lease-share.dada +++ b/dada_tests/permissions/revokation/overwrite-lease-share.dada @@ -1,10 +1,10 @@ class Pair(any a, any b) async fn main() { - any pair1 = Pair(22, 44) - any pair2 = Pair(pair1.lease.share, 66) + pair1 = Pair(22, 44) + pair2 = Pair(pair1.lease.share, 66) - any p = pair2.a.lease + p = pair2.a.lease pair2.a := Pair(23, 45) diff --git a/dada_tests/permissions/revokation/overwrite-leased.dada b/dada_tests/permissions/revokation/overwrite-leased.dada index b79137ac..137df2c6 100644 --- a/dada_tests/permissions/revokation/overwrite-leased.dada +++ b/dada_tests/permissions/revokation/overwrite-leased.dada @@ -1,10 +1,10 @@ class Pair(any a, any b) async fn main() { - any pair1 = Pair(22, 44) - any pair2 = Pair(pair1.lease, 66) + pair1 = Pair(22, 44) + pair2 = Pair(pair1.lease, 66) - any p = pair2.a.lease + p = pair2.a.lease # Writing to `pair.a` causes the lease from `pair2.a` # to be unreachable. However, the owned value that backs diff --git a/dada_tests/permissions/revokation/overwrite-our-leased.dada b/dada_tests/permissions/revokation/overwrite-our-leased.dada index c491dc01..cd97aa21 100644 --- a/dada_tests/permissions/revokation/overwrite-our-leased.dada +++ b/dada_tests/permissions/revokation/overwrite-our-leased.dada @@ -1,10 +1,10 @@ class Pair(any a, any b) async fn main() { - any pair1 = Pair(22, 44).share - any pair2 = Pair(pair1.lease, 66) + pair1 = Pair(22, 44).share + pair2 = Pair(pair1.lease, 66) - any p = pair2.a.lease + p = pair2.a.lease # Writing to `pair2.a` overwrites the shared # lease, but that doesn't cancel it. diff --git a/dada_tests/permissions/revokation/overwrite-our-shared.dada b/dada_tests/permissions/revokation/overwrite-our-shared.dada index bc059b70..474fa279 100644 --- a/dada_tests/permissions/revokation/overwrite-our-shared.dada +++ b/dada_tests/permissions/revokation/overwrite-our-shared.dada @@ -1,10 +1,10 @@ class Pair(any a, any b) async fn main() { - any pair = Pair(Pair(22, 44).share, 66) + pair = Pair(Pair(22, 44).share, 66) # `p` becomes an independent handle on the same shared pair - any p = pair.a.share + p = pair.a.share # `p` is not disturbed by this write pair.a := Pair(23, 45) diff --git a/dada_tests/permissions/revokation/overwrite-owned.dada b/dada_tests/permissions/revokation/overwrite-owned.dada index 23fbd4e2..0062cf72 100644 --- a/dada_tests/permissions/revokation/overwrite-owned.dada +++ b/dada_tests/permissions/revokation/overwrite-owned.dada @@ -1,9 +1,9 @@ class Pair(any a, any b) async fn main() { - any pair = Pair(Pair(22, 44), 66) + pair = Pair(Pair(22, 44), 66) - any p = pair.a.lease + p = pair.a.lease # This write causes the `Pair(22, 44)` # to have no owner. It gets collected by the GC... diff --git a/dada_tests/permissions/revokation/overwrite-shared-separate-root.dada b/dada_tests/permissions/revokation/overwrite-shared-separate-root.dada index 408e8fec..9256af81 100644 --- a/dada_tests/permissions/revokation/overwrite-shared-separate-root.dada +++ b/dada_tests/permissions/revokation/overwrite-shared-separate-root.dada @@ -1,13 +1,13 @@ class Pair(any a, any b) async fn main() { - any temp = Pair(22, 44).share - any pair = Pair(temp, 66) + temp = Pair(22, 44).share + pair = Pair(temp, 66) # ^^^^ # Temp is shared, so this clones # Leasing from `pair.a` creates a third owner. - any p = pair.a.lease + p = pair.a.lease # Overwriting `pair.a` removes one handle to # the shared pair, but `p` is unaffected. diff --git a/dada_tests/permissions/revokation/overwrite-shared.dada b/dada_tests/permissions/revokation/overwrite-shared.dada index 49eb1f15..2c7f134c 100644 --- a/dada_tests/permissions/revokation/overwrite-shared.dada +++ b/dada_tests/permissions/revokation/overwrite-shared.dada @@ -1,13 +1,13 @@ class Pair(any a, any b) async fn main() { - any pair = Pair(Pair(22, 44).share, 66) + pair = Pair(Pair(22, 44).share, 66) # ^^^^^^^^^^^^^^^^^^ # This created a jointly owned value but # puts `pair` is the sole owner of it. # Leasing from `pair.a` clones it, since `pair.a` is "our" - any p = pair.a.lease + p = pair.a.lease # Since `p` is owned, overwriting `pair.a` has no effect on it. pair.a := Pair(23, 45) diff --git a/dada_tests/permissions/revokation/write-field-of-leased.dada b/dada_tests/permissions/revokation/write-field-of-leased.dada index bca385bf..1fc6964d 100644 --- a/dada_tests/permissions/revokation/write-field-of-leased.dada +++ b/dada_tests/permissions/revokation/write-field-of-leased.dada @@ -1,10 +1,10 @@ class Pair(any a, any b) async fn main() { - any p = Pair(22, 44).lease + p = Pair(22, 44).lease # we now have a shared lease on `p` - any q = p.share + q = p.share # mutating field of `p` cancels our shared lease p.a := 23 diff --git a/dada_tests/permissions/shared-data-is-immutable/write-shared-traverse.dada b/dada_tests/permissions/shared-data-is-immutable/write-shared-traverse.dada index 9c7efbf5..f32e1e6f 100644 --- a/dada_tests/permissions/shared-data-is-immutable/write-shared-traverse.dada +++ b/dada_tests/permissions/shared-data-is-immutable/write-shared-traverse.dada @@ -1,7 +1,7 @@ class Pair(any a, any b) async fn main() { - any pair = Pair(Pair(22, 44), 66).share + pair = Pair(Pair(22, 44), 66).share # Here the *immediate* pair (`Pair(22, 44)`) was never shared, # but it is stored in a pair that *is* shared. diff --git a/dada_tests/reservations/our-to-our-leased-assign-field.dada b/dada_tests/reservations/our-to-our-leased-assign-field.dada index 4b4b2cc2..8ed448c8 100644 --- a/dada_tests/reservations/our-to-our-leased-assign-field.dada +++ b/dada_tests/reservations/our-to-our-leased-assign-field.dada @@ -1,14 +1,14 @@ -class Point(any a, any b) +class Point(a, b) class OurLeased(shleased f) async fn main() { - our p = Point(22, 44) # create a shared point `(22, 44)` - any q = OurLeased(p) # `q.f` becomes 2nd owner of `(22, 44)` + p = Point(22, 44).share # create a shared point `(22, 44)` + q = OurLeased(p) # `q.f` becomes 2nd owner of `(22, 44)` print(q.lease).await #! OUTPUT OurLeased\(our Point\(22, 44\)\) p := Point(44, 66) # `p` is shared owner of `(44, 66)` - q.f := p # `q.f` becomes 2nd owner of `(44, 66)` + q.f := p.share # `q.f` becomes 2nd owner of `(44, 66)` print(q.lease).await #! OUTPUT OurLeased\(our Point\(44, 66\)\) p := Point(11, 55) # overwriting `p` doesn't invalidate `q.f` diff --git a/dada_tests/reservations/our-to-our-leased-assign-field/stdout.ref b/dada_tests/reservations/our-to-our-leased-assign-field/stdout.ref index f5398274..689f4a6a 100644 --- a/dada_tests/reservations/our-to-our-leased-assign-field/stdout.ref +++ b/dada_tests/reservations/our-to-our-leased-assign-field/stdout.ref @@ -1,5 +1,5 @@ leased OurLeased(our Point(22, 44)) leased OurLeased(our Point(44, 66)) leased OurLeased(our Point(44, 66)) -our Point(11, 55) +leased Point(11, 55) leased OurLeased(our Point(44, 66)) diff --git a/dada_tests/reservations/our-to-our-leased-assign.dada b/dada_tests/reservations/our-to-our-leased-assign.dada index 6f2a887e..5b969336 100644 --- a/dada_tests/reservations/our-to-our-leased-assign.dada +++ b/dada_tests/reservations/our-to-our-leased-assign.dada @@ -1,7 +1,7 @@ -class Point(any a, any b) +class Point(a, b) async fn main() { - our p = Point(22, 44) + p = Point(22, 44).share # leasing an "our" thing becomes a second # owner (lessors are always exclusive) @@ -9,7 +9,7 @@ async fn main() { print(q).await #! OUTPUT Point\(22, 44\) # reassigning `p` does not invalidate `q`. - p := Point(44, 66) + p := Point(44, 66).share print(q).await #! OUTPUT Point\(22, 44\) # reassigning `q` creates a second owner for the `(44, 66)` point diff --git a/dada_tests/reservations/our-to-our-leased-assign/stdout.ref b/dada_tests/reservations/our-to-our-leased-assign/stdout.ref index c90cad39..9da886ac 100644 --- a/dada_tests/reservations/our-to-our-leased-assign/stdout.ref +++ b/dada_tests/reservations/our-to-our-leased-assign/stdout.ref @@ -1,4 +1,4 @@ our Point(22, 44) our Point(22, 44) -our Point(33, 55) +my Point(33, 55) our Point(44, 66) diff --git a/dada_tests/reservations/our-to-our-leased-field.dada b/dada_tests/reservations/our-to-our-leased-field.dada index f2373a7e..617f3707 100644 --- a/dada_tests/reservations/our-to-our-leased-field.dada +++ b/dada_tests/reservations/our-to-our-leased-field.dada @@ -1,11 +1,11 @@ -class Point(any a, any b) +class Point(a, b) class OurLeased(shleased f) async fn main() { - our p = Point(22, 44) # create `(22, 44)` with shared ownership + p = Point(22, 44).share # create `(22, 44)` with shared ownership print(p.lease).await #! OUTPUT Point\(22, 44\) - any q = OurLeased(p) # `OurLeased` takes 2nd ownership of `(22, 44)` + q = OurLeased(p) # `OurLeased` takes 2nd ownership of `(22, 44)` print(q.lease).await #! OUTPUT OurLeased\(our Point\(22, 44\)\) p := Point(44, 66) # reassigning `p` doesn't invalidate `q.f` diff --git a/dada_tests/reservations/our-to-our-leased-field/stdout.ref b/dada_tests/reservations/our-to-our-leased-field/stdout.ref index 6190d68a..5c21cb0a 100644 --- a/dada_tests/reservations/our-to-our-leased-field/stdout.ref +++ b/dada_tests/reservations/our-to-our-leased-field/stdout.ref @@ -1,5 +1,5 @@ our Point(22, 44) leased OurLeased(our Point(22, 44)) leased OurLeased(our Point(22, 44)) -our Point(44, 66) +leased Point(44, 66) leased OurLeased(our Point(22, 44)) diff --git a/dada_tests/reservations/our-to-our-leased-var.dada b/dada_tests/reservations/our-to-our-leased-var.dada index 32046f0e..97c8eb1a 100644 --- a/dada_tests/reservations/our-to-our-leased-var.dada +++ b/dada_tests/reservations/our-to-our-leased-var.dada @@ -1,7 +1,7 @@ -class Point(any a, any b) +class Point(a, b) async fn main() { - our p = Point(22, 44) + p = Point(22, 44).share shleased q = p # `q` becomes 2nd owner of `(22, 44)` p := Point(44, 66) # reassigning `p` has no effect on `q` diff --git a/dada_tests/reservations/our-to-our-leased-var/stdout.ref b/dada_tests/reservations/our-to-our-leased-var/stdout.ref index e82e7332..3fec5090 100644 --- a/dada_tests/reservations/our-to-our-leased-var/stdout.ref +++ b/dada_tests/reservations/our-to-our-leased-var/stdout.ref @@ -1,2 +1,2 @@ -our Point(44, 66) +my Point(44, 66) our Point(22, 44) diff --git a/dada_tests/specifier/field-leased-mode-leases.dada b/dada_tests/specifier/field-leased-mode-leases.dada deleted file mode 100644 index 5218287c..00000000 --- a/dada_tests/specifier/field-leased-mode-leases.dada +++ /dev/null @@ -1,17 +0,0 @@ -class Modes( - leased l - our o -) - -class Widget( - our name -) - -async fn main() { - any w1 = Widget("w1") - any w2 = Widget("w2") - any p = Modes(w1, w2) - print(p.l).await #! OUTPUT Widget\(w1\) - print(w1).await #! OUTPUT Widget\(w1\) - print(p.l).await #! RUN ERROR your lease to this object was cancelled -} diff --git a/dada_tests/specifier/field-leased-mode-leases/compiler-output.ref b/dada_tests/specifier/field-leased-mode-leases/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/field-leased-mode-leases/stdout.ref b/dada_tests/specifier/field-leased-mode-leases/stdout.ref deleted file mode 100644 index 58ba5a3b..00000000 --- a/dada_tests/specifier/field-leased-mode-leases/stdout.ref +++ /dev/null @@ -1,2 +0,0 @@ -leased Widget(w1) -my Widget(w1) diff --git a/dada_tests/specifier/field-our-mode-moves.dada b/dada_tests/specifier/field-our-mode-moves.dada deleted file mode 100644 index 069135d6..00000000 --- a/dada_tests/specifier/field-our-mode-moves.dada +++ /dev/null @@ -1,15 +0,0 @@ -class Modes( - leased l - our o -) - -class Widget( - our name -) - -async fn main() { - any w1 = Widget("w1") - any w2 = Widget("w2") - any p = Modes(w1, w2) - print(w2).await #! RUN ERROR your lease to this object was cancelled -} diff --git a/dada_tests/specifier/field-our-mode-moves/compiler-output.ref b/dada_tests/specifier/field-our-mode-moves/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/field-our-mode-moves/stdout.ref b/dada_tests/specifier/field-our-mode-moves/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/leased-from-rvalue-assign-in-loop.dada b/dada_tests/specifier/leased-from-rvalue-assign-in-loop.dada index af22aff5..cc869fe9 100644 --- a/dada_tests/specifier/leased-from-rvalue-assign-in-loop.dada +++ b/dada_tests/specifier/leased-from-rvalue-assign-in-loop.dada @@ -1,4 +1,4 @@ -class Point(our x, our y) +class Point(x, y) async fn main() { # Leases a temporary that lives as long as `p` diff --git a/dada_tests/specifier/leased-from-rvalue.dada b/dada_tests/specifier/leased-from-rvalue.dada index a597937b..76af929f 100644 --- a/dada_tests/specifier/leased-from-rvalue.dada +++ b/dada_tests/specifier/leased-from-rvalue.dada @@ -1,4 +1,4 @@ -class Point(our x, our y) +class Point(x, y) async fn main() { leased p = Point(22, 44) diff --git a/dada_tests/specifier/leased-from-shared-rvalue-assign-in-loop.dada b/dada_tests/specifier/leased-from-shared-rvalue-assign-in-loop.dada index 7d75f995..a8aedea3 100644 --- a/dada_tests/specifier/leased-from-shared-rvalue-assign-in-loop.dada +++ b/dada_tests/specifier/leased-from-shared-rvalue-assign-in-loop.dada @@ -1,4 +1,4 @@ -class Point(our x, our y) +class Point(x, y) async fn main() { # Leasing an `our` value just takes ownership diff --git a/dada_tests/specifier/local-my.dada b/dada_tests/specifier/local-my.dada index 7ff7cb6d..eb707450 100644 --- a/dada_tests/specifier/local-my.dada +++ b/dada_tests/specifier/local-my.dada @@ -1,11 +1,11 @@ class Pair(any a, any b) async fn main() { - any pair = Pair(22, 44) + pair = Pair(22, 44) print(pair.lease).await #! OUTPUT Pair\(22, 44\) - our pair1 = pair - our pair2 = pair1 + pair1 = pair.share + pair2 = pair1.share print(pair1).await #! OUTPUT Pair\(22, 44\) print(pair2).await #! OUTPUT Pair\(22, 44\) diff --git a/dada_tests/specifier/need-any-got-leased.dada b/dada_tests/specifier/need-any-got-leased.dada index b3621221..0b2efe67 100644 --- a/dada_tests/specifier/need-any-got-leased.dada +++ b/dada_tests/specifier/need-any-got-leased.dada @@ -1,5 +1,5 @@ class Point() async fn main() { - any p = Point().lease + p = Point().lease } \ No newline at end of file diff --git a/dada_tests/specifier/need-any-got-my.dada b/dada_tests/specifier/need-any-got-my.dada index bf888ccd..66867b10 100644 --- a/dada_tests/specifier/need-any-got-my.dada +++ b/dada_tests/specifier/need-any-got-my.dada @@ -1,5 +1,5 @@ class Point() async fn main() { - any p = Point() + p = Point() } \ No newline at end of file diff --git a/dada_tests/specifier/need-any-got-our.dada b/dada_tests/specifier/need-any-got-our.dada index 82ae94a5..ad93efa2 100644 --- a/dada_tests/specifier/need-any-got-our.dada +++ b/dada_tests/specifier/need-any-got-our.dada @@ -1,5 +1,5 @@ class Point() async fn main() { - any p = Point().share + p = Point().share } \ No newline at end of file diff --git a/dada_tests/specifier/need-any-got-shleased.dada b/dada_tests/specifier/need-any-got-shleased.dada index 5b4702d6..5f16d72f 100644 --- a/dada_tests/specifier/need-any-got-shleased.dada +++ b/dada_tests/specifier/need-any-got-shleased.dada @@ -1,5 +1,5 @@ class Point() async fn main() { - any p = Point().lease.share + p = Point().lease.share } \ No newline at end of file diff --git a/dada_tests/specifier/need-leased-got-my-lvalue.dada b/dada_tests/specifier/need-leased-got-my-lvalue.dada index c08ffa3e..a0b44d09 100644 --- a/dada_tests/specifier/need-leased-got-my-lvalue.dada +++ b/dada_tests/specifier/need-leased-got-my-lvalue.dada @@ -1,7 +1,7 @@ class Point() async fn main() { - any p = Point() + p = Point() leased q = p # Check that the leased value can be used until `p` is used again diff --git a/dada_tests/specifier/need-our-got-leased.dada b/dada_tests/specifier/need-our-got-leased.dada deleted file mode 100644 index f2ae08c6..00000000 --- a/dada_tests/specifier/need-our-got-leased.dada +++ /dev/null @@ -1,5 +0,0 @@ -class Point() - -async fn main() { - our p = Point().lease #! RUN ERROR more permissions needed -} \ No newline at end of file diff --git a/dada_tests/specifier/need-our-got-leased/compiler-output.ref b/dada_tests/specifier/need-our-got-leased/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-our-got-leased/stdout.ref b/dada_tests/specifier/need-our-got-leased/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-our-got-my.dada b/dada_tests/specifier/need-our-got-my.dada deleted file mode 100644 index 970d88be..00000000 --- a/dada_tests/specifier/need-our-got-my.dada +++ /dev/null @@ -1,5 +0,0 @@ -class Point() - -async fn main() { - our p = Point() -} \ No newline at end of file diff --git a/dada_tests/specifier/need-our-got-my/compiler-output.ref b/dada_tests/specifier/need-our-got-my/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-our-got-my/stdout.ref b/dada_tests/specifier/need-our-got-my/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-our-got-our.dada b/dada_tests/specifier/need-our-got-our.dada deleted file mode 100644 index c6c3c66c..00000000 --- a/dada_tests/specifier/need-our-got-our.dada +++ /dev/null @@ -1,5 +0,0 @@ -class Point() - -async fn main() { - our p = Point().share -} \ No newline at end of file diff --git a/dada_tests/specifier/need-our-got-our/compiler-output.ref b/dada_tests/specifier/need-our-got-our/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-our-got-our/stdout.ref b/dada_tests/specifier/need-our-got-our/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-our-got-shleased.dada b/dada_tests/specifier/need-our-got-shleased.dada deleted file mode 100644 index 8f6967d9..00000000 --- a/dada_tests/specifier/need-our-got-shleased.dada +++ /dev/null @@ -1,5 +0,0 @@ -class Point() - -async fn main() { - our p = Point().lease.share #! RUN ERROR more permissions needed -} \ No newline at end of file diff --git a/dada_tests/specifier/need-our-got-shleased/compiler-output.ref b/dada_tests/specifier/need-our-got-shleased/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-our-got-shleased/stdout.ref b/dada_tests/specifier/need-our-got-shleased/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/our-lease-does-not-yield-leased.dada b/dada_tests/specifier/our-lease-does-not-yield-leased.dada index 020164df..eb9c217d 100644 --- a/dada_tests/specifier/our-lease-does-not-yield-leased.dada +++ b/dada_tests/specifier/our-lease-does-not-yield-leased.dada @@ -1,7 +1,7 @@ -class Point(our x, our y) +class Point(x, y) async fn main() { - our p = Point(22, 33) + p = Point(22, 33).share # Leasing an `our` does not yield a `leased` value # (`leased` implies unique access). diff --git a/dada_tests/specifier/our-lease-yields-our.dada b/dada_tests/specifier/our-lease-yields-our.dada index 867fb86c..f4833468 100644 --- a/dada_tests/specifier/our-lease-yields-our.dada +++ b/dada_tests/specifier/our-lease-yields-our.dada @@ -1,10 +1,10 @@ -class Point(our x, our y) +class Point(x, y) async fn main() { - our p = Point(22, 33) + p = Point(22, 33).share # Under current semantics, leasing an `our` # yields another `our` value (not, e.g., shleased), # so this code works. - our x = p.x.lease + x = p.x.lease.share } diff --git a/dada_tests/specifier/our-shlease-yields-our.dada b/dada_tests/specifier/our-shlease-yields-our.dada index 0ce59afd..a56ea313 100644 --- a/dada_tests/specifier/our-shlease-yields-our.dada +++ b/dada_tests/specifier/our-shlease-yields-our.dada @@ -1,10 +1,10 @@ -class Point(our x, our y) +class Point(x, y) async fn main() { - our p = Point(22, 33) + p = Point(22, 33).share # Under current semantics, shleasing an `our` # yields another `our` value (not, e.g., shleased), # so this code works. - our x = p.x.shlease + x = p.x.shlease.share } diff --git a/dada_tests/specifier/shleased-from-shared-rvalue-assign-in-loop.dada b/dada_tests/specifier/shleased-from-shared-rvalue-assign-in-loop.dada index 7d75f995..a8aedea3 100644 --- a/dada_tests/specifier/shleased-from-shared-rvalue-assign-in-loop.dada +++ b/dada_tests/specifier/shleased-from-shared-rvalue-assign-in-loop.dada @@ -1,4 +1,4 @@ -class Point(our x, our y) +class Point(x, y) async fn main() { # Leasing an `our` value just takes ownership diff --git a/dada_tests/specifier/shleased-got-my-then-copy.dada b/dada_tests/specifier/shleased-got-my-then-copy.dada index b57af6ed..7a687b33 100644 --- a/dada_tests/specifier/shleased-got-my-then-copy.dada +++ b/dada_tests/specifier/shleased-got-my-then-copy.dada @@ -1,11 +1,11 @@ -class Point(our x, our y) +class Point(x, y) async fn main() { # `p` is shleased here from a temporary; scope of the temporary is the block p = Point(22, 33) # ...and then we copy it to `q` (also shleased) - q = p + q = p.shlease # ...and check if we can access `p` print(p).await #! OUTPUT Point\(22, 33\) diff --git a/dada_tests/specifier/shleased-got-my-then-copy/stdout.ref b/dada_tests/specifier/shleased-got-my-then-copy/stdout.ref index 463a12ff..1f7b23b5 100644 --- a/dada_tests/specifier/shleased-got-my-then-copy/stdout.ref +++ b/dada_tests/specifier/shleased-got-my-then-copy/stdout.ref @@ -1 +1 @@ -shleased Point(22, 33) +my Point(22, 33) diff --git a/dada_tests/specifier/temporary-lifetime/call-argument.dada b/dada_tests/specifier/temporary-lifetime/call-argument.dada index 58db3b3c..f3da6c19 100644 --- a/dada_tests/specifier/temporary-lifetime/call-argument.dada +++ b/dada_tests/specifier/temporary-lifetime/call-argument.dada @@ -1,7 +1,7 @@ class Object(any data) async fn main() { - any o = lease_me(Object(22)).data + o = lease_me(Object(22)).data #! RUN ERROR your lease to this object was cancelled # # What happens here: diff --git a/dada_tests/specifier/temporary-lifetime/if-then-else-leased.dada b/dada_tests/specifier/temporary-lifetime/if-then-else-leased.dada index 6a24dcd5..dd17cf6c 100644 --- a/dada_tests/specifier/temporary-lifetime/if-then-else-leased.dada +++ b/dada_tests/specifier/temporary-lifetime/if-then-else-leased.dada @@ -1,11 +1,11 @@ class Object(any data) async fn main() { - any o = if true { Object(true).lease } else { Object(false).lease } + o = if true { Object(true).lease } else { Object(false).lease } #! RUN ERROR your lease to this object was cancelled # # What happens here: - # * `Object(true).lease` is equivalent to `{ any o = Object(true); o.lease }` + # * `Object(true).lease` is equivalent to `{ o = Object(true); o.lease }` # * that variable `o` is dropped as we exit the `if-then-else` print(o).await diff --git a/dada_tests/validate/op-eq/lhs_field.dada b/dada_tests/validate/op-eq/lhs_field.dada index acd6e144..30d4cd5e 100644 --- a/dada_tests/validate/op-eq/lhs_field.dada +++ b/dada_tests/validate/op-eq/lhs_field.dada @@ -1,7 +1,7 @@ -class Point(our x, our y) +class Point(x, y) async fn main() { - any p = Point(22, 44) + p = Point(22, 44) p.x += 1 print(p).await #! OUTPUT Point\(23, 44\) } diff --git a/dada_tests/validate/op-eq/lhs_field_of_func_call.dada b/dada_tests/validate/op-eq/lhs_field_of_func_call.dada index e6428d7a..5b6989b8 100644 --- a/dada_tests/validate/op-eq/lhs_field_of_func_call.dada +++ b/dada_tests/validate/op-eq/lhs_field_of_func_call.dada @@ -1,7 +1,7 @@ -class Point(our x, our y) +class Point(x, y) async fn main() { - any p = Point(22, 44) + p = Point(22, 44) test(p).await.x += 1 print(p).await #! OUTPUT Point\(23, 44\) } diff --git a/dada_tests/validate/op-eq/lhs_func_call.dada b/dada_tests/validate/op-eq/lhs_func_call.dada index b2157600..b5c2c330 100644 --- a/dada_tests/validate/op-eq/lhs_func_call.dada +++ b/dada_tests/validate/op-eq/lhs_func_call.dada @@ -1,7 +1,7 @@ -class Point(our x, our y) +class Point(x, y) async fn main() { - any p = Point(22, 44) + p = Point(22, 44) test(p) += 1 #! ERROR you can only assign to local variables and fields, not arbitrary expressions #! RUN ERROR compilation error encountered diff --git a/dada_tests/validate/op-eq/lhs_local_variable.dada b/dada_tests/validate/op-eq/lhs_local_variable.dada index 2b78425e..550b69a1 100644 --- a/dada_tests/validate/op-eq/lhs_local_variable.dada +++ b/dada_tests/validate/op-eq/lhs_local_variable.dada @@ -1,8 +1,8 @@ -class Point(our x, our y) +class Point(x, y) async fn main() { - our x = 22 + x = 22 x += 1 - any p = Point(x, 44) + p = Point(x, 44) print(p).await #! OUTPUT Point\(23, 44\) } diff --git a/dada_tests/validate/op-eq/lhs_shared_field.dada b/dada_tests/validate/op-eq/lhs_shared_field.dada index 8f05e94f..30565b7b 100644 --- a/dada_tests/validate/op-eq/lhs_shared_field.dada +++ b/dada_tests/validate/op-eq/lhs_shared_field.dada @@ -1,7 +1,7 @@ -class Point(our x, our y) +class Point(x, y) async fn main() { - our p = Point(22, 44) + p = Point(22, 44).share p.x += 1 #! RUN ERROR cannot write to shared fields print(p).await } diff --git a/dada_tests/validate/op-eq/lhs_shared_field_of_func_call.dada b/dada_tests/validate/op-eq/lhs_shared_field_of_func_call.dada index 582c6d2b..7028f9b3 100644 --- a/dada_tests/validate/op-eq/lhs_shared_field_of_func_call.dada +++ b/dada_tests/validate/op-eq/lhs_shared_field_of_func_call.dada @@ -1,7 +1,7 @@ -class Point(our x, our y) +class Point(x, y) async fn main() { - our p = Point(22, 44) + p = Point(22, 44).share # Test that we execute `test(p)` (and hence see its output) # before we detect the error here test(p).await.x += 1 #! RUN ERROR cannot write to shared fields From b21d0f1393a6cea75738064428ba9da71a73c912 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 14 Jul 2022 20:36:28 +0300 Subject: [PATCH 05/36] remove leased specifier --- components/dada-execute/src/step.rs | 1 - components/dada-ir/src/storage.rs | 5 +-- components/dada-parse/src/parser/parameter.rs | 2 -- .../dada-validate/src/validate/validator.rs | 32 ++++++------------- ...se-parties-are-not-fair-to-the-tenant.dada | 4 +-- .../revokation/lease-vs-shlease-1.dada | 2 +- .../leased-from-rvalue-assign-in-loop.dada | 2 +- .../stdout.ref | 2 +- dada_tests/specifier/leased-from-rvalue.dada | 4 +-- .../specifier/need-leased-got-leased.dada | 5 --- .../compiler-output.ref | 0 .../need-leased-got-leased/stdout.ref | 0 .../specifier/need-leased-got-my-lvalue.dada | 11 ------- .../compiler-output.ref | 0 .../need-leased-got-my-lvalue/stdout.ref | 2 -- dada_tests/specifier/need-leased-got-my.dada | 5 --- .../need-leased-got-my/compiler-output.ref | 0 .../specifier/need-leased-got-my/stdout.ref | 0 dada_tests/specifier/need-leased-got-our.dada | 5 --- .../need-leased-got-our/compiler-output.ref | 0 .../specifier/need-leased-got-our/stdout.ref | 0 .../specifier/need-leased-got-shleased.dada | 5 --- .../compiler-output.ref | 0 .../need-leased-got-shleased/stdout.ref | 0 .../our-lease-does-not-yield-leased.dada | 9 ------ .../compiler-output.ref | 0 .../stdout.ref | 0 .../temporary-lifetime/call-argument.dada | 16 ++++------ .../call-argument/stdout.ref | 1 + .../if-then-else-owned.dada | 2 +- .../op-eq/lhs_field_of_func_call.dada | 4 +-- dada_tests/validate/op-eq/lhs_func_call.dada | 4 +-- .../op-eq/lhs_func_call/compiler-output.ref | 6 ++-- 33 files changed, 32 insertions(+), 97 deletions(-) delete mode 100644 dada_tests/specifier/need-leased-got-leased.dada delete mode 100644 dada_tests/specifier/need-leased-got-leased/compiler-output.ref delete mode 100644 dada_tests/specifier/need-leased-got-leased/stdout.ref delete mode 100644 dada_tests/specifier/need-leased-got-my-lvalue.dada delete mode 100644 dada_tests/specifier/need-leased-got-my-lvalue/compiler-output.ref delete mode 100644 dada_tests/specifier/need-leased-got-my-lvalue/stdout.ref delete mode 100644 dada_tests/specifier/need-leased-got-my.dada delete mode 100644 dada_tests/specifier/need-leased-got-my/compiler-output.ref delete mode 100644 dada_tests/specifier/need-leased-got-my/stdout.ref delete mode 100644 dada_tests/specifier/need-leased-got-our.dada delete mode 100644 dada_tests/specifier/need-leased-got-our/compiler-output.ref delete mode 100644 dada_tests/specifier/need-leased-got-our/stdout.ref delete mode 100644 dada_tests/specifier/need-leased-got-shleased.dada delete mode 100644 dada_tests/specifier/need-leased-got-shleased/compiler-output.ref delete mode 100644 dada_tests/specifier/need-leased-got-shleased/stdout.ref delete mode 100644 dada_tests/specifier/our-lease-does-not-yield-leased.dada delete mode 100644 dada_tests/specifier/our-lease-does-not-yield-leased/compiler-output.ref delete mode 100644 dada_tests/specifier/our-lease-does-not-yield-leased/stdout.ref diff --git a/components/dada-execute/src/step.rs b/components/dada-execute/src/step.rs index 0711dc4d..d52175f3 100644 --- a/components/dada-execute/src/step.rs +++ b/components/dada-execute/src/step.rs @@ -284,7 +284,6 @@ impl<'me> Stepper<'me> { tracing::debug!(?specifier); let value = match specifier { - Specifier::Leased => self.lease_place(table, source_place)?, Specifier::Shleased => self.shlease_place(table, source_place)?, Specifier::Any => self.give_place(table, source_place)?, }; diff --git a/components/dada-ir/src/storage.rs b/components/dada-ir/src/storage.rs index f92b67a5..96520b7e 100644 --- a/components/dada-ir/src/storage.rs +++ b/components/dada-ir/src/storage.rs @@ -25,7 +25,6 @@ impl SpannedSpecifier { #[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash, Debug)] pub enum Specifier { - Leased, Shleased, Any, } @@ -37,7 +36,6 @@ impl Specifier { /// [`Specifier::Any`] returns false. pub fn must_be_unique(self) -> bool { match self { - Specifier::Leased => true, Specifier::Shleased => false, Specifier::Any => false, } @@ -49,7 +47,7 @@ impl Specifier { /// [`Specifier::Any`] returns false. pub fn must_be_owned(self) -> bool { match self { - Specifier::Shleased | Specifier::Leased => false, + Specifier::Shleased => false, Specifier::Any => false, } } @@ -59,7 +57,6 @@ impl std::fmt::Display for Specifier { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Specifier::Shleased => write!(f, "shleased"), - Specifier::Leased => write!(f, "leased"), Specifier::Any => write!(f, "any"), } } diff --git a/components/dada-parse/src/parser/parameter.rs b/components/dada-parse/src/parser/parameter.rs index 5c32fda5..c49efc4f 100644 --- a/components/dada-parse/src/parser/parameter.rs +++ b/components/dada-parse/src/parser/parameter.rs @@ -89,8 +89,6 @@ impl<'db> Parser<'db> { }; if let Some((shleased_span, _)) = self.eat(Keyword::Shleased) { some_specifier(Specifier::Shleased, shleased_span) - } else if let Some((leased_span, _)) = self.eat(Keyword::Leased) { - some_specifier(Specifier::Leased, leased_span) } else if let Some((any_span, _)) = self.eat(Keyword::Any) { some_specifier(Specifier::Any, any_span) } else { diff --git a/components/dada-validate/src/validate/validator.rs b/components/dada-validate/src/validate/validator.rs index 7e2b4ee1..ee94e8a4 100644 --- a/components/dada-validate/src/validate/validator.rs +++ b/components/dada-validate/src/validate/validator.rs @@ -14,7 +14,6 @@ use dada_ir::return_type::ReturnTypeKind; use dada_ir::span::FileSpan; use dada_ir::span::Span; use dada_ir::storage::Atomic; -use dada_ir::storage::Specifier; use dada_ir::word::Word; use dada_lex::prelude::*; use dada_parse::prelude::*; @@ -42,20 +41,11 @@ pub(crate) struct Validator<'me> { #[derive(Copy, Clone, Debug)] pub enum ExprMode { - Specifier(Specifier), + Given, + Leased, Reserve, } -impl ExprMode { - fn give() -> Self { - Self::Specifier(Specifier::Any) - } - - fn leased() -> Self { - Self::Specifier(Specifier::Leased) - } -} - impl<'me> Validator<'me> { pub(crate) fn root( db: &'me dyn crate::Db, @@ -194,7 +184,7 @@ impl<'me> Validator<'me> { #[tracing::instrument(level = "debug", skip(self, expr))] fn give_validated_expr(&mut self, expr: syntax::Expr) -> validated::Expr { - self.validate_expr_in_mode(expr, ExprMode::give()) + self.validate_expr_in_mode(expr, ExprMode::Given) } #[tracing::instrument(level = "debug", skip(self, expr))] @@ -443,7 +433,7 @@ impl<'me> Validator<'me> { let validated_body_expr = self .subscope() .with_loop_expr(loop_expr) - .validate_expr_and_exit(*body_expr, ExprMode::give()); + .validate_expr_and_exit(*body_expr, ExprMode::Given); self.tables[loop_expr] = validated::ExprData::Loop(validated_body_expr); @@ -605,7 +595,7 @@ impl<'me> Validator<'me> { // `temp_leased_owner = owner.lease` (if this is a field) let (lease_owner_expr, validated_target_place) = - self.validate_expr_as_target_place(lhs_expr, ExprMode::leased())?; + self.validate_expr_as_target_place(lhs_expr, ExprMode::Leased)?; // `temp_value = x + ` or `temp_value = temp_leased_owner.x + ` let (temporary_assign_expr, temporary_place) = { @@ -699,7 +689,7 @@ impl<'me> Validator<'me> { // we simply move/copy out from `temp` immediately and it has no // ill-effect. let (temp_initializer_expr, temp_place) = - self.validate_expr_in_temporary(initializer_expr, ExprMode::give()); + self.validate_expr_in_temporary(initializer_expr, ExprMode::Given); let assignment_expr = self.add( validated::ExprData::AssignFromPlace(target_place, temp_place), origin, @@ -815,11 +805,11 @@ impl<'me> Validator<'me> { ) -> validated::Expr { match data { Ok((opt_assign_expr, place)) => match mode { - ExprMode::Specifier(Specifier::Any) => { + ExprMode::Given => { let place_expr = self.add(validated::ExprData::Give(place), origin); self.seq(opt_assign_expr, place_expr) } - ExprMode::Specifier(Specifier::Leased) => { + ExprMode::Leased => { let place_expr = self.add(validated::ExprData::Lease(place), origin); self.seq(opt_assign_expr, place_expr) } @@ -827,10 +817,6 @@ impl<'me> Validator<'me> { let place_expr = self.add(validated::ExprData::Reserve(place), origin); self.seq(opt_assign_expr, place_expr) } - ExprMode::Specifier(Specifier::Shleased) => { - let place_expr = self.add(validated::ExprData::Shlease(place), origin); - self.seq(opt_assign_expr, place_expr) - } }, Err(ErrorReported) => self.add(validated::ExprData::Error, origin), } @@ -905,7 +891,7 @@ impl<'me> Validator<'me> { syntax::ExprData::Error => Err(ErrorReported), _ => { let (assign_expr, temporary_place) = - self.validate_expr_in_temporary(expr, ExprMode::give()); + self.validate_expr_in_temporary(expr, ExprMode::Given); Ok((Some(assign_expr), temporary_place)) } } diff --git a/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada b/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada index 9455baee..799a5067 100644 --- a/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada +++ b/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada @@ -13,7 +13,7 @@ class Accumulator(any atomic list) class List(field) -fn foo(leased accumulator) -> # shleased List +fn foo(accumulator) -> # shleased List { #! FIXME: Reading an atomic field without atomic section should not be allowed accumulator.list.lease.share @@ -24,7 +24,7 @@ async fn main() { # get a shared lease to the list, # but it is still owned by `a` - l = foo(a) + l = foo(a.lease) # share `a`, which currently revokes # the lease `a`, and hence `l` diff --git a/dada_tests/permissions/revokation/lease-vs-shlease-1.dada b/dada_tests/permissions/revokation/lease-vs-shlease-1.dada index 8eaa0920..48cf1fb3 100644 --- a/dada_tests/permissions/revokation/lease-vs-shlease-1.dada +++ b/dada_tests/permissions/revokation/lease-vs-shlease-1.dada @@ -2,7 +2,7 @@ class Data(field) async fn main() { m = Data(22) - leased l = m + l = m.lease shleased s = l print(m.field).await #! OUTPUT 22 print(s.field).await #! RUN ERROR your lease to this object was cancelled diff --git a/dada_tests/specifier/leased-from-rvalue-assign-in-loop.dada b/dada_tests/specifier/leased-from-rvalue-assign-in-loop.dada index cc869fe9..89189c5c 100644 --- a/dada_tests/specifier/leased-from-rvalue-assign-in-loop.dada +++ b/dada_tests/specifier/leased-from-rvalue-assign-in-loop.dada @@ -2,7 +2,7 @@ class Point(x, y) async fn main() { # Leases a temporary that lives as long as `p` - leased p = Point(22, 44) + p = Point(22, 44).lease i = 0 while i < 1 { diff --git a/dada_tests/specifier/leased-from-rvalue-assign-in-loop/stdout.ref b/dada_tests/specifier/leased-from-rvalue-assign-in-loop/stdout.ref index 8b7043a7..f9189698 100644 --- a/dada_tests/specifier/leased-from-rvalue-assign-in-loop/stdout.ref +++ b/dada_tests/specifier/leased-from-rvalue-assign-in-loop/stdout.ref @@ -1,2 +1,2 @@ leased Point(22, 44) -leased Point(44, 66) +my Point(44, 66) diff --git a/dada_tests/specifier/leased-from-rvalue.dada b/dada_tests/specifier/leased-from-rvalue.dada index 76af929f..b6fb6361 100644 --- a/dada_tests/specifier/leased-from-rvalue.dada +++ b/dada_tests/specifier/leased-from-rvalue.dada @@ -1,8 +1,8 @@ class Point(x, y) async fn main() { - leased p = Point(22, 44) - leased q = p + p = Point(22, 44).lease + q = p.lease print(q).await #! OUTPUT Point\(22, 44\) print(p).await #! OUTPUT Point\(22, 44\) p := Point(44, 66) diff --git a/dada_tests/specifier/need-leased-got-leased.dada b/dada_tests/specifier/need-leased-got-leased.dada deleted file mode 100644 index e373cb65..00000000 --- a/dada_tests/specifier/need-leased-got-leased.dada +++ /dev/null @@ -1,5 +0,0 @@ -class Point() - -async fn main() { - leased p = Point().lease -} \ No newline at end of file diff --git a/dada_tests/specifier/need-leased-got-leased/compiler-output.ref b/dada_tests/specifier/need-leased-got-leased/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-leased-got-leased/stdout.ref b/dada_tests/specifier/need-leased-got-leased/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-leased-got-my-lvalue.dada b/dada_tests/specifier/need-leased-got-my-lvalue.dada deleted file mode 100644 index a0b44d09..00000000 --- a/dada_tests/specifier/need-leased-got-my-lvalue.dada +++ /dev/null @@ -1,11 +0,0 @@ -class Point() - -async fn main() { - p = Point() - leased q = p - - # Check that the leased value can be used until `p` is used again - print(q).await #! OUTPUT Point\(\) - print(p).await #! OUTPUT Point\(\) - print(q).await #! RUN ERROR your lease to this object was cancelled -} \ No newline at end of file diff --git a/dada_tests/specifier/need-leased-got-my-lvalue/compiler-output.ref b/dada_tests/specifier/need-leased-got-my-lvalue/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-leased-got-my-lvalue/stdout.ref b/dada_tests/specifier/need-leased-got-my-lvalue/stdout.ref deleted file mode 100644 index f912844d..00000000 --- a/dada_tests/specifier/need-leased-got-my-lvalue/stdout.ref +++ /dev/null @@ -1,2 +0,0 @@ -leased Point() -my Point() diff --git a/dada_tests/specifier/need-leased-got-my.dada b/dada_tests/specifier/need-leased-got-my.dada deleted file mode 100644 index 18846312..00000000 --- a/dada_tests/specifier/need-leased-got-my.dada +++ /dev/null @@ -1,5 +0,0 @@ -class Point() - -async fn main() { - leased p = Point() -} \ No newline at end of file diff --git a/dada_tests/specifier/need-leased-got-my/compiler-output.ref b/dada_tests/specifier/need-leased-got-my/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-leased-got-my/stdout.ref b/dada_tests/specifier/need-leased-got-my/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-leased-got-our.dada b/dada_tests/specifier/need-leased-got-our.dada deleted file mode 100644 index ed46c80c..00000000 --- a/dada_tests/specifier/need-leased-got-our.dada +++ /dev/null @@ -1,5 +0,0 @@ -class Point() - -async fn main() { - leased p = Point().share #! RUN ERROR more permissions needed -} \ No newline at end of file diff --git a/dada_tests/specifier/need-leased-got-our/compiler-output.ref b/dada_tests/specifier/need-leased-got-our/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-leased-got-our/stdout.ref b/dada_tests/specifier/need-leased-got-our/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-leased-got-shleased.dada b/dada_tests/specifier/need-leased-got-shleased.dada deleted file mode 100644 index 82f0591d..00000000 --- a/dada_tests/specifier/need-leased-got-shleased.dada +++ /dev/null @@ -1,5 +0,0 @@ -class Point() - -async fn main() { - leased p = Point().lease.share #! RUN ERROR more permissions needed -} \ No newline at end of file diff --git a/dada_tests/specifier/need-leased-got-shleased/compiler-output.ref b/dada_tests/specifier/need-leased-got-shleased/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-leased-got-shleased/stdout.ref b/dada_tests/specifier/need-leased-got-shleased/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/our-lease-does-not-yield-leased.dada b/dada_tests/specifier/our-lease-does-not-yield-leased.dada deleted file mode 100644 index eb9c217d..00000000 --- a/dada_tests/specifier/our-lease-does-not-yield-leased.dada +++ /dev/null @@ -1,9 +0,0 @@ -class Point(x, y) - -async fn main() { - p = Point(22, 33).share - - # Leasing an `our` does not yield a `leased` value - # (`leased` implies unique access). - leased x = p.x.lease #! RUN ERROR more permissions needed -} diff --git a/dada_tests/specifier/our-lease-does-not-yield-leased/compiler-output.ref b/dada_tests/specifier/our-lease-does-not-yield-leased/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/our-lease-does-not-yield-leased/stdout.ref b/dada_tests/specifier/our-lease-does-not-yield-leased/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/temporary-lifetime/call-argument.dada b/dada_tests/specifier/temporary-lifetime/call-argument.dada index f3da6c19..db7b39c6 100644 --- a/dada_tests/specifier/temporary-lifetime/call-argument.dada +++ b/dada_tests/specifier/temporary-lifetime/call-argument.dada @@ -1,18 +1,14 @@ -class Object(any data) +class Object(data) async fn main() { - o = lease_me(Object(22)).data - #! RUN ERROR your lease to this object was cancelled - # + o = lease_me(Object(22).lease).data # What happens here: - # * the `Object(22)` is stored into a temporary that is dropped as soon - # as the call completes. - # - #! FIXME: This seems kind of annoying! + # * the `Object(22)` is stored into a temporary that is dropped, but we've already read + # the data field out of it - print(o).await + print(o).await #! OUTPUT 22 } -fn lease_me(leased p) -> { +fn lease_me(p) -> { p } \ No newline at end of file diff --git a/dada_tests/specifier/temporary-lifetime/call-argument/stdout.ref b/dada_tests/specifier/temporary-lifetime/call-argument/stdout.ref index e69de29b..2bd5a0a9 100644 --- a/dada_tests/specifier/temporary-lifetime/call-argument/stdout.ref +++ b/dada_tests/specifier/temporary-lifetime/call-argument/stdout.ref @@ -0,0 +1 @@ +22 diff --git a/dada_tests/specifier/temporary-lifetime/if-then-else-owned.dada b/dada_tests/specifier/temporary-lifetime/if-then-else-owned.dada index 1f4e57f2..04721e37 100644 --- a/dada_tests/specifier/temporary-lifetime/if-then-else-owned.dada +++ b/dada_tests/specifier/temporary-lifetime/if-then-else-owned.dada @@ -2,6 +2,6 @@ class Object(any data) async fn main() { # This is equivalent to `if { .. } else { .. }.lease`. - leased o = if true { Object(true) } else { Object(false) } + o = if true { Object(true) } else { Object(false) }.lease print(o).await #! OUTPUT Object\(true\) } diff --git a/dada_tests/validate/op-eq/lhs_field_of_func_call.dada b/dada_tests/validate/op-eq/lhs_field_of_func_call.dada index 5b6989b8..55f84fce 100644 --- a/dada_tests/validate/op-eq/lhs_field_of_func_call.dada +++ b/dada_tests/validate/op-eq/lhs_field_of_func_call.dada @@ -2,11 +2,11 @@ class Point(x, y) async fn main() { p = Point(22, 44) - test(p).await.x += 1 + test(p.lease).await.x += 1 print(p).await #! OUTPUT Point\(23, 44\) } -async fn test(leased p) -> { +async fn test(p) -> { print("Hi").await #! OUTPUT Hi p } \ No newline at end of file diff --git a/dada_tests/validate/op-eq/lhs_func_call.dada b/dada_tests/validate/op-eq/lhs_func_call.dada index b5c2c330..e5b277d5 100644 --- a/dada_tests/validate/op-eq/lhs_func_call.dada +++ b/dada_tests/validate/op-eq/lhs_func_call.dada @@ -2,13 +2,13 @@ class Point(x, y) async fn main() { p = Point(22, 44) - test(p) += 1 + test(p.lease) += 1 #! ERROR you can only assign to local variables and fields, not arbitrary expressions #! RUN ERROR compilation error encountered print(p).await } -async fn test(leased p) -> { +async fn test(p) -> { print("Hi").await p } \ No newline at end of file diff --git a/dada_tests/validate/op-eq/lhs_func_call/compiler-output.ref b/dada_tests/validate/op-eq/lhs_func_call/compiler-output.ref index bd07c50a..8e4b05ea 100644 --- a/dada_tests/validate/op-eq/lhs_func_call/compiler-output.ref +++ b/dada_tests/validate/op-eq/lhs_func_call/compiler-output.ref @@ -1,7 +1,7 @@ Error: you can only assign to local variables and fields, not arbitrary expressions ╭─[dada_tests/validate/op-eq/lhs_func_call.dada:5:5] │ - 5 │ test(p) += 1 - · ───┬─── - · ╰───── here + 5 │ test(p.lease) += 1 + · ──────┬────── + · ╰──────── here ───╯ From 8d75efde2e723b6788f09af92389fc8f58d2453f Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 14 Jul 2022 20:57:08 +0300 Subject: [PATCH 06/36] remove shleased specifier --- components/dada-execute/src/step.rs | 1 - components/dada-ir/src/storage.rs | 4 ---- components/dada-parse/src/parser/parameter.rs | 4 +--- dada_tests/permissions/revokation/lease-vs-shlease-1.dada | 2 +- dada_tests/permissions/revokation/lease-vs-shlease-2.dada | 2 +- dada_tests/reservations/our-to-our-leased-assign-field.dada | 4 ++-- dada_tests/reservations/our-to-our-leased-assign.dada | 2 +- dada_tests/reservations/our-to-our-leased-field.dada | 4 ++-- dada_tests/reservations/our-to-our-leased-var.dada | 2 +- .../specifier/leased-from-shared-rvalue-assign-in-loop.dada | 2 +- dada_tests/specifier/need-shleased-got-leased.dada | 5 ----- .../specifier/need-shleased-got-leased/compiler-output.ref | 0 dada_tests/specifier/need-shleased-got-leased/stdout.ref | 0 dada_tests/specifier/need-shleased-got-my.dada | 5 ----- .../specifier/need-shleased-got-my/compiler-output.ref | 0 dada_tests/specifier/need-shleased-got-my/stdout.ref | 0 dada_tests/specifier/need-shleased-got-our.dada | 5 ----- .../specifier/need-shleased-got-our/compiler-output.ref | 0 dada_tests/specifier/need-shleased-got-our/stdout.ref | 0 dada_tests/specifier/need-shleased-got-shleased.dada | 5 ----- .../specifier/need-shleased-got-shleased/compiler-output.ref | 0 dada_tests/specifier/need-shleased-got-shleased/stdout.ref | 0 .../shleased-from-shared-rvalue-assign-in-loop.dada | 2 +- dada_tests/validate/op-eq/lhs_shared_field_of_func_call.dada | 4 ++-- 24 files changed, 13 insertions(+), 40 deletions(-) delete mode 100644 dada_tests/specifier/need-shleased-got-leased.dada delete mode 100644 dada_tests/specifier/need-shleased-got-leased/compiler-output.ref delete mode 100644 dada_tests/specifier/need-shleased-got-leased/stdout.ref delete mode 100644 dada_tests/specifier/need-shleased-got-my.dada delete mode 100644 dada_tests/specifier/need-shleased-got-my/compiler-output.ref delete mode 100644 dada_tests/specifier/need-shleased-got-my/stdout.ref delete mode 100644 dada_tests/specifier/need-shleased-got-our.dada delete mode 100644 dada_tests/specifier/need-shleased-got-our/compiler-output.ref delete mode 100644 dada_tests/specifier/need-shleased-got-our/stdout.ref delete mode 100644 dada_tests/specifier/need-shleased-got-shleased.dada delete mode 100644 dada_tests/specifier/need-shleased-got-shleased/compiler-output.ref delete mode 100644 dada_tests/specifier/need-shleased-got-shleased/stdout.ref diff --git a/components/dada-execute/src/step.rs b/components/dada-execute/src/step.rs index d52175f3..5130e049 100644 --- a/components/dada-execute/src/step.rs +++ b/components/dada-execute/src/step.rs @@ -284,7 +284,6 @@ impl<'me> Stepper<'me> { tracing::debug!(?specifier); let value = match specifier { - Specifier::Shleased => self.shlease_place(table, source_place)?, Specifier::Any => self.give_place(table, source_place)?, }; diff --git a/components/dada-ir/src/storage.rs b/components/dada-ir/src/storage.rs index 96520b7e..e8dcce15 100644 --- a/components/dada-ir/src/storage.rs +++ b/components/dada-ir/src/storage.rs @@ -25,7 +25,6 @@ impl SpannedSpecifier { #[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash, Debug)] pub enum Specifier { - Shleased, Any, } @@ -36,7 +35,6 @@ impl Specifier { /// [`Specifier::Any`] returns false. pub fn must_be_unique(self) -> bool { match self { - Specifier::Shleased => false, Specifier::Any => false, } } @@ -47,7 +45,6 @@ impl Specifier { /// [`Specifier::Any`] returns false. pub fn must_be_owned(self) -> bool { match self { - Specifier::Shleased => false, Specifier::Any => false, } } @@ -56,7 +53,6 @@ impl Specifier { impl std::fmt::Display for Specifier { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Specifier::Shleased => write!(f, "shleased"), Specifier::Any => write!(f, "any"), } } diff --git a/components/dada-parse/src/parser/parameter.rs b/components/dada-parse/src/parser/parameter.rs index c49efc4f..86f2b761 100644 --- a/components/dada-parse/src/parser/parameter.rs +++ b/components/dada-parse/src/parser/parameter.rs @@ -87,9 +87,7 @@ impl<'db> Parser<'db> { span.in_file(filename), )) }; - if let Some((shleased_span, _)) = self.eat(Keyword::Shleased) { - some_specifier(Specifier::Shleased, shleased_span) - } else if let Some((any_span, _)) = self.eat(Keyword::Any) { + if let Some((any_span, _)) = self.eat(Keyword::Any) { some_specifier(Specifier::Any, any_span) } else { None diff --git a/dada_tests/permissions/revokation/lease-vs-shlease-1.dada b/dada_tests/permissions/revokation/lease-vs-shlease-1.dada index 48cf1fb3..9e7dae5f 100644 --- a/dada_tests/permissions/revokation/lease-vs-shlease-1.dada +++ b/dada_tests/permissions/revokation/lease-vs-shlease-1.dada @@ -3,7 +3,7 @@ class Data(field) async fn main() { m = Data(22) l = m.lease - shleased s = l + s = l.shlease print(m.field).await #! OUTPUT 22 print(s.field).await #! RUN ERROR your lease to this object was cancelled } diff --git a/dada_tests/permissions/revokation/lease-vs-shlease-2.dada b/dada_tests/permissions/revokation/lease-vs-shlease-2.dada index 9c0ff022..540ae41e 100644 --- a/dada_tests/permissions/revokation/lease-vs-shlease-2.dada +++ b/dada_tests/permissions/revokation/lease-vs-shlease-2.dada @@ -2,7 +2,7 @@ class Data(field) async fn main() { m = Data(22) - shleased s = m + s = m.shlease print(m.field).await #! OUTPUT 22 print(s.field).await #! OUTPUT 22 } diff --git a/dada_tests/reservations/our-to-our-leased-assign-field.dada b/dada_tests/reservations/our-to-our-leased-assign-field.dada index 8ed448c8..105042ce 100644 --- a/dada_tests/reservations/our-to-our-leased-assign-field.dada +++ b/dada_tests/reservations/our-to-our-leased-assign-field.dada @@ -1,10 +1,10 @@ class Point(a, b) -class OurLeased(shleased f) +class OurLeased(f) async fn main() { p = Point(22, 44).share # create a shared point `(22, 44)` - q = OurLeased(p) # `q.f` becomes 2nd owner of `(22, 44)` + q = OurLeased(p.shlease) # `q.f` becomes 2nd owner of `(22, 44)` print(q.lease).await #! OUTPUT OurLeased\(our Point\(22, 44\)\) p := Point(44, 66) # `p` is shared owner of `(44, 66)` diff --git a/dada_tests/reservations/our-to-our-leased-assign.dada b/dada_tests/reservations/our-to-our-leased-assign.dada index 5b969336..ea45c7ce 100644 --- a/dada_tests/reservations/our-to-our-leased-assign.dada +++ b/dada_tests/reservations/our-to-our-leased-assign.dada @@ -5,7 +5,7 @@ async fn main() { # leasing an "our" thing becomes a second # owner (lessors are always exclusive) - shleased q = p + q = p.shlease print(q).await #! OUTPUT Point\(22, 44\) # reassigning `p` does not invalidate `q`. diff --git a/dada_tests/reservations/our-to-our-leased-field.dada b/dada_tests/reservations/our-to-our-leased-field.dada index 617f3707..473f1a93 100644 --- a/dada_tests/reservations/our-to-our-leased-field.dada +++ b/dada_tests/reservations/our-to-our-leased-field.dada @@ -1,11 +1,11 @@ class Point(a, b) -class OurLeased(shleased f) +class OurLeased(f) async fn main() { p = Point(22, 44).share # create `(22, 44)` with shared ownership print(p.lease).await #! OUTPUT Point\(22, 44\) - q = OurLeased(p) # `OurLeased` takes 2nd ownership of `(22, 44)` + q = OurLeased(p.shlease) # `OurLeased` takes 2nd ownership of `(22, 44)` print(q.lease).await #! OUTPUT OurLeased\(our Point\(22, 44\)\) p := Point(44, 66) # reassigning `p` doesn't invalidate `q.f` diff --git a/dada_tests/reservations/our-to-our-leased-var.dada b/dada_tests/reservations/our-to-our-leased-var.dada index 97c8eb1a..e6e97464 100644 --- a/dada_tests/reservations/our-to-our-leased-var.dada +++ b/dada_tests/reservations/our-to-our-leased-var.dada @@ -2,7 +2,7 @@ class Point(a, b) async fn main() { p = Point(22, 44).share - shleased q = p # `q` becomes 2nd owner of `(22, 44)` + q = p # `q` becomes 2nd owner of `(22, 44)`.shlease p := Point(44, 66) # reassigning `p` has no effect on `q` print(p).await #! OUTPUT Point\(44, 66\) diff --git a/dada_tests/specifier/leased-from-shared-rvalue-assign-in-loop.dada b/dada_tests/specifier/leased-from-shared-rvalue-assign-in-loop.dada index a8aedea3..af85b2c3 100644 --- a/dada_tests/specifier/leased-from-shared-rvalue-assign-in-loop.dada +++ b/dada_tests/specifier/leased-from-shared-rvalue-assign-in-loop.dada @@ -4,7 +4,7 @@ async fn main() { # Leasing an `our` value just takes ownership # of it, so `p` becomes (shared) owner of this # point here. - shleased p = Point(22, 44).share + p = Point(22, 44).share.shlease i = 0 while i < 1 { diff --git a/dada_tests/specifier/need-shleased-got-leased.dada b/dada_tests/specifier/need-shleased-got-leased.dada deleted file mode 100644 index 6f5c35e8..00000000 --- a/dada_tests/specifier/need-shleased-got-leased.dada +++ /dev/null @@ -1,5 +0,0 @@ -class Point() - -async fn main() { - shleased p = Point().lease -} \ No newline at end of file diff --git a/dada_tests/specifier/need-shleased-got-leased/compiler-output.ref b/dada_tests/specifier/need-shleased-got-leased/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-shleased-got-leased/stdout.ref b/dada_tests/specifier/need-shleased-got-leased/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-shleased-got-my.dada b/dada_tests/specifier/need-shleased-got-my.dada deleted file mode 100644 index 50dcef59..00000000 --- a/dada_tests/specifier/need-shleased-got-my.dada +++ /dev/null @@ -1,5 +0,0 @@ -class Point() - -async fn main() { - shleased p = Point() -} \ No newline at end of file diff --git a/dada_tests/specifier/need-shleased-got-my/compiler-output.ref b/dada_tests/specifier/need-shleased-got-my/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-shleased-got-my/stdout.ref b/dada_tests/specifier/need-shleased-got-my/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-shleased-got-our.dada b/dada_tests/specifier/need-shleased-got-our.dada deleted file mode 100644 index 5bc1dd3c..00000000 --- a/dada_tests/specifier/need-shleased-got-our.dada +++ /dev/null @@ -1,5 +0,0 @@ -class Point() - -async fn main() { - shleased p = Point().share -} \ No newline at end of file diff --git a/dada_tests/specifier/need-shleased-got-our/compiler-output.ref b/dada_tests/specifier/need-shleased-got-our/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-shleased-got-our/stdout.ref b/dada_tests/specifier/need-shleased-got-our/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-shleased-got-shleased.dada b/dada_tests/specifier/need-shleased-got-shleased.dada deleted file mode 100644 index 70a00da9..00000000 --- a/dada_tests/specifier/need-shleased-got-shleased.dada +++ /dev/null @@ -1,5 +0,0 @@ -class Point() - -async fn main() { - shleased p = Point().lease.share -} \ No newline at end of file diff --git a/dada_tests/specifier/need-shleased-got-shleased/compiler-output.ref b/dada_tests/specifier/need-shleased-got-shleased/compiler-output.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/need-shleased-got-shleased/stdout.ref b/dada_tests/specifier/need-shleased-got-shleased/stdout.ref deleted file mode 100644 index e69de29b..00000000 diff --git a/dada_tests/specifier/shleased-from-shared-rvalue-assign-in-loop.dada b/dada_tests/specifier/shleased-from-shared-rvalue-assign-in-loop.dada index a8aedea3..af85b2c3 100644 --- a/dada_tests/specifier/shleased-from-shared-rvalue-assign-in-loop.dada +++ b/dada_tests/specifier/shleased-from-shared-rvalue-assign-in-loop.dada @@ -4,7 +4,7 @@ async fn main() { # Leasing an `our` value just takes ownership # of it, so `p` becomes (shared) owner of this # point here. - shleased p = Point(22, 44).share + p = Point(22, 44).share.shlease i = 0 while i < 1 { diff --git a/dada_tests/validate/op-eq/lhs_shared_field_of_func_call.dada b/dada_tests/validate/op-eq/lhs_shared_field_of_func_call.dada index 7028f9b3..c296d153 100644 --- a/dada_tests/validate/op-eq/lhs_shared_field_of_func_call.dada +++ b/dada_tests/validate/op-eq/lhs_shared_field_of_func_call.dada @@ -4,11 +4,11 @@ async fn main() { p = Point(22, 44).share # Test that we execute `test(p)` (and hence see its output) # before we detect the error here - test(p).await.x += 1 #! RUN ERROR cannot write to shared fields + test(p.shlease).await.x += 1 #! RUN ERROR cannot write to shared fields print(p).await } -async fn test(shleased p) -> { +async fn test(p) -> { print("Hi").await #! OUTPUT Hi p } \ No newline at end of file From bad40954fa39471611e4a01f5968890d0247a86c Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 14 Jul 2022 21:11:57 +0300 Subject: [PATCH 07/36] add "assign" tests for "a = b" --- .../permissions/exhaustive/assign-var-leased.dada | 10 ++++++++++ .../exhaustive/assign-var-leased/compiler-output.ref | 0 .../exhaustive/assign-var-leased/stdout.ref | 2 ++ dada_tests/permissions/exhaustive/assign-var-my.dada | 8 ++++++++ .../exhaustive/assign-var-my/compiler-output.ref | 0 .../permissions/exhaustive/assign-var-my/stdout.ref | 0 dada_tests/permissions/exhaustive/assign-var-our.dada | 8 ++++++++ .../exhaustive/assign-var-our/compiler-output.ref | 0 .../permissions/exhaustive/assign-var-our/stdout.ref | 1 + 9 files changed, 29 insertions(+) create mode 100644 dada_tests/permissions/exhaustive/assign-var-leased.dada create mode 100644 dada_tests/permissions/exhaustive/assign-var-leased/compiler-output.ref create mode 100644 dada_tests/permissions/exhaustive/assign-var-leased/stdout.ref create mode 100644 dada_tests/permissions/exhaustive/assign-var-my.dada create mode 100644 dada_tests/permissions/exhaustive/assign-var-my/compiler-output.ref create mode 100644 dada_tests/permissions/exhaustive/assign-var-my/stdout.ref create mode 100644 dada_tests/permissions/exhaustive/assign-var-our.dada create mode 100644 dada_tests/permissions/exhaustive/assign-var-our/compiler-output.ref create mode 100644 dada_tests/permissions/exhaustive/assign-var-our/stdout.ref diff --git a/dada_tests/permissions/exhaustive/assign-var-leased.dada b/dada_tests/permissions/exhaustive/assign-var-leased.dada new file mode 100644 index 00000000..47cc3334 --- /dev/null +++ b/dada_tests/permissions/exhaustive/assign-var-leased.dada @@ -0,0 +1,10 @@ +class Pair(any a, any b) + +async fn main() { + p = Pair(22, 44).lease + q = p + print(q).await + #! OUTPUT leased Pair\(22, 44\) + print(p).await + #! OUTPUT leased Pair\(22, 44\) +} \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/assign-var-leased/compiler-output.ref b/dada_tests/permissions/exhaustive/assign-var-leased/compiler-output.ref new file mode 100644 index 00000000..e69de29b diff --git a/dada_tests/permissions/exhaustive/assign-var-leased/stdout.ref b/dada_tests/permissions/exhaustive/assign-var-leased/stdout.ref new file mode 100644 index 00000000..52946d17 --- /dev/null +++ b/dada_tests/permissions/exhaustive/assign-var-leased/stdout.ref @@ -0,0 +1,2 @@ +leased Pair(22, 44) +leased Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/assign-var-my.dada b/dada_tests/permissions/exhaustive/assign-var-my.dada new file mode 100644 index 00000000..f1c1e49a --- /dev/null +++ b/dada_tests/permissions/exhaustive/assign-var-my.dada @@ -0,0 +1,8 @@ +class Pair(any a, any b) + +async fn main() { + p = Pair(22, 44) + q = p + print(p).await + #! RUN ERROR your lease to this object was cancelled +} \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/assign-var-my/compiler-output.ref b/dada_tests/permissions/exhaustive/assign-var-my/compiler-output.ref new file mode 100644 index 00000000..e69de29b diff --git a/dada_tests/permissions/exhaustive/assign-var-my/stdout.ref b/dada_tests/permissions/exhaustive/assign-var-my/stdout.ref new file mode 100644 index 00000000..e69de29b diff --git a/dada_tests/permissions/exhaustive/assign-var-our.dada b/dada_tests/permissions/exhaustive/assign-var-our.dada new file mode 100644 index 00000000..deb9130e --- /dev/null +++ b/dada_tests/permissions/exhaustive/assign-var-our.dada @@ -0,0 +1,8 @@ +class Pair(any a, any b) + +async fn main() { + p = Pair(22, 44).share + q = p + print(p).await + #! OUTPUT Pair\(22, 44\) +} \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/assign-var-our/compiler-output.ref b/dada_tests/permissions/exhaustive/assign-var-our/compiler-output.ref new file mode 100644 index 00000000..e69de29b diff --git a/dada_tests/permissions/exhaustive/assign-var-our/stdout.ref b/dada_tests/permissions/exhaustive/assign-var-our/stdout.ref new file mode 100644 index 00000000..2aa36059 --- /dev/null +++ b/dada_tests/permissions/exhaustive/assign-var-our/stdout.ref @@ -0,0 +1 @@ +our Pair(22, 44) From 6657ebb7857fc59a32caf6bc8c66d60a41551030 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 14 Jul 2022 21:43:09 +0300 Subject: [PATCH 08/36] partially undo the place/value distinction Distinguish: * Default evaluation will no longer be give * Validation with a forced give occurs for `foo.give`, `foo.await` Reinstate: * Assigning a VALUE to a PLACE (no specifiers are activated) --- components/dada-brew/src/brew.rs | 38 +--- components/dada-brew/src/cursor.rs | 13 -- components/dada-ir/src/code/validated.rs | 20 +- components/dada-validate/src/validate.rs | 4 +- .../dada-validate/src/validate/validator.rs | 164 ++++++++-------- .../cursor-position/HeapGraph-0.bir.ref | 126 ++++-------- .../cursor-position/HeapGraph-0.ref | 11 +- .../cursor-position/HeapGraph-1.bir.ref | 126 ++++-------- .../cursor-position/HeapGraph-1.ref | 6 +- .../cursor-position/HeapGraph-2.bir.ref | 126 ++++-------- .../cursor-position/HeapGraph-2.ref | 8 +- .../cursor-position/HeapGraph-3.bir.ref | 126 ++++-------- .../cursor-position/HeapGraph-3.ref | 9 +- dada_tests/heap-graph/dag/HeapGraph-0.bir.ref | 92 +++------ dada_tests/heap-graph/dag/HeapGraph-0.ref | 8 +- .../leased-point/HeapGraph-0.bir.ref | 86 +++----- .../heap-graph/leased-point/HeapGraph-0.ref | 8 +- .../heap-graph/line-end/HeapGraph-0.bir.ref | 50 +---- .../heap-graph/line-end/HeapGraph-0.ref | 8 +- .../heap-graph/line-end/HeapGraph-1.bir.ref | 50 +---- .../heap-graph/line-end/HeapGraph-1.ref | 6 +- .../heap-graph/line-start/HeapGraph-0.bir.ref | 86 +++----- .../heap-graph/line-start/HeapGraph-0.ref | 8 +- .../heap-graph/line-start/HeapGraph-1.bir.ref | 98 +++------- .../heap-graph/line-start/HeapGraph-1.ref | 10 +- .../mid-increment/HeapGraph-0.bir.ref | 118 ++++------- .../heap-graph/mid-increment/HeapGraph-0.ref | 8 +- .../nested-functions/HeapGraph-0.bir.ref | 184 ++++++------------ .../nested-functions/HeapGraph-0.ref | 15 +- .../nested-points/HeapGraph-0.bir.ref | 86 +++----- .../heap-graph/nested-points/HeapGraph-0.ref | 11 +- .../nested-points/HeapGraph-1.bir.ref | 98 +++------- .../heap-graph/nested-points/HeapGraph-1.ref | 10 +- .../nested-points/HeapGraph-2.bir.ref | 86 +++----- .../heap-graph/nested-points/HeapGraph-2.ref | 8 +- .../heap-graph/tutorial-1/HeapGraph-0.bir.ref | 74 +++---- .../heap-graph/tutorial-1/HeapGraph-0.ref | 4 +- .../heap-graph/tutorial-1/HeapGraph-1.bir.ref | 74 +++---- .../heap-graph/tutorial-1/HeapGraph-1.ref | 2 +- .../heap-graph/tutorial-1/HeapGraph-2.bir.ref | 86 ++++---- .../heap-graph/tutorial-1/HeapGraph-2.ref | 6 +- .../heap-graph/tutorial-1/HeapGraph-3.bir.ref | 86 ++++---- .../heap-graph/tutorial-1/HeapGraph-3.ref | 6 +- .../heap-graph/tutorial-1/HeapGraph-4.bir.ref | 74 +++---- .../heap-graph/tutorial-1/HeapGraph-4.ref | 2 +- .../tutorial-give-10/HeapGraph-0.bir.ref | 72 +++---- .../tutorial-give-10/HeapGraph-0.ref | 20 +- .../tutorial-give-10/HeapGraph-1.bir.ref | 60 ++---- .../tutorial-give-10/HeapGraph-1.ref | 16 +- .../tutorial-lease-10/HeapGraph-0.bir.ref | 118 ++++------- .../tutorial-lease-10/HeapGraph-0.ref | 10 +- .../tutorial-lease-10/HeapGraph-1.bir.ref | 116 ++++------- .../tutorial-lease-10/HeapGraph-1.ref | 8 +- .../tutorial-lease-20/HeapGraph-0.bir.ref | 140 ++++--------- .../tutorial-lease-20/HeapGraph-0.ref | 12 +- .../tutorial-lease-30/HeapGraph-0.bir.ref | 110 ++++------- .../tutorial-lease-30/HeapGraph-0.ref | 20 +- .../tutorial-share-10/HeapGraph-0.bir.ref | 82 +++----- .../tutorial-share-10/HeapGraph-0.ref | 10 +- .../tutorial-share-20/HeapGraph-0.bir.ref | 163 +++------------- .../tutorial-share-20/HeapGraph-0.ref | 18 +- .../tutorial-share-30/HeapGraph-0.bir.ref | 80 ++------ .../tutorial-share-30/HeapGraph-0.ref | 12 +- .../exhaustive/share-var-field-my.dada | 4 +- .../exhaustive/share-var-field-my/stdout.ref | 4 +- .../permissions/exhaustive/share-var-my.dada | 4 +- .../exhaustive/share-var-my/stdout.ref | 3 +- .../our-to-our-leased-assign-field.dada | 2 +- dada_tests/specifier/local-my.dada | 4 +- dada_tests/specifier/local-my/stdout.ref | 5 +- .../if-then-else-leased.dada | 6 +- 71 files changed, 1123 insertions(+), 2301 deletions(-) diff --git a/components/dada-brew/src/brew.rs b/components/dada-brew/src/brew.rs index eeba329c..aa3c3029 100644 --- a/components/dada-brew/src/brew.rs +++ b/components/dada-brew/src/brew.rs @@ -113,38 +113,12 @@ impl Cursor { self.terminate_and_diverge(brewery, bir::TerminatorData::Error, origin) } - validated::ExprData::AssignTemporary(place, value_expr) => { - // temporaries are always created with "any" specifier, which ensures - // that we will never have to apply specifier to `value_expr` - assert_eq!(brewery.validated_tables()[*place].specifier, None); - - // we only ever use this for temporaries, user-created values use `AssignFromPlace` - assert!(matches!( - brewery.origin(*place), - validated::LocalVariableOrigin::Temporary(_) - )); - - self.push_breakpoint_start(brewery, origin); - let place = self.brew_target_variable(brewery, *place, origin); - self.brew_expr_and_assign_to(brewery, place, *value_expr); - self.push_breakpoint_end(brewery, None::, origin) - } - - validated::ExprData::AssignFromPlace(target_place, source_place) => { + validated::ExprData::Assign(target_place, value_expr) => { let (target_place, target_origins) = self.brew_target_place(brewery, *target_place); - let (source_place, source_origins) = self.brew_place(brewery, *source_place); - self.push_breakpoint_starts( - brewery, - target_origins.iter().chain(source_origins.iter()).copied(), - origin, - ); - self.push_assignment_from_place(brewery, target_place, source_place, origin); - self.push_breakpoint_ends( - brewery, - None::, - target_origins.into_iter().chain(source_origins), - origin, - ) + + self.push_breakpoint_starts(brewery, target_origins.iter().copied(), origin); + self.brew_expr_and_assign_to(brewery, target_place, *value_expr); + self.push_breakpoint_ends(brewery, None::, target_origins, origin) } validated::ExprData::Declare(vars, subexpr) => { @@ -445,7 +419,7 @@ impl Cursor { } } - validated::ExprData::AssignTemporary(..) | validated::ExprData::AssignFromPlace(..) => { + validated::ExprData::Assign(..) => { self.brew_expr_for_side_effects(brewery, expr); self.push_assignment(brewery, target, bir::ExprData::Unit, origin); } diff --git a/components/dada-brew/src/cursor.rs b/components/dada-brew/src/cursor.rs index 87112f1a..1e605f36 100644 --- a/components/dada-brew/src/cursor.rs +++ b/components/dada-brew/src/cursor.rs @@ -151,19 +151,6 @@ impl Cursor { } } - pub(crate) fn push_assignment_from_place( - &mut self, - brewery: &mut Brewery<'_>, - target: bir::TargetPlace, - source: bir::Place, - origin: ExprOrigin, - ) { - if self.end_block.is_some() { - let statement = brewery.add(bir::StatementData::AssignPlace(target, source), origin); - self.push_statement(brewery, statement); - } - } - /// If any of the origins in `origins`, or `origin`, is a breakpoint expression, /// push a "breakpoint-start" statement onto the current basic block. pub(crate) fn push_breakpoint_starts( diff --git a/components/dada-ir/src/code/validated.rs b/components/dada-ir/src/code/validated.rs index 4ae4d672..2e4db6a4 100644 --- a/components/dada-ir/src/code/validated.rs +++ b/components/dada-ir/src/code/validated.rs @@ -296,17 +296,8 @@ pub enum ExprData { /// ` x` Unary(Op, Expr), - /// `a := b.give` -- it is important that this - /// is only used to create temporaries! This is because - /// we cannot apply all the potential specifiers to an expression - /// (e.g., we cannot lease it). To assign to user-declared variables - /// we must use `AssignFromPlace`. - AssignTemporary(LocalVariable, Expr), - - /// `a := b` -- used when the specifier (`my`, `our`, etc) is not known - /// statically, and we we can't determine whether the place should be - /// given, leased, or what - AssignFromPlace(TargetPlace, Place), + /// `a = b` or `a := b` + Assign(TargetPlace, Expr), /// Bring the variables in scope during the expression Declare(Vec, Expr), @@ -393,16 +384,11 @@ impl ExprData { .field(op) .field(&rhs.debug(db)) .finish(), - ExprData::AssignTemporary(place, expr) => f + ExprData::Assign(place, expr) => f .debug_tuple("Assign") .field(&place.debug(db)) .field(&expr.debug(db)) .finish(), - ExprData::AssignFromPlace(target, source) => f - .debug_tuple("AssignFromPlace") - .field(&target.debug(db)) - .field(&source.debug(db)) - .finish(), ExprData::Declare(vars, expr) => f .debug_tuple("Declare") .field(&vars.debug(db)) diff --git a/components/dada-validate/src/validate.rs b/components/dada-validate/src/validate.rs index 1277e174..e8e731ad 100644 --- a/components/dada-validate/src/validate.rs +++ b/components/dada-validate/src/validate.rs @@ -17,7 +17,7 @@ pub(crate) fn validate_function(db: &dyn crate::Db, function: Function) -> valid let mut tables = validated::Tables::default(); let mut origins = validated::Origins::default(); let root_definitions = root_definitions(db, function.filename(db)); - let scope = Scope::root(db, root_definitions); + let scope = Scope::root(db, &root_definitions); let mut validator = validator::Validator::root(db, function, syntax_tree, &mut tables, &mut origins, scope); @@ -27,7 +27,7 @@ pub(crate) fn validate_function(db: &dyn crate::Db, function: Function) -> valid } let num_parameters = validator.num_local_variables(); - let root_expr = validator.give_validated_root_expr(syntax_tree.data(db).root_expr); + let root_expr = validator.validate_root_expr(syntax_tree.data(db).root_expr); std::mem::drop(validator); let data = validated::TreeData::new(tables, num_parameters, root_expr); validated::Tree::new(db, function, data, origins) diff --git a/components/dada-validate/src/validate/validator.rs b/components/dada-validate/src/validate/validator.rs index ee94e8a4..16472d76 100644 --- a/components/dada-validate/src/validate/validator.rs +++ b/components/dada-validate/src/validate/validator.rs @@ -41,8 +41,18 @@ pub(crate) struct Validator<'me> { #[derive(Copy, Clone, Debug)] pub enum ExprMode { - Given, + /// When you do `a = `, `` is evaluated in "default" mode + Default, + + /// In `a.f = `, `a` is evaluated in "leased" mode Leased, + + /// We sometimes "reserve" an expression before actually using it; + /// this ensures that it remains valid even as subsequent things are executed. + /// + /// Example: `foo(, )` reserves `` + /// + /// This logic may be removed, not sure yet. Reserve, } @@ -157,8 +167,8 @@ impl<'me> Validator<'me> { } #[tracing::instrument(level = "debug", skip_all)] - pub(crate) fn give_validated_root_expr(&mut self, expr: syntax::Expr) -> validated::Expr { - let validated_expr = self.give_validated_expr(expr); + pub(crate) fn validate_root_expr(&mut self, expr: syntax::Expr) -> validated::Expr { + let validated_expr = self.validate_expr(expr); if self.function.return_type(self.db).kind(self.db) == ReturnTypeKind::Value { if let validated::ExprData::Seq(exprs) = validated_expr.data(self.tables) { if exprs.is_empty() { @@ -182,9 +192,33 @@ impl<'me> Validator<'me> { validated_expr } + /// Validates an expression into a value: + /// + /// * If `E` is a place expression, like `a.b`, this is equivalent to `a.b.shlease` + /// * If `E` is a value expression, like `foo()`, this just evalutes it + #[tracing::instrument(level = "debug", skip(self, expr))] + fn validate_expr(&mut self, expr: syntax::Expr) -> validated::Expr { + self.validate_expr_in_mode(expr, ExprMode::Default) + } + + /// Given an expression `E`, takes ownership of its value: + /// + /// * If `E` is a place expression, like `a.b`, this is equivalent to `a.b.give` + /// * If `E` is a value expression, like `foo()`, this just evalutes `E` + /// + /// The `move_expr` argument indicates the expression causing the move (e.g., the `give` expr + /// or the `await` expr). #[tracing::instrument(level = "debug", skip(self, expr))] - fn give_validated_expr(&mut self, expr: syntax::Expr) -> validated::Expr { - self.validate_expr_in_mode(expr, ExprMode::Given) + fn give_validated_expr( + &mut self, + moving_expr: syntax::Expr, + expr: syntax::Expr, + ) -> validated::Expr { + if self.is_place_expression(expr) { + self.validate_permission_expr(moving_expr, expr, validated::ExprData::Give) + } else { + self.validate_expr(expr) + } } #[tracing::instrument(level = "debug", skip(self, expr))] @@ -318,7 +352,7 @@ impl<'me> Validator<'me> { } } - let validated_future_expr = self.give_validated_expr(*future_expr); + let validated_future_expr = self.give_validated_expr(expr, *future_expr); self.add(validated::ExprData::Await(validated_future_expr), expr) } @@ -344,8 +378,12 @@ impl<'me> Validator<'me> { } syntax::ExprData::Share(target_expr) => { - let validated_target_expr = self.give_validated_expr(*target_expr); - self.add(validated::ExprData::Share(validated_target_expr), expr) + if self.is_place_expression(*target_expr) { + self.validate_permission_expr(expr, *target_expr, validated::ExprData::Shlease) + } else { + let validated_target_expr = self.validate_expr(*target_expr); + self.add(validated::ExprData::Share(validated_target_expr), expr) + } } syntax::ExprData::Lease(target_expr) => { @@ -356,13 +394,7 @@ impl<'me> Validator<'me> { self.validate_permission_expr(expr, *target_expr, validated::ExprData::Shlease) } - syntax::ExprData::Give(target_expr) => { - if self.is_place_expression(*target_expr) { - self.validate_permission_expr(expr, *target_expr, validated::ExprData::Give) - } else { - self.give_validated_expr(*target_expr) - } - } + syntax::ExprData::Give(target_expr) => self.give_validated_expr(expr, *target_expr), syntax::ExprData::Var(decl, initializer_expr) => { let decl_data = decl.data(self.syntax_tables()); @@ -399,7 +431,7 @@ impl<'me> Validator<'me> { syntax::ExprData::Concatenate(exprs) => self.concatenate(expr, exprs), syntax::ExprData::If(condition_expr, then_expr, else_expr) => { - let validated_condition_expr = self.give_validated_expr(*condition_expr); + let validated_condition_expr = self.validate_expr(*condition_expr); let validated_then_expr = self.subscope().validate_expr_and_exit(*then_expr, mode); let validated_else_expr = match else_expr { None => self.empty_tuple(expr), @@ -433,7 +465,7 @@ impl<'me> Validator<'me> { let validated_body_expr = self .subscope() .with_loop_expr(loop_expr) - .validate_expr_and_exit(*body_expr, ExprMode::Given); + .validate_expr_and_exit(*body_expr, ExprMode::Default); self.tables[loop_expr] = validated::ExprData::Loop(validated_body_expr); @@ -450,7 +482,7 @@ impl<'me> Validator<'me> { let loop_expr = self.add(validated::ExprData::Error, expr); // lower the condition C - let validated_condition_expr = self.give_validated_expr(*condition_expr); + let validated_condition_expr = self.validate_expr(*condition_expr); // lower the body E, in a subscope so that `break` breaks out from `loop_expr` let validated_body_expr = self @@ -487,8 +519,8 @@ impl<'me> Validator<'me> { } syntax::ExprData::Op(lhs_expr, op, rhs_expr) => { - let validated_lhs_expr = self.give_validated_expr(*lhs_expr); - let validated_rhs_expr = self.give_validated_expr(*rhs_expr); + let validated_lhs_expr = self.validate_expr(*lhs_expr); + let validated_rhs_expr = self.validate_expr(*rhs_expr); let validated_op = self.validated_op(*op); self.add( validated::ExprData::Op(validated_lhs_expr, validated_op, validated_rhs_expr), @@ -497,7 +529,7 @@ impl<'me> Validator<'me> { } syntax::ExprData::Unary(op, rhs_expr) => { - let validated_rhs_expr = self.give_validated_expr(*rhs_expr); + let validated_rhs_expr = self.validate_expr(*rhs_expr); let validated_op = self.validated_op(*op); self.add( validated::ExprData::Unary(validated_op, validated_rhs_expr), @@ -525,10 +557,8 @@ impl<'me> Validator<'me> { syntax::ExprData::Error => self.add(validated::ExprData::Error, expr), syntax::ExprData::Seq(exprs) => { - let validated_exprs: Vec<_> = exprs - .iter() - .map(|expr| self.give_validated_expr(*expr)) - .collect(); + let validated_exprs: Vec<_> = + exprs.iter().map(|expr| self.validate_expr(*expr)).collect(); self.add(validated::ExprData::Seq(validated_exprs), expr) } syntax::ExprData::Return(with_value) => { @@ -559,7 +589,7 @@ impl<'me> Validator<'me> { _ => {} } let validated_expr = if let Some(return_expr) = with_value { - self.give_validated_expr(*return_expr) + self.validate_expr(*return_expr) } else { self.empty_tuple(expr) }; @@ -584,7 +614,7 @@ impl<'me> Validator<'me> { // { // temp_leased_owner = owner.lease // temp_value = temp_leased_owner.x + - // temp_leased_owner.x = temp2 + // temp_leased_owner.x = temp_value.give // } // // below, we will leave comments for the more complex version. @@ -618,7 +648,7 @@ impl<'me> Validator<'me> { }; // - let validated_rhs_expr = self.give_validated_expr(rhs_expr); + let validated_rhs_expr = self.validate_expr(rhs_expr); // `x + ` or `temp_leased_owner.x + ` let validated_op_expr = self.add( @@ -629,13 +659,17 @@ impl<'me> Validator<'me> { self.store_validated_expr_in_temporary(validated_op_expr) }; + // + let temporary_give = self.add( + validated::ExprData::Give(temporary_place), + op_eq_expr.synthesized(), + ); + // `x = temp_value` or `temp_leased_owner.x = temp_value` - let assign_field_expr = { - self.add( - validated::ExprData::AssignFromPlace(validated_target_place, temporary_place), - op_eq_expr, - ) - }; + let assign_field_expr = self.add( + validated::ExprData::Assign(validated_target_place, temporary_give), + op_eq_expr, + ); Ok(self.seq( lease_owner_expr @@ -651,51 +685,11 @@ impl<'me> Validator<'me> { initializer_expr: syntax::Expr, origin: syntax::Expr, ) -> validated::Expr { - if self.is_place_expression(initializer_expr) { - // Compile - // - // Specifier x = - // - // to - // - // x = - // - // directly. - let result = try { - let (validated_opt_temp_expr, validated_initializer_place) = - self.validate_expr_as_place(initializer_expr)?; - let assignment_expr = self.add( - validated::ExprData::AssignFromPlace(target_place, validated_initializer_place), - origin, - ); - self.seq(validated_opt_temp_expr, assignment_expr) - }; - self.or_error(result, origin) - } else { - // Compile - // - // Specifier x = - // - // to - // - // temp = - // x = temp - // - // This temporary lives as long as `x` does. - // - // The reason for introducing this temporary is because - // some specifiers (notably `lease`) need a place - // to "borrow" from. For other specifiers (e.g., `my`, `our`, `any`) - // we simply move/copy out from `temp` immediately and it has no - // ill-effect. - let (temp_initializer_expr, temp_place) = - self.validate_expr_in_temporary(initializer_expr, ExprMode::Given); - let assignment_expr = self.add( - validated::ExprData::AssignFromPlace(target_place, temp_place), - origin, - ); - self.seq(Some(temp_initializer_expr), assignment_expr) - } + let validated_expr = self.validate_expr(initializer_expr); + self.add( + validated::ExprData::Assign(target_place, validated_expr), + origin, + ) } fn validate_expr_as_target_place( @@ -743,7 +737,7 @@ impl<'me> Validator<'me> { } _ => { - let _ = self.give_validated_expr(expr); + let _ = self.validate_expr(expr); Err(dada_ir::error!( self.span(expr), "you can only assign to local variables and fields, not arbitrary expressions", @@ -805,7 +799,7 @@ impl<'me> Validator<'me> { ) -> validated::Expr { match data { Ok((opt_assign_expr, place)) => match mode { - ExprMode::Given => { + ExprMode::Default => { let place_expr = self.add(validated::ExprData::Give(place), origin); self.seq(opt_assign_expr, place_expr) } @@ -891,7 +885,7 @@ impl<'me> Validator<'me> { syntax::ExprData::Error => Err(ErrorReported), _ => { let (assign_expr, temporary_place) = - self.validate_expr_in_temporary(expr, ExprMode::Given); + self.validate_expr_in_temporary(expr, ExprMode::Default); Ok((Some(assign_expr), temporary_place)) } } @@ -924,8 +918,12 @@ impl<'me> Validator<'me> { ); self.scope.insert_temporary(local_variable); + let target_place = self.add( + validated::TargetPlaceData::LocalVariable(local_variable), + origin, + ); let assign_expr = self.add( - validated::ExprData::AssignTemporary(local_variable, validated_expr), + validated::ExprData::Assign(target_place, validated_expr), origin, ); diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref index b8acff2a..2e6eadfa 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{7}, + temp{4}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{8}, + temp{5}, 22, ), Expr(1), ), ( AssignExpr( - temp{9}, + temp{6}, 44, ), Expr(2), ), ], Assign( - temp{6}, + temp{3}, Call( - temp{7}, + temp{4}, [ - temp{8}, - temp{9}, + temp{5}, + temp{6}, ], [ None, @@ -45,19 +45,19 @@ [ ( Clear( - temp{9}, + temp{6}, ), Expr(2), ), ( Clear( - temp{8}, + temp{5}, ), Expr(1), ), ( Clear( - temp{7}, + temp{4}, ), Expr(0), ), @@ -70,8 +70,8 @@ ), ( AssignExpr( - temp{1}, - temp{6}.share, + p{0}, + temp{3}.share, ), Expr(4), ), @@ -81,66 +81,46 @@ 0, Expr(4), Some( - temp{1}, + p{0}, ), ), Expr(4), ), ( Clear( - temp{6}, + temp{3}, ), Expr(3), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(5), - ), ( AssignExpr( - temp{5}, - (), - ), - Expr(5), - ), - ( - Clear( - temp{5}, - ), - Expr(5), - ), - ( - AssignExpr( - temp{12}, + temp{8}, Class(Id { value: 1 }).reserve, ), Expr(6), ), ( AssignExpr( - temp{13}, + temp{9}, p{0}.reserve, ), Expr(7), ), ( AssignExpr( - temp{14}, + temp{10}, 66, ), Expr(8), ), ], Assign( - temp{11}, + temp{7}, Call( - temp{12}, + temp{8}, [ - temp{13}, - temp{14}, + temp{9}, + temp{10}, ], [ None, @@ -154,89 +134,69 @@ [ ( Clear( - temp{14}, + temp{10}, ), Expr(8), ), ( Clear( - temp{13}, + temp{9}, ), Expr(7), ), ( Clear( - temp{12}, + temp{8}, ), Expr(6), ), ( AssignExpr( - temp{3}, - temp{11}.share, + q{1}, + temp{7}.share, ), Expr(10), ), ( Clear( - temp{11}, + temp{7}, ), Expr(9), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(11), - ), ( AssignExpr( - temp{10}, - (), - ), - Expr(11), - ), - ( - Clear( - temp{10}, - ), - Expr(11), - ), - ( - AssignExpr( - temp{17}, + temp{13}, Print.reserve, ), Expr(12), ), ( AssignExpr( - temp{19}, + temp{15}, "Hi", ), Expr(13), ), ( AssignExpr( - temp{18}, - Concatenate(temp{19}), + temp{14}, + Concatenate(temp{15}), ), Expr(14), ), ( Clear( - temp{19}, + temp{15}, ), Expr(13), ), ], Assign( - temp{16}, + temp{12}, Call( - temp{17}, + temp{13}, [ - temp{18}, + temp{14}, ], [ None, @@ -249,21 +209,21 @@ [ ( Clear( - temp{18}, + temp{14}, ), Expr(14), ), ( Clear( - temp{17}, + temp{13}, ), Expr(12), ), ], Assign( - temp{15}, + temp{11}, Await( - temp{16}, + temp{12}, ), BasicBlock(4), ), @@ -272,26 +232,26 @@ [ ( Clear( - temp{16}, + temp{12}, ), Expr(15), ), ( Clear( - temp{15}, + temp{11}, ), Expr(16), ), ( AssignExpr( - temp{4}, + temp{2}, (), ), Expr(17), ), ], Return( - temp{4}, + temp{2}, ), ), }, diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-0.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-0.ref index 8cd222a4..76c828cd 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-0.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-0.ref @@ -12,9 +12,9 @@ digraph { label=< - - - + + +
main
p
q
(in-flight)
p
q
(in-flight)
>; ]; @@ -28,7 +28,8 @@ digraph { y: "44" > ]; - "stack":20 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; + "afterstack":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; + "stack":16 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; } subgraph cluster_before { label=<before> @@ -41,7 +42,7 @@ digraph { - +
main
p
q
q
>; ]; diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref index 13f01e80..81e30ed8 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{7}, + temp{4}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{8}, + temp{5}, 22, ), Expr(1), ), ( AssignExpr( - temp{9}, + temp{6}, 44, ), Expr(2), ), ], Assign( - temp{6}, + temp{3}, Call( - temp{7}, + temp{4}, [ - temp{8}, - temp{9}, + temp{5}, + temp{6}, ], [ None, @@ -45,65 +45,45 @@ [ ( Clear( - temp{9}, + temp{6}, ), Expr(2), ), ( Clear( - temp{8}, + temp{5}, ), Expr(1), ), ( Clear( - temp{7}, + temp{4}, ), Expr(0), ), ( AssignExpr( - temp{1}, - temp{6}.share, + p{0}, + temp{3}.share, ), Expr(4), ), ( Clear( - temp{6}, + temp{3}, ), Expr(3), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(5), - ), ( AssignExpr( - temp{5}, - (), - ), - Expr(5), - ), - ( - Clear( - temp{5}, - ), - Expr(5), - ), - ( - AssignExpr( - temp{12}, + temp{8}, Class(Id { value: 1 }).reserve, ), Expr(6), ), ( AssignExpr( - temp{13}, + temp{9}, p{0}.reserve, ), Expr(7), @@ -117,7 +97,7 @@ ), ( AssignExpr( - temp{14}, + temp{10}, 66, ), Expr(8), @@ -128,19 +108,19 @@ 0, Expr(8), Some( - temp{14}, + temp{10}, ), ), Expr(8), ), ], Assign( - temp{11}, + temp{7}, Call( - temp{12}, + temp{8}, [ - temp{13}, - temp{14}, + temp{9}, + temp{10}, ], [ None, @@ -154,89 +134,69 @@ [ ( Clear( - temp{14}, + temp{10}, ), Expr(8), ), ( Clear( - temp{13}, + temp{9}, ), Expr(7), ), ( Clear( - temp{12}, + temp{8}, ), Expr(6), ), ( AssignExpr( - temp{3}, - temp{11}.share, + q{1}, + temp{7}.share, ), Expr(10), ), ( Clear( - temp{11}, + temp{7}, ), Expr(9), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(11), - ), ( AssignExpr( - temp{10}, - (), - ), - Expr(11), - ), - ( - Clear( - temp{10}, - ), - Expr(11), - ), - ( - AssignExpr( - temp{17}, + temp{13}, Print.reserve, ), Expr(12), ), ( AssignExpr( - temp{19}, + temp{15}, "Hi", ), Expr(13), ), ( AssignExpr( - temp{18}, - Concatenate(temp{19}), + temp{14}, + Concatenate(temp{15}), ), Expr(14), ), ( Clear( - temp{19}, + temp{15}, ), Expr(13), ), ], Assign( - temp{16}, + temp{12}, Call( - temp{17}, + temp{13}, [ - temp{18}, + temp{14}, ], [ None, @@ -249,21 +209,21 @@ [ ( Clear( - temp{18}, + temp{14}, ), Expr(14), ), ( Clear( - temp{17}, + temp{13}, ), Expr(12), ), ], Assign( - temp{15}, + temp{11}, Await( - temp{16}, + temp{12}, ), BasicBlock(4), ), @@ -272,26 +232,26 @@ [ ( Clear( - temp{16}, + temp{12}, ), Expr(15), ), ( Clear( - temp{15}, + temp{11}, ), Expr(16), ), ( AssignExpr( - temp{4}, + temp{2}, (), ), Expr(17), ), ], Return( - temp{4}, + temp{2}, ), ), }, diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-1.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-1.ref index 01b194cc..28031c83 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-1.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-1.ref @@ -13,8 +13,8 @@ digraph { - - + +
main
p
q
(in-flight): "66"
q
(in-flight): "66"
>; ]; @@ -41,7 +41,7 @@ digraph { - +
main
p
q
q
>; ]; diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref index 96ff0f76..b3a9dc65 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{7}, + temp{4}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{8}, + temp{5}, 22, ), Expr(1), ), ( AssignExpr( - temp{9}, + temp{6}, 44, ), Expr(2), ), ], Assign( - temp{6}, + temp{3}, Call( - temp{7}, + temp{4}, [ - temp{8}, - temp{9}, + temp{5}, + temp{6}, ], [ None, @@ -45,55 +45,35 @@ [ ( Clear( - temp{9}, + temp{6}, ), Expr(2), ), ( Clear( - temp{8}, + temp{5}, ), Expr(1), ), ( Clear( - temp{7}, + temp{4}, ), Expr(0), ), ( AssignExpr( - temp{1}, - temp{6}.share, + p{0}, + temp{3}.share, ), Expr(4), ), ( Clear( - temp{6}, + temp{3}, ), Expr(3), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(5), - ), - ( - AssignExpr( - temp{5}, - (), - ), - Expr(5), - ), - ( - Clear( - temp{5}, - ), - Expr(5), - ), ( BreakpoingStart( "class", @@ -103,33 +83,33 @@ ), ( AssignExpr( - temp{12}, + temp{8}, Class(Id { value: 1 }).reserve, ), Expr(6), ), ( AssignExpr( - temp{13}, + temp{9}, p{0}.reserve, ), Expr(7), ), ( AssignExpr( - temp{14}, + temp{10}, 66, ), Expr(8), ), ], Assign( - temp{11}, + temp{7}, Call( - temp{12}, + temp{8}, [ - temp{13}, - temp{14}, + temp{9}, + temp{10}, ], [ None, @@ -147,96 +127,76 @@ 0, Expr(9), Some( - temp{11}, + temp{7}, ), ), Expr(9), ), ( Clear( - temp{14}, + temp{10}, ), Expr(8), ), ( Clear( - temp{13}, + temp{9}, ), Expr(7), ), ( Clear( - temp{12}, + temp{8}, ), Expr(6), ), ( AssignExpr( - temp{3}, - temp{11}.share, + q{1}, + temp{7}.share, ), Expr(10), ), ( Clear( - temp{11}, + temp{7}, ), Expr(9), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(11), - ), ( AssignExpr( - temp{10}, - (), - ), - Expr(11), - ), - ( - Clear( - temp{10}, - ), - Expr(11), - ), - ( - AssignExpr( - temp{17}, + temp{13}, Print.reserve, ), Expr(12), ), ( AssignExpr( - temp{19}, + temp{15}, "Hi", ), Expr(13), ), ( AssignExpr( - temp{18}, - Concatenate(temp{19}), + temp{14}, + Concatenate(temp{15}), ), Expr(14), ), ( Clear( - temp{19}, + temp{15}, ), Expr(13), ), ], Assign( - temp{16}, + temp{12}, Call( - temp{17}, + temp{13}, [ - temp{18}, + temp{14}, ], [ None, @@ -249,21 +209,21 @@ [ ( Clear( - temp{18}, + temp{14}, ), Expr(14), ), ( Clear( - temp{17}, + temp{13}, ), Expr(12), ), ], Assign( - temp{15}, + temp{11}, Await( - temp{16}, + temp{12}, ), BasicBlock(4), ), @@ -272,26 +232,26 @@ [ ( Clear( - temp{16}, + temp{12}, ), Expr(15), ), ( Clear( - temp{15}, + temp{11}, ), Expr(16), ), ( AssignExpr( - temp{4}, + temp{2}, (), ), Expr(17), ), ], Return( - temp{4}, + temp{2}, ), ), }, diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-2.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-2.ref index 3d9d2f0c..5a380848 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-2.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-2.ref @@ -13,8 +13,8 @@ digraph { - - + +
main
p
q
(in-flight)
q
(in-flight)
>; ]; @@ -36,7 +36,7 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; - "stack":20 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "stack":16 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; "afternode1":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; } subgraph cluster_before { @@ -50,7 +50,7 @@ digraph { - +
main
p
q
q
>; ]; diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref index b3e8ccfb..55976e75 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{7}, + temp{4}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{8}, + temp{5}, 22, ), Expr(1), ), ( AssignExpr( - temp{9}, + temp{6}, 44, ), Expr(2), ), ], Assign( - temp{6}, + temp{3}, Call( - temp{7}, + temp{4}, [ - temp{8}, - temp{9}, + temp{5}, + temp{6}, ], [ None, @@ -45,84 +45,64 @@ [ ( Clear( - temp{9}, + temp{6}, ), Expr(2), ), ( Clear( - temp{8}, + temp{5}, ), Expr(1), ), ( Clear( - temp{7}, + temp{4}, ), Expr(0), ), ( AssignExpr( - temp{1}, - temp{6}.share, + p{0}, + temp{3}.share, ), Expr(4), ), ( Clear( - temp{6}, + temp{3}, ), Expr(3), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(5), - ), ( AssignExpr( - temp{5}, - (), - ), - Expr(5), - ), - ( - Clear( - temp{5}, - ), - Expr(5), - ), - ( - AssignExpr( - temp{12}, + temp{8}, Class(Id { value: 1 }).reserve, ), Expr(6), ), ( AssignExpr( - temp{13}, + temp{9}, p{0}.reserve, ), Expr(7), ), ( AssignExpr( - temp{14}, + temp{10}, 66, ), Expr(8), ), ], Assign( - temp{11}, + temp{7}, Call( - temp{12}, + temp{8}, [ - temp{13}, - temp{14}, + temp{9}, + temp{10}, ], [ None, @@ -136,19 +116,19 @@ [ ( Clear( - temp{14}, + temp{10}, ), Expr(8), ), ( Clear( - temp{13}, + temp{9}, ), Expr(7), ), ( Clear( - temp{12}, + temp{8}, ), Expr(6), ), @@ -161,8 +141,8 @@ ), ( AssignExpr( - temp{3}, - temp{11}.share, + q{1}, + temp{7}.share, ), Expr(10), ), @@ -172,71 +152,51 @@ 0, Expr(10), Some( - temp{3}, + q{1}, ), ), Expr(10), ), ( Clear( - temp{11}, + temp{7}, ), Expr(9), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(11), - ), ( AssignExpr( - temp{10}, - (), - ), - Expr(11), - ), - ( - Clear( - temp{10}, - ), - Expr(11), - ), - ( - AssignExpr( - temp{17}, + temp{13}, Print.reserve, ), Expr(12), ), ( AssignExpr( - temp{19}, + temp{15}, "Hi", ), Expr(13), ), ( AssignExpr( - temp{18}, - Concatenate(temp{19}), + temp{14}, + Concatenate(temp{15}), ), Expr(14), ), ( Clear( - temp{19}, + temp{15}, ), Expr(13), ), ], Assign( - temp{16}, + temp{12}, Call( - temp{17}, + temp{13}, [ - temp{18}, + temp{14}, ], [ None, @@ -249,21 +209,21 @@ [ ( Clear( - temp{18}, + temp{14}, ), Expr(14), ), ( Clear( - temp{17}, + temp{13}, ), Expr(12), ), ], Assign( - temp{15}, + temp{11}, Await( - temp{16}, + temp{12}, ), BasicBlock(4), ), @@ -272,26 +232,26 @@ [ ( Clear( - temp{16}, + temp{12}, ), Expr(15), ), ( Clear( - temp{15}, + temp{11}, ), Expr(16), ), ( AssignExpr( - temp{4}, + temp{2}, (), ), Expr(17), ), ], Return( - temp{4}, + temp{2}, ), ), }, diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-3.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-3.ref index ff0d6146..45158841 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-3.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-3.ref @@ -13,8 +13,8 @@ digraph { - - + +
main
p
q
(in-flight)
q
(in-flight)
>; ]; @@ -38,7 +38,8 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; - "stack":20 -> "afternode1" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; + "afterstack":1 -> "afternode1" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; + "stack":16 -> "afternode1" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; "afternode1":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; } subgraph cluster_before { @@ -52,7 +53,7 @@ digraph { - +
main
p
q
q
>; ]; diff --git a/dada_tests/heap-graph/dag/HeapGraph-0.bir.ref b/dada_tests/heap-graph/dag/HeapGraph-0.bir.ref index 291a7195..10566491 100644 --- a/dada_tests/heap-graph/dag/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/dag/HeapGraph-0.bir.ref @@ -12,33 +12,33 @@ ), ( AssignExpr( - temp{7}, + temp{4}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{8}, + temp{5}, 22, ), Expr(1), ), ( AssignExpr( - temp{9}, + temp{6}, 44, ), Expr(2), ), ], Assign( - temp{6}, + temp{3}, Call( - temp{7}, + temp{4}, [ - temp{8}, - temp{9}, + temp{5}, + temp{6}, ], [ None, @@ -52,84 +52,64 @@ [ ( Clear( - temp{9}, + temp{6}, ), Expr(2), ), ( Clear( - temp{8}, + temp{5}, ), Expr(1), ), ( Clear( - temp{7}, + temp{4}, ), Expr(0), ), ( AssignExpr( - temp{1}, - temp{6}.share, + p{0}, + temp{3}.share, ), Expr(4), ), ( Clear( - temp{6}, + temp{3}, ), Expr(3), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(5), - ), - ( - AssignExpr( - temp{5}, - (), - ), - Expr(5), - ), - ( - Clear( - temp{5}, - ), - Expr(5), - ), ( AssignExpr( - temp{11}, + temp{7}, Class(Id { value: 1 }).reserve, ), Expr(6), ), ( AssignExpr( - temp{12}, + temp{8}, p{0}.reserve, ), Expr(7), ), ( AssignExpr( - temp{13}, + temp{9}, p{0}.reserve, ), Expr(8), ), ], Assign( - temp{3}, + q{1}, Call( - temp{11}, + temp{7}, [ - temp{12}, - temp{13}, + temp{8}, + temp{9}, ], [ None, @@ -143,45 +123,25 @@ [ ( Clear( - temp{13}, + temp{9}, ), Expr(8), ), ( Clear( - temp{12}, + temp{8}, ), Expr(7), ), ( Clear( - temp{11}, + temp{7}, ), Expr(6), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(10), - ), ( AssignExpr( - temp{10}, - (), - ), - Expr(10), - ), - ( - Clear( - temp{10}, - ), - Expr(10), - ), - ( - AssignExpr( - temp{4}, + temp{2}, (), ), Expr(11), @@ -192,14 +152,14 @@ 0, Expr(11), Some( - temp{4}, + temp{2}, ), ), Expr(11), ), ], Return( - temp{4}, + temp{2}, ), ), }, diff --git a/dada_tests/heap-graph/dag/HeapGraph-0.ref b/dada_tests/heap-graph/dag/HeapGraph-0.ref index af12e268..e489d91f 100644 --- a/dada_tests/heap-graph/dag/HeapGraph-0.ref +++ b/dada_tests/heap-graph/dag/HeapGraph-0.ref @@ -13,8 +13,8 @@ digraph { - - + +
main
p
q
(in-flight): "()"
q
(in-flight): "()"
>; ]; @@ -34,7 +34,7 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; - "afterstack":2 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "afterstack":1 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; "afternode1":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; "afternode1":1 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; } @@ -49,7 +49,7 @@ digraph { - +
main
p
q
q
>; ]; diff --git a/dada_tests/heap-graph/leased-point/HeapGraph-0.bir.ref b/dada_tests/heap-graph/leased-point/HeapGraph-0.bir.ref index 1b6f2d1f..d233fb90 100644 --- a/dada_tests/heap-graph/leased-point/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/leased-point/HeapGraph-0.bir.ref @@ -12,33 +12,33 @@ ), ( AssignExpr( - temp{6}, + temp{3}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{7}, + temp{4}, 22, ), Expr(1), ), ( AssignExpr( - temp{8}, + temp{5}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{6}, + temp{3}, [ - temp{7}, - temp{8}, + temp{4}, + temp{5}, ], [ None, @@ -52,71 +52,51 @@ [ ( Clear( - temp{8}, + temp{5}, ), Expr(2), ), ( Clear( - temp{7}, + temp{4}, ), Expr(1), ), ( Clear( - temp{6}, + temp{3}, ), Expr(0), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{5}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{5}, - ), - Expr(4), - ), ( AssignExpr( - temp{10}, + temp{6}, Class(Id { value: 1 }).reserve, ), Expr(5), ), ( AssignExpr( - temp{11}, + temp{7}, p{0}.lease, ), Expr(7), ), ( AssignExpr( - temp{12}, + temp{8}, 66, ), Expr(8), ), ], Assign( - temp{3}, + q{1}, Call( - temp{10}, + temp{6}, [ - temp{11}, - temp{12}, + temp{7}, + temp{8}, ], [ None, @@ -130,45 +110,25 @@ [ ( Clear( - temp{12}, + temp{8}, ), Expr(8), ), ( Clear( - temp{11}, + temp{7}, ), Expr(7), ), ( Clear( - temp{10}, + temp{6}, ), Expr(5), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(10), - ), ( AssignExpr( - temp{9}, - (), - ), - Expr(10), - ), - ( - Clear( - temp{9}, - ), - Expr(10), - ), - ( - AssignExpr( - temp{4}, + temp{2}, (), ), Expr(11), @@ -179,14 +139,14 @@ 0, Expr(11), Some( - temp{4}, + temp{2}, ), ), Expr(11), ), ], Return( - temp{4}, + temp{2}, ), ), }, diff --git a/dada_tests/heap-graph/leased-point/HeapGraph-0.ref b/dada_tests/heap-graph/leased-point/HeapGraph-0.ref index 758a4c05..51c9f2f4 100644 --- a/dada_tests/heap-graph/leased-point/HeapGraph-0.ref +++ b/dada_tests/heap-graph/leased-point/HeapGraph-0.ref @@ -13,8 +13,8 @@ digraph { - - + +
main
p
q
(in-flight): "()"
q
(in-flight): "()"
>; ]; @@ -34,7 +34,7 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "afterstack":2 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "afterstack":1 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; "afternode1":0 -> "afternode0" [label="leased", style="solid", penwidth=1.0, arrowtype="empty", color="red"]; } subgraph cluster_before { @@ -48,7 +48,7 @@ digraph { - +
main
p
q
q
>; ]; diff --git a/dada_tests/heap-graph/line-end/HeapGraph-0.bir.ref b/dada_tests/heap-graph/line-end/HeapGraph-0.bir.ref index fa190731..628713b1 100644 --- a/dada_tests/heap-graph/line-end/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/line-end/HeapGraph-0.bir.ref @@ -12,7 +12,7 @@ ), ( AssignExpr( - temp{1}, + x{0}, 22, ), Expr(0), @@ -23,68 +23,28 @@ 0, Expr(0), Some( - temp{1}, + x{0}, ), ), Expr(0), ), - ( - AssignPlace( - x{0}, - temp{1}, - ), - Expr(1), - ), - ( - AssignExpr( - temp{5}, - (), - ), - Expr(1), - ), - ( - Clear( - temp{5}, - ), - Expr(1), - ), ( AssignExpr( - temp{3}, + y{1}, 44, ), Expr(2), ), - ( - AssignPlace( - y{2}, - temp{3}, - ), - Expr(3), - ), - ( - AssignExpr( - temp{6}, - (), - ), - Expr(3), - ), - ( - Clear( - temp{6}, - ), - Expr(3), - ), ( AssignExpr( - temp{4}, + temp{2}, (), ), Expr(4), ), ], Return( - temp{4}, + temp{2}, ), ), }, diff --git a/dada_tests/heap-graph/line-end/HeapGraph-0.ref b/dada_tests/heap-graph/line-end/HeapGraph-0.ref index 8ef06704..f12dee04 100644 --- a/dada_tests/heap-graph/line-end/HeapGraph-0.ref +++ b/dada_tests/heap-graph/line-end/HeapGraph-0.ref @@ -12,9 +12,9 @@ digraph { label=< - - - + + +
main
x
y
(in-flight): "22"
x: "22"
y
(in-flight): "22"
>; ]; @@ -31,7 +31,7 @@ digraph { - +
main
x
y
y
>; ]; diff --git a/dada_tests/heap-graph/line-end/HeapGraph-1.bir.ref b/dada_tests/heap-graph/line-end/HeapGraph-1.bir.ref index f42d52b7..26b58642 100644 --- a/dada_tests/heap-graph/line-end/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/line-end/HeapGraph-1.bir.ref @@ -12,61 +12,21 @@ ), ( AssignExpr( - temp{1}, + x{0}, 22, ), Expr(0), ), - ( - AssignPlace( - x{0}, - temp{1}, - ), - Expr(1), - ), - ( - AssignExpr( - temp{5}, - (), - ), - Expr(1), - ), - ( - Clear( - temp{5}, - ), - Expr(1), - ), ( AssignExpr( - temp{3}, + y{1}, 44, ), Expr(2), ), - ( - AssignPlace( - y{2}, - temp{3}, - ), - Expr(3), - ), - ( - AssignExpr( - temp{6}, - (), - ), - Expr(3), - ), - ( - Clear( - temp{6}, - ), - Expr(3), - ), ( AssignExpr( - temp{4}, + temp{2}, (), ), Expr(4), @@ -77,14 +37,14 @@ 0, Expr(4), Some( - temp{4}, + temp{2}, ), ), Expr(4), ), ], Return( - temp{4}, + temp{2}, ), ), }, diff --git a/dada_tests/heap-graph/line-end/HeapGraph-1.ref b/dada_tests/heap-graph/line-end/HeapGraph-1.ref index f37a11c1..385b39e7 100644 --- a/dada_tests/heap-graph/line-end/HeapGraph-1.ref +++ b/dada_tests/heap-graph/line-end/HeapGraph-1.ref @@ -13,8 +13,8 @@ digraph { - - + +
main
x: "22"
y: "44"
(in-flight): "()"
y: "44"
(in-flight): "()"
>; ]; @@ -31,7 +31,7 @@ digraph { - +
main
x
y
y
>; ]; diff --git a/dada_tests/heap-graph/line-start/HeapGraph-0.bir.ref b/dada_tests/heap-graph/line-start/HeapGraph-0.bir.ref index 920a8bea..d57ba5e2 100644 --- a/dada_tests/heap-graph/line-start/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/line-start/HeapGraph-0.bir.ref @@ -12,7 +12,7 @@ ), ( AssignExpr( - temp{6}, + temp{3}, Class(Id { value: 1 }).reserve, ), Expr(0), @@ -23,33 +23,33 @@ 0, Expr(0), Some( - temp{6}, + temp{3}, ), ), Expr(0), ), ( AssignExpr( - temp{7}, + temp{4}, 22, ), Expr(1), ), ( AssignExpr( - temp{8}, + temp{5}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{6}, + temp{3}, [ - temp{7}, - temp{8}, + temp{4}, + temp{5}, ], [ None, @@ -63,71 +63,51 @@ [ ( Clear( - temp{8}, + temp{5}, ), Expr(2), ), ( Clear( - temp{7}, + temp{4}, ), Expr(1), ), ( Clear( - temp{6}, + temp{3}, ), Expr(0), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{5}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{5}, - ), - Expr(4), - ), ( AssignExpr( - temp{10}, + temp{6}, Class(Id { value: 1 }).reserve, ), Expr(5), ), ( AssignExpr( - temp{11}, + temp{7}, p{0}.reserve, ), Expr(6), ), ( AssignExpr( - temp{12}, + temp{8}, 66, ), Expr(7), ), ], Assign( - temp{3}, + q{1}, Call( - temp{10}, + temp{6}, [ - temp{11}, - temp{12}, + temp{7}, + temp{8}, ], [ None, @@ -141,52 +121,32 @@ [ ( Clear( - temp{12}, + temp{8}, ), Expr(7), ), ( Clear( - temp{11}, + temp{7}, ), Expr(6), ), ( Clear( - temp{10}, + temp{6}, ), Expr(5), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(9), - ), ( AssignExpr( - temp{9}, - (), - ), - Expr(9), - ), - ( - Clear( - temp{9}, - ), - Expr(9), - ), - ( - AssignExpr( - temp{4}, + temp{2}, (), ), Expr(10), ), ], Return( - temp{4}, + temp{2}, ), ), }, diff --git a/dada_tests/heap-graph/line-start/HeapGraph-0.ref b/dada_tests/heap-graph/line-start/HeapGraph-0.ref index 832c53e2..18956d3d 100644 --- a/dada_tests/heap-graph/line-start/HeapGraph-0.ref +++ b/dada_tests/heap-graph/line-start/HeapGraph-0.ref @@ -13,8 +13,8 @@ digraph { - - + +
main
p
q
(in-flight)
q
(in-flight)
>; ]; @@ -24,7 +24,7 @@ digraph { fontcolor = "slategray", label = <Point> ]; - "stack":13 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; + "stack":9 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; } subgraph cluster_before { label=<before> @@ -37,7 +37,7 @@ digraph { - +
main
p
q
q
>; ]; diff --git a/dada_tests/heap-graph/line-start/HeapGraph-1.bir.ref b/dada_tests/heap-graph/line-start/HeapGraph-1.bir.ref index ba6df95c..826b9dac 100644 --- a/dada_tests/heap-graph/line-start/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/line-start/HeapGraph-1.bir.ref @@ -3,35 +3,42 @@ start_basic_block: BasicBlock(0), BasicBlock(0): BasicBlockData( [ + ( + BreakpoingStart( + "class", + 0, + ), + Expr(4), + ), ( AssignExpr( - temp{6}, + temp{3}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{7}, + temp{4}, 22, ), Expr(1), ), ( AssignExpr( - temp{8}, + temp{5}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{6}, + temp{3}, [ - temp{7}, - temp{8}, + temp{4}, + temp{5}, ], [ None, @@ -45,36 +52,22 @@ [ ( Clear( - temp{8}, + temp{5}, ), Expr(2), ), ( Clear( - temp{7}, + temp{4}, ), Expr(1), ), ( Clear( - temp{6}, + temp{3}, ), Expr(0), ), - ( - BreakpoingStart( - "class", - 0, - ), - Expr(4), - ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), ( BreakpointEnd( "class", @@ -86,46 +79,33 @@ ), ( AssignExpr( - temp{5}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{5}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{10}, + temp{6}, Class(Id { value: 1 }).reserve, ), Expr(5), ), ( AssignExpr( - temp{11}, + temp{7}, p{0}.reserve, ), Expr(6), ), ( AssignExpr( - temp{12}, + temp{8}, 66, ), Expr(7), ), ], Assign( - temp{3}, + q{1}, Call( - temp{10}, + temp{6}, [ - temp{11}, - temp{12}, + temp{7}, + temp{8}, ], [ None, @@ -139,52 +119,32 @@ [ ( Clear( - temp{12}, + temp{8}, ), Expr(7), ), ( Clear( - temp{11}, + temp{7}, ), Expr(6), ), ( Clear( - temp{10}, + temp{6}, ), Expr(5), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(9), - ), ( AssignExpr( - temp{9}, - (), - ), - Expr(9), - ), - ( - Clear( - temp{9}, - ), - Expr(9), - ), - ( - AssignExpr( - temp{4}, + temp{2}, (), ), Expr(10), ), ], Return( - temp{4}, + temp{2}, ), ), }, diff --git a/dada_tests/heap-graph/line-start/HeapGraph-1.ref b/dada_tests/heap-graph/line-start/HeapGraph-1.ref index 6c8c4f2f..6a7cedf1 100644 --- a/dada_tests/heap-graph/line-start/HeapGraph-1.ref +++ b/dada_tests/heap-graph/line-start/HeapGraph-1.ref @@ -13,18 +13,16 @@ digraph { - +
main
p
q
q
>; ]; } afternode0 [ - color = "slategray", - fontcolor = "slategray", label = < - - + +
Point
x: "22"
y: "44"
x: "22"
y: "44"
> ]; "afterstack":0 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; @@ -40,7 +38,7 @@ digraph { - +
main
p
q
q
>; ]; diff --git a/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref b/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref index 7480407b..0481accb 100644 --- a/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{8}, + temp{5}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{9}, + temp{6}, 22, ), Expr(1), ), ( AssignExpr( - temp{10}, + temp{7}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{8}, + temp{5}, [ - temp{9}, - temp{10}, + temp{6}, + temp{7}, ], [ None, @@ -45,106 +45,66 @@ [ ( Clear( - temp{10}, + temp{7}, ), Expr(2), ), ( Clear( - temp{9}, + temp{6}, ), Expr(1), ), ( Clear( - temp{8}, + temp{5}, ), Expr(0), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{7}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{7}, - ), - Expr(4), - ), ( AssignExpr( - temp{3}, + q{1}, p{0}.lease, ), Expr(6), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(7), - ), - ( - AssignExpr( - temp{11}, - (), - ), - Expr(7), - ), - ( - Clear( - temp{11}, - ), - Expr(7), - ), ( AssignExpr( - temp{4}, - q{2}.lease, + temp{2}, + q{1}.lease, ), Expr(8), ), ( AssignExpr( - temp{13}, - temp{4}.x.give, + temp{9}, + temp{2}.x.give, ), Expr(9), ), ( AssignExpr( - temp{14}, + temp{10}, 1, ), Expr(10), ), ( AssignExpr( - temp{5}, - temp{13} + temp{14}, + temp{3}, + temp{9} + temp{10}, ), Expr(11), ), ( Clear( - temp{14}, + temp{10}, ), Expr(10), ), ( Clear( - temp{13}, + temp{9}, ), Expr(9), ), @@ -156,9 +116,9 @@ Expr(9), ), ( - AssignPlace( - temp{4}.x, - temp{5}, + AssignExpr( + temp{2}.x, + temp{3}.give, ), Expr(11), ), @@ -173,38 +133,38 @@ ), ( AssignExpr( - temp{12}, + temp{8}, (), ), Expr(11), ), ( Clear( - temp{12}, + temp{8}, ), Expr(11), ), ( AssignExpr( - temp{17}, + temp{13}, Print.reserve, ), Expr(12), ), ( AssignExpr( - temp{18}, - q{2}.reserve, + temp{14}, + q{1}.reserve, ), Expr(13), ), ], Assign( - temp{16}, + temp{12}, Call( - temp{17}, + temp{13}, [ - temp{18}, + temp{14}, ], [ None, @@ -217,21 +177,21 @@ [ ( Clear( - temp{18}, + temp{14}, ), Expr(13), ), ( Clear( - temp{17}, + temp{13}, ), Expr(12), ), ], Assign( - temp{15}, + temp{11}, Await( - temp{16}, + temp{12}, ), BasicBlock(3), ), @@ -240,26 +200,26 @@ [ ( Clear( - temp{16}, + temp{12}, ), Expr(14), ), ( Clear( - temp{15}, + temp{11}, ), Expr(15), ), ( AssignExpr( - temp{6}, + temp{4}, (), ), Expr(16), ), ], Return( - temp{6}, + temp{4}, ), ), }, diff --git a/dada_tests/heap-graph/mid-increment/HeapGraph-0.ref b/dada_tests/heap-graph/mid-increment/HeapGraph-0.ref index f92c9c1c..23751d8c 100644 --- a/dada_tests/heap-graph/mid-increment/HeapGraph-0.ref +++ b/dada_tests/heap-graph/mid-increment/HeapGraph-0.ref @@ -13,7 +13,7 @@ digraph { - +
main
p
q
q
>; ]; @@ -26,7 +26,7 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "afterstack":2 -> "afternode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; + "afterstack":1 -> "afternode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; } subgraph cluster_before { label=<before> @@ -39,7 +39,7 @@ digraph { - +
main
p
q
q
>; ]; @@ -52,7 +52,7 @@ digraph { > ]; "beforestack":0 -> "beforenode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "beforestack":2 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; + "beforestack":1 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; } } leased Point(23, 44) diff --git a/dada_tests/heap-graph/nested-functions/HeapGraph-0.bir.ref b/dada_tests/heap-graph/nested-functions/HeapGraph-0.bir.ref index aaab5dab..b2952bd6 100644 --- a/dada_tests/heap-graph/nested-functions/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/nested-functions/HeapGraph-0.bir.ref @@ -5,56 +5,36 @@ [ ( AssignExpr( - temp{4}, + temp{2}, "Fellow Dadaist", ), Expr(0), ), ( AssignExpr( - temp{1}, - Concatenate(temp{4}), + name{0}, + Concatenate(temp{2}), ), Expr(1), ), ( Clear( - temp{4}, + temp{2}, ), Expr(0), ), - ( - AssignPlace( - name{0}, - temp{1}, - ), - Expr(2), - ), ( AssignExpr( - temp{3}, - (), - ), - Expr(2), - ), - ( - Clear( - temp{3}, - ), - Expr(2), - ), - ( - AssignExpr( - temp{7}, + temp{5}, helper.reserve, ), Expr(3), ), ], Assign( - temp{6}, + temp{4}, Call( - temp{7}, + temp{5}, [], [], ), @@ -65,15 +45,15 @@ [ ( Clear( - temp{7}, + temp{5}, ), Expr(3), ), ], Assign( - temp{5}, + temp{3}, Await( - temp{6}, + temp{4}, ), BasicBlock(2), ), @@ -82,50 +62,50 @@ [ ( Clear( - temp{6}, + temp{4}, ), Expr(4), ), ( Clear( - temp{5}, + temp{3}, ), Expr(5), ), ( AssignExpr( - temp{10}, + temp{8}, Print.reserve, ), Expr(6), ), ( AssignExpr( - temp{12}, + temp{10}, "Hello", ), Expr(7), ), ( AssignExpr( - temp{11}, - Concatenate(temp{12}), + temp{9}, + Concatenate(temp{10}), ), Expr(8), ), ( Clear( - temp{12}, + temp{10}, ), Expr(7), ), ], Assign( - temp{9}, + temp{7}, Call( - temp{10}, + temp{8}, [ - temp{11}, + temp{9}, ], [ None, @@ -138,21 +118,21 @@ [ ( Clear( - temp{11}, + temp{9}, ), Expr(8), ), ( Clear( - temp{10}, + temp{8}, ), Expr(6), ), ], Assign( - temp{8}, + temp{6}, Await( - temp{9}, + temp{7}, ), BasicBlock(4), ), @@ -161,37 +141,37 @@ [ ( Clear( - temp{9}, + temp{7}, ), Expr(9), ), ( Clear( - temp{8}, + temp{6}, ), Expr(10), ), ( AssignExpr( - temp{15}, + temp{13}, Print.reserve, ), Expr(11), ), ( AssignExpr( - temp{16}, + temp{14}, name{0}.reserve, ), Expr(12), ), ], Assign( - temp{14}, + temp{12}, Call( - temp{15}, + temp{13}, [ - temp{16}, + temp{14}, ], [ None, @@ -204,21 +184,21 @@ [ ( Clear( - temp{16}, + temp{14}, ), Expr(12), ), ( Clear( - temp{15}, + temp{13}, ), Expr(11), ), ], Assign( - temp{13}, + temp{11}, Await( - temp{14}, + temp{12}, ), BasicBlock(6), ), @@ -227,26 +207,26 @@ [ ( Clear( - temp{14}, + temp{12}, ), Expr(13), ), ( Clear( - temp{13}, + temp{11}, ), Expr(14), ), ( AssignExpr( - temp{2}, + temp{1}, (), ), Expr(15), ), ], Return( - temp{2}, + temp{1}, ), ), }, @@ -256,33 +236,33 @@ [ ( AssignExpr( - temp{6}, + temp{3}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{7}, + temp{4}, 22, ), Expr(1), ), ( AssignExpr( - temp{8}, + temp{5}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{6}, + temp{3}, [ - temp{7}, - temp{8}, + temp{4}, + temp{5}, ], [ None, @@ -296,42 +276,22 @@ [ ( Clear( - temp{8}, + temp{5}, ), Expr(2), ), ( Clear( - temp{7}, + temp{4}, ), Expr(1), ), ( Clear( - temp{6}, + temp{3}, ), Expr(0), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{5}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{5}, - ), - Expr(4), - ), ( BreakpoingStart( "class", @@ -341,33 +301,33 @@ ), ( AssignExpr( - temp{10}, + temp{6}, Class(Id { value: 1 }).reserve, ), Expr(5), ), ( AssignExpr( - temp{11}, + temp{7}, p{0}.reserve, ), Expr(6), ), ( AssignExpr( - temp{12}, + temp{8}, 66, ), Expr(7), ), ], Assign( - temp{3}, + q{1}, Call( - temp{10}, + temp{6}, [ - temp{11}, - temp{12}, + temp{7}, + temp{8}, ], [ None, @@ -385,59 +345,39 @@ 0, Expr(8), Some( - temp{3}, + q{1}, ), ), Expr(8), ), ( Clear( - temp{12}, + temp{8}, ), Expr(7), ), ( Clear( - temp{11}, + temp{7}, ), Expr(6), ), ( Clear( - temp{10}, + temp{6}, ), Expr(5), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(9), - ), - ( - AssignExpr( - temp{9}, - (), - ), - Expr(9), - ), - ( - Clear( - temp{9}, - ), - Expr(9), - ), ( AssignExpr( - temp{4}, + temp{2}, (), ), Expr(10), ), ], Return( - temp{4}, + temp{2}, ), ), }, diff --git a/dada_tests/heap-graph/nested-functions/HeapGraph-0.ref b/dada_tests/heap-graph/nested-functions/HeapGraph-0.ref index cf9fbd2b..e5e7df6d 100644 --- a/dada_tests/heap-graph/nested-functions/HeapGraph-0.ref +++ b/dada_tests/heap-graph/nested-functions/HeapGraph-0.ref @@ -14,9 +14,9 @@ digraph { main name: "Fellow Dadaist" helper - p - q - (in-flight) + p + q + (in-flight) >; ]; @@ -37,7 +37,8 @@ digraph { y: "44" > ]; - "stack":30 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "afterstack":16 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "stack":24 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; "afternode0":0 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; } subgraph cluster_before { @@ -52,8 +53,8 @@ digraph { main name: "Fellow Dadaist" helper - p - q + p + q >; ]; @@ -67,7 +68,7 @@ digraph { y: "44" > ]; - "beforestack":17 -> "beforenode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "beforestack":15 -> "beforenode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; } } Hello diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-0.bir.ref b/dada_tests/heap-graph/nested-points/HeapGraph-0.bir.ref index 8ee7dd5b..aff0051e 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-0.bir.ref @@ -12,33 +12,33 @@ ), ( AssignExpr( - temp{6}, + temp{3}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{7}, + temp{4}, 22, ), Expr(1), ), ( AssignExpr( - temp{8}, + temp{5}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{6}, + temp{3}, [ - temp{7}, - temp{8}, + temp{4}, + temp{5}, ], [ None, @@ -56,78 +56,58 @@ 0, Expr(3), Some( - temp{1}, + p{0}, ), ), Expr(3), ), ( Clear( - temp{8}, + temp{5}, ), Expr(2), ), ( Clear( - temp{7}, + temp{4}, ), Expr(1), ), ( Clear( - temp{6}, + temp{3}, ), Expr(0), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{5}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{5}, - ), - Expr(4), - ), ( AssignExpr( - temp{10}, + temp{6}, Class(Id { value: 1 }).reserve, ), Expr(5), ), ( AssignExpr( - temp{11}, + temp{7}, p{0}.reserve, ), Expr(6), ), ( AssignExpr( - temp{12}, + temp{8}, 66, ), Expr(7), ), ], Assign( - temp{3}, + q{1}, Call( - temp{10}, + temp{6}, [ - temp{11}, - temp{12}, + temp{7}, + temp{8}, ], [ None, @@ -141,52 +121,32 @@ [ ( Clear( - temp{12}, + temp{8}, ), Expr(7), ), ( Clear( - temp{11}, + temp{7}, ), Expr(6), ), ( Clear( - temp{10}, + temp{6}, ), Expr(5), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(9), - ), ( AssignExpr( - temp{9}, - (), - ), - Expr(9), - ), - ( - Clear( - temp{9}, - ), - Expr(9), - ), - ( - AssignExpr( - temp{4}, + temp{2}, (), ), Expr(10), ), ], Return( - temp{4}, + temp{2}, ), ), }, diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-0.ref b/dada_tests/heap-graph/nested-points/HeapGraph-0.ref index 55264d08..f227934d 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-0.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-0.ref @@ -12,9 +12,9 @@ digraph { label=< - - - + + +
main
p
q
(in-flight)
p
q
(in-flight)
>; ]; @@ -26,7 +26,8 @@ digraph { y: "44" > ]; - "stack":13 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "afterstack":0 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "stack":9 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; } subgraph cluster_before { label=<before> @@ -39,7 +40,7 @@ digraph { - +
main
p
q
q
>; ]; diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-1.bir.ref b/dada_tests/heap-graph/nested-points/HeapGraph-1.bir.ref index ba6df95c..826b9dac 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-1.bir.ref @@ -3,35 +3,42 @@ start_basic_block: BasicBlock(0), BasicBlock(0): BasicBlockData( [ + ( + BreakpoingStart( + "class", + 0, + ), + Expr(4), + ), ( AssignExpr( - temp{6}, + temp{3}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{7}, + temp{4}, 22, ), Expr(1), ), ( AssignExpr( - temp{8}, + temp{5}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{6}, + temp{3}, [ - temp{7}, - temp{8}, + temp{4}, + temp{5}, ], [ None, @@ -45,36 +52,22 @@ [ ( Clear( - temp{8}, + temp{5}, ), Expr(2), ), ( Clear( - temp{7}, + temp{4}, ), Expr(1), ), ( Clear( - temp{6}, + temp{3}, ), Expr(0), ), - ( - BreakpoingStart( - "class", - 0, - ), - Expr(4), - ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), ( BreakpointEnd( "class", @@ -86,46 +79,33 @@ ), ( AssignExpr( - temp{5}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{5}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{10}, + temp{6}, Class(Id { value: 1 }).reserve, ), Expr(5), ), ( AssignExpr( - temp{11}, + temp{7}, p{0}.reserve, ), Expr(6), ), ( AssignExpr( - temp{12}, + temp{8}, 66, ), Expr(7), ), ], Assign( - temp{3}, + q{1}, Call( - temp{10}, + temp{6}, [ - temp{11}, - temp{12}, + temp{7}, + temp{8}, ], [ None, @@ -139,52 +119,32 @@ [ ( Clear( - temp{12}, + temp{8}, ), Expr(7), ), ( Clear( - temp{11}, + temp{7}, ), Expr(6), ), ( Clear( - temp{10}, + temp{6}, ), Expr(5), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(9), - ), ( AssignExpr( - temp{9}, - (), - ), - Expr(9), - ), - ( - Clear( - temp{9}, - ), - Expr(9), - ), - ( - AssignExpr( - temp{4}, + temp{2}, (), ), Expr(10), ), ], Return( - temp{4}, + temp{2}, ), ), }, diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-1.ref b/dada_tests/heap-graph/nested-points/HeapGraph-1.ref index 1361e3fa..6f0ede32 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-1.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-1.ref @@ -13,18 +13,16 @@ digraph { - +
main
p
q
q
>; ]; } afternode0 [ - color = "slategray", - fontcolor = "slategray", label = < - - + +
Point
x: "22"
y: "44"
x: "22"
y: "44"
> ]; "afterstack":0 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; @@ -40,7 +38,7 @@ digraph { - +
main
p
q
q
>; ]; diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-2.bir.ref b/dada_tests/heap-graph/nested-points/HeapGraph-2.bir.ref index 59fadece..cf212bac 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-2.bir.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-2.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{6}, + temp{3}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{7}, + temp{4}, 22, ), Expr(1), ), ( AssignExpr( - temp{8}, + temp{5}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{6}, + temp{3}, [ - temp{7}, - temp{8}, + temp{4}, + temp{5}, ], [ None, @@ -45,45 +45,25 @@ [ ( Clear( - temp{8}, + temp{5}, ), Expr(2), ), ( Clear( - temp{7}, + temp{4}, ), Expr(1), ), ( Clear( - temp{6}, + temp{3}, ), Expr(0), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{5}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{5}, - ), - Expr(4), - ), ( AssignExpr( - temp{10}, + temp{6}, Class(Id { value: 1 }).reserve, ), Expr(5), @@ -97,7 +77,7 @@ ), ( AssignExpr( - temp{11}, + temp{7}, p{0}.reserve, ), Expr(6), @@ -108,26 +88,26 @@ 0, Expr(6), Some( - temp{11}, + temp{7}, ), ), Expr(6), ), ( AssignExpr( - temp{12}, + temp{8}, 66, ), Expr(7), ), ], Assign( - temp{3}, + q{1}, Call( - temp{10}, + temp{6}, [ - temp{11}, - temp{12}, + temp{7}, + temp{8}, ], [ None, @@ -141,52 +121,32 @@ [ ( Clear( - temp{12}, + temp{8}, ), Expr(7), ), ( Clear( - temp{11}, + temp{7}, ), Expr(6), ), ( Clear( - temp{10}, + temp{6}, ), Expr(5), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(9), - ), ( AssignExpr( - temp{9}, - (), - ), - Expr(9), - ), - ( - Clear( - temp{9}, - ), - Expr(9), - ), - ( - AssignExpr( - temp{4}, + temp{2}, (), ), Expr(10), ), ], Return( - temp{4}, + temp{2}, ), ), }, diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-2.ref b/dada_tests/heap-graph/nested-points/HeapGraph-2.ref index cf7c9f81..98ddc0e1 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-2.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-2.ref @@ -13,8 +13,8 @@ digraph { - - + +
main
p
q
(in-flight)
q
(in-flight)
>; ]; @@ -35,7 +35,7 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; - "stack":13 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "stack":9 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; "afternode1":0 -> "afternode0" [label="reserved", style="solid", penwidth=1.0, arrowtype="odot", color="grey"]; } subgraph cluster_before { @@ -49,7 +49,7 @@ digraph { - +
main
p
q
q
>; ]; diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-0.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-0.bir.ref index b94e5ae5..ca5f35c4 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-0.bir.ref @@ -12,7 +12,7 @@ ), ( AssignExpr( - temp{4}, + temp{2}, Class(Id { value: 1 }).reserve, ), Expr(0), @@ -23,33 +23,33 @@ 0, Expr(0), Some( - temp{4}, + temp{2}, ), ), Expr(0), ), ( AssignExpr( - temp{5}, + temp{3}, 22, ), Expr(1), ), ( AssignExpr( - temp{6}, + temp{4}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{4}, + temp{2}, [ - temp{5}, - temp{6}, + temp{3}, + temp{4}, ], [ Some( @@ -67,76 +67,56 @@ [ ( Clear( - temp{6}, + temp{4}, ), Expr(2), ), ( Clear( - temp{5}, + temp{3}, ), Expr(1), ), ( Clear( - temp{4}, + temp{2}, ), Expr(0), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{3}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{3}, - ), - Expr(4), - ), ( AssignExpr( - temp{9}, + temp{7}, Print.reserve, ), Expr(5), ), ( AssignExpr( - temp{11}, + temp{9}, "The point is FIXME", ), Expr(6), ), ( AssignExpr( - temp{10}, - Concatenate(temp{11}), + temp{8}, + Concatenate(temp{9}), ), Expr(7), ), ( Clear( - temp{11}, + temp{9}, ), Expr(6), ), ], Assign( - temp{8}, + temp{6}, Call( - temp{9}, + temp{7}, [ - temp{10}, + temp{8}, ], [ None, @@ -149,21 +129,21 @@ [ ( Clear( - temp{10}, + temp{8}, ), Expr(7), ), ( Clear( - temp{9}, + temp{7}, ), Expr(5), ), ], Assign( - temp{7}, + temp{5}, Await( - temp{8}, + temp{6}, ), BasicBlock(3), ), @@ -172,26 +152,26 @@ [ ( Clear( - temp{8}, + temp{6}, ), Expr(8), ), ( Clear( - temp{7}, + temp{5}, ), Expr(9), ), ( AssignExpr( - temp{2}, + temp{1}, (), ), Expr(10), ), ], Return( - temp{2}, + temp{1}, ), ), }, diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-0.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-0.ref index e8919418..e5f8c01f 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-0.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-0.ref @@ -13,7 +13,7 @@ digraph { - +
main
p
(in-flight)
(in-flight)
>; ]; @@ -23,7 +23,7 @@ digraph { fontcolor = "slategray", label = <Point> ]; - "stack":12 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; + "stack":10 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; } subgraph cluster_before { label=<before> diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-1.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-1.bir.ref index 3a32b577..8b123814 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-1.bir.ref @@ -5,7 +5,7 @@ [ ( AssignExpr( - temp{4}, + temp{2}, Class(Id { value: 1 }).reserve, ), Expr(0), @@ -19,7 +19,7 @@ ), ( AssignExpr( - temp{5}, + temp{3}, 22, ), Expr(1), @@ -30,26 +30,26 @@ 0, Expr(1), Some( - temp{5}, + temp{3}, ), ), Expr(1), ), ( AssignExpr( - temp{6}, + temp{4}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{4}, + temp{2}, [ - temp{5}, - temp{6}, + temp{3}, + temp{4}, ], [ Some( @@ -67,76 +67,56 @@ [ ( Clear( - temp{6}, + temp{4}, ), Expr(2), ), ( Clear( - temp{5}, + temp{3}, ), Expr(1), ), ( Clear( - temp{4}, + temp{2}, ), Expr(0), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{3}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{3}, - ), - Expr(4), - ), ( AssignExpr( - temp{9}, + temp{7}, Print.reserve, ), Expr(5), ), ( AssignExpr( - temp{11}, + temp{9}, "The point is FIXME", ), Expr(6), ), ( AssignExpr( - temp{10}, - Concatenate(temp{11}), + temp{8}, + Concatenate(temp{9}), ), Expr(7), ), ( Clear( - temp{11}, + temp{9}, ), Expr(6), ), ], Assign( - temp{8}, + temp{6}, Call( - temp{9}, + temp{7}, [ - temp{10}, + temp{8}, ], [ None, @@ -149,21 +129,21 @@ [ ( Clear( - temp{10}, + temp{8}, ), Expr(7), ), ( Clear( - temp{9}, + temp{7}, ), Expr(5), ), ], Assign( - temp{7}, + temp{5}, Await( - temp{8}, + temp{6}, ), BasicBlock(3), ), @@ -172,26 +152,26 @@ [ ( Clear( - temp{8}, + temp{6}, ), Expr(8), ), ( Clear( - temp{7}, + temp{5}, ), Expr(9), ), ( AssignExpr( - temp{2}, + temp{1}, (), ), Expr(10), ), ], Return( - temp{2}, + temp{1}, ), ), }, diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-1.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-1.ref index 1113e1bf..c72b06be 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-1.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-1.ref @@ -13,7 +13,7 @@ digraph { - +
main
p
(in-flight): "22"
(in-flight): "22"
>; ]; diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-2.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-2.bir.ref index a11563c6..cff1184f 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-2.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-2.bir.ref @@ -3,35 +3,42 @@ start_basic_block: BasicBlock(0), BasicBlock(0): BasicBlockData( [ + ( + BreakpoingStart( + "class", + 0, + ), + Expr(4), + ), ( AssignExpr( - temp{4}, + temp{2}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{5}, + temp{3}, 22, ), Expr(1), ), ( AssignExpr( - temp{6}, + temp{4}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{4}, + temp{2}, [ - temp{5}, - temp{6}, + temp{3}, + temp{4}, ], [ Some( @@ -49,36 +56,22 @@ [ ( Clear( - temp{6}, + temp{4}, ), Expr(2), ), ( Clear( - temp{5}, + temp{3}, ), Expr(1), ), ( Clear( - temp{4}, + temp{2}, ), Expr(0), ), - ( - BreakpoingStart( - "class", - 0, - ), - Expr(4), - ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), ( BreakpointEnd( "class", @@ -90,51 +83,38 @@ ), ( AssignExpr( - temp{3}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{3}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{9}, + temp{7}, Print.reserve, ), Expr(5), ), ( AssignExpr( - temp{11}, + temp{9}, "The point is FIXME", ), Expr(6), ), ( AssignExpr( - temp{10}, - Concatenate(temp{11}), + temp{8}, + Concatenate(temp{9}), ), Expr(7), ), ( Clear( - temp{11}, + temp{9}, ), Expr(6), ), ], Assign( - temp{8}, + temp{6}, Call( - temp{9}, + temp{7}, [ - temp{10}, + temp{8}, ], [ None, @@ -147,21 +127,21 @@ [ ( Clear( - temp{10}, + temp{8}, ), Expr(7), ), ( Clear( - temp{9}, + temp{7}, ), Expr(5), ), ], Assign( - temp{7}, + temp{5}, Await( - temp{8}, + temp{6}, ), BasicBlock(3), ), @@ -170,26 +150,26 @@ [ ( Clear( - temp{8}, + temp{6}, ), Expr(8), ), ( Clear( - temp{7}, + temp{5}, ), Expr(9), ), ( AssignExpr( - temp{2}, + temp{1}, (), ), Expr(10), ), ], Return( - temp{2}, + temp{1}, ), ), }, diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-2.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-2.ref index 4ddd15d0..6dd8627a 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-2.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-2.ref @@ -18,12 +18,10 @@ digraph { ]; } afternode0 [ - color = "slategray", - fontcolor = "slategray", label = < - - + +
Point
x: "22"
y: "44"
x: "22"
y: "44"
> ]; "afterstack":0 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-3.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-3.bir.ref index a11563c6..cff1184f 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-3.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-3.bir.ref @@ -3,35 +3,42 @@ start_basic_block: BasicBlock(0), BasicBlock(0): BasicBlockData( [ + ( + BreakpoingStart( + "class", + 0, + ), + Expr(4), + ), ( AssignExpr( - temp{4}, + temp{2}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{5}, + temp{3}, 22, ), Expr(1), ), ( AssignExpr( - temp{6}, + temp{4}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{4}, + temp{2}, [ - temp{5}, - temp{6}, + temp{3}, + temp{4}, ], [ Some( @@ -49,36 +56,22 @@ [ ( Clear( - temp{6}, + temp{4}, ), Expr(2), ), ( Clear( - temp{5}, + temp{3}, ), Expr(1), ), ( Clear( - temp{4}, + temp{2}, ), Expr(0), ), - ( - BreakpoingStart( - "class", - 0, - ), - Expr(4), - ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), ( BreakpointEnd( "class", @@ -90,51 +83,38 @@ ), ( AssignExpr( - temp{3}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{3}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{9}, + temp{7}, Print.reserve, ), Expr(5), ), ( AssignExpr( - temp{11}, + temp{9}, "The point is FIXME", ), Expr(6), ), ( AssignExpr( - temp{10}, - Concatenate(temp{11}), + temp{8}, + Concatenate(temp{9}), ), Expr(7), ), ( Clear( - temp{11}, + temp{9}, ), Expr(6), ), ], Assign( - temp{8}, + temp{6}, Call( - temp{9}, + temp{7}, [ - temp{10}, + temp{8}, ], [ None, @@ -147,21 +127,21 @@ [ ( Clear( - temp{10}, + temp{8}, ), Expr(7), ), ( Clear( - temp{9}, + temp{7}, ), Expr(5), ), ], Assign( - temp{7}, + temp{5}, Await( - temp{8}, + temp{6}, ), BasicBlock(3), ), @@ -170,26 +150,26 @@ [ ( Clear( - temp{8}, + temp{6}, ), Expr(8), ), ( Clear( - temp{7}, + temp{5}, ), Expr(9), ), ( AssignExpr( - temp{2}, + temp{1}, (), ), Expr(10), ), ], Return( - temp{2}, + temp{1}, ), ), }, diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-3.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-3.ref index 4ddd15d0..6dd8627a 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-3.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-3.ref @@ -18,12 +18,10 @@ digraph { ]; } afternode0 [ - color = "slategray", - fontcolor = "slategray", label = < - - + +
Point
x: "22"
y: "44"
x: "22"
y: "44"
> ]; "afterstack":0 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-4.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-4.bir.ref index 49a51a07..35e2e1fc 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-4.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-4.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{4}, + temp{2}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{5}, + temp{3}, 22, ), Expr(1), ), ( AssignExpr( - temp{6}, + temp{4}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{4}, + temp{2}, [ - temp{5}, - temp{6}, + temp{3}, + temp{4}, ], [ Some( @@ -49,42 +49,22 @@ [ ( Clear( - temp{6}, + temp{4}, ), Expr(2), ), ( Clear( - temp{5}, + temp{3}, ), Expr(1), ), ( Clear( - temp{4}, + temp{2}, ), Expr(0), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{3}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{3}, - ), - Expr(4), - ), ( BreakpoingStart( "class", @@ -94,7 +74,7 @@ ), ( AssignExpr( - temp{9}, + temp{7}, Print.reserve, ), Expr(5), @@ -105,38 +85,38 @@ 0, Expr(5), Some( - temp{9}, + temp{7}, ), ), Expr(5), ), ( AssignExpr( - temp{11}, + temp{9}, "The point is FIXME", ), Expr(6), ), ( AssignExpr( - temp{10}, - Concatenate(temp{11}), + temp{8}, + Concatenate(temp{9}), ), Expr(7), ), ( Clear( - temp{11}, + temp{9}, ), Expr(6), ), ], Assign( - temp{8}, + temp{6}, Call( - temp{9}, + temp{7}, [ - temp{10}, + temp{8}, ], [ None, @@ -149,21 +129,21 @@ [ ( Clear( - temp{10}, + temp{8}, ), Expr(7), ), ( Clear( - temp{9}, + temp{7}, ), Expr(5), ), ], Assign( - temp{7}, + temp{5}, Await( - temp{8}, + temp{6}, ), BasicBlock(3), ), @@ -172,26 +152,26 @@ [ ( Clear( - temp{8}, + temp{6}, ), Expr(8), ), ( Clear( - temp{7}, + temp{5}, ), Expr(9), ), ( AssignExpr( - temp{2}, + temp{1}, (), ), Expr(10), ), ], Return( - temp{2}, + temp{1}, ), ), }, diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-4.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-4.ref index 7617515c..3be7cb75 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-4.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-4.ref @@ -13,7 +13,7 @@ digraph { - +
main
p
(in-flight): "print"
(in-flight): "print"
>; ]; diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.bir.ref index 3889aa99..d23a005d 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.bir.ref @@ -3,35 +3,42 @@ start_basic_block: BasicBlock(0), BasicBlock(0): BasicBlockData( [ + ( + BreakpoingStart( + "class", + 0, + ), + Expr(4), + ), ( AssignExpr( - temp{6}, + temp{4}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{7}, + temp{5}, 22, ), Expr(1), ), ( AssignExpr( - temp{8}, + temp{6}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{6}, + temp{4}, [ - temp{7}, - temp{8}, + temp{5}, + temp{6}, ], [ Some( @@ -49,36 +56,22 @@ [ ( Clear( - temp{8}, + temp{6}, ), Expr(2), ), ( Clear( - temp{7}, + temp{5}, ), Expr(1), ), ( Clear( - temp{6}, + temp{4}, ), Expr(0), ), - ( - BreakpoingStart( - "class", - 0, - ), - Expr(4), - ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), ( BreakpointEnd( "class", @@ -90,41 +83,28 @@ ), ( AssignExpr( - temp{5}, - (), + q{1}, + p{0}.give, ), - Expr(4), + Expr(5), ), ( - Clear( - temp{5}, - ), - Expr(4), - ), - ( - AssignPlace( - q{2}, - p{0}, - ), - Expr(6), - ), - ( - AssignPlace( - x{3}, - p{0}.x, + AssignExpr( + x{2}, + p{0}.x.give, ), - Expr(9), + Expr(8), ), ( AssignExpr( - temp{4}, + temp{3}, (), ), Expr(10), ), ], Return( - temp{4}, + temp{3}, ), ), }, diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.ref b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.ref index 73be0b13..bc55f564 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.ref @@ -13,19 +13,17 @@ digraph { - - + +
main
p
q
x
q
x
>; ]; } afternode0 [ - color = "slategray", - fontcolor = "slategray", label = < - - + +
Point
x: "22"
y: "44"
x: "22"
y: "44"
> ]; "afterstack":0 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; @@ -41,8 +39,8 @@ digraph { - - + +
main
p
q
x
q
x
>; ]; @@ -52,9 +50,9 @@ digraph { Error: your lease to this object was cancelled ╭─[class:9:9] │ - 6 │     q = p -  · ──┬── -  · ╰──── lease was cancelled here + 6 │     q = p +  · ┬ +  · ╰── lease was cancelled here 9 │     x = p.x  · ┬  · ╰── cancelled lease used here diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.bir.ref index 92bc1dc4..97b8ba9b 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{6}, + temp{4}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{7}, + temp{5}, 22, ), Expr(1), ), ( AssignExpr( - temp{8}, + temp{6}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{6}, + temp{4}, [ - temp{7}, - temp{8}, + temp{5}, + temp{6}, ], [ Some( @@ -49,42 +49,22 @@ [ ( Clear( - temp{8}, + temp{6}, ), Expr(2), ), ( Clear( - temp{7}, + temp{5}, ), Expr(1), ), ( Clear( - temp{6}, + temp{4}, ), Expr(0), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{5}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{5}, - ), - Expr(4), - ), ( BreakpoingStart( "class", @@ -93,11 +73,11 @@ Expr(6), ), ( - AssignPlace( - q{2}, - p{0}, + AssignExpr( + q{1}, + p{0}.give, ), - Expr(6), + Expr(5), ), ( BreakpointEnd( @@ -109,22 +89,22 @@ Expr(6), ), ( - AssignPlace( - x{3}, - p{0}.x, + AssignExpr( + x{2}, + p{0}.x.give, ), - Expr(9), + Expr(8), ), ( AssignExpr( - temp{4}, + temp{3}, (), ), Expr(10), ), ], Return( - temp{4}, + temp{3}, ), ), }, diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.ref b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.ref index b33130a7..3e6dbfb3 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.ref @@ -13,8 +13,8 @@ digraph { - - + +
main
p
q
x
q
x
>; ]; @@ -28,7 +28,7 @@ digraph { y: "44" > ]; - "afterstack":2 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "afterstack":1 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; } subgraph cluster_before { label=<before> @@ -41,8 +41,8 @@ digraph { - - + +
main
p
q
x
q
x
>; ]; @@ -62,9 +62,9 @@ digraph { Error: your lease to this object was cancelled ╭─[class:9:9] │ - 6 │     q = p -  · ──┬── -  · ╰──── lease was cancelled here + 6 │     q = p +  · ┬ +  · ╰── lease was cancelled here 9 │     x = p.x  · ┬  · ╰── cancelled lease used here diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref index 62f46320..b4ffcd17 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{8}, + temp{5}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{9}, + temp{6}, 22, ), Expr(1), ), ( AssignExpr( - temp{10}, + temp{7}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{8}, + temp{5}, [ - temp{9}, - temp{10}, + temp{6}, + temp{7}, ], [ Some( @@ -49,80 +49,40 @@ [ ( Clear( - temp{10}, + temp{7}, ), Expr(2), ), ( Clear( - temp{9}, + temp{6}, ), Expr(1), ), ( Clear( - temp{8}, + temp{5}, ), Expr(0), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{7}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{7}, - ), - Expr(4), - ), ( AssignExpr( - temp{3}, + q{1}, p{0}.lease, ), Expr(6), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(7), - ), - ( - AssignExpr( - temp{11}, - (), - ), - Expr(7), - ), - ( - Clear( - temp{11}, - ), - Expr(7), - ), ( AssignExpr( - temp{4}, - q{2}.lease, + temp{2}, + q{1}.lease, ), Expr(8), ), ( AssignExpr( - temp{13}, - temp{4}.x.give, + temp{9}, + temp{2}.x.give, ), Expr(9), ), @@ -135,7 +95,7 @@ ), ( AssignExpr( - temp{14}, + temp{10}, 1, ), Expr(10), @@ -146,71 +106,71 @@ 0, Expr(10), Some( - temp{14}, + temp{10}, ), ), Expr(10), ), ( AssignExpr( - temp{5}, - temp{13} + temp{14}, + temp{3}, + temp{9} + temp{10}, ), Expr(11), ), ( Clear( - temp{14}, + temp{10}, ), Expr(10), ), ( Clear( - temp{13}, + temp{9}, ), Expr(9), ), ( - AssignPlace( - temp{4}.x, - temp{5}, + AssignExpr( + temp{2}.x, + temp{3}.give, ), Expr(11), ), ( AssignExpr( - temp{12}, + temp{8}, (), ), Expr(11), ), ( Clear( - temp{12}, + temp{8}, ), Expr(11), ), ( AssignExpr( - temp{17}, + temp{13}, Print.reserve, ), Expr(12), ), ( AssignExpr( - temp{18}, + temp{14}, p{0}.x.reserve, ), Expr(14), ), ], Assign( - temp{16}, + temp{12}, Call( - temp{17}, + temp{13}, [ - temp{18}, + temp{14}, ], [ None, @@ -223,21 +183,21 @@ [ ( Clear( - temp{18}, + temp{14}, ), Expr(14), ), ( Clear( - temp{17}, + temp{13}, ), Expr(12), ), ], Assign( - temp{15}, + temp{11}, Await( - temp{16}, + temp{12}, ), BasicBlock(3), ), @@ -246,26 +206,26 @@ [ ( Clear( - temp{16}, + temp{12}, ), Expr(15), ), ( Clear( - temp{15}, + temp{11}, ), Expr(16), ), ( AssignExpr( - temp{6}, + temp{4}, (), ), Expr(17), ), ], Return( - temp{6}, + temp{4}, ), ), }, diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.ref index a6a96562..1db3d00d 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.ref @@ -13,8 +13,8 @@ digraph { - - + +
main
p
q
(in-flight): "1"
q
(in-flight): "1"
>; ]; @@ -29,7 +29,7 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "afterstack":2 -> "afternode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; + "afterstack":1 -> "afternode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; } subgraph cluster_before { label=<before> @@ -42,7 +42,7 @@ digraph { - +
main
p
q
q
>; ]; @@ -57,7 +57,7 @@ digraph { > ]; "beforestack":0 -> "beforenode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "beforestack":2 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; + "beforestack":1 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; } } 23 diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref index f09c6d9c..8bae560a 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{8}, + temp{5}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{9}, + temp{6}, 22, ), Expr(1), ), ( AssignExpr( - temp{10}, + temp{7}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{8}, + temp{5}, [ - temp{9}, - temp{10}, + temp{6}, + temp{7}, ], [ Some( @@ -49,106 +49,66 @@ [ ( Clear( - temp{10}, + temp{7}, ), Expr(2), ), ( Clear( - temp{9}, + temp{6}, ), Expr(1), ), ( Clear( - temp{8}, + temp{5}, ), Expr(0), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{7}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{7}, - ), - Expr(4), - ), ( AssignExpr( - temp{3}, + q{1}, p{0}.lease, ), Expr(6), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(7), - ), - ( - AssignExpr( - temp{11}, - (), - ), - Expr(7), - ), - ( - Clear( - temp{11}, - ), - Expr(7), - ), ( AssignExpr( - temp{4}, - q{2}.lease, + temp{2}, + q{1}.lease, ), Expr(8), ), ( AssignExpr( - temp{13}, - temp{4}.x.give, + temp{9}, + temp{2}.x.give, ), Expr(9), ), ( AssignExpr( - temp{14}, + temp{10}, 1, ), Expr(10), ), ( AssignExpr( - temp{5}, - temp{13} + temp{14}, + temp{3}, + temp{9} + temp{10}, ), Expr(11), ), ( Clear( - temp{14}, + temp{10}, ), Expr(10), ), ( Clear( - temp{13}, + temp{9}, ), Expr(9), ), @@ -160,9 +120,9 @@ Expr(11), ), ( - AssignPlace( - temp{4}.x, - temp{5}, + AssignExpr( + temp{2}.x, + temp{3}.give, ), Expr(11), ), @@ -177,38 +137,38 @@ ), ( AssignExpr( - temp{12}, + temp{8}, (), ), Expr(11), ), ( Clear( - temp{12}, + temp{8}, ), Expr(11), ), ( AssignExpr( - temp{17}, + temp{13}, Print.reserve, ), Expr(12), ), ( AssignExpr( - temp{18}, + temp{14}, p{0}.x.reserve, ), Expr(14), ), ], Assign( - temp{16}, + temp{12}, Call( - temp{17}, + temp{13}, [ - temp{18}, + temp{14}, ], [ None, @@ -221,21 +181,21 @@ [ ( Clear( - temp{18}, + temp{14}, ), Expr(14), ), ( Clear( - temp{17}, + temp{13}, ), Expr(12), ), ], Assign( - temp{15}, + temp{11}, Await( - temp{16}, + temp{12}, ), BasicBlock(3), ), @@ -244,26 +204,26 @@ [ ( Clear( - temp{16}, + temp{12}, ), Expr(15), ), ( Clear( - temp{15}, + temp{11}, ), Expr(16), ), ( AssignExpr( - temp{6}, + temp{4}, (), ), Expr(17), ), ], Return( - temp{6}, + temp{4}, ), ), }, diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.ref index b8be6f1b..9e90db3f 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.ref @@ -13,7 +13,7 @@ digraph { - +
main
p
q
q
>; ]; @@ -26,7 +26,7 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "afterstack":2 -> "afternode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; + "afterstack":1 -> "afternode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; } subgraph cluster_before { label=<before> @@ -39,7 +39,7 @@ digraph { - +
main
p
q
q
>; ]; @@ -52,7 +52,7 @@ digraph { > ]; "beforestack":0 -> "beforenode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "beforestack":2 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; + "beforestack":1 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; } } 23 diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref index 8a941a22..40c47093 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{10}, + temp{6}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{11}, + temp{7}, 22, ), Expr(1), ), ( AssignExpr( - temp{12}, + temp{8}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{10}, + temp{6}, [ - temp{11}, - temp{12}, + temp{7}, + temp{8}, ], [ Some( @@ -49,133 +49,73 @@ [ ( Clear( - temp{12}, + temp{8}, ), Expr(2), ), ( Clear( - temp{11}, + temp{7}, ), Expr(1), ), ( Clear( - temp{10}, + temp{6}, ), Expr(0), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{9}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{9}, - ), - Expr(4), - ), ( AssignExpr( - temp{3}, + q{1}, p{0}.lease, ), Expr(6), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(7), - ), - ( - AssignExpr( - temp{13}, - (), - ), - Expr(7), - ), - ( - Clear( - temp{13}, - ), - Expr(7), - ), ( AssignExpr( - temp{5}, - q{2}.lease, + r{2}, + q{1}.lease, ), Expr(9), ), - ( - AssignPlace( - r{4}, - temp{5}, - ), - Expr(10), - ), ( AssignExpr( - temp{14}, - (), - ), - Expr(10), - ), - ( - Clear( - temp{14}, - ), - Expr(10), - ), - ( - AssignExpr( - temp{6}, - r{4}.lease, + temp{3}, + r{2}.lease, ), Expr(11), ), ( AssignExpr( - temp{16}, - temp{6}.x.give, + temp{10}, + temp{3}.x.give, ), Expr(12), ), ( AssignExpr( - temp{17}, + temp{11}, 1, ), Expr(13), ), ( AssignExpr( - temp{7}, - temp{16} + temp{17}, + temp{4}, + temp{10} + temp{11}, ), Expr(14), ), ( Clear( - temp{17}, + temp{11}, ), Expr(13), ), ( Clear( - temp{16}, + temp{10}, ), Expr(12), ), @@ -187,9 +127,9 @@ Expr(14), ), ( - AssignPlace( - temp{6}.x, - temp{7}, + AssignExpr( + temp{3}.x, + temp{4}.give, ), Expr(14), ), @@ -204,38 +144,38 @@ ), ( AssignExpr( - temp{15}, + temp{9}, (), ), Expr(14), ), ( Clear( - temp{15}, + temp{9}, ), Expr(14), ), ( AssignExpr( - temp{20}, + temp{14}, Print.reserve, ), Expr(15), ), ( AssignExpr( - temp{21}, + temp{15}, p{0}.x.reserve, ), Expr(17), ), ], Assign( - temp{19}, + temp{13}, Call( - temp{20}, + temp{14}, [ - temp{21}, + temp{15}, ], [ None, @@ -248,21 +188,21 @@ [ ( Clear( - temp{21}, + temp{15}, ), Expr(17), ), ( Clear( - temp{20}, + temp{14}, ), Expr(15), ), ], Assign( - temp{18}, + temp{12}, Await( - temp{19}, + temp{13}, ), BasicBlock(3), ), @@ -271,26 +211,26 @@ [ ( Clear( - temp{19}, + temp{13}, ), Expr(18), ), ( Clear( - temp{18}, + temp{12}, ), Expr(19), ), ( AssignExpr( - temp{8}, + temp{5}, (), ), Expr(20), ), ], Return( - temp{8}, + temp{5}, ), ), }, diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.ref index ac2203da..bc995f53 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.ref @@ -13,8 +13,8 @@ digraph { - - + +
main
p
q
r
q
r
>; ]; @@ -27,8 +27,8 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; + "afterstack":1 -> "afternode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; "afterstack":2 -> "afternode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; - "afterstack":4 -> "afternode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; } subgraph cluster_before { label=<before> @@ -41,8 +41,8 @@ digraph { - - + +
main
p
q
r
q
r
>; ]; @@ -55,8 +55,8 @@ digraph { > ]; "beforestack":0 -> "beforenode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; + "beforestack":1 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; "beforestack":2 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; - "beforestack":4 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; } } 23 diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref index 9692a87a..5daba0b7 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{10}, + temp{7}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{11}, + temp{8}, 22, ), Expr(1), ), ( AssignExpr( - temp{12}, + temp{9}, 44, ), Expr(2), ), ], Assign( - temp{1}, + p{0}, Call( - temp{10}, + temp{7}, [ - temp{11}, - temp{12}, + temp{8}, + temp{9}, ], [ Some( @@ -49,126 +49,86 @@ [ ( Clear( - temp{12}, + temp{9}, ), Expr(2), ), ( Clear( - temp{11}, + temp{8}, ), Expr(1), ), ( Clear( - temp{10}, + temp{7}, ), Expr(0), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(4), - ), - ( - AssignExpr( - temp{9}, - (), - ), - Expr(4), - ), - ( - Clear( - temp{9}, - ), - Expr(4), - ), ( AssignExpr( - temp{3}, + q{1}, p{0}.lease, ), Expr(6), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(7), - ), ( AssignExpr( - temp{13}, - (), - ), - Expr(7), - ), - ( - Clear( - temp{13}, - ), - Expr(7), - ), - ( - AssignExpr( - temp{4}, - q{2}.lease, + temp{2}, + q{1}.lease, ), Expr(8), ), ( AssignExpr( - temp{15}, - temp{4}.x.give, + temp{11}, + temp{2}.x.give, ), Expr(9), ), ( AssignExpr( - temp{16}, + temp{12}, 1, ), Expr(10), ), ( AssignExpr( - temp{5}, - temp{15} + temp{16}, + temp{3}, + temp{11} + temp{12}, ), Expr(11), ), ( Clear( - temp{16}, + temp{12}, ), Expr(10), ), ( Clear( - temp{15}, + temp{11}, ), Expr(9), ), ( - AssignPlace( - temp{4}.x, - temp{5}, + AssignExpr( + temp{2}.x, + temp{3}.give, ), Expr(11), ), ( AssignExpr( - temp{14}, + temp{10}, (), ), Expr(11), ), ( Clear( - temp{14}, + temp{10}, ), Expr(11), ), @@ -180,11 +140,11 @@ Expr(14), ), ( - AssignPlace( - x{6}, - p{0}.x, + AssignExpr( + x{4}, + p{0}.x.give, ), - Expr(14), + Expr(13), ), ( BreakpointEnd( @@ -196,22 +156,22 @@ Expr(14), ), ( - AssignPlace( - x{7}, - q{2}.x, + AssignExpr( + x{5}, + q{1}.x.give, ), - Expr(17), + Expr(16), ), ( AssignExpr( - temp{8}, + temp{6}, (), ), Expr(18), ), ], Return( - temp{8}, + temp{6}, ), ), }, diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.ref index c43088dd..85e01285 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.ref @@ -13,9 +13,9 @@ digraph { - - - + + +
main
p
q
x: "23"
x
q
x: "23"
x
>; ]; @@ -42,9 +42,9 @@ digraph { - - - + + +
main
p
q
x
x
q
x
x
>; ]; @@ -59,15 +59,15 @@ digraph { > ]; "beforestack":0 -> "beforenode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "beforestack":2 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; + "beforestack":1 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; } } Error: your lease to this object was cancelled ╭─[class:9:9] │ - 7 │     x = p.x -  · ───┬─── -  · ╰───── lease was cancelled here + 7 │     x = p.x +  · ─┬─ +  · ╰─── lease was cancelled here 9 │     x = q.x  · ┬  · ╰── cancelled lease used here diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.bir.ref index 72425610..3e3a37e3 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.bir.ref @@ -5,33 +5,33 @@ [ ( AssignExpr( - temp{9}, + temp{7}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{10}, + temp{8}, 22, ), Expr(1), ), ( AssignExpr( - temp{11}, + temp{9}, 44, ), Expr(2), ), ], Assign( - temp{8}, + temp{6}, Call( - temp{9}, + temp{7}, [ - temp{10}, - temp{11}, + temp{8}, + temp{9}, ], [ Some( @@ -49,55 +49,35 @@ [ ( Clear( - temp{11}, + temp{9}, ), Expr(2), ), ( Clear( - temp{10}, + temp{8}, ), Expr(1), ), ( Clear( - temp{9}, + temp{7}, ), Expr(0), ), ( AssignExpr( - temp{1}, - temp{8}.share, + p{0}, + temp{6}.share, ), Expr(4), ), ( Clear( - temp{8}, + temp{6}, ), Expr(3), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(5), - ), - ( - AssignExpr( - temp{7}, - (), - ), - Expr(5), - ), - ( - Clear( - temp{7}, - ), - Expr(5), - ), ( BreakpoingStart( "class", @@ -106,11 +86,11 @@ Expr(7), ), ( - AssignPlace( - q{2}, - p{0}, + AssignExpr( + q{1}, + p{0}.give, ), - Expr(7), + Expr(6), ), ( BreakpointEnd( @@ -122,36 +102,36 @@ Expr(7), ), ( - AssignPlace( - x{3}, - p{0}.x, + AssignExpr( + x{2}, + p{0}.x.give, ), - Expr(10), + Expr(9), ), ( - AssignPlace( - x{4}, - q{2}.x, + AssignExpr( + x{3}, + q{1}.x.give, ), - Expr(13), + Expr(12), ), ( - AssignPlace( - x{5}, - p{0}.x, + AssignExpr( + x{4}, + p{0}.x.give, ), - Expr(16), + Expr(15), ), ( AssignExpr( - temp{6}, + temp{5}, (), ), Expr(17), ), ], Return( - temp{6}, + temp{5}, ), ), }, diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.ref b/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.ref index 55a194cd..1ea9ea21 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.ref @@ -13,10 +13,10 @@ digraph { - + + -
main
p
q
q
x
x
x
x
>; ]; @@ -31,7 +31,7 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; - "afterstack":2 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; + "afterstack":1 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; } subgraph cluster_before { label=<before> @@ -44,10 +44,10 @@ digraph { - + + -
main
p
q
q
x
x
x
x
>; ]; diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.bir.ref index 57b204fd..8f8eca4e 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.bir.ref @@ -12,33 +12,33 @@ ), ( AssignExpr( - temp{11}, + temp{6}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{12}, + temp{7}, 22, ), Expr(1), ), ( AssignExpr( - temp{13}, + temp{8}, 44, ), Expr(2), ), ], Assign( - temp{10}, + temp{5}, Call( - temp{11}, + temp{6}, [ - temp{12}, - temp{13}, + temp{7}, + temp{8}, ], [ Some( @@ -56,178 +56,59 @@ [ ( Clear( - temp{13}, + temp{8}, ), Expr(2), ), ( Clear( - temp{12}, + temp{7}, ), Expr(1), ), ( Clear( - temp{11}, + temp{6}, ), Expr(0), ), ( AssignExpr( - temp{1}, - temp{10}.share, + p{0}, + temp{5}.share, ), Expr(4), ), ( Clear( - temp{10}, + temp{5}, ), Expr(3), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(5), - ), ( AssignExpr( - temp{9}, - (), - ), - Expr(5), - ), - ( - Clear( - temp{9}, - ), - Expr(5), - ), - ( - AssignExpr( - temp{15}, - p{0}.give, - ), - Expr(6), - ), - ( - AssignExpr( - temp{3}, - temp{15}.share, + q{1}, + p{0}.shlease, ), Expr(7), ), - ( - Clear( - temp{15}, - ), - Expr(6), - ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(8), - ), - ( - AssignExpr( - temp{14}, - (), - ), - Expr(8), - ), - ( - Clear( - temp{14}, - ), - Expr(8), - ), - ( - AssignExpr( - temp{17}, - q{2}.give, - ), - Expr(9), - ), ( AssignExpr( - temp{5}, - temp{17}.share, + r{2}, + q{1}.shlease, ), Expr(10), ), - ( - Clear( - temp{17}, - ), - Expr(9), - ), - ( - AssignPlace( - r{4}, - temp{5}, - ), - Expr(11), - ), ( AssignExpr( - temp{16}, - (), - ), - Expr(11), - ), - ( - Clear( - temp{16}, - ), - Expr(11), - ), - ( - AssignExpr( - temp{19}, - r{4}.give, - ), - Expr(12), - ), - ( - AssignExpr( - temp{7}, - temp{19}.share, + s{3}, + r{2}.shlease, ), Expr(13), ), - ( - Clear( - temp{19}, - ), - Expr(12), - ), - ( - AssignPlace( - s{6}, - temp{7}, - ), - Expr(14), - ), ( AssignExpr( - temp{18}, - (), - ), - Expr(14), - ), - ( - Clear( - temp{18}, - ), - Expr(14), - ), - ( - AssignExpr( - temp{8}, + temp{4}, (), ), Expr(15), @@ -238,14 +119,14 @@ 0, Expr(15), Some( - temp{8}, + temp{4}, ), ), Expr(15), ), ], Return( - temp{8}, + temp{4}, ), ), }, diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.ref b/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.ref index 8d2e2f2a..accd9aad 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.ref @@ -13,10 +13,10 @@ digraph { - - - - + + + +
main
p
q
r
s
(in-flight): "()"
q
r
s
(in-flight): "()"
>; ]; @@ -29,9 +29,9 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; + "afterstack":1 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; "afterstack":2 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; - "afterstack":4 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; - "afterstack":6 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; + "afterstack":3 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; } subgraph cluster_before { label=<before> @@ -44,9 +44,9 @@ digraph { - - - + + +
main
p
q
r
s
q
r
s
>; ]; diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.bir.ref index 0da9b345..2d747d9c 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.bir.ref @@ -12,33 +12,33 @@ ), ( AssignExpr( - temp{8}, + temp{5}, Class(Id { value: 1 }).reserve, ), Expr(0), ), ( AssignExpr( - temp{9}, + temp{6}, 22, ), Expr(1), ), ( AssignExpr( - temp{10}, + temp{7}, 44, ), Expr(2), ), ], Assign( - temp{7}, + temp{4}, Call( - temp{8}, + temp{5}, [ - temp{9}, - temp{10}, + temp{6}, + temp{7}, ], [ Some( @@ -56,92 +56,52 @@ [ ( Clear( - temp{10}, + temp{7}, ), Expr(2), ), ( Clear( - temp{9}, + temp{6}, ), Expr(1), ), ( Clear( - temp{8}, + temp{5}, ), Expr(0), ), ( AssignExpr( - temp{1}, - temp{7}.share, + p{0}, + temp{4}.share, ), Expr(4), ), ( Clear( - temp{7}, + temp{4}, ), Expr(3), ), - ( - AssignPlace( - p{0}, - temp{1}, - ), - Expr(5), - ), - ( - AssignExpr( - temp{6}, - (), - ), - Expr(5), - ), - ( - Clear( - temp{6}, - ), - Expr(5), - ), ( AssignExpr( - temp{3}, + q{1}, p{0}.give, ), Expr(7), ), - ( - AssignPlace( - q{2}, - temp{3}, - ), - Expr(8), - ), ( AssignExpr( - temp{11}, - (), - ), - Expr(8), - ), - ( - Clear( - temp{11}, + r{2}, + q{1}.give, ), - Expr(8), - ), - ( - AssignPlace( - r{4}, - q{2}, - ), - Expr(10), + Expr(9), ), ( AssignExpr( - temp{5}, + temp{3}, (), ), Expr(11), @@ -152,14 +112,14 @@ 0, Expr(11), Some( - temp{5}, + temp{3}, ), ), Expr(11), ), ], Return( - temp{5}, + temp{3}, ), ), }, diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.ref b/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.ref index 4a90431f..daa4bcd1 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.ref @@ -13,9 +13,9 @@ digraph { - - - + + +
main
p
q
r
(in-flight): "()"
q
r
(in-flight): "()"
>; ]; @@ -28,8 +28,8 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; + "afterstack":1 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; "afterstack":2 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; - "afterstack":4 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; } subgraph cluster_before { label=<before> @@ -42,8 +42,8 @@ digraph { - - + +
main
p
q
r
q
r
>; ]; diff --git a/dada_tests/permissions/exhaustive/share-var-field-my.dada b/dada_tests/permissions/exhaustive/share-var-field-my.dada index bd08894a..cba7b043 100644 --- a/dada_tests/permissions/exhaustive/share-var-field-my.dada +++ b/dada_tests/permissions/exhaustive/share-var-field-my.dada @@ -3,6 +3,6 @@ class Pair(any a, any b) async fn main() { p = Pair(Pair(22, 44), 66) q = p.a.share - print(p).await #! OUTPUT my Pair\(\(expired\), 66\) - print(q).await #! OUTPUT our Pair\(22, 44\) + print(q).await #! OUTPUT shleased Pair\(22, 44\) + print(p).await #! OUTPUT my Pair\(my Pair\(22, 44\), 66\) } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/share-var-field-my/stdout.ref b/dada_tests/permissions/exhaustive/share-var-field-my/stdout.ref index 232ce596..1d604c72 100644 --- a/dada_tests/permissions/exhaustive/share-var-field-my/stdout.ref +++ b/dada_tests/permissions/exhaustive/share-var-field-my/stdout.ref @@ -1,2 +1,2 @@ -my Pair((expired), 66) -our Pair(22, 44) +shleased Pair(22, 44) +my Pair(my Pair(22, 44), 66) diff --git a/dada_tests/permissions/exhaustive/share-var-my.dada b/dada_tests/permissions/exhaustive/share-var-my.dada index 668dc2b9..fa2fbd07 100644 --- a/dada_tests/permissions/exhaustive/share-var-my.dada +++ b/dada_tests/permissions/exhaustive/share-var-my.dada @@ -3,6 +3,6 @@ class Pair(any a, any b) async fn main() { p = Pair(22, 44) q = p.share - print(q).await #! OUTPUT our Pair\(22, 44\) - print(p).await #! RUN ERROR your lease to this object was cancelled + print(q).await #! OUTPUT shleased Pair\(22, 44\) + print(p).await #! OUTPUT my Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/share-var-my/stdout.ref b/dada_tests/permissions/exhaustive/share-var-my/stdout.ref index 2aa36059..8898bfcd 100644 --- a/dada_tests/permissions/exhaustive/share-var-my/stdout.ref +++ b/dada_tests/permissions/exhaustive/share-var-my/stdout.ref @@ -1 +1,2 @@ -our Pair(22, 44) +shleased Pair(22, 44) +my Pair(22, 44) diff --git a/dada_tests/reservations/our-to-our-leased-assign-field.dada b/dada_tests/reservations/our-to-our-leased-assign-field.dada index 105042ce..74c8d2bf 100644 --- a/dada_tests/reservations/our-to-our-leased-assign-field.dada +++ b/dada_tests/reservations/our-to-our-leased-assign-field.dada @@ -7,7 +7,7 @@ async fn main() { q = OurLeased(p.shlease) # `q.f` becomes 2nd owner of `(22, 44)` print(q.lease).await #! OUTPUT OurLeased\(our Point\(22, 44\)\) - p := Point(44, 66) # `p` is shared owner of `(44, 66)` + p := Point(44, 66).share # `p` is shared owner of `(44, 66)` q.f := p.share # `q.f` becomes 2nd owner of `(44, 66)` print(q.lease).await #! OUTPUT OurLeased\(our Point\(44, 66\)\) p := Point(11, 55) # overwriting `p` doesn't invalidate `q.f` diff --git a/dada_tests/specifier/local-my.dada b/dada_tests/specifier/local-my.dada index eb707450..aab13ada 100644 --- a/dada_tests/specifier/local-my.dada +++ b/dada_tests/specifier/local-my.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { pair = Pair(22, 44) @@ -9,5 +9,5 @@ async fn main() { print(pair1).await #! OUTPUT Pair\(22, 44\) print(pair2).await #! OUTPUT Pair\(22, 44\) - print(pair).await #! RUN ERROR your lease to this object was cancelled + print(pair).await #! OUTPUT Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/specifier/local-my/stdout.ref b/dada_tests/specifier/local-my/stdout.ref index 765d2df4..99ae405a 100644 --- a/dada_tests/specifier/local-my/stdout.ref +++ b/dada_tests/specifier/local-my/stdout.ref @@ -1,3 +1,4 @@ leased Pair(22, 44) -our Pair(22, 44) -our Pair(22, 44) +shleased Pair(22, 44) +shleased Pair(22, 44) +my Pair(22, 44) diff --git a/dada_tests/specifier/temporary-lifetime/if-then-else-leased.dada b/dada_tests/specifier/temporary-lifetime/if-then-else-leased.dada index dd17cf6c..3dbfc0d0 100644 --- a/dada_tests/specifier/temporary-lifetime/if-then-else-leased.dada +++ b/dada_tests/specifier/temporary-lifetime/if-then-else-leased.dada @@ -1,12 +1,12 @@ -class Object(any data) +class Object(data) async fn main() { o = if true { Object(true).lease } else { Object(false).lease } + + print(o).await #! RUN ERROR your lease to this object was cancelled # # What happens here: # * `Object(true).lease` is equivalent to `{ o = Object(true); o.lease }` # * that variable `o` is dropped as we exit the `if-then-else` - - print(o).await } From 53930791b9cfc6287246a2e46dd22e28b9f94e0b Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 15 Jul 2022 07:29:30 +0300 Subject: [PATCH 09/36] remove specifiers completely --- components/dada-brew/src/brew.rs | 1 - components/dada-brew/src/brewery.rs | 1 - components/dada-execute/src/step.rs | 95 ------------------- components/dada-execute/src/step/address.rs | 15 +-- components/dada-execute/src/step/call.rs | 40 +------- components/dada-execute/src/step/intrinsic.rs | 4 +- components/dada-ir/src/code/bir.rs | 25 +---- components/dada-ir/src/code/syntax.rs | 4 +- components/dada-ir/src/code/validated.rs | 7 +- components/dada-ir/src/lib.rs | 1 - components/dada-ir/src/storage.rs | 60 ------------ components/dada-parse/src/parser/code.rs | 11 +-- components/dada-parse/src/parser/parameter.rs | 33 +------ .../dada-validate/src/validate/validator.rs | 3 - .../field-access-in-format-string.dada | 2 +- dada_tests/heap-graph/dag.dada | 2 +- dada_tests/heap-graph/leased-point.dada | 2 +- dada_tests/heap-graph/line-start.dada | 2 +- dada_tests/heap-graph/mid-increment.dada | 2 +- dada_tests/heap-graph/nested-functions.dada | 2 +- dada_tests/heap-graph/nested-points.dada | 2 +- dada_tests/heap-graph/tutorial-1.dada | 2 +- .../module_main/ref_class_before_decl.dada | 2 +- .../dyn_tutorial/tutorial-give-10.dada | 2 +- .../dyn_tutorial/tutorial-lease-10.dada | 2 +- .../dyn_tutorial/tutorial-lease-20.dada | 2 +- .../dyn_tutorial/tutorial-lease-30.dada | 2 +- .../dyn_tutorial/tutorial-share-10.dada | 2 +- .../dyn_tutorial/tutorial-share-20.dada | 2 +- .../dyn_tutorial/tutorial-share-30.dada | 2 +- .../exhaustive/assign-var-leased.dada | 2 +- .../permissions/exhaustive/assign-var-my.dada | 2 +- .../exhaustive/assign-var-our.dada | 2 +- .../exhaustive/give-var-field-my.dada | 2 +- .../exhaustive/give-var-leased-shared.dada | 2 +- .../exhaustive/give-var-leased.dada | 2 +- .../permissions/exhaustive/give-var-my.dada | 2 +- .../permissions/exhaustive/give-var-our.dada | 2 +- .../exhaustive/lease-var-field-my.dada | 2 +- .../exhaustive/lease-var-lease-shared.dada | 2 +- .../permissions/exhaustive/lease-var-my.dada | 2 +- .../permissions/exhaustive/lease-var-our.dada | 2 +- .../exhaustive/share-var-field-my.dada | 2 +- .../exhaustive/share-var-leased.dada | 2 +- .../permissions/exhaustive/share-var-my.dada | 2 +- .../permissions/exhaustive/share-var-our.dada | 2 +- ...se-parties-are-not-fair-to-the-tenant.dada | 2 +- .../patterns/pattern-lease-my.dada | 2 +- .../patterns/pattern-lease-our.dada | 2 +- .../revokation/overwrite-lease-share.dada | 2 +- .../revokation/overwrite-leased.dada | 2 +- .../revokation/overwrite-our-leased.dada | 2 +- .../revokation/overwrite-our-shared.dada | 2 +- .../revokation/overwrite-owned.dada | 2 +- .../overwrite-shared-separate-root.dada | 2 +- .../revokation/overwrite-shared.dada | 2 +- .../scoped-exit-atomic-temporary.dada | 2 +- .../scoped-exit-if-false-temporary.dada | 2 +- .../scoped-exit-if-true-temporary.dada | 2 +- .../scoped-exit-while-iteration-named.dada | 2 +- ...scoped-exit-while-iteration-temporary.dada | 2 +- .../revokation/scoped-exit-while-named.dada | 2 +- .../scoped-exit-while-temporary.dada | 2 +- .../revokation/write-field-of-leased.dada | 2 +- .../write-shared-field.dada | 2 +- .../write-shared-traverse.dada | 2 +- .../if-then-else-owned.dada | 2 +- 67 files changed, 67 insertions(+), 339 deletions(-) diff --git a/components/dada-brew/src/brew.rs b/components/dada-brew/src/brew.rs index aa3c3029..7c75a2fd 100644 --- a/components/dada-brew/src/brew.rs +++ b/components/dada-brew/src/brew.rs @@ -563,7 +563,6 @@ fn add_temporary(brewery: &mut Brewery, origin: ExprOrigin) -> bir::LocalVariabl let temporary = brewery.add( bir::LocalVariableData { name: None, - specifier: None, atomic: Atomic::No, }, validated::LocalVariableOrigin::Temporary(origin.into()), diff --git a/components/dada-brew/src/brewery.rs b/components/dada-brew/src/brewery.rs index 2e70bacb..23729faa 100644 --- a/components/dada-brew/src/brewery.rs +++ b/components/dada-brew/src/brewery.rs @@ -226,7 +226,6 @@ fn map_variables( origins, bir::LocalVariableData { name: validated_var_data.name, - specifier: validated_var_data.specifier, atomic: validated_var_data.atomic, }, validated_var_origin, diff --git a/components/dada-execute/src/step.rs b/components/dada-execute/src/step.rs index 5130e049..605fbe5f 100644 --- a/components/dada-execute/src/step.rs +++ b/components/dada-execute/src/step.rs @@ -9,7 +9,6 @@ use dada_ir::{ in_ir_db::InIrDbExt, origin_table::HasOriginIn, span::FileSpan, - storage::{Atomic, Joint, Leased, SpannedSpecifier, Specifier}, word::Word, }; use salsa::DebugWithDb; @@ -192,9 +191,6 @@ impl<'me> Stepper<'me> { let value = self.eval_expr(table, *expr)?; self.assign_value_to_place(table, *place, value)?; } - bir::StatementData::AssignPlace(target_place, source_place) => { - self.assign_place_to_place(table, *target_place, *source_place)?; - } bir::StatementData::Clear(lv) => { let permission = self.machine.expired_permission(None); let object = self.machine.unit_object(); @@ -231,27 +227,6 @@ impl<'me> Stepper<'me> { }) } - fn assign_place_to_place( - &mut self, - table: &bir::Tables, - target_place: bir::TargetPlace, - source_place: bir::Place, - ) -> eyre::Result<()> { - let target_traversal = self.evaluate_target_place(table, target_place)?; - - assert_ne!( - target_traversal.accumulated_permissions.atomic, - Atomic::Yes, - "atomics not yet implemented" - ); - - let specifier = self.specifier(target_traversal.address); - - let value = self.prepare_value_for_specifier(table, specifier, source_place)?; - - self.assign_value_to_traversal(target_traversal, value) - } - fn evaluate_target_place( &mut self, table: &bir::Tables, @@ -269,60 +244,6 @@ impl<'me> Stepper<'me> { } } - #[tracing::instrument(level = "Debug", skip(self, table))] - fn prepare_value_for_specifier( - &mut self, - table: &bir::Tables, - specifier: Option, - source_place: bir::Place, - ) -> eyre::Result { - let (specifier, specifier_span) = match specifier { - Some(i) => i.into_specifier_and_span(self.db), - None => return self.give_place(table, source_place), - }; - - tracing::debug!(?specifier); - - let value = match specifier { - Specifier::Any => self.give_place(table, source_place)?, - }; - - let permission = &self.machine[value.permission]; - let valid = permission - .valid() - .expect("value to be stored has expired permision"); - - if let (true, Leased::Yes) = (specifier.must_be_owned(), valid.leased) { - let source_place_span = self.span_from_bir(source_place); - return Err(error!(source_place_span, "more permissions needed") - .primary_label(format!( - "this value is `{}`, which is leased, not owned", - valid.as_str() - )) - .secondary_label( - specifier_span, - format!("`{specifier}` requires owned values"), - ) - .eyre(self.db)); - } - - if let (true, Joint::Yes) = (specifier.must_be_unique(), valid.joint) { - let source_place_span = self.span_from_bir(source_place); - return Err(error!(source_place_span, "more permissions needed") - .primary_label(format!( - "this value is `{}`, which is shared, not unique", - valid.as_str() - )) - .secondary_label( - specifier_span, - format!("`{specifier}` requires unique access"), - ) - .eyre(self.db)); - } - - Ok(value) - } - fn assign_value_to_place( &mut self, table: &bir::Tables, @@ -600,19 +521,3 @@ impl<'me> Stepper<'me> { bir.span_of(self.db, syntax_expr) } } - -trait IntoSpecifierAndSpan: std::fmt::Debug { - fn into_specifier_and_span(self, db: &dyn crate::Db) -> (Specifier, FileSpan); -} - -impl IntoSpecifierAndSpan for (Specifier, FileSpan) { - fn into_specifier_and_span(self, _db: &dyn crate::Db) -> (Specifier, FileSpan) { - self - } -} - -impl IntoSpecifierAndSpan for SpannedSpecifier { - fn into_specifier_and_span(self, db: &dyn crate::Db) -> (Specifier, FileSpan) { - (self.specifier(db), self.span(db)) - } -} diff --git a/components/dada-execute/src/step/address.rs b/components/dada-execute/src/step/address.rs index 39623b35..440dae0a 100644 --- a/components/dada-execute/src/step/address.rs +++ b/components/dada-execute/src/step/address.rs @@ -1,4 +1,4 @@ -use dada_ir::{code::bir, error, parameter::Parameter, storage::SpannedSpecifier}; +use dada_ir::{code::bir, error, parameter::Parameter}; use crate::{ error::DiagnosticBuilderExt, @@ -24,19 +24,6 @@ pub(super) enum Address { } impl Stepper<'_> { - pub(super) fn specifier(&self, address: Address) -> Option { - match address { - Address::Local(local) => { - let bir = self.machine.pc().bir; - let local_decl = &bir.data(self.db).tables[local]; - local_decl.specifier - } - Address::Constant(_) => None, - Address::Field(_, _, Some(field)) => Some(field.decl(self.db).specifier), - Address::Field(_, _, None) => None, - } - } - /// Read the value at `address`; does not account for permissions at all. pub(super) fn peek(&self, address: Address) -> Value { match address { diff --git a/components/dada-execute/src/step/call.rs b/components/dada-execute/src/step/call.rs index cde6eb4a..3e592016 100644 --- a/components/dada-execute/src/step/call.rs +++ b/components/dada-execute/src/step/call.rs @@ -14,7 +14,7 @@ use crate::{ step::intrinsic::IntrinsicDefinition, }; -use super::{IntoSpecifierAndSpan, Stepper}; +use super::Stepper; pub(super) enum CallResult { Returned(Value), @@ -41,8 +41,7 @@ impl Stepper<'_> { &ObjectData::Class(c) => { let fields = c.fields(self.db); self.match_labels(terminator, labels, fields)?; - let arguments = - self.prepare_arguments_for_parameters(table, fields, argument_places)?; + let arguments = self.prepare_arguments(table, argument_places)?; let instance = Instance { class: c, fields: arguments, @@ -53,8 +52,7 @@ impl Stepper<'_> { let parameters = function.parameters(self.db); self.match_labels(terminator, labels, parameters)?; - let arguments = - self.prepare_arguments_for_parameters(table, parameters, argument_places)?; + let arguments = self.prepare_arguments(table, argument_places)?; if function.effect(self.db).permits_await() { // If the function can await, then it must be an async function. @@ -75,15 +73,7 @@ impl Stepper<'_> { &ObjectData::Intrinsic(intrinsic) => { let definition = IntrinsicDefinition::for_intrinsic(self.db, intrinsic); self.match_labels(callee, labels, &definition.argument_names)?; - let callee_span = self.span_from_bir(callee); - let arguments = self.prepare_arguments( - table, - definition - .argument_specifiers - .iter() - .map(|specifier| (*specifier, callee_span)), - argument_places, - )?; + let arguments = self.prepare_arguments(table, argument_places)?; let value = (definition.function)(self, arguments)?; Ok(CallResult::Returned(value)) } @@ -99,35 +89,15 @@ impl Stepper<'_> { } } - /// Prepare the arguments according to the given specifiers. - fn prepare_arguments_for_parameters( - &mut self, - table: &bir::Tables, - parameters: &[Parameter], - argument_places: &[bir::Place], - ) -> eyre::Result> { - self.prepare_arguments( - table, - parameters - .iter() - .map(|parameter| parameter.decl(self.db).specifier), - argument_places, - ) - } - /// Prepare the arguments according to the given specifiers. fn prepare_arguments( &mut self, table: &bir::Tables, - specifiers: impl Iterator, argument_places: &[bir::Place], ) -> eyre::Result> { argument_places .iter() - .zip(specifiers) - .map(|(argument_place, specifier)| { - self.prepare_value_for_specifier(table, Some(specifier), *argument_place) - }) + .map(|argument_place| self.give_place(table, *argument_place)) .collect() } diff --git a/components/dada-execute/src/step/intrinsic.rs b/components/dada-execute/src/step/intrinsic.rs index 1b3fa800..fb9a7aa7 100644 --- a/components/dada-execute/src/step/intrinsic.rs +++ b/components/dada-execute/src/step/intrinsic.rs @@ -1,4 +1,4 @@ -use dada_ir::{error, intrinsic::Intrinsic, storage::Specifier, word::Word}; +use dada_ir::{error, intrinsic::Intrinsic, word::Word}; use eyre::Context; use crate::{ @@ -14,7 +14,6 @@ pub(crate) type IntrinsicFn = fn(&mut Stepper<'_>, Vec) -> eyre::Result, - pub(crate) argument_specifiers: Vec, pub(crate) function: IntrinsicFn, } @@ -23,7 +22,6 @@ impl IntrinsicDefinition { match intrinsic { Intrinsic::Print => IntrinsicDefinition { argument_names: vec![Word::from(db, "message")], - argument_specifiers: vec![Specifier::Any], function: |s, v| s.intrinsic_print(v), // FIXME: Stepper::intrinsic_write doesn't type check, why? }, diff --git a/components/dada-ir/src/code/bir.rs b/components/dada-ir/src/code/bir.rs index ad393c90..f32147a3 100644 --- a/components/dada-ir/src/code/bir.rs +++ b/components/dada-ir/src/code/bir.rs @@ -11,7 +11,7 @@ use crate::{ origin_table::HasOriginIn, prelude::InIrDbExt, span::FileSpan, - storage::{Atomic, SpannedSpecifier}, + storage::Atomic, word::{SpannedOptionalWord, Word}, }; use dada_id::{id, prelude::*, tables}; @@ -178,12 +178,6 @@ pub struct LocalVariableData { /// introduced by the compiler. pub name: Option, - /// Specifier given this variable by the user - /// (possibly defaulted). If this is `None`, - /// then this is a temporary introduced by the compiler, - /// and it gets the specifier `Any`. - pub specifier: Option, - pub atomic: Atomic, } @@ -259,17 +253,6 @@ pub enum StatementData { /// or (b) the rhs is an rvalue, like `22`, and so is always given. AssignExpr(TargetPlace, Expr), - /// Captures an assignment like - /// - /// ```notrust - /// foo.bar := baz - /// ``` - /// - /// This case is challenging because, until we know - /// the declared type of `bar` at runtime, we don't - /// know whether to give `baz`, lease it, or what. - AssignPlace(TargetPlace, Place), - /// Clears the value from the given local variable. Clear(LocalVariable), @@ -307,12 +290,6 @@ impl DebugWithDb> for StatementData { .field(&expr.debug(db)) .finish(), - StatementData::AssignPlace(target, source) => f - .debug_tuple("AssignPlace") - .field(&target.debug(db)) - .field(&source.debug(db)) - .finish(), - StatementData::Clear(lv) => f.debug_tuple("Clear").field(&lv.debug(db)).finish(), StatementData::BreakpointStart(filename, index) => f diff --git a/components/dada-ir/src/code/syntax.rs b/components/dada-ir/src/code/syntax.rs index 00a5ca72..44556f7d 100644 --- a/components/dada-ir/src/code/syntax.rs +++ b/components/dada-ir/src/code/syntax.rs @@ -3,7 +3,7 @@ use crate::{ in_ir_db::InIrDb, in_ir_db::InIrDbExt, span::Span, - storage::{Atomic, SpannedSpecifier}, + storage::Atomic, word::{SpannedOptionalWord, Word}, }; use dada_id::{id, prelude::*, tables}; @@ -266,7 +266,6 @@ impl DebugWithDb> for LocalVariableDecl { #[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug)] pub struct LocalVariableDeclData { - pub specifier: SpannedSpecifier, pub atomic: Atomic, pub name: Word, pub ty: Option, @@ -275,7 +274,6 @@ pub struct LocalVariableDeclData { impl DebugWithDb> for LocalVariableDeclData { fn fmt(&self, f: &mut std::fmt::Formatter<'_>, db: &InIrDb<'_, Tree>) -> std::fmt::Result { f.debug_struct("LocalVariableDeclData") - .field("specifier", &self.specifier.specifier(db.db())) .field("atomic", &self.atomic) .field("name", &self.name.debug(db.db())) .field("ty", &self.ty.debug(db.db())) diff --git a/components/dada-ir/src/code/validated.rs b/components/dada-ir/src/code/validated.rs index 2e4db6a4..1f7c2df5 100644 --- a/components/dada-ir/src/code/validated.rs +++ b/components/dada-ir/src/code/validated.rs @@ -9,7 +9,7 @@ use crate::{ in_ir_db::InIrDb, intrinsic::Intrinsic, prelude::InIrDbExt, - storage::{Atomic, SpannedSpecifier}, + storage::Atomic, word::{SpannedOptionalWord, Word}, }; use dada_id::{id, prelude::*, tables}; @@ -190,11 +190,6 @@ pub struct LocalVariableData { /// semantics. pub name: Option, - /// If `Some`, then contains specifier given by the - /// user. If `None`, this is a temporary, and its - /// specifier is effectively [`Specifier::Any`]. - pub specifier: Option, - pub atomic: Atomic, } diff --git a/components/dada-ir/src/lib.rs b/components/dada-ir/src/lib.rs index f03785b3..40083849 100644 --- a/components/dada-ir/src/lib.rs +++ b/components/dada-ir/src/lib.rs @@ -42,7 +42,6 @@ pub struct Jar( manifest::source_text, parameter::Parameter, source_file::SourceFile, - storage::SpannedSpecifier, token_tree::TokenTree, ty::Ty, word::Word, diff --git a/components/dada-ir/src/storage.rs b/components/dada-ir/src/storage.rs index e8dcce15..8563567f 100644 --- a/components/dada-ir/src/storage.rs +++ b/components/dada-ir/src/storage.rs @@ -1,63 +1,3 @@ -use crate::span::FileSpan; - -salsa::entity2! { - /// A "spanned spanned" is a `Specifier` that carries a span for diagnostics. - entity SpannedSpecifier in crate::Jar { - #[id] specifier: Specifier, - - /// If true, the specifier was not explicitly given by the user - /// but was defaulted. - defaulted: bool, - - /// Span of the specifier keywords, or storage name if specified was - /// defaulted. - span: FileSpan, - } -} - -impl SpannedSpecifier { - /// Creates a new `SpannedSpecifier` for a variable/field that didn't - /// have an explicit specifier. - pub fn new_defaulted(db: &dyn crate::Db, name_span: FileSpan) -> Self { - Self::new(db, Specifier::Any, true, name_span) - } -} - -#[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash, Debug)] -pub enum Specifier { - Any, -} - -impl Specifier { - /// True if values stored under this specifier must be uniquely - /// accessible (my, leased) and cannot be jointly accessible (our, shleased). - /// - /// [`Specifier::Any`] returns false. - pub fn must_be_unique(self) -> bool { - match self { - Specifier::Any => false, - } - } - - /// True if values stored under this specifier must be owned (my, our) - /// and cannot be leased (leased, shleased). - /// - /// [`Specifier::Any`] returns false. - pub fn must_be_owned(self) -> bool { - match self { - Specifier::Any => false, - } - } -} - -impl std::fmt::Display for Specifier { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Specifier::Any => write!(f, "any"), - } - } -} - /// NB: Ordering is significant. As we traverse a path, we take the /// max of the atomic properties for the various storage modes, /// and we want that to be atomic if any step was atomic. diff --git a/components/dada-parse/src/parser/code.rs b/components/dada-parse/src/parser/code.rs index 3fbb0400..78275398 100644 --- a/components/dada-parse/src/parser/code.rs +++ b/components/dada-parse/src/parser/code.rs @@ -24,7 +24,7 @@ use dada_ir::{ }; use salsa::AsId; -use super::{parameter::SpannedSpecifierExt, OrReportError, ParseList}; +use super::{OrReportError, ParseList}; impl Parser<'_> { pub(crate) fn parse_code_body(&mut self, parameters: &[Parameter]) -> Tree { @@ -475,9 +475,7 @@ impl CodeParser<'_, '_> { fn parse_local_variable_decl(&mut self) -> Option { // Look for `[mode] x = `. If we see that, we are committed to this // being a local variable declaration. Otherwise, we roll fully back. - let (specifier, atomic_span, atomic, name_span, name) = self.lookahead(|this| { - let specifier = this.parse_permission_specifier(); - + let (atomic_span, atomic, name_span, name) = self.lookahead(|this| { // A storage mode like `shared` or `var` *could* be a variable declaration, // but if we see `atomic` it might not be, so check for the `x = ` next. let (atomic_span, atomic) = if let Some(span) = this.parse_atomic() { @@ -490,15 +488,12 @@ impl CodeParser<'_, '_> { this.eat_op(Op::Equal)?; - Some((specifier, atomic_span, atomic, name_span, name)) + Some((atomic_span, atomic, name_span, name)) })?; - let specifier = specifier.or_defaulted(self, name_span); - let local_variable_decl = self.add( LocalVariableDeclData { atomic, - specifier, name, ty: None, // FIXME-- should permit `ty: Ty = ...` }, diff --git a/components/dada-parse/src/parser/parameter.rs b/components/dada-parse/src/parser/parameter.rs index 86f2b761..745376e8 100644 --- a/components/dada-parse/src/parser/parameter.rs +++ b/components/dada-parse/src/parser/parameter.rs @@ -6,7 +6,7 @@ use dada_ir::{ kw::Keyword, parameter::Parameter, span::Span, - storage::{Atomic, SpannedSpecifier, Specifier}, + storage::Atomic, }; use super::ParseList; @@ -19,7 +19,6 @@ impl<'db> Parser<'db> { } fn parse_parameter(&mut self) -> Option { - let opt_specifier = self.parse_permission_specifier(); let opt_storage_mode = self.parse_atomic(); if let Some((name_span, name)) = self.eat(Identifier) { let opt_ty = if let Some(colon_span) = self.eat_op(Op::Colon) { @@ -41,11 +40,8 @@ impl<'db> Parser<'db> { None => (name_span, Atomic::No), }; - let specifier = opt_specifier.or_defaulted(self, name_span); - let decl = LocalVariableDeclData { atomic, - specifier, name, ty: opt_ty, }; @@ -76,31 +72,4 @@ impl<'db> Parser<'db> { None } } - - pub(crate) fn parse_permission_specifier(&mut self) -> Option { - let filename = self.filename; - let some_specifier = |specifier, span: Span| { - Some(SpannedSpecifier::new( - self.db, - specifier, - false, - span.in_file(filename), - )) - }; - if let Some((any_span, _)) = self.eat(Keyword::Any) { - some_specifier(Specifier::Any, any_span) - } else { - None - } - } -} - -#[extension_trait::extension_trait] -pub(crate) impl SpannedSpecifierExt for Option { - fn or_defaulted(self, parser: &Parser<'_>, name_span: Span) -> SpannedSpecifier { - match self { - Some(s) => s, - None => SpannedSpecifier::new_defaulted(parser.db, name_span.in_file(parser.filename)), - } - } } diff --git a/components/dada-validate/src/validate/validator.rs b/components/dada-validate/src/validate/validator.rs index 16472d76..a1a00781 100644 --- a/components/dada-validate/src/validate/validator.rs +++ b/components/dada-validate/src/validate/validator.rs @@ -158,7 +158,6 @@ impl<'me> Validator<'me> { let local_variable = self.add( validated::LocalVariableData { name: Some(decl_data.name), - specifier: Some(decl_data.specifier), atomic: decl_data.atomic, }, validated::LocalVariableOrigin::Parameter(decl), @@ -401,7 +400,6 @@ impl<'me> Validator<'me> { let local_variable = self.add( validated::LocalVariableData { name: Some(decl_data.name), - specifier: Some(decl_data.specifier), atomic: decl_data.atomic, }, validated::LocalVariableOrigin::LocalVariable(*decl), @@ -911,7 +909,6 @@ impl<'me> Validator<'me> { let local_variable = self.add( validated::LocalVariableData { name: None, - specifier: None, atomic: Atomic::No, }, validated::LocalVariableOrigin::Temporary(origin.syntax_expr), diff --git a/dada_tests/format-strings/field-access-in-format-string.dada b/dada_tests/format-strings/field-access-in-format-string.dada index 2912e49d..80843592 100644 --- a/dada_tests/format-strings/field-access-in-format-string.dada +++ b/dada_tests/format-strings/field-access-in-format-string.dada @@ -1,4 +1,4 @@ -class Point(any x, any y) +class Point(x, y) p = Point(22, 44).share print("({p.x}, {p.y})").await diff --git a/dada_tests/heap-graph/dag.dada b/dada_tests/heap-graph/dag.dada index 64e5305d..f41c7b84 100644 --- a/dada_tests/heap-graph/dag.dada +++ b/dada_tests/heap-graph/dag.dada @@ -1,4 +1,4 @@ -class Point(any x, any y) +class Point(x, y) async fn main() { p = Point(22, 44).share diff --git a/dada_tests/heap-graph/leased-point.dada b/dada_tests/heap-graph/leased-point.dada index 699a47d2..3249ab61 100644 --- a/dada_tests/heap-graph/leased-point.dada +++ b/dada_tests/heap-graph/leased-point.dada @@ -1,4 +1,4 @@ -class Point(any x, any y) +class Point(x, y) async fn main() { p = Point(22, 44) diff --git a/dada_tests/heap-graph/line-start.dada b/dada_tests/heap-graph/line-start.dada index c4b7487a..7f83ee15 100644 --- a/dada_tests/heap-graph/line-start.dada +++ b/dada_tests/heap-graph/line-start.dada @@ -1,4 +1,4 @@ -class Point(any x, any y) +class Point(x, y) async fn main() { p = Point(22, 44) diff --git a/dada_tests/heap-graph/mid-increment.dada b/dada_tests/heap-graph/mid-increment.dada index b88e3bbb..c9b1ce81 100644 --- a/dada_tests/heap-graph/mid-increment.dada +++ b/dada_tests/heap-graph/mid-increment.dada @@ -1,4 +1,4 @@ -class Point(any x, any y) +class Point(x, y) async fn main() { p = Point(22, 44) diff --git a/dada_tests/heap-graph/nested-functions.dada b/dada_tests/heap-graph/nested-functions.dada index 427e627c..17d1bef9 100644 --- a/dada_tests/heap-graph/nested-functions.dada +++ b/dada_tests/heap-graph/nested-functions.dada @@ -1,6 +1,6 @@ #! OUTPUT ANY -class Point(any x, any y) +class Point(x, y) async fn main() { name = "Fellow Dadaist" diff --git a/dada_tests/heap-graph/nested-points.dada b/dada_tests/heap-graph/nested-points.dada index 5b1e9cfe..790b7bae 100644 --- a/dada_tests/heap-graph/nested-points.dada +++ b/dada_tests/heap-graph/nested-points.dada @@ -1,5 +1,5 @@ -class Point(any x, any y) +class Point(x, y) async fn main() { p = Point(22, 44) diff --git a/dada_tests/heap-graph/tutorial-1.dada b/dada_tests/heap-graph/tutorial-1.dada index 17629bb3..e9e489ee 100644 --- a/dada_tests/heap-graph/tutorial-1.dada +++ b/dada_tests/heap-graph/tutorial-1.dada @@ -1,4 +1,4 @@ -class Point(any x, any y) +class Point(x, y) async fn main() { p = Point(x: 22, y: 44) diff --git a/dada_tests/module_main/ref_class_before_decl.dada b/dada_tests/module_main/ref_class_before_decl.dada index cb29874b..ea322f68 100644 --- a/dada_tests/module_main/ref_class_before_decl.dada +++ b/dada_tests/module_main/ref_class_before_decl.dada @@ -1,4 +1,4 @@ p = Pair(22, 44) print(p).await #! OUTPUT Pair\(22, 44\) -class Pair(any a, any b) +class Pair(a, b) diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada b/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada index ce9f3425..60e36b27 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada @@ -1,4 +1,4 @@ -class Point(any x, any y) +class Point(x, y) async fn main() { p = Point(x: 22, y: 44) diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10.dada b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10.dada index cd7dae9f..da7ed458 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10.dada +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10.dada @@ -1,4 +1,4 @@ -class Point(any x, any y) +class Point(x, y) async fn main() { p = Point(x: 22, y: 44) diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20.dada b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20.dada index a3cd0711..2d8f417b 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20.dada +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20.dada @@ -1,4 +1,4 @@ -class Point(any x, any y) +class Point(x, y) async fn main() { p = Point(x: 22, y: 44) diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30.dada b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30.dada index d146c651..623c36f8 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30.dada +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30.dada @@ -1,4 +1,4 @@ -class Point(any x, any y) +class Point(x, y) async fn main() { p = Point(x: 22, y: 44) diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-10.dada b/dada_tests/permissions/dyn_tutorial/tutorial-share-10.dada index 9b6fe3dc..91dd783e 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-10.dada +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-10.dada @@ -1,4 +1,4 @@ -class Point(any x, any y) +class Point(x, y) async fn main() { p = Point(x: 22, y: 44).share diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-20.dada b/dada_tests/permissions/dyn_tutorial/tutorial-share-20.dada index 60cf8739..5f252ee4 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-20.dada +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-20.dada @@ -1,4 +1,4 @@ -class Point(any x, any y) +class Point(x, y) async fn main() { p = Point(x: 22, y: 44).share diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-30.dada b/dada_tests/permissions/dyn_tutorial/tutorial-share-30.dada index 4490d74e..a7439dab 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-30.dada +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-30.dada @@ -1,4 +1,4 @@ -class Point(any x, any y) +class Point(x, y) async fn main() { p = Point(x: 22, y: 44).share diff --git a/dada_tests/permissions/exhaustive/assign-var-leased.dada b/dada_tests/permissions/exhaustive/assign-var-leased.dada index 47cc3334..63ed993c 100644 --- a/dada_tests/permissions/exhaustive/assign-var-leased.dada +++ b/dada_tests/permissions/exhaustive/assign-var-leased.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = Pair(22, 44).lease diff --git a/dada_tests/permissions/exhaustive/assign-var-my.dada b/dada_tests/permissions/exhaustive/assign-var-my.dada index f1c1e49a..f89c57f4 100644 --- a/dada_tests/permissions/exhaustive/assign-var-my.dada +++ b/dada_tests/permissions/exhaustive/assign-var-my.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/assign-var-our.dada b/dada_tests/permissions/exhaustive/assign-var-our.dada index deb9130e..0ddf60c9 100644 --- a/dada_tests/permissions/exhaustive/assign-var-our.dada +++ b/dada_tests/permissions/exhaustive/assign-var-our.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = Pair(22, 44).share diff --git a/dada_tests/permissions/exhaustive/give-var-field-my.dada b/dada_tests/permissions/exhaustive/give-var-field-my.dada index 1641edf0..3473c630 100644 --- a/dada_tests/permissions/exhaustive/give-var-field-my.dada +++ b/dada_tests/permissions/exhaustive/give-var-field-my.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { # Here we have an owned point, but in a shared field diff --git a/dada_tests/permissions/exhaustive/give-var-leased-shared.dada b/dada_tests/permissions/exhaustive/give-var-leased-shared.dada index 8a3a6e88..a0b716c1 100644 --- a/dada_tests/permissions/exhaustive/give-var-leased-shared.dada +++ b/dada_tests/permissions/exhaustive/give-var-leased-shared.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { # FIXME: Debatable when the underlying pair should be freed. diff --git a/dada_tests/permissions/exhaustive/give-var-leased.dada b/dada_tests/permissions/exhaustive/give-var-leased.dada index 1f403afc..c68e4a39 100644 --- a/dada_tests/permissions/exhaustive/give-var-leased.dada +++ b/dada_tests/permissions/exhaustive/give-var-leased.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = Pair(22, 44).lease diff --git a/dada_tests/permissions/exhaustive/give-var-my.dada b/dada_tests/permissions/exhaustive/give-var-my.dada index 8e3fef3b..cba27909 100644 --- a/dada_tests/permissions/exhaustive/give-var-my.dada +++ b/dada_tests/permissions/exhaustive/give-var-my.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/give-var-our.dada b/dada_tests/permissions/exhaustive/give-var-our.dada index 5dfb91ae..69d6c3a5 100644 --- a/dada_tests/permissions/exhaustive/give-var-our.dada +++ b/dada_tests/permissions/exhaustive/give-var-our.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = Pair(22, 44).share diff --git a/dada_tests/permissions/exhaustive/lease-var-field-my.dada b/dada_tests/permissions/exhaustive/lease-var-field-my.dada index 648507d2..58a318de 100644 --- a/dada_tests/permissions/exhaustive/lease-var-field-my.dada +++ b/dada_tests/permissions/exhaustive/lease-var-field-my.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = Pair(Pair(22, 44), 66) diff --git a/dada_tests/permissions/exhaustive/lease-var-lease-shared.dada b/dada_tests/permissions/exhaustive/lease-var-lease-shared.dada index 19a60344..ece26b9d 100644 --- a/dada_tests/permissions/exhaustive/lease-var-lease-shared.dada +++ b/dada_tests/permissions/exhaustive/lease-var-lease-shared.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = Pair(22, 44).lease.share diff --git a/dada_tests/permissions/exhaustive/lease-var-my.dada b/dada_tests/permissions/exhaustive/lease-var-my.dada index 847fd30c..6d1f6969 100644 --- a/dada_tests/permissions/exhaustive/lease-var-my.dada +++ b/dada_tests/permissions/exhaustive/lease-var-my.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/lease-var-our.dada b/dada_tests/permissions/exhaustive/lease-var-our.dada index e0b9bbd2..363c34c0 100644 --- a/dada_tests/permissions/exhaustive/lease-var-our.dada +++ b/dada_tests/permissions/exhaustive/lease-var-our.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = Pair(22, 44).share diff --git a/dada_tests/permissions/exhaustive/share-var-field-my.dada b/dada_tests/permissions/exhaustive/share-var-field-my.dada index cba7b043..12df044e 100644 --- a/dada_tests/permissions/exhaustive/share-var-field-my.dada +++ b/dada_tests/permissions/exhaustive/share-var-field-my.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = Pair(Pair(22, 44), 66) diff --git a/dada_tests/permissions/exhaustive/share-var-leased.dada b/dada_tests/permissions/exhaustive/share-var-leased.dada index 18f3defb..05dc36bd 100644 --- a/dada_tests/permissions/exhaustive/share-var-leased.dada +++ b/dada_tests/permissions/exhaustive/share-var-leased.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = Pair(22, 44).lease diff --git a/dada_tests/permissions/exhaustive/share-var-my.dada b/dada_tests/permissions/exhaustive/share-var-my.dada index fa2fbd07..d1714e03 100644 --- a/dada_tests/permissions/exhaustive/share-var-my.dada +++ b/dada_tests/permissions/exhaustive/share-var-my.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/share-var-our.dada b/dada_tests/permissions/exhaustive/share-var-our.dada index 143044db..9e51eaf2 100644 --- a/dada_tests/permissions/exhaustive/share-var-our.dada +++ b/dada_tests/permissions/exhaustive/share-var-our.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = Pair(22, 44).share diff --git a/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada b/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada index 799a5067..5779992d 100644 --- a/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada +++ b/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada @@ -10,7 +10,7 @@ # atomic fields etc, it's hard to demonstrate this danger. =) # But I'm pretty sure it's there. -class Accumulator(any atomic list) +class Accumulator(atomic list) class List(field) fn foo(accumulator) -> # shleased List diff --git a/dada_tests/permissions/patterns/pattern-lease-my.dada b/dada_tests/permissions/patterns/pattern-lease-my.dada index d8a88b0a..be69d562 100644 --- a/dada_tests/permissions/patterns/pattern-lease-my.dada +++ b/dada_tests/permissions/patterns/pattern-lease-my.dada @@ -1,4 +1,4 @@ -class Point(any x, any y) +class Point(x, y) # Test what happens when we lease a "my" thing `p` # and then destroy `p`. The lease should be canceled. diff --git a/dada_tests/permissions/patterns/pattern-lease-our.dada b/dada_tests/permissions/patterns/pattern-lease-our.dada index 71c1d6fa..63ed3c8e 100644 --- a/dada_tests/permissions/patterns/pattern-lease-our.dada +++ b/dada_tests/permissions/patterns/pattern-lease-our.dada @@ -1,4 +1,4 @@ -class Point(any x, any y) +class Point(x, y) # Test what happens when we lease an "our" thing `p` # and then drop `p`. Since leasing an `our` thing diff --git a/dada_tests/permissions/revokation/overwrite-lease-share.dada b/dada_tests/permissions/revokation/overwrite-lease-share.dada index 09784aef..f7e98652 100644 --- a/dada_tests/permissions/revokation/overwrite-lease-share.dada +++ b/dada_tests/permissions/revokation/overwrite-lease-share.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { pair1 = Pair(22, 44) diff --git a/dada_tests/permissions/revokation/overwrite-leased.dada b/dada_tests/permissions/revokation/overwrite-leased.dada index 137df2c6..eba26173 100644 --- a/dada_tests/permissions/revokation/overwrite-leased.dada +++ b/dada_tests/permissions/revokation/overwrite-leased.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { pair1 = Pair(22, 44) diff --git a/dada_tests/permissions/revokation/overwrite-our-leased.dada b/dada_tests/permissions/revokation/overwrite-our-leased.dada index cd97aa21..c9ffa089 100644 --- a/dada_tests/permissions/revokation/overwrite-our-leased.dada +++ b/dada_tests/permissions/revokation/overwrite-our-leased.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { pair1 = Pair(22, 44).share diff --git a/dada_tests/permissions/revokation/overwrite-our-shared.dada b/dada_tests/permissions/revokation/overwrite-our-shared.dada index 474fa279..d131c381 100644 --- a/dada_tests/permissions/revokation/overwrite-our-shared.dada +++ b/dada_tests/permissions/revokation/overwrite-our-shared.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { pair = Pair(Pair(22, 44).share, 66) diff --git a/dada_tests/permissions/revokation/overwrite-owned.dada b/dada_tests/permissions/revokation/overwrite-owned.dada index 0062cf72..f9f7ef07 100644 --- a/dada_tests/permissions/revokation/overwrite-owned.dada +++ b/dada_tests/permissions/revokation/overwrite-owned.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { pair = Pair(Pair(22, 44), 66) diff --git a/dada_tests/permissions/revokation/overwrite-shared-separate-root.dada b/dada_tests/permissions/revokation/overwrite-shared-separate-root.dada index 9256af81..561d200c 100644 --- a/dada_tests/permissions/revokation/overwrite-shared-separate-root.dada +++ b/dada_tests/permissions/revokation/overwrite-shared-separate-root.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { temp = Pair(22, 44).share diff --git a/dada_tests/permissions/revokation/overwrite-shared.dada b/dada_tests/permissions/revokation/overwrite-shared.dada index 2c7f134c..69accdb2 100644 --- a/dada_tests/permissions/revokation/overwrite-shared.dada +++ b/dada_tests/permissions/revokation/overwrite-shared.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { pair = Pair(Pair(22, 44).share, 66) diff --git a/dada_tests/permissions/revokation/scoped-exit-atomic-temporary.dada b/dada_tests/permissions/revokation/scoped-exit-atomic-temporary.dada index 61219668..8401bdd3 100644 --- a/dada_tests/permissions/revokation/scoped-exit-atomic-temporary.dada +++ b/dada_tests/permissions/revokation/scoped-exit-atomic-temporary.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = 0 diff --git a/dada_tests/permissions/revokation/scoped-exit-if-false-temporary.dada b/dada_tests/permissions/revokation/scoped-exit-if-false-temporary.dada index c8822773..91fb950a 100644 --- a/dada_tests/permissions/revokation/scoped-exit-if-false-temporary.dada +++ b/dada_tests/permissions/revokation/scoped-exit-if-false-temporary.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = 0 diff --git a/dada_tests/permissions/revokation/scoped-exit-if-true-temporary.dada b/dada_tests/permissions/revokation/scoped-exit-if-true-temporary.dada index 6562cd0a..8317692a 100644 --- a/dada_tests/permissions/revokation/scoped-exit-if-true-temporary.dada +++ b/dada_tests/permissions/revokation/scoped-exit-if-true-temporary.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = 0 diff --git a/dada_tests/permissions/revokation/scoped-exit-while-iteration-named.dada b/dada_tests/permissions/revokation/scoped-exit-while-iteration-named.dada index 077dfcc2..93b21ea1 100644 --- a/dada_tests/permissions/revokation/scoped-exit-while-iteration-named.dada +++ b/dada_tests/permissions/revokation/scoped-exit-while-iteration-named.dada @@ -2,7 +2,7 @@ # by a named variable scoped to a loop body # that is carried across iterations. -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = 0 diff --git a/dada_tests/permissions/revokation/scoped-exit-while-iteration-temporary.dada b/dada_tests/permissions/revokation/scoped-exit-while-iteration-temporary.dada index 71e8c625..9b4f5aa4 100644 --- a/dada_tests/permissions/revokation/scoped-exit-while-iteration-temporary.dada +++ b/dada_tests/permissions/revokation/scoped-exit-while-iteration-temporary.dada @@ -2,7 +2,7 @@ # by a temporary scoped to a loop body # that is carried across iterations. -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = 0 diff --git a/dada_tests/permissions/revokation/scoped-exit-while-named.dada b/dada_tests/permissions/revokation/scoped-exit-while-named.dada index dee5e2d7..8b741372 100644 --- a/dada_tests/permissions/revokation/scoped-exit-while-named.dada +++ b/dada_tests/permissions/revokation/scoped-exit-while-named.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = 0 diff --git a/dada_tests/permissions/revokation/scoped-exit-while-temporary.dada b/dada_tests/permissions/revokation/scoped-exit-while-temporary.dada index b556478e..e823cc99 100644 --- a/dada_tests/permissions/revokation/scoped-exit-while-temporary.dada +++ b/dada_tests/permissions/revokation/scoped-exit-while-temporary.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = 0 diff --git a/dada_tests/permissions/revokation/write-field-of-leased.dada b/dada_tests/permissions/revokation/write-field-of-leased.dada index 1fc6964d..14d8a3e1 100644 --- a/dada_tests/permissions/revokation/write-field-of-leased.dada +++ b/dada_tests/permissions/revokation/write-field-of-leased.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { p = Pair(22, 44).lease diff --git a/dada_tests/permissions/shared-data-is-immutable/write-shared-field.dada b/dada_tests/permissions/shared-data-is-immutable/write-shared-field.dada index f0594b9c..9caaa999 100644 --- a/dada_tests/permissions/shared-data-is-immutable/write-shared-field.dada +++ b/dada_tests/permissions/shared-data-is-immutable/write-shared-field.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { pair = Pair(22, 44).share diff --git a/dada_tests/permissions/shared-data-is-immutable/write-shared-traverse.dada b/dada_tests/permissions/shared-data-is-immutable/write-shared-traverse.dada index f32e1e6f..61273314 100644 --- a/dada_tests/permissions/shared-data-is-immutable/write-shared-traverse.dada +++ b/dada_tests/permissions/shared-data-is-immutable/write-shared-traverse.dada @@ -1,4 +1,4 @@ -class Pair(any a, any b) +class Pair(a, b) async fn main() { pair = Pair(Pair(22, 44), 66).share diff --git a/dada_tests/specifier/temporary-lifetime/if-then-else-owned.dada b/dada_tests/specifier/temporary-lifetime/if-then-else-owned.dada index 04721e37..dabe5655 100644 --- a/dada_tests/specifier/temporary-lifetime/if-then-else-owned.dada +++ b/dada_tests/specifier/temporary-lifetime/if-then-else-owned.dada @@ -1,4 +1,4 @@ -class Object(any data) +class Object(data) async fn main() { # This is equivalent to `if { .. } else { .. }.lease`. From e86c6e5e4af51fc0ae7f7f391071623b46ae77dc Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sat, 16 Jul 2022 06:55:52 +0300 Subject: [PATCH 10/36] remove `reserve_validated_expr` Without the specifier modes it doesn't have much purpose, at least not in its current form. It's still useful to be able to reserve a target place, I think (?). --- components/dada-validate/src/validate/validator.rs | 11 +++-------- .../src/validate/validator/string_literals.rs | 7 ++----- .../heap-graph/cursor-position/HeapGraph-0.bir.ref | 8 ++++---- .../heap-graph/cursor-position/HeapGraph-1.bir.ref | 8 ++++---- .../heap-graph/cursor-position/HeapGraph-2.bir.ref | 8 ++++---- .../heap-graph/cursor-position/HeapGraph-3.bir.ref | 8 ++++---- dada_tests/heap-graph/dag/HeapGraph-0.bir.ref | 8 ++++---- .../heap-graph/leased-point/HeapGraph-0.bir.ref | 4 ++-- .../heap-graph/line-start/HeapGraph-0.bir.ref | 6 +++--- .../heap-graph/line-start/HeapGraph-1.bir.ref | 6 +++--- .../heap-graph/mid-increment/HeapGraph-0.bir.ref | 6 +++--- .../nested-functions/HeapGraph-0.bir.ref | 14 +++++++------- .../heap-graph/nested-points/HeapGraph-0.bir.ref | 6 +++--- .../heap-graph/nested-points/HeapGraph-1.bir.ref | 6 +++--- .../heap-graph/nested-points/HeapGraph-2.bir.ref | 6 +++--- .../heap-graph/nested-points/HeapGraph-2.ref | 10 +--------- dada_tests/heap-graph/past-end/HeapGraph-0.bir.ref | 2 +- .../heap-graph/rust-thunk/HeapGraph-0.bir.ref | 2 +- .../heap-graph/tutorial-1/HeapGraph-0.bir.ref | 4 ++-- .../heap-graph/tutorial-1/HeapGraph-1.bir.ref | 4 ++-- .../heap-graph/tutorial-1/HeapGraph-2.bir.ref | 4 ++-- .../heap-graph/tutorial-1/HeapGraph-3.bir.ref | 4 ++-- .../heap-graph/tutorial-1/HeapGraph-4.bir.ref | 4 ++-- .../tutorial-give-10/HeapGraph-0.bir.ref | 2 +- .../tutorial-give-10/HeapGraph-1.bir.ref | 2 +- .../tutorial-lease-10/HeapGraph-0.bir.ref | 6 +++--- .../tutorial-lease-10/HeapGraph-1.bir.ref | 6 +++--- .../tutorial-lease-20/HeapGraph-0.bir.ref | 6 +++--- .../tutorial-lease-30/HeapGraph-0.bir.ref | 2 +- .../tutorial-share-10/HeapGraph-0.bir.ref | 2 +- .../tutorial-share-20/HeapGraph-0.bir.ref | 2 +- .../tutorial-share-30/HeapGraph-0.bir.ref | 2 +- 32 files changed, 80 insertions(+), 96 deletions(-) diff --git a/components/dada-validate/src/validate/validator.rs b/components/dada-validate/src/validate/validator.rs index a1a00781..aeef8aab 100644 --- a/components/dada-validate/src/validate/validator.rs +++ b/components/dada-validate/src/validate/validator.rs @@ -220,11 +220,6 @@ impl<'me> Validator<'me> { } } - #[tracing::instrument(level = "debug", skip(self, expr))] - pub(crate) fn reserve_validated_expr(&mut self, expr: syntax::Expr) -> validated::Expr { - self.validate_expr_in_mode(expr, ExprMode::Reserve) - } - fn validate_expr_in_mode(&mut self, expr: syntax::Expr, mode: ExprMode) -> validated::Expr { tracing::trace!("expr.data = {:?}", expr.data(self.syntax_tables())); match expr.data(self.syntax_tables()) { @@ -356,7 +351,7 @@ impl<'me> Validator<'me> { } syntax::ExprData::Call(func_expr, named_exprs) => { - let validated_func_expr = self.reserve_validated_expr(*func_expr); + let validated_func_expr = self.validate_expr(*func_expr); let validated_named_exprs = self.validate_named_exprs(named_exprs); let mut name_required = false; for named_expr in &validated_named_exprs { @@ -421,7 +416,7 @@ impl<'me> Validator<'me> { syntax::ExprData::Tuple(element_exprs) => { let validated_exprs = element_exprs .iter() - .map(|expr| self.reserve_validated_expr(*expr)) + .map(|expr| self.validate_expr(*expr)) .collect(); self.add(validated::ExprData::Tuple(validated_exprs), expr) } @@ -940,7 +935,7 @@ impl<'me> Validator<'me> { fn validate_named_expr(&mut self, named_expr: syntax::NamedExpr) -> validated::NamedExpr { let syntax::NamedExprData { name, expr } = named_expr.data(self.syntax_tables()); - let validated_expr = self.reserve_validated_expr(*expr); + let validated_expr = self.validate_expr(*expr); self.add( validated::NamedExprData { name: *name, diff --git a/components/dada-validate/src/validate/validator/string_literals.rs b/components/dada-validate/src/validate/validator/string_literals.rs index 8d617b40..b0a8b0b1 100644 --- a/components/dada-validate/src/validate/validator/string_literals.rs +++ b/components/dada-validate/src/validate/validator/string_literals.rs @@ -10,10 +10,7 @@ impl Validator<'_> { // See https://dada-lang.org/docs/reference/string-literals for full details. let validated_exprs = if !self.should_strip_margin(exprs) { - exprs - .iter() - .map(|expr| self.reserve_validated_expr(*expr)) - .collect() + exprs.iter().map(|expr| self.validate_expr(*expr)).collect() } else { self.strip_margin_from_exprs(exprs) }; @@ -119,7 +116,7 @@ impl Validator<'_> { let word = Word::from(self.db, escaped); validated_exprs.push(self.add(validated::ExprData::StringLiteral(word), *expr)); } else { - validated_exprs.push(self.reserve_validated_expr(*expr)); + validated_exprs.push(self.validate_expr(*expr)); } } validated_exprs diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref index 2e6eadfa..be4b0150 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -95,14 +95,14 @@ ( AssignExpr( temp{8}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(6), ), ( AssignExpr( temp{9}, - p{0}.reserve, + p{0}.give, ), Expr(7), ), @@ -166,7 +166,7 @@ ( AssignExpr( temp{13}, - Print.reserve, + Print.give, ), Expr(12), ), diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref index 81e30ed8..c612f3f0 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -77,14 +77,14 @@ ( AssignExpr( temp{8}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(6), ), ( AssignExpr( temp{9}, - p{0}.reserve, + p{0}.give, ), Expr(7), ), @@ -166,7 +166,7 @@ ( AssignExpr( temp{13}, - Print.reserve, + Print.give, ), Expr(12), ), diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref index b3a9dc65..fe32ee26 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -84,14 +84,14 @@ ( AssignExpr( temp{8}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(6), ), ( AssignExpr( temp{9}, - p{0}.reserve, + p{0}.give, ), Expr(7), ), @@ -166,7 +166,7 @@ ( AssignExpr( temp{13}, - Print.reserve, + Print.give, ), Expr(12), ), diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref index 55976e75..07dec099 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -77,14 +77,14 @@ ( AssignExpr( temp{8}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(6), ), ( AssignExpr( temp{9}, - p{0}.reserve, + p{0}.give, ), Expr(7), ), @@ -166,7 +166,7 @@ ( AssignExpr( temp{13}, - Print.reserve, + Print.give, ), Expr(12), ), diff --git a/dada_tests/heap-graph/dag/HeapGraph-0.bir.ref b/dada_tests/heap-graph/dag/HeapGraph-0.bir.ref index 10566491..6bcddcf8 100644 --- a/dada_tests/heap-graph/dag/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/dag/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -84,21 +84,21 @@ ( AssignExpr( temp{7}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(6), ), ( AssignExpr( temp{8}, - p{0}.reserve, + p{0}.give, ), Expr(7), ), ( AssignExpr( temp{9}, - p{0}.reserve, + p{0}.give, ), Expr(8), ), diff --git a/dada_tests/heap-graph/leased-point/HeapGraph-0.bir.ref b/dada_tests/heap-graph/leased-point/HeapGraph-0.bir.ref index d233fb90..176d0a72 100644 --- a/dada_tests/heap-graph/leased-point/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/leased-point/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -71,7 +71,7 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(5), ), diff --git a/dada_tests/heap-graph/line-start/HeapGraph-0.bir.ref b/dada_tests/heap-graph/line-start/HeapGraph-0.bir.ref index d57ba5e2..a8656e50 100644 --- a/dada_tests/heap-graph/line-start/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/line-start/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -82,14 +82,14 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(5), ), ( AssignExpr( temp{7}, - p{0}.reserve, + p{0}.give, ), Expr(6), ), diff --git a/dada_tests/heap-graph/line-start/HeapGraph-1.bir.ref b/dada_tests/heap-graph/line-start/HeapGraph-1.bir.ref index 826b9dac..9b98f324 100644 --- a/dada_tests/heap-graph/line-start/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/line-start/HeapGraph-1.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -80,14 +80,14 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(5), ), ( AssignExpr( temp{7}, - p{0}.reserve, + p{0}.give, ), Expr(6), ), diff --git a/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref b/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref index 0481accb..67d43521 100644 --- a/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{5}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -147,14 +147,14 @@ ( AssignExpr( temp{13}, - Print.reserve, + Print.give, ), Expr(12), ), ( AssignExpr( temp{14}, - q{1}.reserve, + q{1}.give, ), Expr(13), ), diff --git a/dada_tests/heap-graph/nested-functions/HeapGraph-0.bir.ref b/dada_tests/heap-graph/nested-functions/HeapGraph-0.bir.ref index b2952bd6..0cbcc2e6 100644 --- a/dada_tests/heap-graph/nested-functions/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/nested-functions/HeapGraph-0.bir.ref @@ -26,7 +26,7 @@ ( AssignExpr( temp{5}, - helper.reserve, + helper.give, ), Expr(3), ), @@ -75,7 +75,7 @@ ( AssignExpr( temp{8}, - Print.reserve, + Print.give, ), Expr(6), ), @@ -154,14 +154,14 @@ ( AssignExpr( temp{13}, - Print.reserve, + Print.give, ), Expr(11), ), ( AssignExpr( temp{14}, - name{0}.reserve, + name{0}.give, ), Expr(12), ), @@ -237,7 +237,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -302,14 +302,14 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(5), ), ( AssignExpr( temp{7}, - p{0}.reserve, + p{0}.give, ), Expr(6), ), diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-0.bir.ref b/dada_tests/heap-graph/nested-points/HeapGraph-0.bir.ref index aff0051e..5c0fc6d0 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -82,14 +82,14 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(5), ), ( AssignExpr( temp{7}, - p{0}.reserve, + p{0}.give, ), Expr(6), ), diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-1.bir.ref b/dada_tests/heap-graph/nested-points/HeapGraph-1.bir.ref index 826b9dac..9b98f324 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-1.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -80,14 +80,14 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(5), ), ( AssignExpr( temp{7}, - p{0}.reserve, + p{0}.give, ), Expr(6), ), diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-2.bir.ref b/dada_tests/heap-graph/nested-points/HeapGraph-2.bir.ref index cf212bac..9472b05e 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-2.bir.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-2.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -64,7 +64,7 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(5), ), @@ -78,7 +78,7 @@ ( AssignExpr( temp{7}, - p{0}.reserve, + p{0}.give, ), Expr(6), ), diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-2.ref b/dada_tests/heap-graph/nested-points/HeapGraph-2.ref index 98ddc0e1..eb900655 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-2.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-2.ref @@ -19,12 +19,6 @@ digraph { >; ]; } - afternode1 [ - label = < - - -
(reservation)
reserved
> - ]; afternode0 [ color = "slategray", fontcolor = "slategray", @@ -34,9 +28,7 @@ digraph { y: "44" > ]; - "afterstack":0 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; - "stack":9 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; - "afternode1":0 -> "afternode0" [label="reserved", style="solid", penwidth=1.0, arrowtype="odot", color="grey"]; + "stack":9 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; } subgraph cluster_before { label=<before> diff --git a/dada_tests/heap-graph/past-end/HeapGraph-0.bir.ref b/dada_tests/heap-graph/past-end/HeapGraph-0.bir.ref index 9be350e7..9f492b8a 100644 --- a/dada_tests/heap-graph/past-end/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/past-end/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{3}, - Print.reserve, + Print.give, ), Expr(0), ), diff --git a/dada_tests/heap-graph/rust-thunk/HeapGraph-0.bir.ref b/dada_tests/heap-graph/rust-thunk/HeapGraph-0.bir.ref index 454e0ad3..43b83906 100644 --- a/dada_tests/heap-graph/rust-thunk/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/rust-thunk/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{3}, - Print.reserve, + Print.give, ), Expr(0), ), diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-0.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-0.bir.ref index ca5f35c4..fab53ba7 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{2}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -86,7 +86,7 @@ ( AssignExpr( temp{7}, - Print.reserve, + Print.give, ), Expr(5), ), diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-1.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-1.bir.ref index 8b123814..84ea45ce 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-1.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{2}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -86,7 +86,7 @@ ( AssignExpr( temp{7}, - Print.reserve, + Print.give, ), Expr(5), ), diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-2.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-2.bir.ref index cff1184f..1333860e 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-2.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-2.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{2}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -84,7 +84,7 @@ ( AssignExpr( temp{7}, - Print.reserve, + Print.give, ), Expr(5), ), diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-3.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-3.bir.ref index cff1184f..1333860e 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-3.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-3.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{2}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -84,7 +84,7 @@ ( AssignExpr( temp{7}, - Print.reserve, + Print.give, ), Expr(5), ), diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-4.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-4.bir.ref index 35e2e1fc..21dbd6d4 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-4.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-4.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{2}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -75,7 +75,7 @@ ( AssignExpr( temp{7}, - Print.reserve, + Print.give, ), Expr(5), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.bir.ref index d23a005d..3276b6ba 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.bir.ref index 97b8ba9b..96f4f5e2 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref index b4ffcd17..8d9eddde 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{5}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -153,14 +153,14 @@ ( AssignExpr( temp{13}, - Print.reserve, + Print.give, ), Expr(12), ), ( AssignExpr( temp{14}, - p{0}.x.reserve, + p{0}.x.give, ), Expr(14), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref index 8bae560a..3a48c930 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{5}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -151,14 +151,14 @@ ( AssignExpr( temp{13}, - Print.reserve, + Print.give, ), Expr(12), ), ( AssignExpr( temp{14}, - p{0}.x.reserve, + p{0}.x.give, ), Expr(14), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref index 40c47093..142f5081 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), @@ -158,14 +158,14 @@ ( AssignExpr( temp{14}, - Print.reserve, + Print.give, ), Expr(15), ), ( AssignExpr( temp{15}, - p{0}.x.reserve, + p{0}.x.give, ), Expr(17), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref index 5daba0b7..e6188d0e 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{7}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.bir.ref index 3e3a37e3..3d0e44bb 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{7}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.bir.ref index 8f8eca4e..208d6f3b 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.bir.ref index 2d747d9c..95067e4d 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{5}, - Class(Id { value: 1 }).reserve, + Class(Id { value: 1 }).give, ), Expr(0), ), From 12b12f1ce09d82ae5ddb3a9b0e4e9ebfa2f211b2 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sat, 16 Jul 2022 07:00:27 +0300 Subject: [PATCH 11/36] add test of `p.give.share` (creates `our`) --- dada_tests/permissions/exhaustive/give-var-field-my.dada | 4 ---- dada_tests/permissions/exhaustive/share-var-my-given.dada | 8 ++++++++ .../exhaustive/share-var-my-given/compiler-output.ref | 0 .../permissions/exhaustive/share-var-my-given/stdout.ref | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 dada_tests/permissions/exhaustive/share-var-my-given.dada create mode 100644 dada_tests/permissions/exhaustive/share-var-my-given/compiler-output.ref create mode 100644 dada_tests/permissions/exhaustive/share-var-my-given/stdout.ref diff --git a/dada_tests/permissions/exhaustive/give-var-field-my.dada b/dada_tests/permissions/exhaustive/give-var-field-my.dada index 3473c630..02777bf9 100644 --- a/dada_tests/permissions/exhaustive/give-var-field-my.dada +++ b/dada_tests/permissions/exhaustive/give-var-field-my.dada @@ -1,12 +1,8 @@ class Pair(a, b) async fn main() { - # Here we have an owned point, but in a shared field p = Pair(Pair(22, 44), 66) - - # Giving that makes a my result q = p.a.give - print(p).await #! OUTPUT my Pair\(\(expired\), 66\) print(q).await #! OUTPUT my Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/share-var-my-given.dada b/dada_tests/permissions/exhaustive/share-var-my-given.dada new file mode 100644 index 00000000..d4a44ea3 --- /dev/null +++ b/dada_tests/permissions/exhaustive/share-var-my-given.dada @@ -0,0 +1,8 @@ +class Pair(a, b) + +async fn main() { + p = Pair(22, 44) + q = p.give.share + print(q).await #! OUTPUT our Pair\(22, 44\) + print(p).await #! RUN ERROR your lease to this object was cancelled +} \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/share-var-my-given/compiler-output.ref b/dada_tests/permissions/exhaustive/share-var-my-given/compiler-output.ref new file mode 100644 index 00000000..e69de29b diff --git a/dada_tests/permissions/exhaustive/share-var-my-given/stdout.ref b/dada_tests/permissions/exhaustive/share-var-my-given/stdout.ref new file mode 100644 index 00000000..2aa36059 --- /dev/null +++ b/dada_tests/permissions/exhaustive/share-var-my-given/stdout.ref @@ -0,0 +1 @@ +our Pair(22, 44) From 7f433433fc6192d6564e692dad269a0498c8f66e Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sat, 16 Jul 2022 07:04:18 +0300 Subject: [PATCH 12/36] add a missing test, clean formatting --- .../permissions/exhaustive/assign-var-shleased.dada | 9 +++++++++ .../exhaustive/assign-var-shleased/compiler-output.ref | 0 .../exhaustive/assign-var-shleased/stdout.ref | 1 + dada_tests/reservations/our-to-our-leased-var.dada | 6 +++--- 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 dada_tests/permissions/exhaustive/assign-var-shleased.dada create mode 100644 dada_tests/permissions/exhaustive/assign-var-shleased/compiler-output.ref create mode 100644 dada_tests/permissions/exhaustive/assign-var-shleased/stdout.ref diff --git a/dada_tests/permissions/exhaustive/assign-var-shleased.dada b/dada_tests/permissions/exhaustive/assign-var-shleased.dada new file mode 100644 index 00000000..d66c1886 --- /dev/null +++ b/dada_tests/permissions/exhaustive/assign-var-shleased.dada @@ -0,0 +1,9 @@ +class Pair(a, b) + +async fn main() { + p0 = Pair(22, 44) + p = p0.share + q = p + print(p).await + #! OUTPUT Pair\(22, 44\) +} \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/assign-var-shleased/compiler-output.ref b/dada_tests/permissions/exhaustive/assign-var-shleased/compiler-output.ref new file mode 100644 index 00000000..e69de29b diff --git a/dada_tests/permissions/exhaustive/assign-var-shleased/stdout.ref b/dada_tests/permissions/exhaustive/assign-var-shleased/stdout.ref new file mode 100644 index 00000000..cd1bd4b7 --- /dev/null +++ b/dada_tests/permissions/exhaustive/assign-var-shleased/stdout.ref @@ -0,0 +1 @@ +shleased Pair(22, 44) diff --git a/dada_tests/reservations/our-to-our-leased-var.dada b/dada_tests/reservations/our-to-our-leased-var.dada index e6e97464..bbfb0f70 100644 --- a/dada_tests/reservations/our-to-our-leased-var.dada +++ b/dada_tests/reservations/our-to-our-leased-var.dada @@ -1,9 +1,9 @@ class Point(a, b) async fn main() { - p = Point(22, 44).share - q = p # `q` becomes 2nd owner of `(22, 44)`.shlease - p := Point(44, 66) # reassigning `p` has no effect on `q` + p = Point(22, 44).share # `p` is `our Point` + q = p # `q` is 2nd owner of the point + p := Point(44, 66) # reassigning `p` has no effect on `q` print(p).await #! OUTPUT Point\(44, 66\) print(q).await #! OUTPUT Point\(22, 44\) From b7cf4b5313749654f48d1c8ba0396747cf5d7397 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sat, 16 Jul 2022 09:23:29 +0300 Subject: [PATCH 13/36] remove deep propagation of reservations and add some tests to show the result (you have to lease inside an if/then/else, for example) --- components/dada-validate/src/validate/validator.rs | 14 +++++++------- dada_tests/assignments/assign-atomic.dada | 5 +++++ .../assignments/assign-atomic/compiler-output.ref | 0 dada_tests/assignments/assign-atomic/stdout.ref | 0 dada_tests/assignments/assign-atomiclease.dada | 5 +++++ .../assign-atomiclease/compiler-output.ref | 0 .../assignments/assign-atomiclease/stdout.ref | 1 + dada_tests/assignments/assign-if-then-else.dada | 7 +++++++ .../assign-if-then-else/compiler-output.ref | 0 .../assignments/assign-if-then-else/stdout.ref | 0 .../assignments/assign-if-thenlease-elselease.dada | 7 +++++++ .../compiler-output.ref | 0 .../assign-if-thenlease-elselease/stdout.ref | 2 ++ 13 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 dada_tests/assignments/assign-atomic.dada create mode 100644 dada_tests/assignments/assign-atomic/compiler-output.ref create mode 100644 dada_tests/assignments/assign-atomic/stdout.ref create mode 100644 dada_tests/assignments/assign-atomiclease.dada create mode 100644 dada_tests/assignments/assign-atomiclease/compiler-output.ref create mode 100644 dada_tests/assignments/assign-atomiclease/stdout.ref create mode 100644 dada_tests/assignments/assign-if-then-else.dada create mode 100644 dada_tests/assignments/assign-if-then-else/compiler-output.ref create mode 100644 dada_tests/assignments/assign-if-then-else/stdout.ref create mode 100644 dada_tests/assignments/assign-if-thenlease-elselease.dada create mode 100644 dada_tests/assignments/assign-if-thenlease-elselease/compiler-output.ref create mode 100644 dada_tests/assignments/assign-if-thenlease-elselease/stdout.ref diff --git a/components/dada-validate/src/validate/validator.rs b/components/dada-validate/src/validate/validator.rs index aeef8aab..faf68207 100644 --- a/components/dada-validate/src/validate/validator.rs +++ b/components/dada-validate/src/validate/validator.rs @@ -425,10 +425,10 @@ impl<'me> Validator<'me> { syntax::ExprData::If(condition_expr, then_expr, else_expr) => { let validated_condition_expr = self.validate_expr(*condition_expr); - let validated_then_expr = self.subscope().validate_expr_and_exit(*then_expr, mode); + let validated_then_expr = self.subscope().validate_expr_and_exit(*then_expr); let validated_else_expr = match else_expr { None => self.empty_tuple(expr), - Some(else_expr) => self.subscope().validate_expr_and_exit(*else_expr, mode), + Some(else_expr) => self.subscope().validate_expr_and_exit(*else_expr), }; self.add( validated::ExprData::If( @@ -446,7 +446,7 @@ impl<'me> Validator<'me> { .with_effect(Effect::Atomic, |this| { this.span(expr).leading_keyword(this.db, Keyword::Atomic) }) - .validate_expr_and_exit(*atomic_expr, mode); + .validate_expr_and_exit(*atomic_expr); self.add(validated::ExprData::Atomic(validated_atomic_expr), expr) } @@ -458,7 +458,7 @@ impl<'me> Validator<'me> { let validated_body_expr = self .subscope() .with_loop_expr(loop_expr) - .validate_expr_and_exit(*body_expr, ExprMode::Default); + .validate_expr_and_exit(*body_expr); self.tables[loop_expr] = validated::ExprData::Loop(validated_body_expr); @@ -481,7 +481,7 @@ impl<'me> Validator<'me> { let validated_body_expr = self .subscope() .with_loop_expr(loop_expr) - .validate_expr_and_exit(*body_expr, mode); + .validate_expr_and_exit(*body_expr); let if_break_expr = { // break @@ -742,8 +742,8 @@ impl<'me> Validator<'me> { /// Validate the expression and then exit the subscope (consumes self). /// See [`Self::exit`]. - fn validate_expr_and_exit(mut self, expr: syntax::Expr, mode: ExprMode) -> validated::Expr { - let validated_expr = self.validate_expr_in_mode(expr, mode); + fn validate_expr_and_exit(mut self, expr: syntax::Expr) -> validated::Expr { + let validated_expr = self.validate_expr(expr); self.exit(validated_expr) } diff --git a/dada_tests/assignments/assign-atomic.dada b/dada_tests/assignments/assign-atomic.dada new file mode 100644 index 00000000..8350af73 --- /dev/null +++ b/dada_tests/assignments/assign-atomic.dada @@ -0,0 +1,5 @@ +class Point(x, y) +p = Point(22, 44) +t = true +atomic { p }.x += 1 +print(p).await #! RUN ERROR your lease to this object diff --git a/dada_tests/assignments/assign-atomic/compiler-output.ref b/dada_tests/assignments/assign-atomic/compiler-output.ref new file mode 100644 index 00000000..e69de29b diff --git a/dada_tests/assignments/assign-atomic/stdout.ref b/dada_tests/assignments/assign-atomic/stdout.ref new file mode 100644 index 00000000..e69de29b diff --git a/dada_tests/assignments/assign-atomiclease.dada b/dada_tests/assignments/assign-atomiclease.dada new file mode 100644 index 00000000..6ec1c50d --- /dev/null +++ b/dada_tests/assignments/assign-atomiclease.dada @@ -0,0 +1,5 @@ +class Point(x, y) +p = Point(22, 44) +t = true +atomic { p.lease }.x += 1 +print(p).await #! OUTPUT Point\(23, 44\) diff --git a/dada_tests/assignments/assign-atomiclease/compiler-output.ref b/dada_tests/assignments/assign-atomiclease/compiler-output.ref new file mode 100644 index 00000000..e69de29b diff --git a/dada_tests/assignments/assign-atomiclease/stdout.ref b/dada_tests/assignments/assign-atomiclease/stdout.ref new file mode 100644 index 00000000..e56b542f --- /dev/null +++ b/dada_tests/assignments/assign-atomiclease/stdout.ref @@ -0,0 +1 @@ +my Point(23, 44) diff --git a/dada_tests/assignments/assign-if-then-else.dada b/dada_tests/assignments/assign-if-then-else.dada new file mode 100644 index 00000000..510a87a4 --- /dev/null +++ b/dada_tests/assignments/assign-if-then-else.dada @@ -0,0 +1,7 @@ +class Point(x, y) +p = Point(22, 44) +q = Point(66, 88) +t = true +if t { p } else { q }.x += 1 +print(p).await #! RUN ERROR your lease to this object +print(q).await \ No newline at end of file diff --git a/dada_tests/assignments/assign-if-then-else/compiler-output.ref b/dada_tests/assignments/assign-if-then-else/compiler-output.ref new file mode 100644 index 00000000..e69de29b diff --git a/dada_tests/assignments/assign-if-then-else/stdout.ref b/dada_tests/assignments/assign-if-then-else/stdout.ref new file mode 100644 index 00000000..e69de29b diff --git a/dada_tests/assignments/assign-if-thenlease-elselease.dada b/dada_tests/assignments/assign-if-thenlease-elselease.dada new file mode 100644 index 00000000..f3a7d521 --- /dev/null +++ b/dada_tests/assignments/assign-if-thenlease-elselease.dada @@ -0,0 +1,7 @@ +class Point(x, y) +p = Point(22, 44) +q = Point(66, 88) +t = true +if t { p.lease } else { q.lease }.x += 1 +print(p).await #! OUTPUT Point\(23, 44\) +print(q).await #! OUTPUT Point\(66, 88\) \ No newline at end of file diff --git a/dada_tests/assignments/assign-if-thenlease-elselease/compiler-output.ref b/dada_tests/assignments/assign-if-thenlease-elselease/compiler-output.ref new file mode 100644 index 00000000..e69de29b diff --git a/dada_tests/assignments/assign-if-thenlease-elselease/stdout.ref b/dada_tests/assignments/assign-if-thenlease-elselease/stdout.ref new file mode 100644 index 00000000..6d874897 --- /dev/null +++ b/dada_tests/assignments/assign-if-thenlease-elselease/stdout.ref @@ -0,0 +1,2 @@ +my Point(23, 44) +my Point(66, 88) From f9ea03c799d7e581ba232ff537983bb7195a8f54 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sat, 16 Jul 2022 10:24:16 +0300 Subject: [PATCH 14/36] refactor `validate_expr_as_place` to take closure instead of returning a complex type --- .../dada-validate/src/validate/validator.rs | 85 ++++++++----------- 1 file changed, 37 insertions(+), 48 deletions(-) diff --git a/components/dada-validate/src/validate/validator.rs b/components/dada-validate/src/validate/validator.rs index faf68207..e79eca56 100644 --- a/components/dada-validate/src/validate/validator.rs +++ b/components/dada-validate/src/validate/validator.rs @@ -223,10 +223,10 @@ impl<'me> Validator<'me> { fn validate_expr_in_mode(&mut self, expr: syntax::Expr, mode: ExprMode) -> validated::Expr { tracing::trace!("expr.data = {:?}", expr.data(self.syntax_tables())); match expr.data(self.syntax_tables()) { - syntax::ExprData::Dot(..) | syntax::ExprData::Id(_) => { - let place = self.validate_expr_as_place(expr); - self.place_to_expr(place, expr.synthesized(), mode) - } + syntax::ExprData::Dot(..) | syntax::ExprData::Id(_) => self + .with_expr_validated_as_place(expr, &mut |this, place| { + this.place_to_expr(place, expr.synthesized(), mode) + }), syntax::ExprData::BooleanLiteral(b) => { self.add(validated::ExprData::BooleanLiteral(*b), expr) @@ -606,6 +606,7 @@ impl<'me> Validator<'me> { // // { // temp_leased_owner = owner.lease + // temp_value = // temp_value = temp_leased_owner.x + // temp_leased_owner.x = temp_value.give // } @@ -786,26 +787,14 @@ impl<'me> Validator<'me> { fn place_to_expr( &mut self, - data: Result<(Option, validated::Place), ErrorReported>, + place: validated::Place, origin: ExprOrigin, mode: ExprMode, ) -> validated::Expr { - match data { - Ok((opt_assign_expr, place)) => match mode { - ExprMode::Default => { - let place_expr = self.add(validated::ExprData::Give(place), origin); - self.seq(opt_assign_expr, place_expr) - } - ExprMode::Leased => { - let place_expr = self.add(validated::ExprData::Lease(place), origin); - self.seq(opt_assign_expr, place_expr) - } - ExprMode::Reserve => { - let place_expr = self.add(validated::ExprData::Reserve(place), origin); - self.seq(opt_assign_expr, place_expr) - } - }, - Err(ErrorReported) => self.add(validated::ExprData::Error, origin), + match mode { + ExprMode::Default => self.add(validated::ExprData::Give(place), origin), + ExprMode::Leased => self.add(validated::ExprData::Lease(place), origin), + ExprMode::Reserve => self.add(validated::ExprData::Reserve(place), origin), } } @@ -815,12 +804,9 @@ impl<'me> Validator<'me> { target_expr: syntax::Expr, perm_variant: impl Fn(validated::Place) -> validated::ExprData, ) -> validated::Expr { - let validated_data = try { - let (opt_temporary_expr, place) = self.validate_expr_as_place(target_expr)?; - let permission_expr = self.add(perm_variant(place), perm_expr); - self.seq(opt_temporary_expr, permission_expr) - }; - self.or_error(validated_data, perm_expr) + self.with_expr_validated_as_place(target_expr, &mut |this, place| { + this.add(perm_variant(place), perm_expr) + }) } fn is_place_expression(&self, expr: syntax::Expr) -> bool { @@ -833,14 +819,19 @@ impl<'me> Validator<'me> { } } - fn validate_expr_as_place( + /// Validates `expr` as a place. Invokes `op` with the place to + /// produce the final expression. Doesn't directly return that + /// expression because it may introduce temporaries + /// that are referenced by the place given to op, and if `expr` + /// is malformed may return an error expression. + fn with_expr_validated_as_place( &mut self, expr: syntax::Expr, - ) -> Result<(Option, validated::Place), ErrorReported> { + op: &mut dyn FnMut(&mut Self, validated::Place) -> validated::Expr, + ) -> validated::Expr { match expr.data(self.syntax_tables()) { - syntax::ExprData::Id(name) => Ok(( - None, - match self.scope.lookup(*name) { + syntax::ExprData::Id(name) => { + let place = match self.scope.lookup(*name) { Some(Definition::Class(c)) => self.add(validated::PlaceData::Class(c), expr), Some(Definition::Function(f)) => { self.add(validated::PlaceData::Function(f), expr) @@ -852,34 +843,32 @@ impl<'me> Validator<'me> { self.add(validated::PlaceData::Intrinsic(i), expr) } None => { - return Err(dada_ir::error!( + let ErrorReported = dada_ir::error!( self.span(expr), "can't find anything named `{}`", name.as_str(self.db) ) - .emit(self.db)) + .emit(self.db); + return self.add(validated::ExprData::Error, expr); } - }, - )), + }; + op(self, place) + } syntax::ExprData::Dot(owner_expr, field) => { - let (opt_temporary_expr, validated_owner_place) = - self.validate_expr_as_place(*owner_expr)?; - Ok(( - opt_temporary_expr, - self.add( - validated::PlaceData::Dot(validated_owner_place, *field), - expr, - ), - )) + self.with_expr_validated_as_place(*owner_expr, &mut |this, owner_place| { + let dot_place = this.add(validated::PlaceData::Dot(owner_place, *field), expr); + op(this, dot_place) + }) } syntax::ExprData::Parenthesized(parenthesized_expr) => { - self.validate_expr_as_place(*parenthesized_expr) + self.with_expr_validated_as_place(*parenthesized_expr, op) } - syntax::ExprData::Error => Err(ErrorReported), + syntax::ExprData::Error => self.add(validated::ExprData::Error, expr), _ => { let (assign_expr, temporary_place) = self.validate_expr_in_temporary(expr, ExprMode::Default); - Ok((Some(assign_expr), temporary_place)) + let expr = op(self, temporary_place); + self.seq(Some(assign_expr), expr) } } } From e440453958d839351a89a7df6103c9dfb0139944 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sun, 17 Jul 2022 05:58:38 +0300 Subject: [PATCH 15/36] validate_expr_as_target_place -> callback This form will allow us to add "rewrites" so that we no longer use reservations. Hence `p.x += p.y` will work by rewriting `p` to reference the lease created by `p.x` --- .../dada-validate/src/validate/validator.rs | 119 +++++++++--------- 1 file changed, 63 insertions(+), 56 deletions(-) diff --git a/components/dada-validate/src/validate/validator.rs b/components/dada-validate/src/validate/validator.rs index e79eca56..0666e065 100644 --- a/components/dada-validate/src/validate/validator.rs +++ b/components/dada-validate/src/validate/validator.rs @@ -1,5 +1,6 @@ use dada_id::prelude::*; use dada_ir::code::syntax; +use dada_ir::code::syntax::op::Op; use dada_ir::code::syntax::LocalVariableDecl; use dada_ir::code::validated; use dada_ir::code::validated::ExprOrigin; @@ -135,14 +136,6 @@ impl<'me> Validator<'me> { key } - fn or_error( - &mut self, - data: Result, - origin: syntax::Expr, - ) -> validated::Expr { - data.unwrap_or_else(|ErrorReported| self.add(validated::ExprData::Error, origin)) - } - fn span(&self, e: impl HasOriginIn) -> FileSpan { self.function.syntax_tree(self.db).spans(self.db)[e] .in_file(self.function.filename(self.db)) @@ -530,23 +523,16 @@ impl<'me> Validator<'me> { ) } - syntax::ExprData::OpEq(..) => { - let result = self.validate_op_eq(expr); - self.or_error(result, expr) - } - - syntax::ExprData::Assign(lhs_expr, rhs_expr) => { - let result = try { - let (validated_lhs_opt_temp_expr, validated_lhs_place) = - self.validate_expr_as_target_place(*lhs_expr, ExprMode::Reserve)?; - - let assign_expr = - self.validated_assignment(validated_lhs_place, *rhs_expr, expr); + syntax::ExprData::OpEq(..) => self.validate_op_eq(expr), - self.seq(validated_lhs_opt_temp_expr, assign_expr) - }; - self.or_error(result, expr) - } + syntax::ExprData::Assign(lhs_expr, rhs_expr) => self + .with_expr_validated_as_target_place( + *lhs_expr, + ExprMode::Reserve, + &mut |this, validated_lhs_place| { + this.validated_assignment(validated_lhs_place, *rhs_expr, expr) + }, + ), syntax::ExprData::Error => self.add(validated::ExprData::Error, expr), syntax::ExprData::Seq(exprs) => { @@ -591,10 +577,7 @@ impl<'me> Validator<'me> { } } - fn validate_op_eq( - &mut self, - op_eq_expr: syntax::Expr, - ) -> Result { + fn validate_op_eq(&mut self, op_eq_expr: syntax::Expr) -> validated::Expr { // if user wrote `x += `, we generate // // { @@ -618,9 +601,29 @@ impl<'me> Validator<'me> { }; // `temp_leased_owner = owner.lease` (if this is a field) - let (lease_owner_expr, validated_target_place) = - self.validate_expr_as_target_place(lhs_expr, ExprMode::Leased)?; + self.with_expr_validated_as_target_place( + lhs_expr, + ExprMode::Leased, + &mut |this, validated_target_place| { + this.validate_op_eq_with_target_place( + op_eq_expr, + lhs_expr, + op, + rhs_expr, + validated_target_place, + ) + }, + ) + } + fn validate_op_eq_with_target_place( + &mut self, + op_eq_expr: syntax::Expr, + lhs_expr: syntax::Expr, + op: Op, + rhs_expr: syntax::Expr, + validated_target_place: validated::TargetPlace, + ) -> validated::Expr { // `temp_value = x + ` or `temp_value = temp_leased_owner.x + ` let (temporary_assign_expr, temporary_place) = { let validated_op = self.validated_op(op); @@ -665,12 +668,7 @@ impl<'me> Validator<'me> { op_eq_expr, ); - Ok(self.seq( - lease_owner_expr - .into_iter() - .chain(Some(temporary_assign_expr)), - assign_field_expr, - )) + self.seq(Some(temporary_assign_expr), assign_field_expr) } fn validated_assignment( @@ -686,11 +684,12 @@ impl<'me> Validator<'me> { ) } - fn validate_expr_as_target_place( + fn with_expr_validated_as_target_place( &mut self, expr: syntax::Expr, owner_mode: ExprMode, - ) -> Result<(Option, validated::TargetPlace), ErrorReported> { + op: &mut dyn FnMut(&mut Self, validated::TargetPlace) -> validated::Expr, + ) -> validated::Expr { match expr.data(self.syntax_tables()) { syntax::ExprData::Dot(owner, field_name) => { let (assign_expr, owner_place) = @@ -699,44 +698,52 @@ impl<'me> Validator<'me> { validated::TargetPlaceData::Dot(owner_place, *field_name), expr, ); - Ok((Some(assign_expr), place)) + let expr = op(self, place); + self.seq(Some(assign_expr), expr) } syntax::ExprData::Id(name) => match self.scope.lookup(*name) { Some(Definition::LocalVariable(lv)) => { let place = self.add(validated::TargetPlaceData::LocalVariable(lv), expr); - Ok((None, place)) + op(self, place) } Some(definition @ Definition::Function(_)) | Some(definition @ Definition::Class(_)) - | Some(definition @ Definition::Intrinsic(_)) => Err(dada_ir::error!( - self.span(expr), - "you can only assign to local variables or fields, not {} like `{}`", - definition.plural_description(), - name.as_str(self.db), - ) - .emit(self.db)), + | Some(definition @ Definition::Intrinsic(_)) => { + let ErrorReported = dada_ir::error!( + self.span(expr), + "you can only assign to local variables or fields, not {} like `{}`", + definition.plural_description(), + name.as_str(self.db), + ) + .emit(self.db); + self.add(validated::ExprData::Error, expr) + } - None => Err(dada_ir::error!( - self.span(expr), - "can't find anything named `{}`", - name.as_str(self.db) - ) - .emit(self.db)), + None => { + let ErrorReported = dada_ir::error!( + self.span(expr), + "can't find anything named `{}`", + name.as_str(self.db) + ) + .emit(self.db); + self.add(validated::ExprData::Error, expr) + } }, syntax::ExprData::Parenthesized(target_expr) => { - self.validate_expr_as_target_place(*target_expr, owner_mode) + self.with_expr_validated_as_target_place(*target_expr, owner_mode, op) } _ => { let _ = self.validate_expr(expr); - Err(dada_ir::error!( + let ErrorReported = dada_ir::error!( self.span(expr), "you can only assign to local variables and fields, not arbitrary expressions", ) - .emit(self.db)) + .emit(self.db); + self.add(validated::ExprData::Error, expr) } } } From 62ee97d9a9102b1bd360a544e6fd289bbf95c05d Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sun, 17 Jul 2022 06:48:11 +0300 Subject: [PATCH 16/36] change target-place to not lease so eagerly We used to compile `a.b := foo` to ``` tmp1 = a.lease tmp2 = foo tmp1.b := foo ``` but we now compile to ``` tmp2 = foo a.b := foo ``` We will still evaluate function calls and other "obviously side-effecting" things left-to-right. --- .../dada-validate/src/validate/validator.rs | 74 +++++++++---------- .../assignments/assign-fields-x+=y.dada | 4 + .../assign-fields-x+=y/compiler-output.ref | 0 .../assignments/assign-fields-x+=y/stdout.ref | 1 + dada_tests/assignments/assign-fields-x=y.dada | 4 + .../assign-fields-x=y/compiler-output.ref | 0 .../assignments/assign-fields-x=y/stdout.ref | 1 + .../mid-increment/HeapGraph-0.bir.ref | 71 ++++++++---------- .../heap-graph/mid-increment/HeapGraph-0.ref | 4 +- .../tutorial-lease-10/HeapGraph-0.bir.ref | 73 +++++++++--------- .../tutorial-lease-10/HeapGraph-0.ref | 6 +- .../tutorial-lease-10/HeapGraph-1.bir.ref | 71 ++++++++---------- .../tutorial-lease-10/HeapGraph-1.ref | 4 +- .../tutorial-lease-20/HeapGraph-0.bir.ref | 71 ++++++++---------- .../tutorial-lease-20/HeapGraph-0.ref | 4 +- .../tutorial-lease-30/HeapGraph-0.bir.ref | 53 ++++++------- .../tutorial-lease-30/HeapGraph-0.ref | 8 +- 17 files changed, 210 insertions(+), 239 deletions(-) create mode 100644 dada_tests/assignments/assign-fields-x+=y.dada create mode 100644 dada_tests/assignments/assign-fields-x+=y/compiler-output.ref create mode 100644 dada_tests/assignments/assign-fields-x+=y/stdout.ref create mode 100644 dada_tests/assignments/assign-fields-x=y.dada create mode 100644 dada_tests/assignments/assign-fields-x=y/compiler-output.ref create mode 100644 dada_tests/assignments/assign-fields-x=y/stdout.ref diff --git a/components/dada-validate/src/validate/validator.rs b/components/dada-validate/src/validate/validator.rs index 0666e065..40076cb4 100644 --- a/components/dada-validate/src/validate/validator.rs +++ b/components/dada-validate/src/validate/validator.rs @@ -47,14 +47,6 @@ pub enum ExprMode { /// In `a.f = `, `a` is evaluated in "leased" mode Leased, - - /// We sometimes "reserve" an expression before actually using it; - /// this ensures that it remains valid even as subsequent things are executed. - /// - /// Example: `foo(, )` reserves `` - /// - /// This logic may be removed, not sure yet. - Reserve, } impl<'me> Validator<'me> { @@ -399,7 +391,12 @@ impl<'me> Validator<'me> { expr.synthesized(), ); - self.validated_assignment(target_place, *initializer_expr, expr) + let validated_initializer_expr = self.validate_expr(*initializer_expr); + + self.add( + validated::ExprData::Assign(target_place, validated_initializer_expr), + expr, + ) } syntax::ExprData::Parenthesized(parenthesized_expr) => { @@ -525,14 +522,9 @@ impl<'me> Validator<'me> { syntax::ExprData::OpEq(..) => self.validate_op_eq(expr), - syntax::ExprData::Assign(lhs_expr, rhs_expr) => self - .with_expr_validated_as_target_place( - *lhs_expr, - ExprMode::Reserve, - &mut |this, validated_lhs_place| { - this.validated_assignment(validated_lhs_place, *rhs_expr, expr) - }, - ), + syntax::ExprData::Assign(lhs_expr, rhs_expr) => { + self.validate_assign_expr(expr, *lhs_expr, *rhs_expr) + } syntax::ExprData::Error => self.add(validated::ExprData::Error, expr), syntax::ExprData::Seq(exprs) => { @@ -671,19 +663,6 @@ impl<'me> Validator<'me> { self.seq(Some(temporary_assign_expr), assign_field_expr) } - fn validated_assignment( - &mut self, - target_place: validated::TargetPlace, - initializer_expr: syntax::Expr, - origin: syntax::Expr, - ) -> validated::Expr { - let validated_expr = self.validate_expr(initializer_expr); - self.add( - validated::ExprData::Assign(target_place, validated_expr), - origin, - ) - } - fn with_expr_validated_as_target_place( &mut self, expr: syntax::Expr, @@ -692,14 +671,13 @@ impl<'me> Validator<'me> { ) -> validated::Expr { match expr.data(self.syntax_tables()) { syntax::ExprData::Dot(owner, field_name) => { - let (assign_expr, owner_place) = - self.validate_expr_in_temporary(*owner, owner_mode); - let place = self.add( - validated::TargetPlaceData::Dot(owner_place, *field_name), - expr, - ); - let expr = op(self, place); - self.seq(Some(assign_expr), expr) + self.with_expr_validated_as_place(*owner, &mut |this, owner_place| { + let target_place = this.add( + validated::TargetPlaceData::Dot(owner_place, *field_name), + expr, + ); + op(this, target_place) + }) } syntax::ExprData::Id(name) => match self.scope.lookup(*name) { @@ -801,7 +779,6 @@ impl<'me> Validator<'me> { match mode { ExprMode::Default => self.add(validated::ExprData::Give(place), origin), ExprMode::Leased => self.add(validated::ExprData::Lease(place), origin), - ExprMode::Reserve => self.add(validated::ExprData::Reserve(place), origin), } } @@ -974,6 +951,25 @@ impl<'me> Validator<'me> { } } } + + pub(crate) fn validate_assign_expr( + &mut self, + assign_expr: syntax::Expr, + lhs_expr: syntax::Expr, + initializer_expr: syntax::Expr, + ) -> validated::Expr { + self.with_expr_validated_as_target_place( + lhs_expr, + ExprMode::Leased, + &mut |this, target_place| { + let validated_expr = this.validate_expr(initializer_expr); + this.add( + validated::ExprData::Assign(target_place, validated_expr), + assign_expr, + ) + }, + ) + } } fn count_bytes_in_common(s1: &[u8], s2: &[u8]) -> usize { diff --git a/dada_tests/assignments/assign-fields-x+=y.dada b/dada_tests/assignments/assign-fields-x+=y.dada new file mode 100644 index 00000000..58d3cea2 --- /dev/null +++ b/dada_tests/assignments/assign-fields-x+=y.dada @@ -0,0 +1,4 @@ +class Point(x, y) +p = Point(22, 44) +p.x += p.y +print(p).await #! OUTPUT Point\(66, 44\) diff --git a/dada_tests/assignments/assign-fields-x+=y/compiler-output.ref b/dada_tests/assignments/assign-fields-x+=y/compiler-output.ref new file mode 100644 index 00000000..e69de29b diff --git a/dada_tests/assignments/assign-fields-x+=y/stdout.ref b/dada_tests/assignments/assign-fields-x+=y/stdout.ref new file mode 100644 index 00000000..1889756b --- /dev/null +++ b/dada_tests/assignments/assign-fields-x+=y/stdout.ref @@ -0,0 +1 @@ +my Point(66, 44) diff --git a/dada_tests/assignments/assign-fields-x=y.dada b/dada_tests/assignments/assign-fields-x=y.dada new file mode 100644 index 00000000..90daa072 --- /dev/null +++ b/dada_tests/assignments/assign-fields-x=y.dada @@ -0,0 +1,4 @@ +class Point(x, y) +p = Point(22, 44) +p.x := p.y +print(p).await #! OUTPUT Point\(44, 44\) \ No newline at end of file diff --git a/dada_tests/assignments/assign-fields-x=y/compiler-output.ref b/dada_tests/assignments/assign-fields-x=y/compiler-output.ref new file mode 100644 index 00000000..e69de29b diff --git a/dada_tests/assignments/assign-fields-x=y/stdout.ref b/dada_tests/assignments/assign-fields-x=y/stdout.ref new file mode 100644 index 00000000..a7154e15 --- /dev/null +++ b/dada_tests/assignments/assign-fields-x=y/stdout.ref @@ -0,0 +1 @@ +my Point(44, 44) diff --git a/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref b/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref index 67d43521..451b0f29 100644 --- a/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref @@ -5,21 +5,21 @@ [ ( AssignExpr( - temp{5}, + temp{4}, Class(Id { value: 1 }).give, ), Expr(0), ), ( AssignExpr( - temp{6}, + temp{5}, 22, ), Expr(1), ), ( AssignExpr( - temp{7}, + temp{6}, 44, ), Expr(2), @@ -28,10 +28,10 @@ Assign( p{0}, Call( - temp{5}, + temp{4}, [ + temp{5}, temp{6}, - temp{7}, ], [ None, @@ -45,19 +45,19 @@ [ ( Clear( - temp{7}, + temp{6}, ), Expr(2), ), ( Clear( - temp{6}, + temp{5}, ), Expr(1), ), ( Clear( - temp{5}, + temp{4}, ), Expr(0), ), @@ -70,41 +70,34 @@ ), ( AssignExpr( - temp{2}, - q{1}.lease, - ), - Expr(8), - ), - ( - AssignExpr( - temp{9}, - temp{2}.x.give, + temp{8}, + q{1}.x.give, ), Expr(9), ), ( AssignExpr( - temp{10}, + temp{9}, 1, ), Expr(10), ), ( AssignExpr( - temp{3}, - temp{9} + temp{10}, + temp{2}, + temp{8} + temp{9}, ), Expr(11), ), ( Clear( - temp{10}, + temp{9}, ), Expr(10), ), ( Clear( - temp{9}, + temp{8}, ), Expr(9), ), @@ -117,8 +110,8 @@ ), ( AssignExpr( - temp{2}.x, - temp{3}.give, + q{1}.x, + temp{2}.give, ), Expr(11), ), @@ -133,38 +126,38 @@ ), ( AssignExpr( - temp{8}, + temp{7}, (), ), Expr(11), ), ( Clear( - temp{8}, + temp{7}, ), Expr(11), ), ( AssignExpr( - temp{13}, + temp{12}, Print.give, ), Expr(12), ), ( AssignExpr( - temp{14}, + temp{13}, q{1}.give, ), Expr(13), ), ], Assign( - temp{12}, + temp{11}, Call( - temp{13}, + temp{12}, [ - temp{14}, + temp{13}, ], [ None, @@ -177,21 +170,21 @@ [ ( Clear( - temp{14}, + temp{13}, ), Expr(13), ), ( Clear( - temp{13}, + temp{12}, ), Expr(12), ), ], Assign( - temp{11}, + temp{10}, Await( - temp{12}, + temp{11}, ), BasicBlock(3), ), @@ -200,26 +193,26 @@ [ ( Clear( - temp{12}, + temp{11}, ), Expr(14), ), ( Clear( - temp{11}, + temp{10}, ), Expr(15), ), ( AssignExpr( - temp{4}, + temp{3}, (), ), Expr(16), ), ], Return( - temp{4}, + temp{3}, ), ), }, diff --git a/dada_tests/heap-graph/mid-increment/HeapGraph-0.ref b/dada_tests/heap-graph/mid-increment/HeapGraph-0.ref index 23751d8c..526fd34b 100644 --- a/dada_tests/heap-graph/mid-increment/HeapGraph-0.ref +++ b/dada_tests/heap-graph/mid-increment/HeapGraph-0.ref @@ -26,7 +26,7 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "afterstack":1 -> "afternode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; + "afterstack":1 -> "afternode0" [label="leased", style="solid", penwidth=1.0, arrowtype="empty", color="red"]; } subgraph cluster_before { label=<before> @@ -52,7 +52,7 @@ digraph { > ]; "beforestack":0 -> "beforenode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "beforestack":1 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; + "beforestack":1 -> "beforenode0" [label="leased", style="solid", penwidth=1.0, arrowtype="empty", color="red"]; } } leased Point(23, 44) diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref index 8d9eddde..227e92f3 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref @@ -5,21 +5,21 @@ [ ( AssignExpr( - temp{5}, + temp{4}, Class(Id { value: 1 }).give, ), Expr(0), ), ( AssignExpr( - temp{6}, + temp{5}, 22, ), Expr(1), ), ( AssignExpr( - temp{7}, + temp{6}, 44, ), Expr(2), @@ -28,10 +28,10 @@ Assign( p{0}, Call( - temp{5}, + temp{4}, [ + temp{5}, temp{6}, - temp{7}, ], [ Some( @@ -49,19 +49,19 @@ [ ( Clear( - temp{7}, + temp{6}, ), Expr(2), ), ( Clear( - temp{6}, + temp{5}, ), Expr(1), ), ( Clear( - temp{5}, + temp{4}, ), Expr(0), ), @@ -74,15 +74,8 @@ ), ( AssignExpr( - temp{2}, - q{1}.lease, - ), - Expr(8), - ), - ( - AssignExpr( - temp{9}, - temp{2}.x.give, + temp{8}, + q{1}.x.give, ), Expr(9), ), @@ -95,7 +88,7 @@ ), ( AssignExpr( - temp{10}, + temp{9}, 1, ), Expr(10), @@ -106,71 +99,71 @@ 0, Expr(10), Some( - temp{10}, + temp{9}, ), ), Expr(10), ), ( AssignExpr( - temp{3}, - temp{9} + temp{10}, + temp{2}, + temp{8} + temp{9}, ), Expr(11), ), ( Clear( - temp{10}, + temp{9}, ), Expr(10), ), ( Clear( - temp{9}, + temp{8}, ), Expr(9), ), ( AssignExpr( - temp{2}.x, - temp{3}.give, + q{1}.x, + temp{2}.give, ), Expr(11), ), ( AssignExpr( - temp{8}, + temp{7}, (), ), Expr(11), ), ( Clear( - temp{8}, + temp{7}, ), Expr(11), ), ( AssignExpr( - temp{13}, + temp{12}, Print.give, ), Expr(12), ), ( AssignExpr( - temp{14}, + temp{13}, p{0}.x.give, ), Expr(14), ), ], Assign( - temp{12}, + temp{11}, Call( - temp{13}, + temp{12}, [ - temp{14}, + temp{13}, ], [ None, @@ -183,21 +176,21 @@ [ ( Clear( - temp{14}, + temp{13}, ), Expr(14), ), ( Clear( - temp{13}, + temp{12}, ), Expr(12), ), ], Assign( - temp{11}, + temp{10}, Await( - temp{12}, + temp{11}, ), BasicBlock(3), ), @@ -206,26 +199,26 @@ [ ( Clear( - temp{12}, + temp{11}, ), Expr(15), ), ( Clear( - temp{11}, + temp{10}, ), Expr(16), ), ( AssignExpr( - temp{4}, + temp{3}, (), ), Expr(17), ), ], Return( - temp{4}, + temp{3}, ), ), }, diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.ref index 1db3d00d..d7001eb2 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.ref @@ -14,7 +14,7 @@ digraph { main p q - (in-flight): "1" + (in-flight): "1" >; ]; @@ -29,7 +29,7 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "afterstack":1 -> "afternode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; + "afterstack":1 -> "afternode0" [label="leased", style="solid", penwidth=1.0, arrowtype="empty", color="red"]; } subgraph cluster_before { label=<before> @@ -57,7 +57,7 @@ digraph { > ]; "beforestack":0 -> "beforenode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "beforestack":1 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; + "beforestack":1 -> "beforenode0" [label="leased", style="solid", penwidth=1.0, arrowtype="empty", color="red"]; } } 23 diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref index 3a48c930..2182a224 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref @@ -5,21 +5,21 @@ [ ( AssignExpr( - temp{5}, + temp{4}, Class(Id { value: 1 }).give, ), Expr(0), ), ( AssignExpr( - temp{6}, + temp{5}, 22, ), Expr(1), ), ( AssignExpr( - temp{7}, + temp{6}, 44, ), Expr(2), @@ -28,10 +28,10 @@ Assign( p{0}, Call( - temp{5}, + temp{4}, [ + temp{5}, temp{6}, - temp{7}, ], [ Some( @@ -49,19 +49,19 @@ [ ( Clear( - temp{7}, + temp{6}, ), Expr(2), ), ( Clear( - temp{6}, + temp{5}, ), Expr(1), ), ( Clear( - temp{5}, + temp{4}, ), Expr(0), ), @@ -74,41 +74,34 @@ ), ( AssignExpr( - temp{2}, - q{1}.lease, - ), - Expr(8), - ), - ( - AssignExpr( - temp{9}, - temp{2}.x.give, + temp{8}, + q{1}.x.give, ), Expr(9), ), ( AssignExpr( - temp{10}, + temp{9}, 1, ), Expr(10), ), ( AssignExpr( - temp{3}, - temp{9} + temp{10}, + temp{2}, + temp{8} + temp{9}, ), Expr(11), ), ( Clear( - temp{10}, + temp{9}, ), Expr(10), ), ( Clear( - temp{9}, + temp{8}, ), Expr(9), ), @@ -121,8 +114,8 @@ ), ( AssignExpr( - temp{2}.x, - temp{3}.give, + q{1}.x, + temp{2}.give, ), Expr(11), ), @@ -137,38 +130,38 @@ ), ( AssignExpr( - temp{8}, + temp{7}, (), ), Expr(11), ), ( Clear( - temp{8}, + temp{7}, ), Expr(11), ), ( AssignExpr( - temp{13}, + temp{12}, Print.give, ), Expr(12), ), ( AssignExpr( - temp{14}, + temp{13}, p{0}.x.give, ), Expr(14), ), ], Assign( - temp{12}, + temp{11}, Call( - temp{13}, + temp{12}, [ - temp{14}, + temp{13}, ], [ None, @@ -181,21 +174,21 @@ [ ( Clear( - temp{14}, + temp{13}, ), Expr(14), ), ( Clear( - temp{13}, + temp{12}, ), Expr(12), ), ], Assign( - temp{11}, + temp{10}, Await( - temp{12}, + temp{11}, ), BasicBlock(3), ), @@ -204,26 +197,26 @@ [ ( Clear( - temp{12}, + temp{11}, ), Expr(15), ), ( Clear( - temp{11}, + temp{10}, ), Expr(16), ), ( AssignExpr( - temp{4}, + temp{3}, (), ), Expr(17), ), ], Return( - temp{4}, + temp{3}, ), ), }, diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.ref index 9e90db3f..522ce1e0 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.ref @@ -26,7 +26,7 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "afterstack":1 -> "afternode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; + "afterstack":1 -> "afternode0" [label="leased", style="solid", penwidth=1.0, arrowtype="empty", color="red"]; } subgraph cluster_before { label=<before> @@ -52,7 +52,7 @@ digraph { > ]; "beforestack":0 -> "beforenode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "beforestack":1 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; + "beforestack":1 -> "beforenode0" [label="leased", style="solid", penwidth=1.0, arrowtype="empty", color="red"]; } } 23 diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref index 142f5081..66960160 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref @@ -5,21 +5,21 @@ [ ( AssignExpr( - temp{6}, + temp{5}, Class(Id { value: 1 }).give, ), Expr(0), ), ( AssignExpr( - temp{7}, + temp{6}, 22, ), Expr(1), ), ( AssignExpr( - temp{8}, + temp{7}, 44, ), Expr(2), @@ -28,10 +28,10 @@ Assign( p{0}, Call( - temp{6}, + temp{5}, [ + temp{6}, temp{7}, - temp{8}, ], [ Some( @@ -49,19 +49,19 @@ [ ( Clear( - temp{8}, + temp{7}, ), Expr(2), ), ( Clear( - temp{7}, + temp{6}, ), Expr(1), ), ( Clear( - temp{6}, + temp{5}, ), Expr(0), ), @@ -81,41 +81,34 @@ ), ( AssignExpr( - temp{3}, - r{2}.lease, - ), - Expr(11), - ), - ( - AssignExpr( - temp{10}, - temp{3}.x.give, + temp{9}, + r{2}.x.give, ), Expr(12), ), ( AssignExpr( - temp{11}, + temp{10}, 1, ), Expr(13), ), ( AssignExpr( - temp{4}, - temp{10} + temp{11}, + temp{3}, + temp{9} + temp{10}, ), Expr(14), ), ( Clear( - temp{11}, + temp{10}, ), Expr(13), ), ( Clear( - temp{10}, + temp{9}, ), Expr(12), ), @@ -128,8 +121,8 @@ ), ( AssignExpr( - temp{3}.x, - temp{4}.give, + r{2}.x, + temp{3}.give, ), Expr(14), ), @@ -144,38 +137,38 @@ ), ( AssignExpr( - temp{9}, + temp{8}, (), ), Expr(14), ), ( Clear( - temp{9}, + temp{8}, ), Expr(14), ), ( AssignExpr( - temp{14}, + temp{13}, Print.give, ), Expr(15), ), ( AssignExpr( - temp{15}, + temp{14}, p{0}.x.give, ), Expr(17), ), ], Assign( - temp{13}, + temp{12}, Call( - temp{14}, + temp{13}, [ - temp{15}, + temp{14}, ], [ None, @@ -188,21 +181,21 @@ [ ( Clear( - temp{15}, + temp{14}, ), Expr(17), ), ( Clear( - temp{14}, + temp{13}, ), Expr(15), ), ], Assign( - temp{12}, + temp{11}, Await( - temp{13}, + temp{12}, ), BasicBlock(3), ), @@ -211,26 +204,26 @@ [ ( Clear( - temp{13}, + temp{12}, ), Expr(18), ), ( Clear( - temp{12}, + temp{11}, ), Expr(19), ), ( AssignExpr( - temp{5}, + temp{4}, (), ), Expr(20), ), ], Return( - temp{5}, + temp{4}, ), ), }, diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.ref index bc995f53..9668cb60 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.ref @@ -28,7 +28,7 @@ digraph { ]; "afterstack":0 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; "afterstack":1 -> "afternode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; - "afterstack":2 -> "afternode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; + "afterstack":2 -> "afternode0" [label="leased", style="solid", penwidth=1.0, arrowtype="empty", color="red"]; } subgraph cluster_before { label=<before> @@ -56,7 +56,7 @@ digraph { ]; "beforestack":0 -> "beforenode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; "beforestack":1 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; - "beforestack":2 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; + "beforestack":2 -> "beforenode0" [label="leased", style="solid", penwidth=1.0, arrowtype="empty", color="red"]; } } 23 diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref index e6188d0e..6d631785 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref @@ -5,21 +5,21 @@ [ ( AssignExpr( - temp{7}, + temp{6}, Class(Id { value: 1 }).give, ), Expr(0), ), ( AssignExpr( - temp{8}, + temp{7}, 22, ), Expr(1), ), ( AssignExpr( - temp{9}, + temp{8}, 44, ), Expr(2), @@ -28,10 +28,10 @@ Assign( p{0}, Call( - temp{7}, + temp{6}, [ + temp{7}, temp{8}, - temp{9}, ], [ Some( @@ -49,19 +49,19 @@ [ ( Clear( - temp{9}, + temp{8}, ), Expr(2), ), ( Clear( - temp{8}, + temp{7}, ), Expr(1), ), ( Clear( - temp{7}, + temp{6}, ), Expr(0), ), @@ -74,61 +74,54 @@ ), ( AssignExpr( - temp{2}, - q{1}.lease, - ), - Expr(8), - ), - ( - AssignExpr( - temp{11}, - temp{2}.x.give, + temp{10}, + q{1}.x.give, ), Expr(9), ), ( AssignExpr( - temp{12}, + temp{11}, 1, ), Expr(10), ), ( AssignExpr( - temp{3}, - temp{11} + temp{12}, + temp{2}, + temp{10} + temp{11}, ), Expr(11), ), ( Clear( - temp{12}, + temp{11}, ), Expr(10), ), ( Clear( - temp{11}, + temp{10}, ), Expr(9), ), ( AssignExpr( - temp{2}.x, - temp{3}.give, + q{1}.x, + temp{2}.give, ), Expr(11), ), ( AssignExpr( - temp{10}, + temp{9}, (), ), Expr(11), ), ( Clear( - temp{10}, + temp{9}, ), Expr(11), ), @@ -141,7 +134,7 @@ ), ( AssignExpr( - x{4}, + x{3}, p{0}.x.give, ), Expr(13), @@ -157,21 +150,21 @@ ), ( AssignExpr( - x{5}, + x{4}, q{1}.x.give, ), Expr(16), ), ( AssignExpr( - temp{6}, + temp{5}, (), ), Expr(18), ), ], Return( - temp{6}, + temp{5}, ), ), }, diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.ref index 85e01285..42b02fc0 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.ref @@ -14,8 +14,8 @@ digraph { main p q - x: "23" - x + x: "23" + x >; ]; @@ -43,8 +43,8 @@ digraph { main p q + x x - x >; ]; @@ -59,7 +59,7 @@ digraph { > ]; "beforestack":0 -> "beforenode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "beforestack":1 -> "beforenode0" [label="leased", style="dotted", penwidth=1.0, arrowtype="empty", color="red"]; + "beforestack":1 -> "beforenode0" [label="leased", style="solid", penwidth=1.0, arrowtype="empty", color="red"]; } } Error: your lease to this object was cancelled From 671ed8a7ec46cf24d4f043345b0d44ab4378560c Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sun, 17 Jul 2022 06:59:13 +0300 Subject: [PATCH 17/36] demonstrate eval order --- .../eval-left-to-right-fn-call.dada | 19 +++++++++++++++++++ .../compiler-output.ref | 0 .../eval-left-to-right-fn-call/stdout.ref | 1 + .../assignments/eval-left-to-right-perm.dada | 12 ++++++++++++ .../compiler-output.ref | 0 .../eval-left-to-right-perm/stdout.ref | 0 6 files changed, 32 insertions(+) create mode 100644 dada_tests/assignments/eval-left-to-right-fn-call.dada create mode 100644 dada_tests/assignments/eval-left-to-right-fn-call/compiler-output.ref create mode 100644 dada_tests/assignments/eval-left-to-right-fn-call/stdout.ref create mode 100644 dada_tests/assignments/eval-left-to-right-perm.dada create mode 100644 dada_tests/assignments/eval-left-to-right-perm/compiler-output.ref create mode 100644 dada_tests/assignments/eval-left-to-right-perm/stdout.ref diff --git a/dada_tests/assignments/eval-left-to-right-fn-call.dada b/dada_tests/assignments/eval-left-to-right-fn-call.dada new file mode 100644 index 00000000..8536cc84 --- /dev/null +++ b/dada_tests/assignments/eval-left-to-right-fn-call.dada @@ -0,0 +1,19 @@ +class Counter(value) + +fn next(c) -> { + c.value += 1 + c.value +} + +fn next_and(c, d) -> { + next(c) + d +} + +c = Counter(0) +d = Counter(22) + +# `next_and` is evaluated first, so `next` +# returns 2 +next_and(c.lease, d.lease).value := next(c.lease) +print(d.shlease).await #! OUTPUT Counter\(2\) \ No newline at end of file diff --git a/dada_tests/assignments/eval-left-to-right-fn-call/compiler-output.ref b/dada_tests/assignments/eval-left-to-right-fn-call/compiler-output.ref new file mode 100644 index 00000000..e69de29b diff --git a/dada_tests/assignments/eval-left-to-right-fn-call/stdout.ref b/dada_tests/assignments/eval-left-to-right-fn-call/stdout.ref new file mode 100644 index 00000000..90a9e7cb --- /dev/null +++ b/dada_tests/assignments/eval-left-to-right-fn-call/stdout.ref @@ -0,0 +1 @@ +shleased Counter(2) diff --git a/dada_tests/assignments/eval-left-to-right-perm.dada b/dada_tests/assignments/eval-left-to-right-perm.dada new file mode 100644 index 00000000..7b05b37f --- /dev/null +++ b/dada_tests/assignments/eval-left-to-right-perm.dada @@ -0,0 +1,12 @@ +class Counter(value) + +fn next(c) -> { + c.value += 1 + c.value +} + +c = Counter(0) + +# We evaluate `c.give` first, then `c.value` fails` + c.value := next(c.give) +#! ^ RUN ERROR your lease to this object was cancelled \ No newline at end of file diff --git a/dada_tests/assignments/eval-left-to-right-perm/compiler-output.ref b/dada_tests/assignments/eval-left-to-right-perm/compiler-output.ref new file mode 100644 index 00000000..e69de29b diff --git a/dada_tests/assignments/eval-left-to-right-perm/stdout.ref b/dada_tests/assignments/eval-left-to-right-perm/stdout.ref new file mode 100644 index 00000000..e69de29b From cc374cd788e07a50644c5fbccdeb0f240a8f0428 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sun, 17 Jul 2022 18:07:15 +0300 Subject: [PATCH 18/36] remove `ExprMode::Leased` --- .../dada-validate/src/validate/validator.rs | 47 +++++++------------ 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/components/dada-validate/src/validate/validator.rs b/components/dada-validate/src/validate/validator.rs index 40076cb4..61611376 100644 --- a/components/dada-validate/src/validate/validator.rs +++ b/components/dada-validate/src/validate/validator.rs @@ -44,9 +44,6 @@ pub(crate) struct Validator<'me> { pub enum ExprMode { /// When you do `a = `, `` is evaluated in "default" mode Default, - - /// In `a.f = `, `a` is evaluated in "leased" mode - Leased, } impl<'me> Validator<'me> { @@ -593,19 +590,15 @@ impl<'me> Validator<'me> { }; // `temp_leased_owner = owner.lease` (if this is a field) - self.with_expr_validated_as_target_place( - lhs_expr, - ExprMode::Leased, - &mut |this, validated_target_place| { - this.validate_op_eq_with_target_place( - op_eq_expr, - lhs_expr, - op, - rhs_expr, - validated_target_place, - ) - }, - ) + self.with_expr_validated_as_target_place(lhs_expr, &mut |this, validated_target_place| { + this.validate_op_eq_with_target_place( + op_eq_expr, + lhs_expr, + op, + rhs_expr, + validated_target_place, + ) + }) } fn validate_op_eq_with_target_place( @@ -666,7 +659,6 @@ impl<'me> Validator<'me> { fn with_expr_validated_as_target_place( &mut self, expr: syntax::Expr, - owner_mode: ExprMode, op: &mut dyn FnMut(&mut Self, validated::TargetPlace) -> validated::Expr, ) -> validated::Expr { match expr.data(self.syntax_tables()) { @@ -711,7 +703,7 @@ impl<'me> Validator<'me> { }, syntax::ExprData::Parenthesized(target_expr) => { - self.with_expr_validated_as_target_place(*target_expr, owner_mode, op) + self.with_expr_validated_as_target_place(*target_expr, op) } _ => { @@ -778,7 +770,6 @@ impl<'me> Validator<'me> { ) -> validated::Expr { match mode { ExprMode::Default => self.add(validated::ExprData::Give(place), origin), - ExprMode::Leased => self.add(validated::ExprData::Lease(place), origin), } } @@ -958,17 +949,13 @@ impl<'me> Validator<'me> { lhs_expr: syntax::Expr, initializer_expr: syntax::Expr, ) -> validated::Expr { - self.with_expr_validated_as_target_place( - lhs_expr, - ExprMode::Leased, - &mut |this, target_place| { - let validated_expr = this.validate_expr(initializer_expr); - this.add( - validated::ExprData::Assign(target_place, validated_expr), - assign_expr, - ) - }, - ) + self.with_expr_validated_as_target_place(lhs_expr, &mut |this, target_place| { + let validated_expr = this.validate_expr(initializer_expr); + this.add( + validated::ExprData::Assign(target_place, validated_expr), + assign_expr, + ) + }) } } From 619440277714b79aa704eb410088b597eee6fbe3 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sun, 17 Jul 2022 22:53:56 +0300 Subject: [PATCH 19/36] remove ExprMode enum --- .../dada-validate/src/validate/validator.rs | 43 ++++++------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/components/dada-validate/src/validate/validator.rs b/components/dada-validate/src/validate/validator.rs index 61611376..68c6fef7 100644 --- a/components/dada-validate/src/validate/validator.rs +++ b/components/dada-validate/src/validate/validator.rs @@ -40,12 +40,6 @@ pub(crate) struct Validator<'me> { synthesized: bool, } -#[derive(Copy, Clone, Debug)] -pub enum ExprMode { - /// When you do `a = `, `` is evaluated in "default" mode - Default, -} - impl<'me> Validator<'me> { pub(crate) fn root( db: &'me dyn crate::Db, @@ -173,15 +167,6 @@ impl<'me> Validator<'me> { validated_expr } - /// Validates an expression into a value: - /// - /// * If `E` is a place expression, like `a.b`, this is equivalent to `a.b.shlease` - /// * If `E` is a value expression, like `foo()`, this just evalutes it - #[tracing::instrument(level = "debug", skip(self, expr))] - fn validate_expr(&mut self, expr: syntax::Expr) -> validated::Expr { - self.validate_expr_in_mode(expr, ExprMode::Default) - } - /// Given an expression `E`, takes ownership of its value: /// /// * If `E` is a place expression, like `a.b`, this is equivalent to `a.b.give` @@ -202,12 +187,17 @@ impl<'me> Validator<'me> { } } - fn validate_expr_in_mode(&mut self, expr: syntax::Expr, mode: ExprMode) -> validated::Expr { + /// Validates an expression into a value: + /// + /// * If `E` is a place expression, like `a.b`, this is equivalent to `a.b.shlease` + /// * If `E` is a value expression, like `foo()`, this just evalutes it + #[tracing::instrument(level = "debug", skip(self, expr))] + fn validate_expr(&mut self, expr: syntax::Expr) -> validated::Expr { tracing::trace!("expr.data = {:?}", expr.data(self.syntax_tables())); match expr.data(self.syntax_tables()) { syntax::ExprData::Dot(..) | syntax::ExprData::Id(_) => self .with_expr_validated_as_place(expr, &mut |this, place| { - this.place_to_expr(place, expr.synthesized(), mode) + this.place_to_expr(place, expr.synthesized()) }), syntax::ExprData::BooleanLiteral(b) => { @@ -397,7 +387,7 @@ impl<'me> Validator<'me> { } syntax::ExprData::Parenthesized(parenthesized_expr) => { - self.validate_expr_in_mode(*parenthesized_expr, mode) + self.validate_expr(*parenthesized_expr) } syntax::ExprData::Tuple(element_exprs) => { @@ -762,15 +752,8 @@ impl<'me> Validator<'me> { } } - fn place_to_expr( - &mut self, - place: validated::Place, - origin: ExprOrigin, - mode: ExprMode, - ) -> validated::Expr { - match mode { - ExprMode::Default => self.add(validated::ExprData::Give(place), origin), - } + fn place_to_expr(&mut self, place: validated::Place, origin: ExprOrigin) -> validated::Expr { + self.add(validated::ExprData::Give(place), origin) } fn validate_permission_expr( @@ -840,8 +823,7 @@ impl<'me> Validator<'me> { } syntax::ExprData::Error => self.add(validated::ExprData::Error, expr), _ => { - let (assign_expr, temporary_place) = - self.validate_expr_in_temporary(expr, ExprMode::Default); + let (assign_expr, temporary_place) = self.validate_expr_in_temporary(expr); let expr = op(self, temporary_place); self.seq(Some(assign_expr), expr) } @@ -852,9 +834,8 @@ impl<'me> Validator<'me> { fn validate_expr_in_temporary( &mut self, expr: syntax::Expr, - mode: ExprMode, ) -> (validated::Expr, validated::Place) { - let validated_expr = self.validate_expr_in_mode(expr, mode); + let validated_expr = self.validate_expr(expr); self.store_validated_expr_in_temporary(validated_expr) } From b8c773e6b51eb4a3a8ebd4bdb7a487659bdc571d Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sun, 17 Jul 2022 23:07:18 +0300 Subject: [PATCH 20/36] change print intrinsic to not print perms Normal functions can't "reflect" on permissions so the default stringifier shouldn't either. --- .../dada-execute/src/heap_graph/capture.rs | 2 +- .../dada-execute/src/machine/stringify.rs | 59 +++++-------------- .../assignments/assign-atomiclease/stdout.ref | 2 +- .../assignments/assign-fields-x+=y/stdout.ref | 2 +- .../assignments/assign-fields-x=y/stdout.ref | 2 +- .../assign-if-thenlease-elselease/stdout.ref | 4 +- .../eval-left-to-right-fn-call/stdout.ref | 2 +- dada_tests/gc/stringify.dada | 2 +- dada_tests/gc/stringify/stdout.ref | 2 +- dada_tests/heap-graph/mid-increment.dada | 2 +- .../heap-graph/mid-increment/HeapGraph-0.ref | 2 +- .../heap-graph/mid-increment/stdout.ref | 2 +- .../ref_class_before_decl/stdout.ref | 2 +- .../exhaustive/assign-var-leased.dada | 4 +- .../exhaustive/assign-var-leased/stdout.ref | 4 +- .../exhaustive/assign-var-our/stdout.ref | 2 +- .../exhaustive/assign-var-shleased/stdout.ref | 2 +- .../exhaustive/give-var-field-my.dada | 4 +- .../exhaustive/give-var-field-my/stdout.ref | 4 +- .../exhaustive/give-var-leased-shared.dada | 6 +- .../give-var-leased-shared/stdout.ref | 6 +- .../exhaustive/give-var-leased.dada | 4 +- .../exhaustive/give-var-leased/stdout.ref | 4 +- .../permissions/exhaustive/give-var-our.dada | 6 +- .../exhaustive/give-var-our/stdout.ref | 6 +- .../exhaustive/lease-var-field-my.dada | 4 +- .../exhaustive/lease-var-field-my/stdout.ref | 4 +- .../exhaustive/lease-var-lease-shared.dada | 6 +- .../lease-var-lease-shared/stdout.ref | 6 +- .../permissions/exhaustive/lease-var-my.dada | 4 +- .../exhaustive/lease-var-my/stdout.ref | 4 +- .../permissions/exhaustive/lease-var-our.dada | 6 +- .../exhaustive/lease-var-our/stdout.ref | 6 +- .../exhaustive/share-var-field-my.dada | 4 +- .../exhaustive/share-var-field-my/stdout.ref | 4 +- .../exhaustive/share-var-leased.dada | 4 +- .../exhaustive/share-var-leased/stdout.ref | 4 +- .../exhaustive/share-var-my-given.dada | 2 +- .../exhaustive/share-var-my-given/stdout.ref | 2 +- .../permissions/exhaustive/share-var-my.dada | 4 +- .../exhaustive/share-var-my/stdout.ref | 4 +- .../permissions/exhaustive/share-var-our.dada | 4 +- .../exhaustive/share-var-our/stdout.ref | 4 +- .../house-parties-are-not-enough.dada | 4 +- .../house-parties-are-not-enough/stdout.ref | 6 +- .../revokation/overwrite-lease-share.dada | 2 +- .../overwrite-lease-share/stdout.ref | 2 +- .../revokation/overwrite-leased.dada | 4 +- .../revokation/overwrite-leased/stdout.ref | 4 +- .../revokation/overwrite-our-leased.dada | 2 +- .../overwrite-our-leased/stdout.ref | 2 +- .../revokation/overwrite-our-shared.dada | 2 +- .../overwrite-our-shared/stdout.ref | 2 +- .../overwrite-shared-separate-root.dada | 2 +- .../overwrite-shared-separate-root/stdout.ref | 2 +- .../revokation/overwrite-shared.dada | 2 +- .../revokation/overwrite-shared/stdout.ref | 2 +- .../our-to-our-leased-assign-field.dada | 8 +-- .../our-to-our-leased-assign-field/stdout.ref | 10 ++-- .../our-to-our-leased-assign/stdout.ref | 8 +-- .../reservations/our-to-our-leased-field.dada | 6 +- .../our-to-our-leased-field/stdout.ref | 10 ++-- .../our-to-our-leased-var/stdout.ref | 4 +- .../stdout.ref | 4 +- .../specifier/leased-from-rvalue/stdout.ref | 4 +- .../stdout.ref | 6 +- dada_tests/specifier/local-my/stdout.ref | 8 +-- .../stdout.ref | 6 +- .../shleased-got-my-then-copy/stdout.ref | 2 +- .../if-then-else-owned/stdout.ref | 2 +- .../validate/op-eq/lhs_field/stdout.ref | 2 +- .../op-eq/lhs_field_of_func_call/stdout.ref | 2 +- .../op-eq/lhs_local_variable/stdout.ref | 2 +- 73 files changed, 153 insertions(+), 182 deletions(-) diff --git a/components/dada-execute/src/heap_graph/capture.rs b/components/dada-execute/src/heap_graph/capture.rs index 9427119f..335270f8 100644 --- a/components/dada-execute/src/heap_graph/capture.rs +++ b/components/dada-execute/src/heap_graph/capture.rs @@ -125,7 +125,7 @@ impl<'me> HeapGraphCapture<'me> { | ObjectData::Float(_) | ObjectData::String(_) | ObjectData::Unit(_) => { - let string = DefaultStringify::stringify_object(self.machine, self.db, "", object); + let string = DefaultStringify::stringify_object(self.machine, self.db, object); self.data_target(db, object, &string) } } diff --git a/components/dada-execute/src/machine/stringify.rs b/components/dada-execute/src/machine/stringify.rs index f53bb997..356e82e4 100644 --- a/components/dada-execute/src/machine/stringify.rs +++ b/components/dada-execute/src/machine/stringify.rs @@ -1,9 +1,6 @@ -use dada_ir::{ - storage::{Joint, Leased}, - word::Word, -}; +use dada_ir::word::Word; -use crate::machine::{ObjectData, Permission, PermissionData, Value}; +use crate::machine::{ObjectData, PermissionData, Value}; use super::{op::MachineOp, Object}; @@ -12,19 +9,18 @@ pub(crate) impl DefaultStringify for T { /// Converts a given value into a string. This should /// eventually be customizable. fn stringify_value(&self, db: &dyn crate::Db, value: Value) -> String { - let Some(p) = self.permission_str(value.permission) else { + if let PermissionData::Expired(_) = self[value.permission] { return "(expired)".to_string(); - }; - - self.stringify_object(db, p, value.object) + } else { + self.stringify_object(db, value.object) + } } // FIXME: There is no way for *users* to write a fn that "inspects" the permission // like this. We should maybe just not print them, but it's kind of useful...? - fn stringify_object(&self, db: &dyn crate::Db, permission: &str, object: Object) -> String { + fn stringify_object(&self, db: &dyn crate::Db, object: Object) -> String { tracing::debug!( - "stringify(permission = {:?}, object = {:?}, object-data = {:?})", - permission, + "stringify(object = {:?}, object-data = {:?})", object, self[object] ); @@ -38,35 +34,22 @@ pub(crate) impl DefaultStringify for T { ObjectData::Unit(_) => "()".to_string(), ObjectData::Intrinsic(i) => i.as_str(db).to_string(), ObjectData::Function(f) => f.name(db).as_str(db).to_string(), - ObjectData::ThunkFn(f) => self.object_string( - db, - permission, - Some(f.function.name(db).word(db)), - &f.arguments, - ), + ObjectData::ThunkFn(f) => { + self.object_string(db, Some(f.function.name(db).word(db)), &f.arguments) + } ObjectData::Instance(i) => { - self.object_string(db, permission, Some(i.class.name(db).word(db)), &i.fields) + self.object_string(db, Some(i.class.name(db).word(db)), &i.fields) } ObjectData::Class(c) => c.name(db).as_str(db).to_string(), - ObjectData::ThunkRust(r) => format!("{permission} {r:?}"), - ObjectData::Tuple(t) => self.object_string(db, permission, None, &t.fields), + ObjectData::ThunkRust(r) => format!("{r:?}"), + ObjectData::Tuple(t) => self.object_string(db, None, &t.fields), ObjectData::Reservation(r) => format!("{r:?}"), // can prob do better than this :) } } - fn object_string( - &self, - db: &dyn crate::Db, - permission: &str, - name: Option, - fields: &[Value], - ) -> String { + fn object_string(&self, db: &dyn crate::Db, name: Option, fields: &[Value]) -> String { let mut output = String::new(); - output.push_str(permission); if let Some(name) = name { - if !permission.is_empty() { - output.push(' '); - } output.push_str(name.as_str(db)); } output.push('('); @@ -79,16 +62,4 @@ pub(crate) impl DefaultStringify for T { output.push(')'); output } - - fn permission_str(&self, permission: Permission) -> Option<&str> { - match &self[permission] { - PermissionData::Expired(_) => None, - PermissionData::Valid(valid) => Some(match (valid.joint, valid.leased) { - (Joint::No, Leased::No) => "my", - (Joint::Yes, Leased::No) => "our", - (Joint::No, Leased::Yes) => "leased", - (Joint::Yes, Leased::Yes) => "shleased", - }), - } - } } diff --git a/dada_tests/assignments/assign-atomiclease/stdout.ref b/dada_tests/assignments/assign-atomiclease/stdout.ref index e56b542f..590ce17a 100644 --- a/dada_tests/assignments/assign-atomiclease/stdout.ref +++ b/dada_tests/assignments/assign-atomiclease/stdout.ref @@ -1 +1 @@ -my Point(23, 44) +Point(23, 44) diff --git a/dada_tests/assignments/assign-fields-x+=y/stdout.ref b/dada_tests/assignments/assign-fields-x+=y/stdout.ref index 1889756b..9d370be2 100644 --- a/dada_tests/assignments/assign-fields-x+=y/stdout.ref +++ b/dada_tests/assignments/assign-fields-x+=y/stdout.ref @@ -1 +1 @@ -my Point(66, 44) +Point(66, 44) diff --git a/dada_tests/assignments/assign-fields-x=y/stdout.ref b/dada_tests/assignments/assign-fields-x=y/stdout.ref index a7154e15..1dae0b32 100644 --- a/dada_tests/assignments/assign-fields-x=y/stdout.ref +++ b/dada_tests/assignments/assign-fields-x=y/stdout.ref @@ -1 +1 @@ -my Point(44, 44) +Point(44, 44) diff --git a/dada_tests/assignments/assign-if-thenlease-elselease/stdout.ref b/dada_tests/assignments/assign-if-thenlease-elselease/stdout.ref index 6d874897..43df7be8 100644 --- a/dada_tests/assignments/assign-if-thenlease-elselease/stdout.ref +++ b/dada_tests/assignments/assign-if-thenlease-elselease/stdout.ref @@ -1,2 +1,2 @@ -my Point(23, 44) -my Point(66, 88) +Point(23, 44) +Point(66, 88) diff --git a/dada_tests/assignments/eval-left-to-right-fn-call/stdout.ref b/dada_tests/assignments/eval-left-to-right-fn-call/stdout.ref index 90a9e7cb..fbba3991 100644 --- a/dada_tests/assignments/eval-left-to-right-fn-call/stdout.ref +++ b/dada_tests/assignments/eval-left-to-right-fn-call/stdout.ref @@ -1 +1 @@ -shleased Counter(2) +Counter(2) diff --git a/dada_tests/gc/stringify.dada b/dada_tests/gc/stringify.dada index 7fcf013f..0309cf49 100644 --- a/dada_tests/gc/stringify.dada +++ b/dada_tests/gc/stringify.dada @@ -3,7 +3,7 @@ class Point(x, y) async fn main() { p = Point(Point(22, 44), 66) print(p).await - #! OUTPUT Point\(my Point\(22, 44\), 66\) + #! OUTPUT Point\(Point\(22, 44\), 66\) print(22 + 44i).await #! OUTPUT 66_i print(22i + 44).await #! OUTPUT 66_i diff --git a/dada_tests/gc/stringify/stdout.ref b/dada_tests/gc/stringify/stdout.ref index 63677fe9..01889505 100644 --- a/dada_tests/gc/stringify/stdout.ref +++ b/dada_tests/gc/stringify/stdout.ref @@ -1,4 +1,4 @@ -my Point(my Point(22, 44), 66) +Point(Point(22, 44), 66) 66_i 66_i 66_u diff --git a/dada_tests/heap-graph/mid-increment.dada b/dada_tests/heap-graph/mid-increment.dada index c9b1ce81..9ed8dd51 100644 --- a/dada_tests/heap-graph/mid-increment.dada +++ b/dada_tests/heap-graph/mid-increment.dada @@ -6,5 +6,5 @@ async fn main() { #? @ +1:10 HeapGraph q.x += 1 print(q).await - #! OUTPUT leased Point\(23, 44\) + #! OUTPUT Point\(23, 44\) } diff --git a/dada_tests/heap-graph/mid-increment/HeapGraph-0.ref b/dada_tests/heap-graph/mid-increment/HeapGraph-0.ref index 526fd34b..64839dee 100644 --- a/dada_tests/heap-graph/mid-increment/HeapGraph-0.ref +++ b/dada_tests/heap-graph/mid-increment/HeapGraph-0.ref @@ -55,4 +55,4 @@ digraph { "beforestack":1 -> "beforenode0" [label="leased", style="solid", penwidth=1.0, arrowtype="empty", color="red"]; } } -leased Point(23, 44) +Point(23, 44) diff --git a/dada_tests/heap-graph/mid-increment/stdout.ref b/dada_tests/heap-graph/mid-increment/stdout.ref index 615f8a06..590ce17a 100644 --- a/dada_tests/heap-graph/mid-increment/stdout.ref +++ b/dada_tests/heap-graph/mid-increment/stdout.ref @@ -1 +1 @@ -leased Point(23, 44) +Point(23, 44) diff --git a/dada_tests/module_main/ref_class_before_decl/stdout.ref b/dada_tests/module_main/ref_class_before_decl/stdout.ref index ab7fae53..f21ec181 100644 --- a/dada_tests/module_main/ref_class_before_decl/stdout.ref +++ b/dada_tests/module_main/ref_class_before_decl/stdout.ref @@ -1 +1 @@ -my Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/assign-var-leased.dada b/dada_tests/permissions/exhaustive/assign-var-leased.dada index 63ed993c..e446f09d 100644 --- a/dada_tests/permissions/exhaustive/assign-var-leased.dada +++ b/dada_tests/permissions/exhaustive/assign-var-leased.dada @@ -4,7 +4,7 @@ async fn main() { p = Pair(22, 44).lease q = p print(q).await - #! OUTPUT leased Pair\(22, 44\) + #! OUTPUT Pair\(22, 44\) print(p).await - #! OUTPUT leased Pair\(22, 44\) + #! OUTPUT Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/assign-var-leased/stdout.ref b/dada_tests/permissions/exhaustive/assign-var-leased/stdout.ref index 52946d17..28047dfe 100644 --- a/dada_tests/permissions/exhaustive/assign-var-leased/stdout.ref +++ b/dada_tests/permissions/exhaustive/assign-var-leased/stdout.ref @@ -1,2 +1,2 @@ -leased Pair(22, 44) -leased Pair(22, 44) +Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/assign-var-our/stdout.ref b/dada_tests/permissions/exhaustive/assign-var-our/stdout.ref index 2aa36059..f21ec181 100644 --- a/dada_tests/permissions/exhaustive/assign-var-our/stdout.ref +++ b/dada_tests/permissions/exhaustive/assign-var-our/stdout.ref @@ -1 +1 @@ -our Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/assign-var-shleased/stdout.ref b/dada_tests/permissions/exhaustive/assign-var-shleased/stdout.ref index cd1bd4b7..f21ec181 100644 --- a/dada_tests/permissions/exhaustive/assign-var-shleased/stdout.ref +++ b/dada_tests/permissions/exhaustive/assign-var-shleased/stdout.ref @@ -1 +1 @@ -shleased Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/give-var-field-my.dada b/dada_tests/permissions/exhaustive/give-var-field-my.dada index 02777bf9..3f0c35ae 100644 --- a/dada_tests/permissions/exhaustive/give-var-field-my.dada +++ b/dada_tests/permissions/exhaustive/give-var-field-my.dada @@ -3,6 +3,6 @@ class Pair(a, b) async fn main() { p = Pair(Pair(22, 44), 66) q = p.a.give - print(p).await #! OUTPUT my Pair\(\(expired\), 66\) - print(q).await #! OUTPUT my Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(\(expired\), 66\) + print(q).await #! OUTPUT Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/give-var-field-my/stdout.ref b/dada_tests/permissions/exhaustive/give-var-field-my/stdout.ref index 33e0458a..d9c7eb14 100644 --- a/dada_tests/permissions/exhaustive/give-var-field-my/stdout.ref +++ b/dada_tests/permissions/exhaustive/give-var-field-my/stdout.ref @@ -1,2 +1,2 @@ -my Pair((expired), 66) -my Pair(22, 44) +Pair((expired), 66) +Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/give-var-leased-shared.dada b/dada_tests/permissions/exhaustive/give-var-leased-shared.dada index a0b716c1..e4250077 100644 --- a/dada_tests/permissions/exhaustive/give-var-leased-shared.dada +++ b/dada_tests/permissions/exhaustive/give-var-leased-shared.dada @@ -4,7 +4,7 @@ async fn main() { # FIXME: Debatable when the underlying pair should be freed. p = Pair(22, 44).lease.share q = p.give - print(p).await #! OUTPUT shleased Pair\(22, 44\) - print(q).await #! OUTPUT shleased Pair\(22, 44\) - print(p).await #! OUTPUT shleased Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) + print(q).await #! OUTPUT Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/give-var-leased-shared/stdout.ref b/dada_tests/permissions/exhaustive/give-var-leased-shared/stdout.ref index 4e0602fe..cc483422 100644 --- a/dada_tests/permissions/exhaustive/give-var-leased-shared/stdout.ref +++ b/dada_tests/permissions/exhaustive/give-var-leased-shared/stdout.ref @@ -1,3 +1,3 @@ -shleased Pair(22, 44) -shleased Pair(22, 44) -shleased Pair(22, 44) +Pair(22, 44) +Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/give-var-leased.dada b/dada_tests/permissions/exhaustive/give-var-leased.dada index c68e4a39..106e4c7a 100644 --- a/dada_tests/permissions/exhaustive/give-var-leased.dada +++ b/dada_tests/permissions/exhaustive/give-var-leased.dada @@ -5,10 +5,10 @@ async fn main() { q = p.give # Giving a leased thing: subleases # Accessing `q`: ok - print(q).await #! OUTPUT leased Pair\(22, 44\) + print(q).await #! OUTPUT Pair\(22, 44\) # Accessing `p`: ok, but cancels sublease (to `q`) - print(p).await #! OUTPUT leased Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) # Accessing `q` again: error print(q).await #! RUN ERROR your lease to this object was cancelled diff --git a/dada_tests/permissions/exhaustive/give-var-leased/stdout.ref b/dada_tests/permissions/exhaustive/give-var-leased/stdout.ref index 52946d17..28047dfe 100644 --- a/dada_tests/permissions/exhaustive/give-var-leased/stdout.ref +++ b/dada_tests/permissions/exhaustive/give-var-leased/stdout.ref @@ -1,2 +1,2 @@ -leased Pair(22, 44) -leased Pair(22, 44) +Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/give-var-our.dada b/dada_tests/permissions/exhaustive/give-var-our.dada index 69d6c3a5..e9094f86 100644 --- a/dada_tests/permissions/exhaustive/give-var-our.dada +++ b/dada_tests/permissions/exhaustive/give-var-our.dada @@ -3,7 +3,7 @@ class Pair(a, b) async fn main() { p = Pair(22, 44).share q = p.give - print(p).await #! OUTPUT our Pair\(22, 44\) - print(q).await #! OUTPUT our Pair\(22, 44\) - print(p).await #! OUTPUT our Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) + print(q).await #! OUTPUT Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/give-var-our/stdout.ref b/dada_tests/permissions/exhaustive/give-var-our/stdout.ref index 6b44d38d..cc483422 100644 --- a/dada_tests/permissions/exhaustive/give-var-our/stdout.ref +++ b/dada_tests/permissions/exhaustive/give-var-our/stdout.ref @@ -1,3 +1,3 @@ -our Pair(22, 44) -our Pair(22, 44) -our Pair(22, 44) +Pair(22, 44) +Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/lease-var-field-my.dada b/dada_tests/permissions/exhaustive/lease-var-field-my.dada index 58a318de..4ca7e894 100644 --- a/dada_tests/permissions/exhaustive/lease-var-field-my.dada +++ b/dada_tests/permissions/exhaustive/lease-var-field-my.dada @@ -3,7 +3,7 @@ class Pair(a, b) async fn main() { p = Pair(Pair(22, 44), 66) q = p.a.lease - print(q).await #! OUTPUT leased Pair\(22, 44\) - print(p).await #! OUTPUT my Pair\(my Pair\(22, 44\), 66\) + print(q).await #! OUTPUT Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(Pair\(22, 44\), 66\) print(q).await #! RUN ERROR your lease to this object was cancelled } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/lease-var-field-my/stdout.ref b/dada_tests/permissions/exhaustive/lease-var-field-my/stdout.ref index 45febc78..67ddbe8f 100644 --- a/dada_tests/permissions/exhaustive/lease-var-field-my/stdout.ref +++ b/dada_tests/permissions/exhaustive/lease-var-field-my/stdout.ref @@ -1,2 +1,2 @@ -leased Pair(22, 44) -my Pair(my Pair(22, 44), 66) +Pair(22, 44) +Pair(Pair(22, 44), 66) diff --git a/dada_tests/permissions/exhaustive/lease-var-lease-shared.dada b/dada_tests/permissions/exhaustive/lease-var-lease-shared.dada index ece26b9d..1559df7a 100644 --- a/dada_tests/permissions/exhaustive/lease-var-lease-shared.dada +++ b/dada_tests/permissions/exhaustive/lease-var-lease-shared.dada @@ -3,7 +3,7 @@ class Pair(a, b) async fn main() { p = Pair(22, 44).lease.share q = p.lease - print(q).await #! OUTPUT shleased Pair\(22, 44\) - print(p).await #! OUTPUT shleased Pair\(22, 44\) - print(q).await #! OUTPUT shleased Pair\(22, 44\) + print(q).await #! OUTPUT Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) + print(q).await #! OUTPUT Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/lease-var-lease-shared/stdout.ref b/dada_tests/permissions/exhaustive/lease-var-lease-shared/stdout.ref index 4e0602fe..cc483422 100644 --- a/dada_tests/permissions/exhaustive/lease-var-lease-shared/stdout.ref +++ b/dada_tests/permissions/exhaustive/lease-var-lease-shared/stdout.ref @@ -1,3 +1,3 @@ -shleased Pair(22, 44) -shleased Pair(22, 44) -shleased Pair(22, 44) +Pair(22, 44) +Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/lease-var-my.dada b/dada_tests/permissions/exhaustive/lease-var-my.dada index 6d1f6969..1f73a83b 100644 --- a/dada_tests/permissions/exhaustive/lease-var-my.dada +++ b/dada_tests/permissions/exhaustive/lease-var-my.dada @@ -3,7 +3,7 @@ class Pair(a, b) async fn main() { p = Pair(22, 44) q = p.lease - print(q).await #! OUTPUT leased Pair\(22, 44\) - print(p).await #! OUTPUT my Pair\(22, 44\) + print(q).await #! OUTPUT Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) print(q).await #! RUN ERROR your lease to this object was cancelled } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/lease-var-my/stdout.ref b/dada_tests/permissions/exhaustive/lease-var-my/stdout.ref index b686a731..28047dfe 100644 --- a/dada_tests/permissions/exhaustive/lease-var-my/stdout.ref +++ b/dada_tests/permissions/exhaustive/lease-var-my/stdout.ref @@ -1,2 +1,2 @@ -leased Pair(22, 44) -my Pair(22, 44) +Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/lease-var-our.dada b/dada_tests/permissions/exhaustive/lease-var-our.dada index 363c34c0..5bd25752 100644 --- a/dada_tests/permissions/exhaustive/lease-var-our.dada +++ b/dada_tests/permissions/exhaustive/lease-var-our.dada @@ -3,7 +3,7 @@ class Pair(a, b) async fn main() { p = Pair(22, 44).share q = p.lease - print(q).await #! OUTPUT our Pair\(22, 44\) - print(p).await #! OUTPUT our Pair\(22, 44\) - print(q).await #! OUTPUT our Pair\(22, 44\) + print(q).await #! OUTPUT Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) + print(q).await #! OUTPUT Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/lease-var-our/stdout.ref b/dada_tests/permissions/exhaustive/lease-var-our/stdout.ref index 6b44d38d..cc483422 100644 --- a/dada_tests/permissions/exhaustive/lease-var-our/stdout.ref +++ b/dada_tests/permissions/exhaustive/lease-var-our/stdout.ref @@ -1,3 +1,3 @@ -our Pair(22, 44) -our Pair(22, 44) -our Pair(22, 44) +Pair(22, 44) +Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/share-var-field-my.dada b/dada_tests/permissions/exhaustive/share-var-field-my.dada index 12df044e..049ceee0 100644 --- a/dada_tests/permissions/exhaustive/share-var-field-my.dada +++ b/dada_tests/permissions/exhaustive/share-var-field-my.dada @@ -3,6 +3,6 @@ class Pair(a, b) async fn main() { p = Pair(Pair(22, 44), 66) q = p.a.share - print(q).await #! OUTPUT shleased Pair\(22, 44\) - print(p).await #! OUTPUT my Pair\(my Pair\(22, 44\), 66\) + print(q).await #! OUTPUT Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(Pair\(22, 44\), 66\) } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/share-var-field-my/stdout.ref b/dada_tests/permissions/exhaustive/share-var-field-my/stdout.ref index 1d604c72..67ddbe8f 100644 --- a/dada_tests/permissions/exhaustive/share-var-field-my/stdout.ref +++ b/dada_tests/permissions/exhaustive/share-var-field-my/stdout.ref @@ -1,2 +1,2 @@ -shleased Pair(22, 44) -my Pair(my Pair(22, 44), 66) +Pair(22, 44) +Pair(Pair(22, 44), 66) diff --git a/dada_tests/permissions/exhaustive/share-var-leased.dada b/dada_tests/permissions/exhaustive/share-var-leased.dada index 05dc36bd..4024ee5b 100644 --- a/dada_tests/permissions/exhaustive/share-var-leased.dada +++ b/dada_tests/permissions/exhaustive/share-var-leased.dada @@ -7,10 +7,10 @@ async fn main() { q = p.share # Accessing `q`: ok - print(q).await #! OUTPUT shleased Pair\(22, 44\) + print(q).await #! OUTPUT Pair\(22, 44\) # Accessing `p`: ok, but cancels subleases - print(p).await #! OUTPUT leased Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) # Accessing `q` again: error print(q).await #! RUN ERROR your lease to this object was cancelled diff --git a/dada_tests/permissions/exhaustive/share-var-leased/stdout.ref b/dada_tests/permissions/exhaustive/share-var-leased/stdout.ref index 849915a3..28047dfe 100644 --- a/dada_tests/permissions/exhaustive/share-var-leased/stdout.ref +++ b/dada_tests/permissions/exhaustive/share-var-leased/stdout.ref @@ -1,2 +1,2 @@ -shleased Pair(22, 44) -leased Pair(22, 44) +Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/share-var-my-given.dada b/dada_tests/permissions/exhaustive/share-var-my-given.dada index d4a44ea3..0a3a3242 100644 --- a/dada_tests/permissions/exhaustive/share-var-my-given.dada +++ b/dada_tests/permissions/exhaustive/share-var-my-given.dada @@ -3,6 +3,6 @@ class Pair(a, b) async fn main() { p = Pair(22, 44) q = p.give.share - print(q).await #! OUTPUT our Pair\(22, 44\) + print(q).await #! OUTPUT Pair\(22, 44\) print(p).await #! RUN ERROR your lease to this object was cancelled } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/share-var-my-given/stdout.ref b/dada_tests/permissions/exhaustive/share-var-my-given/stdout.ref index 2aa36059..f21ec181 100644 --- a/dada_tests/permissions/exhaustive/share-var-my-given/stdout.ref +++ b/dada_tests/permissions/exhaustive/share-var-my-given/stdout.ref @@ -1 +1 @@ -our Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/share-var-my.dada b/dada_tests/permissions/exhaustive/share-var-my.dada index d1714e03..e6872475 100644 --- a/dada_tests/permissions/exhaustive/share-var-my.dada +++ b/dada_tests/permissions/exhaustive/share-var-my.dada @@ -3,6 +3,6 @@ class Pair(a, b) async fn main() { p = Pair(22, 44) q = p.share - print(q).await #! OUTPUT shleased Pair\(22, 44\) - print(p).await #! OUTPUT my Pair\(22, 44\) + print(q).await #! OUTPUT Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/share-var-my/stdout.ref b/dada_tests/permissions/exhaustive/share-var-my/stdout.ref index 8898bfcd..28047dfe 100644 --- a/dada_tests/permissions/exhaustive/share-var-my/stdout.ref +++ b/dada_tests/permissions/exhaustive/share-var-my/stdout.ref @@ -1,2 +1,2 @@ -shleased Pair(22, 44) -my Pair(22, 44) +Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/share-var-our.dada b/dada_tests/permissions/exhaustive/share-var-our.dada index 9e51eaf2..67cac5fb 100644 --- a/dada_tests/permissions/exhaustive/share-var-our.dada +++ b/dada_tests/permissions/exhaustive/share-var-our.dada @@ -3,6 +3,6 @@ class Pair(a, b) async fn main() { p = Pair(22, 44).share q = p.share - print(p).await #! OUTPUT our Pair\(22, 44\) - print(q).await #! OUTPUT our Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) + print(q).await #! OUTPUT Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/share-var-our/stdout.ref b/dada_tests/permissions/exhaustive/share-var-our/stdout.ref index f1cc663b..28047dfe 100644 --- a/dada_tests/permissions/exhaustive/share-var-our/stdout.ref +++ b/dada_tests/permissions/exhaustive/share-var-our/stdout.ref @@ -1,2 +1,2 @@ -our Pair(22, 44) -our Pair(22, 44) +Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/house-parties/house-parties-are-not-enough.dada b/dada_tests/permissions/house-parties/house-parties-are-not-enough.dada index 7275b241..d7b5605d 100644 --- a/dada_tests/permissions/house-parties/house-parties-are-not-enough.dada +++ b/dada_tests/permissions/house-parties/house-parties-are-not-enough.dada @@ -26,6 +26,6 @@ async fn main() { l1 = get_list(a.shlease) l2 = get_list(a.shlease) print(l2).await #! OUTPUT List\(\) - print(l1).await #! OUTPUT shleased List - print(l2).await #! OUTPUT shleased List + print(l1).await #! OUTPUT List + print(l2).await #! OUTPUT List } diff --git a/dada_tests/permissions/house-parties/house-parties-are-not-enough/stdout.ref b/dada_tests/permissions/house-parties/house-parties-are-not-enough/stdout.ref index 3a5f284d..f879fc81 100644 --- a/dada_tests/permissions/house-parties/house-parties-are-not-enough/stdout.ref +++ b/dada_tests/permissions/house-parties/house-parties-are-not-enough/stdout.ref @@ -1,3 +1,3 @@ -shleased List() -shleased List() -shleased List() +List() +List() +List() diff --git a/dada_tests/permissions/revokation/overwrite-lease-share.dada b/dada_tests/permissions/revokation/overwrite-lease-share.dada index f7e98652..fb002d53 100644 --- a/dada_tests/permissions/revokation/overwrite-lease-share.dada +++ b/dada_tests/permissions/revokation/overwrite-lease-share.dada @@ -8,5 +8,5 @@ async fn main() { pair2.a := Pair(23, 45) - print(p).await #! OUTPUT shleased Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/revokation/overwrite-lease-share/stdout.ref b/dada_tests/permissions/revokation/overwrite-lease-share/stdout.ref index cd1bd4b7..f21ec181 100644 --- a/dada_tests/permissions/revokation/overwrite-lease-share/stdout.ref +++ b/dada_tests/permissions/revokation/overwrite-lease-share/stdout.ref @@ -1 +1 @@ -shleased Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/revokation/overwrite-leased.dada b/dada_tests/permissions/revokation/overwrite-leased.dada index eba26173..37a75dee 100644 --- a/dada_tests/permissions/revokation/overwrite-leased.dada +++ b/dada_tests/permissions/revokation/overwrite-leased.dada @@ -13,10 +13,10 @@ async fn main() { # `p` is still a valid leased object, and it points to # `pair1`. - print(p).await #! OUTPUT leased Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) # we can output `pair1` - print(pair1).await #! OUTPUT my Pair\(22, 44\) + print(pair1).await #! OUTPUT Pair\(22, 44\) # and that will cancel `p` print(p).await #! RUN ERROR your lease to this object was cancelled diff --git a/dada_tests/permissions/revokation/overwrite-leased/stdout.ref b/dada_tests/permissions/revokation/overwrite-leased/stdout.ref index b686a731..28047dfe 100644 --- a/dada_tests/permissions/revokation/overwrite-leased/stdout.ref +++ b/dada_tests/permissions/revokation/overwrite-leased/stdout.ref @@ -1,2 +1,2 @@ -leased Pair(22, 44) -my Pair(22, 44) +Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/revokation/overwrite-our-leased.dada b/dada_tests/permissions/revokation/overwrite-our-leased.dada index c9ffa089..48bfac48 100644 --- a/dada_tests/permissions/revokation/overwrite-our-leased.dada +++ b/dada_tests/permissions/revokation/overwrite-our-leased.dada @@ -10,5 +10,5 @@ async fn main() { # lease, but that doesn't cancel it. pair2.a := Pair(23, 45) - print(p).await #! OUTPUT our Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/revokation/overwrite-our-leased/stdout.ref b/dada_tests/permissions/revokation/overwrite-our-leased/stdout.ref index 2aa36059..f21ec181 100644 --- a/dada_tests/permissions/revokation/overwrite-our-leased/stdout.ref +++ b/dada_tests/permissions/revokation/overwrite-our-leased/stdout.ref @@ -1 +1 @@ -our Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/revokation/overwrite-our-shared.dada b/dada_tests/permissions/revokation/overwrite-our-shared.dada index d131c381..d9b4a17b 100644 --- a/dada_tests/permissions/revokation/overwrite-our-shared.dada +++ b/dada_tests/permissions/revokation/overwrite-our-shared.dada @@ -9,5 +9,5 @@ async fn main() { # `p` is not disturbed by this write pair.a := Pair(23, 45) - print(p).await #! OUTPUT our Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/revokation/overwrite-our-shared/stdout.ref b/dada_tests/permissions/revokation/overwrite-our-shared/stdout.ref index 2aa36059..f21ec181 100644 --- a/dada_tests/permissions/revokation/overwrite-our-shared/stdout.ref +++ b/dada_tests/permissions/revokation/overwrite-our-shared/stdout.ref @@ -1 +1 @@ -our Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/revokation/overwrite-shared-separate-root.dada b/dada_tests/permissions/revokation/overwrite-shared-separate-root.dada index 561d200c..f8a84a67 100644 --- a/dada_tests/permissions/revokation/overwrite-shared-separate-root.dada +++ b/dada_tests/permissions/revokation/overwrite-shared-separate-root.dada @@ -12,5 +12,5 @@ async fn main() { # Overwriting `pair.a` removes one handle to # the shared pair, but `p` is unaffected. pair.a := Pair(23, 45) - print(p).await #! OUTPUT our Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/revokation/overwrite-shared-separate-root/stdout.ref b/dada_tests/permissions/revokation/overwrite-shared-separate-root/stdout.ref index 2aa36059..f21ec181 100644 --- a/dada_tests/permissions/revokation/overwrite-shared-separate-root/stdout.ref +++ b/dada_tests/permissions/revokation/overwrite-shared-separate-root/stdout.ref @@ -1 +1 @@ -our Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/permissions/revokation/overwrite-shared.dada b/dada_tests/permissions/revokation/overwrite-shared.dada index 69accdb2..716e5597 100644 --- a/dada_tests/permissions/revokation/overwrite-shared.dada +++ b/dada_tests/permissions/revokation/overwrite-shared.dada @@ -11,5 +11,5 @@ async fn main() { # Since `p` is owned, overwriting `pair.a` has no effect on it. pair.a := Pair(23, 45) - print(p).await #! OUTPUT our Pair\(22, 44\) + print(p).await #! OUTPUT Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/revokation/overwrite-shared/stdout.ref b/dada_tests/permissions/revokation/overwrite-shared/stdout.ref index 2aa36059..f21ec181 100644 --- a/dada_tests/permissions/revokation/overwrite-shared/stdout.ref +++ b/dada_tests/permissions/revokation/overwrite-shared/stdout.ref @@ -1 +1 @@ -our Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/reservations/our-to-our-leased-assign-field.dada b/dada_tests/reservations/our-to-our-leased-assign-field.dada index 74c8d2bf..e9fa186e 100644 --- a/dada_tests/reservations/our-to-our-leased-assign-field.dada +++ b/dada_tests/reservations/our-to-our-leased-assign-field.dada @@ -5,14 +5,14 @@ class OurLeased(f) async fn main() { p = Point(22, 44).share # create a shared point `(22, 44)` q = OurLeased(p.shlease) # `q.f` becomes 2nd owner of `(22, 44)` - print(q.lease).await #! OUTPUT OurLeased\(our Point\(22, 44\)\) + print(q.lease).await #! OUTPUT OurLeased\(Point\(22, 44\)\) p := Point(44, 66).share # `p` is shared owner of `(44, 66)` q.f := p.share # `q.f` becomes 2nd owner of `(44, 66)` - print(q.lease).await #! OUTPUT OurLeased\(our Point\(44, 66\)\) + print(q.lease).await #! OUTPUT OurLeased\(Point\(44, 66\)\) p := Point(11, 55) # overwriting `p` doesn't invalidate `q.f` - print(q.lease).await #! OUTPUT OurLeased\(our Point\(44, 66\)\) + print(q.lease).await #! OUTPUT OurLeased\(Point\(44, 66\)\) print(p.lease).await #! OUTPUT Point\(11, 55\) - print(q.lease).await #! OUTPUT OurLeased\(our Point\(44, 66\)\) + print(q.lease).await #! OUTPUT OurLeased\(Point\(44, 66\)\) } \ No newline at end of file diff --git a/dada_tests/reservations/our-to-our-leased-assign-field/stdout.ref b/dada_tests/reservations/our-to-our-leased-assign-field/stdout.ref index 689f4a6a..133c4842 100644 --- a/dada_tests/reservations/our-to-our-leased-assign-field/stdout.ref +++ b/dada_tests/reservations/our-to-our-leased-assign-field/stdout.ref @@ -1,5 +1,5 @@ -leased OurLeased(our Point(22, 44)) -leased OurLeased(our Point(44, 66)) -leased OurLeased(our Point(44, 66)) -leased Point(11, 55) -leased OurLeased(our Point(44, 66)) +OurLeased(Point(22, 44)) +OurLeased(Point(44, 66)) +OurLeased(Point(44, 66)) +Point(11, 55) +OurLeased(Point(44, 66)) diff --git a/dada_tests/reservations/our-to-our-leased-assign/stdout.ref b/dada_tests/reservations/our-to-our-leased-assign/stdout.ref index 9da886ac..f0a375bf 100644 --- a/dada_tests/reservations/our-to-our-leased-assign/stdout.ref +++ b/dada_tests/reservations/our-to-our-leased-assign/stdout.ref @@ -1,4 +1,4 @@ -our Point(22, 44) -our Point(22, 44) -my Point(33, 55) -our Point(44, 66) +Point(22, 44) +Point(22, 44) +Point(33, 55) +Point(44, 66) diff --git a/dada_tests/reservations/our-to-our-leased-field.dada b/dada_tests/reservations/our-to-our-leased-field.dada index 473f1a93..099eff51 100644 --- a/dada_tests/reservations/our-to-our-leased-field.dada +++ b/dada_tests/reservations/our-to-our-leased-field.dada @@ -6,10 +6,10 @@ async fn main() { p = Point(22, 44).share # create `(22, 44)` with shared ownership print(p.lease).await #! OUTPUT Point\(22, 44\) q = OurLeased(p.shlease) # `OurLeased` takes 2nd ownership of `(22, 44)` - print(q.lease).await #! OUTPUT OurLeased\(our Point\(22, 44\)\) + print(q.lease).await #! OUTPUT OurLeased\(Point\(22, 44\)\) p := Point(44, 66) # reassigning `p` doesn't invalidate `q.f` - print(q.lease).await #! OUTPUT OurLeased\(our Point\(22, 44\)\) + print(q.lease).await #! OUTPUT OurLeased\(Point\(22, 44\)\) print(p.lease).await #! OUTPUT Point\(44, 66\) - print(q.lease).await #! OUTPUT OurLeased\(our Point\(22, 44\)\) + print(q.lease).await #! OUTPUT OurLeased\(Point\(22, 44\)\) } \ No newline at end of file diff --git a/dada_tests/reservations/our-to-our-leased-field/stdout.ref b/dada_tests/reservations/our-to-our-leased-field/stdout.ref index 5c21cb0a..f2590b8e 100644 --- a/dada_tests/reservations/our-to-our-leased-field/stdout.ref +++ b/dada_tests/reservations/our-to-our-leased-field/stdout.ref @@ -1,5 +1,5 @@ -our Point(22, 44) -leased OurLeased(our Point(22, 44)) -leased OurLeased(our Point(22, 44)) -leased Point(44, 66) -leased OurLeased(our Point(22, 44)) +Point(22, 44) +OurLeased(Point(22, 44)) +OurLeased(Point(22, 44)) +Point(44, 66) +OurLeased(Point(22, 44)) diff --git a/dada_tests/reservations/our-to-our-leased-var/stdout.ref b/dada_tests/reservations/our-to-our-leased-var/stdout.ref index 3fec5090..f0b4acc2 100644 --- a/dada_tests/reservations/our-to-our-leased-var/stdout.ref +++ b/dada_tests/reservations/our-to-our-leased-var/stdout.ref @@ -1,2 +1,2 @@ -my Point(44, 66) -our Point(22, 44) +Point(44, 66) +Point(22, 44) diff --git a/dada_tests/specifier/leased-from-rvalue-assign-in-loop/stdout.ref b/dada_tests/specifier/leased-from-rvalue-assign-in-loop/stdout.ref index f9189698..e1a5fb6f 100644 --- a/dada_tests/specifier/leased-from-rvalue-assign-in-loop/stdout.ref +++ b/dada_tests/specifier/leased-from-rvalue-assign-in-loop/stdout.ref @@ -1,2 +1,2 @@ -leased Point(22, 44) -my Point(44, 66) +Point(22, 44) +Point(44, 66) diff --git a/dada_tests/specifier/leased-from-rvalue/stdout.ref b/dada_tests/specifier/leased-from-rvalue/stdout.ref index 871cee0f..289dfd26 100644 --- a/dada_tests/specifier/leased-from-rvalue/stdout.ref +++ b/dada_tests/specifier/leased-from-rvalue/stdout.ref @@ -1,2 +1,2 @@ -leased Point(22, 44) -leased Point(22, 44) +Point(22, 44) +Point(22, 44) diff --git a/dada_tests/specifier/leased-from-shared-rvalue-assign-in-loop/stdout.ref b/dada_tests/specifier/leased-from-shared-rvalue-assign-in-loop/stdout.ref index f604265c..79c3a7f8 100644 --- a/dada_tests/specifier/leased-from-shared-rvalue-assign-in-loop/stdout.ref +++ b/dada_tests/specifier/leased-from-shared-rvalue-assign-in-loop/stdout.ref @@ -1,3 +1,3 @@ -our Point(22, 44) -our Point(44, 66) -our Point(44, 66) +Point(22, 44) +Point(44, 66) +Point(44, 66) diff --git a/dada_tests/specifier/local-my/stdout.ref b/dada_tests/specifier/local-my/stdout.ref index 99ae405a..c0fcae0e 100644 --- a/dada_tests/specifier/local-my/stdout.ref +++ b/dada_tests/specifier/local-my/stdout.ref @@ -1,4 +1,4 @@ -leased Pair(22, 44) -shleased Pair(22, 44) -shleased Pair(22, 44) -my Pair(22, 44) +Pair(22, 44) +Pair(22, 44) +Pair(22, 44) +Pair(22, 44) diff --git a/dada_tests/specifier/shleased-from-shared-rvalue-assign-in-loop/stdout.ref b/dada_tests/specifier/shleased-from-shared-rvalue-assign-in-loop/stdout.ref index f604265c..79c3a7f8 100644 --- a/dada_tests/specifier/shleased-from-shared-rvalue-assign-in-loop/stdout.ref +++ b/dada_tests/specifier/shleased-from-shared-rvalue-assign-in-loop/stdout.ref @@ -1,3 +1,3 @@ -our Point(22, 44) -our Point(44, 66) -our Point(44, 66) +Point(22, 44) +Point(44, 66) +Point(44, 66) diff --git a/dada_tests/specifier/shleased-got-my-then-copy/stdout.ref b/dada_tests/specifier/shleased-got-my-then-copy/stdout.ref index 1f7b23b5..891cf922 100644 --- a/dada_tests/specifier/shleased-got-my-then-copy/stdout.ref +++ b/dada_tests/specifier/shleased-got-my-then-copy/stdout.ref @@ -1 +1 @@ -my Point(22, 33) +Point(22, 33) diff --git a/dada_tests/specifier/temporary-lifetime/if-then-else-owned/stdout.ref b/dada_tests/specifier/temporary-lifetime/if-then-else-owned/stdout.ref index 2b84166d..8c823f66 100644 --- a/dada_tests/specifier/temporary-lifetime/if-then-else-owned/stdout.ref +++ b/dada_tests/specifier/temporary-lifetime/if-then-else-owned/stdout.ref @@ -1 +1 @@ -leased Object(true) +Object(true) diff --git a/dada_tests/validate/op-eq/lhs_field/stdout.ref b/dada_tests/validate/op-eq/lhs_field/stdout.ref index e56b542f..590ce17a 100644 --- a/dada_tests/validate/op-eq/lhs_field/stdout.ref +++ b/dada_tests/validate/op-eq/lhs_field/stdout.ref @@ -1 +1 @@ -my Point(23, 44) +Point(23, 44) diff --git a/dada_tests/validate/op-eq/lhs_field_of_func_call/stdout.ref b/dada_tests/validate/op-eq/lhs_field_of_func_call/stdout.ref index b20f3eae..a5112a2c 100644 --- a/dada_tests/validate/op-eq/lhs_field_of_func_call/stdout.ref +++ b/dada_tests/validate/op-eq/lhs_field_of_func_call/stdout.ref @@ -1,2 +1,2 @@ Hi -my Point(23, 44) +Point(23, 44) diff --git a/dada_tests/validate/op-eq/lhs_local_variable/stdout.ref b/dada_tests/validate/op-eq/lhs_local_variable/stdout.ref index e56b542f..590ce17a 100644 --- a/dada_tests/validate/op-eq/lhs_local_variable/stdout.ref +++ b/dada_tests/validate/op-eq/lhs_local_variable/stdout.ref @@ -1 +1 @@ -my Point(23, 44) +Point(23, 44) From aca11cb4768f78cfed8ce3add6bb80fcc6cf8f98 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sun, 17 Jul 2022 23:17:13 +0300 Subject: [PATCH 21/36] default to shared access When you write a place `a.b`, that is now equivalent to `a.b.shlease` by default; gives/leases must be explicit. --- .../dada-validate/src/validate/validator.rs | 6 +- dada_tests/assignments/assign-atomic.dada | 4 +- .../assignments/assign-atomic/stdout.ref | 1 + .../assignments/assign-if-then-else.dada | 6 +- .../assign-if-then-else/stdout.ref | 2 + .../eval-left-to-right-fn-call.dada | 4 +- .../cursor-position/HeapGraph-0.bir.ref | 8 +-- .../cursor-position/HeapGraph-1.bir.ref | 8 +-- .../cursor-position/HeapGraph-2.bir.ref | 8 +-- .../cursor-position/HeapGraph-3.bir.ref | 8 +-- dada_tests/heap-graph/dag/HeapGraph-0.bir.ref | 8 +-- .../leased-point/HeapGraph-0.bir.ref | 4 +- .../heap-graph/line-start/HeapGraph-0.bir.ref | 24 ++++++- .../heap-graph/line-start/HeapGraph-0.ref | 45 +++++++++++++ .../heap-graph/line-start/HeapGraph-1.bir.ref | 6 +- .../mid-increment/HeapGraph-0.bir.ref | 6 +- .../nested-functions/HeapGraph-0.bir.ref | 14 ++--- .../nested-functions/HeapGraph-0.ref | 11 ++-- .../nested-points/HeapGraph-0.bir.ref | 6 +- .../nested-points/HeapGraph-1.bir.ref | 6 +- .../nested-points/HeapGraph-2.bir.ref | 24 ++++++- .../heap-graph/nested-points/HeapGraph-2.ref | 63 ++++++++++++++++++- .../heap-graph/past-end/HeapGraph-0.bir.ref | 2 +- .../heap-graph/rust-thunk/HeapGraph-0.bir.ref | 2 +- .../heap-graph/tutorial-1/HeapGraph-0.bir.ref | 22 ++++++- .../heap-graph/tutorial-1/HeapGraph-0.ref | 43 +++++++++++++ .../heap-graph/tutorial-1/HeapGraph-1.bir.ref | 4 +- .../heap-graph/tutorial-1/HeapGraph-2.bir.ref | 4 +- .../heap-graph/tutorial-1/HeapGraph-3.bir.ref | 4 +- .../heap-graph/tutorial-1/HeapGraph-4.bir.ref | 22 ++++++- .../heap-graph/tutorial-1/HeapGraph-4.ref | 57 +++++++++++++++++ .../dyn_tutorial/tutorial-give-10.dada | 1 - .../tutorial-give-10/HeapGraph-0.bir.ref | 6 +- .../tutorial-give-10/HeapGraph-0.ref | 10 --- .../tutorial-give-10/HeapGraph-1.bir.ref | 6 +- .../tutorial-give-10/HeapGraph-1.ref | 13 +--- .../tutorial-lease-10/HeapGraph-0.bir.ref | 6 +- .../tutorial-lease-10/HeapGraph-1.bir.ref | 6 +- .../tutorial-lease-20/HeapGraph-0.bir.ref | 6 +- .../tutorial-lease-30/HeapGraph-0.bir.ref | 6 +- .../tutorial-share-10/HeapGraph-0.bir.ref | 10 +-- .../tutorial-share-20/HeapGraph-0.bir.ref | 2 +- .../tutorial-share-30/HeapGraph-0.bir.ref | 4 +- .../permissions/exhaustive/assign-var-my.dada | 3 +- .../exhaustive/assign-var-my/stdout.ref | 1 + .../exhaustive/share-var-leased.dada | 2 +- .../leased-from-rvalue-assign-in-loop.dada | 2 +- .../stdout.ref | 1 + .../op-eq/lhs_field_of_func_call.dada | 2 +- 49 files changed, 389 insertions(+), 130 deletions(-) diff --git a/components/dada-validate/src/validate/validator.rs b/components/dada-validate/src/validate/validator.rs index 68c6fef7..214ff4ae 100644 --- a/components/dada-validate/src/validate/validator.rs +++ b/components/dada-validate/src/validate/validator.rs @@ -197,7 +197,7 @@ impl<'me> Validator<'me> { match expr.data(self.syntax_tables()) { syntax::ExprData::Dot(..) | syntax::ExprData::Id(_) => self .with_expr_validated_as_place(expr, &mut |this, place| { - this.place_to_expr(place, expr.synthesized()) + this.add(validated::ExprData::Shlease(place), expr) }), syntax::ExprData::BooleanLiteral(b) => { @@ -752,10 +752,6 @@ impl<'me> Validator<'me> { } } - fn place_to_expr(&mut self, place: validated::Place, origin: ExprOrigin) -> validated::Expr { - self.add(validated::ExprData::Give(place), origin) - } - fn validate_permission_expr( &mut self, perm_expr: syntax::Expr, diff --git a/dada_tests/assignments/assign-atomic.dada b/dada_tests/assignments/assign-atomic.dada index 8350af73..6ec1c50d 100644 --- a/dada_tests/assignments/assign-atomic.dada +++ b/dada_tests/assignments/assign-atomic.dada @@ -1,5 +1,5 @@ class Point(x, y) p = Point(22, 44) t = true -atomic { p }.x += 1 -print(p).await #! RUN ERROR your lease to this object +atomic { p.lease }.x += 1 +print(p).await #! OUTPUT Point\(23, 44\) diff --git a/dada_tests/assignments/assign-atomic/stdout.ref b/dada_tests/assignments/assign-atomic/stdout.ref index e69de29b..590ce17a 100644 --- a/dada_tests/assignments/assign-atomic/stdout.ref +++ b/dada_tests/assignments/assign-atomic/stdout.ref @@ -0,0 +1 @@ +Point(23, 44) diff --git a/dada_tests/assignments/assign-if-then-else.dada b/dada_tests/assignments/assign-if-then-else.dada index 510a87a4..f3a7d521 100644 --- a/dada_tests/assignments/assign-if-then-else.dada +++ b/dada_tests/assignments/assign-if-then-else.dada @@ -2,6 +2,6 @@ class Point(x, y) p = Point(22, 44) q = Point(66, 88) t = true -if t { p } else { q }.x += 1 -print(p).await #! RUN ERROR your lease to this object -print(q).await \ No newline at end of file +if t { p.lease } else { q.lease }.x += 1 +print(p).await #! OUTPUT Point\(23, 44\) +print(q).await #! OUTPUT Point\(66, 88\) \ No newline at end of file diff --git a/dada_tests/assignments/assign-if-then-else/stdout.ref b/dada_tests/assignments/assign-if-then-else/stdout.ref index e69de29b..43df7be8 100644 --- a/dada_tests/assignments/assign-if-then-else/stdout.ref +++ b/dada_tests/assignments/assign-if-then-else/stdout.ref @@ -0,0 +1,2 @@ +Point(23, 44) +Point(66, 88) diff --git a/dada_tests/assignments/eval-left-to-right-fn-call.dada b/dada_tests/assignments/eval-left-to-right-fn-call.dada index 8536cc84..ca7a1595 100644 --- a/dada_tests/assignments/eval-left-to-right-fn-call.dada +++ b/dada_tests/assignments/eval-left-to-right-fn-call.dada @@ -6,8 +6,8 @@ fn next(c) -> { } fn next_and(c, d) -> { - next(c) - d + next(c.give) + d.give } c = Counter(0) diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref index be4b0150..ad9468b1 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -95,14 +95,14 @@ ( AssignExpr( temp{8}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(6), ), ( AssignExpr( temp{9}, - p{0}.give, + p{0}.shlease, ), Expr(7), ), @@ -166,7 +166,7 @@ ( AssignExpr( temp{13}, - Print.give, + Print.shlease, ), Expr(12), ), diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref index c612f3f0..3deeef82 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -77,14 +77,14 @@ ( AssignExpr( temp{8}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(6), ), ( AssignExpr( temp{9}, - p{0}.give, + p{0}.shlease, ), Expr(7), ), @@ -166,7 +166,7 @@ ( AssignExpr( temp{13}, - Print.give, + Print.shlease, ), Expr(12), ), diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref index fe32ee26..519e8208 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -84,14 +84,14 @@ ( AssignExpr( temp{8}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(6), ), ( AssignExpr( temp{9}, - p{0}.give, + p{0}.shlease, ), Expr(7), ), @@ -166,7 +166,7 @@ ( AssignExpr( temp{13}, - Print.give, + Print.shlease, ), Expr(12), ), diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref index 07dec099..4a3c4876 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -77,14 +77,14 @@ ( AssignExpr( temp{8}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(6), ), ( AssignExpr( temp{9}, - p{0}.give, + p{0}.shlease, ), Expr(7), ), @@ -166,7 +166,7 @@ ( AssignExpr( temp{13}, - Print.give, + Print.shlease, ), Expr(12), ), diff --git a/dada_tests/heap-graph/dag/HeapGraph-0.bir.ref b/dada_tests/heap-graph/dag/HeapGraph-0.bir.ref index 6bcddcf8..6cc40402 100644 --- a/dada_tests/heap-graph/dag/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/dag/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -84,21 +84,21 @@ ( AssignExpr( temp{7}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(6), ), ( AssignExpr( temp{8}, - p{0}.give, + p{0}.shlease, ), Expr(7), ), ( AssignExpr( temp{9}, - p{0}.give, + p{0}.shlease, ), Expr(8), ), diff --git a/dada_tests/heap-graph/leased-point/HeapGraph-0.bir.ref b/dada_tests/heap-graph/leased-point/HeapGraph-0.bir.ref index 176d0a72..b6e9111d 100644 --- a/dada_tests/heap-graph/leased-point/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/leased-point/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -71,7 +71,7 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(5), ), diff --git a/dada_tests/heap-graph/line-start/HeapGraph-0.bir.ref b/dada_tests/heap-graph/line-start/HeapGraph-0.bir.ref index a8656e50..e552cd6a 100644 --- a/dada_tests/heap-graph/line-start/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/line-start/HeapGraph-0.bir.ref @@ -3,6 +3,13 @@ start_basic_block: BasicBlock(0), BasicBlock(0): BasicBlockData( [ + ( + BreakpoingStart( + "class", + 0, + ), + Expr(0), + ), ( BreakpoingStart( "class", @@ -13,7 +20,18 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, + ), + Expr(0), + ), + ( + BreakpointEnd( + "class", + 0, + Expr(0), + Some( + temp{3}, + ), ), Expr(0), ), @@ -82,14 +100,14 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(5), ), ( AssignExpr( temp{7}, - p{0}.give, + p{0}.shlease, ), Expr(6), ), diff --git a/dada_tests/heap-graph/line-start/HeapGraph-0.ref b/dada_tests/heap-graph/line-start/HeapGraph-0.ref index 18956d3d..0990fa75 100644 --- a/dada_tests/heap-graph/line-start/HeapGraph-0.ref +++ b/dada_tests/heap-graph/line-start/HeapGraph-0.ref @@ -44,3 +44,48 @@ digraph { } } } +digraph { + node[shape = "note"]; + rankdir = "LR"; + subgraph cluster_after { + label=<after> + subgraph cluster_afterstack { + label=<stack> + rank="source"; + afterstack[ + shape="none"; + label=< + + + + + +
main
p
q
(in-flight)
+ >; + ]; + } + afternode0 [ + color = "slategray", + fontcolor = "slategray", + label = <Point> + ]; + "stack":9 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; + } + subgraph cluster_before { + label=<before> + subgraph cluster_beforestack { + label=<stack> + rank="source"; + beforestack[ + shape="none"; + label=< + + + + +
main
p
q
+ >; + ]; + } + } +} diff --git a/dada_tests/heap-graph/line-start/HeapGraph-1.bir.ref b/dada_tests/heap-graph/line-start/HeapGraph-1.bir.ref index 9b98f324..3958c54a 100644 --- a/dada_tests/heap-graph/line-start/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/line-start/HeapGraph-1.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -80,14 +80,14 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(5), ), ( AssignExpr( temp{7}, - p{0}.give, + p{0}.shlease, ), Expr(6), ), diff --git a/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref b/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref index 451b0f29..d46dbe7b 100644 --- a/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -140,14 +140,14 @@ ( AssignExpr( temp{12}, - Print.give, + Print.shlease, ), Expr(12), ), ( AssignExpr( temp{13}, - q{1}.give, + q{1}.shlease, ), Expr(13), ), diff --git a/dada_tests/heap-graph/nested-functions/HeapGraph-0.bir.ref b/dada_tests/heap-graph/nested-functions/HeapGraph-0.bir.ref index 0cbcc2e6..974496b5 100644 --- a/dada_tests/heap-graph/nested-functions/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/nested-functions/HeapGraph-0.bir.ref @@ -26,7 +26,7 @@ ( AssignExpr( temp{5}, - helper.give, + helper.shlease, ), Expr(3), ), @@ -75,7 +75,7 @@ ( AssignExpr( temp{8}, - Print.give, + Print.shlease, ), Expr(6), ), @@ -154,14 +154,14 @@ ( AssignExpr( temp{13}, - Print.give, + Print.shlease, ), Expr(11), ), ( AssignExpr( temp{14}, - name{0}.give, + name{0}.shlease, ), Expr(12), ), @@ -237,7 +237,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -302,14 +302,14 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(5), ), ( AssignExpr( temp{7}, - p{0}.give, + p{0}.shlease, ), Expr(6), ), diff --git a/dada_tests/heap-graph/nested-functions/HeapGraph-0.ref b/dada_tests/heap-graph/nested-functions/HeapGraph-0.ref index e5e7df6d..326c7414 100644 --- a/dada_tests/heap-graph/nested-functions/HeapGraph-0.ref +++ b/dada_tests/heap-graph/nested-functions/HeapGraph-0.ref @@ -21,14 +21,14 @@ digraph { >; ]; } - afternode0 [ + afternode1 [ label = <
Point
x
y: "66"
> ]; - afternode1 [ + afternode0 [ color = "slategray", fontcolor = "slategray", label = < @@ -37,9 +37,10 @@ digraph {
y: "44"
> ]; - "afterstack":16 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; - "stack":24 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; - "afternode0":0 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "afterstack":15 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; + "afterstack":16 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "stack":24 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "afternode1":0 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; } subgraph cluster_before { label=<before> diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-0.bir.ref b/dada_tests/heap-graph/nested-points/HeapGraph-0.bir.ref index 5c0fc6d0..ae44200a 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -82,14 +82,14 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(5), ), ( AssignExpr( temp{7}, - p{0}.give, + p{0}.shlease, ), Expr(6), ), diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-1.bir.ref b/dada_tests/heap-graph/nested-points/HeapGraph-1.bir.ref index 9b98f324..3958c54a 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-1.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -80,14 +80,14 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(5), ), ( AssignExpr( temp{7}, - p{0}.give, + p{0}.shlease, ), Expr(6), ), diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-2.bir.ref b/dada_tests/heap-graph/nested-points/HeapGraph-2.bir.ref index 9472b05e..c69a353e 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-2.bir.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-2.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -64,7 +64,7 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(5), ), @@ -75,10 +75,28 @@ ), Expr(6), ), + ( + BreakpoingStart( + "class", + 0, + ), + Expr(6), + ), ( AssignExpr( temp{7}, - p{0}.give, + p{0}.shlease, + ), + Expr(6), + ), + ( + BreakpointEnd( + "class", + 0, + Expr(6), + Some( + temp{7}, + ), ), Expr(6), ), diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-2.ref b/dada_tests/heap-graph/nested-points/HeapGraph-2.ref index eb900655..2a411e2c 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-2.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-2.ref @@ -28,7 +28,68 @@ digraph { y: "44" > ]; - "stack":9 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "afterstack":0 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; + "stack":9 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + } + subgraph cluster_before { + label=<before> + subgraph cluster_beforestack { + label=<stack> + rank="source"; + beforestack[ + shape="none"; + label=< + + + + +
main
p
q
+ >; + ]; + } + beforenode0 [ + color = "slategray", + fontcolor = "slategray", + label = < + + + +
Point
x: "22"
y: "44"
> + ]; + "beforestack":0 -> "beforenode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + } +} +digraph { + node[shape = "note"]; + rankdir = "LR"; + subgraph cluster_after { + label=<after> + subgraph cluster_afterstack { + label=<stack> + rank="source"; + afterstack[ + shape="none"; + label=< + + + + + +
main
p
q
(in-flight)
+ >; + ]; + } + afternode0 [ + color = "slategray", + fontcolor = "slategray", + label = < + + + +
Point
x: "22"
y: "44"
> + ]; + "afterstack":0 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; + "stack":9 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; } subgraph cluster_before { label=<before> diff --git a/dada_tests/heap-graph/past-end/HeapGraph-0.bir.ref b/dada_tests/heap-graph/past-end/HeapGraph-0.bir.ref index 9f492b8a..28489026 100644 --- a/dada_tests/heap-graph/past-end/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/past-end/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{3}, - Print.give, + Print.shlease, ), Expr(0), ), diff --git a/dada_tests/heap-graph/rust-thunk/HeapGraph-0.bir.ref b/dada_tests/heap-graph/rust-thunk/HeapGraph-0.bir.ref index 43b83906..f5662587 100644 --- a/dada_tests/heap-graph/rust-thunk/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/rust-thunk/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{3}, - Print.give, + Print.shlease, ), Expr(0), ), diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-0.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-0.bir.ref index fab53ba7..635c67b2 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-0.bir.ref @@ -3,6 +3,13 @@ start_basic_block: BasicBlock(0), BasicBlock(0): BasicBlockData( [ + ( + BreakpoingStart( + "class", + 0, + ), + Expr(0), + ), ( BreakpoingStart( "class", @@ -13,7 +20,18 @@ ( AssignExpr( temp{2}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, + ), + Expr(0), + ), + ( + BreakpointEnd( + "class", + 0, + Expr(0), + Some( + temp{2}, + ), ), Expr(0), ), @@ -86,7 +104,7 @@ ( AssignExpr( temp{7}, - Print.give, + Print.shlease, ), Expr(5), ), diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-0.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-0.ref index e5f8c01f..b7a36953 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-0.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-0.ref @@ -42,4 +42,47 @@ digraph { } } } +digraph { + node[shape = "note"]; + rankdir = "LR"; + subgraph cluster_after { + label=<after> + subgraph cluster_afterstack { + label=<stack> + rank="source"; + afterstack[ + shape="none"; + label=< + + + + +
main
p
(in-flight)
+ >; + ]; + } + afternode0 [ + color = "slategray", + fontcolor = "slategray", + label = <Point> + ]; + "stack":10 -> "afternode0" [label="our", style="solid", penwidth=3.0, arrowtype="normal", color="blue"]; + } + subgraph cluster_before { + label=<before> + subgraph cluster_beforestack { + label=<stack> + rank="source"; + beforestack[ + shape="none"; + label=< + + + +
main
p
+ >; + ]; + } + } +} The point is FIXME diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-1.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-1.bir.ref index 84ea45ce..fb18bf42 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-1.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{2}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -86,7 +86,7 @@ ( AssignExpr( temp{7}, - Print.give, + Print.shlease, ), Expr(5), ), diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-2.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-2.bir.ref index 1333860e..9dae8942 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-2.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-2.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{2}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -84,7 +84,7 @@ ( AssignExpr( temp{7}, - Print.give, + Print.shlease, ), Expr(5), ), diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-3.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-3.bir.ref index 1333860e..9dae8942 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-3.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-3.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{2}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -84,7 +84,7 @@ ( AssignExpr( temp{7}, - Print.give, + Print.shlease, ), Expr(5), ), diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-4.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-4.bir.ref index 21dbd6d4..22f7bbc8 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-4.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-4.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{2}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -72,10 +72,28 @@ ), Expr(5), ), + ( + BreakpoingStart( + "class", + 0, + ), + Expr(5), + ), ( AssignExpr( temp{7}, - Print.give, + Print.shlease, + ), + Expr(5), + ), + ( + BreakpointEnd( + "class", + 0, + Expr(5), + Some( + temp{7}, + ), ), Expr(5), ), diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-4.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-4.ref index 3be7cb75..16c74997 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-4.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-4.ref @@ -56,4 +56,61 @@ digraph { "beforestack":0 -> "beforenode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; } } +digraph { + node[shape = "note"]; + rankdir = "LR"; + subgraph cluster_after { + label=<after> + subgraph cluster_afterstack { + label=<stack> + rank="source"; + afterstack[ + shape="none"; + label=< + + + + +
main
p
(in-flight): "print"
+ >; + ]; + } + afternode0 [ + color = "slategray", + fontcolor = "slategray", + label = < + + + +
Point
x: "22"
y: "44"
> + ]; + "afterstack":0 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + } + subgraph cluster_before { + label=<before> + subgraph cluster_beforestack { + label=<stack> + rank="source"; + beforestack[ + shape="none"; + label=< + + + +
main
p
+ >; + ]; + } + beforenode0 [ + color = "slategray", + fontcolor = "slategray", + label = < + + + +
Point
x: "22"
y: "44"
> + ]; + "beforestack":0 -> "beforenode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + } +} The point is FIXME diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada b/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada index 60e36b27..1b92719d 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada @@ -7,5 +7,4 @@ async fn main() { #? ^ HeapGraph x = p.x - #! ^ RUN ERROR your lease to this object was cancelled } \ No newline at end of file diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.bir.ref index 3276b6ba..186b826b 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -84,14 +84,14 @@ ( AssignExpr( q{1}, - p{0}.give, + p{0}.shlease, ), Expr(5), ), ( AssignExpr( x{2}, - p{0}.x.give, + p{0}.x.shlease, ), Expr(8), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.ref b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.ref index bc55f564..298fd9d0 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.ref @@ -47,13 +47,3 @@ digraph { } } } -Error: your lease to this object was cancelled - ╭─[class:9:9] - │ - 6 │     q = p -  · ┬ -  · ╰── lease was cancelled here - 9 │     x = p.x -  · ┬ -  · ╰── cancelled lease used here -───╯ diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.bir.ref index 96f4f5e2..e2408911 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -75,7 +75,7 @@ ( AssignExpr( q{1}, - p{0}.give, + p{0}.shlease, ), Expr(5), ), @@ -91,7 +91,7 @@ ( AssignExpr( x{2}, - p{0}.x.give, + p{0}.x.shlease, ), Expr(8), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.ref b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.ref index 3e6dbfb3..19b743a2 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.ref @@ -28,7 +28,8 @@ digraph { y: "44" > ]; - "afterstack":1 -> "afternode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; + "afterstack":0 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; + "afterstack":1 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; } subgraph cluster_before { label=<before> @@ -59,13 +60,3 @@ digraph { "beforestack":0 -> "beforenode0" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; } } -Error: your lease to this object was cancelled - ╭─[class:9:9] - │ - 6 │     q = p -  · ┬ -  · ╰── lease was cancelled here - 9 │     x = p.x -  · ┬ -  · ╰── cancelled lease used here -───╯ diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref index 227e92f3..a47ae11f 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -146,14 +146,14 @@ ( AssignExpr( temp{12}, - Print.give, + Print.shlease, ), Expr(12), ), ( AssignExpr( temp{13}, - p{0}.x.give, + p{0}.x.shlease, ), Expr(14), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref index 2182a224..4b98b8fb 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -144,14 +144,14 @@ ( AssignExpr( temp{12}, - Print.give, + Print.shlease, ), Expr(12), ), ( AssignExpr( temp{13}, - p{0}.x.give, + p{0}.x.shlease, ), Expr(14), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref index 66960160..82072e0e 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{5}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -151,14 +151,14 @@ ( AssignExpr( temp{13}, - Print.give, + Print.shlease, ), Expr(15), ), ( AssignExpr( temp{14}, - p{0}.x.give, + p{0}.x.shlease, ), Expr(17), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref index 6d631785..12150e21 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -135,7 +135,7 @@ ( AssignExpr( x{3}, - p{0}.x.give, + p{0}.x.shlease, ), Expr(13), ), @@ -151,7 +151,7 @@ ( AssignExpr( x{4}, - q{1}.x.give, + q{1}.x.shlease, ), Expr(16), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.bir.ref index 3d0e44bb..f9e9ee38 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{7}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -88,7 +88,7 @@ ( AssignExpr( q{1}, - p{0}.give, + p{0}.shlease, ), Expr(6), ), @@ -104,21 +104,21 @@ ( AssignExpr( x{2}, - p{0}.x.give, + p{0}.x.shlease, ), Expr(9), ), ( AssignExpr( x{3}, - q{1}.x.give, + q{1}.x.shlease, ), Expr(12), ), ( AssignExpr( x{4}, - p{0}.x.give, + p{0}.x.shlease, ), Expr(15), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.bir.ref index 208d6f3b..162aa583 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.bir.ref index 95067e4d..c393e501 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{5}, - Class(Id { value: 1 }).give, + Class(Id { value: 1 }).shlease, ), Expr(0), ), @@ -95,7 +95,7 @@ ( AssignExpr( r{2}, - q{1}.give, + q{1}.shlease, ), Expr(9), ), diff --git a/dada_tests/permissions/exhaustive/assign-var-my.dada b/dada_tests/permissions/exhaustive/assign-var-my.dada index f89c57f4..0c101292 100644 --- a/dada_tests/permissions/exhaustive/assign-var-my.dada +++ b/dada_tests/permissions/exhaustive/assign-var-my.dada @@ -3,6 +3,5 @@ class Pair(a, b) async fn main() { p = Pair(22, 44) q = p - print(p).await - #! RUN ERROR your lease to this object was cancelled + print(p).await #! OUTPUT Pair\(22, 44\) } \ No newline at end of file diff --git a/dada_tests/permissions/exhaustive/assign-var-my/stdout.ref b/dada_tests/permissions/exhaustive/assign-var-my/stdout.ref index e69de29b..f21ec181 100644 --- a/dada_tests/permissions/exhaustive/assign-var-my/stdout.ref +++ b/dada_tests/permissions/exhaustive/assign-var-my/stdout.ref @@ -0,0 +1 @@ +Pair(22, 44) diff --git a/dada_tests/permissions/exhaustive/share-var-leased.dada b/dada_tests/permissions/exhaustive/share-var-leased.dada index 4024ee5b..9b580268 100644 --- a/dada_tests/permissions/exhaustive/share-var-leased.dada +++ b/dada_tests/permissions/exhaustive/share-var-leased.dada @@ -10,7 +10,7 @@ async fn main() { print(q).await #! OUTPUT Pair\(22, 44\) # Accessing `p`: ok, but cancels subleases - print(p).await #! OUTPUT Pair\(22, 44\) + print(p.give).await #! OUTPUT Pair\(22, 44\) # Accessing `q` again: error print(q).await #! RUN ERROR your lease to this object was cancelled diff --git a/dada_tests/specifier/leased-from-rvalue-assign-in-loop.dada b/dada_tests/specifier/leased-from-rvalue-assign-in-loop.dada index 89189c5c..f1094849 100644 --- a/dada_tests/specifier/leased-from-rvalue-assign-in-loop.dada +++ b/dada_tests/specifier/leased-from-rvalue-assign-in-loop.dada @@ -16,5 +16,5 @@ async fn main() { } # The value stored in `p` has expired - print(p).await #! RUN ERROR your lease to this object was cancelled + print(p).await #! OUTPUT Point\(44, 66\) } \ No newline at end of file diff --git a/dada_tests/specifier/leased-from-rvalue-assign-in-loop/stdout.ref b/dada_tests/specifier/leased-from-rvalue-assign-in-loop/stdout.ref index e1a5fb6f..79c3a7f8 100644 --- a/dada_tests/specifier/leased-from-rvalue-assign-in-loop/stdout.ref +++ b/dada_tests/specifier/leased-from-rvalue-assign-in-loop/stdout.ref @@ -1,2 +1,3 @@ Point(22, 44) Point(44, 66) +Point(44, 66) diff --git a/dada_tests/validate/op-eq/lhs_field_of_func_call.dada b/dada_tests/validate/op-eq/lhs_field_of_func_call.dada index 55f84fce..8388226c 100644 --- a/dada_tests/validate/op-eq/lhs_field_of_func_call.dada +++ b/dada_tests/validate/op-eq/lhs_field_of_func_call.dada @@ -8,5 +8,5 @@ async fn main() { async fn test(p) -> { print("Hi").await #! OUTPUT Hi - p + p.give } \ No newline at end of file From 44003c61e1f4c7857ffe6179fd7302d3b0b6e9db Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 18 Jul 2022 06:59:49 +0300 Subject: [PATCH 22/36] remove shlease/shleased terminology It is now equivalent to shared. --- dada_tests/assignments/eval-left-to-right-fn-call.dada | 2 +- .../house-parties/house-parties-are-not-enough.dada | 8 ++++---- .../house-parties-are-not-fair-to-the-tenant.dada | 2 +- dada_tests/permissions/revokation/lease-vs-shlease-1.dada | 2 +- dada_tests/permissions/revokation/lease-vs-shlease-2.dada | 2 +- .../reservations/our-to-our-leased-assign-field.dada | 2 +- dada_tests/reservations/our-to-our-leased-assign.dada | 2 +- dada_tests/reservations/our-to-our-leased-field.dada | 2 +- .../leased-from-shared-rvalue-assign-in-loop.dada | 2 +- dada_tests/specifier/our-lease-yields-our.dada | 2 +- dada_tests/specifier/our-shlease-yields-our.dada | 4 ++-- .../shleased-from-shared-rvalue-assign-in-loop.dada | 2 +- dada_tests/specifier/shleased-got-my-then-copy.dada | 6 +++--- .../validate/op-eq/lhs_shared_field_of_func_call.dada | 2 +- 14 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dada_tests/assignments/eval-left-to-right-fn-call.dada b/dada_tests/assignments/eval-left-to-right-fn-call.dada index ca7a1595..13334952 100644 --- a/dada_tests/assignments/eval-left-to-right-fn-call.dada +++ b/dada_tests/assignments/eval-left-to-right-fn-call.dada @@ -16,4 +16,4 @@ d = Counter(22) # `next_and` is evaluated first, so `next` # returns 2 next_and(c.lease, d.lease).value := next(c.lease) -print(d.shlease).await #! OUTPUT Counter\(2\) \ No newline at end of file +print(d.share).await #! OUTPUT Counter\(2\) \ No newline at end of file diff --git a/dada_tests/permissions/house-parties/house-parties-are-not-enough.dada b/dada_tests/permissions/house-parties/house-parties-are-not-enough.dada index d7b5605d..26de7e69 100644 --- a/dada_tests/permissions/house-parties/house-parties-are-not-enough.dada +++ b/dada_tests/permissions/house-parties/house-parties-are-not-enough.dada @@ -7,8 +7,8 @@ class Accumulator(list) class List() -# This function takes a `shleased` accumulator and returns a -# `shleased` result. (Though, if given an `our` accumulator, +# This function takes a `shared` accumulator and returns a +# `shared` result. (Though, if given an `our` accumulator, # it will return an `our` list, given current rules.) fn get_list(accumulator) -> { accumulator.list.share @@ -23,8 +23,8 @@ async fn main() { # ``` a = Accumulator(list: List()) - l1 = get_list(a.shlease) - l2 = get_list(a.shlease) + l1 = get_list(a.share) + l2 = get_list(a.share) print(l2).await #! OUTPUT List\(\) print(l1).await #! OUTPUT List print(l2).await #! OUTPUT List diff --git a/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada b/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada index 5779992d..6ecd17ef 100644 --- a/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada +++ b/dada_tests/permissions/house-parties/house-parties-are-not-fair-to-the-tenant.dada @@ -13,7 +13,7 @@ class Accumulator(atomic list) class List(field) -fn foo(accumulator) -> # shleased List +fn foo(accumulator) -> # shared List { #! FIXME: Reading an atomic field without atomic section should not be allowed accumulator.list.lease.share diff --git a/dada_tests/permissions/revokation/lease-vs-shlease-1.dada b/dada_tests/permissions/revokation/lease-vs-shlease-1.dada index 9e7dae5f..c7f7e1bd 100644 --- a/dada_tests/permissions/revokation/lease-vs-shlease-1.dada +++ b/dada_tests/permissions/revokation/lease-vs-shlease-1.dada @@ -3,7 +3,7 @@ class Data(field) async fn main() { m = Data(22) l = m.lease - s = l.shlease + s = l.share print(m.field).await #! OUTPUT 22 print(s.field).await #! RUN ERROR your lease to this object was cancelled } diff --git a/dada_tests/permissions/revokation/lease-vs-shlease-2.dada b/dada_tests/permissions/revokation/lease-vs-shlease-2.dada index 540ae41e..f3612aa6 100644 --- a/dada_tests/permissions/revokation/lease-vs-shlease-2.dada +++ b/dada_tests/permissions/revokation/lease-vs-shlease-2.dada @@ -2,7 +2,7 @@ class Data(field) async fn main() { m = Data(22) - s = m.shlease + s = m.share print(m.field).await #! OUTPUT 22 print(s.field).await #! OUTPUT 22 } diff --git a/dada_tests/reservations/our-to-our-leased-assign-field.dada b/dada_tests/reservations/our-to-our-leased-assign-field.dada index e9fa186e..418fd1ea 100644 --- a/dada_tests/reservations/our-to-our-leased-assign-field.dada +++ b/dada_tests/reservations/our-to-our-leased-assign-field.dada @@ -4,7 +4,7 @@ class OurLeased(f) async fn main() { p = Point(22, 44).share # create a shared point `(22, 44)` - q = OurLeased(p.shlease) # `q.f` becomes 2nd owner of `(22, 44)` + q = OurLeased(p.share) # `q.f` becomes 2nd owner of `(22, 44)` print(q.lease).await #! OUTPUT OurLeased\(Point\(22, 44\)\) p := Point(44, 66).share # `p` is shared owner of `(44, 66)` diff --git a/dada_tests/reservations/our-to-our-leased-assign.dada b/dada_tests/reservations/our-to-our-leased-assign.dada index ea45c7ce..0f44b6ba 100644 --- a/dada_tests/reservations/our-to-our-leased-assign.dada +++ b/dada_tests/reservations/our-to-our-leased-assign.dada @@ -5,7 +5,7 @@ async fn main() { # leasing an "our" thing becomes a second # owner (lessors are always exclusive) - q = p.shlease + q = p.share print(q).await #! OUTPUT Point\(22, 44\) # reassigning `p` does not invalidate `q`. diff --git a/dada_tests/reservations/our-to-our-leased-field.dada b/dada_tests/reservations/our-to-our-leased-field.dada index 099eff51..c003a0b5 100644 --- a/dada_tests/reservations/our-to-our-leased-field.dada +++ b/dada_tests/reservations/our-to-our-leased-field.dada @@ -5,7 +5,7 @@ class OurLeased(f) async fn main() { p = Point(22, 44).share # create `(22, 44)` with shared ownership print(p.lease).await #! OUTPUT Point\(22, 44\) - q = OurLeased(p.shlease) # `OurLeased` takes 2nd ownership of `(22, 44)` + q = OurLeased(p.share) # `OurLeased` takes 2nd ownership of `(22, 44)` print(q.lease).await #! OUTPUT OurLeased\(Point\(22, 44\)\) p := Point(44, 66) # reassigning `p` doesn't invalidate `q.f` diff --git a/dada_tests/specifier/leased-from-shared-rvalue-assign-in-loop.dada b/dada_tests/specifier/leased-from-shared-rvalue-assign-in-loop.dada index af85b2c3..25d3a766 100644 --- a/dada_tests/specifier/leased-from-shared-rvalue-assign-in-loop.dada +++ b/dada_tests/specifier/leased-from-shared-rvalue-assign-in-loop.dada @@ -4,7 +4,7 @@ async fn main() { # Leasing an `our` value just takes ownership # of it, so `p` becomes (shared) owner of this # point here. - p = Point(22, 44).share.shlease + p = Point(22, 44).share i = 0 while i < 1 { diff --git a/dada_tests/specifier/our-lease-yields-our.dada b/dada_tests/specifier/our-lease-yields-our.dada index f4833468..f93a3f6f 100644 --- a/dada_tests/specifier/our-lease-yields-our.dada +++ b/dada_tests/specifier/our-lease-yields-our.dada @@ -4,7 +4,7 @@ async fn main() { p = Point(22, 33).share # Under current semantics, leasing an `our` - # yields another `our` value (not, e.g., shleased), + # yields another `our` value (not, e.g., shared), # so this code works. x = p.x.lease.share } diff --git a/dada_tests/specifier/our-shlease-yields-our.dada b/dada_tests/specifier/our-shlease-yields-our.dada index a56ea313..32592e77 100644 --- a/dada_tests/specifier/our-shlease-yields-our.dada +++ b/dada_tests/specifier/our-shlease-yields-our.dada @@ -4,7 +4,7 @@ async fn main() { p = Point(22, 33).share # Under current semantics, shleasing an `our` - # yields another `our` value (not, e.g., shleased), + # yields another `our` value (not, e.g., shared), # so this code works. - x = p.x.shlease.share + x = p.x.share } diff --git a/dada_tests/specifier/shleased-from-shared-rvalue-assign-in-loop.dada b/dada_tests/specifier/shleased-from-shared-rvalue-assign-in-loop.dada index af85b2c3..25d3a766 100644 --- a/dada_tests/specifier/shleased-from-shared-rvalue-assign-in-loop.dada +++ b/dada_tests/specifier/shleased-from-shared-rvalue-assign-in-loop.dada @@ -4,7 +4,7 @@ async fn main() { # Leasing an `our` value just takes ownership # of it, so `p` becomes (shared) owner of this # point here. - p = Point(22, 44).share.shlease + p = Point(22, 44).share i = 0 while i < 1 { diff --git a/dada_tests/specifier/shleased-got-my-then-copy.dada b/dada_tests/specifier/shleased-got-my-then-copy.dada index 7a687b33..8b61269b 100644 --- a/dada_tests/specifier/shleased-got-my-then-copy.dada +++ b/dada_tests/specifier/shleased-got-my-then-copy.dada @@ -1,11 +1,11 @@ class Point(x, y) async fn main() { - # `p` is shleased here from a temporary; scope of the temporary is the block + # `p` is shared here from a temporary; scope of the temporary is the block p = Point(22, 33) - # ...and then we copy it to `q` (also shleased) - q = p.shlease + # ...and then we copy it to `q` (also shared) + q = p.share # ...and check if we can access `p` print(p).await #! OUTPUT Point\(22, 33\) diff --git a/dada_tests/validate/op-eq/lhs_shared_field_of_func_call.dada b/dada_tests/validate/op-eq/lhs_shared_field_of_func_call.dada index c296d153..aaac850d 100644 --- a/dada_tests/validate/op-eq/lhs_shared_field_of_func_call.dada +++ b/dada_tests/validate/op-eq/lhs_shared_field_of_func_call.dada @@ -4,7 +4,7 @@ async fn main() { p = Point(22, 44).share # Test that we execute `test(p)` (and hence see its output) # before we detect the error here - test(p.shlease).await.x += 1 #! RUN ERROR cannot write to shared fields + test(p.share).await.x += 1 #! RUN ERROR cannot write to shared fields print(p).await } From de9c40f4e81075fde6793b757d5e093a5cf69bef Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 18 Jul 2022 07:06:25 +0300 Subject: [PATCH 23/36] delete shlease keyword, public use Still using it internally in the IR --- components/dada-breakpoint/src/breakpoint.rs | 1 - components/dada-execute/src/heap_graph.rs | 4 ++-- components/dada-execute/src/heap_graph/capture.rs | 2 +- components/dada-execute/src/heap_graph/graphviz.rs | 4 ++-- components/dada-execute/src/machine.rs | 2 +- components/dada-ir/src/code/syntax.rs | 4 ---- components/dada-ir/src/code/validated.rs | 8 ++++---- components/dada-ir/src/kw.rs | 2 -- components/dada-parse/src/parser/code.rs | 4 ---- components/dada-validate/src/validate/validator.rs | 6 +----- dada_tests/heap-graph/nested-functions/HeapGraph-0.ref | 2 +- dada_tests/heap-graph/nested-points/HeapGraph-2.ref | 4 ++-- .../dyn_tutorial/tutorial-give-10/HeapGraph-1.ref | 2 +- 13 files changed, 15 insertions(+), 30 deletions(-) diff --git a/components/dada-breakpoint/src/breakpoint.rs b/components/dada-breakpoint/src/breakpoint.rs index 7f71928b..3d414b69 100644 --- a/components/dada-breakpoint/src/breakpoint.rs +++ b/components/dada-breakpoint/src/breakpoint.rs @@ -111,7 +111,6 @@ impl TreeTraversal<'_> { | syntax::ExprData::Dot(base_expr, _) | syntax::ExprData::Share(base_expr) | syntax::ExprData::Lease(base_expr) - | syntax::ExprData::Shlease(base_expr) | syntax::ExprData::Give(base_expr) | syntax::ExprData::Await(base_expr) | syntax::ExprData::Loop(base_expr) diff --git a/components/dada-execute/src/heap_graph.rs b/components/dada-execute/src/heap_graph.rs index de35dd82..e5ec6352 100644 --- a/components/dada-execute/src/heap_graph.rs +++ b/components/dada-execute/src/heap_graph.rs @@ -143,7 +143,7 @@ pub(crate) enum PermissionNodeLabel { My, Our, Leased, - Shleased, + Shared, Reserved, Expired, } @@ -154,7 +154,7 @@ impl PermissionNodeLabel { PermissionNodeLabel::My => "my", PermissionNodeLabel::Our => "our", PermissionNodeLabel::Leased => "leased", - PermissionNodeLabel::Shleased => "shleased", + PermissionNodeLabel::Shared => "Shared", PermissionNodeLabel::Reserved => "reserved", PermissionNodeLabel::Expired => "expired", } diff --git a/components/dada-execute/src/heap_graph/capture.rs b/components/dada-execute/src/heap_graph/capture.rs index 335270f8..870af766 100644 --- a/components/dada-execute/src/heap_graph/capture.rs +++ b/components/dada-execute/src/heap_graph/capture.rs @@ -158,7 +158,7 @@ impl<'me> HeapGraphCapture<'me> { (Joint::No, Leased::No) => PermissionNodeLabel::My, (Joint::Yes, Leased::No) => PermissionNodeLabel::Our, (Joint::No, Leased::Yes) => PermissionNodeLabel::Leased, - (Joint::Yes, Leased::Yes) => PermissionNodeLabel::Shleased, + (Joint::Yes, Leased::Yes) => PermissionNodeLabel::Shared, }, }; diff --git a/components/dada-execute/src/heap_graph/graphviz.rs b/components/dada-execute/src/heap_graph/graphviz.rs index 083eb6af..f7d91f3f 100644 --- a/components/dada-execute/src/heap_graph/graphviz.rs +++ b/components/dada-execute/src/heap_graph/graphviz.rs @@ -151,12 +151,12 @@ impl HeapGraph { PermissionNodeLabel::Reserved => ("1.0", "odot"), PermissionNodeLabel::Expired | PermissionNodeLabel::Leased - | PermissionNodeLabel::Shleased => ("1.0", "empty"), + | PermissionNodeLabel::Shared => ("1.0", "empty"), }; let color = match permission_data.label { PermissionNodeLabel::My | PermissionNodeLabel::Leased => "red", - PermissionNodeLabel::Shleased | PermissionNodeLabel::Our => "blue", + PermissionNodeLabel::Shared | PermissionNodeLabel::Our => "blue", PermissionNodeLabel::Reserved => "grey", PermissionNodeLabel::Expired => "grey", }; diff --git a/components/dada-execute/src/machine.rs b/components/dada-execute/src/machine.rs index 62fe5ba9..3d740d8f 100644 --- a/components/dada-execute/src/machine.rs +++ b/components/dada-execute/src/machine.rs @@ -494,7 +494,7 @@ impl ValidPermissionData { (Joint::No, Leased::No) => "my", (Joint::No, Leased::Yes) => "leased", (Joint::Yes, Leased::No) => "our", - (Joint::Yes, Leased::Yes) => "shleased", + (Joint::Yes, Leased::Yes) => "shared", } } } diff --git a/components/dada-ir/src/code/syntax.rs b/components/dada-ir/src/code/syntax.rs index 44556f7d..90fa0447 100644 --- a/components/dada-ir/src/code/syntax.rs +++ b/components/dada-ir/src/code/syntax.rs @@ -124,9 +124,6 @@ pub enum ExprData { /// `expr.lease` Lease(Expr), - /// `expr.shlease` - Shlease(Expr), - /// `expr.give` Give(Expr), @@ -203,7 +200,6 @@ impl DebugWithDb> for ExprData { .finish(), ExprData::Share(e) => f.debug_tuple("Share").field(&e.debug(db)).finish(), ExprData::Lease(e) => f.debug_tuple("Lease").field(&e.debug(db)).finish(), - ExprData::Shlease(e) => f.debug_tuple("Shlease").field(&e.debug(db)).finish(), ExprData::Give(e) => f.debug_tuple("Give").field(&e.debug(db)).finish(), ExprData::Var(v, e) => f .debug_tuple("Var") diff --git a/components/dada-ir/src/code/validated.rs b/components/dada-ir/src/code/validated.rs index 1f7c2df5..e456a14c 100644 --- a/components/dada-ir/src/code/validated.rs +++ b/components/dada-ir/src/code/validated.rs @@ -244,15 +244,15 @@ pub enum ExprData { /// `expr.reserve` -- not legal syntax Reserve(Place), - /// `expr.share` + /// `.share` Share(Expr), + /// `.share` + Shlease(Place), + /// `expr.lease` Lease(Place), - /// `expr.shlease` - Shlease(Place), - /// `expr.give` Give(Place), diff --git a/components/dada-ir/src/kw.rs b/components/dada-ir/src/kw.rs index 7c4cf074..55990eb8 100644 --- a/components/dada-ir/src/kw.rs +++ b/components/dada-ir/src/kw.rs @@ -60,8 +60,6 @@ define_keywords! { Return => "return", Share => "share", Shared => "shared", - Shlease => "shlease", - Shleased => "shleased", True => "true", Our => "our", While => "while", diff --git a/components/dada-parse/src/parser/code.rs b/components/dada-parse/src/parser/code.rs index 78275398..0bd61369 100644 --- a/components/dada-parse/src/parser/code.rs +++ b/components/dada-parse/src/parser/code.rs @@ -343,10 +343,6 @@ impl CodeParser<'_, '_> { let span = self.spans[expr].to(kw_span); expr = self.add(ExprData::Lease(expr), span); continue; - } else if let Some((kw_span, _)) = self.eat(Keyword::Shlease) { - let span = self.spans[expr].to(kw_span); - expr = self.add(ExprData::Shlease(expr), span); - continue; } else { self.parser .error_at_current_token("expected identifier after `.`") diff --git a/components/dada-validate/src/validate/validator.rs b/components/dada-validate/src/validate/validator.rs index 214ff4ae..0f7ce404 100644 --- a/components/dada-validate/src/validate/validator.rs +++ b/components/dada-validate/src/validate/validator.rs @@ -189,7 +189,7 @@ impl<'me> Validator<'me> { /// Validates an expression into a value: /// - /// * If `E` is a place expression, like `a.b`, this is equivalent to `a.b.shlease` + /// * If `E` is a place expression, like `a.b`, this is equivalent to `a.b.share` /// * If `E` is a value expression, like `foo()`, this just evalutes it #[tracing::instrument(level = "debug", skip(self, expr))] fn validate_expr(&mut self, expr: syntax::Expr) -> validated::Expr { @@ -356,10 +356,6 @@ impl<'me> Validator<'me> { self.validate_permission_expr(expr, *target_expr, validated::ExprData::Lease) } - syntax::ExprData::Shlease(target_expr) => { - self.validate_permission_expr(expr, *target_expr, validated::ExprData::Shlease) - } - syntax::ExprData::Give(target_expr) => self.give_validated_expr(expr, *target_expr), syntax::ExprData::Var(decl, initializer_expr) => { diff --git a/dada_tests/heap-graph/nested-functions/HeapGraph-0.ref b/dada_tests/heap-graph/nested-functions/HeapGraph-0.ref index 326c7414..5ed81bd8 100644 --- a/dada_tests/heap-graph/nested-functions/HeapGraph-0.ref +++ b/dada_tests/heap-graph/nested-functions/HeapGraph-0.ref @@ -40,7 +40,7 @@ digraph { "afterstack":15 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; "afterstack":16 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; "stack":24 -> "afternode1" [label="my", style="solid", penwidth=3.0, arrowtype="normal", color="red"]; - "afternode1":0 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + "afternode1":0 -> "afternode0" [label="Shared", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; } subgraph cluster_before { label=<before> diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-2.ref b/dada_tests/heap-graph/nested-points/HeapGraph-2.ref index 2a411e2c..ce33d91b 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-2.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-2.ref @@ -29,7 +29,7 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "stack":9 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + "stack":9 -> "afternode0" [label="Shared", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; } subgraph cluster_before { label=<before> @@ -89,7 +89,7 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "stack":9 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + "stack":9 -> "afternode0" [label="Shared", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; } subgraph cluster_before { label=<before> diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.ref b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.ref index 19b743a2..9d310ef5 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.ref @@ -29,7 +29,7 @@ digraph { > ]; "afterstack":0 -> "afternode0" [label="my", style="dotted", penwidth=3.0, arrowtype="normal", color="red"]; - "afterstack":1 -> "afternode0" [label="shleased", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; + "afterstack":1 -> "afternode0" [label="Shared", style="solid", penwidth=1.0, arrowtype="empty", color="blue"]; } subgraph cluster_before { label=<before> From 3bfd1bf72b3e1822afa9d8d625ced647f8bd0d25 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 18 Jul 2022 07:18:37 +0300 Subject: [PATCH 24/36] delete dead code: reservations I didn't realize but there's all this machinery --- components/dada-brew/src/brew.rs | 8 -- components/dada-execute/src/heap_graph.rs | 12 +- .../dada-execute/src/heap_graph/capture.rs | 49 +------ .../dada-execute/src/heap_graph/graphviz.rs | 28 ++-- components/dada-execute/src/machine.rs | 118 ---------------- .../src/machine/assert_invariants.rs | 132 +----------------- components/dada-execute/src/machine/op.rs | 61 +------- .../dada-execute/src/machine/stringify.rs | 1 - components/dada-execute/src/step.rs | 3 - components/dada-execute/src/step/access.rs | 3 +- components/dada-execute/src/step/gc.rs | 26 +--- components/dada-execute/src/step/give.rs | 1 - components/dada-execute/src/step/lease.rs | 1 - components/dada-execute/src/step/reserve.rs | 72 ---------- components/dada-execute/src/step/revoke.rs | 27 +--- components/dada-execute/src/step/share.rs | 1 - components/dada-execute/src/step/shlease.rs | 1 - components/dada-execute/src/step/tenant.rs | 1 - components/dada-execute/src/step/traversal.rs | 45 +----- components/dada-ir/src/code/bir.rs | 6 - components/dada-ir/src/code/validated.rs | 4 - 21 files changed, 26 insertions(+), 574 deletions(-) delete mode 100644 components/dada-execute/src/step/reserve.rs diff --git a/components/dada-brew/src/brew.rs b/components/dada-brew/src/brew.rs index 7c75a2fd..6cdd4208 100644 --- a/components/dada-brew/src/brew.rs +++ b/components/dada-brew/src/brew.rs @@ -141,7 +141,6 @@ impl Cursor { | validated::ExprData::FloatLiteral(_) | validated::ExprData::StringLiteral(_) | validated::ExprData::Call(_, _) - | validated::ExprData::Reserve(_) | validated::ExprData::Share(_) | validated::ExprData::Lease(_) | validated::ExprData::Shlease(_) @@ -258,13 +257,6 @@ impl Cursor { } } - validated::ExprData::Reserve(place) => { - let (place, origins) = self.brew_place(brewery, *place); - self.push_breakpoint_starts(brewery, origins.iter().copied(), origin); - self.push_assignment(brewery, target, bir::ExprData::Reserve(place), origin); - self.push_breakpoint_ends(brewery, Some(target), origins, origin); - } - validated::ExprData::Lease(place) => { let (place, origins) = self.brew_place(brewery, *place); self.push_breakpoint_starts(brewery, origins.iter().copied(), origin); diff --git a/components/dada-execute/src/heap_graph.rs b/components/dada-execute/src/heap_graph.rs index e5ec6352..8089bd83 100644 --- a/components/dada-execute/src/heap_graph.rs +++ b/components/dada-execute/src/heap_graph.rs @@ -10,7 +10,7 @@ use dada_ir::{ class::Class, code::bir::LocalVariable, function::Function, span::FileSpan, word::Word, }; -use crate::machine::{op::MachineOp, Machine, Object, Permission, Reservation, Value}; +use crate::machine::{op::MachineOp, Machine, Object, Permission, Value}; mod capture; mod graphviz; @@ -120,7 +120,7 @@ id!(pub(crate) struct PermissionNode); #[derive(Debug)] pub(crate) struct PermissionNodeData { - source: PermissionNodeSource, + source: Permission, label: PermissionNodeLabel, @@ -132,19 +132,12 @@ pub(crate) struct PermissionNodeData { lessor: Option, } -#[derive(Debug)] -pub(crate) enum PermissionNodeSource { - Permission(Permission), - Reservation(Reservation), -} - #[derive(Copy, Clone, Debug)] pub(crate) enum PermissionNodeLabel { My, Our, Leased, Shared, - Reserved, Expired, } @@ -155,7 +148,6 @@ impl PermissionNodeLabel { PermissionNodeLabel::Our => "our", PermissionNodeLabel::Leased => "leased", PermissionNodeLabel::Shared => "Shared", - PermissionNodeLabel::Reserved => "reserved", PermissionNodeLabel::Expired => "expired", } } diff --git a/components/dada-execute/src/heap_graph/capture.rs b/components/dada-execute/src/heap_graph/capture.rs index 870af766..500b5947 100644 --- a/components/dada-execute/src/heap_graph/capture.rs +++ b/components/dada-execute/src/heap_graph/capture.rs @@ -5,14 +5,14 @@ use dada_id::InternKey; use dada_ir::storage::{Joint, Leased}; use crate::machine::{ - op::MachineOp, op::MachineOpExt, stringify::DefaultStringify, Frame, Object, ObjectData, - Permission, PermissionData, Reservation, Value, + op::MachineOp, stringify::DefaultStringify, Frame, Object, ObjectData, Permission, + PermissionData, Value, }; use super::{ DataNodeData, HeapGraph, LocalVariableEdge, ObjectNode, ObjectNodeData, ObjectType, - PermissionNode, PermissionNodeData, PermissionNodeLabel, PermissionNodeSource, - StackFrameNodeData, ValueEdge, ValueEdgeData, ValueEdgeTarget, + PermissionNode, PermissionNodeData, PermissionNodeLabel, StackFrameNodeData, ValueEdge, + ValueEdgeData, ValueEdgeTarget, }; pub(super) struct HeapGraphCapture<'me> { @@ -21,7 +21,6 @@ pub(super) struct HeapGraphCapture<'me> { machine: &'me dyn MachineOp, instances: Map, permissions: Map, - reservations: Map, } impl<'me> HeapGraphCapture<'me> { @@ -36,7 +35,6 @@ impl<'me> HeapGraphCapture<'me> { machine, instances: Default::default(), permissions: Default::default(), - reservations: Default::default(), } } @@ -112,9 +110,6 @@ impl<'me> HeapGraphCapture<'me> { &thunk.arguments, )), ObjectData::Tuple(_tuple) => self.data_target(db, object, &""), // FIXME - ObjectData::Reservation(reservation) => { - ValueEdgeTarget::Object(self.reservation_node(object, *reservation)) - } ObjectData::Class(c) => ValueEdgeTarget::Class(*c), ObjectData::Function(f) => ValueEdgeTarget::Function(*f), ObjectData::Intrinsic(_) @@ -163,7 +158,7 @@ impl<'me> HeapGraphCapture<'me> { }; let node = self.graph.tables.add(PermissionNodeData { - source: PermissionNodeSource::Permission(permission), + source: permission, label, lessor: None, tenants: vec![], @@ -210,38 +205,4 @@ impl<'me> HeapGraphCapture<'me> { node } - - fn reservation_node(&mut self, object: Object, reservation: Reservation) -> ObjectNode { - // Detect cycles and prevent redundant work. - if let Some(n) = self.reservations.get(&reservation) { - return *n; - } - - let node = self.graph.tables.add(ObjectNodeData { - object, - ty: ObjectType::Reservation, - fields: Default::default(), - }); - - self.reservations.insert(reservation, node); - - let mut fields = vec![]; - match self.machine.peek_reservation(self.db, reservation) { - Ok(object) => { - let permission = self.graph.tables.add(PermissionNodeData { - source: PermissionNodeSource::Reservation(reservation), - label: PermissionNodeLabel::Reserved, - tenants: vec![], - lessor: None, - }); - let target = self.value_edge_target(object); - fields.push(self.graph.tables.add(ValueEdgeData { permission, target })); - } - - Err(_err) => { /* should not happen, just ignore I guess */ } - } - self.graph.tables[node].fields = fields; - - node - } } diff --git a/components/dada-execute/src/heap_graph/graphviz.rs b/components/dada-execute/src/heap_graph/graphviz.rs index f7d91f3f..0c626b9d 100644 --- a/components/dada-execute/src/heap_graph/graphviz.rs +++ b/components/dada-execute/src/heap_graph/graphviz.rs @@ -3,8 +3,8 @@ use dada_id::InternKey; use dada_parse::prelude::*; use super::{ - DataNode, HeapGraph, ObjectType, PermissionNode, PermissionNodeLabel, PermissionNodeSource, - ValueEdge, ValueEdgeData, ValueEdgeTarget, + DataNode, HeapGraph, ObjectType, PermissionNode, PermissionNodeLabel, ValueEdge, ValueEdgeData, + ValueEdgeTarget, }; const UNCHANGED: &str = "slategray"; @@ -148,7 +148,6 @@ impl HeapGraph { let (penwidth, arrowtype) = match permission_data.label { PermissionNodeLabel::My | PermissionNodeLabel::Our => ("3.0", "normal"), - PermissionNodeLabel::Reserved => ("1.0", "odot"), PermissionNodeLabel::Expired | PermissionNodeLabel::Leased | PermissionNodeLabel::Shared => ("1.0", "empty"), @@ -157,7 +156,6 @@ impl HeapGraph { let color = match permission_data.label { PermissionNodeLabel::My | PermissionNodeLabel::Leased => "red", PermissionNodeLabel::Shared | PermissionNodeLabel::Our => "blue", - PermissionNodeLabel::Reserved => "grey", PermissionNodeLabel::Expired => "grey", }; @@ -456,22 +454,12 @@ impl HeapGraph { return true; }; - match permission.data(&self.tables).source { - PermissionNodeSource::Permission(machine_permission) => { - Some(&self.machine[machine_permission]) - != diff_against - .machine - .heap - .permission_data(machine_permission) - } - PermissionNodeSource::Reservation(machine_reservation) => { - Some(&self.machine[machine_reservation]) - != diff_against - .machine - .heap - .reservation_data(machine_reservation) - } - } + let machine_permission = permission.data(&self.tables).source; + Some(&self.machine[machine_permission]) + != diff_against + .machine + .heap + .permission_data(machine_permission) } } diff --git a/components/dada-execute/src/machine.rs b/components/dada-execute/src/machine.rs index 3d740d8f..b811fd91 100644 --- a/components/dada-execute/src/machine.rs +++ b/components/dada-execute/src/machine.rs @@ -58,7 +58,6 @@ pub struct Value { pub struct Heap { pub objects: Arena, pub permissions: Arena, - pub reservations: Arena, } impl Heap { @@ -117,34 +116,6 @@ impl Heap { pub(crate) fn permission_data(&self, permission: Permission) -> Option<&PermissionData> { self.permissions.get(permission.index) } - - fn new_reservation(&mut self, data: ReservationData) -> Reservation { - let p = Reservation { - index: self.reservations.insert(data), - }; - - tracing::debug!( - "new reservation: {:?} = {:?}", - p, - &self.reservations[p.index] - ); - - p - } - - pub(crate) fn reservation_data(&self, reservation: Reservation) -> Option<&ReservationData> { - self.reservations.get(reservation.index) - } - - fn all_reservations(&self) -> Vec { - let mut vec: Vec<_> = self - .reservations - .iter() - .map(|(index, _)| Reservation { index }) - .collect(); - vec.sort(); - vec - } } /// An "object" is a piece of data in the heap. @@ -174,11 +145,6 @@ pub enum ObjectData { /// An instance of a class. Instance(Instance), - /// A temporary hold that is placed on a place during evaluation, - /// preventing the user from overwriting it. USed for "two-phase borrow"-like - /// patterns, in Rust terms. - Reservation(Reservation), - /// A reference to a class itself. Class(Class), @@ -226,7 +192,6 @@ impl ObjectData { pub fn kind_str(&self, db: &dyn crate::Db) -> String { match self { ObjectData::Instance(i) => format!("an instance of `{}`", i.class.name(db).as_str(db)), - ObjectData::Reservation(_) => "a reservation".to_string(), ObjectData::Class(_) => "a class".to_string(), ObjectData::Function(_) => "a function".to_string(), ObjectData::Intrinsic(_) => "a function".to_string(), @@ -260,7 +225,6 @@ macro_rules! object_data_from_impls { object_data_from_impls! { Instance(Instance), - Reservation(Reservation), Class(Class), Function(Function), Intrinsic(Intrinsic), @@ -296,50 +260,6 @@ pub struct Tuple { pub fields: Vec, } -/// A *reservation* is issued for a place when -/// we evaluate the place before we actually consume it and -/// we wish to ensure that the place is not invalidated in the -/// meantime; it is also used when we do not yet know how the -/// place will be used. -/// -/// Example: -/// -/// ```notrust -/// foo(a.b.c, ...) -/// ``` -/// -/// Here, we have not yet figured out what fn is being -/// called, and so we don't know if `a.b.c` is being shared -/// or leased or what. -#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] -pub struct Reservation { - index: generational_arena::Index, -} - -impl std::fmt::Debug for Reservation { - fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { - let (a, b) = self.index.into_raw_parts(); - fmt.debug_tuple("Reservation").field(&a).field(&b).finish() - } -} - -#[derive(Clone, Debug, PartialEq, Eq)] -pub struct ReservationData { - /// PC when the reservation was placed. - pub pc: ProgramCounter, - - /// The active frame when reservation was created. - /// Because reservations are used only in particular - /// ways, we only expect the reservation to be activated - /// when this frame is the top-most frame, but we need - /// to store the frame for use when creating heap graphs - /// etc. - pub frame_index: FrameIndex, - - /// The place which was reserved - pub place: bir::Place, -} - #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct Permission { index: generational_arena::Index, @@ -424,42 +344,6 @@ pub struct ValidPermissionData { /// located in a leased location. pub leased: Leased, - /// A *reservation* is placed on a permission when the - /// permission (and its associated value) will be traversed - /// or accessed by some pending operation (typically a function - /// that has yet to be called). The reservation makes - /// it an error to revoke the permission. Reservations are removed - /// when the pending operation occurs. - /// - /// # Example: function calls - /// - /// ```notrust - /// foo(a.b.c, ...) - /// ``` - /// - /// When calling `foo`, we would place a *reservation* on the - /// place `a.b.c` before we go off and evaluate `...`. This allows - /// `...` to access `a.b.c` but ensures that `...` cannot revoke - /// `a.b.c`. - /// - /// # Example: tuples - /// - /// ```notrust - /// (a.b.c, ...) - /// ``` - /// - /// As with function calls, we reserve `a.b.c` while evaluating `...`. - /// - /// # Example: assignments - /// - /// ```notrust - /// a.b.c = ... - /// ``` - /// - /// When performing this assignment, we would reserve `a.b` while - /// evaluating `...`, thus ensuring that `...` cannot revoke `a.b`. - pub reservations: Vec, - /// A *tenant* is another permission that we have given /// a lease (or sublease, if we ourselves are leased) to /// access `o`. This could be a shared @@ -474,7 +358,6 @@ impl ValidPermissionData { ValidPermissionData { joint: Joint::No, leased: Leased::No, - reservations: vec![], tenants: vec![], } } @@ -484,7 +367,6 @@ impl ValidPermissionData { ValidPermissionData { joint: Joint::Yes, leased: Leased::No, - reservations: vec![], tenants: vec![], } } diff --git a/components/dada-execute/src/machine/assert_invariants.rs b/components/dada-execute/src/machine/assert_invariants.rs index 280dbded..d7542fa8 100644 --- a/components/dada-execute/src/machine/assert_invariants.rs +++ b/components/dada-execute/src/machine/assert_invariants.rs @@ -1,23 +1,9 @@ use dada_collections::Map; -use dada_ir::{ - code::bir, - in_ir_db::InIrDbExt, - storage::{Joint, Leased}, -}; -use salsa::DebugWithDb; - -use crate::{ - ext::DadaExecuteClassExt, - machine::{ - op::MachineOp, Frame, Object, ObjectData, Permission, PermissionData, Reservation, Value, - }, -}; - -use super::ReservationData; +use dada_ir::storage::{Joint, Leased}; -pub(super) struct AssertInvariants<'me> { - db: &'me dyn crate::Db, +use crate::machine::{op::MachineOp, Frame, Object, ObjectData, Permission, PermissionData, Value}; +pub(super) struct AssertInvariants<'me> { machine: &'me dyn MachineOp, /// Every permission ought to be associated with "at most one" object. @@ -25,9 +11,8 @@ pub(super) struct AssertInvariants<'me> { } impl<'me> AssertInvariants<'me> { - pub(super) fn new(db: &'me dyn crate::Db, machine: &'me dyn MachineOp) -> Self { + pub(super) fn new(_db: &'me dyn crate::Db, machine: &'me dyn MachineOp) -> Self { Self { - db, machine, permission_map: Default::default(), } @@ -65,10 +50,6 @@ impl<'me> AssertInvariants<'me> { ObjectData::ThunkRust(f) => self.assert_values_ok(&f.arguments)?, ObjectData::Tuple(t) => self.assert_values_ok(&t.fields)?, - ObjectData::Reservation(r) => { - let _object = self.assert_reservation_ok(*r)?; - } - ObjectData::Class(_) | ObjectData::Function(_) | ObjectData::Intrinsic(_) @@ -89,111 +70,6 @@ impl<'me> AssertInvariants<'me> { Ok(()) } - /// Asserts that the reservation is ok and returns the reserved object. - pub(super) fn assert_reservation_ok( - &mut self, - reservation: Reservation, - ) -> eyre::Result { - let ReservationData { - pc: _, - frame_index, - place, - } = self.machine[reservation]; - self.assert_reserved_place(reservation, &self.machine[frame_index], place) - } - - /// Assert that the place `place` found in a reservation `reservation` - /// is in fact reserved. We expect to find `reservation` in each permission - /// and we expect this to be a unique place. - fn assert_reserved_place( - &mut self, - reservation: Reservation, - frame: &Frame, - place: bir::Place, - ) -> eyre::Result { - let bir = frame.pc.bir; - let table = &bir.data(self.db).tables; - match &table[place] { - bir::PlaceData::Class(_) - | bir::PlaceData::Function(_) - | bir::PlaceData::Intrinsic(_) => { - eyre::bail!( - "reserved place `{:?}` bottoms out in a constant `{:?}`", - reservation, - table[place], - ); - } - - bir::PlaceData::LocalVariable(lv) => { - let value = frame.locals[*lv]; - self.assert_reserved_value(reservation, value) - } - - bir::PlaceData::Dot(owner, field) => { - let object = self.assert_reserved_place(reservation, frame, *owner)?; - match &self.machine[object] { - ObjectData::Instance(instance) => { - let Some(index) = instance.class.field_index(self.db, *field) else { - eyre::bail!( - "reservation `{:?}` references place `{:?}` with invalid field `{:?}` for object `{:?}`", - reservation, - place.debug(&bir.in_ir_db(self.db)), - field.debug(self.db), - instance, - ); - }; - let value = instance.fields[index]; - self.assert_reserved_value(reservation, value) - } - - data => { - eyre::bail!( - "reservation `{:?}` reserved object with unexpected data `{:?}` at place `{:?}`", - reservation, - data, - place.debug(&bir.in_ir_db(self.db)), - ); - } - } - } - } - } - - fn assert_reserved_value( - &mut self, - reservation: Reservation, - value: Value, - ) -> eyre::Result { - let Value { object, permission } = value; - - let Some(valid) = self.machine[permission].valid() else { - eyre::bail!( - "reservation `{:?}` references expired permission `{:?}`", - reservation, - permission, - ); - }; - - if let Joint::Yes = valid.joint { - eyre::bail!( - "reservation `{:?}` references joint permission `{:?}`", - reservation, - permission, - ); - } - - if !valid.reservations.contains(&reservation) { - eyre::bail!( - "reservation `{:?}` not found in reservation list `{:?}` for permission `{:?}`", - reservation, - valid.reservations, - permission, - ); - } - - Ok(object) - } - fn assert_values_ok(&mut self, values: &[Value]) -> eyre::Result<()> { for v in values { self.assert_value_ok(v)?; diff --git a/components/dada-execute/src/machine/op.rs b/components/dada-execute/src/machine/op.rs index 8dfd3ef2..717390f3 100644 --- a/components/dada-execute/src/machine/op.rs +++ b/components/dada-execute/src/machine/op.rs @@ -5,14 +5,12 @@ use dada_ir::code::bir; use super::{ assert_invariants::AssertInvariants, Frame, FrameIndex, Machine, Object, ObjectData, - Permission, PermissionData, ProgramCounter, Reservation, ReservationData, ValidPermissionData, - Value, + Permission, PermissionData, ProgramCounter, ValidPermissionData, Value, }; pub(crate) trait MachineOp: std::ops::IndexMut + std::ops::IndexMut - + std::ops::IndexMut + std::ops::IndexMut + std::ops::Index + Debug @@ -41,12 +39,6 @@ pub(crate) trait MachineOp: fn expired_permission(&mut self, origin: Option) -> Permission; fn all_permissions(&self) -> Vec; - fn reservation(&self, reservation: Reservation) -> &ReservationData; - fn reservation_mut(&mut self, reservation: Reservation) -> &mut ReservationData; - fn new_reservation(&mut self, data: ReservationData) -> Reservation; - fn all_reservations(&self) -> Vec; - fn take_reservation(&mut self, reservation: Reservation) -> ReservationData; - // Access locals from the top-most stack frame (panics if stack is empty). fn local(&self, local_variable: bir::LocalVariable) -> &Value; fn local_mut(&mut self, local_variable: bir::LocalVariable) -> &mut Value; @@ -209,32 +201,6 @@ impl MachineOp for Machine { self.heap.new_permission(PermissionData::Expired(place)) } - #[track_caller] - fn reservation(&self, reservation: Reservation) -> &ReservationData { - self.heap.reservations.get(reservation.index).unwrap() - } - - #[track_caller] - fn reservation_mut(&mut self, reservation: Reservation) -> &mut ReservationData { - self.heap.reservations.get_mut(reservation.index).unwrap() - } - - fn new_reservation(&mut self, data: ReservationData) -> Reservation { - self.heap.new_reservation(data) - } - - #[track_caller] - fn take_reservation(&mut self, reservation: Reservation) -> ReservationData { - self.heap - .reservations - .remove(reservation.index) - .unwrap_or_else(|| panic!("reservation not found: {reservation:?}")) - } - - fn all_reservations(&self) -> Vec { - self.heap.all_reservations() - } - fn local(&self, local_variable: bir::LocalVariable) -> &Value { &self.stack.frames.last().unwrap().locals[local_variable] } @@ -296,20 +262,6 @@ impl std::ops::IndexMut for Machine { } } -impl std::ops::Index for Machine { - type Output = ReservationData; - - fn index(&self, index: Reservation) -> &Self::Output { - self.reservation(index) - } -} - -impl std::ops::IndexMut for Machine { - fn index_mut(&mut self, index: Reservation) -> &mut Self::Output { - self.reservation_mut(index) - } -} - impl std::ops::Index for Machine { type Output = Value; @@ -344,15 +296,4 @@ pub(crate) impl MachineOpExt for &dyn MachineOp { fn assert_invariants(self, db: &dyn crate::Db) -> eyre::Result<()> { AssertInvariants::new(db, self).assert_all_ok() } - - /// Given a reservation, peeks to find the reserved object; - /// returns Err if the machine invariants on the reservation are not meant - /// (indicates a bug in Dada somewhere). - fn peek_reservation( - self, - db: &dyn crate::Db, - reservation: Reservation, - ) -> eyre::Result { - AssertInvariants::new(db, self).assert_reservation_ok(reservation) - } } diff --git a/components/dada-execute/src/machine/stringify.rs b/components/dada-execute/src/machine/stringify.rs index 356e82e4..07e8fe40 100644 --- a/components/dada-execute/src/machine/stringify.rs +++ b/components/dada-execute/src/machine/stringify.rs @@ -43,7 +43,6 @@ pub(crate) impl DefaultStringify for T { ObjectData::Class(c) => c.name(db).as_str(db).to_string(), ObjectData::ThunkRust(r) => format!("{r:?}"), ObjectData::Tuple(t) => self.object_string(db, None, &t.fields), - ObjectData::Reservation(r) => format!("{r:?}"), // can prob do better than this :) } } diff --git a/components/dada-execute/src/step.rs b/components/dada-execute/src/step.rs index 605fbe5f..550be181 100644 --- a/components/dada-execute/src/step.rs +++ b/components/dada-execute/src/step.rs @@ -37,7 +37,6 @@ mod gc; mod give; mod intrinsic; mod lease; -mod reserve; mod revoke; mod share; mod shlease; @@ -238,7 +237,6 @@ impl<'me> Stepper<'me> { } bir::TargetPlaceData::Dot(owner, name) => { let owner_traversal = self.traverse_to_object(table, *owner)?; - let owner_traversal = self.confirm_reservation_if_any(table, owner_traversal)?; self.traverse_to_object_field(target_place, owner_traversal, *name) } } @@ -449,7 +447,6 @@ impl<'me> Stepper<'me> { object: self.machine.new_object(ObjectData::Unit(())), permission: self.machine.new_permission(ValidPermissionData::our()), }), - bir::ExprData::Reserve(place) => self.reserve_place(table, *place), bir::ExprData::Share(place) => self.share_place(table, *place), bir::ExprData::Lease(place) => self.lease_place(table, *place), bir::ExprData::Shlease(place) => self.shlease_place(table, *place), diff --git a/components/dada-execute/src/step/access.rs b/components/dada-execute/src/step/access.rs index bcfadd56..bc1b25cb 100644 --- a/components/dada-execute/src/step/access.rs +++ b/components/dada-execute/src/step/access.rs @@ -256,8 +256,7 @@ impl Stepper<'_> { self.push_reachable_via_fields(&v.fields, &mut reachable, &mut queue); } - ObjectData::Reservation(_) - | ObjectData::Bool(_) + ObjectData::Bool(_) | ObjectData::Class(_) | ObjectData::Float(_) | ObjectData::Function(_) diff --git a/components/dada-execute/src/step/gc.rs b/components/dada-execute/src/step/gc.rs index 95ad9df2..48c7990e 100644 --- a/components/dada-execute/src/step/gc.rs +++ b/components/dada-execute/src/step/gc.rs @@ -7,9 +7,7 @@ use dada_collections::Set; use dada_ir::storage::Leased; -use crate::machine::{ - op::MachineOp, Object, ObjectData, Permission, PermissionData, Reservation, Value, -}; +use crate::machine::{op::MachineOp, Object, ObjectData, Permission, PermissionData, Value}; use super::Stepper; @@ -56,9 +54,6 @@ struct Marks { /// This function creates an Object and returns a leased copy, /// In the callee, the leased value will be live, but not the owner. live_permissions: Set, - - /// Reservations reachable from live things - live_reservations: Set, } struct Marker<'me> { @@ -131,8 +126,6 @@ impl<'me> Marker<'me> { ObjectData::ThunkRust(f) => self.mark_values(&f.arguments), ObjectData::Tuple(t) => self.mark_values(&t.fields), - ObjectData::Reservation(r) => self.mark_reservation(*r), - ObjectData::Class(_) | ObjectData::Function(_) | ObjectData::Intrinsic(_) @@ -148,11 +141,6 @@ impl<'me> Marker<'me> { } } - #[tracing::instrument(level = "Debug", skip(self))] - fn mark_reservation(&mut self, reservation: Reservation) { - self.marks.live_reservations.insert(reservation); - } - #[tracing::instrument(level = "Debug", skip(self))] fn mark_permission(&mut self, permission: Permission) { if !self.marks.live_permissions.insert(permission) { @@ -165,10 +153,6 @@ impl<'me> Marker<'me> { return; }; - for reservation in &valid.reservations { - self.mark_reservation(*reservation); - } - for tenant in &valid.tenants { self.mark_permission(*tenant); } @@ -211,14 +195,6 @@ impl Stepper<'_> { tracing::debug!("freeing {:?}: {:?}", o, data); } - let mut dead_reservations = self.machine.all_reservations(); - dead_reservations.retain(|r| !marks.live_reservations.contains(r)); - - for &r in &dead_reservations { - let data = self.machine.take_reservation(r); - tracing::debug!("freeing {:?}: {:?}", r, data); - } - Ok(()) } } diff --git a/components/dada-execute/src/step/give.rs b/components/dada-execute/src/step/give.rs index dcda28a0..ef1fabca 100644 --- a/components/dada-execute/src/step/give.rs +++ b/components/dada-execute/src/step/give.rs @@ -27,7 +27,6 @@ impl Stepper<'_> { place: bir::Place, ) -> eyre::Result { let object_traversal = self.traverse_to_object(table, place)?; - let object_traversal = self.confirm_reservation_if_any(table, object_traversal)?; self.give_traversal(table, object_traversal) } diff --git a/components/dada-execute/src/step/lease.rs b/components/dada-execute/src/step/lease.rs index 8eb99608..82247a82 100644 --- a/components/dada-execute/src/step/lease.rs +++ b/components/dada-execute/src/step/lease.rs @@ -36,7 +36,6 @@ impl Stepper<'_> { place: bir::Place, ) -> eyre::Result { let object_traversal = self.traverse_to_object(table, place)?; - let object_traversal = self.confirm_reservation_if_any(table, object_traversal)?; self.lease_traversal(object_traversal) } diff --git a/components/dada-execute/src/step/reserve.rs b/components/dada-execute/src/step/reserve.rs deleted file mode 100644 index 54c74241..00000000 --- a/components/dada-execute/src/step/reserve.rs +++ /dev/null @@ -1,72 +0,0 @@ -use dada_ir::{code::bir, storage::Joint}; - -use crate::machine::{ - op::MachineOpExtMut, ObjectData, Permission, PermissionData, Reservation, ReservationData, - Value, -}; - -use super::Stepper; - -impl Stepper<'_> { - /// The `reserve` operation - #[tracing::instrument(level = "Debug", skip(self, table))] - pub(super) fn reserve_place( - &mut self, - table: &bir::Tables, - place: bir::Place, - ) -> eyre::Result { - let object_traversal = self.traverse_to_object(table, place)?; - - tracing::debug!(?object_traversal, "object_traversal"); - - // If the object is jointly accessible, then we can just share it and hold - // on to that. - if let Joint::Yes = object_traversal.accumulated_permissions.joint { - return self.share_traversal(object_traversal); - } - - // Otherwise, we have to reserve the place. - - let frame_index = self.machine.top_frame_index().unwrap(); - - let reservation = self.machine.new_reservation(ReservationData { - pc: self.machine.pc(), - frame_index, - place, - }); - - for &permission in &object_traversal.accumulated_permissions.traversed { - tracing::debug!("adding reservation {:?} to {:?}", reservation, permission); - - let PermissionData::Valid(valid) = &mut self.machine[permission] else { - panic!("traversed expired permision `{permission:?}`"); - }; - - valid.reservations.push(reservation); - } - - Ok(self.machine.my_value(ObjectData::Reservation(reservation))) - } - - /// Removes the given reservation from the given permisions. - /// Panics if those permissions are not reserved with this reservation. - #[tracing::instrument(level = "Debug", skip(self))] - pub(super) fn remove_reservations( - &mut self, - reservation: Reservation, - traversed: &[Permission], - ) -> eyre::Result<()> { - for &permission in traversed { - let PermissionData::Valid(valid) = &mut self.machine[permission] else { - panic!("traversed expired permision `{permission:?}`"); - }; - - let Some(index) = valid.reservations.iter().position(|r| *r == reservation) else { - panic!("reservation not found") - }; - - valid.reservations.remove(index); - } - Ok(()) - } -} diff --git a/components/dada-execute/src/step/revoke.rs b/components/dada-execute/src/step/revoke.rs index 4d171978..3266e15f 100644 --- a/components/dada-execute/src/step/revoke.rs +++ b/components/dada-execute/src/step/revoke.rs @@ -1,9 +1,6 @@ -use dada_ir::{error, storage::Joint}; +use dada_ir::storage::Joint; -use crate::{ - error::DiagnosticBuilderExt, - machine::{Permission, PermissionData, ValidPermissionData}, -}; +use crate::machine::{Permission, PermissionData, ValidPermissionData}; use super::Stepper; @@ -14,25 +11,7 @@ impl Stepper<'_> { let pc = self.machine.opt_pc(); let p = std::mem::replace(&mut self.machine[permission], PermissionData::Expired(pc)); - if let PermissionData::Valid(ValidPermissionData { - tenants, - reservations, - .. - }) = p - { - if let Some(reservation) = reservations.into_iter().next() { - let data = &self.machine[reservation]; - let error_pc = pc.unwrap_or(data.pc); - let error_span = error_pc.span(self.db); - return Err(error!( - error_span, - "you can't overwrite this value, it is reserved right now" - ) - .primary_label("attempting to invalidate reservation here") - .secondary_label(data.pc.span(self.db), "reservation was placed here") - .eyre(self.db)); - } - + if let PermissionData::Valid(ValidPermissionData { tenants, .. }) = p { for tenant in tenants { self.revoke(tenant)?; } diff --git a/components/dada-execute/src/step/share.rs b/components/dada-execute/src/step/share.rs index 4640bd81..d4694bbf 100644 --- a/components/dada-execute/src/step/share.rs +++ b/components/dada-execute/src/step/share.rs @@ -39,7 +39,6 @@ impl Stepper<'_> { place: bir::Place, ) -> eyre::Result { let object_traversal = self.traverse_to_object(table, place)?; - let object_traversal = self.confirm_reservation_if_any(table, object_traversal)?; self.share_traversal(object_traversal) } diff --git a/components/dada-execute/src/step/shlease.rs b/components/dada-execute/src/step/shlease.rs index 72fdf47f..4312aa19 100644 --- a/components/dada-execute/src/step/shlease.rs +++ b/components/dada-execute/src/step/shlease.rs @@ -34,7 +34,6 @@ impl Stepper<'_> { place: bir::Place, ) -> eyre::Result { let object_traversal = self.traverse_to_object(table, place)?; - let object_traversal = self.confirm_reservation_if_any(table, object_traversal)?; self.shlease_traversal(object_traversal) } diff --git a/components/dada-execute/src/step/tenant.rs b/components/dada-execute/src/step/tenant.rs index 77268c62..20d66073 100644 --- a/components/dada-execute/src/step/tenant.rs +++ b/components/dada-execute/src/step/tenant.rs @@ -10,7 +10,6 @@ impl Stepper<'_> { let permission = self.machine.new_permission(ValidPermissionData { joint, leased: Leased::Yes, - reservations: vec![], tenants: vec![], }); diff --git a/components/dada-execute/src/step/traversal.rs b/components/dada-execute/src/step/traversal.rs index 55b1d925..144f7035 100644 --- a/components/dada-execute/src/step/traversal.rs +++ b/components/dada-execute/src/step/traversal.rs @@ -17,8 +17,7 @@ use crate::{ error::DiagnosticBuilderExt, ext::DadaExecuteClassExt, machine::{ - op::MachineOpExtMut, Object, ObjectData, Permission, PermissionData, ProgramCounter, - ReservationData, Value, + op::MachineOpExtMut, Object, ObjectData, Permission, PermissionData, ProgramCounter, Value, }, }; @@ -216,48 +215,6 @@ impl Stepper<'_> { }) } - /// If `traversal` reaches a reservation, then "confirm" the reservation by - /// traversing to the place that was reversal, removing the reservation from - /// each permission along the way, and returning that traversal. - /// - /// Otherwise return `traversal` unchanged. - #[tracing::instrument(level = "Debug", skip(self, table))] - pub(super) fn confirm_reservation_if_any( - &mut self, - table: &bir::Tables, - traversal: ObjectTraversal, - ) -> eyre::Result { - let ObjectData::Reservation(_) = self.machine[traversal.object] else { - return Ok(traversal); - }; - - let (Joint::No, Leased::No) = (traversal.accumulated_permissions.joint, traversal.accumulated_permissions.leased) else { - // our codegen doesn't ever share or lease a temporary containing a reservation - panic!("expected to find reservation in a `my` location"); - }; - - let object = self.take_object(traversal)?; - let ObjectData::Reservation(reservation) = self.machine[object] else { - panic!("object data changed from a reservation"); - }; - let ReservationData { - pc: _, - frame_index, - place: reserved_place, - } = self.machine.take_reservation(reservation); - - assert_eq!( - frame_index, - self.machine.top_frame_index().unwrap(), - "reservation `{reservation:?}` escaped its frame" - ); - - // the reservation should ensure that this place is still valid - let retraversal = self.traverse_to_object(table, reserved_place).unwrap(); - self.remove_reservations(reservation, &retraversal.accumulated_permissions.traversed)?; - Ok(retraversal) - } - fn object_field( &mut self, place: impl HasOriginIn, diff --git a/components/dada-ir/src/code/bir.rs b/components/dada-ir/src/code/bir.rs index f32147a3..d0e1cc3d 100644 --- a/components/dada-ir/src/code/bir.rs +++ b/components/dada-ir/src/code/bir.rs @@ -418,11 +418,6 @@ pub enum ExprData { /// `"foo"` with no format strings StringLiteral(Word), - /// `expr.reserve` - /// - /// not (presently) actual syntax, emitted as part of lowering - Reserve(Place), - /// `expr.share` Share(Place), @@ -464,7 +459,6 @@ impl DebugWithDb> for ExprData { ExprData::SignedIntegerLiteral(w) => write!(f, "{}", w), ExprData::StringLiteral(w) => write!(f, "{:?}", w.as_str(db.db())), ExprData::FloatLiteral(w) => write!(f, "{}", w), - ExprData::Reserve(p) => write!(f, "{:?}.reserve", p.debug(db)), ExprData::Share(p) => write!(f, "{:?}.share", p.debug(db)), ExprData::Lease(p) => write!(f, "{:?}.lease", p.debug(db)), ExprData::Shlease(p) => write!(f, "{:?}.shlease", p.debug(db)), diff --git a/components/dada-ir/src/code/validated.rs b/components/dada-ir/src/code/validated.rs index e456a14c..1da4ab55 100644 --- a/components/dada-ir/src/code/validated.rs +++ b/components/dada-ir/src/code/validated.rs @@ -241,9 +241,6 @@ pub enum ExprData { /// `expr(id: expr, ...)` Call(Expr, Vec), - /// `expr.reserve` -- not legal syntax - Reserve(Place), - /// `.share` Share(Expr), @@ -328,7 +325,6 @@ impl ExprData { .field(&expr.debug(db)) .field(&args.debug(db)) .finish(), - ExprData::Reserve(p) => f.debug_tuple("Reserve").field(&p.debug(db)).finish(), ExprData::Share(p) => f.debug_tuple("Share").field(&p.debug(db)).finish(), ExprData::Lease(p) => f.debug_tuple("Lease").field(&p.debug(db)).finish(), ExprData::Shlease(p) => f.debug_tuple("Shlease").field(&p.debug(db)).finish(), From 209f58d8987ce48712059e4608f07ac3e590075d Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 18 Jul 2022 07:52:50 +0300 Subject: [PATCH 25/36] refactor: rename share to into-share --- components/dada-brew/src/brew.rs | 6 +++--- components/dada-execute/src/step.rs | 4 ++-- components/dada-execute/src/step/give.rs | 2 +- .../src/step/{share.rs => into_shared.rs} | 9 ++++++--- components/dada-ir/src/code/bir.rs | 14 +++++++------- components/dada-ir/src/code/validated.rs | 4 ++-- components/dada-validate/src/validate/validator.rs | 2 +- .../heap-graph/cursor-position/HeapGraph-0.bir.ref | 8 ++++---- .../heap-graph/cursor-position/HeapGraph-1.bir.ref | 8 ++++---- .../heap-graph/cursor-position/HeapGraph-2.bir.ref | 8 ++++---- .../heap-graph/cursor-position/HeapGraph-3.bir.ref | 8 ++++---- dada_tests/heap-graph/dag/HeapGraph-0.bir.ref | 8 ++++---- .../heap-graph/leased-point/HeapGraph-0.bir.ref | 4 ++-- .../heap-graph/line-start/HeapGraph-0.bir.ref | 6 +++--- .../heap-graph/line-start/HeapGraph-1.bir.ref | 6 +++--- .../heap-graph/mid-increment/HeapGraph-0.bir.ref | 6 +++--- .../nested-functions/HeapGraph-0.bir.ref | 14 +++++++------- .../heap-graph/nested-points/HeapGraph-0.bir.ref | 6 +++--- .../heap-graph/nested-points/HeapGraph-1.bir.ref | 6 +++--- .../heap-graph/nested-points/HeapGraph-2.bir.ref | 6 +++--- dada_tests/heap-graph/past-end/HeapGraph-0.bir.ref | 2 +- .../heap-graph/rust-thunk/HeapGraph-0.bir.ref | 2 +- .../heap-graph/tutorial-1/HeapGraph-0.bir.ref | 4 ++-- .../heap-graph/tutorial-1/HeapGraph-1.bir.ref | 4 ++-- .../heap-graph/tutorial-1/HeapGraph-2.bir.ref | 4 ++-- .../heap-graph/tutorial-1/HeapGraph-3.bir.ref | 4 ++-- .../heap-graph/tutorial-1/HeapGraph-4.bir.ref | 4 ++-- .../tutorial-give-10/HeapGraph-0.bir.ref | 6 +++--- .../tutorial-give-10/HeapGraph-1.bir.ref | 6 +++--- .../tutorial-lease-10/HeapGraph-0.bir.ref | 6 +++--- .../tutorial-lease-10/HeapGraph-1.bir.ref | 6 +++--- .../tutorial-lease-20/HeapGraph-0.bir.ref | 6 +++--- .../tutorial-lease-30/HeapGraph-0.bir.ref | 6 +++--- .../tutorial-share-10/HeapGraph-0.bir.ref | 10 +++++----- .../tutorial-share-20/HeapGraph-0.bir.ref | 8 ++++---- .../tutorial-share-30/HeapGraph-0.bir.ref | 4 ++-- 36 files changed, 110 insertions(+), 107 deletions(-) rename components/dada-execute/src/step/{share.rs => into_shared.rs} (97%) diff --git a/components/dada-brew/src/brew.rs b/components/dada-brew/src/brew.rs index 6cdd4208..c122107c 100644 --- a/components/dada-brew/src/brew.rs +++ b/components/dada-brew/src/brew.rs @@ -141,7 +141,7 @@ impl Cursor { | validated::ExprData::FloatLiteral(_) | validated::ExprData::StringLiteral(_) | validated::ExprData::Call(_, _) - | validated::ExprData::Share(_) + | validated::ExprData::IntoShared(_) | validated::ExprData::Lease(_) | validated::ExprData::Shlease(_) | validated::ExprData::Give(_) @@ -249,10 +249,10 @@ impl Cursor { ); } - validated::ExprData::Share(operand) => { + validated::ExprData::IntoShared(operand) => { if let Some(temp) = self.brew_expr_to_temporary(brewery, *operand) { self.push_breakpoint_start(brewery, origin); - self.push_assignment(brewery, target, bir::ExprData::Share(temp), origin); + self.push_assignment(brewery, target, bir::ExprData::IntoShared(temp), origin); self.push_breakpoint_end(brewery, Some(target), origin); } } diff --git a/components/dada-execute/src/step.rs b/components/dada-execute/src/step.rs index 550be181..5f481aaf 100644 --- a/components/dada-execute/src/step.rs +++ b/components/dada-execute/src/step.rs @@ -35,10 +35,10 @@ mod call; mod concatenate; mod gc; mod give; +mod into_shared; mod intrinsic; mod lease; mod revoke; -mod share; mod shlease; mod tenant; mod traversal; @@ -447,7 +447,7 @@ impl<'me> Stepper<'me> { object: self.machine.new_object(ObjectData::Unit(())), permission: self.machine.new_permission(ValidPermissionData::our()), }), - bir::ExprData::Share(place) => self.share_place(table, *place), + bir::ExprData::IntoShared(place) => self.into_shared_place(table, *place), bir::ExprData::Lease(place) => self.lease_place(table, *place), bir::ExprData::Shlease(place) => self.shlease_place(table, *place), bir::ExprData::Give(place) => self.give_place(table, *place), diff --git a/components/dada-execute/src/step/give.rs b/components/dada-execute/src/step/give.rs index ef1fabca..93bf84ac 100644 --- a/components/dada-execute/src/step/give.rs +++ b/components/dada-execute/src/step/give.rs @@ -50,7 +50,7 @@ impl Stepper<'_> { // * Sharing preserves the ownership properties, just like give // * Sharing always results in a shared permission, but since input is shared, this also preserves desired properties if let Joint::Yes = object_traversal.accumulated_permissions.joint { - return self.share_traversal(object_traversal); + return self.into_shared_traversal(object_traversal); } // Giving something that is leased is handled via leasing. diff --git a/components/dada-execute/src/step/share.rs b/components/dada-execute/src/step/into_shared.rs similarity index 97% rename from components/dada-execute/src/step/share.rs rename to components/dada-execute/src/step/into_shared.rs index d4694bbf..33e7599b 100644 --- a/components/dada-execute/src/step/share.rs +++ b/components/dada-execute/src/step/into_shared.rs @@ -33,17 +33,20 @@ impl Stepper<'_> { /// /// * Sharing a shared thing is effectively "cloning" it, in the Rust sense #[tracing::instrument(level = "Debug", skip(self, table))] - pub(super) fn share_place( + pub(super) fn into_shared_place( &mut self, table: &bir::Tables, place: bir::Place, ) -> eyre::Result { let object_traversal = self.traverse_to_object(table, place)?; - self.share_traversal(object_traversal) + self.into_shared_traversal(object_traversal) } #[tracing::instrument(level = "debug", skip(self))] - pub(super) fn share_traversal(&mut self, traversal: ObjectTraversal) -> eyre::Result { + pub(super) fn into_shared_traversal( + &mut self, + traversal: ObjectTraversal, + ) -> eyre::Result { // Sharing counts as a read of the data being shared. self.read(&traversal)?; diff --git a/components/dada-ir/src/code/bir.rs b/components/dada-ir/src/code/bir.rs index d0e1cc3d..127f618d 100644 --- a/components/dada-ir/src/code/bir.rs +++ b/components/dada-ir/src/code/bir.rs @@ -418,15 +418,15 @@ pub enum ExprData { /// `"foo"` with no format strings StringLiteral(Word), - /// `expr.share` - Share(Place), + /// `.share` + IntoShared(Place), + + /// `.share` + Shlease(Place), /// `expr.lease` Lease(Place), - /// `expr.shlease` - Shlease(Place), - /// `expr.give` Give(Place), @@ -459,9 +459,9 @@ impl DebugWithDb> for ExprData { ExprData::SignedIntegerLiteral(w) => write!(f, "{}", w), ExprData::StringLiteral(w) => write!(f, "{:?}", w.as_str(db.db())), ExprData::FloatLiteral(w) => write!(f, "{}", w), - ExprData::Share(p) => write!(f, "{:?}.share", p.debug(db)), + ExprData::IntoShared(e) => write!(f, "{:?}.share", e.debug(db)), + ExprData::Shlease(p) => write!(f, "{:?}.share", p.debug(db)), ExprData::Lease(p) => write!(f, "{:?}.lease", p.debug(db)), - ExprData::Shlease(p) => write!(f, "{:?}.shlease", p.debug(db)), ExprData::Give(p) => write!(f, "{:?}.give", p.debug(db)), ExprData::Unit => write!(f, "()"), ExprData::Tuple(vars) => write_parenthesized_places(f, vars, db), diff --git a/components/dada-ir/src/code/validated.rs b/components/dada-ir/src/code/validated.rs index 1da4ab55..1d44b619 100644 --- a/components/dada-ir/src/code/validated.rs +++ b/components/dada-ir/src/code/validated.rs @@ -242,7 +242,7 @@ pub enum ExprData { Call(Expr, Vec), /// `.share` - Share(Expr), + IntoShared(Expr), /// `.share` Shlease(Place), @@ -325,7 +325,7 @@ impl ExprData { .field(&expr.debug(db)) .field(&args.debug(db)) .finish(), - ExprData::Share(p) => f.debug_tuple("Share").field(&p.debug(db)).finish(), + ExprData::IntoShared(p) => f.debug_tuple("Share").field(&p.debug(db)).finish(), ExprData::Lease(p) => f.debug_tuple("Lease").field(&p.debug(db)).finish(), ExprData::Shlease(p) => f.debug_tuple("Shlease").field(&p.debug(db)).finish(), ExprData::Give(p) => f.debug_tuple("Give").field(&p.debug(db)).finish(), diff --git a/components/dada-validate/src/validate/validator.rs b/components/dada-validate/src/validate/validator.rs index 0f7ce404..d98b85b9 100644 --- a/components/dada-validate/src/validate/validator.rs +++ b/components/dada-validate/src/validate/validator.rs @@ -348,7 +348,7 @@ impl<'me> Validator<'me> { self.validate_permission_expr(expr, *target_expr, validated::ExprData::Shlease) } else { let validated_target_expr = self.validate_expr(*target_expr); - self.add(validated::ExprData::Share(validated_target_expr), expr) + self.add(validated::ExprData::IntoShared(validated_target_expr), expr) } } diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref index ad9468b1..d5e06f1d 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -95,14 +95,14 @@ ( AssignExpr( temp{8}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(6), ), ( AssignExpr( temp{9}, - p{0}.shlease, + p{0}.share, ), Expr(7), ), @@ -166,7 +166,7 @@ ( AssignExpr( temp{13}, - Print.shlease, + Print.share, ), Expr(12), ), diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref index 3deeef82..ceea6a57 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-1.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -77,14 +77,14 @@ ( AssignExpr( temp{8}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(6), ), ( AssignExpr( temp{9}, - p{0}.shlease, + p{0}.share, ), Expr(7), ), @@ -166,7 +166,7 @@ ( AssignExpr( temp{13}, - Print.shlease, + Print.share, ), Expr(12), ), diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref index 519e8208..f136832a 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-2.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -84,14 +84,14 @@ ( AssignExpr( temp{8}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(6), ), ( AssignExpr( temp{9}, - p{0}.shlease, + p{0}.share, ), Expr(7), ), @@ -166,7 +166,7 @@ ( AssignExpr( temp{13}, - Print.shlease, + Print.share, ), Expr(12), ), diff --git a/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref b/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref index 4a3c4876..6df4ba95 100644 --- a/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref +++ b/dada_tests/heap-graph/cursor-position/HeapGraph-3.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -77,14 +77,14 @@ ( AssignExpr( temp{8}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(6), ), ( AssignExpr( temp{9}, - p{0}.shlease, + p{0}.share, ), Expr(7), ), @@ -166,7 +166,7 @@ ( AssignExpr( temp{13}, - Print.shlease, + Print.share, ), Expr(12), ), diff --git a/dada_tests/heap-graph/dag/HeapGraph-0.bir.ref b/dada_tests/heap-graph/dag/HeapGraph-0.bir.ref index 6cc40402..188d5072 100644 --- a/dada_tests/heap-graph/dag/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/dag/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -84,21 +84,21 @@ ( AssignExpr( temp{7}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(6), ), ( AssignExpr( temp{8}, - p{0}.shlease, + p{0}.share, ), Expr(7), ), ( AssignExpr( temp{9}, - p{0}.shlease, + p{0}.share, ), Expr(8), ), diff --git a/dada_tests/heap-graph/leased-point/HeapGraph-0.bir.ref b/dada_tests/heap-graph/leased-point/HeapGraph-0.bir.ref index b6e9111d..dae8c196 100644 --- a/dada_tests/heap-graph/leased-point/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/leased-point/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -71,7 +71,7 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(5), ), diff --git a/dada_tests/heap-graph/line-start/HeapGraph-0.bir.ref b/dada_tests/heap-graph/line-start/HeapGraph-0.bir.ref index e552cd6a..611c398b 100644 --- a/dada_tests/heap-graph/line-start/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/line-start/HeapGraph-0.bir.ref @@ -20,7 +20,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -100,14 +100,14 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(5), ), ( AssignExpr( temp{7}, - p{0}.shlease, + p{0}.share, ), Expr(6), ), diff --git a/dada_tests/heap-graph/line-start/HeapGraph-1.bir.ref b/dada_tests/heap-graph/line-start/HeapGraph-1.bir.ref index 3958c54a..d6ef1c4c 100644 --- a/dada_tests/heap-graph/line-start/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/line-start/HeapGraph-1.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -80,14 +80,14 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(5), ), ( AssignExpr( temp{7}, - p{0}.shlease, + p{0}.share, ), Expr(6), ), diff --git a/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref b/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref index d46dbe7b..6396595b 100644 --- a/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/mid-increment/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -140,14 +140,14 @@ ( AssignExpr( temp{12}, - Print.shlease, + Print.share, ), Expr(12), ), ( AssignExpr( temp{13}, - q{1}.shlease, + q{1}.share, ), Expr(13), ), diff --git a/dada_tests/heap-graph/nested-functions/HeapGraph-0.bir.ref b/dada_tests/heap-graph/nested-functions/HeapGraph-0.bir.ref index 974496b5..b326805a 100644 --- a/dada_tests/heap-graph/nested-functions/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/nested-functions/HeapGraph-0.bir.ref @@ -26,7 +26,7 @@ ( AssignExpr( temp{5}, - helper.shlease, + helper.share, ), Expr(3), ), @@ -75,7 +75,7 @@ ( AssignExpr( temp{8}, - Print.shlease, + Print.share, ), Expr(6), ), @@ -154,14 +154,14 @@ ( AssignExpr( temp{13}, - Print.shlease, + Print.share, ), Expr(11), ), ( AssignExpr( temp{14}, - name{0}.shlease, + name{0}.share, ), Expr(12), ), @@ -237,7 +237,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -302,14 +302,14 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(5), ), ( AssignExpr( temp{7}, - p{0}.shlease, + p{0}.share, ), Expr(6), ), diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-0.bir.ref b/dada_tests/heap-graph/nested-points/HeapGraph-0.bir.ref index ae44200a..38e64cc3 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -82,14 +82,14 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(5), ), ( AssignExpr( temp{7}, - p{0}.shlease, + p{0}.share, ), Expr(6), ), diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-1.bir.ref b/dada_tests/heap-graph/nested-points/HeapGraph-1.bir.ref index 3958c54a..d6ef1c4c 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-1.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -80,14 +80,14 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(5), ), ( AssignExpr( temp{7}, - p{0}.shlease, + p{0}.share, ), Expr(6), ), diff --git a/dada_tests/heap-graph/nested-points/HeapGraph-2.bir.ref b/dada_tests/heap-graph/nested-points/HeapGraph-2.bir.ref index c69a353e..ecfddae1 100644 --- a/dada_tests/heap-graph/nested-points/HeapGraph-2.bir.ref +++ b/dada_tests/heap-graph/nested-points/HeapGraph-2.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{3}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -64,7 +64,7 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(5), ), @@ -85,7 +85,7 @@ ( AssignExpr( temp{7}, - p{0}.shlease, + p{0}.share, ), Expr(6), ), diff --git a/dada_tests/heap-graph/past-end/HeapGraph-0.bir.ref b/dada_tests/heap-graph/past-end/HeapGraph-0.bir.ref index 28489026..30ae3aa2 100644 --- a/dada_tests/heap-graph/past-end/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/past-end/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{3}, - Print.shlease, + Print.share, ), Expr(0), ), diff --git a/dada_tests/heap-graph/rust-thunk/HeapGraph-0.bir.ref b/dada_tests/heap-graph/rust-thunk/HeapGraph-0.bir.ref index f5662587..131f520d 100644 --- a/dada_tests/heap-graph/rust-thunk/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/rust-thunk/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{3}, - Print.shlease, + Print.share, ), Expr(0), ), diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-0.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-0.bir.ref index 635c67b2..c15fe42b 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-0.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-0.bir.ref @@ -20,7 +20,7 @@ ( AssignExpr( temp{2}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -104,7 +104,7 @@ ( AssignExpr( temp{7}, - Print.shlease, + Print.share, ), Expr(5), ), diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-1.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-1.bir.ref index fb18bf42..a639c132 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-1.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-1.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{2}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -86,7 +86,7 @@ ( AssignExpr( temp{7}, - Print.shlease, + Print.share, ), Expr(5), ), diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-2.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-2.bir.ref index 9dae8942..12713141 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-2.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-2.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{2}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -84,7 +84,7 @@ ( AssignExpr( temp{7}, - Print.shlease, + Print.share, ), Expr(5), ), diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-3.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-3.bir.ref index 9dae8942..12713141 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-3.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-3.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{2}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -84,7 +84,7 @@ ( AssignExpr( temp{7}, - Print.shlease, + Print.share, ), Expr(5), ), diff --git a/dada_tests/heap-graph/tutorial-1/HeapGraph-4.bir.ref b/dada_tests/heap-graph/tutorial-1/HeapGraph-4.bir.ref index 22f7bbc8..1bed3e8c 100644 --- a/dada_tests/heap-graph/tutorial-1/HeapGraph-4.bir.ref +++ b/dada_tests/heap-graph/tutorial-1/HeapGraph-4.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{2}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -82,7 +82,7 @@ ( AssignExpr( temp{7}, - Print.shlease, + Print.share, ), Expr(5), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.bir.ref index 186b826b..5b08f922 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -84,14 +84,14 @@ ( AssignExpr( q{1}, - p{0}.shlease, + p{0}.share, ), Expr(5), ), ( AssignExpr( x{2}, - p{0}.x.shlease, + p{0}.x.share, ), Expr(8), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.bir.ref index e2408911..8861d3dc 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10/HeapGraph-1.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -75,7 +75,7 @@ ( AssignExpr( q{1}, - p{0}.shlease, + p{0}.share, ), Expr(5), ), @@ -91,7 +91,7 @@ ( AssignExpr( x{2}, - p{0}.x.shlease, + p{0}.x.share, ), Expr(8), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref index a47ae11f..3036ca42 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -146,14 +146,14 @@ ( AssignExpr( temp{12}, - Print.shlease, + Print.share, ), Expr(12), ), ( AssignExpr( temp{13}, - p{0}.x.shlease, + p{0}.x.share, ), Expr(14), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref index 4b98b8fb..f0070fc2 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-10/HeapGraph-1.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{4}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -144,14 +144,14 @@ ( AssignExpr( temp{12}, - Print.shlease, + Print.share, ), Expr(12), ), ( AssignExpr( temp{13}, - p{0}.x.shlease, + p{0}.x.share, ), Expr(14), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref index 82072e0e..1699742d 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-20/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{5}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -151,14 +151,14 @@ ( AssignExpr( temp{13}, - Print.shlease, + Print.share, ), Expr(15), ), ( AssignExpr( temp{14}, - p{0}.x.shlease, + p{0}.x.share, ), Expr(17), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref index 12150e21..448c69de 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-lease-30/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -135,7 +135,7 @@ ( AssignExpr( x{3}, - p{0}.x.shlease, + p{0}.x.share, ), Expr(13), ), @@ -151,7 +151,7 @@ ( AssignExpr( x{4}, - q{1}.x.shlease, + q{1}.x.share, ), Expr(16), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.bir.ref index f9e9ee38..1d64c81b 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-10/HeapGraph-0.bir.ref @@ -6,7 +6,7 @@ ( AssignExpr( temp{7}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -88,7 +88,7 @@ ( AssignExpr( q{1}, - p{0}.shlease, + p{0}.share, ), Expr(6), ), @@ -104,21 +104,21 @@ ( AssignExpr( x{2}, - p{0}.x.shlease, + p{0}.x.share, ), Expr(9), ), ( AssignExpr( x{3}, - q{1}.x.shlease, + q{1}.x.share, ), Expr(12), ), ( AssignExpr( x{4}, - p{0}.x.shlease, + p{0}.x.share, ), Expr(15), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.bir.ref index 162aa583..e2ea332a 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-20/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{6}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -88,21 +88,21 @@ ( AssignExpr( q{1}, - p{0}.shlease, + p{0}.share, ), Expr(7), ), ( AssignExpr( r{2}, - q{1}.shlease, + q{1}.share, ), Expr(10), ), ( AssignExpr( s{3}, - r{2}.shlease, + r{2}.share, ), Expr(13), ), diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.bir.ref b/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.bir.ref index c393e501..909d243c 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.bir.ref +++ b/dada_tests/permissions/dyn_tutorial/tutorial-share-30/HeapGraph-0.bir.ref @@ -13,7 +13,7 @@ ( AssignExpr( temp{5}, - Class(Id { value: 1 }).shlease, + Class(Id { value: 1 }).share, ), Expr(0), ), @@ -95,7 +95,7 @@ ( AssignExpr( r{2}, - q{1}.shlease, + q{1}.share, ), Expr(9), ), From a17112f6cb562f5ac4b94e1f39ae2575620e355f Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 18 Jul 2022 14:02:48 +0300 Subject: [PATCH 26/36] refactor: rename shlease to share --- components/dada-brew/src/brew.rs | 6 +++--- components/dada-execute/src/step.rs | 4 ++-- components/dada-execute/src/step/concatenate.rs | 2 +- components/dada-execute/src/step/into_shared.rs | 2 +- components/dada-execute/src/step/lease.rs | 2 +- components/dada-execute/src/step/{shlease.rs => share.rs} | 2 +- components/dada-ir/src/code/bir.rs | 4 ++-- components/dada-ir/src/code/validated.rs | 6 +++--- components/dada-validate/src/validate/validator.rs | 4 ++-- 9 files changed, 16 insertions(+), 16 deletions(-) rename components/dada-execute/src/step/{shlease.rs => share.rs} (99%) diff --git a/components/dada-brew/src/brew.rs b/components/dada-brew/src/brew.rs index c122107c..396ce688 100644 --- a/components/dada-brew/src/brew.rs +++ b/components/dada-brew/src/brew.rs @@ -143,7 +143,7 @@ impl Cursor { | validated::ExprData::Call(_, _) | validated::ExprData::IntoShared(_) | validated::ExprData::Lease(_) - | validated::ExprData::Shlease(_) + | validated::ExprData::Share(_) | validated::ExprData::Give(_) | validated::ExprData::Tuple(_) | validated::ExprData::Concatenate(_) @@ -264,10 +264,10 @@ impl Cursor { self.push_breakpoint_ends(brewery, Some(target), origins, origin); } - validated::ExprData::Shlease(place) => { + validated::ExprData::Share(place) => { let (place, origins) = self.brew_place(brewery, *place); self.push_breakpoint_starts(brewery, origins.iter().copied(), origin); - self.push_assignment(brewery, target, bir::ExprData::Shlease(place), origin); + self.push_assignment(brewery, target, bir::ExprData::Share(place), origin); self.push_breakpoint_ends(brewery, Some(target), origins, origin); } diff --git a/components/dada-execute/src/step.rs b/components/dada-execute/src/step.rs index 5f481aaf..1fc15643 100644 --- a/components/dada-execute/src/step.rs +++ b/components/dada-execute/src/step.rs @@ -39,7 +39,7 @@ mod into_shared; mod intrinsic; mod lease; mod revoke; -mod shlease; +mod share; mod tenant; mod traversal; @@ -449,7 +449,7 @@ impl<'me> Stepper<'me> { }), bir::ExprData::IntoShared(place) => self.into_shared_place(table, *place), bir::ExprData::Lease(place) => self.lease_place(table, *place), - bir::ExprData::Shlease(place) => self.shlease_place(table, *place), + bir::ExprData::Share(place) => self.share_place(table, *place), bir::ExprData::Give(place) => self.give_place(table, *place), bir::ExprData::Tuple(places) => { let fields = places diff --git a/components/dada-execute/src/step/concatenate.rs b/components/dada-execute/src/step/concatenate.rs index c6ccead7..2598b26a 100644 --- a/components/dada-execute/src/step/concatenate.rs +++ b/components/dada-execute/src/step/concatenate.rs @@ -15,7 +15,7 @@ impl Stepper<'_> { ) -> eyre::Result { let mut string = String::new(); for place in places { - let value = self.shlease_place(table, *place)?; + let value = self.share_place(table, *place)?; string.push_str(&self.machine.stringify_value(self.db, value)); } diff --git a/components/dada-execute/src/step/into_shared.rs b/components/dada-execute/src/step/into_shared.rs index 33e7599b..3267f7e2 100644 --- a/components/dada-execute/src/step/into_shared.rs +++ b/components/dada-execute/src/step/into_shared.rs @@ -26,7 +26,7 @@ impl Stepper<'_> { /// * The shared result has the same ownership/lease properties as original path: /// * If original path was owned, shared result is owned (sharing a `my Foo` gives an `our Foo`). /// * If original path was leased, shared result is leased and lives as long as original lease would - /// (sharing a `leased(p) Foo` gives a `shleased(p) Foo`). + /// (sharing a `leased(p) Foo` gives a `shared(p) Foo`). /// * After sharing, the original path can be read (or shared again) without disturbing the share. /// /// Implication: diff --git a/components/dada-execute/src/step/lease.rs b/components/dada-execute/src/step/lease.rs index 82247a82..40a5772c 100644 --- a/components/dada-execute/src/step/lease.rs +++ b/components/dada-execute/src/step/lease.rs @@ -135,7 +135,7 @@ impl Stepper<'_> { // : // : tenant // v - // --shleased--> b + // --shared----> b // ============= resulting permission // ``` // diff --git a/components/dada-execute/src/step/shlease.rs b/components/dada-execute/src/step/share.rs similarity index 99% rename from components/dada-execute/src/step/shlease.rs rename to components/dada-execute/src/step/share.rs index 4312aa19..fd8bccb4 100644 --- a/components/dada-execute/src/step/shlease.rs +++ b/components/dada-execute/src/step/share.rs @@ -28,7 +28,7 @@ impl Stepper<'_> { /// * `place` may be used for reads without invalidating the resulting value `v` /// * `place` remains valid and unchanged; writing to `place` may invalidate the result `v`. #[tracing::instrument(level = "Debug", skip(self, table))] - pub(super) fn shlease_place( + pub(super) fn share_place( &mut self, table: &bir::Tables, place: bir::Place, diff --git a/components/dada-ir/src/code/bir.rs b/components/dada-ir/src/code/bir.rs index 127f618d..d2637cde 100644 --- a/components/dada-ir/src/code/bir.rs +++ b/components/dada-ir/src/code/bir.rs @@ -422,7 +422,7 @@ pub enum ExprData { IntoShared(Place), /// `.share` - Shlease(Place), + Share(Place), /// `expr.lease` Lease(Place), @@ -460,7 +460,7 @@ impl DebugWithDb> for ExprData { ExprData::StringLiteral(w) => write!(f, "{:?}", w.as_str(db.db())), ExprData::FloatLiteral(w) => write!(f, "{}", w), ExprData::IntoShared(e) => write!(f, "{:?}.share", e.debug(db)), - ExprData::Shlease(p) => write!(f, "{:?}.share", p.debug(db)), + ExprData::Share(p) => write!(f, "{:?}.share", p.debug(db)), ExprData::Lease(p) => write!(f, "{:?}.lease", p.debug(db)), ExprData::Give(p) => write!(f, "{:?}.give", p.debug(db)), ExprData::Unit => write!(f, "()"), diff --git a/components/dada-ir/src/code/validated.rs b/components/dada-ir/src/code/validated.rs index 1d44b619..898370b8 100644 --- a/components/dada-ir/src/code/validated.rs +++ b/components/dada-ir/src/code/validated.rs @@ -245,7 +245,7 @@ pub enum ExprData { IntoShared(Expr), /// `.share` - Shlease(Place), + Share(Place), /// `expr.lease` Lease(Place), @@ -325,9 +325,9 @@ impl ExprData { .field(&expr.debug(db)) .field(&args.debug(db)) .finish(), - ExprData::IntoShared(p) => f.debug_tuple("Share").field(&p.debug(db)).finish(), + ExprData::IntoShared(p) => f.debug_tuple("IntoShared").field(&p.debug(db)).finish(), ExprData::Lease(p) => f.debug_tuple("Lease").field(&p.debug(db)).finish(), - ExprData::Shlease(p) => f.debug_tuple("Shlease").field(&p.debug(db)).finish(), + ExprData::Share(p) => f.debug_tuple("Share").field(&p.debug(db)).finish(), ExprData::Give(p) => f.debug_tuple("Give").field(&p.debug(db)).finish(), ExprData::Tuple(exprs) => { let mut f = f.debug_tuple("Tuple"); diff --git a/components/dada-validate/src/validate/validator.rs b/components/dada-validate/src/validate/validator.rs index d98b85b9..69f77130 100644 --- a/components/dada-validate/src/validate/validator.rs +++ b/components/dada-validate/src/validate/validator.rs @@ -197,7 +197,7 @@ impl<'me> Validator<'me> { match expr.data(self.syntax_tables()) { syntax::ExprData::Dot(..) | syntax::ExprData::Id(_) => self .with_expr_validated_as_place(expr, &mut |this, place| { - this.add(validated::ExprData::Shlease(place), expr) + this.add(validated::ExprData::Share(place), expr) }), syntax::ExprData::BooleanLiteral(b) => { @@ -345,7 +345,7 @@ impl<'me> Validator<'me> { syntax::ExprData::Share(target_expr) => { if self.is_place_expression(*target_expr) { - self.validate_permission_expr(expr, *target_expr, validated::ExprData::Shlease) + self.validate_permission_expr(expr, *target_expr, validated::ExprData::Share) } else { let validated_target_expr = self.validate_expr(*target_expr); self.add(validated::ExprData::IntoShared(validated_target_expr), expr) From 31e4061f9f151b90d46e82fe2e964f8c2e8c8fec Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 18 Jul 2022 15:04:19 +0300 Subject: [PATCH 27/36] WIP: start editing text --- book/docs/dyn_tutorial/class.md | 4 -- book/docs/dyn_tutorial/index.md | 12 +----- book/docs/dyn_tutorial/labeled_arguments.md | 47 ++++++++++----------- book/docs/dyn_tutorial/permissions.md | 37 +++++++++++++--- 4 files changed, 56 insertions(+), 44 deletions(-) diff --git a/book/docs/dyn_tutorial/class.md b/book/docs/dyn_tutorial/class.md index 122c45e1..d66d935b 100644 --- a/book/docs/dyn_tutorial/class.md +++ b/book/docs/dyn_tutorial/class.md @@ -62,8 +62,4 @@ p.x += 1 # Print the new value. print_point(p).await - -# prints: -# The point is: Point(x: 22, y: 44) -# The point is: Point(x: 34, y: 44) ``` diff --git a/book/docs/dyn_tutorial/index.md b/book/docs/dyn_tutorial/index.md index b8816b87..b9a49f8d 100644 --- a/book/docs/dyn_tutorial/index.md +++ b/book/docs/dyn_tutorial/index.md @@ -4,7 +4,7 @@ import Caveat from '../caveat.md' -The classic “Hello, World” program in Dada should be quite familiar: +You can see a classic “Hello, World” program in Dada below; it should be quite familiar. Note that this is a live-editing IDE -- try editing the program to see the new output! ```dada ide # Print a classic quote @@ -15,15 +15,7 @@ print(" ").await ``` -When you run this (try it!) it prints: - -``` -I have forced myself to contradict myself -in order to avoid conforming to my own taste. - -- Marcel Duchamp -``` - -There are a few interesting things to note: +Some interesting things: - Comments in Dada are written with `#`, like Python or Ruby, not `//` like JavaScript or Rust. - Dada, like JavaScript, is based exclusively on **async-await**. This means that operations that perform I/O, like `print`, don't execute immediately. Instead, they return a _thunk_, which is basically "code waiting to run" (but not running yet). The thunk doesn't execute until you _await_ it by using the `.await` operation. diff --git a/book/docs/dyn_tutorial/labeled_arguments.md b/book/docs/dyn_tutorial/labeled_arguments.md index 71ceb73a..30fd7da3 100644 --- a/book/docs/dyn_tutorial/labeled_arguments.md +++ b/book/docs/dyn_tutorial/labeled_arguments.md @@ -4,50 +4,49 @@ sidebar_position: 3 # Aside: Labeled arguments -Before we go further with the tutorial, it's worth nothing that Dada supports *labeled arguments*. That means that instead of writing `Point(22, 44)` one can also give labels to each argument, like `Point(x: 22, y: 44)`: +Before we go further with the tutorial, it's worth nothing that Dada supports _labeled arguments_. That means that instead of writing `Point(22, 44)` one can also give labels to each argument, like `Point(x: 22, y: 44)`: -``` -class Point(our x, our y) +```dada ide +class Point(x, y) my p = Point(x: 22, y: 44) print("The point is `{p}`").await - -# prints: -# The point is `Point(x: 22, y: 44)` ``` +Try changing the code above to give the parameters in another orde, such as `Point(y: 44, x: 22)` -- you will see that the output doesn't change. + Adding labels can help make it clearer what is going on. The rules are as follows: -* You must also give the arguments in the order in which they were declared in the function, whether or not labels were provided. -* Once you give a label to a parameter, you must give a label to all the remaining parameters (so you can't do `Point(x: 22, yy)` but you can do `Point(22, y: 44)`. +- You must also give the arguments in the order in which they were declared in the function, whether or not labels were provided. +- Once you give a label to a parameter, you must give a label to all the remaining parameters (so you can't do `Point(x: 22, yy)` but you can do `Point(22, y: 44)`. Dada will also sometimes suggest you use labels if it thinks you might be making a mistake. For example, try this: -``` -class Point(our x, our y) +```dada ide +class Point(x, y) -async fn print_line(my start, my end) { - print(start).await - print(end).await +async fn print_line(start, end) { + print("The start is {start}").await + print("The end is {end}").await } -my start = Point(22, 44) -my end = Point(33, 55) +start = Point(22, 44) +end = Point(33, 55) print_line(end, start).await # ~~~~~~~~~~ warning: are these parameters in the right order? ``` -See the squiggly line? That is Dada telling us that we may have reversed the order of `end` and `start`. We can disable this warning by giving explicit labels to the arguments, making it clear that we *meant* to switch the order: +See the squiggly line? That is Dada telling us that we may have reversed the order of `end` and `start`. We can disable this warning by giving explicit labels to the arguments, making it clear that we _meant_ to switch the order: -``` -class Point(our x, our y) +```dada ide +class Point(x, y) -async fn print_line(my start, my end) { - print(start).await - print(end).await +async fn print_line(start, end) { + print("The start is {start}").await + print("The end is {end}").await } -my start = Point(22, 44) -my end = Point(33, 55) +start = Point(22, 44) +end = Point(33, 55) print_line(start: end, end: start).await -``` \ No newline at end of file +``` diff --git a/book/docs/dyn_tutorial/permissions.md b/book/docs/dyn_tutorial/permissions.md index c059a288..592dd7d8 100644 --- a/book/docs/dyn_tutorial/permissions.md +++ b/book/docs/dyn_tutorial/permissions.md @@ -4,6 +4,31 @@ sidebar_position: 4 # Permissions +Dada hopefully feels familiar to you thus far, but if you played a lot with the programs, you may have noticed some errors you didn't expect. Consider this program...what do you expect it to print? Take a guess, and then hit the "Run" button to see what happens... + +```dada ide +class Point(x, y) + +p = Point(22, 44) +q = p +q.x := 23 +print(p).await +``` + +Surprise! It gets an error! What is going on? The answer lies in the key Dada concept of **permissions**. + +## What is a permission? + +In Dada, variables don't just store a reference to an object, like they do in Python or Java. Instead, they store a reference to an object _with some permission_. These permissions determine whether you can read or write to the object. + +When you write `q = p`, the default is to get _shared_ permission. + +## The shared permission + +The answer lies in the `q = p` statement. + +You may have noticed + In the previous chapter, we saw keywords like `my` and `our` attached to variables. These are examples of **permissions** -- permissions are a key part of Dada. Like Rust, Dada leverages permissions to avoid the need for a garbage collector, while retaining memory safety. ## Running example @@ -30,17 +55,17 @@ This example already makes use of two permissions, `my` and `our`. There are fou The difference between these dimensions: -* *Owned* permissions are permanent. They cannot be revoked through access to other variables. - * *Leased* permissions are temporary -- there is always a lessor (either an owner or another lease), and that lessor can reclaim full access to their object. -* *Unique* permissions are exclusive. When one variable has unique permission, no other variables can access the object while that variable is in use (without some kind of error occurring). - * *Shared* permissions can be copied freely, but they [require that the object is read-only](./sharing_xor_mutation.md). In other words, while you are reading from an object with a shared permission, nobody else can come and change it under your feet (except via an [atomic](./atomic.md) field). +- _Owned_ permissions are permanent. They cannot be revoked through access to other variables. + - _Leased_ permissions are temporary -- there is always a lessor (either an owner or another lease), and that lessor can reclaim full access to their object. +- _Unique_ permissions are exclusive. When one variable has unique permission, no other variables can access the object while that variable is in use (without some kind of error occurring). + - _Shared_ permissions can be copied freely, but they [require that the object is read-only](./sharing_xor_mutation.md). In other words, while you are reading from an object with a shared permission, nobody else can come and change it under your feet (except via an [atomic](./atomic.md) field). ## Overview of what's to come Over the next few chapters, we're going to look at each of the permissions in detail: -* We'll start with the *owned permissions*, [`my`] and [`our`]. -* Then we'll cover the *leased permissions*, [`leased`] and [`shleased`]. +- We'll start with the _owned permissions_, [`my`] and [`our`]. +- Then we'll cover the _leased permissions_, [`leased`] and [`shleased`]. [`my`]: ./my [`our`]: ./our From 94831c5c8b0636626054893cb29ae9f8657c7ef7 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 18 Jul 2022 15:49:10 +0300 Subject: [PATCH 28/36] make in-place editing require Run, Debug Still looks terrible but you can click Run, Debug --- book/src/components/Ide/index.tsx | 32 +++++++++-- book/src/components/Ide/output.tsx | 88 ++++++++++++++++++++++-------- 2 files changed, 92 insertions(+), 28 deletions(-) diff --git a/book/src/components/Ide/index.tsx b/book/src/components/Ide/index.tsx index 6c07f37b..694eb3db 100644 --- a/book/src/components/Ide/index.tsx +++ b/book/src/components/Ide/index.tsx @@ -4,6 +4,8 @@ import Col from "react-bootstrap/Col"; import Row from "react-bootstrap/Row"; import { default as AnsiUp } from "ansi_up"; import Container from "react-bootstrap/Container"; +import Stack from "react-bootstrap/Stack"; +import Button from "react-bootstrap/Button"; import dadaWeb, { compiler } from "dada-web"; import type { DadaCompiler, InitOutput } from "dada-web"; @@ -113,7 +115,9 @@ class DCW { export type Cursor = { row: number; column: number }; export enum OutputMode { + NONE = "none", EXECUTE = "execute", + DEBUG = "debug", SYNTAX = "syntax", VALIDATED = "validated", BIR = "bir", @@ -123,7 +127,9 @@ function Ide(props: { mini: boolean; sourceText: string }) { const [_module, setModule] = useState(null); const [dada, setDada] = useState(null); const [queue] = useState(() => new Queue()); - const [outputMode, setOutputMode] = useState(OutputMode.EXECUTE); + const [outputMode, setOutputMode] = useState( + props.mini ? OutputMode.NONE : OutputMode.DEBUG + ); // Guess an appropriate number of lines based on the initial // source. @@ -182,8 +188,26 @@ function Ide(props: { mini: boolean; sourceText: string }) { if (props.mini) { return ( - - Source Code + + + Source Code + + + + + + + diff --git a/book/src/components/Ide/output.tsx b/book/src/components/Ide/output.tsx index 6817f2eb..d983ea2f 100644 --- a/book/src/components/Ide/output.tsx +++ b/book/src/components/Ide/output.tsx @@ -3,6 +3,7 @@ import { Graphviz } from "graphviz-react"; import { OutputMode } from "."; import Col from "react-bootstrap/Col"; import Row from "react-bootstrap/Row"; +import { Stack } from "react-bootstrap"; type StateGraphProps = { heap: string; @@ -14,7 +15,7 @@ const StateGraph = (props: PropsWithChildren) => { return (
-

{props.name}

+

{props.name}

@@ -30,35 +31,74 @@ type OutputProps = { }; function Output(props: PropsWithChildren) { - const executeTemplate = props.mini ? ( -
- ) : ( - <> + if (props.mini) { + const outputTemplate = (
- - - - ); + ); - const irTemplate = ( - <> -
- - ); + switch (props.mode) { + case OutputMode.EXECUTE: + return outputTemplate; + case OutputMode.DEBUG: + return ( + + {outputTemplate} + + + + + ); + case OutputMode.NONE: + return
; + default: + return outputTemplate; + } + } else { + const executeTemplate = ( + <> +
+ + ); + + const debugTemplate = ( + <> +
+ + + ); + + const irTemplate = ( + <> +
+ + ); - return props.mode === OutputMode.EXECUTE ? executeTemplate : irTemplate; + switch (props.mode) { + case OutputMode.EXECUTE: + return executeTemplate; + case OutputMode.DEBUG: + return debugTemplate; + case OutputMode.NONE: + return
; + default: + return irTemplate; + } + } } export default Output; From fd69cee40ed0c5de59a928853104d5799500987b Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 18 Jul 2022 16:21:32 +0300 Subject: [PATCH 29/36] rewrite the permission chapter seems like the read/write keywords would be better --- book/docs/dyn_tutorial/permissions.md | 64 +++++++++++---------------- 1 file changed, 26 insertions(+), 38 deletions(-) diff --git a/book/docs/dyn_tutorial/permissions.md b/book/docs/dyn_tutorial/permissions.md index 592dd7d8..cd17d03b 100644 --- a/book/docs/dyn_tutorial/permissions.md +++ b/book/docs/dyn_tutorial/permissions.md @@ -21,53 +21,41 @@ Surprise! It gets an error! What is going on? The answer lies in the key Dada co In Dada, variables don't just store a reference to an object, like they do in Python or Java. Instead, they store a reference to an object _with some permission_. These permissions determine whether you can read or write to the object. -When you write `q = p`, the default is to get _shared_ permission. +Permissions in Dada can be divided across two axes. We'll cover those two axes separately: -## The shared permission +- **Read** vs **write** -- covered now! +- **Owned** vs **leased** -- covered later, in the chapters on ownership -The answer lies in the `q = p` statement. +## Read permission is the default -You may have noticed +When you write something like `q = p` in Dada, the default is that you get a **leased, read permission**. Leasing will be covered in more detail later, but for now it suffices to say that the permission for `q` is tied to the permission from `p`; when `p` goes out of scope, for example, then `q`'s permission will also be canceled. -In the previous chapter, we saw keywords like `my` and `our` attached to variables. These are examples of **permissions** -- permissions are a key part of Dada. Like Rust, Dada leverages permissions to avoid the need for a garbage collector, while retaining memory safety. +As the name suggests, **read permissions** can only be used to read fields. This is why we get an error! -## Running example +Dada comes equipped with a visual debugger that lets you visualize permissions. To see how it works, try hitting the "Debug" button and then position your cursor write after the line for `q = p`: -As we explain permissions both here and over the next several chapters, we're going to work with variations on this example program. It builds on syntax that we [introduced previously](./class.md), so if anything is confusing you may want to check out that chapter. - -``` -class Point(our x, our y) +```dada ide +class Point(x, y) -async fn main() { - my p = Point(22, 44) - print("The point is ({p.x}, {p.y})").await -} +p = Point(22, 44) +q = p +# ▲ +# ───┘ +# put your cursor here -- you will see a diagram below +# that shows that while `p` and `q` reference the same +# point, `q` has read permisions (indicated with a blue +# line). ``` -## `my`, `our`, and other permissions - -This example already makes use of two permissions, `my` and `our`. There are four permissions in total, and they can be divided along two dimensions: - -| | Unique | Shared | -| ------ | ---------- | ------------ | -| Owned | [`my`] | [`our`] | -| Leased | [`leased`] | [`shleased`] | - -The difference between these dimensions: +## Requesting write permission -- _Owned_ permissions are permanent. They cannot be revoked through access to other variables. - - _Leased_ permissions are temporary -- there is always a lessor (either an owner or another lease), and that lessor can reclaim full access to their object. -- _Unique_ permissions are exclusive. When one variable has unique permission, no other variables can access the object while that variable is in use (without some kind of error occurring). - - _Shared_ permissions can be copied freely, but they [require that the object is read-only](./sharing_xor_mutation.md). In other words, while you are reading from an object with a shared permission, nobody else can come and change it under your feet (except via an [atomic](./atomic.md) field). +You can explicitly request write permision by using the `lease` keyword, like `p.lease`. If you use the debugger and position it after `q = p.lease`, you will see that `q` is given write permission this time. As a result, `q.x := 23` succeeds and, when we print the variable `p`, we see the new value. -## Overview of what's to come - -Over the next few chapters, we're going to look at each of the permissions in detail: - -- We'll start with the _owned permissions_, [`my`] and [`our`]. -- Then we'll cover the _leased permissions_, [`leased`] and [`shleased`]. +```dada ide +class Point(x, y) -[`my`]: ./my -[`our`]: ./our -[`leased`]: ./lease -[`shleased`]: ./shlease +p = Point(22, 44) +q = p.lease +q.x := 23 +print(p).await +``` From 86943543ecc289f50c2e8374bfd30938e44f3c58 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 22 Jul 2022 07:10:34 +0300 Subject: [PATCH 30/36] pacify the tyrannical clippy --- components/dada-execute/src/machine/stringify.rs | 2 +- components/dada-validate/src/validate.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/dada-execute/src/machine/stringify.rs b/components/dada-execute/src/machine/stringify.rs index 07e8fe40..1a57b7d2 100644 --- a/components/dada-execute/src/machine/stringify.rs +++ b/components/dada-execute/src/machine/stringify.rs @@ -10,7 +10,7 @@ pub(crate) impl DefaultStringify for T { /// eventually be customizable. fn stringify_value(&self, db: &dyn crate::Db, value: Value) -> String { if let PermissionData::Expired(_) = self[value.permission] { - return "(expired)".to_string(); + "(expired)".to_string() } else { self.stringify_object(db, value.object) } diff --git a/components/dada-validate/src/validate.rs b/components/dada-validate/src/validate.rs index e8e731ad..f08280a3 100644 --- a/components/dada-validate/src/validate.rs +++ b/components/dada-validate/src/validate.rs @@ -17,7 +17,7 @@ pub(crate) fn validate_function(db: &dyn crate::Db, function: Function) -> valid let mut tables = validated::Tables::default(); let mut origins = validated::Origins::default(); let root_definitions = root_definitions(db, function.filename(db)); - let scope = Scope::root(db, &root_definitions); + let scope = Scope::root(db, root_definitions); let mut validator = validator::Validator::root(db, function, syntax_tree, &mut tables, &mut origins, scope); From b0dbaa8a2f0349477f910e7156922d1aae3c4278 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 29 Jul 2022 08:22:31 +0300 Subject: [PATCH 31/36] Update book/docs/dyn_tutorial/labeled_arguments.md --- book/docs/dyn_tutorial/labeled_arguments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/docs/dyn_tutorial/labeled_arguments.md b/book/docs/dyn_tutorial/labeled_arguments.md index 30fd7da3..e44a6301 100644 --- a/book/docs/dyn_tutorial/labeled_arguments.md +++ b/book/docs/dyn_tutorial/labeled_arguments.md @@ -4,7 +4,7 @@ sidebar_position: 3 # Aside: Labeled arguments -Before we go further with the tutorial, it's worth nothing that Dada supports _labeled arguments_. That means that instead of writing `Point(22, 44)` one can also give labels to each argument, like `Point(x: 22, y: 44)`: +Before we go further with the tutorial, it's worth noting that Dada supports _labeled arguments_. That means that instead of writing `Point(22, 44)` one can also give labels to each argument, like `Point(x: 22, y: 44)`: ```dada ide class Point(x, y) From 0724c099a9971e47a6d3a6dc2b56190bd40487e6 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sun, 31 Jul 2022 06:24:14 +0300 Subject: [PATCH 32/36] Update dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada --- dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada b/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada index 1b92719d..6ab70fe3 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada @@ -3,7 +3,7 @@ class Point(x, y) async fn main() { p = Point(x: 22, y: 44) #? ^ HeapGraph - q = p + q = p.give #? ^ HeapGraph x = p.x From daa6c74ff211051ff550228e46bca125d9f36761 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 1 Aug 2022 15:18:19 +0300 Subject: [PATCH 33/36] adopt python mode --- book/src/components/Ide/editor.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/src/components/Ide/editor.tsx b/book/src/components/Ide/editor.tsx index ecf04d24..f1e9858a 100644 --- a/book/src/components/Ide/editor.tsx +++ b/book/src/components/Ide/editor.tsx @@ -2,7 +2,7 @@ import React, { PropsWithChildren } from "react"; import AceEditor from "react-ace"; import { useColorMode } from "@docusaurus/theme-common"; -import "ace-builds/src-noconflict/mode-rust"; +import "ace-builds/src-noconflict/mode-python"; import "ace-builds/src-noconflict/theme-github"; import "ace-builds/src-noconflict/theme-twilight"; @@ -20,7 +20,7 @@ function Editor(props: PropsWithChildren) { const { colorMode } = useColorMode(); return ( Date: Mon, 1 Aug 2022 15:19:29 +0300 Subject: [PATCH 34/36] remove the `.give` from the example --- dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada b/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada index 6ab70fe3..1b92719d 100644 --- a/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada +++ b/dada_tests/permissions/dyn_tutorial/tutorial-give-10.dada @@ -3,7 +3,7 @@ class Point(x, y) async fn main() { p = Point(x: 22, y: 44) #? ^ HeapGraph - q = p.give + q = p #? ^ HeapGraph x = p.x From 2419daa6c5040e12eb1fdd9f003f1a1b56b61f32 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 1 Aug 2022 15:20:06 +0300 Subject: [PATCH 35/36] switch to the dada branch of salsa salsa is evolving, we'll have to play catchup --- components/salsa/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/salsa/Cargo.toml b/components/salsa/Cargo.toml index eb5782be..28a92824 100644 --- a/components/salsa/Cargo.toml +++ b/components/salsa/Cargo.toml @@ -6,5 +6,5 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -salsa-entity-mock = { git = "https://github.com/nikomatsakis/salsa/", branch = "entity" } +salsa-entity-mock = { git = "https://github.com/nikomatsakis/salsa/", branch = "dada" } # salsa-entity-mock = { path = "../../../salsa/components/salsa-entity-mock" } From 5284b1d17f998caaa70b9a7503aff38340b80a93 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 1 Aug 2022 15:21:05 +0300 Subject: [PATCH 36/36] update Cargo.lock --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 17b78e98..975ceb6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -938,7 +938,7 @@ dependencies = [ [[package]] name = "salsa-entity-macros" version = "0.1.0" -source = "git+https://github.com/nikomatsakis/salsa/?branch=entity#bd8ea4a6768f12ecc9251f39f379b369fefedb71" +source = "git+https://github.com/nikomatsakis/salsa/?branch=dada#bd8ea4a6768f12ecc9251f39f379b369fefedb71" dependencies = [ "eyre", "heck", @@ -950,7 +950,7 @@ dependencies = [ [[package]] name = "salsa-entity-mock" version = "0.1.0" -source = "git+https://github.com/nikomatsakis/salsa/?branch=entity#bd8ea4a6768f12ecc9251f39f379b369fefedb71" +source = "git+https://github.com/nikomatsakis/salsa/?branch=dada#bd8ea4a6768f12ecc9251f39f379b369fefedb71" dependencies = [ "arc-swap", "crossbeam",