Changeset 235 in dev for trunk/abdev/BasicCompiler32/Compile_Object.cpp
- Timestamp:
- Jul 25, 2007, 11:54:20 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/Compile_Object.cpp
r225 r235 84 84 85 85 //add eax,TypeSize 86 OpBuffer[obp++]=(char)0x05; 87 *((long *)(OpBuffer+obp))=ObjectSize; 88 obp+=sizeof(long); 86 compiler.codeGenerator.op_add_RV( REG_EAX, ObjectSize ); 89 87 90 88 //sub ebx,1 … … 119 117 120 118 //※添え字上限値であることを考慮 121 //add eax,1 122 OpBuffer[obp++]=(char)0x83; 123 OpBuffer[obp++]=(char)0xC0; 124 OpBuffer[obp++]=(char)0x01; 119 //inc eax 120 compiler.codeGenerator.op_inc( REG_EAX ); 125 121 126 122 //オブジェクトの個数をebxに一時保持 127 123 //※ebxは関数が呼ばれても不変 128 124 //mov ebx,eax 129 OpBuffer[obp++]=(char)0x8B; 130 OpBuffer[obp++]=(char)0xD8; 125 compiler.codeGenerator.op_mov_RR( REG_EBX, REG_EAX ); 131 126 132 127 //imul eax,size 133 OpBuffer[obp++]=(char)0x69; 134 OpBuffer[obp++]=(char)0xC0; 135 *((long *)(OpBuffer+obp))=typeSize; 136 obp+=sizeof(long); 128 compiler.codeGenerator.op_imul_RV( REG_EAX, typeSize ); 137 129 138 130 //add eax,OBJECT_HEAD_SIZE 139 OpBuffer[obp++]=(char)0x05; 140 *((long *)(OpBuffer+obp))=OBJECT_HEAD_SIZE; 141 obp+=sizeof(long); 131 compiler.codeGenerator.op_add_RV8( REG_EAX, (char)OBJECT_HEAD_SIZE ); 142 132 143 133 //push eax … … 148 138 //※ebxは関数が呼ばれても不変 149 139 //mov ebx,1 150 OpBuffer[obp++]=(char)0xBB; 151 *((long *)(OpBuffer+obp))=1; 152 obp+=sizeof(long); 140 compiler.codeGenerator.op_mov_RV( REG_EBX, 1 ); 153 141 154 142 //push size + OBJECT_HEAD_SIZE 155 OpBuffer[obp++]=(char)0x68; 156 *((long *)(OpBuffer+obp))=typeSize + OBJECT_HEAD_SIZE; 157 obp+=sizeof(long); 143 compiler.codeGenerator.op_push_V( typeSize + OBJECT_HEAD_SIZE ); 158 144 } 159 145 … … 188 174 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EBX, REG_EAX, 0, MOD_BASE ); 189 175 190 //add eax,sizeof(DWORD) 191 OpBuffer[obp++]=(char)0x05; 192 *((long *)(OpBuffer+obp))=sizeof(DWORD); 193 obp+=sizeof(long); 194 176 //add eax,sizeof(long) 177 compiler.codeGenerator.op_add_RV8( REG_EAX, sizeof(long) ); 195 178 196 179 //mov ecx,TypeSize 197 OpBuffer[obp++]=(char)0xB9; 198 *((long *)(OpBuffer+obp))=typeSize; 199 obp+=sizeof(long); 180 compiler.codeGenerator.op_mov_RV( REG_ECX, typeSize ); 200 181 201 182 //mov dword ptr[eax],ecx(オブジェクトのサイズ) 202 183 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_ECX, REG_EAX, 0, MOD_BASE ); 203 184 204 //add eax,sizeof(DWORD) 205 OpBuffer[obp++]=(char)0x05; 206 *((long *)(OpBuffer+obp))=sizeof(DWORD); 207 obp+=sizeof(long); 185 //add eax,sizeof(long) 186 compiler.codeGenerator.op_add_RV8( REG_EAX, sizeof(long) ); 208 187 209 188 … … 220 199 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_ECX, REG_EAX, 0, MOD_BASE ); 221 200 222 //add eax,sizeof(DWORD) 223 OpBuffer[obp++]=(char)0x05; 224 *((long *)(OpBuffer+obp))=sizeof(DWORD); 225 obp+=sizeof(long); 201 //add eax,sizeof(long) 202 compiler.codeGenerator.op_add_RV8( REG_EAX, sizeof(long) ); 226 203 227 204 228 205 // リザーブ領域 229 //add eax,sizeof(DWORD) 230 OpBuffer[obp++]=(char)0x05; 231 *((long *)(OpBuffer+obp))=sizeof(DWORD); 232 obp+=sizeof(long); 206 //add eax,sizeof(long) 207 compiler.codeGenerator.op_add_RV8( REG_EAX, sizeof(long) ); 233 208 234 209 … … 264 239 265 240 //mov ebx,dword ptr[eax](オブジェクトの個数) 266 OpBuffer[obp++]=(char)0x8B; 267 OpBuffer[obp++]=(char)0x18; 268 269 //add eax,sizeof(DWORD) 270 OpBuffer[obp++]=(char)0x05; 271 *((long *)(OpBuffer+obp))=sizeof(DWORD); 272 obp+=sizeof(long); 241 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EBX, REG_EAX, 0, MOD_BASE ); 242 243 //add eax,sizeof(long) 244 compiler.codeGenerator.op_add_RV8( REG_EAX, sizeof(long) ); 273 245 274 246 275 247 //mov esi,dword ptr[eax](オブジェクトのサイズ) 276 OpBuffer[obp++]=(char)0x8B; 277 OpBuffer[obp++]=(char)0x30; 278 279 //add eax,sizeof(DWORD) 280 OpBuffer[obp++]=(char)0x05; 281 *((long *)(OpBuffer+obp))=sizeof(DWORD); 282 obp+=sizeof(long); 248 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_ESI, REG_EAX, 0, MOD_BASE ); 249 250 //add eax,sizeof(long) 251 compiler.codeGenerator.op_add_RV8( REG_EAX, sizeof(long) ); 283 252 284 253 285 254 //mov edx,dword ptr[eax](デストラクタの関数ポインタ) 286 OpBuffer[obp++]=(char)0x8B; 287 OpBuffer[obp++]=(char)0x10; 288 289 //add eax,sizeof(DWORD) 290 OpBuffer[obp++]=(char)0x05; 291 *((long *)(OpBuffer+obp))=sizeof(DWORD); 292 obp+=sizeof(long); 255 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EAX, 0, MOD_BASE ); 256 257 //add eax,sizeof(long) 258 compiler.codeGenerator.op_add_RV8( REG_EAX, sizeof(long) ); 293 259 294 260 295 261 // リザーブ領域 296 //add eax,sizeof(DWORD) 297 OpBuffer[obp++]=(char)0x05; 298 *((long *)(OpBuffer+obp))=sizeof(DWORD); 299 obp+=sizeof(long); 262 //add eax,sizeof(long) 263 compiler.codeGenerator.op_add_RV8( REG_EAX, sizeof(long) ); 300 264 301 265 302 266 //mov ecx,eax 303 OpBuffer[obp++]=(char)0x8B; 304 OpBuffer[obp++]=(char)0xC8; 267 compiler.codeGenerator.op_mov_RR( REG_ECX, REG_EAX ); 305 268 306 269 … … 319 282 320 283 //call edx 321 OpBuffer[obp++]=(char)0xFF; 322 OpBuffer[obp++]=(char)0xD2; 284 compiler.codeGenerator.op_call_R( REG_EDX ); 323 285 324 286 //pop edx
Note:
See TracChangeset
for help on using the changeset viewer.