// StoreHandlerBox - Store instruction handler
// Handles: store %value -> %ptr (store to memory)

using selfhost.shared.common.string_helpers as StringHelpers
using selfhost.vm.boxes.result_box as Result
using selfhost.vm.hakorune-vm.value_manager as ValueManagerBox
using selfhost.vm.hakorune-vm.reg_guard as RegGuardBox
using selfhost.vm.hakorune-vm.json_field_extractor as JsonFieldExtractor
using selfhost.vm.hakorune-vm.core_bridge_ops as CoreBridgeOps

static box StoreHandlerBox {
  // Handle store instruction
  // inst_json: {"op":"store","value":2,"ptr":1}
  // mem: memory MapBox
  // Returns: Result.Ok(0) or Result.Err(message)
  handle(inst_json, regs, mem) { return CoreBridgeOps.apply_store(inst_json, regs, mem) }
}
