Browse Source

Reachability analysis uses dict_add_fast

Yentl Van Tendeloo 8 years ago
parent
commit
6dd812b4f7
1 changed files with 13 additions and 13 deletions
  1. 13 13
      integration/code/reachability.alc

+ 13 - 13
integration/code/reachability.alc

@@ -54,8 +54,8 @@ Element function reachability_graph(params : Element, output_mms : Element):
 			link = set_pop(links)
 			name = reverseKeyLookup(in_model["model"], read_edge_src(in_model["model"][link]))
 			link_weight = read_attribute(in_model, link, "weight")
-			dict_add(tv, name, link_weight)
-		dict_add(transition_vectors_consume, transition, tv)
+			dict_add_fast(tv, name, link_weight)
+		dict_add_fast(transition_vectors_consume, transition, tv)
 
 		tv = create_node()
 		links = allOutgoingAssociationInstances(in_model, transition, "T2P")
@@ -63,8 +63,8 @@ Element function reachability_graph(params : Element, output_mms : Element):
 			link = set_pop(links)
 			name = reverseKeyLookup(in_model["model"], read_edge_dst(in_model["model"][link]))
 			link_weight = read_attribute(in_model, link, "weight")
-			dict_add(tv, name, link_weight)
-		dict_add(transition_vectors_produce, transition, tv)
+			dict_add_fast(tv, name, link_weight)
+		dict_add_fast(transition_vectors_produce, transition, tv)
 
 	workset = create_node()
 
@@ -72,7 +72,7 @@ Element function reachability_graph(params : Element, output_mms : Element):
 	dict_repr = create_node()
 	while (read_nr_out(all_places) > 0):
 		place = set_pop(all_places)
-		dict_add(dict_repr, place, read_attribute(in_model, place, "tokens"))
+		dict_add_fast(dict_repr, place, read_attribute(in_model, place, "tokens"))
 
 	all_transitions_original = allInstances(in_model, "Transition")
 
@@ -80,8 +80,8 @@ Element function reachability_graph(params : Element, output_mms : Element):
 	state_id = 0
 	next_id = 1
 	reachable_states = create_node()
-	dict_add(reachable_states, state_id, dict_repr)
-	dict_add(mappings, state_id, create_node())
+	dict_add_fast(reachable_states, state_id, dict_repr)
+	dict_add_fast(mappings, state_id, create_node())
 	set_add(workset, state_id)
 
 	// And add in the model itself
@@ -149,8 +149,8 @@ Element function reachability_graph(params : Element, output_mms : Element):
 					next_id = next_id + 1
 
 					// Add to all data structures
-					dict_add(reachable_states, target_id, new_dict_repr)
-					dict_add(mappings, target_id, create_node())
+					dict_add_fast(reachable_states, target_id, new_dict_repr)
+					dict_add_fast(mappings, target_id, create_node())
 					set_add(workset, target_id)
 
 					// And add in the model itself
@@ -164,23 +164,23 @@ Element function reachability_graph(params : Element, output_mms : Element):
 						key = set_pop(keys)
 						name = read_attribute(in_model, key, "name")
 						if (bool_not(dict_in(cache, name))):
-							dict_add(cache, name, create_node())
+							dict_add_fast(cache, name, create_node())
 						sub = cache[name]
 						if (bool_not(dict_in(sub, new_dict_repr[key]))):
 							place = instantiate_node(out_model, "Place", "")
 							instantiate_attribute(out_model, place, "name", name)
 							instantiate_attribute(out_model, place, "tokens", new_dict_repr[key])
-							dict_add(sub, new_dict_repr[key], place)
+							dict_add_fast(sub, new_dict_repr[key], place)
 						else:
 							place = sub[new_dict_repr[key]]
 						instantiate_link(out_model, "Contains", "", state, place)
 
 				// Anyway, we have found a transition, which we should store
-				dict_add(mappings[state_id], transition, target_id)
+				dict_add_fast(mappings[state_id], transition, target_id)
 
 				// And also store it in the model itself
 				new_transition = instantiate_link(out_model, "Transition", "", cast_i2s(state_id), cast_i2s(target_id))
 				instantiate_attribute(out_model, new_transition, "name", read_attribute(in_model, transition, "name"))
 
-	dict_add(result, "ReachabilityGraph", out_model)
+	dict_add_fast(result, "ReachabilityGraph", out_model)
 	return result!