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
after · 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	Const(Val),148}149150impl Debug for MaybeUnbound {151	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {152		write!(f, "MaybeUnbound")153	}154}155impl MaybeUnbound {156	/// Attach object context to value, if required157	pub fn evaluate(&self, sup_this: SupThis) -> Result<Val> {158		match self {159			Self::Unbound(v) => v.0.bind(sup_this),160			Self::Bound(v) => Ok(v.evaluate()?),161			Self::Const(v) => Ok(v.clone()),162		}163	}164}165166cc_dyn!(CcContextInitializer, ContextInitializer);167168/// During import, this trait will be called to create initial context for file.169/// It may initialize global variables, stdlib for example.170pub trait ContextInitializer {171	/// For composability: extend builder. May panic if this initialization is not supported,172	/// and the context may only be created via `initialize`.173	fn populate(&self, for_file: Source, builder: &mut InitialContextBuilder);174	/// Allows upcasting from abstract to concrete context initializer.175	/// jrsonnet by itself doesn't use this method, it is allowed for it to panic.176	fn as_any(&self) -> &dyn Any;177}178impl<T> ContextInitializer for &T179where180	T: ContextInitializer,181{182	fn populate(&self, for_file: Source, builder: &mut InitialContextBuilder) {183		(*self).populate(for_file, builder);184	}185186	fn as_any(&self) -> &dyn Any {187		(*self).as_any()188	}189}190191/// Context initializer which adds nothing.192impl ContextInitializer for () {193	fn populate(&self, _for_file: Source, _builder: &mut InitialContextBuilder) {}194	fn as_any(&self) -> &dyn Any {195		self196	}197}198199impl<T> ContextInitializer for Option<T>200where201	T: ContextInitializer + 'static,202{203	fn populate(&self, for_file: Source, builder: &mut InitialContextBuilder) {204		if let Some(ctx) = self {205			ctx.populate(for_file, builder);206		}207	}208209	fn as_any(&self) -> &dyn Any {210		self211	}212}213214macro_rules! impl_context_initializer {215	($($gen:ident)*) => {216		#[allow(non_snake_case)]217		impl<$($gen: ContextInitializer + Trace,)*> ContextInitializer for ($($gen,)*) {218			fn populate(&self, for_file: Source, builder: &mut InitialContextBuilder) {219				let ($($gen,)*) = self;220				$($gen.populate(for_file.clone(), builder);)*221			}222			fn as_any(&self) -> &dyn Any {223				self224			}225		}226	};227	($($cur:ident)* @ $c:ident $($rest:ident)*) => {228		impl_context_initializer!($($cur)*);229		impl_context_initializer!($($cur)* $c @ $($rest)*);230	};231	($($cur:ident)* @) => {232		impl_context_initializer!($($cur)*);233	}234}235impl_context_initializer! {236	A @ B C D E F G237}238239#[derive(Trace)]240struct FileData {241	string: Option<IStr>,242	bytes: Option<IBytes>,243	parsed: Option<Rc<Expr>>,244	evaluated: Option<Val>,245246	evaluating: bool,247}248impl FileData {249	fn new_string(data: IStr) -> Self {250		Self {251			string: Some(data),252			bytes: None,253			parsed: None,254			evaluated: None,255			evaluating: false,256		}257	}258	fn new_bytes(data: IBytes) -> Self {259		Self {260			string: None,261			bytes: Some(data),262			parsed: None,263			evaluated: None,264			evaluating: false,265		}266	}267	pub(crate) fn get_string(&mut self) -> Option<IStr> {268		if self.string.is_none() {269			self.string = Some(270				self.bytes271					.as_ref()272					.expect("either string or bytes should be set")273					.clone()274					.cast_str()?,275			);276		}277		Some(self.string.clone().expect("just set"))278	}279}280281#[derive(Trace)]282pub struct EvaluationStateInternals {283	/// Internal state284	file_cache: RefCell<FxHashMap<SourcePath, FileData>>,285	/// Context initializer, which will be used for imports and everything286	/// [`NoopContextInitializer`] is used by default, most likely you want to have `jrsonnet-stdlib`287	context_initializer: CcContextInitializer,288	/// Used to resolve file locations/contents289	import_resolver: Rc<dyn ImportResolver>,290}291292/// Maintains stack trace and import resolution293#[derive(Clone, Trace)]294pub struct State(Cc<EvaluationStateInternals>);295296thread_local! {297	pub static DEFAULT_STATE: State = State::builder().build();298	pub static STATE: RefCell<Option<State>> = const {RefCell::new(None)};299}300pub struct StateEnterGuard(PhantomData<()>);301impl Drop for StateEnterGuard {302	fn drop(&mut self) {303		STATE.with_borrow_mut(|v| *v = None);304	}305}306307pub fn with_state<V>(v: impl FnOnce(State) -> V) -> V {308	if let Some(state) = STATE.with_borrow(Clone::clone) {309		v(state)310	} else {311		let s = DEFAULT_STATE.with(Clone::clone);312		v(s)313	}314}315316impl State {317	pub fn enter(&self) -> StateEnterGuard {318		self.try_enter().expect("entered state already exists")319	}320	pub fn try_enter(&self) -> Option<StateEnterGuard> {321		STATE.with_borrow_mut(|v| {322			if v.is_none() {323				*v = Some(self.clone());324				Some(StateEnterGuard(PhantomData))325			} else {326				None327			}328		})329	}330	/// Should only be called with path retrieved from [`resolve_path`], may panic otherwise331	pub fn import_resolved_str(&self, path: SourcePath) -> Result<IStr> {332		let mut file_cache = self.file_cache();333		let mut file = file_cache.entry(path.clone());334335		let file = match file {336			Entry::Occupied(ref mut d) => d.get_mut(),337			Entry::Vacant(v) => {338				let data = self.import_resolver().load_file_contents(&path)?;339				v.insert(FileData::new_string(340					std::str::from_utf8(&data)341						.map_err(|_| ImportBadFileUtf8(path.clone()))?342						.into(),343				))344			}345		};346		Ok(file347			.get_string()348			.ok_or_else(|| ImportBadFileUtf8(path.clone()))?)349	}350	/// Should only be called with path retrieved from [`resolve_path`], may panic otherwise351	pub fn import_resolved_bin(&self, path: SourcePath) -> Result<IBytes> {352		let mut file_cache = self.file_cache();353		let mut file = file_cache.entry(path.clone());354355		let file = match file {356			Entry::Occupied(ref mut d) => d.get_mut(),357			Entry::Vacant(v) => {358				let data = self.import_resolver().load_file_contents(&path)?;359				v.insert(FileData::new_bytes(data.as_slice().into()))360			}361		};362		if let Some(str) = &file.bytes {363			return Ok(str.clone());364		}365		if file.bytes.is_none() {366			file.bytes = Some(367				file.string368					.as_ref()369					.expect("either string or bytes should be set")370					.clone()371					.cast_bytes(),372			);373		}374		Ok(file.bytes.as_ref().expect("just set").clone())375	}376	/// Should only be called with path retrieved from [`resolve_path`], may panic otherwise377	pub fn import_resolved(&self, path: SourcePath) -> Result<Val> {378		let mut file_cache = self.file_cache();379		let mut file = file_cache.entry(path.clone());380381		let file = match file {382			Entry::Occupied(ref mut d) => d.get_mut(),383			Entry::Vacant(v) => {384				let data = self.import_resolver().load_file_contents(&path)?;385				v.insert(FileData::new_string(386					std::str::from_utf8(&data)387						.map_err(|_| ImportBadFileUtf8(path.clone()))?388						.into(),389				))390			}391		};392		if let Some(val) = &file.evaluated {393			return Ok(val.clone());394		}395		let code = file396			.get_string()397			.ok_or_else(|| ImportBadFileUtf8(path.clone()))?;398		let file_name = Source::new(path.clone(), code.clone());399		if file.parsed.is_none() {400			file.parsed = Some(401				parse_jsonnet(&code, file_name.clone())402					.map(Rc::new)403					.map_err(|e| {404						let span = e.location.clone();405						let mut err = Error::from(ImportSyntaxError {406							path: file_name.clone(),407							error: Box::new(e),408						});409						err.trace_mut().0.push(StackTraceElement {410							location: Some(span),411							desc: "parse imported".to_string(),412						});413						err414					})?,415			);416		}417		let parsed = file.parsed.as_ref().expect("just set").clone();418		if file.evaluating {419			bail!(InfiniteRecursionDetected)420		}421		file.evaluating = true;422		// Dropping file cache guard here, as evaluation may use this map too423		drop(file_cache);424		let (externals, thunks) = self.create_default_context(file_name).build();425		let report = analyze_root(&parsed, externals);426		if report.errored {427			return Err(StaticAnalysisError(report.diagnostics_list).into());428		}429		debug_assert_eq!(report.root_shape.n_locals as usize, thunks.len());430		debug_assert!(report.root_shape.captures.is_empty());431		let ctx = Context::root(thunks);432		let res = evaluate::evaluate(ctx, &report.lir);433434		let mut file_cache = self.file_cache();435		let mut file = file_cache.entry(path);436437		let Entry::Occupied(file) = &mut file else {438			unreachable!("this file was just here")439		};440		let file = file.get_mut();441		file.evaluating = false;442		match res {443			Ok(v) => {444				file.evaluated = Some(v.clone());445				Ok(v)446			}447			Err(e) => Err(e),448		}449	}450451	/// Has same semantics as `import 'path'` called from `from` file452	pub fn import_from(&self, from: &SourcePath, path: impl AsPathLike) -> Result<Val> {453		let resolved = self.resolve_from(from, &path)?;454		self.import_resolved(resolved)455	}456	pub fn import(&self, path: impl AsPathLike) -> Result<Val> {457		let resolved = self.resolve_from_default(&path)?;458		self.import_resolved(resolved)459	}460461	/// Creates context with all passed global variables462	pub fn create_default_context(&self, source: Source) -> InitialContextBuilder {463		self.create_default_context_with(source, &())464	}465466	/// Creates context with all passed global variables, calling custom modifier467	pub fn create_default_context_with(468		&self,469		source: Source,470		context_initializer: &dyn ContextInitializer,471	) -> InitialContextBuilder {472		let default_initializer = self.context_initializer();473		let mut builder = InitialContextBuilder::new();474		default_initializer.populate(source.clone(), &mut builder);475		context_initializer.populate(source, &mut builder);476477		builder478	}479}480481/// Internals482impl State {483	fn file_cache(&self) -> RefMut<'_, FxHashMap<SourcePath, FileData>> {484		self.0.file_cache.borrow_mut()485	}486}487/// Executes code creating a new stack frame, to be replaced with try{}488pub fn in_frame<T>(489	e: CallLocation<'_>,490	frame_desc: impl FnOnce() -> String,491	f: impl FnOnce() -> Result<T>,492) -> Result<T> {493	let _guard = check_depth()?;494495	f().with_description_src(e, frame_desc)496}497498/// Executes code creating a new stack frame, to be replaced with try{}499pub fn in_description_frame<T>(500	frame_desc: impl FnOnce() -> String,501	f: impl FnOnce() -> Result<T>,502) -> Result<T> {503	let _guard = check_depth()?;504505	f().with_description(frame_desc)506}507508#[derive(Trace)]509pub struct InitialUnderscore(pub Thunk<Val>);510impl ContextInitializer for InitialUnderscore {511	fn populate(&self, _for_file: Source, builder: &mut InitialContextBuilder) {512		builder.bind("_", self.0.clone());513	}514515	fn as_any(&self) -> &dyn Any {516		self517	}518}519520pub struct PreparedSnippet {521	lir: LExpr,522	thunks: Vec<Thunk<Val>>,523}524525/// Raw methods evaluate passed values but don't perform TLA execution526impl State {527	/// Parses and analyses the given snippet with a custom context528	/// modifier.529	pub fn prepare_snippet_with(530		&self,531		name: impl Into<IStr>,532		code: impl Into<IStr>,533		context_initializer: &dyn ContextInitializer,534	) -> Result<PreparedSnippet> {535		let code = code.into();536		let source = Source::new_virtual(name.into(), code.clone());537		let parsed = parse_jsonnet(&code, source.clone()).map_err(|e| ImportSyntaxError {538			path: source.clone(),539			error: Box::new(e),540		})?;541		let (externals, thunks) = self542			.create_default_context_with(source, context_initializer)543			.build();544		let report = analyze_root(&parsed, externals);545		if report.errored {546			return Err(StaticAnalysisError(report.diagnostics_list).into());547		}548		debug_assert_eq!(report.root_shape.n_locals as usize, thunks.len());549		debug_assert!(report.root_shape.captures.is_empty());550		Ok(PreparedSnippet {551			lir: report.lir,552			thunks,553		})554	}555	/// Parses and analyses the given snippet556	pub fn prepare_snippet(557		&self,558		name: impl Into<IStr>,559		code: impl Into<IStr>,560	) -> Result<PreparedSnippet> {561		self.prepare_snippet_with(name, code, &())562	}563	pub fn evaluate_prepared_snippet(&self, prepared: &PreparedSnippet) -> Result<Val> {564		let ctx = Context::root(prepared.thunks.clone());565		evaluate::evaluate(ctx, &prepared.lir)566	}567	/// Parses and evaluates the given snippet with custom context modifier568	pub fn evaluate_snippet_with(569		&self,570		name: impl Into<IStr>,571		code: impl Into<IStr>,572		context_initializer: &dyn ContextInitializer,573	) -> Result<Val> {574		let prepared = self.prepare_snippet_with(name, code, context_initializer)?;575		self.evaluate_prepared_snippet(&prepared)576	}577	/// Parses and evaluates the given snippet578	pub fn evaluate_snippet(&self, name: impl Into<IStr>, code: impl Into<IStr>) -> Result<Val> {579		self.evaluate_snippet_with(name, code, &())580	}581}582583/// Settings utilities584impl State {585	// Only panics in case of [`ImportResolver`] contract violation586	#[allow(clippy::missing_panics_doc)]587	pub fn resolve_from(&self, from: &SourcePath, path: &dyn AsPathLike) -> Result<SourcePath> {588		self.import_resolver().resolve_from(from, path)589	}590	#[allow(clippy::missing_panics_doc)]591	pub fn resolve_from_default(&self, path: &dyn AsPathLike) -> Result<SourcePath> {592		self.import_resolver().resolve_from_default(path)593	}594	pub fn import_resolver(&self) -> &dyn ImportResolver {595		&*self.0.import_resolver596	}597	pub fn context_initializer(&self) -> &dyn ContextInitializer {598		&*self.0.context_initializer.0599	}600}601602impl State {603	pub fn builder() -> StateBuilder {604		StateBuilder::default()605	}606}607608impl Default for State {609	fn default() -> Self {610		Self::builder().build()611	}612}613614#[derive(Default)]615pub struct StateBuilder {616	import_resolver: Option<Rc<dyn ImportResolver>>,617	context_initializer: Option<CcContextInitializer>,618}619impl StateBuilder {620	pub fn import_resolver(&mut self, import_resolver: impl ImportResolver) -> &mut Self {621		let _ = self.import_resolver.insert(Rc::new(import_resolver));622		self623	}624	pub fn context_initializer(625		&mut self,626		context_initializer: impl ContextInitializer + Trace,627	) -> &mut Self {628		let _ = self629			.context_initializer630			.insert(CcContextInitializer::new(context_initializer));631		self632	}633	pub fn build(mut self) -> State {634		State(Cc::new(EvaluationStateInternals {635			file_cache: RefCell::new(FxHashMap::new()),636			context_initializer: self637				.context_initializer638				.take()639				.unwrap_or_else(|| CcContextInitializer::new(())),640			import_resolver: self641				.import_resolver642				.take()643				.unwrap_or_else(|| Rc::new(DummyImportResolver)),644		}))645	}646}
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 {