Index: trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp
===================================================================
--- trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp	(revision 252)
+++ trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp	(revision 253)
@@ -236,5 +236,5 @@
 	extern HANDLE hHeap;
 	extern BOOL bDebugCompile;
-	int i3,i4,LocalVarSchedule,BaseOffset;
+	int i3,i4,BaseOffset;
 	char temporary[VN_SIZE];
 
@@ -263,4 +263,5 @@
 	else bDebugSupportProc=0;
 
+	extern int obp;
 	pUserProc->SetBeginOpAddress( obp );
 
@@ -306,10 +307,4 @@
 	extern int AllLocalVarSize;
 	AllLocalVarSize=0;
-
-	//ローカル変数アドレススケジュール
-	extern DWORD *pLocalVarAddrSchedule;
-	extern int LocalVarAddrScheduleNum;
-	pLocalVarAddrSchedule=(DWORD *)HeapAlloc(hHeap,0,1);
-	LocalVarAddrScheduleNum=0;
 
 	//パラメータ用の変数データを考慮
@@ -362,6 +357,5 @@
 
 	//sub esp,AllLocalVarSize（スケジュール）
-	compiler.codeGenerator.op_sub_esp(0xFFFFFFFF);
-	LocalVarSchedule=obp-sizeof(long);
+	const PertialSchedule *pAllLocalVarPertialSchedule = compiler.codeGenerator.op_sub_esp( 0, true );
 
 	//push ebp
@@ -641,17 +635,26 @@
 		{
 			//fld qword ptr[ebp+offset]
-			compiler.codeGenerator.op_fld_base_offset( i3, REG_EBP, RelativeVar.offset, Schedule::LocalVar );
+			compiler.codeGenerator.localVarPertialSchedules.push_back(
+				compiler.codeGenerator.op_fld_base_offset( i3, REG_EBP, RelativeVar.offset, Schedule::None, true )
+			);
 		}
 		else if(i3==DEF_INT64||i3==DEF_QWORD){
 			//mov eax,dword ptr[ebp+offset]
-			compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::LocalVar );
+			compiler.codeGenerator.localVarPertialSchedules.push_back(
+				compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::None, true )
+			);
 
 			//mov edx,dword ptr[ebp+offset+sizeof(long)]
-			compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EBP, RelativeVar.offset+sizeof(long), MOD_BASE_DISP32, Schedule::LocalVar );
+			compiler.codeGenerator.localVarPertialSchedules.push_back(
+				compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EBP, RelativeVar.offset+sizeof(long), MOD_BASE_DISP32, Schedule::None, true )
+			);
 		}
 		else if(i3==DEF_LONG||i3==DEF_DWORD||
-			IsPtrType(i3)){
+			IsPtrType(i3))
+		{
 			//mov eax,dword ptr[ebp+offset]
-			compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::LocalVar );
+			compiler.codeGenerator.localVarPertialSchedules.push_back(
+				compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::None, true )
+			);
 		}
 		else if(i3==DEF_INTEGER||i3==DEF_WORD || (Smoothie::IsUnicode()&&i3==DEF_CHAR)){
@@ -660,5 +663,7 @@
 
 			//mov ax,word ptr[ebp+offset]
-			compiler.codeGenerator.op_mov_RM( sizeof(short), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::LocalVar );
+			compiler.codeGenerator.localVarPertialSchedules.push_back(
+				compiler.codeGenerator.op_mov_RM( sizeof(short), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::None, true )
+			);
 		}
 		else if(i3==DEF_SBYTE||i3==DEF_BYTE||i3==DEF_BOOLEAN || (Smoothie::IsUnicode()==false&&i3==DEF_CHAR)){
@@ -667,13 +672,16 @@
 
 			//mov al,byte ptr[ebp+offset]
-			compiler.codeGenerator.op_mov_RM( sizeof(char), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::LocalVar );
+			compiler.codeGenerator.localVarPertialSchedules.push_back(
+				compiler.codeGenerator.op_mov_RM( sizeof(char), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::None, true )
+			);
 		}
 	}
 
 	//ローカル変数アドレススケジュール
-	for(i3=0;i3<LocalVarAddrScheduleNum;i3++){
-		*((long *)(OpBuffer+pLocalVarAddrSchedule[i3]))+=AllLocalVarSize;
-	}
-	HeapDefaultFree(pLocalVarAddrSchedule);
+	BOOST_FOREACH( const PertialSchedule *pPertialSchedule, compiler.codeGenerator.localVarPertialSchedules )
+	{
+		compiler.codeGenerator.opfix_offset( pPertialSchedule, AllLocalVarSize );
+	}
+	compiler.codeGenerator.localVarPertialSchedules.clear();
 	BOOST_FOREACH( Variable *pVar, pUserProc->GetLocalVars() ){
 		//後にデバッグで利用する
@@ -685,5 +693,5 @@
 
 	//ローカル変数用メモリを確保するためのスケジュール（subコマンド）
-	*((long *)(OpBuffer+LocalVarSchedule))=AllLocalVarSize-BaseOffset;
+	compiler.codeGenerator.opfix( pAllLocalVarPertialSchedule, AllLocalVarSize - BaseOffset );
 
 	//pop edi
