Index: trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp
===================================================================
--- trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp	(revision 254)
+++ trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp	(revision 255)
@@ -39,7 +39,5 @@
 
 		//sub rsp,スタックフレームサイズ
-		int StackFrameSchedule;
-		compiler.codeGenerator.op_sub_rsp(0xFFFFFFFF);
-		StackFrameSchedule=obp-sizeof(long);
+		const PertialSchedule *pStackFramePertialSchedule = compiler.codeGenerator.op_sub_rsp( 0, true );
 
 		extern BOOL bDebugCompile;
@@ -65,5 +63,5 @@
 
 		//スタックフレームスケジュール（subコマンドに渡す値）
-		*((long *)(OpBuffer+StackFrameSchedule))=pobj_sf->GetFrameSize(0);
+		compiler.codeGenerator.opfix( pStackFramePertialSchedule, pobj_sf->GetFrameSize(0) );
 
 		UserProc::CompileStartForUserProc( pBackUserProc );
@@ -77,7 +75,5 @@
 
 		//sub rsp,スタックフレームサイズ
-		int StackFrameSchedule;
-		compiler.codeGenerator.op_sub_rsp(0xFFFFFFFF);
-		StackFrameSchedule=obp-sizeof(long);
+		const PertialSchedule *pStackFramePertialSchedule = compiler.codeGenerator.op_sub_rsp( 0, true );
 
 		BOOST_FOREACH( Variable *pVar, compiler.GetMeta().GetGlobalVars() ){
@@ -102,5 +98,5 @@
 
 		//スタックフレームスケジュール（subコマンドに渡す値）
-		*((long *)(OpBuffer+StackFrameSchedule))=pobj_sf->GetFrameSize(0);
+		compiler.codeGenerator.opfix( pStackFramePertialSchedule, pobj_sf->GetFrameSize(0) );
 
 		//ret
@@ -135,74 +131,4 @@
 		//ret
 		compiler.codeGenerator.op_ret();
-	}
-	else if( userProc.GetName() == "_allrem" ){
-		//乗除演算用の特殊関数（64ビット整数対応）
-		BYTE Buffer_allrem[]={
-			0x53,0x57,0x33,0xFF,0x8B,0x44,0x24,0x10,0x0B,0xC0,0x7D,0x14,0x47,0x8B,0x54,0x24,0x0C,0xF7,0xD8,0xF7,0xDA,0x83,0xD8,0x00,0x89,0x44,0x24,0x10,0x89,0x54,0x24,0x0C,0x8B,0x44,0x24,0x18,0x0B,0xC0,0x7D,0x13,0x8B,0x54,0x24,0x14,0xF7,0xD8,0xF7,0xDA,0x83,0xD8,0x00,0x89,0x44,0x24,0x18,0x89,0x54,0x24,0x14,0x0B,0xC0,0x75,0x1B,0x8B,0x4C,0x24,0x14,0x8B,0x44,0x24,0x10,0x33,0xD2,0xF7,0xF1,0x8B,0x44,0x24,0x0C,0xF7,0xF1,0x8B,0xC2,0x33,0xD2,0x4F,0x79,0x4E,0xEB,0x53,0x8B,0xD8,0x8B,0x4C,0x24,0x14,0x8B,0x54,0x24,0x10,0x8B,0x44,0x24,0x0C,0xD1,0xEB,0xD1,0xD9,0xD1,0xEA,0xD1,0xD8,0x0B,0xDB,0x75,0xF4,0xF7,0xF1,0x8B,0xC8,0xF7,0x64,0x24,0x18,0x91,0xF7,0x64,0x24,0x14,0x03,0xD1,0x72,0x0E,0x3B,0x54,0x24,0x10,0x77,0x08,0x72,0x0E,0x3B,0x44,0x24,0x0C,0x76,0x08,0x2B,0x44,0x24,0x14,0x1B,0x54,0x24,0x18,0x2B,0x44,0x24,0x0C,0x1B,0x54,0x24,0x10,0x4F,0x79,0x07,0xF7,0xDA,0xF7,0xD8,0x83,0xDA,0x00,0x5F,0x5B,0xC2,0x10,0x00
-		};
-
-		memcpy(OpBuffer+obp,Buffer_allrem,178);
-		obp+=178;
-	}
-	else if( userProc.GetName() == "_allmul" ){
-		//乗算用の特殊関数（64ビット整数対応）
-		BYTE Buffer_allmul[]={
-			0x8B,0x44,0x24,0x08,0x8B,0x4C,0x24,0x10,0x0B,0xC8,0x8B,0x4C,0x24,0x0C,0x75,0x09,0x8B,0x44,0x24,0x04,0xF7,0xE1,0xC2,0x10,0x00,0x53,0xF7,0xE1,0x8B,0xD8,0x8B,0x44,0x24,0x08,0xF7,0x64,0x24,0x14,0x03,0xD8,0x8B,0x44,0x24,0x08,0xF7,0xE1,0x03,0xD3,0x5B,0xC2,0x10,0x00
-		};
-
-		memcpy(OpBuffer+obp,Buffer_allmul,52);
-		obp+=52;
-	}
-	else if( userProc.GetName() == "_alldiv" ){
-		//除算用の特殊関数（64ビット整数対応）
-		BYTE Buffer_alldiv[]={
-			0x57,0x56,0x53,0x33,0xFF,0x8B,0x44,0x24,0x14,0x0B,0xC0,0x7D,0x14,0x47,0x8B,0x54,0x24,0x10,0xF7,0xD8,0xF7,0xDA,0x83,0xD8,0x00,0x89,0x44,0x24,0x14,0x89,0x54,0x24,0x10,0x8B,0x44,0x24,0x1C,0x0B,0xC0,0x7D,0x14,0x47,0x8B,0x54,0x24,0x18,0xF7,0xD8,0xF7,0xDA,0x83,0xD8,0x00,0x89,0x44,0x24,0x1C,0x89,0x54,0x24,0x18,0x0B,0xC0,0x75,0x18,0x8B,0x4C,0x24,0x18,0x8B,0x44,0x24,0x14,0x33,0xD2,0xF7,0xF1,0x8B,0xD8,0x8B,0x44,0x24,0x10,0xF7,0xF1,0x8B,0xD3,0xEB,0x41,0x8B,0xD8,0x8B,0x4C,0x24,0x18,0x8B,0x54,0x24,0x14,0x8B,0x44,0x24,0x10,0xD1,0xEB,0xD1,0xD9,0xD1,0xEA,0xD1,0xD8,0x0B,0xDB,0x75,0xF4,0xF7,0xF1,0x8B,0xF0,0xF7,0x64,0x24,0x1C,0x8B,0xC8,0x8B,0x44,0x24,0x18,0xF7,0xE6,0x03,0xD1,0x72,0x0E,0x3B,0x54,0x24,0x14,0x77,0x08,0x72,0x07,0x3B,0x44,0x24,0x10,0x76,0x01,0x4E,0x33,0xD2,0x8B,0xC6,0x4F,0x75,0x07,0xF7,0xDA,0xF7,0xD8,0x83,0xDA,0x00,0x5B,0x5E,0x5F,0xC2,0x10,0x00
-		};
-
-		memcpy(OpBuffer+obp,Buffer_alldiv,170);
-		obp+=170;
-	}
-	else if( userProc.GetName() == "_allshl" ){
-		//符号あり左ビットシフト用の特殊関数（64ビット整数対応）
-		BYTE Buffer_allshl[]={
-			0x80,0xF9,0x40,0x73,0x15,0x80,0xF9,0x20,0x73,0x06,0x0F,0xA5,0xC2,0xD3,0xE0,0xC3,0x8B,0xD0,0x33,0xC0,0x80,0xE1,0x1F,0xD3,0xE2,0xC3,0x33,0xC0,0x33,0xD2,0xC3
-		};
-
-		memcpy(OpBuffer+obp,Buffer_allshl,31);
-		obp+=31;
-	}
-	else if( userProc.GetName() == "_allshr" ){
-		//符号あり右ビットシフト用の特殊関数（64ビット整数対応）
-		BYTE Buffer_allshr[]={
-			0x80,0xF9,0x40,0x73,0x16,0x80,0xF9,0x20,0x73,0x06,0x0F,0xAD,0xD0,0xD3,0xFA,0xC3,0x8B,0xC2,0xC1,0xFA,0x1F,0x80,0xE1,0x1F,0xD3,0xF8,0xC3,0xC1,0xFA,0x1F,0x8B,0xC2,0xC3
-		};
-
-		memcpy(OpBuffer+obp,Buffer_allshr,33);
-		obp+=33;
-	}
-	else if( userProc.GetName() == "_aullshr" ){
-		//符号なし右ビットシフト用の特殊関数（64ビット整数対応）
-		BYTE Buffer_aullshr[]={
-			0x80,0xF9,0x40,         //cmp         cl,40h
-			0x73,0x15,              //jae         RETZERO (0040d71a)
-			0x80,0xF9,0x20,         //cmp         cl,20h
-			0x73,0x06,              //jae         MORE32 (0040d710)
-			0x0F,0xAD,0xD0,         //shrd        eax,edx,cl
-			0xD3,0xEA,              //shr         edx,cl
-			0xC3,                   //ret
-			//MORE32:
-			0x8B,0xC2,              //mov         eax,edx
-			0x33,0xD2,              //xor         edx,edx
-			0x80,0xE1,0x1F,         //and         cl,1Fh
-			0xD3,0xE8,              //shr         eax,cl
-			0xC3,                   //ret
-			//RETZERO:
-			0x33,0xC0,              //xor         eax,eax
-			0x33,0xD2,              //xor         edx,edx
-			0xC3                    //ret
-		};
-
-		memcpy(OpBuffer+obp,Buffer_aullshr,31);
-		obp+=31;
 	}
 	else{
@@ -441,7 +367,5 @@
 
 	//sub rsp,スタックフレームサイズ
-	int StackFrameSchedule;
-	compiler.codeGenerator.op_sub_rsp(0xFFFFFFFF);
-	StackFrameSchedule=obp-sizeof(long);
+	const PertialSchedule *pStackFramePertialSchedule = compiler.codeGenerator.op_sub_rsp( 0, true );
 
 	//mov qword ptr[rsp+offset],reg     ※スタックフレームを利用
@@ -482,10 +406,9 @@
 	}
 
