Changeset: 39063cbcb55b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=39063cbcb55b
Modified Files:
        clients/Tests/exports.stable.out
        monetdb5/mal/Tests/tst120a.malC
        monetdb5/mal/Tests/tst120a.stable.out
        monetdb5/mal/Tests/tst120b.malC
        monetdb5/mal/Tests/tst120b.stable.out
        monetdb5/mal/Tests/tst804.stable.err
        monetdb5/mal/mal.c
        monetdb5/mal/mal_parser.c
        monetdb5/mal/mal_private.h
        monetdb5/mal/mal_scenario.c
        sql/test/Dependencies/Tests/Dependencies.stable.out
        sql/test/Dependencies/Tests/Dependencies.stable.out.int128
Branch: default
Log Message:

Wrapup modules
During system exit all modules should be properly freed before an exit.
Extended the tests to see if the functions exist at the right place


diffs (truncated from 346 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -2219,7 +2219,6 @@ str mal_quote(const char *msg, size_t si
 MT_Lock mal_remoteLock;
 void mal_resource_reset(void) __attribute__((__visibility__("hidden")));
 void mal_runtime_reset(void) __attribute__((__visibility__("hidden")));
-void mal_scenario_reset(void) __attribute__((__visibility__("hidden")));
 int mal_trace;
 void mal_unquote(char *msg);
 str manifoldRef;
diff --git a/monetdb5/mal/Tests/tst120a.malC b/monetdb5/mal/Tests/tst120a.malC
--- a/monetdb5/mal/Tests/tst120a.malC
+++ b/monetdb5/mal/Tests/tst120a.malC
@@ -1,2 +1,5 @@
 module top;
-function first(i:sht):sht; return first:= 0:sht; end first;
+function first(i:int):int; return first:= 0:int; end first;
+i:=first(1);
+i:=top.first(1);
+io.print(i);
diff --git a/monetdb5/mal/Tests/tst120a.stable.out 
b/monetdb5/mal/Tests/tst120a.stable.out
--- a/monetdb5/mal/Tests/tst120a.stable.out
+++ b/monetdb5/mal/Tests/tst120a.stable.out
@@ -29,6 +29,7 @@ Ready.
 # 15:36:13 >  "mclient" "-lmal" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-16148" "--port=33827"
 # 15:36:13 >  
 
+[ 0    ]
 
 # 15:36:13 >  
 # 15:36:13 >  "Done."
diff --git a/monetdb5/mal/Tests/tst120b.malC b/monetdb5/mal/Tests/tst120b.malC
--- a/monetdb5/mal/Tests/tst120b.malC
+++ b/monetdb5/mal/Tests/tst120b.malC
@@ -1,3 +1,9 @@
 module bottom;
 function first(i:str):int; c:=1; return c; end first;
 function second(i:str):int; return second:=1; end second;
+
+i:= bottom.first("");
+io.print(i);
+
+i:= bottom.second("");
+io.print(i);
diff --git a/monetdb5/mal/Tests/tst120b.stable.out 
b/monetdb5/mal/Tests/tst120b.stable.out
--- a/monetdb5/mal/Tests/tst120b.stable.out
+++ b/monetdb5/mal/Tests/tst120b.stable.out
@@ -29,6 +29,8 @@ Ready.
 # 15:36:13 >  "mclient" "-lmal" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-16148" "--port=33827"
 # 15:36:13 >  
 
+[ 1    ]
+[ 1    ]
 
 # 15:36:14 >  
 # 15:36:14 >  "Done."
diff --git a/monetdb5/mal/Tests/tst804.stable.err 
b/monetdb5/mal/Tests/tst804.stable.err
--- a/monetdb5/mal/Tests/tst804.stable.err
+++ b/monetdb5/mal/Tests/tst804.stable.err
@@ -42,8 +42,6 @@ QUERY = # test definiton of a function i
         end foo;
 ERROR = !SyntaxException:parseError:function wrong.message():void;
         !SyntaxException:parseError:                      ^<module> name not 
defined
-        !SyntaxException:parseError:   io.print("shouldn't come here");
-        !SyntaxException:parseError:^';' expected
         !SyntaxException:parseError:end message;
         !SyntaxException:parseError:   ^non matching end label
         !TypeException:user.foo[1]:'wrong.message' undefined in:     
wrong.message();
diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -141,14 +141,11 @@ void mserver_reset(void)
        mal_factory_reset();
        mal_dataflow_reset();
        THRdel(mal_clients->mythread);
-       GDKreset(0);    // terminate all other threads
        mal_client_reset();
-       mal_module_reset();
-       mal_module_reset();
        mal_linker_reset();
        mal_resource_reset();
        mal_runtime_reset();
-       mal_scenario_reset();
+       mal_module_reset();
 
        memset((char*)monet_cwd,0, sizeof(monet_cwd));
        monet_memory = 0;
@@ -156,6 +153,7 @@ void mserver_reset(void)
        mal_trace = 0;
        /* No need to clean up the namespace, it will simply be extended
         * upon restart mal_namespace_reset(); */
+       GDKreset(0);    // terminate all other threads
 }
 
 
diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -1066,6 +1066,11 @@ fcnHeader(Client cntxt, int kind)
        if (currChar(cntxt) == '.') {
                nextChar(cntxt); /* skip '.' */
                modnme = fnme;
+               if (isModuleDefined(cntxt->nspace, modnme) == FALSE) {
+                       parseError(cntxt, "<module> name not defined\n");
+                       skipToEnd(cntxt);
+                       return curBlk;
+               }
                l = operatorLength(cntxt);
                if (l == 0)
                        l = idLength(cntxt);
@@ -1076,7 +1081,8 @@ fcnHeader(Client cntxt, int kind)
                }
                fnme = putNameLen(((char *) CURRENT(cntxt)), l);
                advance(cntxt, l);
-       }
+       } else 
+               modnme= cntxt->nspace->name;
 
        /* temporary suspend capturing statements in main block */
        if (cntxt->backup){
@@ -1084,38 +1090,20 @@ fcnHeader(Client cntxt, int kind)
                skipToEnd(cntxt);
                return 0;
        }
