Changeset 436 in dev for trunk/abdev/BasicCompiler32
- Timestamp:
- Mar 15, 2008, 3:33:36 PM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler32
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/CParameter.cpp
r435 r436 65 65 //変数ではないとき 66 66 Type calcType; 67 BOOL bUseHeap;68 NumOpe( Parms[i2], dummyType, calcType, & bUseHeap);67 bool isNeedHeapFreeStructure; 68 NumOpe( Parms[i2], dummyType, calcType, &isNeedHeapFreeStructure ); 69 69 //↑ここでスタックに積む 70 70 … … 86 86 i2); 87 87 88 if( result && bUseHeap ){ 88 if( result ) 89 { 89 90 useTempParameters[i2] = true; 91 isNeedFreeStructures[i2] = true; 90 92 useTempObject = true; 91 93 … … 107 109 for(int i2=ParmsNum-1;i2>=0;i2--){ 108 110 if( useTempParameters[i2] ){ 109 if( types[i2].IsStruct() ){ 111 if( types[i2].IsStruct() ) 112 { 110 113 // 構造体の一時メモリ 111 114 112 //メモリを解放する 113 114 //call free 115 extern const UserProc *pSub_free; 116 compiler.codeGenerator.op_call(pSub_free); 117 } 118 else{ 119 if( types[i2].Is64() ){ 115 if( isNeedFreeStructures[i2] ) 116 { 117 //メモリを解放する 118 119 //call free 120 extern const UserProc *pSub_free; 121 compiler.codeGenerator.op_call(pSub_free); 122 } 123 else 124 { 125 //pop ... 参照を消す 126 compiler.codeGenerator.op_add_esp( PTR_SIZE ); 127 } 128 } 129 else 130 { 131 if( types[i2].Is64() ) 132 { 120 133 //pop ... 参照を消す 121 134 //pop ... 上位32ビット … … 123 136 compiler.codeGenerator.op_add_esp( PTR_SIZE * 3 ); 124 137 } 125 else{ 138 else 139 { 126 140 //pop ... 参照を消す 127 141 //pop ... 値を消す … … 150 164 151 165 Type calcType; 152 BOOL bUseHeap;166 bool isNeedHeapFreeStructure; 153 167 NumOpe( expression, 154 168 baseType, 155 169 calcType, 156 & bUseHeap);170 &isNeedHeapFreeStructure ); 157 171 158 172 // ※スタックにある二つのデータ(コピー先、コピー元)の値を必要とする 159 SetStructVariable( baseType, calcType, bUseHeap);173 SetStructVariable( baseType, calcType, isNeedHeapFreeStructure ); 160 174 } 161 175 … … 234 248 } 235 249 236 BOOL bCalcUseHeap;237 250 Type calcType; 238 if( !NumOpe( Parms[i2], dummyType, calcType, &bCalcUseHeap ) ){ 251 bool isNeedHeapFreeStructure; 252 if( !NumOpe( Parms[i2], dummyType, calcType, &isNeedHeapFreeStructure ) ) 253 { 239 254 break; 240 255 } 241 256 242 if( calcType.IsObject() ){ 257 if( calcType.IsObject() ) 258 { 243 259 if( !dummyType.IsObject() 244 260 || 245 261 dummyType.IsObject() && 246 !dummyType.GetClass().IsEqualsOrSubClass( &calcType.GetClass() ) ){ 262 !dummyType.GetClass().IsEqualsOrSubClass( &calcType.GetClass() ) ) 263 { 247 264 //キャスト演算子のオーバーロードに対応する 248 CallCastOperatorProc( calcType, bCalcUseHeap,dummyType );265 CallCastOperatorProc( calcType, isNeedHeapFreeStructure,dummyType ); 249 266 } 250 267 } -
trunk/abdev/BasicCompiler32/Compile_Calc.cpp
r435 r436 573 573 574 574 //NumOpe...(スタックに答えが格納される) 575 BOOL bCalcUseHeap;576 575 Type calcType; 577 if( !NumOpe(Command+i+1,varType,calcType,&bCalcUseHeap) ){ 576 bool isNeedHeapFreeStructure; 577 if( !NumOpe(Command+i+1,varType,calcType,&isNeedHeapFreeStructure) ){ 578 578 return; 579 579 } … … 588 588 if( !isUpCast ){ 589 589 //キャスト演算子のオーバーロードに対応する 590 CallCastOperatorProc(calcType, bCalcUseHeap,varType);590 CallCastOperatorProc(calcType,isNeedHeapFreeStructure,varType); 591 591 } 592 592 } … … 606 606 if( varType.IsStruct() ){ 607 607 //構造体インスタンスへの代入 608 SetStructVariable(varType,calcType, bCalcUseHeap);608 SetStructVariable(varType,calcType,isNeedHeapFreeStructure); 609 609 return; 610 610 } -
trunk/abdev/BasicCompiler32/Compile_Var.cpp
r424 r436 116 116 for(i=i3-1;i>=0;i--){ 117 117 Type tempType; 118 BOOL bUseHeap; 119 NumOpe( pParm[i], Type( DEF_LONG ), tempType, &bUseHeap ); 120 if( tempType.IsObject() ){ 118 bool isNeedHeapFreeStructure; 119 NumOpe( pParm[i], Type( DEF_LONG ), tempType, &isNeedHeapFreeStructure ); 120 if( tempType.IsObject() ) 121 { 121 122 //キャスト演算子のオーバーロードに対応する 122 123 CallCastOperatorProc( 123 124 tempType, 124 bUseHeap, Type(DEF_LONG) );125 isNeedHeapFreeStructure, Type(DEF_LONG) ); 125 126 tempType.SetBasicType( DEF_LONG ); 126 127 } … … 130 131 compiler.codeGenerator.op_pop(REG_EAX); 131 132 132 for(i2=i+1,i4=1;i2<i3;i2++) i4*=subscripts[i2]+1; 133 for( i2=i+1, i4=1; i2<i3; i2++ ) 134 { 135 i4*=subscripts[i2]+1; 136 } 133 137 134 138 //imul eax,i4 -
trunk/abdev/BasicCompiler32/NumOpe.cpp
r435 r436 671 671 const Type &baseType, 672 672 Type &resultType, 673 BOOL *pbUseHeap ){ 674 675 if( !NumOpe( expression, baseType, resultType, pbUseHeap ) ){ 673 bool *pbIsNeedHeapFreeStructure ){ 674 675 if( !NumOpe( expression, baseType, resultType, pbIsNeedHeapFreeStructure ) ) 676 { 676 677 return false; 677 678 } … … 703 704 const Type &baseType, 704 705 Type &resultType, 705 BOOL *pbUseHeap)706 bool *pbIsNeedHeapFreeStructure ) 706 707 { 707 708 int i,i2,i3; … … 1274 1275 } 1275 1276 1276 if(pbUseHeap) *pbUseHeap = isNeedHeapFreeStructureStack[0]; 1277 if(pbIsNeedHeapFreeStructure) 1278 { 1279 *pbIsNeedHeapFreeStructure = isNeedHeapFreeStructureStack[0]; 1280 } 1277 1281 1278 1282 resultType.SetType( type_stack[0], index_stack[0] ); -
trunk/abdev/BasicCompiler32/Opcode.h
r435 r436 73 73 const Type &baseType, 74 74 Type &resultType, 75 BOOL *pbUseHeap= NULL );75 bool *pbIsNeedHeapFreeStructure = NULL ); 76 76 bool NumOpe( const char *Command, 77 77 const Type &baseType, 78 78 Type &resultType, 79 BOOL *pbUseHeap= NULL );79 bool *pbIsNeedHeapFreeStructure = NULL ); 80 80 81 81 //NumOpe_Arithmetic.cpp … … 177 177 bool useTempObject; 178 178 bool useTempParameters[255]; 179 bool isNeedFreeStructures[255]; 179 180 int nCountOfTempObjects; 180 181
Note:
See TracChangeset
for help on using the changeset viewer.