Changeset: f95dce9d4efd for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f95dce9d4efd
Removed Files:
monetdb5/optimizer/Tests/STexample.mal
monetdb5/optimizer/Tests/STexample.stable.err
monetdb5/optimizer/Tests/STexample.stable.out
monetdb5/optimizer/opt_singleton.c
monetdb5/optimizer/opt_singleton.h
Modified Files:
monetdb5/optimizer/Tests/All
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
monetdb5/optimizer/opt_support.c
monetdb5/optimizer/opt_support.h
monetdb5/optimizer/opt_wrapper.c
monetdb5/optimizer/optimizer.mal
Branch: default
Log Message:
Move non-used optimizer to the attic
The singleton was an exercise in unpacking small BATs into scalar
operators.
diffs (truncated from 549 to 300 lines):
diff --git a/monetdb5/optimizer/Tests/All b/monetdb5/optimizer/Tests/All
--- a/monetdb5/optimizer/Tests/All
+++ b/monetdb5/optimizer/Tests/All
@@ -92,7 +92,6 @@ CXexample
JPexample
Mexample
SRexample
-STexample
dataflow
dataflow3
diff --git a/monetdb5/optimizer/Tests/STexample.mal
b/monetdb5/optimizer/Tests/STexample.mal
deleted file mode 100644
--- a/monetdb5/optimizer/Tests/STexample.mal
+++ /dev/null
@@ -1,8 +0,0 @@
-b:= bat.new(:oid,:int);
-bat.insert(b,1@0,2);
-#many more inserts
-c{singleton}:= algebra.select(b,0,4);
-d:= algebra.markH(c);
-io.print(d);
-optimizer.singleton();
-mdb.List();
diff --git a/monetdb5/optimizer/Tests/STexample.stable.err
b/monetdb5/optimizer/Tests/STexample.stable.err
deleted file mode 100644
--- a/monetdb5/optimizer/Tests/STexample.stable.err
+++ /dev/null
@@ -1,12 +0,0 @@
-stderr of test 'STexample` in directory 'optimizer` itself:
-
-
-# 19:36:15 >
-# 19:36:15 > Mtimeout -timeout 60 mserver5
"--config=/ufs/mk/monet5/Linux/etc/MonetDB5.conf" --debug=10 --set
"monet_mod_path=/ufs/mk/monet5/Linux/lib/MonetDB5:/ufs/mk/opensource/MonetDB/Linux/lib/MonetDB"
--set "gdk_dbfarm=/ufs/mk/monet5/Linux/var/MonetDB5/dbfarm" --set
"sql_logdir=/ufs/mk/monet5/Linux/var/MonetDB5/dblogs" --set mapi_port=31892
--set monet_prompt= --trace --dbname=mTests_src_optimizer STexample.mal <
/dev/null
-# 19:36:15 >
-
-
-# 19:36:15 >
-# 19:36:15 > Done.
-# 19:36:15 >
-
diff --git a/monetdb5/optimizer/Tests/STexample.stable.out
b/monetdb5/optimizer/Tests/STexample.stable.out
deleted file mode 100644
--- a/monetdb5/optimizer/Tests/STexample.stable.out
+++ /dev/null
@@ -1,47 +0,0 @@
-stdout of test 'STexample` in directory 'optimizer` itself:
-
-
-# 19:36:15 >
-# 19:36:15 > Mtimeout -timeout 60 mserver5
"--config=/ufs/mk/monet5/Linux/etc/MonetDB5.conf" --debug=10 --set
"monet_mod_path=/ufs/mk/monet5/Linux/lib/MonetDB5:/ufs/mk/opensource/MonetDB/Linux/lib/MonetDB"
--set "gdk_dbfarm=/ufs/mk/monet5/Linux/var/MonetDB5/dbfarm" --set
"sql_logdir=/ufs/mk/monet5/Linux/var/MonetDB5/dblogs" --set mapi_port=31892
--set monet_prompt= --trace --dbname=mTests_src_optimizer STexample.mal <
/dev/null
-# 19:36:15 >
-
-# MonetDB Server v4.99.19
-# Copyright (c) 1993-2006 CWI, all rights reserved
-# Compiled for x86_64-redhat-linux-gnu/64bit with 64bit OIDs dynamically linked
-# config:/ufs/mk/monet5/Linux/etc/MonetDB5.conf
-# dbfarm:/ufs/mk/monet5/Linux/var/MonetDB5/dbfarm
-# dbname:mTests_src_optimizer
-# Visit http://monetdb.cwi.nl/ for further information
-# Listening for connection requests on mapi:monetdb://eir.ins.cwi.nl:32348/
-function user.main():void;
- b := bat.new(:oid,:int);
- bat.insert(b,1@0,2);
-#many more inserts
- c := algebra.select(b,0,4);
- (X_15,X_16) := bat.unpack(c);
- (X_19,X_20) := (0@0,X_16);
- d := bat.pack(X_19,X_20);
- io.print(d);
- mdb.List();
-end main;
-#-----------------#
-# h t # name
-# void int # type
-#-----------------#
-[ 0@0, 2 ]
-function user.main():void; # 0 main:void := user.main() {G}
- b := bat.new(:oid,:int); # 1 b:bat[:oid,:int] :=
CMDBATnew(_2:oid, _3:int) {G}
- bat.insert(b,1@0,2); # 2 _4:bat[:oid,:int] :=
BKCinsert_bun(b:bat[:oid,:int], _5:oid, _6:int) {G}
-#many more inserts
- c{singleton} := algebra.select(b,0,4);# 4 c:bat[:oid,:int] :=
ALGselect(b:bat[:oid,:int], _9:int, _10:int) {G}
- (X_15,X_16) := bat.unpack(c{singleton});# 5 (_15:oid, _16:int) :=
CMDbatunpack(c:bat[:oid,:int]) {G}
- (X_19,X_20) := (0@0,X_16); # 6 (_19:oid, _20:int) :=
ALGmarkHead_default(_18:oid, _16:int) {G}
- d := bat.pack(X_19,X_20); # 7 d:bat[:oid,:int] :=
CMDbatpack(_19:oid, _20:int) {G}
- io.print(d); # 8 _12:void :=
IOprint_val(d:bat[:oid,:int]) {G}
- mdb.List(); # 9 _14:void := MDBlistDetail()
-end main; # 10
-
-# 19:36:15 >
-# 19:36:15 > Done.
-# 19:36:15 >
-
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
@@ -150,6 +150,7 @@ str partitionRef;
str pcreRef;
str pinRef;
str plusRef;
+str singleRef;
str sqlplusRef;
str printRef;
str preludeRef;
@@ -183,7 +184,6 @@ str semijoinRef;
str setAccessRef;
str setWriteModeRef;
str sliceRef;
-str singleRef;
str sortHRef;
str sortHTRef;
str sortRef;
@@ -233,7 +233,6 @@ int notnilProp;
int rowsProp;
int fileProp;
int runonceProp;
-int singletonProp;
int unsafeProp;
int stableProp;
@@ -457,7 +456,6 @@ void optimizerInit(void){
notnilProp = PropertyIndex("notnil");
rowsProp = PropertyIndex("rows");
runonceProp = PropertyIndex("runonce");
- singletonProp = PropertyIndex("singleton");
unsafeProp = PropertyIndex("unsafe");
sqlfunctionProp = PropertyIndex("sqlfunction");
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
@@ -232,7 +232,6 @@ opt_export int notnilProp; /* binary */
opt_export int rowsProp; /* long */
opt_export int fileProp; /* str */
opt_export int runonceProp; /* binary */
-opt_export int singletonProp; /* binary */
opt_export int unsafeProp; /* binary */
opt_export int stableProp; /* binary */
diff --git a/monetdb5/optimizer/opt_singleton.c
b/monetdb5/optimizer/opt_singleton.c
deleted file mode 100644
--- a/monetdb5/optimizer/opt_singleton.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * The contents of this file are subject to the MonetDB Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.monetdb.org/Legal/MonetDBLicense
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- * License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the MonetDB Database System.
- *
- * The Initial Developer of the Original Code is CWI.
- * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
- * Copyright August 2008-2012 MonetDB B.V.
- * All Rights Reserved.
-*/
-#include "monetdb_config.h"
-#include "opt_singleton.h"
-#include "opt_aliases.h"
-#include "mal_interpreter.h" /* for showErrors() */
-#include "mal_builder.h"
-
-/*
- * When we run into an instruction that can not be optimized,
- * we have to rebuild the singleton set as an ordinary BAT.
- */
-typedef struct {
- int vidx;
- int hidx;
- int htpe;
- int tidx;
- int ttpe;
- int packed;
-} STtuple;
-
-static int
-STalias(int idx, int top, STtuple * tuples)
-{
- int i;
-
- for (i = 0; i < top; i++)
- if (tuples[i].vidx == idx)
- return i;
- return -1;
-}
-
-static int
-STnewTuple(MalBlkPtr mb, int vidx, int *top, STtuple * tuples)
-{
- tuples[*top].packed = 1;
- tuples[*top].vidx = vidx;
- tuples[*top].htpe = getHeadType(getVarType(mb, vidx));
- tuples[*top].htpe= TYPE_oid;
- tuples[*top].hidx = newTmpVariable(mb, tuples[*top].htpe);
- tuples[*top].ttpe = getTailType(getVarType(mb, vidx));
- tuples[*top].tidx = newTmpVariable(mb, tuples[*top].ttpe);
- *top = *top + 1;
- return *top - 1;
-}
-
-static void
-STunpack(MalBlkPtr mb, int varid, STtuple * tuples)
-{
- InstrPtr p = 0;
-
- if (tuples[varid].packed == 0)
- return;
-
- p = newFcnCall(mb, batRef, unpackRef);
- getArg(p, 0) = tuples[varid].hidx;
- setVarUsed(mb,getArg(p,0));
- setArgument(mb, p, 1, tuples[varid].tidx);
- setVarUsed(mb,getArg(p,1));
- p->retc++;
- p= pushArgument(mb, p, tuples[varid].vidx);
- tuples[varid].packed = 0;
-}
-
-static void
-STpack(MalBlkPtr mb, int varid, STtuple * tuples)
-{
- InstrPtr p = 0;
-
- p = newFcnCall(mb, batRef, packRef);
- getArg(p, 0) = tuples[varid].vidx;
- p->retc = 1;
- p->argc = 1;
- p= pushArgument(mb, p, tuples[varid].hidx);
- p= pushArgument(mb, p, tuples[varid].tidx);
-}
-
-static int
-STevaluate(Client cntxt, MalBlkPtr mb, int cnt, int *vars)
-{
- int i, j = 0, k, limit, slimit, actions = 0;
- InstrPtr p;
- InstrPtr *old;
- STtuple *tuples;
- int top = 0;
-
- (void) cntxt;
- if( mb->errors)
- return 0;
- tuples = (STtuple*) GDKmalloc(mb->stop * sizeof(STtuple));
- if (tuples == NULL)
- return 0;
- limit = mb->stop;
- slimit = mb->ssize;
- old = mb->stmt;
-
- /*
- * Prepare the list of tuple aliases using allocation of
- * variables on the stack.
- */
- for (i = 0; i < cnt; i++)
- STnewTuple(mb, vars[i], &top, tuples);
- OPTDEBUGsingleton{
- mnstr_printf(cntxt->fdout, "START SINGLETON OPTIMIZER %d:",
cnt);
- for (i = 0; i < top; i++)
- mnstr_printf(cntxt->fdout, "[%d,%d,%d] ", vars[i],
tuples[i].hidx, tuples[i].tidx);
- mnstr_printf(cntxt->fdout, "\n");
- }
- if ( newMalBlkStmt(mb, mb->ssize) < 0){
- GDKfree(tuples);
- return 0;
- }
-
- for (i = 0; i < limit; i++) {
- p = old[i];
- /* decode operations */
- if (getModuleId(p) == batRef) {
- if (getFunctionId(p) == reverseRef &&
- (k = STalias(getArg(p, 1), top, tuples) >= 0)) {
- setModuleId(p, NULL);
- setFunctionId(p, NULL);
- p->retc = p->argc = 2;
- p= pushArgument(mb, p, tuples[k].hidx);
- p= pushArgument(mb, p, tuples[k].tidx);
- k = STnewTuple(mb, getArg(p, 0), &top, tuples);
- p->argv[0] = tuples[k].hidx;
- p->argv[1] = tuples[k].tidx;
- p->token= ASSIGNsymbol;
- actions++;
- } else
- goto STrepack;
- } else if (getModuleId(p)== ioRef) {
- if (getFunctionId(p) == printRef &&
- p->argc == 3 &&
- (k = STalias(getArg(p, 1), top, tuples)) >= 0) {
- if (tuples[k].packed == 0) {
- getArg(p, 1) = tuples[k].hidx;
- p= pushArgument(mb, p, tuples[k].tidx);
- } else
- goto STrepack;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list