Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2062/mal
Modified Files:
Makefile.ag mal_instruction.mx mal_interpreter.mx
Log Message:
This is a test checkin for the compilers
It introduces the third recycle framework, which hooks into the
interpreter directly without spelling out the signatures.
The marking of the instructions (actually the variables) should be
done still.
Index: Makefile.ag
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/Makefile.ag,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- Makefile.ag 11 Jan 2008 10:41:31 -0000 1.47
+++ Makefile.ag 1 Mar 2008 22:52:36 -0000 1.48
@@ -28,7 +28,7 @@
mal_client.mx mal_profiler.mx mal_scenario.mx mal_factory.mx \
mal_namespace.mx mal_properties.mx \
mal_syntax.mx mal_authorize.mx mal_sabaoth.mx \
- mal_builder.mx mal_readline.mx mal_atom.mx
+ mal_builder.mx mal_readline.mx mal_atom.mx mal_recycle.mx
SCRIPTS = mal
LIBS = $(MONETDB_LIBS) -lbat -lstream \
@@ -47,7 +47,7 @@
mal_client.mx mal_profiler.mx mal_scenario.mx mal_factory.mx \
mal_namespace.mx mal_properties.mx \
mal_syntax.mx mal_authorize.mx mal_sabaoth.mx \
- mal_builder.mx mal_readline.mx mal_atom.mx
+ mal_builder.mx mal_readline.mx mal_atom.mx mal_recycle.mx
HEADERS = h
}
Index: mal_interpreter.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_interpreter.mx,v
retrieving revision 1.213
retrieving revision 1.214
diff -u -d -r1.213 -r1.214
--- mal_interpreter.mx 12 Feb 2008 18:48:26 -0000 1.213
+++ mal_interpreter.mx 1 Mar 2008 22:52:36 -0000 1.214
@@ -65,6 +65,7 @@
#include "mal_config.h"
#include "mal_interpreter.h"
#include "mal_debugger.h" /* for mdbStep() */
+#include "mal_recycle.h"
#include "mal_type.h"
#define SLOW 1
@@ -467,7 +468,10 @@
pci = getInstrPtr(mb,stkpc);
if( malProfileMode + cntxt->itrace)
goto workslow;
- @:MALinterpret(FAST)@
+ @:MALrecyclerStart@ {
+ @:MALinterpret(FAST)@
+ @:MALrecyclerExit@
+ }
@:MALflowofcontrol(FAST)@
}
} else
@@ -496,7 +500,10 @@
}
@:beginProfile@
- @:MALinterpret(SLOW)@
+ @:MALrecyclerStart@ {
+ @:MALinterpret(SLOW)@
+ @:MALrecyclerExit@
+ }
@:MALflowofcontrol(SLOW)@
@:endProfile@
}
@@ -1452,6 +1459,17 @@
v->name, getTypeName(v->type), getTypeName(tpe));
}
[EMAIL PROTECTED]
[EMAIL PROTECTED] Result Recycler
+An optimization scheme for query sequences is to re-use variables
+as much as possible.
+The recycler works for any variable and relies on policy functions
+registered.
[EMAIL PROTECTED] MALrecyclerStart
+ if( !mb->version || !RECYCLEentry(mb,stk,pci) )
[EMAIL PROTECTED] MALrecyclerExit
+ if( mb->version )
+ RECYCLEexit(mb,stk,pci);
@}
@-
@node Garbage Collection, Stack Management, Exception Handling, The MAL
Interpreter
Index: mal_instruction.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_instruction.mx,v
retrieving revision 1.298
retrieving revision 1.299
diff -u -d -r1.298 -r1.299
--- mal_instruction.mx 28 Feb 2008 14:09:58 -0000 1.298
+++ mal_instruction.mx 1 Mar 2008 22:52:36 -0000 1.299
@@ -318,7 +318,8 @@
typedef struct VARRECORD {
str name; /* argname or lexical value repr */
malType type; /* internal type signature */
- int tmpindex; /* temporary variable */
+ short tmpindex; /* temporary variable */
+ short recycle; /* variable id in the recycler catalog */
ValRecord value;
short flags; /* see below, reserve some space */
short propc, maxprop; /* proc count and max number of properties */
@@ -334,7 +335,8 @@
#define VAR_INIT 32
#define VAR_USED 64
#define VAR_DISABLED 128 /* used for comments and scheduler */
-#define VAR_STORED 256 /* used for replicator */
+#define VAR_RECYCLE 256 /* Recycle control, variable can be
recycled */
+#define VAR_KEPT 512 /* Recycle control, variable is available
*/
/* type check status is kept around to improve type checking efficiency */
#define TYPE_ERROR -1
@@ -414,7 +416,8 @@
int keephistory; /* do we need the history at all */
str marker; /* history points are marked for
backtracking */
int maxarg; /* keep track on the maximal arguments
used */
- ptr replica;
+ int version; /* recycling version, 0 means no recycling */
+ ptr replica; /* for the replicator tests */
} *MalBlkPtr, MalBlkRecord;
@-
@@ -458,9 +461,11 @@
@:varProperty(Typedef,TYPEVAR)@
@:varProperty(UDFtype,UDFTYPE)@
@:varProperty(Constant,CONSTANT)@
-@:varProperty(Stored,STORED)@
+@:varProperty(Kept,KEPT)@
+@:varProperty(Recycled,RECYCLE)@
-#define getVarConstant(M,I) ((M)->var[I]->value)
+#define getVarConstant(M,I) ((M)->var[I]->value)
+#define getVarValue(M,I) VALget(&(M)->var[I]->value)
#define getDestVar(P) (P)->argv[0]
#define setDestVar(P,X) (P)->argv[0] =X
@@ -666,7 +671,7 @@
mb->profiler = NULL;
mb->ptop = mb->psize = 0;
mb->prps = NULL;
- mb->replica = NULL;
+ mb->version = 0;
return mb;
}
@@ -2090,6 +2095,10 @@
mb->ssize += STMT_INCREMENT;
GDKfree(mb->stmt);
mb->stmt = newblk;
+ /* also extend the storage space for the profiler */
+ /* left to the environment */
+ if( mb->profiler)
+ mb->profiler= NULL;
}
@-
If the destination variable has not been set, introduce a temporary
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins