Skip to documentation
SLOP

tiny.choir.ir.context

Reference tiny.choir ir context

Defined in ir.

API (41)

Actions

Public operations.

Types and contracts

Public types and contracts.

No direct callersNo direct callsircontext
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/choir/src/core/context/resources.zig:4

zig
pub const Tracker = struct {    next_value_id: u32,    next_operation_id: u31,    operation_head: ?*Operation,    operation_count: usize,    pub fn init() Tracker {        return .{            .next_value_id = 0,            .next_operation_id = 0,            .operation_head = null,            .operation_count = 0,        };    }    pub fn deinit(self: *Tracker) void {        var current = self.operation_head;        var remaining = self.operation_count;        while (remaining > 0) : (remaining -|= 1) {            const op = current.?;            op.dropAllReferences();            current = op.tracking_next;        }        while (self.operation_head) |op| {            std.debug.assert(op.hasNoUses());            const removed = self.removeOperation(op);            std.debug.assert(removed);            op.destroy();        }        std.debug.assert(self.operation_count == 0);    }    fn containsOperation(self: *const Tracker, expected: *const Operation) bool {        var current = self.operation_head;        var remaining = self.operation_count;        while (remaining > 0) : (remaining -|= 1) {            const op = current.?;            if (op == expected) return true;            current = op.tracking_next;        }        return false;    }    fn appendOperation(self: *Tracker, op: *Operation) void {        std.debug.assert(op.tracking_prev == null);        std.debug.assert(op.tracking_next == null);        std.debug.assert(self.next_operation_id < std.math.maxInt(u31));        std.debug.assert(self.operation_count < std.math.maxInt(usize));        op.setCreationId(self.next_operation_id);        self.next_operation_id = std.math.add(u31, self.next_operation_id, 1) catch unreachable;        if (self.operation_head) |head| {            const tail = head.tracking_prev.?;            op.tracking_prev = tail;            op.tracking_next = head;            tail.tracking_next = op;            head.tracking_prev = op;        } else {            op.tracking_prev = op;            op.tracking_next = op;            self.operation_head = op;        }        self.operation_count = std.math.add(usize, self.operation_count, 1) catch unreachable;    }    fn removeOperation(self: *Tracker, op: *Operation) bool {        const previous = op.tracking_prev orelse {            std.debug.assert(op.tracking_next == null);            return false;        };        const next = op.tracking_next.?;        std.debug.assert(self.operation_count > 0);        if (previous == op) {            std.debug.assert(next == op);            std.debug.assert(self.operation_head == op);            std.debug.assert(self.operation_count == 1);            self.operation_head = null;        } else {            std.debug.assert(next != op);            previous.tracking_next = next;            next.tracking_prev = previous;            if (self.operation_head == op) self.operation_head = next;        }        op.tracking_prev = null;        op.tracking_next = null;        self.operation_count = std.math.sub(usize, self.operation_count, 1) catch unreachable;        return true;    }};
Called byCallsContextdeinitprivate sourcelib.choir.src.core.context.resources.TrackerremoveOperationir.context.ResourceTrackerdeinit
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsContextinittest sourcelib.choir.src.core.context.resourcestest: operation creation boundary exc...test sourcelib.choir.src.core.context.resourcestest: operation resource tracking use...ir.context.ResourceTrackerinit
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.choir.src.core.context.memoryattributePayloadAllocatorir.contextattributePayloadAllocator
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.choir.src.core.context.memoryattributeTableAllocatorir.contextattributeTableAllocator
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.choir.src.core.context.memoryconfigurationInterfaceAllocatorir.contextconfigurationInterfaceAllocator
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.choir.src.core.context.memoryconfigurationNameAllocatorir.contextconfigurationNameAllocator
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.choir.src.core.context.memoryconfigurationTableAllocatorir.contextconfigurationTableAllocator
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.choir.src.core.context.memoryconfigurationTransactionAllocatorir.contextconfigurationTransactionAllocator
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.choir.src.core.context.memorydiagnosticHandlerAllocatorir.contextdiagnosticHandlerAllocator
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.choir.src.core.context.memorydiagnosticPayloadAllocatorir.contextdiagnosticPayloadAllocator
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.choir.src.core.context.lifecycleoperationStorageAllocatorir.contextfixedOperationAllocator
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.choir.src.core.context.memoryoperationNestedAllocatorir.contextinitRegion
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callersprivate sourcelib.choir.src.core.context.memoryoperationNestedAllocatorir.contextoperationAllocator
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.choir.src.core.context.memorytransientAllocatorir.contexttransientAllocator
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.choir.src.core.context.memorytypeKeyAllocatorir.contexttypeKeyAllocator
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.choir.src.core.context.memorytypePayloadAllocatorir.contexttypePayloadAllocator
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.choir.src.core.context.memorytypeTableAllocatorir.contexttypeTableAllocator
Static calls · unresolved targets: 0 · external targets: 0.

