瀏覽代碼

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 年之前
父節點
當前提交
efa9bc9ee7
共有 1 個文件被更改,包括 5 次插入3 次删除
  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);