-       cntxt->backup = cntxt->curprg;
-       cntxt->curprg = newFunction(putName("user"), fnme, kind);
-       curPrg = cntxt->curprg;
-       curBlk = curPrg->def;
-       curBlk->flowfixed = 0;
-       curBlk->typefixed = 0;
-       curInstr = getInstrPtr(curBlk, 0);
-
        if (currChar(cntxt) != '('){
-               if (cntxt->backup) {
-                       freeSymbol(cntxt->curprg);
-                       cntxt->curprg = cntxt->backup;
-                       cntxt->backup = 0;
-               }
                parseError(cntxt, "function header '(' expected\n");
                skipToEnd(cntxt);
                return curBlk;
        }
        advance(cntxt, 1);
 
-       setModuleId(curInstr, modnme ? putName(modnme) :
-                       putName(cntxt->nspace->name));
-
-       if (isModuleDefined(cntxt->nspace, getModuleId(curInstr)) == FALSE) {
-               if (cntxt->backup) {
-                       freeSymbol(cntxt->curprg);
-                       cntxt->curprg = cntxt->backup;
-                       cntxt->backup = 0;
-               }
-               parseError(cntxt, "<module> name not defined\n");
-               return curBlk;
-       }
+       cntxt->backup = cntxt->curprg;
+       cntxt->curprg = newFunction( modnme, fnme, kind);
+       curPrg = cntxt->curprg;
+       curBlk = curPrg->def;
+       curBlk->flowfixed = 0;
+       curBlk->typefixed = 0;
+       curInstr = getInstrPtr(curBlk, 0);
 
        /* get calling parameters */
        ch = currChar(cntxt);
diff --git a/monetdb5/mal/mal_private.h b/monetdb5/mal/mal_private.h
--- a/monetdb5/mal/mal_private.h
+++ b/monetdb5/mal/mal_private.h
@@ -112,9 +112,6 @@
 __hidden mal_export void mal_runtime_reset(void)
        __attribute__((__visibility__("hidden")));
 
-__hidden mal_export void mal_scenario_reset(void)
-       __attribute__((__visibility__("hidden")));
-
 extern volatile ATOMIC_TYPE mal_running;
 #ifdef ATOMIC_LOCK
 extern MT_Lock mal_runningLock;
