Skip to content

Commit

Permalink
More mucking with var ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
uberFoo committed Jan 7, 2025
1 parent 1a35be2 commit e1d6ba0
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 195 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sarzak"
version = "2.15.0"
version = "2.15.1"
edition = "2021"
authors = ["Keith T. Star <[email protected]>"]
categories = ["compilers", "memory-management"]
Expand Down Expand Up @@ -41,6 +41,7 @@ serde_json = "1.0.93"
tracy-client = { version = "0.15.2", optional = true }
uuid = { version = "1.2.2", features = ["v5", "serde"] }
tracing = "0.1.40"
ordered_hash_map = { version = "0.4.0", features = ["serde"] }

[lib]
doctest = true
Expand Down
2 changes: 1 addition & 1 deletion models/lu_dog.json

Large diffs are not rendered by default.

27 changes: 2 additions & 25 deletions src/v2/lu_dog/types/x_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ pub struct XValue {
pub id: Uuid,
/// R33: [`XValue`] '' [`Block`]
pub block: Uuid,
/// R258: [`XValue`] '' [`XValue`]
pub next: Option<Uuid>,
/// R24: [`XValue`] 'is decoded by a' [`ValueType`]
pub ty: Uuid,
}
Expand All @@ -46,15 +44,13 @@ impl XValue {
/// Inter a new XValue in the store, and return it's `id`.
pub fn new_expression(
block: &Rc<RefCell<Block>>,
next: Option<&Rc<RefCell<XValue>>>,
ty: &Rc<RefCell<ValueType>>,
subtype: &Rc<RefCell<Expression>>,
store: &mut LuDogStore,
) -> Rc<RefCell<XValue>> {
let id = Uuid::new_v4();
let new = Rc::new(RefCell::new(XValue {
block: block.borrow().id,
next: next.map(|x_value| x_value.borrow().id),
ty: ty.borrow().id,
subtype: XValueEnum::Expression(subtype.borrow().id), // b
id,
Expand All @@ -67,15 +63,13 @@ impl XValue {
/// Inter a new XValue in the store, and return it's `id`.
pub fn new_variable(
block: &Rc<RefCell<Block>>,
next: Option<&Rc<RefCell<XValue>>>,
ty: &Rc<RefCell<ValueType>>,
subtype: &Rc<RefCell<Variable>>,
store: &mut LuDogStore,
) -> Rc<RefCell<XValue>> {
let id = Uuid::new_v4();
let new = Rc::new(RefCell::new(XValue {
block: block.borrow().id,
next: next.map(|x_value| x_value.borrow().id),
ty: ty.borrow().id,
subtype: XValueEnum::Variable(subtype.borrow().id), // b
id,
Expand All @@ -91,13 +85,6 @@ impl XValue {
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-struct-impl-nav-forward-cond-to-next"}}}
/// Navigate to [`XValue`] across R258(1-*c)
pub fn r258_x_value<'a>(&'a self, store: &'a LuDogStore) -> Vec<Rc<RefCell<XValue>>> {
match self.next {
Some(ref next) => vec![store.exhume_x_value(&next).unwrap()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-struct-impl-nav-forward-to-ty"}}}
/// Navigate to [`ValueType`] across R24(1-*)
Expand All @@ -116,18 +103,8 @@ impl XValue {
.collect()
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-struct-impl-nav-backward-one-bi-cond-to-x_value"}}}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-struct-impl-nav-backward-one-bi-cond-to-x_value"}}}
/// Navigate to [`XValue`] across R258(1c-1c)
pub fn r258c_x_value<'a>(&'a self, store: &'a LuDogStore) -> Vec<Rc<RefCell<XValue>>> {
let x_value = store
.iter_x_value()
.find(|x_value| x_value.borrow().next == Some(self.id));
match x_value {
Some(ref x_value) => vec![x_value.clone()],
None => Vec::new(),
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-struct-impl-nav-backward-one-bi-cond-to-x_value"}}}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
}
Expand Down
34 changes: 1 addition & 33 deletions src/v2/lu_dog_ndrwlock_vec/types/x_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ pub struct XValue {
pub id: usize,
/// R33: [`XValue`] '' [`Block`]
pub block: usize,
/// R258: [`XValue`] '' [`XValue`]
pub next: Option<usize>,
/// R24: [`XValue`] 'is decoded by a' [`ValueType`]
pub ty: usize,
}
Expand All @@ -46,15 +44,13 @@ impl XValue {
/// Inter a new XValue in the store, and return it's `id`.
pub fn new_expression(
block: &Arc<RwLock<Block>>,
next: Option<&Arc<RwLock<XValue>>>,
ty: &Arc<RwLock<ValueType>>,
subtype: &Arc<RwLock<Expression>>,
store: &mut LuDogNdrwlockVecStore,
) -> Arc<RwLock<XValue>> {
store.inter_x_value(|id| {
Arc::new(RwLock::new(XValue {
block: block.read().unwrap().id,
next: next.map(|x_value| x_value.read().unwrap().id),
ty: ty.read().unwrap().id,
subtype: XValueEnum::Expression(subtype.read().unwrap().id), // b
id,
Expand All @@ -66,15 +62,13 @@ impl XValue {
/// Inter a new XValue in the store, and return it's `id`.
pub fn new_variable(
block: &Arc<RwLock<Block>>,
next: Option<&Arc<RwLock<XValue>>>,
ty: &Arc<RwLock<ValueType>>,
subtype: &Arc<RwLock<Variable>>,
store: &mut LuDogNdrwlockVecStore,
) -> Arc<RwLock<XValue>> {
store.inter_x_value(|id| {
Arc::new(RwLock::new(XValue {
block: block.read().unwrap().id,
next: next.map(|x_value| x_value.read().unwrap().id),
ty: ty.read().unwrap().id,
subtype: XValueEnum::Variable(subtype.read().unwrap().id), // b
id,
Expand All @@ -89,16 +83,6 @@ impl XValue {
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-struct-impl-nav-forward-cond-to-next"}}}
/// Navigate to [`XValue`] across R258(1-*c)
pub fn r258_x_value<'a>(
&'a self,
store: &'a LuDogNdrwlockVecStore,
) -> Vec<Arc<RwLock<XValue>>> {
match self.next {
Some(ref next) => vec![store.exhume_x_value(&next).unwrap()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-struct-impl-nav-forward-to-ty"}}}
/// Navigate to [`ValueType`] across R24(1-*)
Expand All @@ -121,29 +105,13 @@ impl XValue {
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-struct-impl-nav-backward-one-bi-cond-to-x_value"}}}
/// Navigate to [`XValue`] across R258(1c-1c)
pub fn r258c_x_value<'a>(
&'a self,
store: &'a LuDogNdrwlockVecStore,
) -> Vec<Arc<RwLock<XValue>>> {
let x_value = store
.iter_x_value()
.find(|x_value| x_value.read().unwrap().next == Some(self.id));
match x_value {
Some(ref x_value) => vec![x_value.clone()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-implementation"}}}
impl PartialEq for XValue {
fn eq(&self, other: &Self) -> bool {
self.subtype == other.subtype
&& self.block == other.block
&& self.next == other.next
&& self.ty == other.ty
self.subtype == other.subtype && self.block == other.block && self.ty == other.ty
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
Expand Down
28 changes: 1 addition & 27 deletions src/v2/lu_dog_pl_vec/types/x_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ pub struct XValue {
pub id: usize,
/// R33: [`XValue`] '' [`Block`]
pub block: usize,
/// R258: [`XValue`] '' [`XValue`]
pub next: Option<usize>,
/// R24: [`XValue`] 'is decoded by a' [`ValueType`]
pub ty: usize,
}
Expand All @@ -46,15 +44,13 @@ impl XValue {
/// Inter a new XValue in the store, and return it's `id`.
pub fn new_expression(
block: &Arc<RwLock<Block>>,
next: Option<&Arc<RwLock<XValue>>>,
ty: &Arc<RwLock<ValueType>>,
subtype: &Arc<RwLock<Expression>>,
store: &mut LuDogPlVecStore,
) -> Arc<RwLock<XValue>> {
store.inter_x_value(|id| {
Arc::new(RwLock::new(XValue {
block: block.read().id,
next: next.map(|x_value| x_value.read().id),
ty: ty.read().id,
subtype: XValueEnum::Expression(subtype.read().id), // b
id,
Expand All @@ -66,15 +62,13 @@ impl XValue {
/// Inter a new XValue in the store, and return it's `id`.
pub fn new_variable(
block: &Arc<RwLock<Block>>,
next: Option<&Arc<RwLock<XValue>>>,
ty: &Arc<RwLock<ValueType>>,
subtype: &Arc<RwLock<Variable>>,
store: &mut LuDogPlVecStore,
) -> Arc<RwLock<XValue>> {
store.inter_x_value(|id| {
Arc::new(RwLock::new(XValue {
block: block.read().id,
next: next.map(|x_value| x_value.read().id),
ty: ty.read().id,
subtype: XValueEnum::Variable(subtype.read().id), // b
id,
Expand All @@ -89,13 +83,6 @@ impl XValue {
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-struct-impl-nav-forward-cond-to-next"}}}
/// Navigate to [`XValue`] across R258(1-*c)
pub fn r258_x_value<'a>(&'a self, store: &'a LuDogPlVecStore) -> Vec<Arc<RwLock<XValue>>> {
match self.next {
Some(ref next) => vec![store.exhume_x_value(&next).unwrap()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-struct-impl-nav-forward-to-ty"}}}
/// Navigate to [`ValueType`] across R24(1-*)
Expand All @@ -113,26 +100,13 @@ impl XValue {
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-struct-impl-nav-backward-one-bi-cond-to-x_value"}}}
/// Navigate to [`XValue`] across R258(1c-1c)
pub fn r258c_x_value<'a>(&'a self, store: &'a LuDogPlVecStore) -> Vec<Arc<RwLock<XValue>>> {
let x_value = store
.iter_x_value()
.find(|x_value| x_value.read().next == Some(self.id));
match x_value {
Some(ref x_value) => vec![x_value.clone()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-implementation"}}}
impl PartialEq for XValue {
fn eq(&self, other: &Self) -> bool {
self.subtype == other.subtype
&& self.block == other.block
&& self.next == other.next
&& self.ty == other.ty
self.subtype == other.subtype && self.block == other.block && self.ty == other.ty
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
Expand Down
27 changes: 2 additions & 25 deletions src/v2/lu_dog_rwlock/types/x_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ pub struct XValue {
pub id: Uuid,
/// R33: [`XValue`] '' [`Block`]
pub block: Uuid,
/// R258: [`XValue`] '' [`XValue`]
pub next: Option<Uuid>,
/// R24: [`XValue`] 'is decoded by a' [`ValueType`]
pub ty: Uuid,
}
Expand All @@ -46,15 +44,13 @@ impl XValue {
/// Inter a new XValue in the store, and return it's `id`.
pub fn new_expression(
block: &Arc<RwLock<Block>>,
next: Option<&Arc<RwLock<XValue>>>,
ty: &Arc<RwLock<ValueType>>,
subtype: &Arc<RwLock<Expression>>,
store: &mut LuDogRwlockStore,
) -> Arc<RwLock<XValue>> {
let id = Uuid::new_v4();
let new = Arc::new(RwLock::new(XValue {
block: block.read().unwrap().id,
next: next.map(|x_value| x_value.read().unwrap().id),
ty: ty.read().unwrap().id,
subtype: XValueEnum::Expression(subtype.read().unwrap().id), // b
id,
Expand All @@ -67,15 +63,13 @@ impl XValue {
/// Inter a new XValue in the store, and return it's `id`.
pub fn new_variable(
block: &Arc<RwLock<Block>>,
next: Option<&Arc<RwLock<XValue>>>,
ty: &Arc<RwLock<ValueType>>,
subtype: &Arc<RwLock<Variable>>,
store: &mut LuDogRwlockStore,
) -> Arc<RwLock<XValue>> {
let id = Uuid::new_v4();
let new = Arc::new(RwLock::new(XValue {
block: block.read().unwrap().id,
next: next.map(|x_value| x_value.read().unwrap().id),
ty: ty.read().unwrap().id,
subtype: XValueEnum::Variable(subtype.read().unwrap().id), // b
id,
Expand All @@ -91,13 +85,6 @@ impl XValue {
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-struct-impl-nav-forward-cond-to-next"}}}
/// Navigate to [`XValue`] across R258(1-*c)
pub fn r258_x_value<'a>(&'a self, store: &'a LuDogRwlockStore) -> Vec<Arc<RwLock<XValue>>> {
match self.next {
Some(ref next) => vec![store.exhume_x_value(&next).unwrap()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-struct-impl-nav-forward-to-ty"}}}
/// Navigate to [`ValueType`] across R24(1-*)
Expand All @@ -119,18 +106,8 @@ impl XValue {
.collect()
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-struct-impl-nav-backward-one-bi-cond-to-x_value"}}}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-struct-impl-nav-backward-one-bi-cond-to-x_value"}}}
/// Navigate to [`XValue`] across R258(1c-1c)
pub fn r258c_x_value<'a>(&'a self, store: &'a LuDogRwlockStore) -> Vec<Arc<RwLock<XValue>>> {
let x_value = store
.iter_x_value()
.find(|x_value| x_value.read().unwrap().next == Some(self.id));
match x_value {
Some(ref x_value) => vec![x_value.clone()],
None => Vec::new(),
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"x_value-struct-impl-nav-backward-one-bi-cond-to-x_value"}}}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
}
Expand Down
Loading

0 comments on commit e1d6ba0

Please sign in to comment.