Prechádzať zdrojové kódy

Patches to make the cooperative Kernel (RPI / AMD) compile.
Not yet tested and known to be incomplete.

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7032 8c9fc860-2736-0410-a75d-ab315db34111

felixf 8 rokov pred
rodič
commit
5ec9ea5c5a
1 zmenil súbory, kde vykonal 24 pridanie a 14 odobranie
  1. 24 14
      source/FoxIntermediateBackend.Mod

+ 24 - 14
source/FoxIntermediateBackend.Mod

@@ -7982,7 +7982,8 @@ TYPE
 						IF (size # 1) THEN
 							Emit(Mul(position,reg,reg,IntermediateCode.Immediate(addressType,size))); (*! optimize the multiplication of immediate operands *)
 						END;
-						Emit(Add(position,reg,reg,IntermediateCode.Immediate(addressType,ToMemoryUnits(system,(BaseArrayTypeSize + openDim)* system.addressSize))));
+						AddInt(reg, reg, IntermediateCode.Immediate(addressType,ToMemoryUnits(system,(BaseArrayTypeSize + openDim)* system.addressSize)));
+						(*Emit(Add(position,reg,reg,IntermediateCode.Immediate(addressType,ToMemoryUnits(system,(BaseArrayTypeSize + openDim)* system.addressSize))));*)
 						Emit(Push(position,reg));
 						ReleaseIntermediateOperand(reg);
 						CallThis(position,"Runtime","New", 1);
@@ -11035,10 +11036,12 @@ TYPE
 		
 		PROCEDURE AddPointer(section: IntermediateCode.Section; offset: LONGINT);
 		BEGIN
-			NamedSymbol(modulePointerSection, section.name, NIL, 0, offset);
-			INC(modulePointers);
-			(* optimization hint: this can be done once at the end but for consistency of the first tests we keep it like this *)
-			PatchSize(modulePointerSection, modulePointerSizePC, modulePointers); 
+			IF ~implementationVisitor.backend.cooperative THEN
+				NamedSymbol(modulePointerSection, section.name, NIL, 0, offset);
+				INC(modulePointers);
+				(* optimization hint: this can be done once at the end but for consistency of the first tests we keep it like this *)
+				PatchSize(modulePointerSection, modulePointerSizePC, modulePointers); 
+			END;
 		END AddPointer;
 
 		PROCEDURE GetTypeRecordBaseOffset(numberMethods: LONGINT): LONGINT;
@@ -12182,17 +12185,20 @@ TYPE
 						Global.GetSymbolSegmentedName(typeDeclaration,name);
 						Basic.AppendToSegmentedName(name,".@Info");
 						s := module.allSections.FindByName(name); 
-						PatchSize(s(IntermediateCode.Section), patchInfoPC, pos);
-
-						NScope(declared.recordScope, pos);
+						IF s # NIL THEN (* does not work for coop *)
+							PatchSize(s(IntermediateCode.Section), patchInfoPC, pos);
+							NScope(declared.recordScope, pos);
+						END;
 					|declared: SyntaxTree.CellType DO
 						offset := ToMemoryUnits(module.system,GetTypeRecordBaseOffset(0)*module.system.addressSize);
 						Symbol(section, s,  0, offset);
 						Global.GetSymbolSegmentedName(typeDeclaration,name);
 						Basic.AppendToSegmentedName(name,".@Info");
 						s := module.allSections.FindByName(name); 
-						PatchSize(s(IntermediateCode.Section), patchInfoPC, pos);
-						NScope(declared.cellScope, pos);
+						IF s # NIL THEN
+							PatchSize(s(IntermediateCode.Section), patchInfoPC, pos);
+							NScope(declared.cellScope, pos);
+						END;
 					ELSE
 						Address(section, 0);
 					END;					
@@ -12251,9 +12257,11 @@ TYPE
 				NEW(indirectTypes, 32); 
 				ArrayBlock(section,sizePC,"", FALSE);
 				
-				startPC := section.pc;
-				NModule(module.module, -1);
-				PatchArray(section,sizePC,CurrentIndex());
+				IF ~implementationVisitor.backend.cooperative THEN
+					startPC := section.pc;
+					NModule(module.module, -1);
+					PatchArray(section,sizePC,CurrentIndex());
+				END;
 			END References;
 			
 		(*
@@ -12639,7 +12647,9 @@ TYPE
 			name := "Heaps.AnyPtr";
 			offset := ToMemoryUnits(module.system,TypeRecordBaseOffset*module.system.addressSize);
 			(* set base pointer *)
-			NamedSymbolAt(procTableSection, procTableSectionOffset -1, name, NIL, 0, offset);
+			IF procTableSectionOffset > 0 THEN (*? for coop ? *)
+				NamedSymbolAt(procTableSection, procTableSectionOffset  -1 , name, NIL, 0, offset);
+			END;
 
 			emptyArraySection := Block("Heaps","SystemBlockDesc",".@EmptyArray",emptyArraySectionOffset);
 			ArrayBlock(emptyArraySection,temp,"", FALSE);