Browse Source

This improves the memory fragmentation when using the compiler with large files

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

+ 2 - 1
source/FoxIntermediateCode.Mod

@@ -120,7 +120,7 @@ TYPE
 		ModeString			mode, string
 		ModeString			mode, string
 	*)
 	*)
 
 
-	Instruction* = RECORD
+	Instruction* = POINTER TO RECORD
 		opcode-: SHORTINT; (* instruction opcode *)
 		opcode-: SHORTINT; (* instruction opcode *)
 		subtype-: SHORTINT; (* for special backend instruction *)
 		subtype-: SHORTINT; (* for special backend instruction *)
 		textPosition-: LONGINT; (* for error handling and tracking (findPC) *)
 		textPosition-: LONGINT; (* for error handling and tracking (findPC) *)
@@ -815,6 +815,7 @@ TYPE
 	PROCEDURE InitInstruction*(VAR instr: Instruction; textPosition: LONGINT; opcode: SHORTINT; op1,op2,op3: Operand);
 	PROCEDURE InitInstruction*(VAR instr: Instruction; textPosition: LONGINT; opcode: SHORTINT; op1,op2,op3: Operand);
 	VAR format: InstructionFormat; mode1, mode2, mode3: LONGINT; (* debugging *)
 	VAR format: InstructionFormat; mode1, mode2, mode3: LONGINT; (* debugging *)
 	BEGIN
 	BEGIN
+		IF instr = NIL THEN NEW(instr) END;
 		format := instructionFormat[opcode];
 		format := instructionFormat[opcode];
 		mode1 := op1.mode;
 		mode1 := op1.mode;
 		mode2 := op2.mode;
 		mode2 := op2.mode;