sun::abi

namespace · Source (opens in a new tab)

Owns compatibility policy independently of bundle container decoding.

Checks decoded source declarations against independently lowered signatures.

Checks native archive structure and declared runtime requirements.

Validates compiler capabilities against concrete implementation bindings.

Publishes implemented compatibility rules independently of producer age.

Describes the declarations and retained bodies interpreted by an importer.

Provides diagnostic provenance independently of compatibility decisions.

Describes nominal identity separately from exact implementation artifacts.

Checks native archive structure and referenced runtime services.

Describes machine representations shared by code generation and contracts.

Validates correspondence between revisions without changing code ownership.

Describes CPU requirements shared by lowering and bundle validation.

Generates and checks complete Moon bundle requirements before semantic use.

Validates the emitted boundaries retained in bundle contracts.

Manages the lifetime of ABI validation state for a compilation.

Namespaces

Classes

Structs

Functions

addNativeRequirements

public · function · Source (opens in a new tab)

void sun::abi::addNativeRequirements(BundleContract &contract, const std::vector< std::string > &cpuFeatures, const std::vector< std::string > &runtimeServices)

Adds producer-declared CPU and runtime requirements, rejecting unknown names.

Failure leaves the contract unchanged.

Related: BundleContract

classLayouts

public · function · Source (opens in a new tab)

std::map< std::string, llvm::StructType * > sun::abi::classLayouts(const llvm::Module &module)

Reads recorded class layouts, rejecting malformed or conflicting identities.

compareProducerIdentity

public · function · Source (opens in a new tab)

ProducerOrdering sun::abi::compareProducerIdentity(const ProducerIdentity &producer, const ProducerIdentity &consumer)

Compares official releases within one series; incomplete provenance is unknown.

Related: ProducerOrdering, ProducerIdentity

compatibilityImplementation

public · function · Source (opens in a new tab)

const std::string & sun::abi::compatibilityImplementation()

Returns the build-time compiler and toolchain implementation identity.

compatibilitySupportJson

public · function · Source (opens in a new tab)

std::string sun::abi::compatibilitySupportJson()

Returns the experimental support inventory and producer identity as release JSON.

compatibilityTarget

public · function · Source (opens in a new tab)

TargetProfile sun::abi::compatibilityTarget(const std::string &triple)

Constructs effective target properties from the target machine.

Related: TargetProfile

compatibleRuleImplementations

public · function · Source (opens in a new tab)

bool sun::abi::compatibleRuleImplementations(const std::string &name, const std::string &required, const std::string &supported)

Compares rule identities, allowing experimental fingerprints and bitcode hashes to differ.

Bitcode still requires payload and ABI validation.

compatibleTargetProfiles

public · function · Source (opens in a new tab)

bool sun::abi::compatibleTargetProfiles(const TargetProfile &left, const TargetProfile &right)

Compares machine ABIs, accepting macOS OS-version spellings and ignoring CPU features, which are checked separately.

Serialized profiles stay intact.

Related: TargetProfile

compilerAbiSupport

public · function · Source (opens in a new tab)

const proto::CompilerAbiSupport & sun::abi::compilerAbiSupport()

Returns the immutable build-validated compiler support descriptor.

createAvx2FmaProbe

public · function · Source (opens in a new tab)

llvm::Function * sun::abi::createAvx2FmaProbe(llvm::Module &module)

Builds a baseline probe checking AVX2/FMA hardware and operating-system state.

The body is kept unoptimized so import validation can reconstruct it exactly.

currentProducerIdentity

public · function · Source (opens in a new tab)

ProducerIdentity sun::abi::currentProducerIdentity()

Returns the generated identity and optional official release ordering.

Related: ProducerIdentity

describeBoundaries

public · function · Source (opens in a new tab)

std::vector< std::string > sun::abi::describeBoundaries(const llvm::Module &module)

Describes emitted layouts, signatures and call sites without function bodies.

describeContract

public · function · Source (opens in a new tab)

BundleContract sun::abi::describeContract(const llvm::Module &module)

Generates requirements from emitted code and retained declarations.

