git.delta.rocks / jrsonnet / refs/commits / 7bd5bbd0756a

difftreelog

perf static object shapes

ptmvzrqoYaroslav Bolyukin2026-05-08parent: #d0b9ff2.patch.diff
in: master

29 files changed

modifiedcrates/jrsonnet-evaluator/src/analyze.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/analyze.rs
+++ b/crates/jrsonnet-evaluator/src/analyze.rs
@@ -21,16 +21,18 @@
 use jrsonnet_interner::IStr;
 use jrsonnet_ir::{
 	ArgsDesc, AssertExpr, AssertStmt, BinaryOp, BinaryOpType, BindSpec, CompSpec, Destruct, Expr,
-	ExprParams, FieldName, ForSpecData, IfElse, IfSpecData, ImportKind, LiteralType, NumValue,
-	ObjBody, ObjComp, ObjMembers, Slice, SliceDesc, Span, Spanned, UnaryOpType, Visibility,
+	ExprParams, FieldName, ForSpecData, IdentityKind, IfElse, IfSpecData, ImportKind, ObjBody,
+	ObjComp, ObjMembers, Slice, SliceDesc, Span, Spanned, TrivialVal, UnaryOpType, Visibility,
 	function::FunctionSignature,
 };
-use rustc_hash::FxHashMap;
+use rustc_hash::{FxHashMap, FxHashSet};
 use smallvec::SmallVec;
 
 use crate::{
 	arr::arridx,
 	error::{format_found, suggest_names},
+	gc::WithCapacityExt as _,
+	obj::{ObjFieldFlags, ObjShape, ShapeField, ordering::FieldIndex},
 };
 
 #[derive(Debug, Clone, Copy)]
@@ -329,6 +331,7 @@
 #[derive(Debug, Acyclic)]
 pub enum LObjBody {
 	MemberList(LObjMembers),
+	StaticMembers(Box<LObjStaticMembers>),
 	ObjComp(Box<LObjComp>),
 }
 
@@ -349,6 +352,20 @@
 }
 
 #[derive(Debug, Acyclic)]
+pub struct LObjStaticMembers {
+	pub frame_shape: ClosureShape,
+	pub this: Option<LocalSlot>,
+	pub set_dollar: bool,
+	pub uses_super: bool,
+
+	pub locals: Rc<Vec<LBind>>,
+	pub asserts: Option<Rc<LObjAsserts>>,
+
+	pub shape: Rc<ObjShape>,
+	pub bindings: Vec<Rc<(ClosureShape, LExpr)>>,
+}
+
+#[derive(Debug, Acyclic)]
 pub struct LObjComp {
 	pub frame_shape: Rc<ClosureShape>,
 	pub this: Option<LocalSlot>,
@@ -1336,7 +1353,7 @@
 	taint: &mut AnalysisResult,
 ) -> LExpr {
 	if let Expr::Function(span, params, body) = expr {
-		return analyze_function(Some(name), &span, &params, body, stack, taint);
+		return analyze_function(Some(name), span, params, body, stack, taint);
 	}
 	analyze(expr, stack, taint)
 }
@@ -1552,7 +1569,7 @@
 		BindSpec::Field {
 			value: Expr::Function(span, params, value),
 			into: Destruct::Full(name),
-		} => analyze_function(Some(name.value.clone()), &span, params, value, stack, taint),
+		} => analyze_function(Some(name.value.clone()), span, params, value, stack, taint),
 		BindSpec::Field { value, .. } => analyze(value, stack, taint),
 		BindSpec::Function {
 			params,
@@ -1694,12 +1711,69 @@
 ) -> LObjBody {
 	match obj {
 		ObjBody::MemberList(members) => {
-			LObjBody::MemberList(analyze_obj_members(members, stack, taint))
+			let lowered = analyze_obj_members(members, stack, taint);
+			match try_lower_static(lowered) {
+				Ok(static_members) => LObjBody::StaticMembers(Box::new(static_members)),
+				Err(member_list) => LObjBody::MemberList(member_list),
+			}
 		}
 		ObjBody::ObjComp(comp) => LObjBody::ObjComp(Box::new(analyze_obj_comp(comp, stack, taint))),
 	}
 }
 
+fn try_lower_static(members: LObjMembers) -> Result<LObjStaticMembers, LObjMembers> {
+	let mut seen: FxHashSet<IStr> = FxHashSet::with_capacity(members.fields.len());
+	for f in &members.fields {
+		match &f.name {
+			LFieldName::Fixed(name) => {
+				if !seen.insert(name.clone()) {
+					return Err(members);
+				}
+			}
+			LFieldName::Dyn(_) => return Err(members),
+		}
+	}
+
+	let LObjMembers {
+		frame_shape,
+		this,
+		set_dollar,
+		uses_super,
+		locals,
+		asserts,
+		fields,
+	} = members;
+
+	let mut shape_fields = Vec::with_capacity(fields.len());
+	let mut bindings = Vec::with_capacity(fields.len());
+	let mut next_index = FieldIndex::default();
+	for f in fields {
+		let LFieldName::Fixed(name) = f.name else {
+			unreachable!("checked above");
+		};
+		let index = next_index;
+		next_index = next_index.next();
+		shape_fields.push(ShapeField {
+			name,
+			flags: ObjFieldFlags::new(f.plus, f.visibility),
+			location: None,
+			index,
+		});
+		bindings.push(f.value);
+	}
+
+	Ok(LObjStaticMembers {
+		frame_shape,
+		this,
+		set_dollar,
+		uses_super,
+		locals,
+		asserts,
+		shape: Rc::new(ObjShape::new(shape_fields)),
+		bindings,
+	})
+}
+
 fn analyze_obj_members(
 	members: &ObjMembers,
 	stack: &mut AnalysisStack,
modifiedcrates/jrsonnet-evaluator/src/evaluate/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate/mod.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/mod.rs
@@ -11,11 +11,11 @@
 	operator::evaluate_binary_op_special,
 };
 use crate::{
-	Context, Error, ObjValue, ObjValueBuilder, ObjectAssertion, Result, ResultExt as _, SupThis,
-	Unbound, Val,
+	CcObjectAssertion, CcUnbound, Context, Error, MaybeUnbound, ObjValue, ObjValueBuilder,
+	ObjectAssertion, Result, ResultExt as _, StaticShapeOopObject, SupThis, Unbound, Val,
 	analyze::{
 		ClosureShape, LArgsDesc, LAssertStmt, LExpr, LFieldMember, LFieldName, LFunction,
-		LIndexPart, LObjAsserts, LObjBody, LObjMembers, LSlot,
+		LIndexPart, LObjAsserts, LObjBody, LObjMembers, LObjStaticMembers, LSlot,
 	},
 	arr::ArrValue,
 	bail,
@@ -469,6 +469,9 @@
 fn evaluate_obj_body(super_obj: Option<ObjValue>, ctx: Context, body: &LObjBody) -> Result<Val> {
 	match body {
 		LObjBody::MemberList(members) => evaluate_obj_members(super_obj, ctx, members),
+		LObjBody::StaticMembers(members) => {
+			Ok(evaluate_static_obj_members(super_obj, ctx, members))
+		}
 		LObjBody::ObjComp(comp) => evaluate_obj_comp(super_obj, ctx, comp),
 	}
 }
@@ -540,6 +543,84 @@
 	Ok(())
 }
 
+fn evaluate_static_obj_members(
+	super_obj: Option<ObjValue>,
+	ctx: Context,
+	members: &LObjStaticMembers,
+) -> Val {
+	#[derive(Trace)]
+	struct UnboundField<B: Trace> {
+		uctx: B,
+		value: Rc<(ClosureShape, LExpr)>,
+		name: IStr,
+	}
+	impl<B: Unbound<Bound = Context>> Unbound for UnboundField<B> {
+		type Bound = Val;
+		fn bind(&self, sup_this: SupThis) -> Result<Val> {
+			let a_ctx = self.uctx.bind(sup_this)?;
+			let b_ctx = Context::enter_using(&a_ctx, &self.value.0);
+			evaluate(b_ctx, &self.value.1)
+		}
+	}
+
+	let needs_unbound = members.this.is_some() || members.uses_super;
+
+	let mut bindings: Vec<MaybeUnbound> = Vec::with_capacity(members.bindings.len());
+
+	let assertion = if needs_unbound {
+		let uctx = CachedUnbound::new(evaluate_locals_unbound(
+			&ctx,
+			&members.frame_shape,
+			members.this,
+			members.locals.clone(),
+		));
+		for (binding, field) in members.bindings.iter().zip(members.shape.fields()) {
+			if let Some(v) = evaluate_trivial(&binding.1) {
+				bindings.push(MaybeUnbound::Const(v));
+				continue;
+			}
+			bindings.push(MaybeUnbound::Unbound(CcUnbound::new(UnboundField {
+				uctx: uctx.clone(),
+				value: binding.clone(),
+				name: field.name.clone(),
+			})));
+		}
+		members
+			.asserts
+			.as_ref()
+			.map(|a| CcObjectAssertion::new(evaluate_object_assertions_unbound(uctx, a.clone())))
+	} else {
+		let a_ctx = ctx
+			.pack_captures_sup_this(&members.frame_shape)
+			.enter(|fill, ctx| {
+				fill_letrec_binds(fill, ctx, &members.locals);
+			});
+		for binding in &members.bindings {
+			if let Some(v) = evaluate_trivial(&binding.1) {
+				bindings.push(MaybeUnbound::Const(v));
+				continue;
+			}
+			let env = Context::enter_using(&a_ctx, &binding.0);
+			let value = binding.clone();
+			bindings.push(MaybeUnbound::Bound(Thunk!(move || evaluate(env, &value.1))));
+		}
+		members.asserts.as_ref().map(|a| {
+			CcObjectAssertion::new(evaluate_object_assertions_static(a_ctx.clone(), a.clone()))
+		})
+	};
+
+	let mut builder = ObjValueBuilder::with_capacity(0);
+	if let Some(sup) = super_obj {
+		builder.with_super(sup);
+	}
+	builder.extend_with_core(StaticShapeOopObject::new(
+		members.shape.clone(),
+		bindings,
+		assertion,
+	));
+	Val::Obj(builder.build())
+}
+
 fn evaluate_obj_members(
 	super_obj: Option<ObjValue>,
 	ctx: Context,
modifiedcrates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/lib.rs
+++ b/crates/jrsonnet-evaluator/src/lib.rs
@@ -144,6 +144,7 @@
 	Unbound(CcUnbound<Val>),
 	/// Value is object-independent
 	Bound(Thunk<Val>),
+	Const(Val),
 }
 
 impl Debug for MaybeUnbound {
@@ -157,6 +158,7 @@
 		match self {
 			Self::Unbound(v) => v.0.bind(sup_this),
 			Self::Bound(v) => Ok(v.evaluate()?),
+			Self::Const(v) => Ok(v.clone()),
 		}
 	}
 }
