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
before · crates/jrsonnet-evaluator/src/lib.rs
1//! jsonnet interpreter implementation2#![cfg_attr(nightly, feature(thread_local))]34// For jrsonnet-macros5extern crate self as jrsonnet_evaluator;67mod arr;8pub mod async_import;9mod ctx;10mod dynamic;11pub mod error;12mod evaluate;13pub mod function;14pub mod gc;15mod import;16mod integrations;17pub mod manifest;18mod obj;19pub mod stack;20pub mod stdlib;21pub mod tla;22pub mod trace;23pub mod typed;24pub mod val;2526use std::{27	any::Any,28	cell::{RefCell, RefMut},29	clone::Clone,30	collections::hash_map::Entry,31	fmt::{self, Debug},32	marker::PhantomData,33	rc::Rc,34};3536pub use ctx::*;37pub use dynamic::*;38pub use error::{Error, ErrorKind::*, Result, ResultExt, StackTraceElement};39pub use evaluate::ensure_sufficient_stack;40use function::CallLocation;41pub use import::*;42use jrsonnet_gcmodule::{Cc, Trace, cc_dyn};43pub use jrsonnet_interner::{IBytes, IStr};44use jrsonnet_ir::Expr;45pub use jrsonnet_ir::{46	NumValue, Source, SourceDefaultIgnoreJpath, SourcePath, SourceUrl, SourceVirtual, Span,47};48#[doc(hidden)]49pub use jrsonnet_macros;5051#[cfg(not(any(feature = "ir-parser", feature = "peg-parser")))]52compile_error!("at least one of `ir-parser` or `peg-parser` features must be enabled");5354pub use error::SyntaxError;55pub use obj::*;56pub use rustc_hash;57use rustc_hash::FxHashMap;58use stack::check_depth;59pub use tla::apply_tla;60pub use val::{Thunk, Val};6162pub mod analyze;63use self::analyze::{LExpr, analyze_root};64use crate::gc::WithCapacityExt as _;6566#[allow(clippy::needless_return)]67pub(crate) fn parse_jsonnet(code: &str, source: Source) -> Result<Expr, SyntaxError> {68	#[cfg(feature = "peg-parser")]69	{70		use std::sync::LazyLock;71		static USE_LEGACY_PARSER: LazyLock<bool> =72			LazyLock::new(|| std::env::var_os("JRSONNET_LEGACY_PARSER").is_some());7374		if *USE_LEGACY_PARSER {75			return parse_peg(code, source);76		}77	}78	#[cfg(feature = "ir-parser")]79	{80		return parse_ir(code, source);81	}82	#[cfg(feature = "peg-parser")]83	{84		return parse_peg(code, source);85	}86}8788#[cfg(feature = "ir-parser")]89fn parse_ir(code: &str, source: Source) -> Result<Expr, SyntaxError> {90	jrsonnet_ir_parser::parse(code, &jrsonnet_ir_parser::ParserSettings { source }).map_err(|e| {91		SyntaxError {92			message: e.message,93			location: e.location,94		}95	})96}9798#[cfg(feature = "peg-parser")]99fn parse_peg(code: &str, source: Source) -> Result<Expr, SyntaxError> {100	jrsonnet_peg_parser::parse(code, &jrsonnet_peg_parser::ParserSettings { source }).map_err(|e| {101		let message = e102			.expected103			.tokens()104			.find(|t| t.starts_with("!!!"))105			.map_or_else(106				|| {107					format!(108						"expected {}, got {:?}",109						e.expected,110						code.chars()111							.nth(e.location.0)112							.map_or_else(|| "EOF".into(), |c: char| c.to_string())113					)114				},115				|v| v[3..].into(),116			);117		SyntaxError {118			message,119			location: e.location,120		}121	})122}123124cc_dyn!(125	#[derive(Clone)]126	CcUnbound<V>,127	Unbound<Bound = V>128);129130/// Thunk without bound `super`/`this`131/// object inheritance may be overriden multiple times, and will be fixed only on field read132pub trait Unbound: Trace {133	/// Type of value after object context is bound134	type Bound;135	/// Create value bound to specified object context136	fn bind(&self, sup_this: SupThis) -> Result<Self::Bound>;137}138139/// Object fields may, or may not depend on `this`/`super`, this enum allows cheaper reuse of object-independent fields for native code140/// Standard jsonnet fields are always unbound141#[derive(Clone, Trace)]142pub enum MaybeUnbound {143	/// Value needs to be bound to `this`/`super`144	Unbound(CcUnbound<Val>),145	/// Value is object-independent146	Bound(Thunk<Val>),147}148149impl Debug for MaybeUnbound {150	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {151		write!(f, "MaybeUnbound")152	}153}154impl MaybeUnbound {155	/// Attach object context to value, if required156	pub fn evaluate(&self, sup_this: SupThis) -> Result<Val> {157		match self {158			Self::Unbound(v) => v.0.bind(sup_this),159			Self::Bound(v) => Ok(v.evaluate()?),160		}161	}162}163164cc_dyn!(CcContextInitializer, ContextInitializer);165166/// During import, this trait will be called to create initial context for file.167/// It may initialize global variables, stdlib for example.168pub trait ContextInitializer {169	/// For composability: extend builder. May panic if this initialization is not supported,170	/// and the context may only be created via `initialize`.171	fn populate(&self, for_file: Source, builder: &mut InitialContextBuilder);172	/// Allows upcasting from abstract to concrete context initializer.173	/// jrsonnet by itself doesn't use this method, it is allowed for it to panic.174	fn as_any(&self) -> &dyn Any;175}176impl<T> ContextInitializer for &T177where178	T: ContextInitializer,179{180	fn populate(&self, for_file: Source, builder: &mut InitialContextBuilder) {181		(*self).populate(for_file, builder);182	}183184	fn as_any(&self) -> &dyn Any {185		(*self).as_any()186	}187}188189/// Context initializer which adds nothing.190impl ContextInitializer for () {191	fn populate(&self, _for_file: Source, _builder: &mut InitialContextBuilder) {}192	fn as_any(&self) -> &dyn Any {193		self194	}195}196197impl<T> ContextInitializer for Option<T>198where199	T: ContextInitializer + 'static,200{201	fn populate(&self, for_file: Source, builder: &mut InitialContextBuilder) {202		if let Some(ctx) = self {203			ctx.populate(for_file, builder);204		}205	}206207	fn as_any(&self) -> &dyn Any {208		self209	}210}211212macro_rules! impl_context_initializer {213	($($gen:ident)*) => {214		#[allow(non_snake_case)]215		impl<$($gen: ContextInitializer + Trace,)*> ContextInitializer for ($($gen,)*) {216			fn populate(&self, for_file: Source, builder: &mut InitialContextBuilder) {217				let ($($gen,)*) = self;218				$($gen.populate(for_file.clone(), builder);)*219			}220			fn as_any(&self) -> &dyn Any {221				self222			}223		}224	};225	($($cur:ident)* @ $c:ident $($rest:ident)*) => {226		impl_context_initializer!($($cur)*);227		impl_context_initializer!($($cur)* $c @ $($rest)*);228	};229	($($cur:ident)* @) => {230		impl_context_initializer!($($cur)*);231	}232}233impl_context_initializer! {234	A @ B C D E F G235}236237#[derive(Trace)]238struct FileData {239	string: Option<IStr>,240	bytes: Option<IBytes>,241	parsed: Option<Rc<Expr>>,242	evaluated: Option<Val>,243244	evaluating: bool,245}246impl FileData {247	fn new_string(data: IStr) -> Self {248		Self {249			string: Some(data),250			bytes: None,251			parsed: None,252			evaluated: None,253			evaluating: false,254		}255	}256	fn new_bytes(data: IBytes) -> Self {257		Self {258			string: None,259			bytes: Some(data),260			parsed: None,261			evaluated: None,262			evaluating: false,263		}264	}265	pub(crate) fn get_string(&mut self) -> Option<IStr> {266		if self.string.is_none() {267			self.string = Some(268				self.bytes269					.as_ref()270					.expect("either string or bytes should be set")271					.clone()272					.cast_str()?,273			);274		}275		Some(self.string.clone().expect("just set"))276	}277}278279#[derive(Trace)]280pub struct EvaluationStateInternals {281	/// Internal state282	file_cache: RefCell<FxHashMap<SourcePath, FileData>>,283	/// Context initializer, which will be used for imports and everything284	/// [`NoopContextInitializer`] is used by default, most likely you want to have `jrsonnet-stdlib`285	context_initializer: CcContextInitializer,286	/// Used to resolve file locations/contents287	import_resolver: Rc<dyn ImportResolver>,288}289290/// Maintains stack trace and import resolution291#[derive(Clone, Trace)]292pub struct State(Cc<EvaluationStateInternals>);293294thread_local! {295	pub static DEFAULT_STATE: State = State::builder().build();296	pub static STATE: RefCell<Option<State>> = const {RefCell::new(None)};297}298pub struct StateEnterGuard(PhantomData<()>);299impl Drop for StateEnterGuard {300	fn drop(&mut self) {301		STATE.with_borrow_mut(|v| *v = None);302	}303}304305pub fn with_state<V>(v: impl FnOnce(State) -> V) -> V {306	if let Some(state) = STATE.with_borrow(Clone::clone) {307		v(state)308	} else {309		let s = DEFAULT_STATE.with(Clone::clone);310		v(s)311	}312}313314impl State {315	pub fn enter(&self) -> StateEnterGuard {316		self.try_enter().expect("entered state already exists")317	}318	pub fn try_enter(&self) -> Option<StateEnterGuard> {319		STATE.with_borrow_mut(|v| {320			if v.is_none() {321				*v = Some(self.clone());322				Some(StateEnterGuard(PhantomData))323			} else {324				None325			}326		})327	}328	/// Should only be called with path retrieved from [`resolve_path`], may panic otherwise329	pub fn import_resolved_str(&self, path: SourcePath) -> Result<IStr> {330		let mut file_cache = self.file_cache();331		let mut file = file_cache.entry(path.clone());332333		let file = match file {334			Entry::Occupied(ref mut d) => d.get_mut(),335			Entry::Vacant(v) => {336				let data = self.import_resolver().load_file_contents(&path)?;337				v.insert(FileData::new_string(338					std::str::from_utf8(&data)339						.map_err(|_| ImportBadFileUtf8(path.clone()))?340						.into(),341				))342			}343		};344		Ok(file345			.get_string()346			.ok_or_else(|| ImportBadFileUtf8(path.clone()))?)347	}348	/// Should only be called with path retrieved from [`resolve_path`], may panic otherwise349	pub fn import_resolved_bin(&self, path: SourcePath) -> Result<IBytes> {350		let mut file_cache = self.file_cache();351		let mut file = file_cache.entry(path.clone());352353		let file = match file {354			Entry::Occupied(ref mut d) => d.get_mut(),355			Entry::Vacant(v) => {356				let data = self.import_resolver().load_file_contents(&path)?;357				v.insert(FileData::new_bytes(data.as_slice().into()))358			}359		};360		if let Some(str) = &file.bytes {361			return Ok(str.clone());362		}363		if file.bytes.is_none() {364			file.bytes = Some(365				file.string366					.as_ref()367					.expect("either string or bytes should be set")368					.clone()369					.cast_bytes(),370			);371		}372		Ok(file.bytes.as_ref().expect("just set").clone())373	}374	/// Should only be called with path retrieved from [`resolve_path`], may panic otherwise375	pub fn import_resolved(&self, path: SourcePath) -> Result<Val> {376		let mut file_cache = self.file_cache();377		let mut file = file_cache.entry(path.clone());378379		let file = match file {380			Entry::Occupied(ref mut d) => d.get_mut(),381			Entry::Vacant(v) => {382				let data = self.import_resolver().load_file_contents(&path)?;383				v.insert(FileData::new_string(384					std::str::from_utf8(&data)385						.map_err(|_| ImportBadFileUtf8(path.clone()))?386						.into(),387				))388			}389		};390		if let Some(val) = &file.evaluated {391			return Ok(val.clone());392		}393		let code = file394			.get_string()395			.ok_or_else(|| ImportBadFileUtf8(path.clone()))?;396		let file_name = Source::new(path.clone(), code.clone());397		if file.parsed.is_none() {398			file.parsed = Some(399				parse_jsonnet(&code, file_name.clone())400					.map(Rc::new)401					.map_err(|e| {402						let span = e.location.clone();403						let mut err = Error::from(ImportSyntaxError {404							path: file_name.clone(),405							error: Box::new(e),406						});407						err.trace_mut().0.push(StackTraceElement {408							location: Some(span),409							desc: "parse imported".to_string(),410						});411						err412					})?,413			);414		}415		let parsed = file.parsed.as_ref().expect("just set").clone();416		if file.evaluating {417			bail!(InfiniteRecursionDetected)418		}419		file.evaluating = true;420		// Dropping file cache guard here, as evaluation may use this map too421		drop(file_cache);422		let (externals, thunks) = self.create_default_context(file_name).build();423		let report = analyze_root(&parsed, externals);424		if report.errored {425			return Err(StaticAnalysisError(report.diagnostics_list).into());426		}427		debug_assert_eq!(report.root_shape.n_locals as usize, thunks.len());428		debug_assert!(report.root_shape.captures.is_empty());429		let ctx = Context::root(thunks);430		let res = evaluate::evaluate(ctx, &report.lir);431432		let mut file_cache = self.file_cache();433		let mut file = file_cache.entry(path);434435		let Entry::Occupied(file) = &mut file else {436			unreachable!("this file was just here")437		};438		let file = file.get_mut();439		file.evaluating = false;440		match res {441			Ok(v) => {442				file.evaluated = Some(v.clone());443				Ok(v)444			}445			Err(e) => Err(e),446		}447	}448449	/// Has same semantics as `import 'path'` called from `from` file450	pub fn import_from(&self, from: &SourcePath, path: impl AsPathLike) -> Result<Val> {451		let resolved = self.resolve_from(from, &path)?;452		self.import_resolved(resolved)453	}454	pub fn import(&self, path: impl AsPathLike) -> Result<Val> {455		let resolved = self.resolve_from_default(&path)?;456		self.import_resolved(resolved)457	}458459	/// Creates context with all passed global variables460	pub fn create_default_context(&self, source: Source) -> InitialContextBuilder {461		self.create_default_context_with(source, &())462	}463464	/// Creates context with all passed global variables, calling custom modifier465	pub fn create_default_context_with(466		&self,467		source: Source,468		context_initializer: &dyn ContextInitializer,469	) -> InitialContextBuilder {470		let default_initializer = self.context_initializer();471		let mut builder = InitialContextBuilder::new();472		default_initializer.populate(source.clone(), &mut builder);473		context_initializer.populate(source, &mut builder);474475		builder476	}477}478479/// Internals480impl State {481	fn file_cache(&self) -> RefMut<'_, FxHashMap<SourcePath, FileData>> {482		self.0.file_cache.borrow_mut()483	}484}485/// Executes code creating a new stack frame, to be replaced with try{}486pub fn in_frame<T>(487	e: CallLocation<'_>,488	frame_desc: impl FnOnce() -> String,489	f: impl FnOnce() -> Result<T>,490) -> Result<T> {491	let _guard = check_depth()?;492493	f().with_description_src(e, frame_desc)494}495496/// Executes code creating a new stack frame, to be replaced with try{}497pub fn in_description_frame<T>(498	frame_desc: impl FnOnce() -> String,499	f: impl FnOnce() -> Result<T>,500) -> Result<T> {501	let _guard = check_depth()?;502503	f().with_description(frame_desc)504}505506#[derive(Trace)]507pub struct InitialUnderscore(pub Thunk<Val>);508impl ContextInitializer for InitialUnderscore {509	fn populate(&self, _for_file: Source, builder: &mut InitialContextBuilder) {510		builder.bind("_", self.0.clone());511	}512513	fn as_any(&self) -> &dyn Any {514		self515	}516}517518pub struct PreparedSnippet {519	lir: LExpr,520	thunks: Vec<Thunk<Val>>,521}522523/// Raw methods evaluate passed values but don't perform TLA execution524impl State {525	/// Parses and analyses the given snippet with a custom context526	/// modifier.527	pub fn prepare_snippet_with(528		&self,529		name: impl Into<IStr>,530		code: impl Into<IStr>,531		context_initializer: &dyn ContextInitializer,532	) -> Result<PreparedSnippet> {533		let code = code.into();534		let source = Source::new_virtual(name.into(), code.clone());535		let parsed = parse_jsonnet(&code, source.clone()).map_err(|e| ImportSyntaxError {536			path: source.clone(),537			error: Box::new(e),538		})?;539		let (externals, thunks) = self540			.create_default_context_with(source, context_initializer)541			.build();542		let report = analyze_root(&parsed, externals);543		if report.errored {544			return Err(StaticAnalysisError(report.diagnostics_list).into());545		}546		debug_assert_eq!(report.root_shape.n_locals as usize, thunks.len());547		debug_assert!(report.root_shape.captures.is_empty());548		Ok(PreparedSnippet {549			lir: report.lir,550			thunks,551		})552	}553	/// Parses and analyses the given snippet554	pub fn prepare_snippet(555		&self,556		name: impl Into<IStr>,557		code: impl Into<IStr>,558	) -> Result<PreparedSnippet> {559		self.prepare_snippet_with(name, code, &())560	}561	pub fn evaluate_prepared_snippet(&self, prepared: &PreparedSnippet) -> Result<Val> {562		let ctx = Context::root(prepared.thunks.clone());563		evaluate::evaluate(ctx, &prepared.lir)564	}565	/// Parses and evaluates the given snippet with custom context modifier566	pub fn evaluate_snippet_with(567		&self,568		name: impl Into<IStr>,569		code: impl Into<IStr>,570		context_initializer: &dyn ContextInitializer,571	) -> Result<Val> {572		let prepared = self.prepare_snippet_with(name, code, context_initializer)?;573		self.evaluate_prepared_snippet(&prepared)574	}575	/// Parses and evaluates the given snippet576	pub fn evaluate_snippet(&self, name: impl Into<IStr>, code: impl Into<IStr>) -> Result<Val> {577		self.evaluate_snippet_with(name, code, &())578	}579}580581/// Settings utilities582impl State {583	// Only panics in case of [`ImportResolver`] contract violation584	#[allow(clippy::missing_panics_doc)]585	pub fn resolve_from(&self, from: &SourcePath, path: &dyn AsPathLike) -> Result<SourcePath> {586		self.import_resolver().resolve_from(from, path)587	}588	#[allow(clippy::missing_panics_doc)]589	pub fn resolve_from_default(&self, path: &dyn AsPathLike) -> Result<SourcePath> {590		self.import_resolver().resolve_from_default(path)591	}592	pub fn import_resolver(&self) -> &dyn ImportResolver {593		&*self.0.import_resolver594	}595	pub fn context_initializer(&self) -> &dyn ContextInitializer {596		&*self.0.context_initializer.0597	}598}599600impl State {601	pub fn builder() -> StateBuilder {602		StateBuilder::default()603	}604}605606impl Default for State {607	fn default() -> Self {608		Self::builder().build()609	}610}611612#[derive(Default)]613pub struct StateBuilder {614	import_resolver: Option<Rc<dyn ImportResolver>>,615	context_initializer: Option<CcContextInitializer>,616}617impl StateBuilder {618	pub fn import_resolver(&mut self, import_resolver: impl ImportResolver) -> &mut Self {619		let _ = self.import_resolver.insert(Rc::new(import_resolver));620		self621	}622	pub fn context_initializer(623		&mut self,624		context_initializer: impl ContextInitializer + Trace,625	) -> &mut Self {626		let _ = self627			.context_initializer628			.insert(CcContextInitializer::new(context_initializer));629		self630	}631	pub fn build(mut self) -> State {632		State(Cc::new(EvaluationStateInternals {633			file_cache: RefCell::new(FxHashMap::new()),634			context_initializer: self635				.context_initializer636				.take()637				.unwrap_or_else(|| CcContextInitializer::new(())),638			import_resolver: self639				.import_resolver640				.take()641				.unwrap_or_else(|| Rc::new(DummyImportResolver)),642		}))643	}644}
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
--- a/crates/jrsonnet-evaluator/src/obj/oop.rs
+++ b/crates/jrsonnet-evaluator/src/obj/oop.rs
@@ -113,6 +113,10 @@
 		}
 		Ok(())
 	}
