Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit c93a529

Browse files
committed
[[ ModuleAssemblies ]] Don't include support modules in manifest requirements
Support modules in a multi-module assembly should not be included in the list of required modules in manifest, as they are compiled into the one bytecode file and thus are not strictly dependencies from an external point of view.
1 parent 027cc07 commit c93a529

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

toolchain/lc-compile/src/emit.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ extern "C" void EmitPosition(PositionRef position);
171171
extern "C" void OutputBeginManifest(void);
172172

173173
extern "C" int IsBootstrapCompile(void);
174+
extern "C" int IsNotBytecodeOutput(void);
174175

175176
extern "C" void DependStart(void);
176177
extern "C" void DependFinish(void);

toolchain/lc-compile/src/generate.g

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@
2828

2929
'var' ModuleDependencyList : NAMELIST
3030

31+
-- Keep a list of all modules for which bytecode is being generated
32+
'var' CompiledModuleList : NAMELIST
33+
3134
'var' IgnoredModuleList : NAMELIST
3235

3336
'var' GeneratingModuleIndex : INT
3437

3538
'action' GenerateModules(MODULELIST)
3639

3740
'rule' GenerateModules(List):
41+
CompiledModuleList <- nil
3842
GeneratingModuleIndex <- 1
3943
EmitStart()
4044
GenerateForEachModule(List)
@@ -54,6 +58,7 @@
5458
'action' Generate(MODULE)
5559

5660
'rule' Generate(Module):
61+
CompiledModuleList <- nil
5762
GeneratingModuleIndex <- 1
5863
EmitStart()
5964
GenerateSingleModule(Module)
@@ -80,6 +85,9 @@
8085
where(Kind -> library)
8186
EmitBeginLibraryModule(ModuleName -> ModuleIndex)
8287
|)
88+
89+
AddModuleToCompiledList(ModuleName)
90+
8391
Info'Index <- ModuleIndex
8492
GeneratingModuleIndex -> Generator
8593
Info'Generator <- Generator
@@ -185,13 +193,34 @@
185193

186194
'action' AddModuleToDependencyList(NAME)
187195

196+
'rule' AddModuleToDependencyList(Name):
197+
-- If this is in the list of compiled modules, then don't
198+
-- include in list of required modules in manifest - in
199+
-- particular if we are creating a multi-module assembly,
200+
-- then this is not an external dependency.
201+
CompiledModuleList -> NoDependencyList
202+
IsNameInList(Name, NoDependencyList)
203+
188204
'rule' AddModuleToDependencyList(Name):
189205
ModuleDependencyList -> List
190206
IsNameInList(Name, List)
191207
192208
'rule' AddModuleToDependencyList(Name):
193209
ModuleDependencyList -> List
194210
ModuleDependencyList <- namelist(Name, List)
211+
212+
'action' AddModuleToCompiledList(NAME)
213+
214+
'rule' AddModuleToCompiledList(Name):
215+
IsNotBytecodeOutput()
216+
217+
'rule' AddModuleToCompiledList(Name):
218+
CompiledModuleList -> List
219+
IsNameInList(Name, List)
220+
221+
'rule' AddModuleToCompiledList(Name):
222+
CompiledModuleList -> List
223+
CompiledModuleList <- namelist(Name, List)
195224
196225
'action' GenerateManifestRequires(NAMELIST)
197226

toolchain/lc-compile/src/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ int IsBootstrapCompile(void)
3939
return s_is_bootstrap;
4040
}
4141

42+
int IsNotBytecodeOutput(void)
43+
{
44+
return OutputFileAsBytecode == 0;
45+
}
46+
4247
int IsDependencyCompile(void)
4348
{
4449
return DependencyMode != kDependencyModeNone;

toolchain/lc-compile/src/support.g

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
'export'
2323
IsBootstrapCompile
24+
IsNotBytecodeOutput
2425

2526
NegateReal
2627

@@ -366,6 +367,7 @@
366367
--------------------------------------------------------------------------------
367368

368369
'condition' IsBootstrapCompile()
370+
'condition' IsNotBytecodeOutput()
369371

370372
--------------------------------------------------------------------------------
371373

0 commit comments

Comments
 (0)