Source: lib/choir/src/core/context/root.zig

zig
const std = @import("std");const lifecycle = @import("lifecycle.zig");const memory = @import("memory.zig");const core = @import("../root.zig");const resources = @import("resources.zig");pub const DialectLoaderFn = core.dialects.DialectLoaderFn;pub const DialectExtensionFn = core.dialects.DialectExtensionFn;pub const DialectRegistryEntry = core.dialects.DialectRegistryEntry;pub const DialectRegistrySpec = core.dialects.DialectRegistrySpec;pub const DialectLoadState = core.dialects.DialectLoadState;pub const OpInterfaceFallbackFn = core.dialects.OpInterfaceFallbackFn;pub const OpInterfaceFallbackEntry = core.dialects.OpInterfaceFallbackEntry;pub const TypeInterfaceFallbackFn = core.dialects.TypeInterfaceFallbackFn;pub const TypeInterfaceFallbackEntry = core.dialects.TypeInterfaceFallbackEntry;pub const Dialect = core.dialects.Dialect;pub const TypeStorage = core.types.TypeStorage;pub const AttrStorage = core.attrs.AttrStorage;pub const DialectAttrKey = core.attrs.DialectAttrKey;pub const IntegerAttrKey = core.attrs.IntegerAttrKey;pub const FloatAttrKey = core.attrs.FloatAttrKey;pub const StringAttrKey = core.attrs.StringAttrKey;pub const SymbolRefAttrKey = core.attrs.SymbolRefAttrKey;pub const StringListAttrKey = core.attrs.StringListAttrKey;pub const TypeInterner = core.types.TypeInterner;pub const AttributeInterner = core.attrs.AttributeInterner;pub const DialectRegistry = core.dialects.DialectRegistry;pub const ResourceTracker = resources.Tracker;pub const ThreadingExecutionGuard = core.ThreadingExecutionGuard;pub const Context = lifecycle.Context;pub fn configurationTableAllocator(context: *Context) std.mem.Allocator {    return memory.configurationTableAllocator(context.memory);}pub fn configurationNameAllocator(context: *Context) std.mem.Allocator {    return memory.configurationNameAllocator(context.memory);}pub fn configurationInterfaceAllocator(context: *Context) std.mem.Allocator {    return memory.configurationInterfaceAllocator(context.memory);}pub fn configurationTransactionAllocator(context: *Context) std.mem.Allocator {    return memory.configurationTransactionAllocator(context.memory);}pub fn initRegion(context: *Context) core.Region {    return core.Region.init(memory.operationNestedAllocator(context.memory));}pub fn transientAllocator(context: *Context) std.mem.Allocator {    return memory.transientAllocator(context.memory);}pub fn operationAllocator(context: *Context) std.mem.Allocator {    return memory.operationNestedAllocator(context.memory);}pub fn fixedOperationAllocator(context: *Context) std.mem.Allocator {    return lifecycle.operationStorageAllocator(context).allocator();}pub fn typeTableAllocator(context: *Context) std.mem.Allocator {    return memory.typeTableAllocator(context.memory);}pub fn typeKeyAllocator(context: *Context) std.mem.Allocator {    return memory.typeKeyAllocator(context.memory);}pub fn typePayloadAllocator(context: *Context) std.mem.Allocator {    return memory.typePayloadAllocator(context.memory);}pub fn attributeTableAllocator(context: *Context) std.mem.Allocator {    return memory.attributeTableAllocator(context.memory);}pub fn attributePayloadAllocator(context: *Context) std.mem.Allocator {    return memory.attributePayloadAllocator(context.memory);}pub fn diagnosticHandlerAllocator(context: *Context) std.mem.Allocator {    return memory.diagnosticHandlerAllocator(context.memory);}pub fn diagnosticPayloadAllocator(context: *Context) std.mem.Allocator {    return memory.diagnosticPayloadAllocator(context.memory);}

Source: lib/choir/src/core/root.zig:23

zig
pub const context = @import("context/root.zig");

Also reachable as

backends.wasm.emission.module_encoding.common.ir.context.

Audit

Definitions39
Public names78
Members4
Version26.7.0
Revisiondaab053ee433