- Timestamp:
- Mar 6, 2008, 11:28:05 PM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler64
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler64/Compile_Calc.cpp
r402 r416 177 177 178 178 //型を識別 179 if( !Get VarType(variable,varType,false) ){179 if( !GetTermTypeOnlyVariable(variable,varType) ){ 180 180 181 181 // プロパティ用のメソッドを呼び出す … … 205 205 206 206 //変数アドレスを取得 207 RELATIVE_VAR VarRelativeVar;208 bool result = GetVarOffsetReadWrite(209 variable,210 &VarRelativeVar,211 varType);207 if( !TermOpeOnlyVariable( variable, varType, VarRelativeVar, true ) ) 208 { 209 SetError(); 210 return; 211 } 212 212 213 213 //レジスタのブロッキングを解除 -
trunk/abdev/BasicCompiler64/Compile_CallProc.cpp
r370 r416 128 128 //"->"によってオブジェクトを指定する通常のメンバ関数呼び出し 129 129 Type varType; 130 GetVarType( ObjectName, varType, false ); 131 if( NATURAL_TYPE( varType.GetBasicType() ) == DEF_OBJECT ) 130 if( GetTermType( ObjectName, varType ) ) 132 131 { 133 pobj_c = &varType.GetClass(); 134 leftType = varType; 132 if( varType.IsObject() ) 133 { 134 pobj_c = &varType.GetClass(); 135 leftType = varType; 136 } 135 137 } 136 else 138 139 if( !pobj_c ) 137 140 { 138 141 pobj_c=compiler.GetObjectModule().meta.GetClasses().Find(ObjectName); … … 319 322 if(lstrcmpi(ObjectName,"Super")==0) goto InClassMember; 320 323 else{ 321 RELATIVE_VAR RelativeVar; 322 if( pMethod->IsConst() ){ 323 //Constアクセスが可能なメソッドの場合 324 if( !GetVarOffsetReadOnly( ObjectName, &RelativeVar, Type() ) ){ 325 return false; 326 } 324 bool isLiteral; 325 if( !TermOpe( ObjectName, Type(), Type(), isLiteral, NULL, NULL, false, !pMethod->IsConst() ) ) 326 { 327 return false; 327 328 } 328 else{ 329 //Constアクセスが不可能なメソッドの場合 330 if( !GetVarOffsetReadWrite( ObjectName, &RelativeVar, Type() ) ){ 331 return false; 332 } 333 } 334 335 SetVarPtrToReg(REG_RCX,&RelativeVar); 336 337 // 参照を実体ポインタにする 338 //mov rcx,qword ptr[rcx] 339 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RCX,REG_RCX,0,MOD_BASE); 329 330 // 実態ポインタをraxにコピー 331 compiler.codeGenerator.op_mov_RR( REG_RCX, REG_RAX ); 340 332 } 341 333 } -
trunk/abdev/BasicCompiler64/Compile_Statement.cpp
r408 r416 97 97 bool isLiteral; 98 98 BOOL bUseHeap; 99 bool result = TermOpe( leftTerm, Type(), resultType, isLiteral, &bUseHeap, false,NULL, true );99 bool result = TermOpe( leftTerm, Type(), resultType, isLiteral, &bUseHeap, NULL, true ); 100 100 101 101 delete pobj_reg; -
trunk/abdev/BasicCompiler64/MakePeHdr.cpp
r407 r416 1647 1647 //リロケーション情報を解放 1648 1648 delete pobj_Reloc; 1649 1650 //クラスに関するメモリを解放1651 compiler.GetObjectModule().meta.GetClasses().Clear();1652 1649 } -
trunk/abdev/BasicCompiler64/NumOpe.cpp
r413 r416 130 130 return true; 131 131 } 132 bool TermMemberOpe( const Type &leftType, const Type &baseType, Type &resultType, const char *termFull, const char *termLeft, const char *member )132 bool TermMemberOpe( const Type &leftType, const Type &baseType, Type &resultType, const char *termFull, const char *termLeft, const char *member, bool &isVariable, RELATIVE_VAR &relativeVar ) 133 133 { 134 134 const CClass &objClass = leftType.GetClass(); … … 166 166 compiler.codeGenerator.op_mov_RR( REG_R11, useReg ); 167 167 168 RELATIVE_VAR relativeVar;169 relativeVar.dwKind=VAR_DIRECTMEM;168 RELATIVE_VAR tempRelativeVar; 169 tempRelativeVar.dwKind=VAR_DIRECTMEM; 170 170 171 171 if( !_member_offset( … … 173 173 false, //読み込み専用 174 174 leftType, 175 VarName,&relativeVar,classType,0)) 176 { 177 return false; 175 VarName,&tempRelativeVar,classType,0)){ 176 return false; 178 177 } 179 178 180 179 // オブジェクトメンバのポインタをraxにコピー 181 if( !VarToReg( relativeVar, baseType, resultType ) ){180 if( !VarToReg( tempRelativeVar, baseType, resultType ) ){ 182 181 SetError(11,termFull,cp); 183 182 } … … 222 221 compiler.codeGenerator.op_mov_RR( REG_R11, useReg ); 223 222 224 RELATIVE_VAR relativeVar;225 223 relativeVar.dwKind=VAR_DIRECTMEM; 226 224 … … 233 231 } 234 232 235 if( !VarToReg( relativeVar, baseType, resultType ) ){ 236 SetError(11,termFull,cp); 237 } 233 // 変数として扱う 234 isVariable = true; 238 235 239 236 return true; … … 268 265 269 266 // まずはプロパティ値を取得 270 TermMemberOpe( leftType, baseType, resultType, termFull, termLeft, methodName ); 267 bool dummyIsVariable; 268 RELATIVE_VAR dummyRelativeVar; 269 TermMemberOpe( leftType, baseType, resultType, termFull, termLeft, methodName, dummyIsVariable, dummyRelativeVar ); 271 270 272 271 // 戻り値のオブジェクトインスタンスのインデクサを呼び出す … … 275 274 sprintf( temp2, "%s.%s", termLeft, methodName ); 276 275 Type classType = resultType; 277 return TermMemberOpe( classType, baseType, resultType, termFull, temp2, temporary );276 return TermMemberOpe( classType, baseType, resultType, termFull, temp2, temporary, isVariable, relativeVar ); 278 277 } 279 278 … … 333 332 return false; 334 333 } 335 bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool isWantObject, bool *pIsClassName, bool isProcedureCallOnly ){ 334 bool _TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool *pIsClassName, bool isProcedureCallOnly, bool &isVariable, RELATIVE_VAR &relativeVar, bool isWriteAccess ) 335 { 336 336 char parameter[VN_SIZE]; 337 337 … … 373 373 } 374 374 375 if( !TermOpe( termLeft, baseType, leftType, isLiteral, pbUseHeap, true,&isClassName ) ){375 if( !TermOpe( termLeft, baseType, leftType, isLiteral, pbUseHeap, &isClassName ) ){ 376 376 goto globalArea; 377 377 } … … 391 391 } 392 392 393 return TermMemberOpe( leftType, baseType, resultType, termFull, termLeft, member );393 return TermMemberOpe( leftType, baseType, resultType, termFull, termLeft, member, isVariable, relativeVar ); 394 394 } 395 395 globalArea: … … 554 554 //////////////////////////////// 555 555 556 RELATIVE_VAR relativeVar;557 556 if(GetVarOffset( 558 557 false, //エラー表示なし 559 false, //読み込み専用558 isWriteAccess, 560 559 termFull, 561 560 &relativeVar,resultType)){ … … 564 563 ////////// 565 564 566 if( !VarToReg( relativeVar, baseType, resultType ) ){ 567 SetError(11,termFull,cp); 568 } 565 // 変数として扱う 566 isVariable = true; 569 567 570 568 isLiteral = false; … … 637 635 return false; 638 636 } 637 638 bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool *pIsClassName, bool isProcedureCallOnly, bool isWriteAccess ) 639 { 640 RELATIVE_VAR relativeVar; 641 bool isVariable = false; 642 bool result = _TermOpe( term, baseType, resultType, isLiteral, pbUseHeap, pIsClassName, isProcedureCallOnly, isVariable, relativeVar, isWriteAccess ); 643 644 if( isVariable ) 645 { 646 // 変数の場合はeaxに変数ポインタを格納する 647 if( !VarToReg( relativeVar, baseType, resultType ) ){ 648 SetError(11,term,cp); 649 } 650 } 651 652 return result; 653 } 654 bool TermOpeOnlyVariable( const char *term, Type &resultType, RELATIVE_VAR &relativeVar, bool isWriteAccess ) 655 { 656 bool isLiteral, isVariable = false; 657 bool result = _TermOpe( term, Type(), resultType, isLiteral, NULL, NULL, false, isVariable, relativeVar, isWriteAccess ); 658 659 if( !isVariable ) 660 { 661 SetError(); 662 } 663 664 return result; 665 } 666 639 667 640 668 bool _numope( int *pReg, -
trunk/abdev/BasicCompiler64/Opcode.h
r372 r416 185 185 186 186 //NumOpe.cpp 187 bool TermOpeOnlyVariable( const char *term, Type &resultType, RELATIVE_VAR &relativeVar, bool isWriteAccess ); 187 188 bool TermOpe( 188 189 const char *term, … … 191 192 bool &isLiteral, 192 193 BOOL *pbUseHeap, 193 bool isWantObject = false,194 194 bool *pIsClassName = NULL, 195 bool isProcedureCallOnly = false ); 195 bool isProcedureCallOnly = false, 196 bool isWriteAccess = false ); 196 197 bool NumOpe( int *pReg, 197 198 const char *Command,
Note:
See TracChangeset
for help on using the changeset viewer.