Changeset 245 in dev for trunk/abdev/BasicCompiler_Common
- Timestamp:
- Jul 27, 2007, 8:02:22 PM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler_Common
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/include/CodeGenerator.h
r244 r245 52 52 53 53 private: 54 55 54 // 部分スケジュールの管理 56 typedef std::vector< PertialSchedule *> PertialSchedules;55 typedef std::vector<const PertialSchedule *> PertialSchedules; 57 56 PertialSchedules pertialSchedules; 58 57 … … 128 127 129 128 private: 130 PertialSchedule *__jmp_op_format( char opcode, long offset, int op_size, bool isPertialSchedule = false, bool isSelfOpcodeOffset = false );131 public: 132 PertialSchedule *op_jle( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );133 PertialSchedule *op_jbe( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );134 PertialSchedule *op_jge( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );135 PertialSchedule *op_jae( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );136 PertialSchedule *op_jl( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );137 PertialSchedule *op_jb( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );138 PertialSchedule *op_jg( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );139 PertialSchedule *op_ja( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );140 PertialSchedule *op_jne( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );141 PertialSchedule *op_je( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );142 PertialSchedule *op_jmp( long offset, int op_size = sizeof(char), bool isPertialSchedule = false, bool isSelfOpcodeOffset = false );129 const PertialSchedule *__jmp_op_format( char opcode, long offset, int op_size, bool isPertialSchedule = false, bool isSelfOpcodeOffset = false ); 130 public: 131 const PertialSchedule *op_jle( long offset, int op_size = sizeof(char), bool isPertialSchedule = false ); 132 const PertialSchedule *op_jbe( long offset, int op_size = sizeof(char), bool isPertialSchedule = false ); 133 const PertialSchedule *op_jge( long offset, int op_size = sizeof(char), bool isPertialSchedule = false ); 134 const PertialSchedule *op_jae( long offset, int op_size = sizeof(char), bool isPertialSchedule = false ); 135 const PertialSchedule *op_jl( long offset, int op_size = sizeof(char), bool isPertialSchedule = false ); 136 const PertialSchedule *op_jb( long offset, int op_size = sizeof(char), bool isPertialSchedule = false ); 137 const PertialSchedule *op_jg( long offset, int op_size = sizeof(char), bool isPertialSchedule = false ); 138 const PertialSchedule *op_ja( long offset, int op_size = sizeof(char), bool isPertialSchedule = false ); 139 const PertialSchedule *op_jne( long offset, int op_size = sizeof(char), bool isPertialSchedule = false ); 140 const PertialSchedule *op_je( long offset, int op_size = sizeof(char), bool isPertialSchedule = false ); 141 const PertialSchedule *op_jmp( long offset, int op_size = sizeof(char), bool isPertialSchedule = false, bool isSelfOpcodeOffset = false ); 143 142 void op_jmp_continue(); 144 143 -
trunk/abdev/BasicCompiler_Common/include/NativeCode.h
r244 r245 241 241 ObpPlus( sizeof(long) ); 242 242 } 243 void PutUserProcSchedule( const UserProc *pUserProc, bool isCall ) 244 { 245 Schedule schedule( pUserProc, size ); 246 if( isCall == false ) 247 { 248 schedule.SpecifyAddressOf(); 249 } 250 schedules.push_back( schedule ); 251 252 *((long *)(codeBuffer+size))=0; 253 size += sizeof(long); 254 255 256 257 // 未完成 258 if( isCall ) 259 { 260 pobj_SubAddrSchedule->add(pUserProc,1); 261 } 262 else 263 { 264 pobj_SubAddrSchedule->add(pUserProc,0); 265 } 266 extern char *OpBuffer; 267 extern int obp; 268 *((long *)(OpBuffer+obp))=0; 269 ObpPlus( sizeof(long) ); 270 } 243 void PutUserProcSchedule( const UserProc *pUserProc, bool isCall ); 271 244 void Put( short s ) 272 245 { -
trunk/abdev/BasicCompiler_Common/src/CommonCodeGenerator.cpp
r241 r245 53 53 } 54 54 55 pertialSchedules.erase( it );55 it = pertialSchedules.erase( it ); 56 56 delete pPertialSchedule; 57 57 … … 69 69 } 70 70 } 71 CodeGenerator::PertialSchedule *CodeGenerator::__jmp_op_format( char opcode, long offset, int op_size, bool isPertialSchedule, bool isSelfOpcodeOffset )71 const CodeGenerator::PertialSchedule *CodeGenerator::__jmp_op_format( char opcode, long offset, int op_size, bool isPertialSchedule, bool isSelfOpcodeOffset ) 72 72 { 73 73 long beginCodePos = pNativeCode->GetSize(); … … 111 111 } 112 112 113 PertialSchedule *pPertialSchedule = NULL;113 const PertialSchedule *pPertialSchedule = NULL; 114 114 if( isPertialSchedule ) 115 115 { … … 143 143 return pPertialSchedule; 144 144 } 145 CodeGenerator::PertialSchedule *CodeGenerator::op_jle( long offset, int op_size, bool isPertialSchedule )145 const CodeGenerator::PertialSchedule *CodeGenerator::op_jle( long offset, int op_size, bool isPertialSchedule ) 146 146 { 147 147 return __jmp_op_format( (char)0x0E, offset, op_size, isPertialSchedule ); 148 148 } 149 CodeGenerator::PertialSchedule *CodeGenerator::op_jbe( long offset, int op_size, bool isPertialSchedule )149 const CodeGenerator::PertialSchedule *CodeGenerator::op_jbe( long offset, int op_size, bool isPertialSchedule ) 150 150 { 151 151 return __jmp_op_format( (char)0x06, offset, op_size, isPertialSchedule ); 152 152 } 153 CodeGenerator::PertialSchedule *CodeGenerator::op_jge( long offset, int op_size, bool isPertialSchedule )153 const CodeGenerator::PertialSchedule *CodeGenerator::op_jge( long offset, int op_size, bool isPertialSchedule ) 154 154 { 155 155 return __jmp_op_format( (char)0x0D, offset, op_size, isPertialSchedule ); 156 156 } 157 CodeGenerator::PertialSchedule *CodeGenerator::op_jae( long offset, int op_size, bool isPertialSchedule )157 const CodeGenerator::PertialSchedule *CodeGenerator::op_jae( long offset, int op_size, bool isPertialSchedule ) 158 158 { 159 159 return __jmp_op_format( (char)0x03, offset, op_size, isPertialSchedule ); 160 160 } 161 CodeGenerator::PertialSchedule *CodeGenerator::op_jl( long offset, int op_size, bool isPertialSchedule )161 const CodeGenerator::PertialSchedule *CodeGenerator::op_jl( long offset, int op_size, bool isPertialSchedule ) 162 162 { 163 163 return __jmp_op_format( (char)0x0C, offset, op_size, isPertialSchedule ); 164 164 } 165 CodeGenerator::PertialSchedule *CodeGenerator::op_jb( long offset, int op_size, bool isPertialSchedule )165 const CodeGenerator::PertialSchedule *CodeGenerator::op_jb( long offset, int op_size, bool isPertialSchedule ) 166 166 { 167 167 return __jmp_op_format( (char)0x02, offset, op_size, isPertialSchedule ); 168 168 } 169 CodeGenerator::PertialSchedule *CodeGenerator::op_jg( long offset, int op_size, bool isPertialSchedule )169 const CodeGenerator::PertialSchedule *CodeGenerator::op_jg( long offset, int op_size, bool isPertialSchedule ) 170 170 { 171 171 return __jmp_op_format( (char)0x0F, offset, op_size, isPertialSchedule ); 172 172 } 173 CodeGenerator::PertialSchedule *CodeGenerator::op_ja( long offset, int op_size, bool isPertialSchedule )173 const CodeGenerator::PertialSchedule *CodeGenerator::op_ja( long offset, int op_size, bool isPertialSchedule ) 174 174 { 175 175 return __jmp_op_format( (char)0x07, offset, op_size, isPertialSchedule ); 176 176 } 177 CodeGenerator::PertialSchedule *CodeGenerator::op_jne( long offset, int op_size, bool isPertialSchedule )177 const CodeGenerator::PertialSchedule *CodeGenerator::op_jne( long offset, int op_size, bool isPertialSchedule ) 178 178 { 179 179 return __jmp_op_format( (char)0x05, offset, op_size, isPertialSchedule ); 180 180 } 181 CodeGenerator::PertialSchedule *CodeGenerator::op_je( long offset, int op_size, bool isPertialSchedule )181 const CodeGenerator::PertialSchedule *CodeGenerator::op_je( long offset, int op_size, bool isPertialSchedule ) 182 182 { 183 183 return __jmp_op_format( (char)0x04, offset, op_size, isPertialSchedule ); 184 184 } 185 CodeGenerator::PertialSchedule *CodeGenerator::op_jmp( long offset, int op_size, bool isPertialSchedule, bool isSelfOpcodeOffset )185 const CodeGenerator::PertialSchedule *CodeGenerator::op_jmp( long offset, int op_size, bool isPertialSchedule, bool isSelfOpcodeOffset ) 186 186 { 187 187 return __jmp_op_format( (char)0xEB, offset, op_size, isPertialSchedule, isSelfOpcodeOffset ); -
trunk/abdev/BasicCompiler_Common/src/NativeCode.cpp
r237 r245 1 1 #include "stdafx.h" 2 3 #include <NativeCode.h> 4 #include <Procedure.h> 2 5 3 6 #define BREAK_EIP(checkEip) (obp+0x00401000>=checkEip) … … 14 17 } 15 18 } 19 20 void NativeCode::PutUserProcSchedule( const UserProc *pUserProc, bool isCall ) 21 { 22 pUserProc->Using(); 23 24 Schedule schedule( pUserProc, size ); 25 if( isCall == false ) 26 { 27 schedule.SpecifyAddressOf(); 28 } 29 schedules.push_back( schedule ); 30 31 *((long *)(codeBuffer+size))=0; 32 size += sizeof(long); 33 34 35 36 // 未完成 37 if( isCall ) 38 { 39 pobj_SubAddrSchedule->add(pUserProc,1); 40 } 41 else 42 { 43 pobj_SubAddrSchedule->add(pUserProc,0); 44 } 45 extern char *OpBuffer; 46 extern int obp; 47 *((long *)(OpBuffer+obp))=0; 48 ObpPlus( sizeof(long) ); 49 }
Note:
See TracChangeset
for help on using the changeset viewer.