modifiedcrates/jrsonnet-evaluator/src/obj/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/obj/mod.rs
+++ b/crates/jrsonnet-evaluator/src/obj/mod.rs
@@ -17,9 +17,11 @@
 use rustc_hash::{FxHashMap, FxHashSet};
 
 mod oop;
+mod static_shape;
 
 pub use jrsonnet_ir::Visibility;
 pub use oop::ObjValueBuilder;
+pub use static_shape::{ObjShape, ObjShapeBuilder, ShapeField, StaticShapeOopObject};
 
 use crate::{
 	CcUnbound, MaybeUnbound, Result, Thunk, Unbound, Val,
@@ -99,7 +101,7 @@
 #[derive(Clone, Copy, Acyclic)]
 pub struct ObjFieldFlags(u8);
 impl ObjFieldFlags {
-	fn new(add: bool, visibility: Visibility) -> Self {
+	pub fn new(add: bool, visibility: Visibility) -> Self {
 		let mut v = 0;
 		if add {
 			v |= 1;
@@ -140,7 +142,7 @@
 	pub location: Option<Span>,
 }
 
-cc_dyn!(CcObjectAssertion, ObjectAssertion);
+cc_dyn!(CcObjectAssertion, ObjectAssertion, pub fn new() {...});
 pub trait ObjectAssertion: Trace {
 	fn run(&self, sup_this: SupThis) -> Result<()>;
 }
@@ -203,6 +205,10 @@
 	fn field_visibility_core(&self, field: IStr) -> FieldVisibility;
 
 	fn run_assertions_core(&self, sup_this: SupThis) -> Result<()>;
+
+	fn has_assertion(&self) -> bool {
+		false
+	}
 }
 
 #[derive(Clone, Trace)]
@@ -1117,7 +1123,7 @@
 pub struct ExtendBuilder<'v>(&'v mut ObjValue);
 impl ObjMemberBuilder<ExtendBuilder<'_>> {
 	pub fn value(self, value: impl Into<Val>) {
-		self.binding(MaybeUnbound::Bound(Thunk::evaluated(value.into())));
+		self.binding(MaybeUnbound::Const(value.into()));
 	}
 	pub fn bindable(self, bindable: impl Unbound<Bound = Val>) {
 		self.binding(MaybeUnbound::Unbound(CcUnbound::new(bindable)));
modifiedcrates/jrsonnet-evaluator/src/obj/oop.rsdiffbeforeafterboth
before · crates/jrsonnet-evaluator/src/obj/oop.rs
1use std::{2	cell::{Cell, RefCell},3	fmt, mem,4	ops::ControlFlow,5};67use jrsonnet_gcmodule::{Cc, Trace};8use jrsonnet_ir::IStr;9use rustc_hash::{FxHashMap, FxHashSet};1011use super::{12	CcObjectAssertion, CcObjectCore, EnumFields, EnumFieldsHandler, FieldVisibility, GetFor,13	HasFieldIncludeHidden, ObjMember, ObjMemberBuilder, ObjValue, ObjValueInner, ObjectAssertion,14	ObjectCore, OmitFieldsCore, SupThis,15	ordering::{FieldIndex, SuperDepth},16};17use crate::{18	CcUnbound, MaybeUnbound, Result, Thunk, Unbound, Val, bail,19	error::ErrorKind::*,20	function::{CallLocation, FuncVal},21	gc::WithCapacityExt as _,22	in_frame,23};2425#[allow(clippy::module_name_repetitions)]26#[derive(Trace, Default)]27#[trace(tracking(force))]28pub struct OopObject {29	assertion: Option<CcObjectAssertion>,30	this_entries: FxHashMap<IStr, (ObjMember, FieldIndex)>,31}32impl fmt::Debug for OopObject {33	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {34		f.debug_struct("OopObject")35			.field("this_entries", &self.this_entries)36			.finish_non_exhaustive()37	}38}39impl OopObject {40	fn is_empty(&self) -> bool {41		self.assertion.is_none() && self.this_entries.is_empty()42	}43}44impl OopObject {45	pub fn new(46		this_entries: FxHashMap<IStr, (ObjMember, FieldIndex)>,47		assertion: Option<CcObjectAssertion>,48	) -> Self {49		Self {50			assertion,51			this_entries,52		}53	}54}5556impl ObjectCore for OopObject {57	fn enum_fields_core(58		&self,59		super_depth: &mut SuperDepth,60		handler: &mut EnumFieldsHandler<'_>,61	) -> bool {62		for (name, (member, idx)) in &self.this_entries {63			if matches!(64				handler(65					*super_depth,66					*idx,67					name.clone(),68					EnumFields::Normal(member.flags.visibility()),69				),70				ControlFlow::Break(())71			) {72				return false;73			}74		}75		true76	}7778	fn has_field_include_hidden_core(&self, name: IStr) -> HasFieldIncludeHidden {79		if self.this_entries.contains_key(&name) {80			HasFieldIncludeHidden::Exists81		} else {82			HasFieldIncludeHidden::NotFound83		}84	}8586	fn get_for_core(&self, key: IStr, sup_this: SupThis, omit_only: bool) -> Result<GetFor> {87		if omit_only {88			return Ok(GetFor::NotFound);89		}90		match self.this_entries.get(&key) {91			Some((k, _)) => {92				let v = k.invoke.evaluate(sup_this)?;93				Ok(if k.flags.add() {94					GetFor::SuperPlus(v)95				} else {96					GetFor::Final(v)97				})98			}99			None => Ok(GetFor::NotFound),100		}101	}102	fn field_visibility_core(&self, name: IStr) -> FieldVisibility {103		self.this_entries104			.get(&name)105			.map_or(FieldVisibility::NotFound, |(f, _)| {106				FieldVisibility::Found(f.flags.visibility())107			})108	}109110	fn run_assertions_core(&self, sup_this: SupThis) -> Result<()> {111		if let Some(assertion) = &self.assertion {112			assertion.0.run(sup_this)?;113		}114		Ok(())115	}116}117118#[allow(clippy::module_name_repetitions)]119pub struct ObjValueBuilder {120	sup: Vec<CcObjectCore>,121	has_assertions: bool,122123	new: OopObject,124	next_field_index: FieldIndex,125}126impl ObjValueBuilder {127	pub fn new() -> Self {128		Self::with_capacity(0)129	}130	pub fn with_capacity(capacity: usize) -> Self {131		Self {132			sup: Vec::new(),133			has_assertions: false,134			new: OopObject::new(FxHashMap::with_capacity(capacity), None),135			next_field_index: FieldIndex::default(),136		}137	}138	pub fn reserve_fields(&mut self, capacity: usize) {139		self.new.this_entries.reserve(capacity);140	}141	pub fn with_super(&mut self, super_obj: ObjValue) -> &mut Self {142		self.has_assertions |= super_obj.0.has_assertions;143		self.sup.clone_from(&super_obj.0.cores);144		self145	}146147	pub fn assert(&mut self, assertion: impl ObjectAssertion + 'static) -> &mut Self {148		assert!(149			self.new.assertion.is_none(),150			"one OopObject can only have one assertion"151		);152		self.has_assertions = true;153		self.new.assertion = Some(CcObjectAssertion::new(assertion));154		self155	}156	pub fn field(&mut self, name: impl Into<IStr>) -> ObjMemberBuilder<ValueBuilder<'_>> {157		let field_index = self.next_field_index;158		self.next_field_index = self.next_field_index.next();159		ObjMemberBuilder::new(ValueBuilder(self), name.into(), field_index)160	}161	/// Preset for common method definiton pattern:162	/// Create a hidden field with the function value.163	///164	/// `.field(name).hide().value(Val::function(value))`165	pub fn method(&mut self, name: impl Into<IStr>, value: impl Into<FuncVal>) -> &mut Self {166		self.field(name).hide().value(Val::Func(value.into()));167		self168	}169	pub fn try_method(170		&mut self,171		name: impl Into<IStr>,172		value: impl Into<FuncVal>,173	) -> Result<&mut Self> {174		self.field(name).hide().try_value(Val::Func(value.into()))?;175		Ok(self)176	}177178	pub fn extend_with_core(&mut self, core: impl ObjectCore) {179		self.commit();180		self.sup.push(CcObjectCore::new(core));181	}182183	fn commit(&mut self) {184		if !self.new.is_empty() {185			self.sup.push(CcObjectCore::new(mem::take(&mut self.new)));186		}187		self.next_field_index = FieldIndex::default();188	}189190	pub fn with_fields_omitted(&mut self, omit: FxHashSet<IStr>) {191		self.commit();192		self.sup.push(CcObjectCore::new(OmitFieldsCore {193			omit,194			prev_layers: self.sup.len(),195		}));196	}197198	pub fn build(mut self) -> ObjValue {199		self.commit();200		if self.sup.is_empty() {201			return ObjValue::empty();202		}203		let has_assertions = self.has_assertions;204		ObjValue(Cc::new(ObjValueInner {205			cores: self.sup,206			assertions_ran: Cell::new(!has_assertions),207			has_assertions,208			value_cache: RefCell::default(),209		}))210	}211}212impl Default for ObjValueBuilder {213	fn default() -> Self {214		Self::with_capacity(0)215	}216}217218pub struct ValueBuilder<'v>(&'v mut ObjValueBuilder);219impl ObjMemberBuilder<ValueBuilder<'_>> {220	/// Inserts value, replacing if it is already defined221	pub fn value(self, value: impl Into<Val>) {222		let (receiver, name, idx, member) =223			self.build_member(MaybeUnbound::Bound(Thunk::evaluated(value.into())));224		let entry = receiver.0.new.this_entries.entry(name);225		entry.insert_entry((member, idx));226	}227	/// Inserts thunk, replacing if it is already defined228	pub fn thunk(self, value: impl Into<Thunk<Val>>) {229		let (receiver, name, idx, member) = self.build_member(MaybeUnbound::Bound(value.into()));230		let entry = receiver.0.new.this_entries.entry(name);231		entry.insert_entry((member, idx));232	}233234	/// Tries to insert value, returns an error if it was already defined235	pub fn try_value(self, value: impl Into<Val>) -> Result<()> {236		self.try_thunk(Thunk::evaluated(value.into()))237	}238	pub fn try_thunk(self, value: impl Into<Thunk<Val>>) -> Result<()> {239		self.binding(MaybeUnbound::Bound(value.into()))240	}241	pub fn bindable(self, bindable: impl Unbound<Bound = Val>) -> Result<()> {242		self.binding(MaybeUnbound::Unbound(CcUnbound::new(bindable)))243	}244	pub fn binding(self, binding: MaybeUnbound) -> Result<()> {245		let (receiver, name, idx, member) = self.build_member(binding);246		let location = member.location.clone();247		let old = receiver248			.0249			.new250			.this_entries251			.insert(name.clone(), (member, idx));252		if old.is_some() {253			in_frame(254				CallLocation(location.as_ref()),255				|| format!("field <{}> initializtion", name.clone()),256				|| bail!(DuplicateFieldName(name.clone())),257			)?;258		}259		Ok(())260	}261}
after · crates/jrsonnet-evaluator/src/obj/oop.rs
1use std::{2	cell::{Cell, RefCell},3	fmt, mem,4	ops::ControlFlow,5};67use jrsonnet_gcmodule::{Cc, Trace};8use jrsonnet_ir::IStr;9use rustc_hash::{FxHashMap, FxHashSet};1011use super::{12	CcObjectAssertion, CcObjectCore, EnumFields, EnumFieldsHandler, FieldVisibility, GetFor,13	HasFieldIncludeHidden, ObjMember, ObjMemberBuilder, ObjValue, ObjValueInner, ObjectAssertion,14	ObjectCore, OmitFieldsCore, SupThis,15	ordering::{FieldIndex, SuperDepth},16};17use crate::{18	CcUnbound, MaybeUnbound, Result, Thunk, Unbound, Val, bail,19	error::ErrorKind::*,20	function::{CallLocation, FuncVal},21	gc::WithCapacityExt as _,22	in_frame,23};2425#[allow(clippy::module_name_repetitions)]26#[derive(Trace, Default)]27#[trace(tracking(force))]28pub struct OopObject {29	assertion: Option<CcObjectAssertion>,30	this_entries: FxHashMap<IStr, (ObjMember, FieldIndex)>,31}32impl fmt::Debug for OopObject {33	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {34		f.debug_struct("OopObject")35			.field("this_entries", &self.this_entries)36			.finish_non_exhaustive()37	}38}39impl OopObject {40	fn is_empty(&self) -> bool {41		self.assertion.is_none() && self.this_entries.is_empty()42	}43}44impl OopObject {45	pub fn new(46		this_entries: FxHashMap<IStr, (ObjMember, FieldIndex)>,47		assertion: Option<CcObjectAssertion>,48	) -> Self {49		Self {50			assertion,51			this_entries,52		}53	}54}5556impl ObjectCore for OopObject {57	fn enum_fields_core(58		&self,59		super_depth: &mut SuperDepth,60		handler: &mut EnumFieldsHandler<'_>,61	) -> bool {62		for (name, (member, idx)) in &self.this_entries {63			if matches!(64				handler(65					*super_depth,66					*idx,67					name.clone(),68					EnumFields::Normal(member.flags.visibility()),69				),70				ControlFlow::Break(())71			) {72				return false;73			}74		}75		true76	}7778	fn has_field_include_hidden_core(&self, name: IStr) -> HasFieldIncludeHidden {79		if self.this_entries.contains_key(&name) {80			HasFieldIncludeHidden::Exists81		} else {82			HasFieldIncludeHidden::NotFound83		}84	}8586	fn get_for_core(&self, key: IStr, sup_this: SupThis, omit_only: bool) -> Result<GetFor> {87		if omit_only {88			return Ok(GetFor::NotFound);89		}90		match self.this_entries.get(&key) {91			Some((k, _)) => {92				let v = k.invoke.evaluate(sup_this)?;93				Ok(if k.flags.add() {94					GetFor::SuperPlus(v)95				} else {96					GetFor::Final(v)97				})98			}99			None => Ok(GetFor::NotFound),100		}101	}102	fn field_visibility_core(&self, name: IStr) -> FieldVisibility {103		self.this_entries104			.get(&name)105			.map_or(FieldVisibility::NotFound, |(f, _)| {106				FieldVisibility::Found(f.flags.visibility())107			})108	}109110	fn run_assertions_core(&self, sup_this: SupThis) -> Result<()> {111		if let Some(assertion) = &self.assertion {112			assertion.0.run(sup_this)?;113		}114		Ok(())115	}116117	fn has_assertion(&self) -> bool {118		self.assertion.is_some()119	}120}121122#[allow(clippy::module_name_repetitions)]123pub struct ObjValueBuilder {124	sup: Vec<CcObjectCore>,125	has_assertions: bool,126127	new: OopObject,128	next_field_index: FieldIndex,129}130impl ObjValueBuilder {131	pub fn new() -> Self {132		Self::with_capacity(0)133	}134	pub fn with_capacity(capacity: usize) -> Self {135		Self {136			sup: Vec::new(),137			has_assertions: false,138			new: OopObject::new(FxHashMap::with_capacity(capacity), None),139			next_field_index: FieldIndex::default(),140		}141	}142	pub fn reserve_fields(&mut self, capacity: usize) {143		self.new.this_entries.reserve(capacity);144	}145	pub fn with_super(&mut self, super_obj: ObjValue) -> &mut Self {146		self.has_assertions |= super_obj.0.has_assertions;147		self.sup.clone_from(&super_obj.0.cores);148		self149	}150151	pub fn assert(&mut self, assertion: impl ObjectAssertion + 'static) -> &mut Self {152		assert!(153			self.new.assertion.is_none(),154			"one OopObject can only have one assertion"155		);156		self.has_assertions = true;157		self.new.assertion = Some(CcObjectAssertion::new(assertion));158		self159	}160	pub fn field(&mut self, name: impl Into<IStr>) -> ObjMemberBuilder<ValueBuilder<'_>> {161		let field_index = self.next_field_index;162		self.next_field_index = self.next_field_index.next();163		ObjMemberBuilder::new(ValueBuilder(self), name.into(), field_index)164	}165	/// Preset for common method definiton pattern:166	/// Create a hidden field with the function value.167	///168	/// `.field(name).hide().value(Val::function(value))`169	pub fn method(&mut self, name: impl Into<IStr>, value: impl Into<FuncVal>) -> &mut Self {170		self.field(name).hide().value(Val::Func(value.into()));171		self172	}173	pub fn try_method(174		&mut self,175		name: impl Into<IStr>,176		value: impl Into<FuncVal>,177	) -> Result<&mut Self> {178		self.field(name).hide().try_value(Val::Func(value.into()))?;179		Ok(self)180	}181182	pub fn extend_with_core(&mut self, core: impl ObjectCore) {183		self.commit();184		self.has_assertions |= core.has_assertion();185		self.sup.push(CcObjectCore::new(core));186	}187188	fn commit(&mut self) {189		if !self.new.is_empty() {190			self.sup.push(CcObjectCore::new(mem::take(&mut self.new)));191		}192		self.next_field_index = FieldIndex::default();193	}194195	pub fn with_fields_omitted(&mut self, omit: FxHashSet<IStr>) {196		self.commit();197		self.sup.push(CcObjectCore::new(OmitFieldsCore {198			omit,199			prev_layers: self.sup.len(),200		}));201	}202203	pub fn build(mut self) -> ObjValue {204		self.commit();205		if self.sup.is_empty() {206			return ObjValue::empty();207		}208		let has_assertions = self.has_assertions;209		ObjValue(Cc::new(ObjValueInner {210			cores: self.sup,211			assertions_ran: Cell::new(!has_assertions),212			has_assertions,213			value_cache: RefCell::default(),214		}))215	}216}217impl Default for ObjValueBuilder {218	fn default() -> Self {219		Self::with_capacity(0)220	}221}222223pub struct ValueBuilder<'v>(&'v mut ObjValueBuilder);224impl ObjMemberBuilder<ValueBuilder<'_>> {225	/// Inserts value, replacing if it is already defined226	pub fn value(self, value: impl Into<Val>) {227		let (receiver, name, idx, member) = self.build_member(MaybeUnbound::Const(value.into()));228		let entry = receiver.0.new.this_entries.entry(name);229		entry.insert_entry((member, idx));230	}231	/// Inserts thunk, replacing if it is already defined232	pub fn thunk(self, value: impl Into<Thunk<Val>>) {233		let (receiver, name, idx, member) = self.build_member(MaybeUnbound::Bound(value.into()));234		let entry = receiver.0.new.this_entries.entry(name);235		entry.insert_entry((member, idx));236	}237238	/// Tries to insert value, returns an error if it was already defined239	pub fn try_value(self, value: impl Into<Val>) -> Result<()> {240		self.binding(MaybeUnbound::Const(value.into()))241	}242	pub fn try_thunk(self, value: impl Into<Thunk<Val>>) -> Result<()> {243		self.binding(MaybeUnbound::Bound(value.into()))244	}245	pub fn bindable(self, bindable: impl Unbound<Bound = Val>) -> Result<()> {246		self.binding(MaybeUnbound::Unbound(CcUnbound::new(bindable)))247	}248	pub fn binding(self, binding: MaybeUnbound) -> Result<()> {249		let (receiver, name, idx, member) = self.build_member(binding);250		let location = member.location.clone();251		let old = receiver252			.0253			.new254			.this_entries255			.insert(name.clone(), (member, idx));256		if old.is_some() {257			in_frame(258				CallLocation(location.as_ref()),259				|| format!("field <{}> initializtion", name.clone()),260				|| bail!(DuplicateFieldName(name.clone())),261			)?;262		}263		Ok(())264	}265}
addedcrates/jrsonnet-evaluator/src/obj/static_shape.rsdiffbeforeafterboth
--- /dev/null
+++ b/crates/jrsonnet-evaluator/src/obj/static_shape.rs
@@ -0,0 +1,213 @@
+use std::{fmt, ops::ControlFlow, rc::Rc};
+
+use jrsonnet_gcmodule::{Acyclic, Trace, TraceBox};
+use jrsonnet_interner::IStr;
+use jrsonnet_ir::Span;
+
+use super::{
+	CcObjectAssertion, EnumFields, EnumFieldsHandler, FieldVisibility, GetFor,
+	HasFieldIncludeHidden, ObjFieldFlags, ObjectCore, SupThis, Visibility,
+	ordering::{FieldIndex, SuperDepth},
+};
+use crate::{MaybeUnbound, Result};
+
+#[derive(Acyclic, Debug)]
+pub struct ShapeField {
+	pub name: IStr,
+	pub flags: ObjFieldFlags,
+	pub location: Option<Span>,
+	pub index: FieldIndex,
+}
+
+#[derive(Acyclic, Debug)]
+pub struct ObjShape {
+	fields: Vec<ShapeField>,
+}
+
+impl ObjShape {
+	#[must_use]
+	pub fn new(fields: Vec<ShapeField>) -> Self {
+		Self { fields }
+	}
+
+	#[inline]
+	pub fn fields(&self) -> &[ShapeField] {
+		&self.fields
+	}
+
+	#[inline]
+	#[must_use]
+	pub fn len(&self) -> usize {
+		self.fields.len()
+	}
+
+	#[inline]
+	#[must_use]
+	pub fn is_empty(&self) -> bool {
+		self.fields.is_empty()
+	}
+
+	#[inline]
+	pub fn find_index(&self, name: &IStr) -> Option<usize> {
+		self.fields.iter().position(|f| &f.name == name)
+	}
+}
+
+#[derive(Trace)]
+pub struct StaticShapeOopObject {
+	shape: Rc<ObjShape>,
+	bindings: TraceBox<[MaybeUnbound]>,
+	assertion: Option<CcObjectAssertion>,
+}
+
+impl fmt::Debug for StaticShapeOopObject {
+	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+		f.debug_struct("StaticShapeOopObject")
+			.field("shape", &self.shape)
+			.field("has_assertion", &self.assertion.is_some())
+			.finish_non_exhaustive()
+	}
+}
+
+impl StaticShapeOopObject {
+	pub fn new(
+		shape: Rc<ObjShape>,
+		bindings: Vec<MaybeUnbound>,
+		assertion: Option<CcObjectAssertion>,
+	) -> Self {
+		debug_assert_eq!(
+			shape.fields.len(),
+			bindings.len(),
+			"shape arity must match bindings"
+		);
+		Self {
+			shape,
+			bindings: TraceBox(bindings.into_boxed_slice()),
+			assertion,
+		}
+	}
+
+	#[inline]
+	#[must_use]
+	pub const fn shape(&self) -> &Rc<ObjShape> {
+		&self.shape
+	}
+}
+
+impl ObjectCore for StaticShapeOopObject {
+	fn enum_fields_core(
+		&self,
+		super_depth: &mut SuperDepth,
+		handler: &mut EnumFieldsHandler<'_>,
+	) -> bool {
+		for field in &self.shape.fields {
+			if matches!(
+				handler(
+					*super_depth,
+					field.index,
+					field.name.clone(),
+					EnumFields::Normal(field.flags.visibility()),
+				),
+				ControlFlow::Break(())
+			) {
+				return false;
+			}
+		}
+		true
+	}
+
+	fn has_field_include_hidden_core(&self, name: IStr) -> HasFieldIncludeHidden {
+		if self.shape.find_index(&name).is_some() {
+			HasFieldIncludeHidden::Exists
+		} else {
+			HasFieldIncludeHidden::NotFound
+		}
+	}
+
+	fn get_for_core(&self, key: IStr, sup_this: SupThis, omit_only: bool) -> Result<GetFor> {
+		if omit_only {
+			return Ok(GetFor::NotFound);
+		}
+		let Some(i) = self.shape.find_index(&key) else {
+			return Ok(GetFor::NotFound);
+		};
+		let field = &self.shape.fields[i];
+		let v = self.bindings[i].evaluate(sup_this)?;
+		Ok(if field.flags.add() {
+			GetFor::SuperPlus(v)
+		} else {
+			GetFor::Final(v)
+		})
+	}
+
+	fn field_visibility_core(&self, field: IStr) -> FieldVisibility {
+		self.shape
+			.find_index(&field)
+			.map_or(FieldVisibility::NotFound, |i| {
+				FieldVisibility::Found(self.shape.fields[i].flags.visibility())
+			})
+	}
+
+	fn run_assertions_core(&self, sup_this: SupThis) -> Result<()> {
+		if let Some(assertion) = &self.assertion {
+			assertion.0.run(sup_this)?;
+		}
+		Ok(())
+	}
+
+	fn has_assertion(&self) -> bool {
+		self.assertion.is_some()
+	}
+}
+
+pub struct ObjShapeBuilder {
+	fields: Vec<ShapeField>,
+	next_index: FieldIndex,
+}
+
+impl ObjShapeBuilder {
+	#[must_use]
+	pub fn new() -> Self {
+		Self {
+			fields: Vec::new(),
+			next_index: FieldIndex::default(),
+		}
+	}
+
+	#[must_use]
+	pub fn with_capacity(cap: usize) -> Self {
+		Self {
+			fields: Vec::with_capacity(cap),
+			next_index: FieldIndex::default(),
+		}
+	}
+
+	pub fn field(
+		&mut self,
+		name: impl Into<IStr>,
+		visibility: Visibility,
+		add: bool,
+		location: Option<Span>,
+	) -> &mut Self {
+		let index = self.next_index;
+		self.next_index = self.next_index.next();
+		self.fields.push(ShapeField {
+			name: name.into(),
+			flags: ObjFieldFlags::new(add, visibility),
+			location,
+			index,
+		});
+		self
+	}
+
+	#[must_use]
+	pub fn build(self) -> ObjShape {
+		ObjShape::new(self.fields)
+	}
+}
+
+impl Default for ObjShapeBuilder {
+	fn default() -> Self {
+		Self::new()
+	}
+}
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@array_comp.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@array_comp.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@array_comp.jsonnet.snap
@@ -1,5 +1,6 @@
 ---
 source: crates/jrsonnet-evaluator/src/analyze.rs
+assertion_line: 2175
 expression: rendered
 input_file: crates/jrsonnet-evaluator/src/analysis_tests/array_comp.jsonnet
 ---
@@ -26,8 +27,10 @@
                 ),
             ),
             op: Mul,
