2
0
Эх сурвалжийг харах

Patched a problem with instruction width (18 became 32 when data sections were present)

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6521 8c9fc860-2736-0410-a75d-ab315db34111
felixf 9 жил өмнө
parent
commit
311a5949d3

+ 6 - 3
source/FoxIntermediateLinker.Mod

@@ -42,7 +42,7 @@ TYPE
 			backend := defaultBackend;
 			defaultBackend.GetDescription(platformName);
 			
-			backend.Initialize(diagnostics, NIL, {}, NIL, backend.GetSystem());
+
 			NEW(allSections);
 			NEW(importList, 128);
 			NEW(loadedModules, 128);
@@ -1294,9 +1294,9 @@ TYPE
 
 				(* do linking after having read in all blocks to account for potential constraints *)
 				IF ~linker.error THEN linker.Link; END;
-
+				
 				system := backend.GetSystem();
-
+				
 
 				IF (instructionMemorySize > 0) & (instructionMemorySize < code.SizeInBits() DIV system.codeUnit) THEN
 					diagnostics.Error(instanceName,Diagnostics.Invalid, Diagnostics.Invalid, "specified instruction memory size too small");
@@ -1318,6 +1318,9 @@ TYPE
 				IF ~linker.error THEN
 					StaticLinker.WriteOutputFile (code, codeFileName, linker, StaticLinker.WriteTRMCodeFile);
 					StaticLinker.WriteOutputFile (data, dataFileName, linker, StaticLinker.WriteTRMDataFile);
+					
+					
+					
 					IF linkerLog # NIL THEN linkerLog.Update; Files.Register(logFile) END;
 					IF log # NIL THEN
 						log.String(instanceName);

+ 3 - 3
source/FoxTRMBackend.Mod

@@ -2276,8 +2276,9 @@ TYPE
 		 			Basic.SegmentedNameToString(in.name, name);
 			 		out := ResolvedSection(in(IntermediateCode.Section));
 			 		cg.dump := out.comments;
-			 		
-			 		SetInstructionWidth(out.os.unit);
+			 		IF instructionWidth < out.os.unit THEN 
+			 			SetInstructionWidth(out.os.unit);
+			 		END;
 			 		cg.Section(in(IntermediateCode.Section), out);  (*compilation*)
 			 		IF in.symbol # NIL THEN
 				 		procedure := in.symbol(SyntaxTree.Procedure);
@@ -2295,7 +2296,6 @@ TYPE
 			 		in := module.allSections.GetSection(i);
 			 		IF (in.type # Sections.InlineCodeSection) (*& (in(IntermediateCode.Section).resolved = NIL) *) THEN
 				 		out := ResolvedSection(in(IntermediateCode.Section));
-				 		SetInstructionWidth(out.os.unit);
 				 		cg.Section(in(IntermediateCode.Section),out);  
 			 		END
 			 	END