Related: BundleContract

describeLibraryAbiSnapshot

public · function · Source (opens in a new tab)

proto::LibraryAbiSnapshot sun::abi::describeLibraryAbiSnapshot(const BundleContract &contract, const std::string &artifact, const std::vector< const moon::ModuleMetadata * > &modules)

Describes the declared library's semantic ABI under its target and rules.

Metadata must already have passed declaration and payload validation.

Related: BundleContract

describeSemantics

public · function · Source (opens in a new tab)

std::string sun::abi::describeSemantics(const moon::ModuleMetadata &metadata)

Canonically encodes semantic metadata, excluding diagnostic and container fields.

emissionImplementation

public · function · Source (opens in a new tab)

std::string sun::abi::emissionImplementation(const std::string &name)

Resolves the build-selected emission default to its wire implementation identity.

encodeBundleContract

public · function · Source (opens in a new tab)

std::string sun::abi::encodeBundleContract(const BundleContract &contract)

Canonically encodes required fields, excluding the hash and producer data.

Related: BundleContract

encodeLibraryAbiSnapshot

public · function · Source (opens in a new tab)

std::string sun::abi::encodeLibraryAbiSnapshot(const proto::LibraryAbiSnapshot &revision)

Canonically encodes a dependency requirement, including its exact keys.

hasGuardedCPURequirements

public · function · Source (opens in a new tab)

bool sun::abi::hasGuardedCPURequirements(const llvm::Function &function)

Recognizes local AVX2/FMA kernels whose every use is a direct call dominated by the successful edge of a reconstructed compiler probe.

Escaping addresses, extra CPU features, and unguarded calls remain unconditional requirements.

hashBitcodeReaderContract

public · function · Source (opens in a new tab)

std::string sun::abi::hashBitcodeReaderContract(const proto::BitcodeReaderContract &contract)

Hashes the sorted bitcode requirement set using canonical tagged integers.

Rejects unknown fields or requirements rather than silently excluding them.

hashBundleContract

public · function · Source (opens in a new tab)

std::string sun::abi::hashBundleContract(const BundleContract &contract)

Computes the domain-separated SHA-256 compatibility identifier.

Related: BundleContract

isExperimentalFingerprint

public · function · Source (opens in a new tab)

bool sun::abi::isExperimentalFingerprint(const std::string &name, const std::string &implementation)

Recognizes well-formed advisory fingerprints for implemented experimental rules.

machineTypeName

public · function · Source (opens in a new tab)

std::string sun::abi::machineTypeName(llvm::Type *type)

Describes LLVM storage structurally; source nominal identities stay separate.

Describes machine types structurally while keeping opaque nominal references.

LLVM linking can replace a named aggregate with its identical literal layout. Sun nominal identities are validated separately from these machine shapes.

matchesLibraryAbiSnapshot

public · function · Source (opens in a new tab)

bool sun::abi::matchesLibraryAbiSnapshot(const proto::LibraryAbiSnapshot &required, const BundleContract &selected, const std::string &artifact, const std::vector< const moon::ModuleMetadata * > &modules, const BundleContract &retaining)

Checks a legacy ABI hash using a retaining bundle's compatible target spelling and advisory rule identities.

Selected metadata and both contracts must have passed validation. Declarations, CPU features, and strict rules stay unchanged.

Related: BundleContract

mergeContractRequirements

public · function · Source (opens in a new tab)

void sun::abi::mergeContractRequirements(BundleContract &destination, const BundleContract &inherited)

Merges inherited requirements, rejecting conflicting rule implementations.

Related: BundleContract

nativeArchiveRule

public · function · Source (opens in a new tab)

std::string sun::abi::nativeArchiveRule(const TargetProfile &target)

Returns the implemented native object rule for a declared target, or fails.

Related: TargetProfile

recordClassLayout

public · function · Source (opens in a new tab)

void sun::abi::recordClassLayout(llvm::Module &module, const std::string &identity, llvm::StructType *storage)

Records the actual class storage under its portable source declaration identity.

remapDeclarationReferences

