Changeset: bba2819c6be4 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bba2819c6be4 Modified Files: Branch: jacqueline Log Message:
Merged from default diffs (truncated from 2000 to 300 lines): diff --git a/monetdb5/mal/mal_instruction.mx b/monetdb5/mal/mal_instruction.mx --- a/monetdb5/mal/mal_instruction.mx +++ b/monetdb5/mal/mal_instruction.mx @@ -39,29 +39,29 @@ All Rights Reserved. #define DEBUG_MAL_INSTR /* #define DEBUG_REDUCE */ -#define MAXARG 4 /* BEWARE the code depends on this knowledge */ +#define MAXARG 4 /* BEWARE the code depends on this knowledge */ #define STMT_INCREMENT 32 #define MAL_VAR_WINDOW 32 #define MAXVARS 32 #define MAXLISTING 64*1024 typedef struct SYMDEF { - struct SYMDEF *peer; /* where to look next */ - struct SYMDEF *skip; /* skip to next different symbol */ + struct SYMDEF *peer; /* where to look next */ + struct SYMDEF *skip; /* skip to next different symbol */ str name; int kind; - struct MALBLK *def; /* the details of the MAL fcn */ + struct MALBLK *def; /* the details of the MAL fcn */ } *Symbol, SymRecord; typedef struct VARRECORD { - str name; /* argname or lexical value repr */ - malType type; /* internal type signature */ - int flags; /* see below, reserve some space */ - int tmpindex; /* temporary variable */ + str name; /* argname or lexical value repr */ + malType type; /* internal type signature */ + int flags; /* see below, reserve some space */ + int tmpindex; /* temporary variable */ ValRecord value; - int eolife; /* pc index when it should be garbage collected */ - int propc, maxprop; /* proc count and max number of properties */ - int prps[]; /* property array */ + int eolife; /* pc index when it should be garbage collected */ + int propc, maxprop; /* proc count and max number of properties */ + int prps[]; /* property array */ } *VarPtr, VarRecord; /* Variable properties */ @@ -72,7 +72,7 @@ typedef struct VARRECORD { #define VAR_CLEANUP 16 #define VAR_INIT 32 #define VAR_USED 64 -#define VAR_DISABLED 128 /* used for comments and scheduler */ +#define VAR_DISABLED 128 /* used for comments and scheduler */ /* type check status is kept around to improve type checking efficiency */ #define TYPE_ERROR -1 @@ -81,112 +81,106 @@ typedef struct VARRECORD { #define GARBAGECONTROL 3 -#define VARARGS 1 /* deal with variable arguments */ +#define VARARGS 1 /* deal with variable arguments */ #define VARRETS 2 /* all functions return a string */ typedef struct { - bit token; /* instruction type */ - bit barrier; /* flow of control modifier takes: - BARRIER, LEAVE, REDO, EXIT, CATCH, RAISE*/ - bit typechk; /* type check status */ - bit gc; /* garbage control flags */ - bit polymorphic; /* complex type analysis */ - bit varargs; /* variable number of arguments */ - int recycle; /* <0 or index into recycle cache */ - int jump; /* controlflow program counter */ - MALfcn fcn; /* resolved function address */ - struct MALBLK *blk; /* resolved MAL function address */ - str modname; /* module context */ - str fcnname; /* function name */ - int argc, retc, maxarg; /* total and result argument count */ - int argv[]; /* at least a few entries */ + bit token; /* instruction type */ + bit barrier; /* flow of control modifier takes: + BARRIER, LEAVE, REDO, EXIT, CATCH, RAISE */ + bit typechk; /* type check status */ + bit gc; /* garbage control flags */ + bit polymorphic; /* complex type analysis */ + bit varargs; /* variable number of arguments */ + int recycle; /* <0 or index into recycle cache */ + int jump; /* controlflow program counter */ + MALfcn fcn; /* resolved function address */ + struct MALBLK *blk; /* resolved MAL function address */ + str modname; /* module context */ + str fcnname; /* function name */ + int argc, retc, maxarg; /* total and result argument count */ + int argv[]; /* at least a few entries */ } *InstrPtr, InstrRecord; -/* -For performance analysis we keep track of the number of calls -and the total time spent while executing the instruction. -(See mal_profiler.mx) -The performance structures are separately administered, because -they are only used in limited curcumstances. -*/ +/* For performance analysis we keep track of the number of calls and + * the total time spent while executing the instruction. (See + * mal_profiler.mx) The performance structures are separately + * administered, because they are only used in limited + * curcumstances. */ typedef struct PERF { #ifdef HAVE_TIMES - struct tms timer; /* timing information */ + struct tms timer; /* timing information */ #endif - struct timeval clock; /* clock */ - lng clk; /* microseconds clock */ - lng ticks; /* micro seconds spent */ - int counter; /* accumulate statistics */ - lng totalticks; - bit trace; /* facilitate filter-based profiling */ - lng rbytes; /* bytes read by an instruction */ - lng wbytes; /* bytes written by an instruction */ + struct timeval clock; /* clock */ + lng clk; /* microseconds clock */ + lng ticks; /* micro seconds spent */ + int counter; /* accumulate statistics */ + lng totalticks; + bit trace; /* facilitate filter-based profiling */ + lng rbytes; /* bytes read by an instruction */ + lng wbytes; /* bytes written by an instruction */ } *ProfPtr, ProfRecord; typedef struct MALBLK { - str binding; /* related C-function */ - str help; /* supportive commentary */ + str binding; /* related C-function */ + str help; /* supportive commentary */ struct MALBLK *alternative; - int vtop; /* next free slot */ - int vsize; /* size of variable arena */ - VarRecord **var; /* Variable table */ - int stop; /* next free slot */ - int ssize; /* byte size of arena */ - InstrPtr *stmt; /* Instruction location */ - int ptop; /* next free slot */ - int psize; /* byte size of arena */ - MalProp *prps; /* property table */ - int errors; /* left over errors */ - int typefixed; /* no undetermined instruction */ - int flowfixed; /* all flow instructions are fixed */ + int vtop; /* next free slot */ + int vsize; /* size of variable arena */ + VarRecord **var; /* Variable table */ + int stop; /* next free slot */ + int ssize; /* byte size of arena */ + InstrPtr *stmt; /* Instruction location */ + int ptop; /* next free slot */ + int psize; /* byte size of arena */ + MalProp *prps; /* property table */ + int errors; /* left over errors */ + int typefixed; /* no undetermined instruction */ + int flowfixed; /* all flow instructions are fixed */ ProfPtr profiler; - struct MALBLK *history;/* of optimizer actions */ - 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; /* for the replicator tests */ - sht recycle; /* execution subject to recycler control */ - lng recid; /* ID given by recycler optimizer */ + struct MALBLK *history; /* of optimizer actions */ + 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; /* for the replicator tests */ + sht recycle; /* execution subject to recycler control */ + lng recid; /* ID given by recycler optimizer */ lng legid; - sht trap; /* call debugger when called */ + sht trap; /* call debugger when called */ } *MalBlkPtr, MalBlkRecord; -/* -Allocation of space assumes a rather exotic number of arguments. -Access to module and function name are cast in macros to prepare -for separate name space management. -*/ -#define getModuleId(P) (P)->modname -#define setModuleId(P,S) (P)->modname= S -#define setModuleScope(P,S) {(P)->modname= (S)==NULL?NULL: (S)->name;} +/* Allocation of space assumes a rather exotic number of + * arguments. Access to module and function name are cast in macros to + * prepare for separate name space management. */ +#define getModuleId(P) (P)->modname +#define setModuleId(P,S) (P)->modname= S +#define setModuleScope(P,S) {(P)->modname= (S)==NULL?NULL: (S)->name;} -#define getFunctionId(P) (P)->fcnname -#define setFunctionId(P,S) (P)->fcnname= S -#define garbageControl(P) ((P)->gc & GARBAGECONTROL) +#define getFunctionId(P) (P)->fcnname +#define setFunctionId(P,S) (P)->fcnname= S +#define garbageControl(P) ((P)->gc & GARBAGECONTROL) -#define getInstrPtr(M,I) (M)->stmt[I] -#define getSignature(S) getInstrPtr((S)->def,0) +#define getInstrPtr(M,I) (M)->stmt[I] +#define getSignature(S) getInstrPtr((S)->def,0) #define isMain(M) ((getInstrPtr(M,0))->fcnname== putName("main",4)) -#define getFcnName(M) getFunctionId(getInstrPtr(M,0)) -#define getArgCount(M) getInstrPtr(M,0)->argc -#define getModName(M) getModuleId(getInstrPtr(M,0)) -#define getPrgSize(M) (M)->stop +#define getFcnName(M) getFunctionId(getInstrPtr(M,0)) +#define getArgCount(M) getInstrPtr(M,0)->argc +#define getModName(M) getModuleId(getInstrPtr(M,0)) +#define getPrgSize(M) (M)->stop -#define getVar(M,I) (M)->var[I] -#define getVarTmp(M,I) (M)->var[I]->tmpindex -#define isTmpVar(M,I) ((M)->var[I]->tmpindex) -#define getVarType(M,I) ((M)->var[I]->type) -#define getVarGDKType(M,I) getGDKType((M)->var[I]->type) +#define getVar(M,I) (M)->var[I] +#define getVarTmp(M,I) (M)->var[I]->tmpindex +#define isTmpVar(M,I) ((M)->var[I]->tmpindex) +#define getVarType(M,I) ((M)->var[I]->type) +#define getVarGDKType(M,I) getGDKType((M)->var[I]->type) #define ignoreVar(M,I) ((M)->var[I]->type == TYPE_ptr? 1: 0) -/* - * @- - */ + @= varProperty -#define clrVar@1(M,I) ((M)->var[I]->flags &= ~VAR_@2) -#define setVar@1(M,I) ((M)->var[I]->flags |= VAR_@2) -#define isVar@1(M,I) ((M)->var[I]->flags & VAR_@2) +#define clrVar@1(M,I) ((M)->var[I]->flags &= ~VAR_@2) +#define setVar@1(M,I) ((M)->var[I]->flags |= VAR_@2) +#define isVar@1(M,I) ((M)->var[I]->flags & VAR_@2) @ @h @:varProperty(Fixed,FIXTYPE)@ @@ -198,20 +192,20 @@ for separate name space management. @:varProperty(UDFtype,UDFTYPE)@ @:varProperty(Constant,CONSTANT)@ -#define getVarConstant(M,I) ((M)->var[I]->value) -#define getVarValue(M,I) VALget(&(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 -#define setDestType(M,P,V) setVarType((M),getDestVar(P),V) -#define getDestType(M,P) destinationType((M),(P)) -#define getArg(P,I) (P)->argv[I] -#define setArg(P,I,R) (P)->argv[I]= R -#define getArgName(M,P,I) getVarName((M),(P)->argv[I]) -#define getArgType(M,P,I) getVarType((M),(P)->argv[I]) -#define getArgGDKType(M,P,I) getVarGDKType((M),(P)->argv[I]) +#define getDestVar(P) (P)->argv[0] +#define setDestVar(P,X) (P)->argv[0] =X +#define setDestType(M,P,V) setVarType((M),getDestVar(P),V) +#define getDestType(M,P) destinationType((M),(P)) +#define getArg(P,I) (P)->argv[I] +#define setArg(P,I,R) (P)->argv[I]= R +#define getArgName(M,P,I) getVarName((M),(P)->argv[I]) +#define getArgType(M,P,I) getVarType((M),(P)->argv[I]) +#define getArgGDKType(M,P,I) getVarGDKType((M),(P)->argv[I]) -#define getEndOfLife(X,Y) (X)->var[Y]->eolife +#define getEndOfLife(X,Y) (X)->var[Y]->eolife mal_export InstrPtr newInstruction(MalBlkPtr mb, int kind); mal_export InstrPtr copyInstruction(InstrPtr p); @@ -231,9 +225,9 @@ mal_export int newMalBlkStmt(MalBlkPtr m mal_export void prepareMalBlk(MalBlkPtr mb, str s); mal_export void freeMalBlk(MalBlkPtr mb); mal_export MalBlkPtr copyMalBlk(MalBlkPtr mb); -mal_export void addtoMalBlkHistory(MalBlkPtr mb,str marker); +mal_export void addtoMalBlkHistory(MalBlkPtr mb, str marker); mal_export void showMalBlkHistory(MalBlkPtr mb); -mal_export MalBlkPtr getMalBlkHistory(MalBlkPtr mb,int idx); +mal_export MalBlkPtr getMalBlkHistory(MalBlkPtr mb, int idx); mal_export MalBlkPtr gotoMalBlkMarker(MalBlkPtr mb, str marker); mal_export MalBlkPtr getMalBlkMarker(MalBlkPtr mb, str marker); mal_export void expandMalBlk(MalBlkPtr mb, int lines); @@ -267,14 +261,14 @@ mal_export void freeVariable(MalBlkPtr m mal_export void clearVariable(MalBlkPtr mb, int varid); mal_export int cpyConstant(MalBlkPtr mb, VarPtr vr); mal_export int defConstant(MalBlkPtr mb, int type, ValPtr cst); -mal_export int fndConstant(MalBlkPtr mb, ValPtr cst,int depth); +mal_export int fndConstant(MalBlkPtr mb, ValPtr cst, int depth); mal_export str convertConstant(malType type, ValPtr vr); mal_export int newProperty(MalBlkPtr mb); #define varSetProperty(mb, var, name, opname, cst) \ varSetProp(mb, var, PropertyIndex(name), PropertyOperator(opname), cst) mal_export void varSetProp(MalBlkPtr mb, int var, int prop, int op, ValPtr cst); -mal_export str varGetPropStr( MalBlkPtr mb, int var ); _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list