コード例 #1
0
            public CompilationUnitSet(ReadyToRunCompilationModuleGroupBase compilationGroup, ModuleDesc module)
            {
                CompilationUnitIndex compilationIndex = compilationGroup.ModuleToCompilationUnitIndex(module);

                _bits = new BitArray(((int)compilationIndex) + 1);
                _bits.Set((int)compilationIndex, true);
            }
コード例 #2
0
        // Compilation Unit Index is the compilation unit of a given module. If the compilation unit
        // is unknown the module will be given an independent index from other modules, but
        // IsCompilationUnitIndexExact will return false for that index. All compilation unit indices
        // are >= 2, to allow for 0 and 1 to be sentinel values.
        private CompilationUnitIndex ModuleToCompilationUnitIndex(ModuleDesc nonEcmaModule)
        {
            EcmaModule module = (EcmaModule)nonEcmaModule;

            if (IsModuleInCompilationGroup(module))
            {
                return(CompilationUnitIndex.Current);
            }

            if (!VersionsWithModule(module))
            {
                return(CompilationUnitIndex.OutsideOfVersionBubble);
            }

            // Assemblies within the version bubble, but not compiled as part of this compilation unit are given
            // unique separate compilation units. The practical effect of this is that the compiler can assume that
            // types which are entirely defined in one module can be laid out in an optimal fashion, but types
            // which are laid out relying on multiple modules cannot have their type layout precisely known as
            // it is unknown if the modules are bounding into a single composite image or into individual assemblies.
            lock (_moduleCompilationUnits)
            {
                if (!_moduleCompilationUnits.TryGetValue(module, out CompilationUnitIndex compilationUnit))
                {
                    compilationUnit      = _nextCompilationUnit;
                    _nextCompilationUnit = (CompilationUnitIndex)(((int)_nextCompilationUnit) + 1);
                    _moduleCompilationUnits.Add(module, compilationUnit);
                }

                return(compilationUnit);
            }
        }
コード例 #3
0
 // Indicate whether or not the compiler can take a hard dependency on the meaning of
 // the compilation unit index.
 private bool IsCompilationUnitIndexExact(CompilationUnitIndex compilationUnitIndex)
 {
     // Currently the implementation is only allowed to assume 2 details.
     // 1. That any assembly which is compiled with inputbubble set shall have its entire set of dependencies compiled as R2R
     // 2. That any assembly which is compiled in the current process may be considered to be part of a single unit.
     //
     // At some point, the compiler could take new parameters to allow the compiler to know that assemblies not in the current compilation
     // unit are to be compiled into composite images or into separate binaries, and this helper function could return true for these other
     // compilation unit shapes.
     if (compilationUnitIndex != CompilationUnitIndex.Current)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }