Changeset: ebad1bb26201 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ebad1bb26201 Modified Files: clients/Tests/exports.stable.out monetdb5/modules/mal/language.mal monetdb5/modules/mal/oltp.mal monetdb5/modules/mal/remote.mal monetdb5/optimizer/opt_dataflow.c monetdb5/optimizer/opt_deadcode.c monetdb5/optimizer/opt_prelude.c monetdb5/optimizer/opt_prelude.h monetdb5/optimizer/opt_reorder.c monetdb5/optimizer/opt_support.c monetdb5/optimizer/opt_support.h sql/backends/monet5/sql_gencode.c sql/backends/monet5/sqlcatalog.mal Branch: default Log Message:
Cleanup of some old code. Move checking of unsafe functions into the hassideeffect. diffs (truncated from 533 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 @@ -1989,7 +1989,6 @@ str commitRef; str compileOptimizer(Client cntxt, str name); str compileString(Symbol *fcn, Client c, str s); str connectRef; -str constraintsRef; str convertConstant(malType type, ValPtr vr); InstrPtr copyInstruction(InstrPtr p); MalBlkPtr copyMalBlk(MalBlkPtr mb); @@ -2143,7 +2142,7 @@ str groupdoneRef; int hasCommonResults(InstrPtr p, InstrPtr q); int hasSameArguments(MalBlkPtr mb, InstrPtr p, InstrPtr q); int hasSameSignature(MalBlkPtr mb, InstrPtr p, InstrPtr q, int stop); -int hasSideEffects(InstrPtr p, int strict); +int hasSideEffects(MalBlkPtr mb, InstrPtr p, int strict); str hashRef; int have_hge; str hgeRef; @@ -2172,15 +2171,12 @@ str ioRef; str io_stderr(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str io_stdin(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str io_stdout(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); -int isAllScalar(MalBlkPtr mb, InstrPtr p); int isBlocking(InstrPtr p); int isDelta(InstrPtr q); -int isDependent(InstrPtr p, InstrPtr q); int isExceptionVariable(str nme); int isFragmentGroup(InstrPtr q); int isFragmentGroup2(InstrPtr q); int isIdentifier(str s); -int isInvariant(MalBlkPtr mb, int pcf, int pcl, int varid); int isLikeOp(InstrPtr q); int isLoopBarrier(MalBlkPtr mb, int pc); int isMapOp(InstrPtr q); @@ -2192,7 +2188,6 @@ int isNotUsedIn(InstrPtr p, int start, i int isOptimizerEnabled(MalBlkPtr mb, str opt); int isOptimizerPipe(str name); int isOrderby(InstrPtr q); -int isProcedure(MalBlkPtr mb, InstrPtr p); int isSample(InstrPtr q); int isSealedFunction(InstrPtr q); int isSelect(InstrPtr q); diff --git a/monetdb5/modules/mal/language.mal b/monetdb5/modules/mal/language.mal --- a/monetdb5/modules/mal/language.mal +++ b/monetdb5/modules/mal/language.mal @@ -18,23 +18,23 @@ pattern source(f:str):void address CMDevalFile comment "Merge the instructions stored in the file with the current program."; -command raise(msg:str) :str +unsafe command raise(msg:str) :str address CMDraise comment "Raise an exception labeled with a specific message."; -command assert(v:bit,term:str):void +unsafe command assert(v:bit,term:str):void address MALassertBit; -command assert(v:sht,term:str):void +unsafe command assert(v:sht,term:str):void address MALassertSht; -command assert(v:int,term:str):void +unsafe command assert(v:int,term:str):void address MALassertInt; -command assert(v:lng,term:str):void +unsafe command assert(v:lng,term:str):void address MALassertLng; -command assert(v:str,term:str):void +unsafe command assert(v:str,term:str):void address MALassertStr; -command assert(v:oid,term:str):void +unsafe command assert(v:oid,term:str):void address MALassertOid; -pattern assert(v:any_1,pname:str,oper:str,val:any_2):void +unsafe pattern assert(v:any_1,pname:str,oper:str,val:any_2):void address MALassertTriple comment "Assertion test."; diff --git a/monetdb5/modules/mal/oltp.mal b/monetdb5/modules/mal/oltp.mal --- a/monetdb5/modules/mal/oltp.mal +++ b/monetdb5/modules/mal/oltp.mal @@ -1,33 +1,42 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2017 MonetDB B.V. + +# This file was generated by using the script 00_batcalc_hge.mal.sh. + +# all routines are unsafe, having side effects module oltp; -pattern init() +unsafe pattern init() address OLTPinit comment "Initialize the lock table"; -pattern enable() +unsafe pattern enable() address OLTPenable comment "Enable the OLTP delay monitor"; -pattern disable() +unsafe pattern disable() address OLTPdisable comment "Disable the OLTP delay monitor"; -pattern reset() +unsafe pattern reset() address OLTPreset comment "Reset the OLTP lock table"; -pattern lock(lck:int...):void +unsafe pattern lock(lck:int...):void address OLTPlock comment "Wait for all write locks needed"; -pattern release(lck:int...):void +unsafe pattern release(lck:int...):void address OLTPrelease comment "Release for all write locks needed"; -pattern table() (start:bat[:timestamp], usr:bat[:str], unit:bat[:int], cnt:bat[:int]) +unsafe pattern table() (start:bat[:timestamp], usr:bat[:str], unit:bat[:int], cnt:bat[:int]) address OLTPtable comment "Show status of lock table"; -command isenabled():int +unsafe command isenabled():int address OLTPis_enabled comment "Query the OLTP state"; diff --git a/monetdb5/modules/mal/remote.mal b/monetdb5/modules/mal/remote.mal --- a/monetdb5/modules/mal/remote.mal +++ b/monetdb5/modules/mal/remote.mal @@ -4,6 +4,7 @@ # # Copyright 1997 - July 2008 CWI, August 2008 - 2017 MonetDB B.V. +# All routines are unsafe module remote; command prelude():void @@ -14,61 +15,61 @@ command epilogue():void address RMTepilogue comment "release the resources held by the remote module"; -command resolve(pattern:str):bat[:str] +unsafe command resolve(pattern:str):bat[:str] address RMTresolve comment "resolve a pattern against Merovingian and return the URIs"; -command connect(uri:str, user:str, passwd:str):str +unsafe command connect(uri:str, user:str, passwd:str):str address RMTconnect comment "returns a newly created connection for uri, using user name and password"; -command connect(uri:str, user:str, passwd:str, scen:str):str +unsafe command connect(uri:str, user:str, passwd:str, scen:str):str address RMTconnectScen comment "returns a newly created connection for uri, using user name, password and scenario"; -command disconnect(conn:str):void +unsafe command disconnect(conn:str):void address RMTdisconnect comment "disconnects the connection pointed to by handle (received from a call to connect()"; -pattern get(conn:str, ident:str):any +unsafe pattern get(conn:str, ident:str):any address RMTget comment "retrieves a copy of remote object ident"; -pattern put(conn:str, object:any):str +unsafe pattern put(conn:str, object:any):str address RMTput comment "copies object to the remote site and returns its identifier"; -pattern register(conn:str, mod:str, fcn:str):void +unsafe pattern register(conn:str, mod:str, fcn:str):void address RMTregister comment "register <mod>.<fcn> at the remote site"; -pattern exec(conn:str, mod:str, func:str):str +unsafe pattern exec(conn:str, mod:str, func:str):str address RMTexec comment "remotely executes <mod>.<func> and returns the handle to its result"; -pattern exec(conn:str, mod:str, func:str):str... +unsafe pattern exec(conn:str, mod:str, func:str):str... address RMTexec comment "remotely executes <mod>.<func> and returns the handle to its result"; -pattern exec(conn:str, mod:str, func:str, :str...):str +unsafe pattern exec(conn:str, mod:str, func:str, :str...):str address RMTexec comment "remotely executes <mod>.<func> using the argument list of remote objects and returns the handle to its result"; -pattern exec(conn:str, mod:str, func:str, :str...):str... +unsafe pattern exec(conn:str, mod:str, func:str, :str...):str... address RMTexec comment "remotely executes <mod>.<func> using the argument list of remote objects and returns the handle to its result"; -command isalive(conn:str):int +unsafe command isalive(conn:str):int address RMTisalive comment "check if conn is still valid and connected"; -pattern batload(tt:any_1, size:int):bat[:any_1] +unsafe pattern batload(tt:any_1, size:int):bat[:any_1] address RMTbatload comment "create a BAT of the given type and size, and load values from the input stream"; -pattern batbincopy(b:bat[:any]):void +unsafe pattern batbincopy(b:bat[:any]):void address RMTbincopyto comment "dump BAT b in binary form to the stream"; -pattern batbincopy():bat[:any] +unsafe pattern batbincopy():bat[:any] address RMTbincopyfrom comment "store the binary BAT data in the BBP and return as BAT"; -pattern bintype():void +unsafe pattern bintype():void address RMTbintype comment "print the binary type of this mserver5"; diff --git a/monetdb5/optimizer/opt_dataflow.c b/monetdb5/optimizer/opt_dataflow.c --- a/monetdb5/optimizer/opt_dataflow.c +++ b/monetdb5/optimizer/opt_dataflow.c @@ -59,8 +59,8 @@ simpleFlow(InstrPtr *old, int start, int } // take care of side-effects in updates -static void setAssigned(InstrPtr p, int k, int *assigned){ - if ( isUpdateInstruction(p) || hasSideEffects(p,TRUE)) +static void setAssigned(MalBlkPtr mb, InstrPtr p, int k, int *assigned){ + if ( isUpdateInstruction(p) || hasSideEffects(mb,p,TRUE)) assigned[getArg(p,p->retc)] ++; assigned[getArg(p,k)]++; } @@ -103,7 +103,7 @@ dataflowConflict(Client cntxt, MalBlkPtr case CMDcall: case FACcall: case FCNcall: - return (hasSideEffects(p,FALSE) || isUnsafeFunction(p) ); + return (hasSideEffects(mb,p,FALSE) || isUnsafeFunction(p) ); } return TRUE; } @@ -275,7 +275,7 @@ OPTdataflowImplementation(Client cntxt, } // remember you assigned to variables for ( k = 0; k < p->retc; k++) - setAssigned(p,k,assigned); + setAssigned(mb,p,k,assigned); } /* take the remainder as is */ for (; i<slimit; i++) diff --git a/monetdb5/optimizer/opt_deadcode.c b/monetdb5/optimizer/opt_deadcode.c --- a/monetdb5/optimizer/opt_deadcode.c +++ b/monetdb5/optimizer/opt_deadcode.c @@ -55,7 +55,7 @@ OPTdeadcodeImplementation(Client cntxt, varused[getArg(p,0)]++; // force keeping continue; } - if (hasSideEffects(p, FALSE) || !isLinearFlow(p) || isProcedure(mb,p) || + if (hasSideEffects(mb, p, FALSE) || !isLinearFlow(p) || (p->retc == 1 && mb->unsafeProp) || p->barrier /* ==side-effect */){ varused[getArg(p,0)]++; // force keeping it continue; diff --git a/monetdb5/optimizer/opt_prelude.c b/monetdb5/optimizer/opt_prelude.c --- a/monetdb5/optimizer/opt_prelude.c +++ b/monetdb5/optimizer/opt_prelude.c @@ -74,7 +74,6 @@ str columnRef; str columnBindRef; str commitRef; str connectRef; -str constraintsRef; str countRef; str subcountRef; str copyRef; @@ -356,7 +355,6 @@ void optimizerInit(void) columnBindRef = putName("columnBind"); commitRef = putName("commit"); connectRef = putName("connect"); - constraintsRef = putName("constraints"); countRef = putName("count"); subcountRef = putName("subcount"); copyRef = putName("copy"); diff --git a/monetdb5/optimizer/opt_prelude.h b/monetdb5/optimizer/opt_prelude.h --- a/monetdb5/optimizer/opt_prelude.h +++ b/monetdb5/optimizer/opt_prelude.h @@ -72,7 +72,6 @@ mal_export str columnRef; mal_export str commitRef; mal_export str columnBindRef; mal_export str connectRef; -mal_export str constraintsRef; mal_export str countRef; mal_export str subcountRef; mal_export str copyRef; diff --git a/monetdb5/optimizer/opt_reorder.c b/monetdb5/optimizer/opt_reorder.c --- a/monetdb5/optimizer/opt_reorder.c +++ b/monetdb5/optimizer/opt_reorder.c @@ -295,7 +295,7 @@ OPTreorderImplementation(Client cntxt, M _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list