+
+	fn has_assertion(&self) -> bool {
+		self.assertion.is_some()
+	}
 }
 
 #[allow(clippy::module_name_repetitions)]
@@ -177,6 +181,7 @@
 
 	pub fn extend_with_core(&mut self, core: impl ObjectCore) {
 		self.commit();
+		self.has_assertions |= core.has_assertion();
 		self.sup.push(CcObjectCore::new(core));
 	}
 
@@ -219,8 +224,7 @@
 impl ObjMemberBuilder<ValueBuilder<'_>> {
 	/// Inserts value, replacing if it is already defined
 	pub fn value(self, value: impl Into<Val>) {
-		let (receiver, name, idx, member) =
-			self.build_member(MaybeUnbound::Bound(Thunk::evaluated(value.into())));
+		let (receiver, name, idx, member) = self.build_member(MaybeUnbound::Const(value.into()));
 		let entry = receiver.0.new.this_entries.entry(name);
 		entry.insert_entry((member, idx));
 	}
@@ -233,7 +237,7 @@
 
 	/// Tries to insert value, returns an error if it was already defined
 	pub fn try_value(self, value: impl Into<Val>) -> Result<()> {
-		self.try_thunk(Thunk::evaluated(value.into()))
+		self.binding(MaybeUnbound::Const(value.into()))
 	}
 	pub fn try_thunk(self, value: impl Into<Thunk<Val>>) -> Result<()> {
 		self.binding(MaybeUnbound::Bound(value.into()))
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 {