Browse Source

Reverted bad changes and replaced with new patch

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6569 8c9fc860-2736-0410-a75d-ab315db34111
felixf 9 năm trước cách đây
mục cha
commit
84f025c53a
2 tập tin đã thay đổi với 7 bổ sung30 xóa
  1. 0 20
      source/FoxBinaryObjectFile.Mod
  2. 7 10
      source/FoxIntermediateBackend.Mod

+ 0 - 20
source/FoxBinaryObjectFile.Mod

@@ -425,9 +425,6 @@ TYPE
 				WHILE fixup # NIL DO
 					next := fixup.nextFixup;
 					symbol := module.allSections.FindByName(fixup.symbol.name);
-					IF symbol = NIL THEN
-						symbol := module.importedSections.FindByName(fixup.symbol.name)
-					END;
 					IF symbol # NIL THEN
 						symbol.SetReferenced(TRUE);
 					ELSIF Trace THEN
@@ -742,9 +739,6 @@ TYPE
 					typeDeclaration := type.typeDeclaration; (* must be non-nil *)
 					typeDeclaration.GetName(name);
 					section := symbols.BySymbol(type.typeDeclaration);
-					IF section = NIL THEN 
-						section := importedSymbols.BySymbol(type.typeDeclaration);
-					END;
 					ASSERT(section # NIL);
 					w.RawNum((section.offset )); (* type descriptor section offset *)
 					IF Trace THEN
@@ -1416,9 +1410,6 @@ TYPE
 						IF type.recordScope.ownerModule = importedModule THEN (* type belongs to currently processed module *)
 							IF Trace  THEN D.Str("UseTypeFP:"); D.Str(name); D.Str("?"); D.Ln END;
 							t := symbols.BySymbol(type.typeDeclaration); (* TODO *)
-							IF t = NIL THEN 
-								t := importedSymbols.BySymbol(type.typeDeclaration);
-							END;
 							IF (t # NIL) & (t.referenced) (*(t.fixups # NIL)*) THEN
 								t.referenced := FALSE;
 
@@ -1508,7 +1499,6 @@ TYPE
 						type := typeDeclaration.declaredType;
 						IF type IS SyntaxTree.PointerType THEN type := type(SyntaxTree.PointerType).pointerBase END;
 						sym := symbols.BySymbol(typeDeclaration); (* only if has been used -- contained in module sections: alias *)
-						IF sym = NIL THEN sym := importedSymbols.BySymbol(typeDeclaration) END;
 						IF (sym # NIL) & (sym.referenced) THEN
 							UseEntry(importedModule,typeDeclaration,0,"");
 							UseType(typeDeclaration.declaredType);
@@ -2200,16 +2190,6 @@ TYPE
 				END
 			END;
 
-			(* enter unused types to local sections -- required, otherwise traps *)
-			FOR i := 0 TO module.importedSections.Length() - 1 DO
-				section := module.importedSections.GetSection(i);
-				IF (section.type = Sections.ConstSection) & (section.symbol # NIL) & (section.symbol IS SyntaxTree.TypeDeclaration) THEN
-					IF symbols.BySymbol(section.symbol) = NIL THEN 
-						ASSERT(Enter(section, symbols, symbol))
-					END;
-				END;
-			END;
-
 			IF Trace THEN
 				D.String("imported sections(module) "); D.Ln;
 				module.importedSections.Dump(D.Log); D.Ln;

+ 7 - 10
source/FoxIntermediateBackend.Mod

@@ -5868,11 +5868,9 @@ TYPE
 					IF source = NIL THEN
 						null := 0;
 						GetCodeSectionNameForSymbol(td,name);
-						IF (td.scope = NIL) OR (td.scope.ownerModule = module.module) THEN
-							source := NewSection(module.allSections, Sections.ConstSection, name,td,commentPrintout # NIL);
-						ELSE
-							source := NewSection(module.importedSections, Sections.ConstSection, name,td,commentPrintout # NIL);
-						END;
+						Basic.SuffixSegmentedName (name, Basic.MakeString("@"));
+						Basic.SuffixSegmentedName (name, module.module.name);
+						source := NewSection(module.allSections, Sections.ConstSection, name,td,commentPrintout # NIL);
 						IntermediateCode.InitImmediate(op,addressType,0);
 						source(IntermediateCode.Section).Emit(Data(position,op));
 						source.SetReferenced(FALSE)
@@ -12784,11 +12782,10 @@ TYPE
 					ELSE
 						(* data section in intermediate code *)
 						Global.GetSymbolSegmentedName(td,name);
-						IF (td.scope = NIL) OR (td.scope.ownerModule = module.module) THEN
-							tir := IntermediateCode.NewSection(module.allSections, Sections.ConstSection, name,td,implementationVisitor.dump # NIL);
-						ELSE
-							tir := IntermediateCode.NewSection(module.importedSections, Sections.ConstSection, name,td,implementationVisitor.dump # NIL);
-						END;
+						Basic.SuffixSegmentedName (name, Basic.MakeString("@"));
+						Basic.SuffixSegmentedName (name, module.module.name);
+
+						tir := IntermediateCode.NewSection(module.allSections, Sections.ConstSection, name,td,implementationVisitor.dump # NIL);
 						IntermediateCode.InitImmediate(op,IntermediateCode.GetType(module.system, module.system.addressType),0);
 						tir.Emit(Data(-1,op));
 					END;