[vala] codegen: Do not use temp var when accessing floating locals



commit 26020d62909d0871c9f6051c10ef73885c033310
Author: JÃrg Billeter <j bitron ch>
Date:   Mon Aug 1 21:51:42 2011 +0200

    codegen: Do not use temp var when accessing floating locals

 codegen/valaccodememberaccessmodule.vala |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 4e428fb..569e1dc 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -698,11 +698,17 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 			use_temp = false;
 		}
 		if (variable.single_assignment && !result.value_type.is_real_struct_type ()) {
-			// no need to copy values from variables that are exactly once
+			// no need to copy values from variables that are assigned exactly once
 			// as there is no risk of modification
 			// except for structs that are always passed by reference
 			use_temp = false;
 		}
+		var local = variable as LocalVariable;
+		if (local != null && local.floating) {
+			// floating locals are generated internally and safe to
+			// access without temporary variable
+			use_temp = false;
+		}
 
 		if (use_temp) {
 			result = (GLibValue) store_temp_value (result, variable);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]