⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 opt_crack.mx

📁 一个内存数据库的源代码这是服务器端还有客户端
💻 MX
字号:
@' 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://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html@'@' 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-2007 CWI.@' All Rights Reserved.@f opt_crack@a S.IdreosThe cracker optimizer searches patterns to be replaced bythe special cracker index operations.@{@malpattern optimizer.crack():straddress OPTcrack;pattern optimizer.crack(mod:str, fcn:str):straddress OPTcrackcomment "Replace algebra select with crackers select";@h#ifndef _OPT_CRACK_#define _OPT_CRACK_/* #define DEBUG_OPT_CRACK */#include "opt_support.h"#endif@c  #include "mal_config.h"#include "opt_crack.h"#include "mal_interpreter.h"	/* for showErrors() */#include "opt_prelude.h"#define match2(X,M,F) ( (X) && getFunctionId(X) && getFunctionId(X)==F && \	getModuleId(X) && getModuleId(X)==M)/* find all algebra select structions in a mal block mb and change them to the corresponding crackers command    */static intOPTcrackImplementation(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){	InstrPtr p, *old;	int i, limit, actions=0;#ifdef DEBUG_OPT_CRACK	printf("Crack optimizer started\n");#endif	(void) stk; (void) pci;		limit = mb->stop;	old = mb->stmt;		for (i = 0; i < limit; i++) {		p = old[i];#ifdef DEBUG_OPT_CRACK		printf("limit is at: %d and i is at: %d  ", limit, i);	        printInstruction(GDKout, mb, p, LIST_MAL_ALL);	#endif		/* find and replace algebra select commands with crack select ones*/		if (match2(p, batRef, newRef) ||			match2(p, sqlRef, bindRef)){  				/* add a property can be cracked to every base relation */			if ( getTailType(mb->var[getArg(p,0)]->type)!=TYPE_int &&			     getTailType(mb->var[getArg(p,0)]->type)!=TYPE_dbl &&			     getTailType(mb->var[getArg(p,0)]->type)!=TYPE_lng &&			     getTailType(mb->var[getArg(p,0)]->type)!=TYPE_flt &&			     getTailType(mb->var[getArg(p,0)]->type)!=TYPE_sht &&			     getTailType(mb->var[getArg(p,0)]->type)!=TYPE_chr ) 					continue;			if (getModuleId(p)== sqlRef &&				mb->var[getArg(p,4)]->value.val.ival != 0 ) continue;									setArgProperty(mb,p,0,"canBeCracked","=", TYPE_int, &i);			actions++;		}		if (match2(p, batRef, setWriteModeRef)){ /* propagete the canBeCracked property */			if(fndArgProperty(mb,p,1,"canBeCracked")){				setArgProperty(mb,p,0,"canBeCracked","=", TYPE_int, &i);			actions++;			}		}		if (match2(p, algebraRef, selectRef) ||			match2(p, algebraRef, uselectRef)){ 				if(fndArgProperty(mb,p,1,"canBeCracked"))						setModuleId(p,putName("crackers",8));			actions++;		}		if (p == pci) 			removeInstruction(mb, p);	}	return actions;}@include optimizerWrapper.mx@h@:exportOptimizer(crack)@@c@:wrapOptimizer(crack,OPT_CHECK_ALL)@@}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -