Browse Source

More fixes, still broken as need to remove ["metamodel"]["model"]

Yentl Van Tendeloo 8 years ago
parent
commit
581a4f0438

BIN
bootstrap/bootstrap.m.gz


+ 0 - 3
bootstrap/modelling.alc

@@ -213,9 +213,6 @@ Void function instantiate_attribute(model : Element, element : String, attribute
 		log("For element " + element)
 		return!
 		
-	// Make a copy of the value, as it is likely that this value is reused later on
-	value = create_value(value)
-
 	attr_name = model_add_value(model, (element + ".") + attribute_name, value)
 	retype(model, attr_name, reverseKeyLookup(model["metamodel"]["model"], read_edge_dst(model["metamodel"]["model"][attr_type])))
 	instantiate_link(model, attr_type, "", element, attr_name)

+ 4 - 2
core/core_algorithm.alc

@@ -132,14 +132,16 @@ Element function get_full_model(model_id : String):
 	m = create_node()
 	all_links = allOutgoingAssociationInstances(core, model_id, "instanceOf")
 
-	if (read_nr_out(all_links) != 1):
+	if (read_nr_out(all_links) > 1):
 		log("WARNING: multiple instanceOf relations were detected for this model; picking one at random!")
+	elif (read_nr_out(all_links) == 0):
+		log("ERROR: untyped model!")
 	
 	choice = set_pop(allOutgoingAssociationInstances(core, model_id, "instanceOf"))
 
 	dict_add(m, "model", import_node(read_attribute(core, model_id, "location")))
 	dict_add(m, "type_mapping", read_attribute(core, choice, "type_mapping"))
-	dict_add(m, "metamodel", import_node(read_attribute(core, choice, "location")))
+	dict_add(m, "metamodel", import_node(read_attribute(core, readAssociationDestination(core, choice), "location")))
 
 	return m!
 

+ 11 - 7
hybrid_server/classes/mvkcontroller.xml

@@ -80,13 +80,17 @@
             <![CDATA[
             reply = None
             commands = []
-            while 1:
-                commands = self.mvk.execute_yields(taskname, operation, params, reply)
-                if commands is None:
-                    break
-                reply = [self.mvs_operations[command[0]](*(command[1]))[0] for command in commands]
-                #for c, r in zip(commands, reply):
-                #    print("%s --> %s" % (c, r))
+            try:
+                while 1:
+                    commands = self.mvk.execute_yields(taskname, operation, params, reply)
+                    if commands is None:
+                        break
+                    reply = [self.mvs_operations[command[0]](*(command[1]))[0] for command in commands]
+                    #for c, r in zip(commands, reply):
+                    #    print("%s --> %s" % (c, r))
+            except:
+                print("ERROR: " + str(self.mvk.debug_info.get(taskname, "Unknown taskname")))
+                raise
             ]]>
         </body>
     </method>

+ 2 - 2
scripts/run_local_modelverse.py

@@ -7,5 +7,5 @@ if len(sys.argv) < 2:
     sys.stderr.write("    %s port\n" % sys.argv[0])
 else:
     subprocess.check_call([sys.executable, "-m", "sccd.compiler.sccdc", "-p", "threads", "server.xml"], cwd="hybrid_server")
-    subprocess.call([sys.executable, "run_mvk_server.py"] + sys.argv[1:] + ["--kernel=baseline-jit"], cwd="hybrid_server")
-    #subprocess.call([sys.executable, "run_mvk_server.py"] + sys.argv[1:] + ["--kernel=legacy-interpreter"], cwd="hybrid_server")
+    #subprocess.call([sys.executable, "run_mvk_server.py"] + sys.argv[1:] + ["--kernel=baseline-jit"], cwd="hybrid_server")
+    subprocess.call([sys.executable, "run_mvk_server.py"] + sys.argv[1:] + ["--kernel=legacy-interpreter"], cwd="hybrid_server")

+ 1 - 0
state/modelverse_state/main.py

@@ -149,6 +149,7 @@ class ModelverseState(object):
     def create_nodevalue(self, value):
         if not self.is_valid_datavalue(value):
             print("Not correct: " + str(value))
+            raise Exception()
             return (None, status.FAIL_CNV_OOB)
         self.values[self.free_id] = value
         self.nodes.add(self.free_id)