From 00746bf09047cdf01c19dac513a532bcf3ed3ea3 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Wed, 9 Jul 2025 14:41:19 +0800 Subject: Stable names and backwards compat for serialized IR modules (#7644) * stable names * tests, options and ci for stable names * Add back compat design document * fix warnings * formatting * comment * neaten * regenerate command line reference * consolidate ci scripts * faster ci * remove libreadline * Move new function to end of interface --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> --- source/slang/slang-ir.h | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'source/slang/slang-ir.h') diff --git a/source/slang/slang-ir.h b/source/slang/slang-ir.h index c29a52ff7..712763e86 100644 --- a/source/slang/slang-ir.h +++ b/source/slang/slang-ir.h @@ -2357,8 +2357,10 @@ struct IRAnalysis IRDominatorTree* getDominatorTree(); }; +FIDDLE() struct IRModule : RefObject { + FIDDLE(...) public: enum { @@ -2441,9 +2443,28 @@ public: ContainerPool& getContainerPool() { return m_containerPool; } + // + // The range of module versions this compiler supports + // + // This will need to be updated if for example an instruction is removed, + // the max supported version should be incremented and the min supported + // version set to above the last version an instance of that instruction + // could be found + // + // Additionally this should be updated when new instructions are added, + // however only k_maxSupportedModuleVersion needs to be incremented in that + // case + // + // It represents the version of module regarding semantics and doesn't have + // anything to do with serialization format + // + const static UInt k_minSupportedModuleVersion = 0; + const static UInt k_maxSupportedModuleVersion = 0; + private: friend struct IRSerialReadContext; friend struct IRSerialWriteContext; + friend struct Fossilized_IRModule; IRModule() = delete; @@ -2463,10 +2484,13 @@ private: /// instructions from an arbitrary IR instruction we expect to find the /// `IRModuleInst` for the module the instruction belongs to, if any. /// - IRModuleInst* m_moduleInst = nullptr; + FIDDLE() IRModuleInst* m_moduleInst = nullptr; // The name of the module. - Name* m_name = nullptr; + FIDDLE() Name* m_name = nullptr; + + // The version of the module as it was loaded + FIDDLE() UInt m_version = k_maxSupportedModuleVersion; /// The memory arena from which all IR instructions (and any associated state) in this module /// are allocated. -- cgit v1.2.3