-            rhs: Num(
-                2.0,
+            rhs: Trivial(
+                Num(
+                    2.0,
+                ),
             ),
         },
         compspecs: [
@@ -41,12 +44,8 @@
                         0,
                     ),
                 ),
-                over: Arr {
-                    shape: ClosureShape {
-                        captures: [],
-                        n_locals: 0,
-                    },
-                    items: [
+                over: ArrConst(
+                    [
                         Num(
                             1.0,
                         ),
@@ -57,7 +56,7 @@
                             3.0,
                         ),
                     ],
-                },
+                ),
                 loop_invariant: true,
             },
             If(
@@ -70,8 +69,10 @@
                         ),
                     ),
                     op: Gt,
-                    rhs: Num(
-                        1.0,
+                    rhs: Trivial(
+                        Num(
+                            1.0,
+                        ),
                     ),
                 },
             ),
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@dollar_deeply_nested.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@dollar_deeply_nested.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@dollar_deeply_nested.jsonnet.snap
@@ -20,8 +20,8 @@
 --- diagnostics ---
 --- lir ---
 Obj(
-    MemberList(
-        LObjMembers {
+    StaticMembers(
+        LObjStaticMembers {
             frame_shape: ClosureShape {
                 captures: [],
                 n_locals: 1,
@@ -35,74 +35,145 @@
             uses_super: false,
             locals: [],
             asserts: None,
-            fields: [
-                LFieldMember {
-                    name: Fixed(
-                        "top",
-                    ),
-                    plus: false,
-                    visibility: Normal,
-                    value: (
-                        ClosureShape {
-                            captures: [],
-                            n_locals: 0,
+            shape: ObjShape {
+                fields: [
+                    ShapeField {
+                        name: "top",
+                        flags: ObjFieldFlags {
+                            add: false,
+                            visibility: Normal,
+                        },
+                        location: None,
+                        index: FieldIndex(
+                            (),
+                        ),
+                    },
+                    ShapeField {
+                        name: "a",
+                        flags: ObjFieldFlags {
+                            add: false,
+                            visibility: Normal,
                         },
+                        location: None,
+                        index: FieldIndex(
+                            (),
+                        ),
+                    },
+                ],
+            },
+            bindings: [
+                (
+                    ClosureShape {
+                        captures: [],
+                        n_locals: 0,
+                    },
+                    Trivial(
                         Str(
                             "outer",
                         ),
                     ),
-                },
-                LFieldMember {
-                    name: Fixed(
-                        "a",
-                    ),
-                    plus: false,
-                    visibility: Normal,
-                    value: (
-                        ClosureShape {
-                            captures: [],
-                            n_locals: 0,
-                        },
-                        Obj(
-                            MemberList(
-                                LObjMembers {
-                                    frame_shape: ClosureShape {
-                                        captures: [
-                                            Local(
-                                                LocalSlot(
-                                                    0,
-                                                ),
+                ),
+                (
+                    ClosureShape {
+                        captures: [],
+                        n_locals: 0,
+                    },
+                    Obj(
+                        StaticMembers(
+                            LObjStaticMembers {
+                                frame_shape: ClosureShape {
+                                    captures: [
+                                        Local(
+                                            LocalSlot(
+                                                0,
                                             ),
-                                        ],
-                                        n_locals: 1,
-                                    },
-                                    this: None,
-                                    set_dollar: false,
-                                    uses_super: false,
-                                    locals: [],
-                                    asserts: None,
+                                        ),
+                                    ],
+                                    n_locals: 1,
+                                },
+                                this: None,
+                                set_dollar: false,
+                                uses_super: false,
+                                locals: [],
+                                asserts: None,
+                                shape: ObjShape {
                                     fields: [
-                                        LFieldMember {
-                                            name: Fixed(
-                                                "b",
+                                        ShapeField {
+                                            name: "b",
+                                            flags: ObjFieldFlags {
+                                                add: false,
+                                                visibility: Normal,
+                                            },
+                                            location: None,
+                                            index: FieldIndex(
+                                                (),
                                             ),
-                                            plus: false,
-                                            visibility: Normal,
-                                            value: (
-                                                ClosureShape {
-                                                    captures: [
-                                                        Capture(
-                                                            CaptureSlot(
-                                                                0,
+                                        },
+                                    ],
+                                },
+                                bindings: [
+                                    (
+                                        ClosureShape {
+                                            captures: [
+                                                Capture(
+                                                    CaptureSlot(
+                                                        0,
+                                                    ),
+                                                ),
+                                            ],
+                                            n_locals: 0,
+                                        },
+                                        Obj(
+                                            StaticMembers(
+                                                LObjStaticMembers {
+                                                    frame_shape: ClosureShape {
+                                                        captures: [
+                                                            Capture(
+                                                                CaptureSlot(
+                                                                    0,
+                                                                ),
                                                             ),
+                                                        ],
+                                                        n_locals: 1,
+                                                    },
+                                                    this: Some(
+                                                        LocalSlot(
+                                                            0,
                                                         ),
-                                                    ],
-                                                    n_locals: 0,
-                                                },
-                                                Obj(
-                                                    MemberList(
-                                                        LObjMembers {
-                                                            frame_shape: ClosureShape {
+                                                    ),
+                                                    set_dollar: false,
+                                                    uses_super: false,
+                                                    locals: [],
+                                                    asserts: None,
+                                                    shape: ObjShape {
+                                                        fields: [
+                                                            ShapeField {
+                                                                name: "c",
+                                                                flags: ObjFieldFlags {
+                                                                    add: false,
+                                                                    visibility: Normal,
+                                                                },
+                                                                location: None,
+                                                                index: FieldIndex(
+                                                                    (),
+                                                                ),
+                                                            },
+                                                            ShapeField {
+                                                                name: "d",
+                                                                flags: ObjFieldFlags {
+                                                                    add: false,
+                                                                    visibility: Normal,
+                                                                },
+                                                                location: None,
+                                                                index: FieldIndex(
+                                                                    (),
+                                                                ),
+                                                            },
+                                                        ],
+                                                    },
+                                                    bindings: [
+                                                        (
+                                                            ClosureShape {
                                                                 captures: [
                                                                     Capture(
                                                                         CaptureSlot(
@@ -110,86 +181,51 @@
                                                                         ),
                                                                     ),
                                                                 ],
-                                                                n_locals: 1,
+                                                                n_locals: 0,
                                                             },
-                                                            this: Some(
-                                                                LocalSlot(
-                                                                    0,
-                                                                ),
-                                                            ),
-                                                            set_dollar: false,
-                                                            uses_super: false,
-                                                            locals: [],
-                                                            asserts: None,
-                                                            fields: [
-                                                                LFieldMember {
-                                                                    name: Fixed(
-                                                                        "c",
+                                                            Index {
+                                                                indexable: Slot(
+                                                                    Capture(
+                                                                        CaptureSlot(
+                                                                            0,
+                                                                        ),
                                                                     ),
-                                                                    plus: false,
-                                                                    visibility: Normal,
-                                                                    value: (
-                                                                        ClosureShape {
-                                                                            captures: [
-                                                                                Capture(
-                                                                                    CaptureSlot(
-                                                                                        0,
-                                                                                    ),
-                                                                                ),
-                                                                            ],
-                                                                            n_locals: 0,
-                                                                        },
-                                                                        Index {
-                                                                            indexable: Slot(
-                                                                                Capture(
-                                                                                    CaptureSlot(
-                                                                                        0,
-                                                                                    ),
-                                                                                ),
+                                                                ),
+                                                                parts: [
+                                                                    LIndexPart {
+                                                                        span: virtual:<test>:45-48,
+                                                                        value: Trivial(
+                                                                            Str(
+                                                                                "top",
                                                                             ),
-                                                                            parts: [
-                                                                                LIndexPart {
-                                                                                    span: virtual:<test>:45-48,
-                                                                                    value: Str(
-                                                                                        "top",
-                                                                                    ),
-                                                                                },
-                                                                            ],
-                                                                        },
-                                                                    ),
-                                                                },
-                                                                LFieldMember {
-                                                                    name: Fixed(
-                                                                        "d",
-                                                                    ),
-                                                                    plus: false,
-                                                                    visibility: Normal,
-                                                                    value: (
-                                                                        ClosureShape {
-                                                                            captures: [],
-                                                                            n_locals: 0,
-                                                                        },
-                                                                        Slot(
-                                                                            Local(
-                                                                                LocalSlot(
-                                                                                    0,
-                                                                                ),
-                                                                            ),
                                                                         ),
+                                                                    },
+                                                                ],
+                                                            },
+                                                        ),
+                                                        (
+                                                            ClosureShape {
+                                                                captures: [],
+                                                                n_locals: 0,
+                                                            },
+                                                            Slot(
+                                                                Local(
+                                                                    LocalSlot(
+                                                                        0,
                                                                     ),
-                                                                },
-                                                            ],
-                                                        },
-                                                    ),
-                                                ),
+                                                                ),
+                                                            ),
+                                                        ),
+                                                    ],
+                                                },
                                             ),
-                                        },
-                                    ],
-                                },
-                            ),
+                                        ),
+                                    ),
+                                ],
+                            },
                         ),
                     ),
-                },
+                ),
             ],
         },
     ),
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@dollar_outside_object.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@dollar_outside_object.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@dollar_outside_object.jsonnet.snap
@@ -1,5 +1,6 @@
 ---
 source: crates/jrsonnet-evaluator/src/analyze.rs
+assertion_line: 2175
 expression: rendered
 input_file: crates/jrsonnet-evaluator/src/analysis_tests/dollar_outside_object.jsonnet
 ---
@@ -21,8 +22,10 @@
     parts: [
         LIndexPart {
             span: virtual:<test>:2-3,
-            value: Str(
-                "a",
+            value: Trivial(
+                Str(
+                    "a",
+                ),
             ),
         },
     ],
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@function_def.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@function_def.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@function_def.jsonnet.snap
@@ -1,5 +1,6 @@
 ---
 source: crates/jrsonnet-evaluator/src/analyze.rs
+assertion_line: 2175
 expression: rendered
 input_file: crates/jrsonnet-evaluator/src/analysis_tests/function_def.jsonnet
 ---
@@ -108,11 +109,15 @@
             ),
             args: LArgsDesc {
                 unnamed: [
-                    Num(
-                        1.0,
+                    Trivial(
+                        Num(
+                            1.0,
+                        ),
                     ),
-                    Num(
-                        2.0,
+                    Trivial(
+                        Num(
+                            2.0,
+                        ),
                     ),
                 ],
                 names: [],
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@hoistable_local.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@hoistable_local.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@hoistable_local.jsonnet.snap
@@ -1,5 +1,6 @@
 ---
 source: crates/jrsonnet-evaluator/src/analyze.rs
+assertion_line: 2175
 expression: rendered
 input_file: crates/jrsonnet-evaluator/src/analysis_tests/hoistable_local.jsonnet
 ---
@@ -31,8 +32,10 @@
                     captures: [],
                     n_locals: 0,
                 },
-                value: Num(
-                    1.0,
+                value: Trivial(
+                    Num(
+                        1.0,
+                    ),
                 ),
             },
         ],
@@ -60,12 +63,16 @@
                             n_locals: 0,
                         },
                         value: BinaryOp {
-                            lhs: Num(
-                                10.0,
+                            lhs: Trivial(
+                                Num(
+                                    10.0,
+                                ),
                             ),
                             op: Add,
-                            rhs: Num(
-                                20.0,
+                            rhs: Trivial(
+                                Num(
+                                    20.0,
+                                ),
                             ),
                         },
                     },
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@ifelse.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@ifelse.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@ifelse.jsonnet.snap
@@ -1,7 +1,8 @@
 ---
 source: crates/jrsonnet-evaluator/src/analyze.rs
+assertion_line: 2175
 expression: rendered
-input_file: crates/jrsonnet-evaluator/src/analyze_tests/ifelse.jsonnet
+input_file: crates/jrsonnet-evaluator/src/analysis_tests/ifelse.jsonnet
 ---
 --- source ---
 if true then 1 else 2
@@ -12,15 +13,21 @@
 --- diagnostics ---
 --- lir ---
 IfElse {
-    cond: Bool(
-        true,
+    cond: Trivial(
+        Bool(
+            true,
+        ),
     ),
-    cond_then: Num(
-        1.0,
+    cond_then: Trivial(
+        Num(
+            1.0,
+        ),
     ),
     cond_else: Some(
-        Num(
-            2.0,
+        Trivial(
+            Num(
+                2.0,
+            ),
         ),
     ),
 }
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@literal.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@literal.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@literal.jsonnet.snap
@@ -1,7 +1,8 @@
 ---
 source: crates/jrsonnet-evaluator/src/analyze.rs
+assertion_line: 2175
 expression: rendered
-input_file: crates/jrsonnet-evaluator/src/analyze_tests/literal.jsonnet
+input_file: crates/jrsonnet-evaluator/src/analysis_tests/literal.jsonnet
 ---
 --- source ---
 42
@@ -11,6 +12,8 @@
 errored: false
 --- diagnostics ---
 --- lir ---
-Num(
-    42.0,
+Trivial(
+    Num(
+        42.0,
+    ),
 )
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@loop_invariant.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@loop_invariant.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@loop_invariant.jsonnet.snap
@@ -1,5 +1,6 @@
 ---
 source: crates/jrsonnet-evaluator/src/analyze.rs
+assertion_line: 2175
 expression: rendered
 input_file: crates/jrsonnet-evaluator/src/analysis_tests/loop_invariant.jsonnet
 ---
@@ -64,19 +65,25 @@
                         parts: [
                             LIndexPart {
                                 span: virtual:<test>:21-26,
-                                value: Str(
-                                    "range",
+                                value: Trivial(
+                                    Str(
+                                        "range",
+                                    ),
                                 ),
                             },
                         ],
                     },
                     args: LArgsDesc {
                         unnamed: [
-                            Num(
-                                1.0,
+                            Trivial(
+                                Num(
+                                    1.0,
+                                ),
                             ),
-                            Num(
-                                1000.0,
+                            Trivial(
+                                Num(
+                                    1000.0,
+                                ),
                             ),
                         ],
                         names: [],
@@ -110,19 +117,25 @@
                         parts: [
                             LIndexPart {
                                 span: virtual:<test>:49-54,
-                                value: Str(
-                                    "range",
+                                value: Trivial(
+                                    Str(
+                                        "range",
+                                    ),
                                 ),
                             },
                         ],
                     },
                     args: LArgsDesc {
                         unnamed: [
-                            Num(
-                                1.0,
+                            Trivial(
+                                Num(
+                                    1.0,
+                                ),
                             ),
-                            Num(
-                                1000.0,
+                            Trivial(
+                                Num(
+                                    1000.0,
+                                ),
                             ),
                         ],
                         names: [],
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@mutual_recursion.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@mutual_recursion.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@mutual_recursion.jsonnet.snap
@@ -1,5 +1,6 @@
 ---
 source: crates/jrsonnet-evaluator/src/analyze.rs
+assertion_line: 2175
 expression: rendered
 input_file: crates/jrsonnet-evaluator/src/analysis_tests/mutual_recursion.jsonnet
 ---
@@ -46,8 +47,10 @@
                     captures: [],
                     n_locals: 0,
                 },
-                value: Num(
-                    1.0,
+                value: Trivial(
+                    Num(
+                        1.0,
+                    ),
                 ),
             },
         ],
@@ -60,8 +63,10 @@
                 ),
             ),
             op: Add,
-            rhs: Num(
-                2.0,
+            rhs: Trivial(
+                Num(
+                    2.0,
+                ),
             ),
         },
     },
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@nested_object_independent.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@nested_object_independent.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@nested_object_independent.jsonnet.snap
@@ -17,8 +17,8 @@
 --- diagnostics ---
 --- lir ---
 Obj(
-    MemberList(
-        LObjMembers {
+    StaticMembers(
+        LObjStaticMembers {
             frame_shape: ClosureShape {
                 captures: [],
                 n_locals: 1,
@@ -28,103 +28,133 @@
             uses_super: false,
             locals: [],
             asserts: None,
-            fields: [
-                LFieldMember {
-                    name: Fixed(
-                        "a",
-                    ),
-                    plus: false,
-                    visibility: Normal,
-                    value: (
-                        ClosureShape {
-                            captures: [],
-                            n_locals: 0,
+            shape: ObjShape {
+                fields: [
+                    ShapeField {
+                        name: "a",
+                        flags: ObjFieldFlags {
+                            add: false,
+                            visibility: Normal,
                         },
+                        location: None,
+                        index: FieldIndex(
+                            (),
+                        ),
+                    },
+                    ShapeField {
+                        name: "b",
+                        flags: ObjFieldFlags {
+                            add: false,
+                            visibility: Normal,
+                        },
+                        location: None,
+                        index: FieldIndex(
+                            (),
+                        ),
+                    },
+                ],
+            },
+            bindings: [
+                (
+                    ClosureShape {
+                        captures: [],
+                        n_locals: 0,
+                    },
+                    Trivial(
                         Num(
                             1.0,
                         ),
                     ),
-                },
-                LFieldMember {
-                    name: Fixed(
-                        "b",
-                    ),
-                    plus: false,
-                    visibility: Normal,
-                    value: (
-                        ClosureShape {
-                            captures: [],
-                            n_locals: 0,
-                        },
-                        Obj(
-                            MemberList(
-                                LObjMembers {
-                                    frame_shape: ClosureShape {
-                                        captures: [],
-                                        n_locals: 1,
-                                    },
-                                    this: Some(
-                                        LocalSlot(
-                                            0,
-                                        ),
+                ),
+                (
+                    ClosureShape {
+                        captures: [],
+                        n_locals: 0,
+                    },
+                    Obj(
+                        StaticMembers(
+                            LObjStaticMembers {
+                                frame_shape: ClosureShape {
+                                    captures: [],
+                                    n_locals: 1,
+                                },
+                                this: Some(
+                                    LocalSlot(
+                                        0,
                                     ),
-                                    set_dollar: false,
-                                    uses_super: false,
-                                    locals: [],
-                                    asserts: None,
+                                ),
+                                set_dollar: false,
+                                uses_super: false,
+                                locals: [],
+                                asserts: None,
+                                shape: ObjShape {
                                     fields: [
-                                        LFieldMember {
-                                            name: Fixed(
-                                                "c",
+                                        ShapeField {
+                                            name: "c",
+                                            flags: ObjFieldFlags {
+                                                add: false,
+                                                visibility: Normal,
+                                            },
+                                            location: None,
+                                            index: FieldIndex(
+                                                (),
                                             ),
-                                            plus: false,
-                                            visibility: Normal,
-                                            value: (
-                                                ClosureShape {
-                                                    captures: [],
-                                                    n_locals: 0,
-                                                },
-                                                Num(
-                                                    2.0,
-                                                ),
+                                        },
+                                        ShapeField {
+                                            name: "d",
+                                            flags: ObjFieldFlags {
+                                                add: false,
+                                                visibility: Normal,
+                                            },
+                                            location: None,
+                                            index: FieldIndex(
+                                                (),
                                             ),
                                         },
-                                        LFieldMember {
-                                            name: Fixed(
-                                                "d",
+                                    ],
+                                },
+                                bindings: [
+                                    (
+                                        ClosureShape {
+                                            captures: [],
+                                            n_locals: 0,
+                                        },
+                                        Trivial(
+                                            Num(
+                                                2.0,
                                             ),
-                                            plus: false,
-                                            visibility: Normal,
-                                            value: (
-                                                ClosureShape {
-                                                    captures: [],
-                                                    n_locals: 0,
-                                                },
-                                                Index {
-                                                    indexable: Slot(
-                                                        Local(
-                                                            LocalSlot(
-                                                                0,
-                                                            ),
+                                        ),
+                                    ),
+                                    (
+                                        ClosureShape {
+                                            captures: [],
+                                            n_locals: 0,
+                                        },
+                                        Index {
+                                            indexable: Slot(
+                                                Local(
+                                                    LocalSlot(
+                                                        0,
+                                                    ),
+                                                ),
+                                            ),
+                                            parts: [
+                                                LIndexPart {
+                                                    span: virtual:<test>:35-36,
+                                                    value: Trivial(
+                                                        Str(
+                                                            "c",
                                                         ),
                                                     ),
-                                                    parts: [
-                                                        LIndexPart {
-                                                            span: virtual:<test>:35-36,
-                                                            value: Str(
-                                                                "c",
-                                                            ),
-                                                        },
-                                                    ],
                                                 },
-                                            ),
+                                            ],
                                         },
-                                    ],
-                                },
-                            ),
+                                    ),
+                                ],
+                            },
                         ),
                     ),
-                },
+                ),
             ],
         },
     ),
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@object_comp.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@object_comp.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@object_comp.jsonnet.snap
@@ -1,5 +1,6 @@
 ---
 source: crates/jrsonnet-evaluator/src/analyze.rs
+assertion_line: 2175
 expression: rendered
 input_file: crates/jrsonnet-evaluator/src/analysis_tests/object_comp.jsonnet
 ---
@@ -71,12 +72,8 @@
                             0,
                         ),
                     ),
-                    over: Arr {
-                        shape: ClosureShape {
-                            captures: [],
-                            n_locals: 0,
-                        },
-                        items: [
+                    over: ArrConst(
+                        [
                             Str(
                                 "a",
                             ),
@@ -84,7 +81,7 @@
                                 "b",
                             ),
                         ],
-                    },
+                    ),
                     loop_invariant: true,
                 },
             ],
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@object_dollar.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@object_dollar.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@object_dollar.jsonnet.snap
@@ -12,8 +12,8 @@
 --- diagnostics ---
 --- lir ---
 Obj(
-    MemberList(
-        LObjMembers {
+    StaticMembers(
+        LObjStaticMembers {
             frame_shape: ClosureShape {
                 captures: [],
                 n_locals: 1,
@@ -27,95 +27,119 @@
             uses_super: false,
             locals: [],
             asserts: None,
-            fields: [
-                LFieldMember {
-                    name: Fixed(
-                        "a",
-                    ),
-                    plus: false,
-                    visibility: Normal,
-                    value: (
-                        ClosureShape {
-                            captures: [],
-                            n_locals: 0,
+            shape: ObjShape {
+                fields: [
+                    ShapeField {
+                        name: "a",
+                        flags: ObjFieldFlags {
+                            add: false,
+                            visibility: Normal,
                         },
+                        location: None,
+                        index: FieldIndex(
+                            (),
+                        ),
+                    },
+                    ShapeField {
+                        name: "b",
+                        flags: ObjFieldFlags {
+                            add: false,
+                            visibility: Normal,
+                        },
+                        location: None,
+                        index: FieldIndex(
+                            (),
+                        ),
+                    },
+                ],
+            },
+            bindings: [
+                (
+                    ClosureShape {
+                        captures: [],
+                        n_locals: 0,
+                    },
+                    Trivial(
                         Num(
                             1.0,
                         ),
                     ),
-                },
-                LFieldMember {
-                    name: Fixed(
-                        "b",
-                    ),
-                    plus: false,
-                    visibility: Normal,
-                    value: (
-                        ClosureShape {
-                            captures: [],
-                            n_locals: 0,
-                        },
-                        Obj(
-                            MemberList(
-                                LObjMembers {
-                                    frame_shape: ClosureShape {
-                                        captures: [
-                                            Local(
-                                                LocalSlot(
-                                                    0,
-                                                ),
+                ),
+                (
+                    ClosureShape {
+                        captures: [],
+                        n_locals: 0,
+                    },
+                    Obj(
+                        StaticMembers(
+                            LObjStaticMembers {
+                                frame_shape: ClosureShape {
+                                    captures: [
+                                        Local(
+                                            LocalSlot(
+                                                0,
                                             ),
-                                        ],
-                                        n_locals: 1,
-                                    },
-                                    this: None,
-                                    set_dollar: false,
-                                    uses_super: false,
-                                    locals: [],
-                                    asserts: None,
+                                        ),
+                                    ],
+                                    n_locals: 1,
+                                },
+                                this: None,
+                                set_dollar: false,
+                                uses_super: false,
+                                locals: [],
+                                asserts: None,
+                                shape: ObjShape {
                                     fields: [
-                                        LFieldMember {
-                                            name: Fixed(
-                                                "c",
+                                        ShapeField {
+                                            name: "c",
+                                            flags: ObjFieldFlags {
+                                                add: false,
+                                                visibility: Normal,
+                                            },
+                                            location: None,
+                                            index: FieldIndex(
+                                                (),
                                             ),
-                                            plus: false,
-                                            visibility: Normal,
-                                            value: (
-                                                ClosureShape {
-                                                    captures: [
-                                                        Capture(
-                                                            CaptureSlot(
-                                                                0,
-                                                            ),
-                                                        ),
-                                                    ],
-                                                    n_locals: 0,
-                                                },
-                                                Index {
-                                                    indexable: Slot(
-                                                        Capture(
-                                                            CaptureSlot(
-                                                                0,
-                                                            ),
+                                        },
+                                    ],
+                                },
+                                bindings: [
+                                    (
+                                        ClosureShape {
+                                            captures: [
+                                                Capture(
+                                                    CaptureSlot(
+                                                        0,
+                                                    ),
+                                                ),
+                                            ],
+                                            n_locals: 0,
+                                        },
+                                        Index {
+                                            indexable: Slot(
+                                                Capture(
+                                                    CaptureSlot(
+                                                        0,
+                                                    ),
+                                                ),
+                                            ),
+                                            parts: [
+                                                LIndexPart {
+                                                    span: virtual:<test>:18-19,
+                                                    value: Trivial(
+                                                        Str(
+                                                            "a",
                                                         ),
                                                     ),
-                                                    parts: [
-                                                        LIndexPart {
-                                                            span: virtual:<test>:18-19,
-                                                            value: Str(
-                                                                "a",
-                                                            ),
-                                                        },
-                                                    ],
                                                 },
-                                            ),
+                                            ],
                                         },
-                                    ],
-                                },
-                            ),
+                                    ),
+                                ],
+                            },
                         ),
                     ),
-                },
+                ),
             ],
         },
     ),
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@object_self.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@object_self.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@object_self.jsonnet.snap
@@ -12,8 +12,8 @@
 --- diagnostics ---
 --- lir ---
 Obj(
-    MemberList(
-        LObjMembers {
+    StaticMembers(
+        LObjStaticMembers {
             frame_shape: ClosureShape {
                 captures: [],
                 n_locals: 1,
@@ -27,53 +27,69 @@
             uses_super: false,
             locals: [],
             asserts: None,
-            fields: [
-                LFieldMember {
-                    name: Fixed(
-                        "a",
-                    ),
-                    plus: false,
-                    visibility: Normal,
-                    value: (
-                        ClosureShape {
-                            captures: [],
-                            n_locals: 0,
+            shape: ObjShape {
+                fields: [
+                    ShapeField {
+                        name: "a",
+                        flags: ObjFieldFlags {
+                            add: false,
+                            visibility: Normal,
+                        },
+                        location: None,
+                        index: FieldIndex(
+                            (),
+                        ),
+                    },
+                    ShapeField {
+                        name: "b",
+                        flags: ObjFieldFlags {
+                            add: false,
+                            visibility: Normal,
                         },
+                        location: None,
+                        index: FieldIndex(
+                            (),
+                        ),
+                    },
+                ],
+            },
+            bindings: [
+                (
+                    ClosureShape {
+                        captures: [],
+                        n_locals: 0,
+                    },
+                    Trivial(
                         Num(
                             1.0,
                         ),
                     ),
-                },
-                LFieldMember {
-                    name: Fixed(
-                        "b",
-                    ),
-                    plus: false,
-                    visibility: Normal,
-                    value: (
-                        ClosureShape {
-                            captures: [],
-                            n_locals: 0,
-                        },
-                        Index {
-                            indexable: Slot(
-                                Local(
-                                    LocalSlot(
-                                        0,
-                                    ),
+                ),
+                (
+                    ClosureShape {
+                        captures: [],
+                        n_locals: 0,
+                    },
+                    Index {
+                        indexable: Slot(
+                            Local(
+                                LocalSlot(
+                                    0,
                                 ),
                             ),
-                            parts: [
-                                LIndexPart {
-                                    span: virtual:<test>:16-17,
-                                    value: Str(
+                        ),
+                        parts: [
+                            LIndexPart {
+                                span: virtual:<test>:16-17,
+                                value: Trivial(
+                                    Str(
                                         "a",
                                     ),
-                                },
-                            ],
-                        },
-                    ),
-                },
+                                ),
+                            },
+                        ],
+                    },
+                ),
             ],
         },
     ),
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@object_with_locals.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@object_with_locals.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@object_with_locals.jsonnet.snap
@@ -16,8 +16,8 @@
 --- diagnostics ---
 --- lir ---
 Obj(
-    MemberList(
-        LObjMembers {
+    StaticMembers(
+        LObjStaticMembers {
             frame_shape: ClosureShape {
                 captures: [],
                 n_locals: 2,
@@ -36,59 +36,75 @@
                         captures: [],
                         n_locals: 0,
                     },
-                    value: Num(
-                        10.0,
+                    value: Trivial(
+                        Num(
+                            10.0,
+                        ),
                     ),
                 },
             ],
             asserts: None,
-            fields: [
-                LFieldMember {
-                    name: Fixed(
-                        "a",
+            shape: ObjShape {
+                fields: [
+                    ShapeField {
+                        name: "a",
+                        flags: ObjFieldFlags {
+                            add: false,
+                            visibility: Normal,
+                        },
+                        location: None,
+                        index: FieldIndex(
+                            (),
+                        ),
+                    },
+                    ShapeField {
+                        name: "b",
+                        flags: ObjFieldFlags {
+                            add: false,
+                            visibility: Normal,
+                        },
+                        location: None,
+                        index: FieldIndex(
+                            (),
+                        ),
+                    },
+                ],
+            },
+            bindings: [
+                (
+                    ClosureShape {
+                        captures: [],
+                        n_locals: 0,
+                    },
+                    Slot(
+                        Local(
+                            LocalSlot(
+                                1,
+                            ),
+                        ),
                     ),
-                    plus: false,
-                    visibility: Normal,
-                    value: (
-                        ClosureShape {
-                            captures: [],
-                            n_locals: 0,
-                        },
-                        Slot(
+                ),
+                (
+                    ClosureShape {
+                        captures: [],
+                        n_locals: 0,
+                    },
+                    BinaryOp {
+                        lhs: Slot(
                             Local(
                                 LocalSlot(
                                     1,
                                 ),
                             ),
                         ),
-                    ),
-                },
-                LFieldMember {
-                    name: Fixed(
-                        "b",
-                    ),
-                    plus: false,
-                    visibility: Normal,
-                    value: (
-                        ClosureShape {
-                            captures: [],
-                            n_locals: 0,
-                        },
-                        BinaryOp {
-                            lhs: Slot(
-                                Local(
-                                    LocalSlot(
-                                        1,
-                                    ),
-                                ),
-                            ),
-                            op: Mul,
-                            rhs: Num(
+                        op: Mul,
+                        rhs: Trivial(
+                            Num(
                                 2.0,
                             ),
-                        },
-                    ),
-                },
+                        ),
+                    },
+                ),
             ],
         },
     ),
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@redeclared_local.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@redeclared_local.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@redeclared_local.jsonnet.snap
@@ -1,5 +1,6 @@
 ---
 source: crates/jrsonnet-evaluator/src/analyze.rs
+assertion_line: 2175
 expression: rendered
 input_file: crates/jrsonnet-evaluator/src/analysis_tests/redeclared_local.jsonnet
 ---
@@ -31,8 +32,10 @@
                     captures: [],
                     n_locals: 0,
                 },
-                value: Num(
-                    1.0,
+                value: Trivial(
+                    Num(
+                        1.0,
+                    ),
                 ),
             },
         ],
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@shadowing.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@shadowing.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@shadowing.jsonnet.snap
@@ -1,5 +1,6 @@
 ---
 source: crates/jrsonnet-evaluator/src/analyze.rs
+assertion_line: 2175
 expression: rendered
 input_file: crates/jrsonnet-evaluator/src/analysis_tests/shadowing.jsonnet
 ---
@@ -32,8 +33,10 @@
                     captures: [],
                     n_locals: 0,
                 },
-                value: Num(
-                    1.0,
+                value: Trivial(
+                    Num(
+                        1.0,
+                    ),
                 ),
             },
         ],
@@ -54,8 +57,10 @@
                             captures: [],
                             n_locals: 0,
                         },
-                        value: Num(
-                            2.0,
+                        value: Trivial(
+                            Num(
+                                2.0,
+                            ),
                         ),
                     },
                 ],
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@simple_local.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@simple_local.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@simple_local.jsonnet.snap
@@ -1,5 +1,6 @@
 ---
 source: crates/jrsonnet-evaluator/src/analyze.rs
+assertion_line: 2175
 expression: rendered
 input_file: crates/jrsonnet-evaluator/src/analysis_tests/simple_local.jsonnet
 ---
@@ -28,8 +29,10 @@
                     captures: [],
                     n_locals: 0,
                 },
-                value: Num(
-                    1.0,
+                value: Trivial(
+                    Num(
+                        1.0,
+                    ),
                 ),
             },
         ],
@@ -42,8 +45,10 @@
                 ),
             ),
             op: Add,
-            rhs: Num(
-                2.0,
+            rhs: Trivial(
+                Num(
+                    2.0,
+                ),
             ),
         },
     },
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@slice.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@slice.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@slice.jsonnet.snap
@@ -1,6 +1,6 @@
 ---
 source: crates/jrsonnet-evaluator/src/analyze.rs
-assertion_line: 2017
+assertion_line: 2175
 expression: rendered
 input_file: crates/jrsonnet-evaluator/src/analysis_tests/slice.jsonnet
 ---
@@ -14,12 +14,8 @@
 --- lir ---
 Slice(
     LSliceExpr {
-        value: Arr {
-            shape: ClosureShape {
-                captures: [],
-                n_locals: 0,
-            },
-            items: [
+        value: ArrConst(
+            [
                 Num(
                     1.0,
                 ),
@@ -36,15 +32,19 @@
                     5.0,
                 ),
             ],
-        },
+        ),
         start: Some(
-            Num(
-                1.0,
+            Trivial(
+                Num(
+                    1.0,
+                ),
             ),
         ),
         end: Some(
-            Num(
-                3.0,
+            Trivial(
+                Num(
+                    3.0,
+                ),
             ),
         ),
         step: None,
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@super_outside_object.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@super_outside_object.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@super_outside_object.jsonnet.snap
@@ -1,5 +1,6 @@
 ---
 source: crates/jrsonnet-evaluator/src/analyze.rs
+assertion_line: 2175
 expression: rendered
 input_file: crates/jrsonnet-evaluator/src/analysis_tests/super_outside_object.jsonnet
 ---
@@ -21,8 +22,10 @@
     parts: [
         LIndexPart {
             span: virtual:<test>:6-7,
-            value: Str(
-                "a",
+            value: Trivial(
+                Str(
+                    "a",
+                ),
             ),
         },
     ],
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@super_usage.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@super_usage.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@super_usage.jsonnet.snap
@@ -13,8 +13,8 @@
 --- lir ---
 BinaryOp {
     lhs: Obj(
-        MemberList(
-            LObjMembers {
+        StaticMembers(
+            LObjStaticMembers {
                 frame_shape: ClosureShape {
                     captures: [],
                     n_locals: 1,
@@ -24,47 +24,63 @@
                 uses_super: false,
                 locals: [],
                 asserts: None,
-                fields: [
-                    LFieldMember {
-                        name: Fixed(
-                            "a",
-                        ),
-                        plus: false,
-                        visibility: Normal,
-                        value: (
-                            ClosureShape {
-                                captures: [],
-                                n_locals: 0,
+                shape: ObjShape {
+                    fields: [
+                        ShapeField {
+                            name: "a",
+                            flags: ObjFieldFlags {
+                                add: false,
+                                visibility: Normal,
                             },
+                            location: None,
+                            index: FieldIndex(
+                                (),
+                            ),
+                        },
+                        ShapeField {
+                            name: "b",
+                            flags: ObjFieldFlags {
+                                add: false,
+                                visibility: Normal,
+                            },
+                            location: None,
+                            index: FieldIndex(
+                                (),
+                            ),
+                        },
+                    ],
+                },
+                bindings: [
+                    (
+                        ClosureShape {
+                            captures: [],
+                            n_locals: 0,
+                        },
+                        Trivial(
                             Num(
                                 1.0,
                             ),
                         ),
-                    },
-                    LFieldMember {
-                        name: Fixed(
-                            "b",
-                        ),
-                        plus: false,
-                        visibility: Normal,
-                        value: (
-                            ClosureShape {
-                                captures: [],
-                                n_locals: 0,
-                            },
+                    ),
+                    (
+                        ClosureShape {
+                            captures: [],
+                            n_locals: 0,
+                        },
+                        Trivial(
                             Num(
                                 2.0,
                             ),
                         ),
-                    },
+                    ),
                 ],
             },
         ),
     ),
     op: Add,
     rhs: Obj(
-        MemberList(
-            LObjMembers {
+        StaticMembers(
+            LObjStaticMembers {
                 frame_shape: ClosureShape {
                     captures: [],
                     n_locals: 1,
@@ -78,67 +94,85 @@
                 uses_super: true,
                 locals: [],
                 asserts: None,
-                fields: [
-                    LFieldMember {
-                        name: Fixed(
-                            "a",
-                        ),
-                        plus: false,
-                        visibility: Normal,
-                        value: (
-                            ClosureShape {
-                                captures: [],
-                                n_locals: 0,
+                shape: ObjShape {
+                    fields: [
+                        ShapeField {
+                            name: "a",
+                            flags: ObjFieldFlags {
+                                add: false,
+                                visibility: Normal,
+                            },
+                            location: None,
+                            index: FieldIndex(
+                                (),
+                            ),
+                        },
+                        ShapeField {
+                            name: "c",
+                            flags: ObjFieldFlags {
+                                add: false,
+                                visibility: Normal,
                             },
-                            BinaryOp {
-                                lhs: Index {
-                                    indexable: Super,
-                                    parts: [
-                                        LIndexPart {
-                                            span: virtual:<test>:28-29,
-                                            value: Str(
+                            location: None,
+                            index: FieldIndex(
+                                (),
+                            ),
+                        },
+                    ],
+                },
+                bindings: [
+                    (
+                        ClosureShape {
+                            captures: [],
+                            n_locals: 0,
+                        },
+                        BinaryOp {
+                            lhs: Index {
+                                indexable: Super,
+                                parts: [
+                                    LIndexPart {
+                                        span: virtual:<test>:28-29,
+                                        value: Trivial(
+                                            Str(
                                                 "a",
                                             ),
-                                        },
-                                    ],
-                                },
-                                op: Add,
-                                rhs: Num(
+                                        ),
+                                    },
+                                ],
+                            },
+                            op: Add,
+                            rhs: Trivial(
+                                Num(
                                     10.0,
                                 ),
-                            },
-                        ),
-                    },
-                    LFieldMember {
-                        name: Fixed(
-                            "c",
-                        ),
-                        plus: false,
-                        visibility: Normal,
-                        value: (
-                            ClosureShape {
-                                captures: [],
-                                n_locals: 0,
-                            },
-                            Index {
-                                indexable: Slot(
-                                    Local(
-                                        LocalSlot(
-                                            0,
-                                        ),
+                            ),
+                        },
+                    ),
+                    (
+                        ClosureShape {
+                            captures: [],
+                            n_locals: 0,
+                        },
+                        Index {
+                            indexable: Slot(
+                                Local(
+                                    LocalSlot(
+                                        0,
                                     ),
                                 ),
-                                parts: [
-                                    LIndexPart {
-                                        span: virtual:<test>:44-45,
-                                        value: Str(
+                            ),
+                            parts: [
+                                LIndexPart {
+                                    span: virtual:<test>:44-45,
+                                    value: Trivial(
+                                        Str(
                                             "b",
                                         ),
-                                    },
-                                ],
-                            },
-                        ),
-                    },
+                                    ),
+                                },
+                            ],
+                        },
+                    ),
                 ],
             },
         ),
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@undefined_var.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@undefined_var.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@undefined_var.jsonnet.snap
@@ -1,5 +1,6 @@
 ---
 source: crates/jrsonnet-evaluator/src/analyze.rs
+assertion_line: 2175
 expression: rendered
 input_file: crates/jrsonnet-evaluator/src/analysis_tests/undefined_var.jsonnet
 ---
@@ -19,7 +20,9 @@
         "ref",
     ),
     op: Add,
-    rhs: Num(
-        1.0,
+    rhs: Trivial(
+        Num(
+            1.0,
+        ),
     ),
 }
modifiedcrates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@unused_local.jsonnet.snapdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@unused_local.jsonnet.snap
+++ b/crates/jrsonnet-evaluator/src/snapshots/jrsonnet_evaluator__analyze__tests__snapshots@unused_local.jsonnet.snap
@@ -1,5 +1,6 @@
 ---
 source: crates/jrsonnet-evaluator/src/analyze.rs
+assertion_line: 2175
 expression: rendered
 input_file: crates/jrsonnet-evaluator/src/analysis_tests/unused_local.jsonnet
 ---
@@ -31,13 +32,17 @@
                     captures: [],
                     n_locals: 0,
                 },
-                value: Num(
-                    1.0,
+                value: Trivial(
+                    Num(
+                        1.0,
+                    ),
                 ),
             },
         ],
-        body: Num(
-            2.0,
+        body: Trivial(
+            Num(
+                2.0,
+            ),
         ),
     },
 )
modifiedcrates/jrsonnet-evaluator/src/tla.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/tla.rs
+++ b/crates/jrsonnet-evaluator/src/tla.rs
@@ -5,7 +5,7 @@
 use jrsonnet_ir::{SourceFifo, SourcePath};
 
 use crate::{
-	Result, Thunk, Val,
+	Result, Thunk, Val, ensure_sufficient_stack,
 	function::{CallLocation, PreparedFuncVal},
 	in_description_frame, with_state,
 };
@@ -21,7 +21,7 @@
 }
 impl TlaArg {
 	pub fn evaluate_tailstrict(&self) -> Result<Val> {
-		match self {
+		ensure_sufficient_stack(|| match self {
 			Self::String(s) => Ok(Val::string(s.clone())),
 			Self::Val(val) => Ok(val.clone()),
 			Self::Lazy(lazy) => Ok(lazy.evaluate()?),
@@ -38,7 +38,7 @@
 					SourcePath::new(SourceFifo("<inline code>".to_owned(), p.as_bytes().into()));
 				s.import_resolved(resolved)
 			}),
-		}
+		})
 	}
 	pub fn evaluate(&self) -> Result<Thunk<Val>> {
 		match self {