Переглянути джерело

Added self pointer for precise GC
Added OBJECT; as pointer for precise GC

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

felixf 9 роки тому
батько
коміт
8a4342849c
1 змінених файлів з 12 додано та 6 видалено
  1. 12 6
      source/FoxIntermediateBackend.Mod

+ 12 - 6
source/FoxIntermediateBackend.Mod

@@ -11064,7 +11064,7 @@ TYPE
 			Info(section,"nextRealtime: HeapBlock;");
 			Address(section,0);
 		END HeapBlock;
-
+		
 		PROCEDURE ProtectedHeapBlock(CONST moduleName, typeName: ARRAY OF CHAR; section: IntermediateCode.Section; dataAdrOffset: LONGINT);
 		VAR i: LONGINT;
 		BEGIN
@@ -11233,10 +11233,8 @@ TYPE
 		VAR variable: SyntaxTree.Variable; i,n,size: LONGINT; base: SyntaxTree.Type;
 		BEGIN
 			type := type.resolved;
-			IF type IS SyntaxTree.AnyType THEN
-				Symbol(section, symbol, 0, (offset ));
-				INC(numberPointers);
-
+			IF (type IS SyntaxTree.AnyType) OR (type IS SyntaxTree.ObjectType) THEN
+				Symbol(section, symbol, 0, (offset )); INC(numberPointers);
 				IF Trace THEN D.Str("ptr at offset="); D.Int(offset,1); D.Ln; END;
 			ELSIF (type IS SyntaxTree.PortType) & implementationVisitor.backend.cellsAreObjects THEN
 				Symbol(section, symbol, 0, offset); INC(numberPointers);
@@ -12648,7 +12646,7 @@ TYPE
 		END Module;
 
 		PROCEDURE PointerArray(source: IntermediateCode.Section; scope: SyntaxTree.Scope; VAR numberPointers: LONGINT);
-		VAR variable: SyntaxTree.Variable; pc: LONGINT; symbol: Sections.Section; parameter: SyntaxTree.Parameter;
+		VAR variable: SyntaxTree.Variable; pc: LONGINT; symbol: Sections.Section; parameter: SyntaxTree.Parameter; parametersSize: SIZE;
 		BEGIN
 			ArrayBlock(source,pc,"",FALSE);
 			Info(source, "pointer offsets array data");
@@ -12674,6 +12672,14 @@ TYPE
 						END;
 						parameter := parameter.nextParameter;
 					END;
+					IF scope(SyntaxTree.ProcedureScope).ownerProcedure.type(SyntaxTree.ProcedureType).isDelegate THEN 
+						parametersSize := ProcedureParametersSize(module.system,scope(SyntaxTree.ProcedureScope).ownerProcedure);
+						INC(parametersSize,ToMemoryUnits(module.system,module.system.addressSize));
+						IF PreciseGCSupport THEN
+							INC(parametersSize,ToMemoryUnits(module.system,module.system.addressSize));
+						END;
+						Symbol(source, NIL, 0, parametersSize); INC(numberPointers);
+					END;
 					variable := scope(SyntaxTree.ProcedureScope).firstVariable;
 					WHILE(variable # NIL) DO
 						IF ~(variable.untraced) & (variable.externalName = NIL) THEN