Changeset: b84ceba8719a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b84ceba8719a
Modified Files:
monetdb5/optimizer/opt_matpack.c
monetdb5/optimizer/opt_mergetable.c
monetdb5/optimizer/opt_pipes.c
monetdb5/optimizer/opt_reorder.c
monetdb5/optimizer/opt_support.c
monetdb5/optimizer/opt_support.h
Branch: default
Log Message:
Merge with Mar2025 branch.
diffs (146 lines):
diff --git a/monetdb5/optimizer/opt_matpack.c b/monetdb5/optimizer/opt_matpack.c
--- a/monetdb5/optimizer/opt_matpack.c
+++ b/monetdb5/optimizer/opt_matpack.c
@@ -27,10 +27,6 @@ OPTmatpackImplementation(Client cntxt, M
InstrPtr *old = NULL;
str msg = MAL_SUCCEED;
- if (!isOptimizerUsed(mb, pci, mergetableRef)) {
- goto wrapup;
- }
-
(void) cntxt;
(void) stk;
for (i = 1; i < mb->stop; i++)
diff --git a/monetdb5/optimizer/opt_mergetable.c
b/monetdb5/optimizer/opt_mergetable.c
--- a/monetdb5/optimizer/opt_mergetable.c
+++ b/monetdb5/optimizer/opt_mergetable.c
@@ -2292,8 +2292,6 @@ OPTmergetableImplementation(Client cntxt
char *group_input;
str msg = MAL_SUCCEED;
- if (!isOptimizerUsed(mb, pci, mitosisRef))
- goto cleanup2;
old = mb->stmt;
oldtop = mb->stop;
@@ -2912,7 +2910,6 @@ OPTmergetableImplementation(Client cntxt
if (!msg)
msg = chkDeclarations(mb);
}
- cleanup2:
/* keep actions taken as a fake argument */
if (msg == MAL_SUCCEED) {
(void) pushInt(mb, pci, actions);
diff --git a/monetdb5/optimizer/opt_pipes.c b/monetdb5/optimizer/opt_pipes.c
--- a/monetdb5/optimizer/opt_pipes.c
+++ b/monetdb5/optimizer/opt_pipes.c
@@ -261,7 +261,6 @@ validatePipe(struct pipeline *pipe)
{
bool mitosis = false, deadcode = false, mergetable = false;
bool multiplex = false, garbage = false, generator = false, remap =
false;
- int i;
if (pipe->def == NULL || pipe->def[0] == NULL)
throw(MAL, "optimizer.validate", SQLSTATE(42000) "missing
optimizers");
@@ -274,7 +273,7 @@ validatePipe(struct pipeline *pipe)
throw(MAL, "optimizer.validate",
SQLSTATE(42000) "'inline' should be the first\n");
- for (i = 0; pipe->def[i]; i++) {
+ for (int i = 0; pipe->def[i]; i++) {
const char *fname = pipe->def[i];
if (garbage)
throw(MAL, "optimizer.validate",
@@ -286,8 +285,17 @@ validatePipe(struct pipeline *pipe)
remap = true;
else if (strcmp(fname, "mitosis") == 0)
mitosis = true;
- else if (strcmp(fname, "mergetable") == 0)
+ else if (strcmp(fname, "mergetable") == 0) {
+ if (!mitosis)
+ throw(MAL, "optimizer.validate",
+ SQLSTATE(42000) "'mergetable'
requires 'mitosis'\n");
mergetable = true;
+ } else if (strcmp(fname, "matpack") == 0 && !mergetable)
+ throw(MAL, "optimizer.validate",
+ SQLSTATE(42000) "'matpack' requires
'mergetable'\n");
+ else if (strcmp(fname, "reorder") == 0 && !mitosis)
+ throw(MAL, "optimizer.validate",
+ SQLSTATE(42000) "'reorder' requires
'mitosis'\n");
else if (strcmp(fname, "multiplex") == 0)
multiplex = true;
else if (strcmp(fname, "generator") == 0)
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
@@ -40,7 +40,7 @@
/* Insert the instruction immediately after a previous instruction that
* generated an argument needed.
- * If non can be found, add it to the end.
+ * If none can be found, add it to the end.
* Be aware of side-effect instructions, they may not be skipped.
*/
str
@@ -57,9 +57,6 @@ OPTreorderImplementation(Client cntxt, M
for (i = 0; i < MAXSLICES; i++)
top[i] = 0;
- if (!isOptimizerUsed(mb, pci, mitosisRef)) {
- goto wrapup;
- }
(void) cntxt;
(void) stk;
@@ -173,7 +170,6 @@ OPTreorderImplementation(Client cntxt, M
/* keep all actions taken as a post block comment */
//mnstr_printf(cntxt->fdout,"REORDER RESULT ");
//printFunction(cntxt->fdout, mb, 0, LIST_MAL_ALL);
- wrapup:
for (i = 0; i <= blkcnt; i++)
if (top[i])
GDKfree(blocks[i]);
diff --git a/monetdb5/optimizer/opt_support.c b/monetdb5/optimizer/opt_support.c
--- a/monetdb5/optimizer/opt_support.c
+++ b/monetdb5/optimizer/opt_support.c
@@ -59,29 +59,6 @@ isOptimizerEnabled(MalBlkPtr mb, const c
return 0;
}
-/*
- * Find if an optimizer 'opt' has run before the instruction 'p'.
- */
-bool
-isOptimizerUsed(MalBlkPtr mb, InstrPtr p, const char *opt)
-{
- bool p_found = false;
-
- if (getModuleId(p) == optimizerRef && getFunctionId(p) ==
defaultfastRef)
- return true;
- for (int i = mb->stop - 1; i > 0; i--) {
- InstrPtr q = getInstrPtr(mb, i);
-
- p_found |= q == p; /* the optimizer to find must
come before p */
- if (q && q->token == ENDsymbol)
- return false;
- if (p_found && q && q != p && getModuleId(q) == optimizerRef
- && getFunctionId(q) == opt)
- return true;
- }
- return false;
-}
-
/* Simple insertion statements do not require complex optimizer steps */
int
isSimpleSQL(MalBlkPtr mb)
diff --git a/monetdb5/optimizer/opt_support.h b/monetdb5/optimizer/opt_support.h
--- a/monetdb5/optimizer/opt_support.h
+++ b/monetdb5/optimizer/opt_support.h
@@ -53,6 +53,5 @@ extern int isSubJoin(InstrPtr q);
extern int isMultiplex(InstrPtr q);
extern int isUnion(InstrPtr q);
extern int isOptimizerEnabled(MalBlkPtr mb, const char *opt);
-extern bool isOptimizerUsed(MalBlkPtr mb, InstrPtr p, const char *opt);
#endif /* _OPT_SUPPORT_H */
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]