Browse Source

Sort formal parameters in export to resolve non-determinism in order

Yentl Van Tendeloo 7 years ago
parent
commit
923d13fe79
3 changed files with 6 additions and 4 deletions
  1. 5 0
      kernel/modelverse_jit/jit.py
  2. 0 3
      state/modelverse_state/main.py
  3. 1 1
      wrappers/modelverse_SCCD.py

+ 5 - 0
kernel/modelverse_jit/jit.py

@@ -448,6 +448,11 @@ class ModelverseJit(object):
                 #NOTE Patch up strange links...
                 #NOTE Patch up strange links...
                 param_names = [i for i in param_names if i is not None]
                 param_names = [i for i in param_names if i is not None]
                 param_vars = yield [("RD", [param_set_id, k]) for k in param_names]
                 param_vars = yield [("RD", [param_set_id, k]) for k in param_names]
+
+                #NOTE that variables might not be in the correct order, as we just read them out!
+                lst = sorted([(name, var) for name, var in zip(param_names, param_vars)])
+                param_vars = [i[1] for i in lst]
+                param_names = [i[0] for i in lst]
                 self.jitted_parameters[body_id] = (param_vars, param_names, is_mutable)
                 self.jitted_parameters[body_id] = (param_vars, param_names, is_mutable)
 
 
         raise primitive_functions.PrimitiveFinished(self.jitted_parameters[body_id])
         raise primitive_functions.PrimitiveFinished(self.jitted_parameters[body_id])

+ 0 - 3
state/modelverse_state/main.py

@@ -176,8 +176,6 @@ class ModelverseState(object):
 
 
     def create_dict(self, source, data, destination):
     def create_dict(self, source, data, destination):
         if source not in self.nodes and source not in self.edges:
         if source not in self.nodes and source not in self.edges:
-            if destination is not None:
-                print("CREATE DICT FAILED FOR " + str(locals()))
             return None
             return None
         elif destination not in self.nodes and destination not in self.edges:
         elif destination not in self.nodes and destination not in self.edges:
             return None
             return None
@@ -230,7 +228,6 @@ class ModelverseState(object):
             del self.cache[node][value]
             del self.cache[node][value]
         except KeyError:
         except KeyError:
             # Didn't exist
             # Didn't exist
-            #print("No such entry: " + str(locals()))
             pass
             pass
         except:
         except:
             raise
             raise

+ 1 - 1
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
 
-Date:   Tue Apr 24 07:27:14 2018
+Date:   Tue Apr 24 09:20:59 2018
 
 
 Model author: Yentl Van Tendeloo
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server
 Model name:   MvK Server