Browse Source

global initialization in the object file only when new object file is used

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6536 8c9fc860-2736-0410-a75d-ab315db34111
felixf 9 years ago
parent
commit
efa9bc9ee7
1 changed files with 5 additions and 3 deletions
  1. 5 3
      source/FoxIntermediateBackend.Mod

+ 5 - 3
source/FoxIntermediateBackend.Mod

@@ -432,7 +432,9 @@ TYPE
 					END;
 				ELSE
 					lastUpdated:= 0;
-					Initialize(x.type, x.initializer, 0);
+					IF implementationVisitor.newObjectFile THEN
+						Initialize(x.type, x.initializer, 0);
+					END;
 					size := ToMemoryUnits(system,system.SizeOf(x.type)) - lastUpdated;	
 					IF size > 0 THEN
 						irv.Emit(Reserve(x.position,size));
@@ -10673,8 +10675,8 @@ TYPE
 				END;
 
 				section.SetPositionOrAlignment(procedure.fixed, procedure.alignment);
-				IF moduleBody THEN
-					(* InitVariables(moduleScope) *)
+				IF moduleBody & ~newObjectFile THEN
+					InitVariables(moduleScope)
 				END;
 				IF (scope.outerScope # NIL) & (scope.outerScope IS SyntaxTree.CellScope) THEN
 					cellScope := scope.outerScope(SyntaxTree.CellScope);