-	int RspOffsetSchedule=0;
-	int RspOffsetSchedule2;
+	const PertialSchedule *pRspOffsetPertialSchedule1 = NULL;
+	const PertialSchedule *pRspOffsetPertialSchedule2 = NULL;
 	if(bDebugCompile&&bDebugSupportProc==0){
 		//mov rdx, qword ptr[rsp+スタックフレームサイズ]
-		compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RDX,REG_RSP,0,MOD_BASE_DISP32);
-		RspOffsetSchedule=obp-sizeof(long);
+		pRspOffsetPertialSchedule1 = compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RDX,REG_RSP,0,MOD_BASE_DISP32, Schedule::None, true );
 
 		//mov rcx,rsp
@@ -493,6 +416,5 @@
 
 		//add rcx,スタックフレームサイズ+sizeof(_int64) ※ret用のサイズを考慮
-		compiler.codeGenerator.op_add_RV(REG_RCX,0);
-		RspOffsetSchedule2=obp-sizeof(long);
+		pRspOffsetPertialSchedule2 = compiler.codeGenerator.op_add_RV(REG_RCX,0, Schedule::None, true );
 
 		//call _DebugSys_StartProc
@@ -713,5 +635,5 @@
 	BOOST_FOREACH( const PertialSchedule *pPertialSchedule, compiler.codeGenerator.localVarPertialSchedules )
 	{
-		compiler.codeGenerator.opfix_offset( pPertialSchedule, AllLocalVarSize );
+		compiler.codeGenerator.opfix_offset( pPertialSchedule, AllLocalVarSize + stackFrameSize );
 	}
 	compiler.codeGenerator.localVarPertialSchedules.clear();
@@ -742,12 +664,12 @@
 
 	//デバッグ用
-	if(RspOffsetSchedule){
-		*((long *)(OpBuffer+RspOffsetSchedule))=stackFrameAndLocalParamSize;
-		*((long *)(OpBuffer+RspOffsetSchedule2))=stackFrameAndLocalParamSize+sizeof(_int64);
+	if( pRspOffsetPertialSchedule1 ){
+		compiler.codeGenerator.opfix( pRspOffsetPertialSchedule1, stackFrameAndLocalParamSize );
+		compiler.codeGenerator.opfix( pRspOffsetPertialSchedule2, stackFrameAndLocalParamSize + sizeof(_int64) );
 	}
 
 
 	//スタックフレームスケジュール（subコマンド）
-	*((long *)(OpBuffer+StackFrameSchedule))=stackFrameAndLocalParamSize;
+	compiler.codeGenerator.opfix( pStackFramePertialSchedule, stackFrameAndLocalParamSize );
 
 	//スタックフレームスケジュールを実行
