Bladeren bron

Activated Option "AliasOnlyExported" such that only aliases appear in object files that are required to link or load object files
Procedures that are implicitly required at runtime need to be exported, too.


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

felixf 7 jaren geleden
bovenliggende
commit
252996767c
4 gewijzigde bestanden met toevoegingen van 27 en 4 verwijderingen
  1. 1 1
      source/FoxGenericObjectFile.Mod
  2. 1 1
      source/FoxIntermediateBackend.Mod
  3. 23 0
      source/FoxSyntaxTree.Mod
  4. 2 2
      source/Win32.Objects.Mod

+ 1 - 1
source/FoxGenericObjectFile.Mod

@@ -13,7 +13,7 @@ CONST
 
 	(* optimizations *)
 	PatchFixups = TRUE; (* patch all fixups that can be processed during object file generation *)
-	AliasOnlyExported = FALSE;  (* create an alias only for exported sections *)
+	AliasOnlyExported = TRUE;  (* create an alias only for exported sections *)
 	DetailedStatistics = FALSE;
 
 VAR

+ 1 - 1
source/FoxIntermediateBackend.Mod

@@ -14704,7 +14704,7 @@ TYPE
 
 	PROCEDURE IsExported(symbol: SyntaxTree.Symbol): BOOLEAN;
 	BEGIN
-		RETURN (symbol # NIL) & (symbol.access * SyntaxTree.Public # {})
+		RETURN (symbol # NIL) & symbol.NeedsSection();
 	END IsExported;
 
 

+ 23 - 0
source/FoxSyntaxTree.Mod

@@ -3154,6 +3154,16 @@ TYPE
 		PROCEDURE NeedsTrace* (): BOOLEAN;
 		BEGIN RETURN FALSE;
 		END NeedsTrace;
+		
+		(* If a symbol needs to be vieible in the object file
+			A symbol needs to be visible in an object file when it is require during linking
+			This is the case for exported symbols but also for methods in a method table, for instance.
+		*)
+		PROCEDURE NeedsSection*(): BOOLEAN;
+		BEGIN
+			RETURN access * Public # {};
+		END NeedsSection;
+
 
 	END Symbol;
 
@@ -3193,6 +3203,12 @@ TYPE
 		VAR position: LONGINT;
 		BEGIN position := SELF.position.start; v.VisitTypeDeclaration(SELF)
 		END Accept;
+		
+		(* type declarations should be generally included in object files *)
+		PROCEDURE NeedsSection*(): BOOLEAN;
+		BEGIN
+			RETURN TRUE;
+		END NeedsSection;
 
 	END TypeDeclaration;
 
@@ -3474,10 +3490,17 @@ TYPE
 		BEGIN SELF.methodNumber := methodNumber
 		END SetMethodNumber;
 
+		PROCEDURE NeedsSection(): BOOLEAN;
+		BEGIN
+			RETURN (access * Public # {}) OR (methodNumber >= 0);
+		END NeedsSection;
+
 		PROCEDURE Accept*(v: Visitor);
 		VAR position: LONGINT;
 		BEGIN position := SELF.position.start; v.VisitProcedure(SELF)
 		END Accept;
+		
+
 
 	END Procedure;
 

+ 2 - 2
source/Win32.Objects.Mod

@@ -1302,7 +1302,7 @@ END TimerFrequency;
 VAR GetProcedureName*: PROCEDURE (pc: ADDRESS; VAR n: ARRAY OF CHAR; VAR spc: ADDRESS);
 
 
-PROCEDURE LeaveA2;
+PROCEDURE LeaveA2*;
 VAR cur: Process; ebp,n: ADDRESS;
 BEGIN
 	IF clock = NIL THEN RETURN END;
@@ -1315,7 +1315,7 @@ BEGIN
 	END;
 END LeaveA2;
 
-PROCEDURE ReenterA2;
+PROCEDURE ReenterA2*;
 VAR cur: Process;
 BEGIN
 	IF clock = NIL THEN RETURN END;