feat(phase-5.2): Complete backend cleanup - reject deprecated MIR instructions
Phase 5.2 of MIR 35→26 reduction project: - VM backend: Reject all 17 deprecated instructions with proper error messages - WASM backend: Reject deprecated instructions with migration guidance - All deprecated instructions now properly handled in both backends - Build successful with expected deprecation warnings Deprecated instructions removed: - UnaryOp → Use BinOp - Load/Store → Use BoxFieldLoad/BoxFieldStore - ArrayGet/ArraySet → Use BoxFieldLoad/BoxFieldStore or intrinsics - Print/Debug → Use Call @print/@debug - TypeCheck/Cast → Use Call @type_check/@cast - Throw/Catch → Use Call @throw/@catch - RefNew → References handled implicitly - BarrierRead/BarrierWrite → Use AtomicFence - FutureNew/FutureSet/Await → Use NewBox/BoxCall - Copy/Nop → Not needed in final IR
This commit is contained in:
@ -364,67 +364,27 @@ impl VM {
|
|||||||
Ok(ControlFlow::Continue)
|
Ok(ControlFlow::Continue)
|
||||||
},
|
},
|
||||||
|
|
||||||
MirInstruction::TypeCheck { dst, value: _, expected_type: _ } => {
|
// Phase 5: Removed instructions - TypeCheck, Cast, ArrayGet, ArraySet, Copy, Debug, Nop
|
||||||
// For now, type checks always return true
|
#[allow(deprecated)]
|
||||||
// TODO: Implement proper type checking
|
MirInstruction::TypeCheck { .. } |
|
||||||
self.values.insert(*dst, VMValue::Bool(true));
|
MirInstruction::Cast { .. } |
|
||||||
Ok(ControlFlow::Continue)
|
MirInstruction::ArrayGet { .. } |
|
||||||
},
|
MirInstruction::ArraySet { .. } |
|
||||||
|
MirInstruction::Copy { .. } |
|
||||||
MirInstruction::Cast { dst, value, target_type: _ } => {
|
MirInstruction::Debug { .. } |
|
||||||
// For now, casting just copies the value
|
|
||||||
// TODO: Implement proper type casting
|
|
||||||
let val = self.get_value(*value)?;
|
|
||||||
self.values.insert(*dst, val);
|
|
||||||
Ok(ControlFlow::Continue)
|
|
||||||
},
|
|
||||||
|
|
||||||
MirInstruction::ArrayGet { dst, array: _, index: _ } => {
|
|
||||||
// For now, array access returns a placeholder
|
|
||||||
// TODO: Implement proper array access
|
|
||||||
self.values.insert(*dst, VMValue::Integer(0));
|
|
||||||
Ok(ControlFlow::Continue)
|
|
||||||
},
|
|
||||||
|
|
||||||
MirInstruction::ArraySet { array: _, index: _, value: _ } => {
|
|
||||||
// For now, array setting is a no-op
|
|
||||||
// TODO: Implement proper array setting
|
|
||||||
Ok(ControlFlow::Continue)
|
|
||||||
},
|
|
||||||
|
|
||||||
MirInstruction::Copy { dst, src } => {
|
|
||||||
// Copy instruction - duplicate the source value
|
|
||||||
let val = self.get_value(*src)?;
|
|
||||||
self.values.insert(*dst, val);
|
|
||||||
Ok(ControlFlow::Continue)
|
|
||||||
},
|
|
||||||
|
|
||||||
MirInstruction::Debug { value, message: _ } => {
|
|
||||||
// Debug instruction - print value for debugging
|
|
||||||
let val = self.get_value(*value)?;
|
|
||||||
println!("DEBUG: {}", val.to_string());
|
|
||||||
Ok(ControlFlow::Continue)
|
|
||||||
},
|
|
||||||
|
|
||||||
MirInstruction::Nop => {
|
MirInstruction::Nop => {
|
||||||
// No-op instruction
|
Err(VMError::InvalidInstruction(
|
||||||
Ok(ControlFlow::Continue)
|
"Phase 5: Deprecated instruction - use 26-instruction set replacements".to_string()
|
||||||
|
))
|
||||||
},
|
},
|
||||||
|
|
||||||
// Phase 5: Control flow & exception handling
|
// Phase 5: Removed instructions - Throw, Catch
|
||||||
MirInstruction::Throw { exception, effects: _ } => {
|
#[allow(deprecated)]
|
||||||
let exception_val = self.get_value(*exception)?;
|
MirInstruction::Throw { .. } |
|
||||||
// For now, convert throw to error return (simplified exception handling)
|
MirInstruction::Catch { .. } => {
|
||||||
// In a full implementation, this would unwind the stack looking for catch handlers
|
Err(VMError::InvalidInstruction(
|
||||||
println!("Exception thrown: {}", exception_val.to_string());
|
"Phase 5: Exception handling via intrinsics - use Call with @throw/@catch".to_string()
|
||||||
Err(VMError::InvalidInstruction(format!("Unhandled exception: {}", exception_val.to_string())))
|
))
|
||||||
},
|
|
||||||
|
|
||||||
MirInstruction::Catch { exception_type: _, exception_value, handler_bb: _ } => {
|
|
||||||
// For now, catch is a no-op since we don't have full exception handling
|
|
||||||
// In a real implementation, this would set up exception handling metadata
|
|
||||||
self.values.insert(*exception_value, VMValue::Void);
|
|
||||||
Ok(ControlFlow::Continue)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
MirInstruction::Safepoint => {
|
MirInstruction::Safepoint => {
|
||||||
@ -433,34 +393,12 @@ impl VM {
|
|||||||
Ok(ControlFlow::Continue)
|
Ok(ControlFlow::Continue)
|
||||||
},
|
},
|
||||||
|
|
||||||
// Phase 6: Box reference operations
|
// Phase 5: Removed instruction - RefNew
|
||||||
MirInstruction::RefNew { dst, box_val } => {
|
#[allow(deprecated)]
|
||||||
// Get the box type/value from the previous Const instruction
|
MirInstruction::RefNew { .. } => {
|
||||||
let box_value = self.get_value(*box_val)?;
|
Err(VMError::InvalidInstruction(
|
||||||
|
"Phase 5: RefNew deprecated - RefGet is sufficient".to_string()
|
||||||
// If this is a Box type name (like "StringBox", "IntegerBox"), create an appropriate default value
|
))
|
||||||
// In the context of Everything is Box, this should create the actual Box instance
|
|
||||||
let ref_value = match &box_value {
|
|
||||||
VMValue::String(type_name) => {
|
|
||||||
match type_name.as_str() {
|
|
||||||
"StringBox" => {
|
|
||||||
// For StringBox, we need the actual string content from previous context
|
|
||||||
// For now, create an empty string - this should be improved to use the actual value
|
|
||||||
VMValue::String(String::new())
|
|
||||||
},
|
|
||||||
"IntegerBox" => VMValue::Integer(0),
|
|
||||||
"BoolBox" => VMValue::Bool(false),
|
|
||||||
_ => {
|
|
||||||
// If it's a regular string (not a type name), use it as-is
|
|
||||||
VMValue::String(type_name.clone())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_ => box_value, // For non-string values, use as-is
|
|
||||||
};
|
|
||||||
|
|
||||||
self.values.insert(*dst, ref_value);
|
|
||||||
Ok(ControlFlow::Continue)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Phase 3: RefGet/RefSet removed - now handled by BoxFieldLoad/BoxFieldStore
|
// Phase 3: RefGet/RefSet removed - now handled by BoxFieldLoad/BoxFieldStore
|
||||||
@ -481,61 +419,23 @@ impl VM {
|
|||||||
Ok(ControlFlow::Continue)
|
Ok(ControlFlow::Continue)
|
||||||
},
|
},
|
||||||
|
|
||||||
MirInstruction::BarrierRead { ptr: _ } => {
|
// Phase 5: Removed instructions - BarrierRead, BarrierWrite
|
||||||
// Memory barrier read is a no-op for now
|
#[allow(deprecated)]
|
||||||
// In a real implementation, this would ensure memory ordering
|
MirInstruction::BarrierRead { .. } |
|
||||||
Ok(ControlFlow::Continue)
|
MirInstruction::BarrierWrite { .. } => {
|
||||||
|
Err(VMError::InvalidInstruction(
|
||||||
|
"Phase 5: Memory barriers deprecated - use AtomicFence".to_string()
|
||||||
|
))
|
||||||
},
|
},
|
||||||
|
|
||||||
MirInstruction::BarrierWrite { ptr: _ } => {
|
// Phase 5: Removed instructions - FutureNew, FutureSet, Await
|
||||||
// Memory barrier write is a no-op for now
|
#[allow(deprecated)]
|
||||||
// In a real implementation, this would ensure memory ordering
|
MirInstruction::FutureNew { .. } |
|
||||||
Ok(ControlFlow::Continue)
|
MirInstruction::FutureSet { .. } |
|
||||||
},
|
MirInstruction::Await { .. } => {
|
||||||
|
Err(VMError::InvalidInstruction(
|
||||||
// Phase 7: Async/Future Operations
|
"Phase 5: Future operations deprecated - use NewBox + BoxCall".to_string()
|
||||||
MirInstruction::FutureNew { dst, value } => {
|
))
|
||||||
let initial_value = self.get_value(*value)?;
|
|
||||||
println!("FutureNew: initial_value = {:?}", initial_value);
|
|
||||||
let future = crate::boxes::future::FutureBox::new();
|
|
||||||
// Convert VMValue to NyashBox and set it in the future
|
|
||||||
let nyash_box = initial_value.to_nyash_box();
|
|
||||||
println!("FutureNew: converted to NyashBox type = {}", nyash_box.type_name());
|
|
||||||
future.set_result(nyash_box);
|
|
||||||
self.values.insert(*dst, VMValue::Future(future));
|
|
||||||
println!("FutureNew: stored Future in dst = {:?}", dst);
|
|
||||||
Ok(ControlFlow::Continue)
|
|
||||||
},
|
|
||||||
|
|
||||||
MirInstruction::FutureSet { future, value } => {
|
|
||||||
let future_val = self.get_value(*future)?;
|
|
||||||
let new_value = self.get_value(*value)?;
|
|
||||||
|
|
||||||
if let VMValue::Future(ref future_box) = future_val {
|
|
||||||
future_box.set_result(new_value.to_nyash_box());
|
|
||||||
Ok(ControlFlow::Continue)
|
|
||||||
} else {
|
|
||||||
Err(VMError::TypeError(format!("Expected Future, got {:?}", future_val)))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
MirInstruction::Await { dst, future } => {
|
|
||||||
let future_val = self.get_value(*future)?;
|
|
||||||
println!("Await: future_val = {:?}", future_val);
|
|
||||||
|
|
||||||
if let VMValue::Future(ref future_box) = future_val {
|
|
||||||
// This blocks until the future is ready
|
|
||||||
let result = future_box.get();
|
|
||||||
println!("Await: future.get() returned type = {}", result.type_name());
|
|
||||||
println!("Await: future.get() string = {}", result.to_string_box().value);
|
|
||||||
// Convert NyashBox back to VMValue
|
|
||||||
let vm_value = VMValue::from_nyash_box(result);
|
|
||||||
println!("Await: converted back to VMValue = {:?}", vm_value);
|
|
||||||
self.values.insert(*dst, vm_value);
|
|
||||||
Ok(ControlFlow::Continue)
|
|
||||||
} else {
|
|
||||||
Err(VMError::TypeError(format!("Expected Future, got {:?}", future_val)))
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Phase 9.7: External Function Calls
|
// Phase 9.7: External Function Calls
|
||||||
|
|||||||
@ -247,13 +247,12 @@ impl WasmCodegen {
|
|||||||
// Phase 3: Print removed - now handled by Call intrinsic (@print)
|
// Phase 3: Print removed - now handled by Call intrinsic (@print)
|
||||||
|
|
||||||
// Phase 8.3 PoC2: Reference operations
|
// Phase 8.3 PoC2: Reference operations
|
||||||
MirInstruction::RefNew { dst, box_val } => {
|
// Phase 5: RefNew deprecated - just use the value directly
|
||||||
// Create a new reference to a Box by copying the Box value
|
#[allow(deprecated)]
|
||||||
// This assumes box_val contains a Box pointer already
|
MirInstruction::RefNew { .. } => {
|
||||||
Ok(vec![
|
Err(WasmError::UnsupportedInstruction(
|
||||||
format!("local.get ${}", self.get_local_index(*box_val)?),
|
"Phase 5: RefNew deprecated - references are handled implicitly".to_string()
|
||||||
format!("local.set ${}", self.get_local_index(*dst)?),
|
))
|
||||||
])
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Phase 3: RefGet/RefSet removed - now handled by BoxFieldLoad/BoxFieldStore
|
// Phase 3: RefGet/RefSet removed - now handled by BoxFieldLoad/BoxFieldStore
|
||||||
@ -295,29 +294,54 @@ impl WasmCodegen {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Phase 8.4 PoC3: Extension stubs
|
// Phase 8.4 PoC3: Extension stubs
|
||||||
MirInstruction::WeakNew { dst, box_val } |
|
MirInstruction::WeakNew { dst, box_val } => {
|
||||||
MirInstruction::FutureNew { dst, value: box_val } => {
|
// WeakNew is still part of 26-instruction set
|
||||||
// Treat as regular reference for now
|
|
||||||
Ok(vec![
|
Ok(vec![
|
||||||
format!("local.get ${}", self.get_local_index(*box_val)?),
|
format!("local.get ${}", self.get_local_index(*box_val)?),
|
||||||
format!("local.set ${}", self.get_local_index(*dst)?),
|
format!("local.set ${}", self.get_local_index(*dst)?),
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
|
|
||||||
MirInstruction::WeakLoad { dst, weak_ref } |
|
// Phase 5: FutureNew deprecated - use NewBox "Future"
|
||||||
MirInstruction::Await { dst, future: weak_ref } => {
|
#[allow(deprecated)]
|
||||||
// Always succeed for now
|
MirInstruction::FutureNew { .. } => {
|
||||||
|
Err(WasmError::UnsupportedInstruction(
|
||||||
|
"Phase 5: FutureNew deprecated - use 'NewBox \"Future\"' instead".to_string()
|
||||||
|
))
|
||||||
|
},
|
||||||
|
|
||||||
|
MirInstruction::WeakLoad { dst, weak_ref } => {
|
||||||
|
// WeakLoad is still part of 26-instruction set
|
||||||
Ok(vec![
|
Ok(vec![
|
||||||
format!("local.get ${}", self.get_local_index(*weak_ref)?),
|
format!("local.get ${}", self.get_local_index(*weak_ref)?),
|
||||||
format!("local.set ${}", self.get_local_index(*dst)?),
|
format!("local.set ${}", self.get_local_index(*dst)?),
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
|
|
||||||
MirInstruction::BarrierRead { .. } |
|
// Phase 5: Await deprecated - use BoxCall Future.await()
|
||||||
MirInstruction::BarrierWrite { .. } |
|
#[allow(deprecated)]
|
||||||
MirInstruction::FutureSet { .. } |
|
MirInstruction::Await { .. } => {
|
||||||
|
Err(WasmError::UnsupportedInstruction(
|
||||||
|
"Phase 5: Await deprecated - use 'BoxCall Future.await()' instead".to_string()
|
||||||
|
))
|
||||||
|
},
|
||||||
|
|
||||||
|
// Phase 5: BarrierRead/BarrierWrite deprecated - use AtomicFence
|
||||||
|
#[allow(deprecated)]
|
||||||
|
MirInstruction::BarrierRead { .. } => {
|
||||||
|
Err(WasmError::UnsupportedInstruction(
|
||||||
|
"Phase 5: BarrierRead deprecated - use AtomicFence with acquire ordering".to_string()
|
||||||
|
))
|
||||||
|
},
|
||||||
|
#[allow(deprecated)]
|
||||||
|
MirInstruction::BarrierWrite { .. } => {
|
||||||
|
Err(WasmError::UnsupportedInstruction(
|
||||||
|
"Phase 5: BarrierWrite deprecated - use AtomicFence with release ordering".to_string()
|
||||||
|
))
|
||||||
|
},
|
||||||
|
|
||||||
MirInstruction::Safepoint => {
|
MirInstruction::Safepoint => {
|
||||||
// No-op for now
|
// Safepoint is still valid - no-op for now
|
||||||
Ok(vec!["nop".to_string()])
|
Ok(vec!["nop".to_string()])
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -497,6 +521,72 @@ impl WasmCodegen {
|
|||||||
self.generate_call_instruction(dst.as_ref(), *func, args)
|
self.generate_call_instruction(dst.as_ref(), *func, args)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Phase 5: Removed instructions - TypeCheck, Cast, ArrayGet, ArraySet, Copy, Debug, Nop
|
||||||
|
#[allow(deprecated)]
|
||||||
|
MirInstruction::TypeCheck { .. } |
|
||||||
|
MirInstruction::Cast { .. } |
|
||||||
|
MirInstruction::ArrayGet { .. } |
|
||||||
|
MirInstruction::ArraySet { .. } |
|
||||||
|
MirInstruction::Copy { .. } |
|
||||||
|
MirInstruction::Debug { .. } |
|
||||||
|
MirInstruction::Nop => {
|
||||||
|
Err(WasmError::UnsupportedInstruction(
|
||||||
|
"Phase 5: Deprecated instruction - use 26-instruction set replacements".to_string()
|
||||||
|
))
|
||||||
|
},
|
||||||
|
|
||||||
|
// Phase 5: Removed instructions - UnaryOp (use BinOp instead)
|
||||||
|
#[allow(deprecated)]
|
||||||
|
MirInstruction::UnaryOp { .. } => {
|
||||||
|
Err(WasmError::UnsupportedInstruction(
|
||||||
|
"Phase 5: UnaryOp deprecated - use BinOp (e.g., 'not x' -> 'x xor true', 'neg x' -> '0 sub x')".to_string()
|
||||||
|
))
|
||||||
|
},
|
||||||
|
|
||||||
|
// Phase 5: Removed instructions - Load/Store (use BoxFieldLoad/BoxFieldStore)
|
||||||
|
#[allow(deprecated)]
|
||||||
|
MirInstruction::Load { .. } => {
|
||||||
|
Err(WasmError::UnsupportedInstruction(
|
||||||
|
"Phase 5: Load deprecated - use BoxFieldLoad for field access".to_string()
|
||||||
|
))
|
||||||
|
},
|
||||||
|
#[allow(deprecated)]
|
||||||
|
MirInstruction::Store { .. } => {
|
||||||
|
Err(WasmError::UnsupportedInstruction(
|
||||||
|
"Phase 5: Store deprecated - use BoxFieldStore for field updates".to_string()
|
||||||
|
))
|
||||||
|
},
|
||||||
|
|
||||||
|
// Phase 5: Removed instructions - Print (use Call @print)
|
||||||
|
#[allow(deprecated)]
|
||||||
|
MirInstruction::Print { .. } => {
|
||||||
|
Err(WasmError::UnsupportedInstruction(
|
||||||
|
"Phase 5: Print deprecated - use 'Call @print' intrinsic function".to_string()
|
||||||
|
))
|
||||||
|
},
|
||||||
|
|
||||||
|
// Phase 5: Removed instructions - Throw/Catch (use Call @throw/@catch)
|
||||||
|
#[allow(deprecated)]
|
||||||
|
MirInstruction::Throw { .. } => {
|
||||||
|
Err(WasmError::UnsupportedInstruction(
|
||||||
|
"Phase 5: Throw deprecated - use 'Call @throw' intrinsic function".to_string()
|
||||||
|
))
|
||||||
|
},
|
||||||
|
#[allow(deprecated)]
|
||||||
|
MirInstruction::Catch { .. } => {
|
||||||
|
Err(WasmError::UnsupportedInstruction(
|
||||||
|
"Phase 5: Catch deprecated - use 'Call @catch' intrinsic function".to_string()
|
||||||
|
))
|
||||||
|
},
|
||||||
|
|
||||||
|
// Phase 5: Removed FutureSet - use BoxCall instead
|
||||||
|
#[allow(deprecated)]
|
||||||
|
MirInstruction::FutureSet { .. } => {
|
||||||
|
Err(WasmError::UnsupportedInstruction(
|
||||||
|
"Phase 5: FutureSet deprecated - use BoxCall method for Future.set()".to_string()
|
||||||
|
))
|
||||||
|
},
|
||||||
|
|
||||||
// Unsupported instructions
|
// Unsupported instructions
|
||||||
_ => Err(WasmError::UnsupportedInstruction(
|
_ => Err(WasmError::UnsupportedInstruction(
|
||||||
format!("Instruction not yet supported: {:?}", instruction)
|
format!("Instruction not yet supported: {:?}", instruction)
|
||||||
|
|||||||
@ -31,6 +31,8 @@ pub enum MirInstruction {
|
|||||||
|
|
||||||
/// Unary operation
|
/// Unary operation
|
||||||
/// `%dst = op %operand`
|
/// `%dst = op %operand`
|
||||||
|
/// DEPRECATED: Phase 5 - Use BinOp instead (e.g., `not %a` → `%a xor true`, `neg %a` → `0 sub %a`)
|
||||||
|
#[deprecated(since = "Phase 5", note = "Use BinOp instead")]
|
||||||
UnaryOp {
|
UnaryOp {
|
||||||
dst: ValueId,
|
dst: ValueId,
|
||||||
op: UnaryOp,
|
op: UnaryOp,
|
||||||
@ -50,6 +52,8 @@ pub enum MirInstruction {
|
|||||||
// === Memory Operations ===
|
// === Memory Operations ===
|
||||||
/// Load from memory/variable
|
/// Load from memory/variable
|
||||||
/// `%dst = load %ptr`
|
/// `%dst = load %ptr`
|
||||||
|
/// DEPRECATED: Phase 5 - Use BoxFieldLoad instead
|
||||||
|
#[deprecated(since = "Phase 5", note = "Use BoxFieldLoad instead")]
|
||||||
Load {
|
Load {
|
||||||
dst: ValueId,
|
dst: ValueId,
|
||||||
ptr: ValueId,
|
ptr: ValueId,
|
||||||
@ -57,6 +61,8 @@ pub enum MirInstruction {
|
|||||||
|
|
||||||
/// Store to memory/variable
|
/// Store to memory/variable
|
||||||
/// `store %value -> %ptr`
|
/// `store %value -> %ptr`
|
||||||
|
/// DEPRECATED: Phase 5 - Use BoxFieldStore instead
|
||||||
|
#[deprecated(since = "Phase 5", note = "Use BoxFieldStore instead")]
|
||||||
Store {
|
Store {
|
||||||
value: ValueId,
|
value: ValueId,
|
||||||
ptr: ValueId,
|
ptr: ValueId,
|
||||||
@ -122,6 +128,8 @@ pub enum MirInstruction {
|
|||||||
|
|
||||||
/// Check Box type
|
/// Check Box type
|
||||||
/// `%dst = type_check %box "BoxType"`
|
/// `%dst = type_check %box "BoxType"`
|
||||||
|
/// DEPRECATED: Phase 5 - Use Call with @type_check intrinsic
|
||||||
|
#[deprecated(since = "Phase 5", note = "Use Call with @type_check intrinsic")]
|
||||||
TypeCheck {
|
TypeCheck {
|
||||||
dst: ValueId,
|
dst: ValueId,
|
||||||
value: ValueId,
|
value: ValueId,
|
||||||
@ -131,6 +139,8 @@ pub enum MirInstruction {
|
|||||||
// === Type Conversion ===
|
// === Type Conversion ===
|
||||||
/// Convert between types
|
/// Convert between types
|
||||||
/// `%dst = cast %value as Type`
|
/// `%dst = cast %value as Type`
|
||||||
|
/// DEPRECATED: Phase 5 - Use Call with @cast intrinsic
|
||||||
|
#[deprecated(since = "Phase 5", note = "Use Call with @cast intrinsic")]
|
||||||
Cast {
|
Cast {
|
||||||
dst: ValueId,
|
dst: ValueId,
|
||||||
value: ValueId,
|
value: ValueId,
|
||||||
@ -140,6 +150,8 @@ pub enum MirInstruction {
|
|||||||
// === Array Operations ===
|
// === Array Operations ===
|
||||||
/// Get array element
|
/// Get array element
|
||||||
/// `%dst = %array[%index]`
|
/// `%dst = %array[%index]`
|
||||||
|
/// DEPRECATED: Phase 5 - Use BoxFieldLoad or Call with @array_get intrinsic
|
||||||
|
#[deprecated(since = "Phase 5", note = "Use BoxFieldLoad or Call with @array_get intrinsic")]
|
||||||
ArrayGet {
|
ArrayGet {
|
||||||
dst: ValueId,
|
dst: ValueId,
|
||||||
array: ValueId,
|
array: ValueId,
|
||||||
@ -148,6 +160,8 @@ pub enum MirInstruction {
|
|||||||
|
|
||||||
/// Set array element
|
/// Set array element
|
||||||
/// `%array[%index] = %value`
|
/// `%array[%index] = %value`
|
||||||
|
/// DEPRECATED: Phase 5 - Use BoxFieldStore or Call with @array_set intrinsic
|
||||||
|
#[deprecated(since = "Phase 5", note = "Use BoxFieldStore or Call with @array_set intrinsic")]
|
||||||
ArraySet {
|
ArraySet {
|
||||||
array: ValueId,
|
array: ValueId,
|
||||||
index: ValueId,
|
index: ValueId,
|
||||||
@ -157,6 +171,8 @@ pub enum MirInstruction {
|
|||||||
// === Special Operations ===
|
// === Special Operations ===
|
||||||
/// Copy a value (for optimization passes)
|
/// Copy a value (for optimization passes)
|
||||||
/// `%dst = copy %src`
|
/// `%dst = copy %src`
|
||||||
|
/// DEPRECATED: Phase 5 - Optimization pass only, not needed in IR
|
||||||
|
#[deprecated(since = "Phase 5", note = "Optimization pass only, not needed in IR")]
|
||||||
Copy {
|
Copy {
|
||||||
dst: ValueId,
|
dst: ValueId,
|
||||||
src: ValueId,
|
src: ValueId,
|
||||||
@ -164,6 +180,8 @@ pub enum MirInstruction {
|
|||||||
|
|
||||||
/// Debug/introspection instruction
|
/// Debug/introspection instruction
|
||||||
/// `debug %value "message"`
|
/// `debug %value "message"`
|
||||||
|
/// DEPRECATED: Phase 5 - Use Call with @debug intrinsic
|
||||||
|
#[deprecated(since = "Phase 5", note = "Use Call with @debug intrinsic")]
|
||||||
Debug {
|
Debug {
|
||||||
value: ValueId,
|
value: ValueId,
|
||||||
message: String,
|
message: String,
|
||||||
@ -171,18 +189,24 @@ pub enum MirInstruction {
|
|||||||
|
|
||||||
/// Print instruction for console output
|
/// Print instruction for console output
|
||||||
/// `print %value`
|
/// `print %value`
|
||||||
|
/// DEPRECATED: Phase 5 - Use Call with @print intrinsic
|
||||||
|
#[deprecated(since = "Phase 5", note = "Use Call with @print intrinsic")]
|
||||||
Print {
|
Print {
|
||||||
value: ValueId,
|
value: ValueId,
|
||||||
effects: EffectMask,
|
effects: EffectMask,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// No-op instruction (for optimization placeholders)
|
/// No-op instruction (for optimization placeholders)
|
||||||
|
/// DEPRECATED: Phase 5 - Not needed in final IR
|
||||||
|
#[deprecated(since = "Phase 5", note = "Not needed in final IR")]
|
||||||
Nop,
|
Nop,
|
||||||
|
|
||||||
// === Control Flow & Exception Handling (Phase 5) ===
|
// === Control Flow & Exception Handling (Phase 5) ===
|
||||||
|
|
||||||
/// Throw an exception
|
/// Throw an exception
|
||||||
/// `throw %exception_value`
|
/// `throw %exception_value`
|
||||||
|
/// DEPRECATED: Phase 5 - Use Call with @throw intrinsic
|
||||||
|
#[deprecated(since = "Phase 5", note = "Use Call with @throw intrinsic")]
|
||||||
Throw {
|
Throw {
|
||||||
exception: ValueId,
|
exception: ValueId,
|
||||||
effects: EffectMask,
|
effects: EffectMask,
|
||||||
@ -190,6 +214,8 @@ pub enum MirInstruction {
|
|||||||
|
|
||||||
/// Catch handler setup (landing pad for exceptions)
|
/// Catch handler setup (landing pad for exceptions)
|
||||||
/// `catch %exception_type -> %handler_bb`
|
/// `catch %exception_type -> %handler_bb`
|
||||||
|
/// DEPRECATED: Phase 5 - Use Call with @catch intrinsic
|
||||||
|
#[deprecated(since = "Phase 5", note = "Use Call with @catch intrinsic")]
|
||||||
Catch {
|
Catch {
|
||||||
exception_type: Option<String>, // None = catch-all
|
exception_type: Option<String>, // None = catch-all
|
||||||
exception_value: ValueId, // Where to store caught exception
|
exception_value: ValueId, // Where to store caught exception
|
||||||
@ -204,6 +230,8 @@ pub enum MirInstruction {
|
|||||||
|
|
||||||
/// Create a new reference to a Box
|
/// Create a new reference to a Box
|
||||||
/// `%dst = ref_new %box`
|
/// `%dst = ref_new %box`
|
||||||
|
/// DEPRECATED: Phase 5 - RefGet is sufficient
|
||||||
|
#[deprecated(since = "Phase 5", note = "RefGet is sufficient")]
|
||||||
RefNew {
|
RefNew {
|
||||||
dst: ValueId,
|
dst: ValueId,
|
||||||
box_val: ValueId,
|
box_val: ValueId,
|
||||||
@ -241,12 +269,16 @@ pub enum MirInstruction {
|
|||||||
|
|
||||||
/// Memory barrier read (no-op for now, proper effect annotation)
|
/// Memory barrier read (no-op for now, proper effect annotation)
|
||||||
/// `barrier_read %ptr`
|
/// `barrier_read %ptr`
|
||||||
|
/// DEPRECATED: Phase 5 - Use AtomicFence instead
|
||||||
|
#[deprecated(since = "Phase 5", note = "Use AtomicFence instead")]
|
||||||
BarrierRead {
|
BarrierRead {
|
||||||
ptr: ValueId,
|
ptr: ValueId,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Memory barrier write (no-op for now, proper effect annotation)
|
/// Memory barrier write (no-op for now, proper effect annotation)
|
||||||
/// `barrier_write %ptr`
|
/// `barrier_write %ptr`
|
||||||
|
/// DEPRECATED: Phase 5 - Use AtomicFence instead
|
||||||
|
#[deprecated(since = "Phase 5", note = "Use AtomicFence instead")]
|
||||||
BarrierWrite {
|
BarrierWrite {
|
||||||
ptr: ValueId,
|
ptr: ValueId,
|
||||||
},
|
},
|
||||||
@ -255,6 +287,8 @@ pub enum MirInstruction {
|
|||||||
|
|
||||||
/// Create a new Future with initial value
|
/// Create a new Future with initial value
|
||||||
/// `%dst = future_new %value`
|
/// `%dst = future_new %value`
|
||||||
|
/// DEPRECATED: Phase 5 - Use NewBox + BoxCall
|
||||||
|
#[deprecated(since = "Phase 5", note = "Use NewBox + BoxCall")]
|
||||||
FutureNew {
|
FutureNew {
|
||||||
dst: ValueId,
|
dst: ValueId,
|
||||||
value: ValueId,
|
value: ValueId,
|
||||||
@ -262,6 +296,8 @@ pub enum MirInstruction {
|
|||||||
|
|
||||||
/// Set Future value and mark as ready
|
/// Set Future value and mark as ready
|
||||||
/// `future_set %future = %value`
|
/// `future_set %future = %value`
|
||||||
|
/// DEPRECATED: Phase 5 - Use BoxCall
|
||||||
|
#[deprecated(since = "Phase 5", note = "Use BoxCall")]
|
||||||
FutureSet {
|
FutureSet {
|
||||||
future: ValueId,
|
future: ValueId,
|
||||||
value: ValueId,
|
value: ValueId,
|
||||||
@ -269,6 +305,8 @@ pub enum MirInstruction {
|
|||||||
|
|
||||||
/// Wait for Future completion and get value
|
/// Wait for Future completion and get value
|
||||||
/// `%dst = await %future`
|
/// `%dst = await %future`
|
||||||
|
/// DEPRECATED: Phase 5 - Use BoxCall
|
||||||
|
#[deprecated(since = "Phase 5", note = "Use BoxCall")]
|
||||||
Await {
|
Await {
|
||||||
dst: ValueId,
|
dst: ValueId,
|
||||||
future: ValueId,
|
future: ValueId,
|
||||||
|
|||||||
Reference in New Issue
Block a user