diff --git a/monetdb5/mal/mal_scenario.c b/monetdb5/mal/mal_scenario.c
--- a/monetdb5/mal/mal_scenario.c
+++ b/monetdb5/mal/mal_scenario.c
@@ -145,12 +145,7 @@ static str fillScenario(Client c, Scenar
 static MT_Lock scenarioLock MT_LOCK_INITIALIZER("scenarioLock");
 
 
-void
-mal_scenario_reset(void)
-{
-}
 /*
- * @-
  * Currently each user can define a new scenario, provided we have a free slot.
  * Scenarios not hardwired can always be dropped.
  */
@@ -175,7 +170,6 @@ getFreeScenario(void)
 }
 
 /*
- * @-
  * A scenario is initialized only once per session.
  * All other requests are silently ignored.
  * After initialization, all state functions should have been set.
@@ -240,7 +234,6 @@ defaultScenario(Client c)
 }
 
 /*
- * @-
  * The Monet debugger provides an option to inspect the scenarios currently
  * defined.
  *
@@ -282,7 +275,6 @@ findScenario(str nme)
 }
 
 /*
- * @-
  * Functions may become resolved only after the corresponding module
  * has been loaded. This should be announced as part of the module
  * prelude code.
@@ -366,7 +358,6 @@ str getScenarioLanguage(Client c){
        return "mal";
 }
 /*
- * @-
  * Changing the scenario for a particular client invalidates the
  * state maintained for the previous scenario. The old scenario is
  * retained in the client record to facilitate propagation of
@@ -377,7 +368,6 @@ str getScenarioLanguage(Client c){
  * has been processed, the scenario phases are replaced with the
  * proper ones.
  *
- * @-
  * All client records should be initialized with a default
  * scenario, i.e. the first described in the scenario table.
  */
@@ -404,7 +394,6 @@ fillScenario(Client c, Scenario scen)
 }
 
 /*
- * @-
  * Setting a new scenario calls for saving the previous state
  * and execution of the initClientScenario routine.
  */
@@ -446,7 +435,6 @@ setScenario(Client c, str nme)
 }
 
 /*
- * @-
  * After finishing a session in a scenario, we should reset the
  * state of the previous one. But also call the exitClient
  * to garbage collect any scenario specific structures.
@@ -494,7 +482,6 @@ exitScenario(Client c)
 }
 
 /*
- * @-
  * The building blocks of scenarios are routines obeying a strict
  * name signature. They require exclusive access to the client
  * record. Any specific information should be accessible from
@@ -521,7 +508,6 @@ exitScenario(Client c)
  * The default is the MAL interpreter, which provides good balance
  * between speed and ability to analysis its behavior.
  *
- * @-
  */
 static str
 runPhase(Client c, int phase)
@@ -533,7 +519,6 @@ runPhase(Client c, int phase)
 }
 
 /*
- * @-
  * Access control enforcement. Except for the server owner
  * running a scenario should be explicitly permitted.
  */
diff --git a/sql/test/Dependencies/Tests/Dependencies.stable.out 
b/sql/test/Dependencies/Tests/Dependencies.stable.out
--- a/sql/test/Dependencies/Tests/Dependencies.stable.out
+++ b/sql/test/Dependencies/Tests/Dependencies.stable.out
@@ -279,6 +279,7 @@ Dependencies between database objects
 [ "owner",     "dependencies_owners_on_schemas",       "DEP_FUNC"      ]
 [ "proj4text", "getproj4",     "DEP_FUNC"      ]
 [ "reference", "storagemodel", "DEP_FUNC"      ]
+[ "revsorted", "storagemodel", "DEP_FUNC"      ]
 [ "rkey",      "dependencies_columns_on_keys", "DEP_FUNC"      ]
 [ "rkey",      "dependencies_keys_on_foreignkeys",     "DEP_FUNC"      ]
 [ "rkey",      "dependencies_tables_on_foreignkeys",   "DEP_FUNC"      ]
@@ -292,6 +293,7 @@ Dependencies between database objects
 [ "table_id",  "dependencies_tables_on_indexes",       "DEP_FUNC"      ]
 [ "table_id",  "dependencies_tables_on_triggers",      "DEP_FUNC"      ]
 [ "type",      "storagemodel", "DEP_FUNC"      ]
+[ "unique",    "storagemodel", "DEP_FUNC"      ]
 #SELECT c.name, tri.name, 'DEP_TRIGGER' from columns as c, triggers as tri, 
dependencies as dep where dep.id = c.id AND dep.depend_id =tri.id AND 
dep.depend_type = 8;
 % .c,  .tri,   .L1 # table_name
 % name,        name,   L1 # name
@@ -650,6 +652,7 @@ Cleanup
 [ "owner",     "dependencies_owners_on_schemas",       "DEP_FUNC"      ]
 [ "proj4text", "getproj4",     "DEP_FUNC"      ]
 [ "reference", "storagemodel", "DEP_FUNC"      ]
+[ "revsorted", "storagemodel", "DEP_FUNC"      ]
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to