public · function · Source (opens in a new tab)

void sun::abi::remapDeclarationReferences(google::protobuf::Message &message, const std::map< std::string, std::string > &replacements)

Rewrites only declaration references in a temporary validation copy.

Literal strings and exact implementation symbols are never rewritten.

runtimeFingerprint

public · function · Source (opens in a new tab)

const std::string & sun::abi::runtimeFingerprint()

Returns diagnostic provenance for the compiler's loaded runtime libraries.

supportedRules

public · function · Source (opens in a new tab)

std::map< std::string, std::string > sun::abi::supportedRules()

Returns supported rule implementations; this inventory never authorizes a payload.

validateCompilerSupport

public · function · Source (opens in a new tab)

void sun::abi::validateCompilerSupport(const proto::CompilerAbiSupport &support)

Rejects unsupported schemas, bindings, duplicate entries, and invalid defaults.

validateDeclarationGraph

public · function · Source (opens in a new tab)

void sun::abi::validateDeclarationGraph(const std::vector< const moon::ModuleMetadata * > &modules, bool completeImportSet=false)

Checks declaration ownership and retained references against bundle and compiler-provided identities before import.

Complete import sets also reject unresolved external references and allow identical embedded records.

validateLibraryId

public · function · Source (opens in a new tab)

void sun::abi::validateLibraryId(const std::string &library)

Rejects empty, invalid UTF-8, or oversized library IDs without normalizing their contents.

Library IDs may contain at most 512 UTF-8 bytes.

validateNativeArchives

public · function · Source (opens in a new tab)

void sun::abi::validateNativeArchives(const std::vector< NativeArchiveInput > &archives, const TargetProfile &target, std::set< std::string > *runtimeServices=nullptr, std::set< std::string > *linkSymbols=nullptr)

Checks ELF and Mach-O targets, symbol isolation, and runtime references.

Relocation support and application are delegated to the selected linker. Machine code is trusted to obey the declared CPU and runtime requirements; the compatibility checker validates the bundle's declarations separately. Optional outputs collect runtime rules and external symbols for the contract.

Related: NativeArchiveInput, TargetProfile

validatePayloadDeclarations

public · function · Source (opens in a new tab)

void sun::abi::validatePayloadDeclarations(const std::vector< const moon::ModuleMetadata * > &modules, const llvm::Module &module)

Reconstructs concrete source signatures and compares them with compiled code.

validateSpecializationPayload

public · function · Source (opens in a new tab)

void sun::abi::validateSpecializationPayload(const moon::ModuleMetadata &metadata, const llvm::Module &module)

Checks that advertised precompiled specialization methods have definitions.

Enums

NativeExecution

public · enum · Source (opens in a new tab)

enum class sun::abi::NativeExecution

Selects the runtime that must implement imported native requirements.

JIT

JIT

No documentation comment.

NativeLink

NativeLink

No documentation comment.

NominalKind

public · enum · Source (opens in a new tab)

enum class sun::abi::NominalKind

Distinguishes nominal declaration kinds even when their names match.

Class

Class

No documentation comment.

Interface

Interface

No documentation comment.

Enum

Enum

No documentation comment.

ProducerOrdering

public · enum · Source (opens in a new tab)

enum class sun::abi::ProducerOrdering

Describes the producer relative to the consumer without implying compatibility.

SameBuild

SameBuild

No documentation comment.

Older

Older

No documentation comment.

Newer

Newer

No documentation comment.

Unknown

Unknown

No documentation comment.

Type Aliases

BundleContract

public · typedef · Source (opens in a new tab)

using sun::abi::BundleContract =  proto::BundleContract

The serialized complete contract; its hash is independent of artifact identity.

ProducerIdentity

public · typedef · Source (opens in a new tab)

using sun::abi::ProducerIdentity =  proto::ProducerIdentity

Diagnostic producer provenance, excluded from compatibility hashing.

TargetProfile

public · typedef · Source (opens in a new tab)

using sun::abi::TargetProfile =  proto::TargetProfile

Effective machine properties used to compare targets.