Changeset: cab6e4c8ffd2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cab6e4c8ffd2 Added Files: monetdb5/mal/Tests/tst111.malC monetdb5/mal/Tests/tst111.stable.err monetdb5/mal/Tests/tst111.stable.out monetdb5/mal/Tests/tst112.malC monetdb5/mal/Tests/tst112.stable.err monetdb5/mal/Tests/tst112.stable.out monetdb5/mal/Tests/tst113.malC monetdb5/mal/Tests/tst113.stable.err monetdb5/mal/Tests/tst113.stable.out monetdb5/mal/Tests/tst114.malC monetdb5/mal/Tests/tst114.stable.err monetdb5/mal/Tests/tst114.stable.out monetdb5/mal/Tests/tst117.malC monetdb5/mal/Tests/tst117.stable.err monetdb5/mal/Tests/tst117.stable.out Modified Files: clients/Tests/exports.stable.out monetdb5/extras/mal_optimizer_template/opt_sql_append.c monetdb5/mal/Tests/All monetdb5/mal/Tests/tst010.stable.err monetdb5/mal/Tests/tst013.stable.err monetdb5/mal/Tests/tst019.stable.err monetdb5/mal/Tests/tst054.stable.err monetdb5/mal/Tests/tst108.stable.err monetdb5/mal/Tests/tst109.stable.err monetdb5/mal/Tests/tst110.malC monetdb5/mal/Tests/tst110.stable.err monetdb5/mal/Tests/tst161.stable.err monetdb5/mal/Tests/tst194.stable.err monetdb5/mal/mal_function.c monetdb5/mal/mal_function.h monetdb5/mal/mal_instruction.c monetdb5/mal/mal_resolve.c monetdb5/optimizer/opt_aliases.c monetdb5/optimizer/opt_candidates.c monetdb5/optimizer/opt_coercion.c monetdb5/optimizer/opt_commonTerms.c monetdb5/optimizer/opt_constants.c monetdb5/optimizer/opt_costModel.c monetdb5/optimizer/opt_dataflow.c monetdb5/optimizer/opt_deadcode.c monetdb5/optimizer/opt_emptybind.c monetdb5/optimizer/opt_evaluate.c monetdb5/optimizer/opt_garbageCollector.c monetdb5/optimizer/opt_generator.c monetdb5/optimizer/opt_inline.c monetdb5/optimizer/opt_jit.c monetdb5/optimizer/opt_json.c monetdb5/optimizer/opt_macro.c monetdb5/optimizer/opt_matpack.c monetdb5/optimizer/opt_mergetable.c monetdb5/optimizer/opt_mitosis.c monetdb5/optimizer/opt_multiplex.c monetdb5/optimizer/opt_oltp.c monetdb5/optimizer/opt_postfix.c monetdb5/optimizer/opt_profiler.c monetdb5/optimizer/opt_projectionpath.c monetdb5/optimizer/opt_pushselect.c monetdb5/optimizer/opt_querylog.c monetdb5/optimizer/opt_reduce.c monetdb5/optimizer/opt_remap.c monetdb5/optimizer/opt_remoteQueries.c monetdb5/optimizer/opt_reorder.c monetdb5/optimizer/opt_support.c monetdb5/optimizer/opt_volcano.c monetdb5/optimizer/opt_wlc.c monetdb5/scheduler/run_adder.c sql/backends/monet5/wlr.c Branch: gdk_tracer Log Message:
Turning the result of chkFlow() into a proper exception thrown upon the first error encountered. diffs (truncated from 1793 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 @@ -2068,7 +2068,7 @@ str callString(Client c, str s, int list str capiRef; str catalogRef; str chkDeclarations(MalBlkPtr mb); -void chkFlow(MalBlkPtr mb); +str chkFlow(MalBlkPtr mb); int chkInstruction(Module s, MalBlkPtr mb, InstrPtr p); str chkProgram(Module s, MalBlkPtr mb); void chkTypes(Module s, MalBlkPtr mb, int silent); diff --git a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c --- a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c +++ b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c @@ -295,8 +295,10 @@ str OPTsql_append(Client cntxt, MalBlkPt /* Defense line against incorrect plans */ chkTypes(cntxt->usermodule, mb, FALSE); - chkFlow(mb); - if( msg == MAL_SUCCEED) msg = chkDeclarations(mb); + if( msg == MAL_SUCCEED) + msg = chkFlow(mb); + if( msg == MAL_SUCCEED) + msg = chkDeclarations(mb); #ifdef DEBUG_OPT_OPTIMIZERS mnstr_printf(cntxt->fdout,"=FINISHED sql_append %d\n",actions); printFunction(cntxt->fdout,mb,0,LIST_MAL_ALL ); diff --git a/monetdb5/mal/Tests/All b/monetdb5/mal/Tests/All --- a/monetdb5/mal/Tests/All +++ b/monetdb5/mal/Tests/All @@ -76,6 +76,11 @@ tst107 tst108 tst109 tst110 +tst111 +tst112 +tst113 +tst114 +tst117 tst115 tst116 tst1150 diff --git a/monetdb5/mal/Tests/tst010.stable.err b/monetdb5/mal/Tests/tst010.stable.err --- a/monetdb5/mal/Tests/tst010.stable.err +++ b/monetdb5/mal/Tests/tst010.stable.err @@ -69,16 +69,7 @@ QUERY = # syntax analysis test for guard f:=1; end; end foo; -ERROR = !MALException:user.foo[3]:label 'Z' not in guarded block - !MALException:user.foo[7]:label 'L' not in guarded block - !MALException:user.foo[9]:label 'X' not in guarded block - !MALException:user.foo[11]:label 'A' not in guarded block - !MALException:user.foo[14]:label 'L' not in guarded block - !MALException:user.foo[17]:label 'L' not in guarded block - !MALException:user.foo[27]:exit-label 'B' doesnot match 'A' - !MALException:user.foo[29]:exit-label 'F' without begin-label - !MALException:user.foo[39]:exit-label 'A' without begin-label - !SyntaxException:parseError:end foo; +ERROR = !MALException:user.foo:label 'Z' not in guarded blockSyntaxException:parseError:end foo; !SyntaxException:parseError: ^non matching end label # 10:57:17 > diff --git a/monetdb5/mal/Tests/tst013.stable.err b/monetdb5/mal/Tests/tst013.stable.err --- a/monetdb5/mal/Tests/tst013.stable.err +++ b/monetdb5/mal/Tests/tst013.stable.err @@ -46,8 +46,7 @@ QUERY = # incomplete barrier blocks. Res exit t; redo; exit; -ERROR = !MALException:user.main[3]:label 'X_2' not in guarded block - !MALException:user.main[14]:label 't' not in guarded block +ERROR = !MALException:user.main:label 'X_2' not in guarded block # 13:20:00 > # 13:20:00 > "Done." diff --git a/monetdb5/mal/Tests/tst019.stable.err b/monetdb5/mal/Tests/tst019.stable.err --- a/monetdb5/mal/Tests/tst019.stable.err +++ b/monetdb5/mal/Tests/tst019.stable.err @@ -77,7 +77,6 @@ QUERY = function welcome(lim:int):void; (x,y):= user.welcome2(1); ERROR = !TypeException:user.welcome[3]:type mismatch void := str !TypeException:user.welcome0[3]:Multiple assignment mismatch - !MALException:user.welcome3[2]:invalid return target! !TypeException:user.welcome4[2]:Multiple assignment mismatch # 15:16:11 > diff --git a/monetdb5/mal/Tests/tst054.stable.err b/monetdb5/mal/Tests/tst054.stable.err --- a/monetdb5/mal/Tests/tst054.stable.err +++ b/monetdb5/mal/Tests/tst054.stable.err @@ -78,7 +78,6 @@ QUERY = function z()( :int,:int,:int,:in z(); ERROR = !SyntaxException:parseError:return (1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0); !SyntaxException:parseError: ^<identifier> expected - !MALException:user.z[2]:invalid return target! # 11:11:08 > # 11:11:08 > Done. diff --git a/monetdb5/mal/Tests/tst108.stable.err b/monetdb5/mal/Tests/tst108.stable.err --- a/monetdb5/mal/Tests/tst108.stable.err +++ b/monetdb5/mal/Tests/tst108.stable.err @@ -43,9 +43,7 @@ QUERY = # analyse the basic interpreter redo t; exit t; i:= 0; -ERROR = !MALException:user.main[7]:exit-label 'v' doesnot match 't' - !MALException:user.main[9]:label 't' not in guarded block - !MALException:user.main[10]:exit-label 't' without begin-label +ERROR = !MALException:user.main:exit-label 'v' doesnot match 't' # 20:43:15 > # 20:43:15 > "Done." diff --git a/monetdb5/mal/Tests/tst109.stable.err b/monetdb5/mal/Tests/tst109.stable.err --- a/monetdb5/mal/Tests/tst109.stable.err +++ b/monetdb5/mal/Tests/tst109.stable.err @@ -44,9 +44,7 @@ QUERY = # Error, illegal block weaveing redo t; exit t; i:= 0; -ERROR = !MALException:user.main[9]:exit-label 'v' doesnot match 't' - !MALException:user.main[10]:label 't' not in guarded block - !MALException:user.main[11]:exit-label 't' without begin-label +ERROR = !MALException:user.main:exit-label 'v' doesnot match 't' # 20:43:15 > # 20:43:15 > "Done." diff --git a/monetdb5/mal/Tests/tst110.malC b/monetdb5/mal/Tests/tst110.malC --- a/monetdb5/mal/Tests/tst110.malC +++ b/monetdb5/mal/Tests/tst110.malC @@ -1,10 +1,37 @@ -# Simply skip the barred block -# analyse the basic interpreter loop +# syntax analysis test for guarded blocks, redo's and leave's +# forcefully end the block, because the parser counts barrier/exit pairs +function foo(); +barrier L:= 1; + #do it + redo L; +exit L; + redo L; # outside block + leave X; # outside block + redo A; # outside block +barrier X:=1; + leave L; # outside block + leave X; + redo L; # outside block +exit X; +barrier A:=1; + barrier B:= 1; + redo A; + exit B; + barrier C:=1; + leave A; + exit C; - i:=0; - v:= false; -barrier v:=v; - i:= 1; - j:= 2; -exit v; - k:= 3; + exit B; # out of order + exit F; # unknown + + barrier D:=1; + leave D; + redo D; # dead code + exit D; + barrier D:=2; # duplicate block + exit D; +exit A; +barrier unfinished:= 1; + f:=1; +end; +end foo; diff --git a/monetdb5/mal/Tests/tst110.stable.err b/monetdb5/mal/Tests/tst110.stable.err --- a/monetdb5/mal/Tests/tst110.stable.err +++ b/monetdb5/mal/Tests/tst110.stable.err @@ -1,1 +1,71 @@ stderr of test 'tst110` in directory 'monetdb5/mal` itself: + + +# 13:24:08 > +# 13:24:08 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=36081" "--set" "mapi_usock=/var/tmp/mtest-29935/.s.monetdb.36081" "--forcemito" "--dbpath=/export/scratch1/mk/branches/tracer//Linux/var/MonetDB/mTests_monetdb5_mal" "--set" "embedded_c=true" +# 13:24:08 > + +# builtin opt gdk_dbpath = /export/scratch1/mk/branches/tracer//Linux/var/monetdb5/dbfarm/demo +# builtin opt mapi_port = 50000 +# builtin opt mapi_open = false +# builtin opt mapi_ipv6 = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# builtin opt raw_strings = false +# cmdline opt gdk_nr_threads = 0 +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 36081 +# cmdline opt mapi_usock = /var/tmp/mtest-29935/.s.monetdb.36081 +# cmdline opt gdk_dbpath = /export/scratch1/mk/branches/tracer//Linux/var/MonetDB/mTests_monetdb5_mal +# cmdline opt embedded_c = true + +# 13:24:08 > +# 13:24:08 > "mclient" "-lmal" "-ftest" "-tnone" "-Eutf-8" "--host=/var/tmp/mtest-29935" "--port=36081" +# 13:24:08 > + +MAPI = (monetdb) /var/tmp/mtest-29935/.s.monetdb.36081 +QUERY = # syntax analysis test for guarded blocks, redo's and leave's + # forcefully end the block, because the parser counts barrier/exit pairs + function foo(); + barrier L:= 1; + #do it + redo L; + exit L; + redo L; # outside block + leave X; # outside block + redo A; # outside block + barrier X:=1; + leave L; # outside block + leave X; + redo L; # outside block + exit X; + barrier A:=1; + barrier B:= 1; + redo A; + exit B; + barrier C:=1; + leave A; + exit C; + + exit B; # out of order + exit F; # unknown + + barrier D:=1; + leave D; + redo D; # dead code + exit D; + barrier D:=2; # duplicate block + exit D; + exit A; + barrier unfinished:= 1; + f:=1; + end; + end foo; +ERROR = !MALException:user.foo:label 'L' not in guarded blockSyntaxException:parseError:end foo; + !SyntaxException:parseError: ^non matching end label + +# 13:24:08 > +# 13:24:08 > "Done." +# 13:24:08 > + diff --git a/monetdb5/mal/Tests/tst111.malC b/monetdb5/mal/Tests/tst111.malC new file mode 100644 --- /dev/null +++ b/monetdb5/mal/Tests/tst111.malC @@ -0,0 +1,36 @@ +# syntax analysis test for guarded blocks, redo's and leave's +# forcefully end the block, because the parser counts barrier/exit pairs +function foo(); +barrier L:= 1; + #do it + redo L; +exit L; + leave X; # outside block + redo A; # outside block +barrier X:=1; + leave L; # outside block + leave X; + redo L; # outside block +exit X; +barrier A:=1; + barrier B:= 1; + redo A; + exit B; + barrier C:=1; + leave A; + exit C; + + exit B; # out of order + exit F; # unknown + + barrier D:=1; + leave D; + redo D; # dead code + exit D; + barrier D:=2; # duplicate block + exit D; +exit A; +barrier unfinished:= 1; + f:=1; +end; +end foo; diff --git a/monetdb5/mal/Tests/tst111.stable.err b/monetdb5/mal/Tests/tst111.stable.err new file mode 100644 --- /dev/null +++ b/monetdb5/mal/Tests/tst111.stable.err @@ -0,0 +1,70 @@ +stderr of test 'tst111` in directory 'monetdb5/mal` itself: + _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list