Changeset: 0f365c5a0ff0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0f365c5a0ff0
Removed Files:
monetdb5/mal/Tests/tst780.maltest
monetdb5/optimizer/Tests/tst4601.maltest
monetdb5/optimizer/opt_macro.c
monetdb5/optimizer/opt_macro.h
Modified Files:
clients/Tests/MAL-signatures-hge.test
clients/Tests/MAL-signatures.test
monetdb5/mal/Tests/All
monetdb5/optimizer/CMakeLists.txt
monetdb5/optimizer/Tests/All
monetdb5/optimizer/opt_inline.c
monetdb5/optimizer/opt_inline.h
monetdb5/optimizer/opt_remap.c
monetdb5/optimizer/optimizer.c
Branch: Dec2023
Log Message:
Removed unused macro optimizer.
diffs (truncated from 927 to 300 lines):
diff --git a/clients/Tests/MAL-signatures-hge.test
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -48484,16 +48484,6 @@ pattern optimizer.inline(X_0:str, X_1:st
OPTwrapper;
Expand inline functions
optimizer
-macro
-pattern optimizer.macro(X_0:str, X_1:str):void
-OPTmacro;
-Inline the code of the target function.
-optimizer
-macro
-pattern optimizer.macro(X_0:str, X_1:str, X_2:str, X_3:str):void
-OPTmacro;
-Inline a target function used in a specific function.
-optimizer
matpack
pattern optimizer.matpack():str
OPTwrapper;
@@ -48549,16 +48539,6 @@ pattern optimizer.optimize(X_0:str, X_1:
QOToptimize;
Optimize a specific operation
optimizer
-orcam
-pattern optimizer.orcam(X_0:str, X_1:str):void
-OPTorcam;
-Inverse macro processor for current function
-optimizer
-orcam
-pattern optimizer.orcam(X_0:str, X_1:str, X_2:str, X_3:str):void
-OPTorcam;
-Inverse macro, find pattern and replace with a function call.
-optimizer
postfix
pattern optimizer.postfix():str
OPTwrapper;
diff --git a/clients/Tests/MAL-signatures.test
b/clients/Tests/MAL-signatures.test
--- a/clients/Tests/MAL-signatures.test
+++ b/clients/Tests/MAL-signatures.test
@@ -36914,16 +36914,6 @@ pattern optimizer.inline(X_0:str, X_1:st
OPTwrapper;
Expand inline functions
optimizer
-macro
-pattern optimizer.macro(X_0:str, X_1:str):void
-OPTmacro;
-Inline the code of the target function.
-optimizer
-macro
-pattern optimizer.macro(X_0:str, X_1:str, X_2:str, X_3:str):void
-OPTmacro;
-Inline a target function used in a specific function.
-optimizer
matpack
pattern optimizer.matpack():str
OPTwrapper;
@@ -36979,16 +36969,6 @@ pattern optimizer.optimize(X_0:str, X_1:
QOToptimize;
Optimize a specific operation
optimizer
-orcam
-pattern optimizer.orcam(X_0:str, X_1:str):void
-OPTorcam;
-Inverse macro processor for current function
-optimizer
-orcam
-pattern optimizer.orcam(X_0:str, X_1:str, X_2:str, X_3:str):void
-OPTorcam;
-Inverse macro, find pattern and replace with a function call.
-optimizer
postfix
pattern optimizer.postfix():str
OPTwrapper;
diff --git a/monetdb5/mal/Tests/All b/monetdb5/mal/Tests/All
--- a/monetdb5/mal/Tests/All
+++ b/monetdb5/mal/Tests/All
@@ -155,7 +155,6 @@ tst750
tst755
tst760
tst770
-tst780
tst802
tst804
tst810
diff --git a/monetdb5/mal/Tests/tst780.maltest
b/monetdb5/mal/Tests/tst780.maltest
deleted file mode 100644
--- a/monetdb5/mal/Tests/tst780.maltest
+++ /dev/null
@@ -1,29 +0,0 @@
-statement ok
-module dummy;
-
-statement ok
-function hello():void;
- io.print("hello world\n");
-end hello;
-
-statement ok
-function doit(i:int, j:str):int;
- io.print(i);
- io.print(j);
- return doit:= 3;
-end doit;
-
-query T rowsort
-dummy.hello();
-----
-"hello world\n"
-
-query T rowsort
-z:=dummy.doit(1,"help");
-----
-"help"
-1
-
-statement ok
-optimizer.macro("dummy","hello");
-
diff --git a/monetdb5/optimizer/CMakeLists.txt
b/monetdb5/optimizer/CMakeLists.txt
--- a/monetdb5/optimizer/CMakeLists.txt
+++ b/monetdb5/optimizer/CMakeLists.txt
@@ -30,7 +30,6 @@ target_sources(optimizer
opt_querylog.c opt_querylog.h
opt_inline.c opt_inline.h
opt_projectionpath.c opt_projectionpath.h
- opt_macro.c opt_macro.h
opt_matpack.c opt_matpack.h
opt_mergetable.c opt_mergetable.h
opt_mitosis.c opt_mitosis.h
diff --git a/monetdb5/optimizer/Tests/All b/monetdb5/optimizer/Tests/All
--- a/monetdb5/optimizer/Tests/All
+++ b/monetdb5/optimizer/Tests/All
@@ -7,7 +7,6 @@ tst4005
tst4006
tst4010
tst4030
-tst4601
tst4630
#tst4700 no compiler
#tst4701
diff --git a/monetdb5/optimizer/Tests/tst4601.maltest
b/monetdb5/optimizer/Tests/tst4601.maltest
deleted file mode 100644
--- a/monetdb5/optimizer/Tests/tst4601.maltest
+++ /dev/null
@@ -1,14 +0,0 @@
-statement ok
-function welcome(lim:int):int;
- i:= 0;
-barrier j:= i<lim;
- io.print("Welcome");
- i:= i+1;
- redo j:= i<lim;
-exit j;
- return i;
-end welcome
-
-statement ok
-optimizer.macro("user","welcome")
-
diff --git a/monetdb5/optimizer/opt_inline.c b/monetdb5/optimizer/opt_inline.c
--- a/monetdb5/optimizer/opt_inline.c
+++ b/monetdb5/optimizer/opt_inline.c
@@ -11,6 +11,112 @@
#include "monetdb_config.h"
#include "opt_inline.h"
+#define MAXEXPANSION 256
+
+int
+inlineMALblock(MalBlkPtr mb, int pc, MalBlkPtr mc)
+{
+ int i, k, l, n;
+ InstrPtr *ns, p, q;
+ int *nv;
+
+ p = getInstrPtr(mb, pc);
+ q = getInstrPtr(mc, 0);
+ ns = GDKzalloc((l = (mb->ssize + mc->ssize + p->retc - 3)) *
sizeof(InstrPtr));
+ if (ns == NULL)
+ return -1;
+ nv = (int *) GDKmalloc(mc->vtop * sizeof(int));
+ if (nv == 0) {
+ GDKfree(ns);
+ return -1;
+ }
+
+ /* add all variables of the new block to the target environment */
+ for (n = 0; n < mc->vtop; n++) {
+ if (isExceptionVariable(getVarName(mc, n))) {
+ nv[n] = newVariable(mb, getVarName(mc, n),
+
strlen(getVarName(mc, n)), TYPE_str);
+ } else if (isVarTypedef(mc, n)) {
+ nv[n] = newTypeVariable(mb, getVarType(mc, n));
+ } else if (isVarConstant(mc, n)) {
+ nv[n] = cpyConstant(mb, getVar(mc, n));
+ } else {
+ nv[n] = newTmpVariable(mb, getVarType(mc, n));
+ }
+ if (nv[n] < 0) {
+ GDKfree(nv);
+ GDKfree(ns);
+ return -1;
+ }
+ }
+
+ /* use an alias mapping to keep track of the actual arguments */
+ for (n = p->retc; n < p->argc; n++)
+ nv[getArg(q, n)] = getArg(p, n);
+
+ k = 0;
+ /* find the return statement of the inline function */
+ for (i = 1; i < mc->stop - 1; i++) {
+ q = mc->stmt[i];
+ if (q->barrier == RETURNsymbol) {
+ /* add the mapping of the return variables */
+ for (n = 0; n < p->retc; n++)
+ nv[getArg(q, n)] = getArg(p, n);
+ }
+ }
+
+ /* copy the stable part */
+ for (i = 0; i < pc; i++)
+ ns[k++] = mb->stmt[i];
+
+ for (i = 1; i < mc->stop - 1; i++) {
+ q = mc->stmt[i];
+ if (q->token == ENDsymbol)
+ break;
+
+ /* copy the instruction and fix variable references */
+ ns[k] = copyInstruction(q);
+ if (ns[k] == NULL) {
+ GDKfree(nv);
+ GDKfree(ns);
+ return -1;
+ }
+
+ for (n = 0; n < q->argc; n++)
+ getArg(ns[k], n) = nv[getArg(q, n)];
+
+ if (q->barrier == RETURNsymbol) {
+ for (n = 0; n < q->retc; n++)
+ clrVarFixed(mb, getArg(ns[k], n)); /* for
typing */
+ setModuleId(ns[k], getModuleId(q));
+ setFunctionId(ns[k], getFunctionId(q));
+ ns[k]->typechk = TYPE_UNKNOWN;
+ ns[k]->barrier = 0;
+ ns[k]->token = ASSIGNsymbol;
+ }
+ k++;
+ }
+
+ /* copy the remainder of the stable part */
+ freeInstruction(p);
+ for (i = pc + 1; i < mb->stop; i++) {
+ ns[k++] = mb->stmt[i];
+ }
+ /* remove any free instruction */
+ for (; i < mb->ssize; i++)
+ if (mb->stmt[i]) {
+ freeInstruction(mb->stmt[i]);
+ mb->stmt[i] = 0;
+ }
+ GDKfree(mb->stmt);
+ mb->stmt = ns;
+
+ mb->ssize = l;
+ mb->stop = k;
+ GDKfree(nv);
+ return pc;
+}
+
static bool
isCorrectInline(MalBlkPtr mb)
{
diff --git a/monetdb5/optimizer/opt_inline.h b/monetdb5/optimizer/opt_inline.h
--- a/monetdb5/optimizer/opt_inline.h
+++ b/monetdb5/optimizer/opt_inline.h
@@ -13,8 +13,8 @@
#include "opt_prelude.h"
#include "opt_support.h"
#include "mal_interpreter.h"
-#include "opt_macro.h"
+extern int inlineMALblock(MalBlkPtr mb, int pc, MalBlkPtr mc);
extern str OPTinlineImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr p);
diff --git a/monetdb5/optimizer/opt_macro.c b/monetdb5/optimizer/opt_macro.c
deleted file mode 100644
--- a/monetdb5/optimizer/opt_macro.c
+++ /dev/null
@@ -1,563 +0,0 @@
-/*
- * SPDX-License-Identifier: MPL-2.0
- *
- * 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/.
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]