Changeset 206 in dev for trunk/abdev/BasicCompiler64
- Timestamp:
- Jul 12, 2007, 2:58:26 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler64
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler64/BasicCompiler.vcproj
r198 r206 55 55 RuntimeLibrary="1" 56 56 RuntimeTypeInfo="true" 57 UsePrecompiledHeader=" 0"57 UsePrecompiledHeader="2" 58 58 PrecompiledHeaderFile=".\Debug/BasicCompiler.pch" 59 59 AssemblerListingLocation=".\Debug/" … … 167 167 RuntimeLibrary="1" 168 168 RuntimeTypeInfo="true" 169 UsePrecompiledHeader=" 0"169 UsePrecompiledHeader="2" 170 170 PrecompiledHeaderFile=".\Release/BasicCompiler.pch" 171 171 AssemblerListingLocation=".\Release/" … … 246 246 </File> 247 247 <File 248 RelativePath="..\BasicCompiler_Common\BasicFixed.h"249 >250 </File>251 <File252 248 RelativePath="CommandValue.h" 253 249 > … … 263 259 <File 264 260 RelativePath="..\BasicCompiler_Common\include\option.h" 261 > 262 </File> 263 <File 264 RelativePath=".\stdafx.h" 265 265 > 266 266 </File> … … 289 289 > 290 290 <File 291 RelativePath="..\BasicCompiler_Common\include\Class Impl.h"291 RelativePath="..\BasicCompiler_Common\include\Class.h" 292 292 > 293 293 </File> … … 301 301 </File> 302 302 <File 303 RelativePath="..\BasicCompiler_Common\include\Const.h" 304 > 305 </File> 306 <File 303 307 RelativePath="..\BasicCompiler_Common\include\DataTable.h" 304 308 > … … 313 317 </File> 314 318 <File 319 RelativePath="..\BasicCompiler_Common\include\Member.h" 320 > 321 </File> 322 <File 315 323 RelativePath="..\BasicCompiler_Common\include\MetaImpl.h" 316 324 > 317 325 </File> 318 326 <File 327 RelativePath="..\BasicCompiler_Common\include\Method.h" 328 > 329 </File> 330 <File 319 331 RelativePath="..\BasicCompiler_Common\include\NamespaceSupporter.h" 320 332 > 321 333 </File> 322 334 <File 323 RelativePath="..\BasicCompiler_Common\include\ProcedureImpl.h" 335 RelativePath="..\BasicCompiler_Common\include\Parameter.h" 336 > 337 </File> 338 <File 339 RelativePath="..\BasicCompiler_Common\include\Procedure.h" 324 340 > 325 341 </File> … … 329 345 </File> 330 346 <File 347 RelativePath="..\BasicCompiler_Common\include\Prototype.h" 348 > 349 </File> 350 <File 331 351 RelativePath="..\BasicCompiler_Common\include\SmoothieImpl.h" 332 352 > 333 353 </File> 334 354 <File 355 RelativePath="..\BasicCompiler_Common\include\Symbol.h" 356 > 357 </File> 358 <File 359 RelativePath="..\BasicCompiler_Common\include\Type.h" 360 > 361 </File> 362 <File 335 363 RelativePath="..\BasicCompiler_Common\include\TypeDef.h" 336 364 > 337 365 </File> 338 366 <File 339 RelativePath="..\BasicCompiler_Common\include\Variable Impl.h"367 RelativePath="..\BasicCompiler_Common\include\Variable.h" 340 368 > 341 369 </File> … … 396 424 Name="VCResourceCompilerTool" 397 425 PreprocessorDefinitions="_DEBUG;JPN;$(NoInherit)" 426 /> 427 </FileConfiguration> 428 </File> 429 <File 430 RelativePath=".\stdafx.cpp" 431 > 432 <FileConfiguration 433 Name="Debug|Win32" 434 > 435 <Tool 436 Name="VCCLCompilerTool" 437 UsePrecompiledHeader="1" 438 /> 439 </FileConfiguration> 440 <FileConfiguration 441 Name="Release|Win32" 442 > 443 <Tool 444 Name="VCCLCompilerTool" 445 UsePrecompiledHeader="1" 398 446 /> 399 447 </FileConfiguration> … … 981 1029 </Filter> 982 1030 <Filter 983 Name="Constant"984 >985 <File986 RelativePath="..\BasicCompiler_Common\Const.cpp"987 >988 </File>989 <File990 RelativePath="..\BasicCompiler_Common\Const.h"991 >992 </File>993 </Filter>994 <Filter995 1031 Name="Variable" 996 1032 > … … 1021 1057 > 1022 1058 <File 1023 RelativePath="..\BasicCompiler_Common\src\Class Impl.cpp"1059 RelativePath="..\BasicCompiler_Common\src\Class.cpp" 1024 1060 > 1025 1061 </File> … … 1033 1069 </File> 1034 1070 <File 1071 RelativePath="..\BasicCompiler_Common\src\Const.cpp" 1072 > 1073 </File> 1074 <File 1035 1075 RelativePath="..\BasicCompiler_Common\src\DataTable.cpp" 1036 1076 > … … 1045 1085 </File> 1046 1086 <File 1087 RelativePath="..\BasicCompiler_Common\src\Method.cpp" 1088 > 1089 </File> 1090 <File 1047 1091 RelativePath="..\BasicCompiler_Common\src\NamespaceSupporter.cpp" 1048 1092 > 1049 1093 </File> 1050 1094 <File 1051 RelativePath="..\BasicCompiler_Common\src\Procedure Impl.cpp"1095 RelativePath="..\BasicCompiler_Common\src\Procedure.cpp" 1052 1096 > 1053 1097 </File> … … 1061 1105 </File> 1062 1106 <File 1107 RelativePath="..\BasicCompiler_Common\src\Symbol.cpp" 1108 > 1109 </File> 1110 <File 1111 RelativePath="..\BasicCompiler_Common\src\Type.cpp" 1112 > 1113 </File> 1114 <File 1063 1115 RelativePath="..\BasicCompiler_Common\src\TypeDef.cpp" 1064 1116 > 1065 1117 </File> 1066 1118 <File 1067 RelativePath="..\BasicCompiler_Common\src\Variable Impl.cpp"1119 RelativePath="..\BasicCompiler_Common\src\Variable.cpp" 1068 1120 > 1069 1121 </File> -
trunk/abdev/BasicCompiler64/CLockParameter.cpp
r3 r206 1 #include "stdafx.h" 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "opcode.h" -
trunk/abdev/BasicCompiler64/CParameter.cpp
r75 r206 1 #include "stdafx.h" 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "opcode.h" … … 110 112 111 113 //call free 112 extern UserProc *pSub_free;114 extern const UserProc *pSub_free; 113 115 op_call(pSub_free); 114 116 } … … 133 135 134 136 //call calloc 135 extern UserProc *pSub_calloc;137 extern const UserProc *pSub_calloc; 136 138 op_call(pSub_calloc); 137 139 -
trunk/abdev/BasicCompiler64/Compile_Calc.cpp
r198 r206 1 #include "stdafx.h" 2 1 3 #include <jenga/include/smoothie/Smoothie.h> 2 4 #include <jenga/include/smoothie/LexicalAnalysis.h> … … 94 96 } 95 97 else{ 96 if(GetConstHash(variable)){ 98 if( compiler.GetMeta().GetGlobalConsts().IsExist(variable) 99 || compiler.GetMeta().GetGlobalConstMacros().IsExist(variable) ) 100 { 97 101 //定数リストに該当したとき 98 102 SetError(1,NULL,cp); … … 234 238 if( varType.IsObject() && compiler.GetMeta().GetBlittableTypes().IsExist( calcType ) ){ 235 239 // Blittable型をオブジェクトとして扱う 236 vector< UserProc *> userProcs;240 vector<const UserProc *> userProcs; 237 241 compiler.GetMeta().GetBlittableTypes().GetClass( calcType ).GetStaticMethods().Enum( "_Create", userProcs ); 238 242 if( userProcs.size() != 1 ){ … … 240 244 return; 241 245 } 242 UserProc *pUserProc = userProcs[0];246 const UserProc *pUserProc = userProcs[0]; 243 247 244 248 // mov rcx, rax -
trunk/abdev/BasicCompiler64/Compile_Calc_PushVar.cpp
r66 r206 1 #include "stdafx.h" 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "Opcode.h" -
trunk/abdev/BasicCompiler64/Compile_CallProc.cpp
r198 r206 1 #include "stdafx.h" 2 1 3 #include <jenga/include/smoothie/Smoothie.h> 2 4 … … 12 14 void Call_DebugSys_SaveContext(){ 13 15 //call _System_GetEip 14 extern UserProc *pSub_System_GetEip;16 extern const UserProc *pSub_System_GetEip; 15 17 op_call(pSub_System_GetEip); 16 18 … … 22 24 23 25 //call _DebugSys_SaveContext 24 extern UserProc *pSub_DebugSys_SaveContext;26 extern const UserProc *pSub_DebugSys_SaveContext; 25 27 op_call(pSub_DebugSys_SaveContext); 26 28 } … … 99 101 } 100 102 101 bool Opcode_CallProc(const char *Parameter, UserProc *pUserProc,DWORD dwFlags,const char *ObjectName,int RefType){103 bool Opcode_CallProc(const char *Parameter,const UserProc *pUserProc,DWORD dwFlags,const char *ObjectName,int RefType){ 102 104 // TODO: RefTypeは不必要なので削除する 103 105 int i2; … … 128 130 if(lstrcmpi(ObjectName,"Super")==0){ 129 131 //クラスメンバ関数内から基底クラスの呼び出し 130 pobj_c= Smoothie::Temp::pCompilingClass;132 pobj_c=compiler.pCompilingClass; 131 133 } 132 134 else{ … … 153 155 else{ 154 156 //クラスメンバ関数内から同一クラスのメンバ関数の呼び出し 155 pobj_c= Smoothie::Temp::pCompilingClass;157 pobj_c=compiler.pCompilingClass; 156 158 } 157 159 } … … 182 184 if(ObjectName[0]){ 183 185 //外部からの呼び出し 184 if(pobj_c== Smoothie::Temp::pCompilingClass){186 if(pobj_c==compiler.pCompilingClass){ 185 187 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 186 188 if( pMethod->IsNoneAccess() ){ … … 279 281 280 282 //call calloc 281 extern UserProc *pSub_calloc;283 extern const UserProc *pSub_calloc; 282 284 op_call(pSub_calloc); 283 285 -
trunk/abdev/BasicCompiler64/Compile_Func.cpp
r198 r206 1 #include "stdafx.h" 2 1 3 #include <jenga/include/smoothie/Smoothie.h> 2 4 … … 46 48 } 47 49 48 int SubScripts[MAX_ARRAYDIM];50 Subscripts subscripts; 49 51 RELATIVE_VAR RelativeVar; 50 if(!GetVarOffsetReadOnly(tempParm,&RelativeVar,type, SubScripts)) return;52 if(!GetVarOffsetReadOnly(tempParm,&RelativeVar,type,&subscripts)) return; 51 53 52 54 if(type.GetBasicType()&FLAG_PTR){ … … 59 61 int typeSize = type.GetSize(); 60 62 61 if(bArrayHead) typeSize*=JumpSubScripts( SubScripts);63 if(bArrayHead) typeSize*=JumpSubScripts(subscripts); 62 64 63 65 //mov rax,TypeSize … … 68 70 void Opcode_Func_AddressOf( const char *name ){ 69 71 extern int cp; 70 UserProc *pUserProc;72 const UserProc *pUserProc; 71 73 72 74 extern LONG_PTR ProcPtr_BaseIndex; … … 74 76 //左辺の型にのっとり、オーバーロードを解決 75 77 76 std::vector< UserProc *> subs;78 std::vector<const UserProc *> subs; 77 79 GetOverloadSubHash( name, subs ); 78 80 if( subs.size() == 0 ){ … … 131 133 SetThisPtrToReg(REG_RCX); 132 134 133 pobj_c= Smoothie::Temp::pCompilingClass;135 pobj_c=compiler.pCompilingClass; 134 136 } 135 137 -
trunk/abdev/BasicCompiler64/Compile_Interface.cpp
r132 r206 1 #include "stdafx.h" 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "opcode.h" -
trunk/abdev/BasicCompiler64/Compile_Object.cpp
r140 r206 1 #include "stdafx.h" 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "opcode.h" … … 33 35 //////////////////////// 34 36 35 std::vector< UserProc *> subs;37 std::vector<const UserProc *> subs; 36 38 pobj_c->GetMethods().Enum( pobj_c->GetName().c_str(), subs ); 37 39 38 UserProc *pUserProc;40 const UserProc *pUserProc; 39 41 if( subs.size() > 0 ){ 40 42 //オーバーロードを解決 … … 142 144 143 145 //call _System_GC_malloc_ForObject 144 extern UserProc *pSub_System_GC_malloc_ForObject;146 extern const UserProc *pSub_System_GC_malloc_ForObject; 145 147 op_call(pSub_System_GC_malloc_ForObject); 146 148 } … … 150 152 151 153 //call _System_GC_malloc_ForObjectPtr 152 extern UserProc *pSub_System_GC_malloc_ForObjectPtr;154 extern const UserProc *pSub_System_GC_malloc_ForObjectPtr; 153 155 op_call(pSub_System_GC_malloc_ForObjectPtr); 154 156 } … … 185 187 op_mov_RV(sizeof(_int64),REG_RCX,0); 186 188 obp-=sizeof(long); 187 pobj_SubAddrSchedule->add( method->pUserProc,0);188 method-> pUserProc->Using();189 pobj_SubAddrSchedule->add(&method->GetUserProc(),0); 190 method->GetUserProc().Using(); 189 191 obp+=sizeof(long); 190 192 … … 299 301 if( isSweeping ){ 300 302 //call _System_GC_free_for_SweepingDelete 301 extern UserProc *pSub_System_GC_free_for_SweepingDelete;303 extern const UserProc *pSub_System_GC_free_for_SweepingDelete; 302 304 op_call(pSub_System_GC_free_for_SweepingDelete); 303 305 } 304 306 else{ 305 307 //call free 306 extern UserProc *pSub_free;308 extern const UserProc *pSub_free; 307 309 op_call(pSub_free); 308 310 } -
trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp
r204 r206 1 #include "stdafx.h" 2 1 3 #include <jenga/include/smoothie/Smoothie.h> 2 4 #include <jenga/include/smoothie/LexicalAnalysis.h> … … 5 7 #include <Compiler.h> 6 8 #include <LexicalScopingImpl.h> 7 #include <ClassImpl.h> 8 #include <VariableImpl.h> 9 #include <Class.h> 9 10 10 11 #include "../BasicCompiler_Common/common.h" … … 31 32 } 32 33 33 UserProc *pBackUserProc; 34 pBackUserProc = &UserProc::CompilingUserProc(); 34 const UserProc *pBackUserProc = &UserProc::CompilingUserProc(); 35 35 UserProc::CompileStartForGlobalArea(); 36 36 … … 54 54 55 55 //_System_StartupProgramの呼び出し 56 extern UserProc *pSub_System_StartupProgram;56 extern const UserProc *pSub_System_StartupProgram; 57 57 op_call(pSub_System_StartupProgram); 58 58 … … 82 82 StackFrameSchedule=obp-sizeof(long); 83 83 84 BOOST_FOREACH( Variable *pVar, globalVars){84 BOOST_FOREACH( Variable *pVar, compiler.GetMeta().GetGlobalVars() ){ 85 85 if(memicmp(pVar->GetName().c_str(),"Static%",7)==0){ 86 86 //コンストラクタ呼び出し 87 if( pVar-> IsObject() ){87 if( pVar->GetType().IsObject() ){ 88 88 89 89 //エラー用 … … 92 92 CallConstructor( 93 93 pVar->GetName().c_str(), 94 pVar->GetSub ScriptsPtr(),95 *pVar,96 pVar-> paramStrForConstructor.c_str());94 pVar->GetSubscripts(), 95 pVar->GetType(), 96 pVar->GetParamStrForConstructor().c_str()); 97 97 } 98 98 } … … 113 113 114 114 115 UserProc *pBackUserProc; 116 pBackUserProc = &UserProc::CompilingUserProc(); 115 const UserProc *pBackUserProc = &UserProc::CompilingUserProc(); 117 116 UserProc::CompileStartForGlobalArea(); 118 117 … … 212 211 } 213 212 } 214 void AutoGeneration( UserProc &userProc){213 void AutoGeneration(const UserProc &userProc){ 215 214 if( userProc.GetName() == "InitializeUserTypes" 216 215 && userProc.HasParentClass() … … 229 228 } 230 229 } 231 void _compile_proc( UserProc *pUserProc){230 void _compile_proc(const UserProc *pUserProc){ 232 231 extern char *basbuf; 233 232 extern HANDLE hHeap; 234 extern GlobalProc **ppSubHash;235 233 extern BOOL bDebugCompile; 236 234 int i3,i4; … … 239 237 if( pUserProc->IsUsing() == false || pUserProc->IsCompiled() ) return; 240 238 241 if( pUserProc-> localVars.size() ){239 if( pUserProc->GetLocalVars().size() ){ 242 240 SetError(); 243 241 return; 244 242 } 243 244 trace_for_sourcecodestep( "★★★ " << pUserProc->GetFullName() << "のコンパイルを開始" ); 245 245 246 246 pUserProc->CompleteCompile(); … … 259 259 else bDebugSupportProc=0; 260 260 261 pUserProc-> beginOpAddress=obp;261 pUserProc->SetBeginOpAddress( obp ); 262 262 263 263 //コンパイル中の関数が属するクラス 264 Smoothie::Temp::pCompilingClass=pUserProc->GetParentClassPtr();264 compiler.pCompilingClass=pUserProc->GetParentClassPtr(); 265 265 266 266 //コンパイルスタートをクラス管理クラスに追加 … … 294 294 pobj_sf=0; 295 295 296 pUserProc-> endOpAddress=obp;296 pUserProc->SetEndOpAddress( obp ); 297 297 return; 298 298 } … … 360 360 Parameter ¶m = *pUserProc->RealParams()[i3]; 361 361 362 Variable *pVar = new Variable Impl( param.GetVarName(), param, false, param.IsRef());362 Variable *pVar = new Variable( param.GetVarName(), param, false, param.IsRef(), "" ); 363 363 364 364 if( param.IsArray() ){ 365 pVar->SetArray( param.GetSub ScriptsPtr() );365 pVar->SetArray( param.GetSubscripts() ); 366 366 } 367 367 … … 381 381 } 382 382 AllLocalVarSize+=varSize; 383 pVar-> offset=AllLocalVarSize;383 pVar->SetOffsetAddress( AllLocalVarSize ); 384 384 385 385 //レキシカルスコープ情報 386 pVar->S copeLevel=GetLexicalScopes().GetNowLevel();387 pVar->S copeStartAddress=GetLexicalScopes().GetStartAddress();386 pVar->SetScopeLevel( GetLexicalScopes().GetNowLevel() ); 387 pVar->SetScopeStartAddress( GetLexicalScopes().GetStartAddress() ); 388 388 pVar->bLiving=TRUE; 389 389 390 pUserProc-> localVars.push_back( pVar );390 pUserProc->GetLocalVars().push_back( pVar ); 391 391 } 392 392 … … 507 507 508 508 //call _DebugSys_StartProc 509 extern UserProc *pSub_DebugSys_StartProc;509 extern const UserProc *pSub_DebugSys_StartProc; 510 510 op_call(pSub_DebugSys_StartProc); 511 511 } 512 512 513 if( Smoothie::Temp::pCompilingClass){514 if( pUserProc->GetName() == Smoothie::Temp::pCompilingClass->GetName() ){513 if(compiler.pCompilingClass){ 514 if( pUserProc->GetName() == compiler.pCompilingClass->GetName() ){ 515 515 //////////////////////////////////// 516 516 // コンストラクタをコンパイルするとき … … 518 518 519 519 //コンストラクタのコンパイル開始を通知 520 Smoothie::Temp::pCompilingClass->NotifyStartConstructorCompile();520 compiler.pCompilingClass->NotifyStartConstructorCompile(); 521 521 522 522 //基底クラスかどうかの識別 523 523 //(継承元がインターフェイスの場合も基底クラスと見なす) 524 524 BOOL bThisIsSuperClass; 525 if( ! Smoothie::Temp::pCompilingClass->HasSuperClass() ) bThisIsSuperClass=1;526 else if( Smoothie::Temp::pCompilingClass->GetSuperClass().GetConstructorMethod() == NULL ){525 if( !compiler.pCompilingClass->HasSuperClass() ) bThisIsSuperClass=1; 526 else if( compiler.pCompilingClass->GetSuperClass().GetConstructorMethod() == NULL ){ 527 527 //インターフェイスを継承したときはコンストラクタを持たない 528 528 bThisIsSuperClass=1; … … 543 543 temporary[i4]=basbuf[i3]; 544 544 } 545 if( Smoothie::Temp::pCompilingClass->GetSuperClass().GetName() == temporary ){545 if( compiler.pCompilingClass->GetSuperClass().GetName() == temporary ){ 546 546 //基底クラスのコンストラクタを呼び出す 547 547 cp=i3; … … 560 560 Type dummyType; 561 561 CallProc( PROC_DEFAULT 562 , Smoothie::Temp::pCompilingClass->GetSuperClass().GetConstructorMethod()->pUserProc563 , Smoothie::Temp::pCompilingClass->GetSuperClass().GetConstructorMethod()->pUserProc->GetName().c_str()562 , &compiler.pCompilingClass->GetSuperClass().GetConstructorMethod()->GetUserProc() 563 , compiler.pCompilingClass->GetSuperClass().GetConstructorMethod()->GetUserProc().GetName().c_str() 564 564 , temporary 565 565 , dummyType ); … … 568 568 //基底クラスのコンストラクタを暗黙的に呼び出す 569 569 Opcode_CallProc("", 570 Smoothie::Temp::pCompilingClass->GetSuperClass().GetConstructorMethod()->pUserProc,570 &compiler.pCompilingClass->GetSuperClass().GetConstructorMethod()->GetUserProc(), 571 571 0, 572 572 "", … … 576 576 577 577 //仮想関数テーブルを初期化 578 if( Smoothie::Temp::pCompilingClass->IsExistVirtualFunctions()579 && ! Smoothie::Temp::pCompilingClass->IsAbstract() ){578 if( compiler.pCompilingClass->IsExistVirtualFunctions() 579 && !compiler.pCompilingClass->IsAbstract() ){ 580 580 //関数テーブルに値をセット 581 int offset = (int) Smoothie::Temp::pCompilingClass->GetVtblGlobalOffset();581 int offset = (int)compiler.pCompilingClass->GetVtblGlobalOffset(); 582 582 583 583 //mov rax,offset … … 598 598 599 599 //デストラクタのコンパイル開始を通知 600 Smoothie::Temp::pCompilingClass->NotifyStartDestructorCompile();600 compiler.pCompilingClass->NotifyStartDestructorCompile(); 601 601 } 602 602 } … … 624 624 ////////////////////////////////////////// 625 625 626 if( Smoothie::Temp::pCompilingClass ){627 628 if( Smoothie::Temp::pCompilingClass->IsCompilingConstructor() ){626 if( compiler.pCompilingClass ){ 627 628 if( compiler.pCompilingClass->IsCompilingConstructor() ){ 629 629 // コンストラクタをコンパイルしていたとき 630 630 631 631 // コンストラクタのコンパイルが完了したことを通知 632 Smoothie::Temp::pCompilingClass->NotifyFinishConstructorCompile();632 compiler.pCompilingClass->NotifyFinishConstructorCompile(); 633 633 } 634 634 else if( pUserProc->IsDestructor() ){ … … 638 638 639 639 // デストラクタのコンパイルが完了したことを通知 640 Smoothie::Temp::pCompilingClass->NotifyFinishDestructorCompile();641 642 if( Smoothie::Temp::pCompilingClass->HasSuperClass() ){640 compiler.pCompilingClass->NotifyFinishDestructorCompile(); 641 642 if( compiler.pCompilingClass->HasSuperClass() ){ 643 643 /* サブクラスのデストラクタをコンパイルしているときは、 644 644 基底クラスのデストラクタを呼び出す */ 645 645 646 const CMethod *method = Smoothie::Temp::pCompilingClass->GetSuperClass().GetDestructorMethod();646 const CMethod *method = compiler.pCompilingClass->GetSuperClass().GetDestructorMethod(); 647 647 if( method ){ 648 648 Opcode_CallProc("", 649 method->pUserProc,649 &method->GetUserProc(), 650 650 0, 651 651 "", … … 694 694 if(bDebugCompile&&bDebugSupportProc==0){ 695 695 //call _DebugSys_EndProc 696 extern UserProc *pSub_DebugSys_EndProc;696 extern const UserProc *pSub_DebugSys_EndProc; 697 697 op_call(pSub_DebugSys_EndProc); 698 698 } … … 745 745 } 746 746 HeapDefaultFree(pLocalVarAddrSchedule); 747 BOOST_FOREACH( Variable *pVar, pUserProc-> localVars){747 BOOST_FOREACH( Variable *pVar, pUserProc->GetLocalVars() ){ 748 748 //後にデバッグで利用する 749 pVar->offset = AllLocalVarSize + pobj_sf->GetFrameSize() - pVar->offset; 749 pVar->SetOffsetAddress( 750 AllLocalVarSize + pobj_sf->GetFrameSize() - pVar->GetOffsetAddress() 751 ); 750 752 } 751 753 … … 785 787 786 788 787 pUserProc-> endOpAddress=obp;789 pUserProc->SetEndOpAddress( obp ); 788 790 789 791 … … 793 795 } 794 796 795 void CompileBufferInProcedure( UserProc &userProc ){797 void CompileBufferInProcedure( const UserProc &userProc ){ 796 798 if( userProc.IsUsing() == false || userProc.IsCompiled() ) return; 797 799 … … 809 811 } 810 812 void CompileLocal(){ 811 extern GlobalProc **ppSubHash;812 int i2;813 814 813 extern BOOL bDll; 815 814 if(bDll){ 816 815 //DLLの場合はグローバル変数を初期化するための関数を一番初めにコンパイルする 817 UserProc *pUserProc=GetSubHash("_System_InitDllGlobalVariables");816 const UserProc *pUserProc = GetSubHash("_System_InitDllGlobalVariables"); 818 817 if(pUserProc){ 819 818 CompileBufferInProcedure( *pUserProc ); … … 823 822 824 823 //_System_TypeBase_InitializeUserTypesは一番最後にコンパイル 825 extern UserProc *pSubStaticMethod_System_TypeBase_InitializeUserTypes;824 extern const UserProc *pSubStaticMethod_System_TypeBase_InitializeUserTypes; 826 825 pSubStaticMethod_System_TypeBase_InitializeUserTypes->CompleteCompile(); 827 826 828 827 //_System_InitStaticLocalVariablesは一番最後にコンパイル 829 828 //※一般関数内の静的変数オブジェクトをすべて収集しなければならない 830 extern UserProc *pSub_System_InitStaticLocalVariables;829 extern const UserProc *pSub_System_InitStaticLocalVariables; 831 830 pSub_System_InitStaticLocalVariables->CompleteCompile(); 832 831 833 832 //_System_Call_Destructor_of_GlobalObjectは一番最後にコンパイル 834 extern UserProc *pSub_System_Call_Destructor_of_GlobalObject;833 extern const UserProc *pSub_System_Call_Destructor_of_GlobalObject; 835 834 pSub_System_Call_Destructor_of_GlobalObject->CompleteCompile(); 836 835 837 836 repeat: 838 GlobalProc *pGlobalProc; 839 for(i2=0;i2<MAX_HASH;i2++){ 840 pGlobalProc=ppSubHash[i2]; 841 while(pGlobalProc){ 842 CompileBufferInProcedure( *pGlobalProc ); 843 pGlobalProc=pGlobalProc->pNextData; 844 } 837 compiler.GetMeta().GetUserProcs().Iterator_Reset(); 838 while( compiler.GetMeta().GetUserProcs().Iterator_HasNext() ) 839 { 840 UserProc *pUserProc = compiler.GetMeta().GetUserProcs().Iterator_GetNext(); 841 CompileBufferInProcedure( *pUserProc ); 845 842 } 846 843 … … 856 853 if( IsNeedProcCompile() ){ 857 854 //プロシージャコンパイルによって、プロシージャコンパイルが必要になる場合 858 for(i2=0;i2<MAX_HASH;i2++){ 859 pGlobalProc=ppSubHash[i2];860 while(pGlobalProc){861 CompileBufferInProcedure( *pGlobalProc );862 pGlobalProc=pGlobalProc->pNextData;863 }855 856 compiler.GetMeta().GetUserProcs().Iterator_Reset(); 857 while( compiler.GetMeta().GetUserProcs().Iterator_HasNext() ) 858 { 859 UserProc *pUserProc = compiler.GetMeta().GetUserProcs().Iterator_GetNext(); 860 CompileBufferInProcedure( *pUserProc ); 864 861 } 865 862 } -
trunk/abdev/BasicCompiler64/Compile_Set_Var.cpp
r96 r206 1 #include "stdafx.h" 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "Opcode.h" … … 78 80 79 81 //call free 80 extern UserProc *pSub_free;82 extern const UserProc *pSub_free; 81 83 op_call(pSub_free); 82 84 } -
trunk/abdev/BasicCompiler64/Compile_Statement.cpp
r198 r206 1 #include "stdafx.h" 2 1 3 #include <jenga/include/smoothie/LexicalAnalysis.h> 2 4 … … 9 11 void OpcodeOthers(const char *Command){ 10 12 int i,i2; 11 UserProc *pUserProc;12 13 13 14 char leftTerm[8192]; … … 59 60 ////////////////////////////// 60 61 61 pUserProc=GetSubHash(Command);62 const UserProc *pUserProc=GetSubHash(Command); 62 63 63 64 //GetSubHash内でエラー提示が行われた場合 … … 737 738 738 739 if(type1.IsObject()){ 739 std::vector< UserProc *> subs;740 std::vector<const UserProc *> subs; 740 741 type1.GetClass().GetMethods().Enum( CALC_EQUAL, subs ); 741 742 if( subs.size() == 0 ){ … … 747 748 748 749 //オーバーロードを解決 749 UserProc *pUserProc; 750 pUserProc=OverloadSolution("==",subs, params, NULL); 750 const UserProc *pUserProc = OverloadSolution("==",subs, params, NULL); 751 751 752 752 delete params[0]; … … 892 892 893 893 //call _System_GetEip 894 extern UserProc *pSub_System_GetEip;894 extern const UserProc *pSub_System_GetEip; 895 895 op_call(pSub_System_GetEip); 896 896 … … 953 953 //戻り値をセット 954 954 if(Parameter[0]){ 955 UserProc &proc = UserProc::CompilingUserProc();955 const UserProc &proc = UserProc::CompilingUserProc(); 956 956 957 957 const char *temp = "_System_ReturnValue"; -
trunk/abdev/BasicCompiler64/Compile_Var.cpp
r198 r206 1 #include "stdafx.h" 2 1 3 #include <jenga/include/smoothie/Smoothie.h> 2 4 #include <jenga/include/smoothie/LexicalAnalysis.h> … … 5 7 #include <CodeGenerator.h> 6 8 #include <Compiler.h> 7 #include <Variable Impl.h>9 #include <Variable.h> 8 10 9 11 #include "../BasicCompiler_Common/common.h" … … 11 13 12 14 //変数 13 Variables globalVars; 15 // TODO: xml未完成 14 16 int AllGlobalVarSize; 15 17 int AllInitGlobalVarSize; … … 86 88 } 87 89 } 88 bool GetArrayOffset(const int *SubScripts,char *array, const Type &type){90 bool GetArrayOffset(const Subscripts &subscripts,char *array, const Type &type){ 89 91 extern HANDLE hHeap; 90 92 int i,i2,i3,i4; … … 105 107 } 106 108 if(array[i]==','||array[i]=='\0'){ 107 if(SubScripts[i3]==-1){ 109 if( i3 >= (int)subscripts.size() ) 110 { 108 111 for(i3--;i3>=0;i3--) HeapDefaultFree(pParm[i3]); 109 112 return false; … … 118 121 119 122 if(array[i]=='\0'){ 120 if(SubScripts[i3]!=-1){ 123 if( i3 < (int)subscripts.size() ) 124 { 121 125 for(i3--;i3>=0;i3--) HeapDefaultFree(pParm[i3]); 122 126 return false; … … 166 170 pobj_sf->pop(REG_R12); 167 171 168 for(i2=i+1,i4=1;i2<i3;i2++) i4*= SubScripts[i2]+1;172 for(i2=i+1,i4=1;i2<i3;i2++) i4*=subscripts[i2]+1; 169 173 170 174 //imul reg,i4 … … 204 208 char lpPtrOffset[VN_SIZE]; //第2次配列 205 209 char NestMember[VN_SIZE]; //入れ子メンバ 206 CClass::RefTyperefType;210 ReferenceKind refType; 207 211 lstrcpy(VarName,member); 208 212 if(!GetVarFormatString(VarName,array,lpPtrOffset,NestMember,refType)) return false; … … 224 228 225 229 //アクセシビリティをチェック 226 if(&objClass== Smoothie::Temp::pCompilingClass){230 if(&objClass==compiler.pCompilingClass){ 227 231 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 228 232 if(pMember->IsNoneAccess()){ … … 257 261 //ポインタ変数の場合 258 262 if( resultType.IsPointer() ){ 259 if( pMember->SubScripts[0]==-1){263 if( pMember->GetSubscripts().size() == 0 ){ 260 264 lstrcpy(lpPtrOffset,array); 261 265 array[0]=0; … … 280 284 if(array[0]){ 281 285 //配列オフセット 282 if(!GetArrayOffset(pMember-> SubScripts,array,pMember->GetType())){286 if(!GetArrayOffset(pMember->GetSubscripts(),array,pMember->GetType())){ 283 287 if(isErrorEnabled) SetError(14,member,cp); 284 288 } 285 289 } 286 else if( pMember->SubScripts[0]!=-1){290 else if( pMember->GetSubscripts().size() > 0 ){ 287 291 resultType.SetBasicType( resultType.GetBasicType() | FLAG_PTR ); 288 292 } … … 292 296 293 297 if( resultType.IsObject() || resultType.IsStruct() ){ 294 if( refType != CClass::Dot ){298 if( refType != RefDot ){ 295 299 if(isErrorEnabled) SetError(104,member,cp); 296 300 return false; … … 308 312 //pObj[n].member 309 313 if( ( resultType.IsObjectPtr() || resultType.IsStructPtr() ) 310 && refType != CClass::Dot ){314 && refType != RefDot ){ 311 315 if(isErrorEnabled) SetError(104,member,cp); 312 316 return false; … … 322 326 //pObj->member 323 327 if( (resultType.IsObjectPtr() || resultType.IsStructPtr() ) 324 && refType != CClass::Pointer ){328 && refType != RefPointer ){ 325 329 if(isErrorEnabled) SetError(104,member,cp); 326 330 return false; … … 336 340 if(lpPtrOffset[0]){ 337 341 //ppObj[n]->member 338 if( refType != CClass::Pointer ){342 if( refType != RefPointer ){ 339 343 if(isErrorEnabled) SetError(104,member,cp); 340 344 return false; … … 385 389 SetReg_WholeVariable(DEF_PTR_VOID,&RelativeVar,reg); 386 390 } 387 bool GetVarOffset(bool isErrorEnabled,bool isWriteAccess,const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType, int *pss){391 bool GetVarOffset(bool isErrorEnabled,bool isWriteAccess,const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType, Subscripts *pResultSubscripts ){ 388 392 char variable[VN_SIZE]; 389 393 … … 399 403 400 404 // 先頭オブジェクトまたはクラス名と入れ子メンバに分割 401 CClass::RefTyperefType;405 ReferenceKind refType; 402 406 char member[VN_SIZE],array[VN_SIZE],lpPtrOffset[VN_SIZE]; 403 407 GetVarFormatString(simpleName,array,lpPtrOffset,member,refType); … … 412 416 } 413 417 414 const int *pSubScripts;418 const Subscripts *pSubscripts; 415 419 bool bConst = false; 416 420 … … 421 425 ////////////////// 422 426 423 const Variable *pVar = UserProc::CompilingUserProc(). localVars.BackSearch( VarName);427 const Variable *pVar = UserProc::CompilingUserProc().GetLocalVars().BackSearch( Symbol( VarName ) ); 424 428 if( pVar ){ 425 429 //ポインタ変数の場合 426 if( pVar-> IsPointer() ){430 if( pVar->GetType().IsPointer() ){ 427 431 if( !pVar->IsArray() ){ 428 432 lstrcpy(lpPtrOffset,array); … … 438 442 } 439 443 440 pRelativeVar->offset=-pVar-> offset;444 pRelativeVar->offset=-pVar->GetOffsetAddress(); 441 445 pRelativeVar->bOffsetOffset=0; 442 446 if( pVar->IsRef() ){ … … 445 449 } 446 450 else pRelativeVar->dwKind=VAR_LOCAL; 447 resultType = *pVar;448 pSub Scripts=pVar->GetSubScriptsPtr();451 resultType = pVar->GetType(); 452 pSubscripts = &pVar->GetSubscripts(); 449 453 bConst = pVar->IsConst(); 450 454 … … 454 458 455 459 456 if( Smoothie::Temp::pCompilingClass){460 if(compiler.pCompilingClass){ 457 461 ////////////////////// 458 462 // クラスメンバの参照 … … 465 469 pRelativeVar->dwKind=VAR_DIRECTMEM; 466 470 467 resultType.SetType( DEF_OBJECT, Smoothie::Temp::pCompilingClass );471 resultType.SetType( DEF_OBJECT, compiler.pCompilingClass ); 468 472 return true; 469 473 } … … 478 482 479 483 bool isFound = false; 480 BOOST_FOREACH( CMember *pMember, Smoothie::Temp::pCompilingClass->GetDynamicMembers() ){484 BOOST_FOREACH( CMember *pMember, compiler.pCompilingClass->GetDynamicMembers() ){ 481 485 if( pMember->GetName() == VarName ){ 482 486 isFound = true; … … 492 496 if( isWriteAccess && 493 497 pMethod->IsConst() && 494 Smoothie::Temp::pCompilingClass->IsCompilingConstructor() == false &&495 Smoothie::Temp::pCompilingClass->IsCompilingDestructor() == false498 compiler.pCompilingClass->IsCompilingConstructor() == false && 499 compiler.pCompilingClass->IsCompilingDestructor() == false 496 500 ){ 497 501 SetError(131, NULL, cp ); … … 505 509 isErrorEnabled, 506 510 isWriteAccess, 507 * Smoothie::Temp::pCompilingClass,511 *compiler.pCompilingClass, 508 512 variable, 509 513 pRelativeVar, … … 526 530 GetNowStaticVarFullName(VarName,temporary); 527 531 528 pVar = globalVars.Find( temporary);532 pVar = compiler.GetMeta().GetGlobalVars().Find( Symbol( temporary ) ); 529 533 if( pVar ){ 530 534 goto GlobalOk; … … 545 549 char tempArray[VN_SIZE]; 546 550 { 547 CClass::RefTyperefType;551 ReferenceKind refType; 548 552 GetVarFormatString(temporary,tempArray,lpPtrOffset,tempMember, refType ); 549 553 } … … 557 561 char temp2[VN_SIZE]; 558 562 sprintf(temp2,"%s.%s",VarName,temporary); 559 pVar = globalVars.Find( temp2);563 pVar = compiler.GetMeta().GetGlobalVars().Find( Symbol( temp2 ) ); 560 564 if( pVar ){ 561 565 lstrcpy(member,tempMember); … … 565 569 } 566 570 567 if( Smoothie::Temp::pCompilingClass){571 if(compiler.pCompilingClass){ 568 572 //自身のクラスから静的メンバを参照する場合 569 573 char temp2[VN_SIZE]; 570 sprintf(temp2,"%s.%s", Smoothie::Temp::pCompilingClass->GetName().c_str(),VarName);571 pVar = globalVars.Find( temp2);574 sprintf(temp2,"%s.%s",compiler.pCompilingClass->GetName().c_str(),VarName); 575 pVar = compiler.GetMeta().GetGlobalVars().Find( Symbol( temp2 ) ); 572 576 if( pVar ){ 573 577 goto GlobalOk; … … 579 583 ///////////////////// 580 584 581 pVar = globalVars.BackSearch( VarName);585 pVar = compiler.GetMeta().GetGlobalVars().BackSearch( Symbol( VarName ) ); 582 586 if( pVar ){ 583 587 goto GlobalOk; … … 592 596 GlobalOk: 593 597 //ポインタ変数の場合 594 if( pVar-> IsPointer() ){598 if( pVar->GetType().IsPointer() ){ 595 599 if( !pVar->IsArray() ){ 596 600 lstrcpy(lpPtrOffset,array); … … 606 610 } 607 611 608 pRelativeVar->offset=pVar-> offset;612 pRelativeVar->offset=pVar->GetOffsetAddress(); 609 613 pRelativeVar->bOffsetOffset=0; 610 614 if( pVar->IsRef() ){ … … 613 617 } 614 618 else pRelativeVar->dwKind=VAR_GLOBAL; 615 resultType = *pVar;616 pSub Scripts=pVar->GetSubScriptsPtr();619 resultType = pVar->GetType(); 620 pSubscripts=&pVar->GetSubscripts(); 617 621 bConst = pVar->IsConst(); 618 622 } … … 634 638 } 635 639 636 if( array[0]==0&&pSubScripts[0]!=-1){640 if( array[0] == 0 && pSubscripts->size() > 0 ){ 637 641 //配列の先頭ポインタを示す場合 638 642 resultType.SetBasicType( resultType.GetBasicType() | FLAG_PTR ); 639 if(pss) memcpy(pss,pSubScripts,MAX_ARRAYDIM); 643 644 if( pResultSubscripts ) 645 { 646 (*pResultSubscripts) = *pSubscripts; 647 } 640 648 return true; 641 649 } … … 649 657 } 650 658 if(array[0]){ 651 if(!GetArrayOffset( pSubScripts,array,resultType)){659 if(!GetArrayOffset(*pSubscripts,array,resultType)){ 652 660 SetError(14,variable,cp); 653 661 pRelativeVar->dwKind=NON_VAR; … … 658 666 if( resultType.IsObject() || resultType.IsStruct() ){ 659 667 //実態オブジェクトのメンバを参照(obj.member) 660 if( refType != CClass::Dot ){668 if( refType != RefDot ){ 661 669 SetError(104,VarName,cp); 662 670 pRelativeVar->dwKind=NON_VAR; … … 673 681 if(lpPtrOffset[0]){ 674 682 //pObj[n].member 675 if( refType != CClass::Dot ){683 if( refType != RefDot ){ 676 684 SetError(104,VarName,cp); 677 685 pRelativeVar->dwKind=NON_VAR; … … 683 691 else{ 684 692 //pObj->member 685 if( refType != CClass::Pointer ){693 if( refType != RefPointer ){ 686 694 SetError(104,VarName,cp); 687 695 pRelativeVar->dwKind=NON_VAR; … … 700 708 if(lpPtrOffset[0]){ 701 709 //ppObj[n]->member 702 if( refType != CClass::Pointer ){710 if( refType != RefPointer ){ 703 711 SetError(104,VarName,cp); 704 712 pRelativeVar->dwKind=NON_VAR; … … 744 752 } 745 753 746 bool SetInitGlobalData(int offset,const Type &type,const int *SubScripts,const char *lpszInitBuf){754 bool SetInitGlobalData(int offset,const Type &type,const Subscripts &subscripts,const char *lpszInitBuf){ 747 755 extern BYTE *initGlobalBuf; 748 int i ,i2,i3;756 int i2,i3; 749 757 char temporary[VN_SIZE]; 750 758 char InitBuf[VN_SIZE]; … … 757 765 int typeSize = type.GetSize(); 758 766 759 if(SubScripts[0]!=-1){ 760 typeSize*=JumpSubScripts(SubScripts+1); 761 i=0; 762 i2=0; 763 while(1){ 764 if(SubScripts[0]<i2){ 765 SetError(41,0,cp); 766 return 0; 767 } 768 i=GetOneParameter(InitBuf,i,temporary); 769 if(!SetInitGlobalData( 770 offset+i2*typeSize, 771 type, 772 SubScripts+1, 773 temporary)) return false; 774 i2++; 775 if(InitBuf[i]=='\0') break; 767 if( subscripts.size() > 0 ){ 768 Subscripts nestSubscripts; 769 for( int i=1; i<(int)subscripts.size(); i++ ) 770 { 771 nestSubscripts.push_back( subscripts[i] ); 772 } 773 774 typeSize*=JumpSubScripts( nestSubscripts ); 775 { 776 int i=0; 777 i2=0; 778 while(1){ 779 if( subscripts[0] < i2 ){ 780 SetError(41,0,cp); 781 return 0; 782 } 783 i=GetOneParameter(InitBuf,i,temporary); 784 if(!SetInitGlobalData( 785 offset+i2*typeSize, 786 type, 787 nestSubscripts, 788 temporary)) return false; 789 i2++; 790 if(InitBuf[i]=='\0') break; 791 } 776 792 } 777 793 return true; … … 794 810 if(!SetInitGlobalData(offset+i3, 795 811 pMember->GetType(), 796 pMember-> SubScripts,812 pMember->GetSubscripts(), 797 813 temporary)) return false; 798 814 } … … 815 831 } 816 832 817 if( SubScripts[0]!=-1){833 if( subscripts.size() > 0 ){ 818 834 SetError(41,0,cp); 819 835 return false; … … 883 899 return true; 884 900 } 885 bool InitLocalVar(int offset,const Type &type,const int *SubScripts,const char *lpszInitBuf){886 int i ,i2,i3;901 bool InitLocalVar(int offset,const Type &type,const Subscripts &subscripts,const char *lpszInitBuf){ 902 int i2,i3; 887 903 char temporary[VN_SIZE]; 888 904 char InitBuf[VN_SIZE]; … … 895 911 int typeSize = type.GetSize(); 896 912 897 if(SubScripts[0]!=-1){ 898 typeSize*=JumpSubScripts(SubScripts+1); 899 i=0; 900 i2=0; 901 while(1){ 902 if(SubScripts[0]<i2){ 903 SetError(41,0,cp); 904 return false; 905 } 906 i=GetOneParameter(InitBuf,i,temporary); 907 if(!InitLocalVar( 908 offset+i2*typeSize, 909 type, 910 SubScripts+1, 911 temporary)) return false; 912 i2++; 913 if(InitBuf[i]=='\0') break; 913 if( subscripts.size() > 0 ){ 914 Subscripts nestSubscripts; 915 for( int i=1; i<(int)subscripts.size(); i++ ) 916 { 917 nestSubscripts.push_back( subscripts[i] ); 918 } 919 920 typeSize*=JumpSubScripts( nestSubscripts ); 921 { 922 int i=0; 923 i2=0; 924 while(1){ 925 if( subscripts[0] < i2 ){ 926 SetError(41,0,cp); 927 return 0; 928 } 929 i=GetOneParameter(InitBuf,i,temporary); 930 if(!InitLocalVar( 931 offset+i2*typeSize, 932 type, 933 nestSubscripts, 934 temporary)) return false; 935 i2++; 936 if(InitBuf[i]=='\0') break; 937 } 914 938 } 915 939 return true; … … 932 956 if(!InitLocalVar(offset+i3, 933 957 pMember->GetType(), 934 pMember-> SubScripts,958 pMember->GetSubscripts(), 935 959 temporary)) return false; 936 960 … … 949 973 /////////////////////////////////////// 950 974 951 if( SubScripts[0]!=-1){975 if( subscripts.size() > 0 ){ 952 976 SetError(41,0,cp); 953 977 return false; … … 1061 1085 } 1062 1086 1063 void dim( char *VarName, int *SubScripts,Type &type,const char *InitBuf,const char *ConstractParameter,DWORD dwFlags){1087 void dim( char *VarName, const Subscripts &subscripts, Type &type,const char *InitBuf,const char *ConstractParameter,DWORD dwFlags){ 1064 1088 if( UserProc::IsGlobalAreaCompiling() ){ 1065 1089 ///////////////////////// … … 1067 1091 ///////////////////////// 1068 1092 1069 //OpcodeOthers( ( (string)"OutputDebugString(Ex\"" + VarName + "\r\n\")" ).c_str() ); 1070 AddGlobalVariable(VarName,SubScripts,type,InitBuf,ConstractParameter,dwFlags); 1093 AddGlobalVariable(VarName,subscripts,type,InitBuf,ConstractParameter,dwFlags); 1071 1094 } 1072 1095 else{ … … 1075 1098 ///////////////// 1076 1099 1077 if( UserProc::CompilingUserProc(). localVars.DuplicateCheck( VarName ) ){1100 if( UserProc::CompilingUserProc().GetLocalVars().DuplicateCheck( VarName ) ){ 1078 1101 //2重定義のエラー 1079 1102 SetError(15,VarName,cp); … … 1083 1106 bool isConst = ( dwFlags & DIMFLAG_CONST ) ? true:false; 1084 1107 1085 Variable *pVar = new Variable Impl( VarName, type, isConst);1086 1087 if( SubScripts[0] != -1){1108 Variable *pVar = new Variable( VarName, type, isConst, false, ConstractParameter ); 1109 1110 if( subscripts.size() > 0 ){ 1088 1111 //配列あり 1089 pVar->SetArray( SubScripts ); 1090 } 1091 1092 //コンストラクタ用パラメータ 1093 pVar->paramStrForConstructor = ConstractParameter; 1112 pVar->SetArray( subscripts ); 1113 } 1094 1114 1095 1115 //レキシカルスコープ 1096 pVar->S copeLevel=GetLexicalScopes().GetNowLevel();1097 pVar->S copeStartAddress=GetLexicalScopes().GetStartAddress();1116 pVar->SetScopeLevel( GetLexicalScopes().GetNowLevel() ); 1117 pVar->SetScopeStartAddress( GetLexicalScopes().GetStartAddress() ); 1098 1118 pVar->bLiving=TRUE; 1099 1119 … … 1102 1122 1103 1123 // 変数を追加 1104 UserProc::CompilingUserProc(). localVars.push_back( pVar );1124 UserProc::CompilingUserProc().GetLocalVars().push_back( pVar ); 1105 1125 1106 1126 //アラインメントを考慮 1107 if( pVar-> IsStruct() ){1108 int alignment = pVar->Get Class().iAlign;1127 if( pVar->GetType().IsStruct() ){ 1128 int alignment = pVar->GetType().GetClass().iAlign; 1109 1129 1110 1130 if( alignment ){ … … 1126 1146 1127 1147 AllLocalVarSize += pVar->GetMemorySize(); 1128 pVar-> offset = AllLocalVarSize;1148 pVar->SetOffsetAddress( AllLocalVarSize ); 1129 1149 1130 1150 //レキシカルスコープ 1131 pVar->S copeLevel=GetLexicalScopes().GetNowLevel();1132 pVar->S copeStartAddress=GetLexicalScopes().GetStartAddress();1151 pVar->SetScopeLevel( GetLexicalScopes().GetNowLevel() ); 1152 pVar->SetScopeStartAddress( GetLexicalScopes().GetStartAddress() ); 1133 1153 pVar->bLiving=TRUE; 1134 1154 … … 1140 1160 1141 1161 int result = 0; 1142 if( !pVar-> IsObject() ){1143 result = InitLocalVar(-pVar-> offset,1144 *pVar,1145 pVar->GetSub ScriptsPtr(),1162 if( !pVar->GetType().IsObject() ){ 1163 result = InitLocalVar(-pVar->GetOffsetAddress(), 1164 pVar->GetType(), 1165 pVar->GetSubscripts(), 1146 1166 InitBuf); 1147 1167 } … … 1171 1191 1172 1192 //add rcx, offset 1173 op_add_RV( REG_RCX, -pVar-> offset);1193 op_add_RV( REG_RCX, -pVar->GetOffsetAddress() ); 1174 1194 obp-=sizeof(long); 1175 1195 AddLocalVarAddrSchedule(); … … 1186 1206 if( type.IsObject() &&(dwFlags&DIMFLAG_NONCALL_CONSTRACTOR)==0&&InitBuf[0]=='\0'){ 1187 1207 char objectSize[255]; 1188 if( SubScripts[0] == -1){1208 if( subscripts.size() == 0 ){ 1189 1209 objectSize[0] = 0; 1190 1210 } 1191 1211 else{ 1192 if( SubScripts[1] != -1 ){1212 if( subscripts.size() > 1 ){ 1193 1213 SetError(300,NULL,cp); 1194 1214 } 1195 sprintf( objectSize, "%d", SubScripts[0] );1215 sprintf( objectSize, "%d", subscripts[0] ); 1196 1216 } 1197 1217 Operator_New( type.GetClass(), objectSize, ConstractParameter, type ); … … 1304 1324 1305 1325 bool Compile_AddGlobalRootsForGc(){ 1306 UserProc *pUserProc_AddGlobalRootPtr = GetClassMethod( "_System_CGarbageCollection", "AddGlobalRootPtr" );1326 const UserProc *pUserProc_AddGlobalRootPtr = GetClassMethod( "_System_CGarbageCollection", "AddGlobalRootPtr" ); 1307 1327 if( !pUserProc_AddGlobalRootPtr ){ 1308 1328 SetError(3, "_System_CGarbageCollection.AddGlobalRootPtr", -1 ); … … 1310 1330 } 1311 1331 1312 BOOST_FOREACH( const Variable *pVar, globalVars){1313 if( pVar-> IsObject() || pVar->IsPointer() || pVar->IsStruct() ){1332 BOOST_FOREACH( const Variable *pVar, compiler.GetMeta().GetGlobalVars() ){ 1333 if( pVar->GetType().IsObject() || pVar->GetType().IsPointer() || pVar->GetType().IsStruct() ){ 1314 1334 // オブジェクトまたはポインタだったとき 1315 1335 // ※構造体も含む(暫定対応) … … 1321 1341 // ルートポインタを引き渡す 1322 1342 //mov rdx,offset 1323 op_mov_RV(sizeof(_int64), REG_RDX,(int)pVar-> offset);1343 op_mov_RV(sizeof(_int64), REG_RDX,(int)pVar->GetOffsetAddress()); 1324 1344 obp-=sizeof(long); 1325 1345 pobj_GlobalVarSchedule->add(); -
trunk/abdev/BasicCompiler64/MakePeHdr.cpp
r202 r206 1 #include "stdafx.h" 2 1 3 #include <jenga/include/common/Environment.h> 2 4 … … 4 6 5 7 #include <LexicalScopingImpl.h> 6 #include <Class Impl.h>8 #include <Class.h> 7 9 #include <Compiler.h> 8 10 11 #include <../Enum.h> 12 9 13 #include "../BasicCompiler_Common/common.h" 14 #include "../BasicCompiler_Common/DebugSection.h" 10 15 #include "Opcode.h" 11 16 … … 16 21 17 22 // グローバル関数、静的メソッド 18 UserProc23 const UserProc 19 24 *pSub_System_StartupProgram, 20 25 *pSub_DebugSys_StartProc, … … 36 41 37 42 // 動的メソッド 38 UserProc43 const UserProc 39 44 *pUserProc_System_CGarbageCollection_RegisterGlobalRoots; 40 45 … … 160 165 161 166 //クラス名を取得(詳細情報はGetAllClassInfoで取得) 162 // GetSubInfo関数の中で参照されるオブジェクト名を事前に取得する。167 // CollectUserProcs関数の中で参照されるオブジェクト名を事前に取得する。 163 168 // ※オブジェクトの内容までは取得しない 164 169 compiler.GetMeta().GetClasses().CollectClassesForNameOnly( Smoothie::Lexical::source ); … … 171 176 172 177 //サブルーチン(ユーザー定義、DLL関数)の識別子、アドレスを取得 173 Smoothie::Temp::pCompilingClass = NULL;174 GetSubInfo();175 176 // クラス情報を取得(※注 - GetSubInfoの後に呼び出す)178 compiler.pCompilingClass = NULL; 179 UserProcs::CollectUserProcs( Smoothie::Lexical::source, compiler.GetMeta().GetUserProcs() ); 180 181 // クラス情報を取得(※注 - CollectUserProcsの後に呼び出す) 177 182 compiler.GetMeta().GetClasses().GetAllClassInfo(); 178 183 179 compiler.GetMeta().AutoWrite( Jenga::Common::Environment::GetAppDir() + "\\meta_test.xml" ); 184 // サブルーチン(ユーザー定義、DLL関数)のイテレータの準備 185 compiler.GetMeta().GetUserProcs().Iterator_Init(); 186 187 /* 188 if( !compiler.GetMeta().Write( Jenga::Common::Environment::GetAppDir() + "\\meta_test.xml" ) ) 189 { 190 MessageBox(0,"XML書き込みに失敗","test",0); 191 } 192 MetaImpl *pTempMeta = new MetaImpl(); 193 if( !pTempMeta->Read( Jenga::Common::Environment::GetAppDir() + "\\meta_test.xml" ) ) 194 { 195 MessageBox(0,"XML読み込みに失敗","test",0); 196 } 197 compiler.GetMeta() = (*pTempMeta); 198 */ 180 199 181 200 //コードと行番号の関係 … … 347 366 extern CStackFrame *pobj_sf; 348 367 pobj_sf=new CStackFrame(); 368 369 trace_for_sourcecodestep( "★★★ グローバル領域のコンパイルを開始" ); 349 370 350 371 … … 399 420 400 421 //call _System_Call_Destructor_of_GlobalObject 401 extern UserProc *pSub_System_Call_Destructor_of_GlobalObject;422 extern const UserProc *pSub_System_Call_Destructor_of_GlobalObject; 402 423 op_call(pSub_System_Call_Destructor_of_GlobalObject); 403 424 … … 557 578 ExportNamesLength=lstrlen(lpExportNames)+1; 558 579 559 extern GlobalProc **ppSubHash; 560 GlobalProc *pUserProc,*psi2; 580 UserProc *pUserProc,*psi2; 561 581 while(1){ 562 582 //辞書順にサーチ 563 583 temporary[0]=0; 564 for(i=0,psi2=0;i<MAX_HASH;i++){ 565 pUserProc=ppSubHash[i]; 566 while(pUserProc){ 567 if(pUserProc->IsExport()){ 568 if(temporary[0]=='\0'){ 584 compiler.GetMeta().GetUserProcs().Iterator_Reset(); 585 while( compiler.GetMeta().GetUserProcs().Iterator_HasNext() ) 586 { 587 pUserProc = compiler.GetMeta().GetUserProcs().Iterator_GetNext(); 588 if(pUserProc->IsExport()){ 589 if(temporary[0]=='\0'){ 590 lstrcpy(temporary,pUserProc->GetName().c_str()); 591 psi2=pUserProc; 592 } 593 else{ 594 i3=lstrlen(temporary); 595 i4=(int)pUserProc->GetName().size(); 596 if(i3<i4) i3=i4; 597 if(memcmp(temporary,pUserProc->GetName().c_str(),i3)>0){ 569 598 lstrcpy(temporary,pUserProc->GetName().c_str()); 570 599 psi2=pUserProc; 571 600 } 572 else{573 i3=lstrlen(temporary);574 i4=(int)pUserProc->GetName().size();575 if(i3<i4) i3=i4;576 if(memcmp(temporary,pUserProc->GetName().c_str(),i3)>0){577 lstrcpy(temporary,pUserProc->GetName().c_str());578 psi2=pUserProc;579 }580 }581 601 } 582 pUserProc=pUserProc->pNextData;583 602 } 584 603 } … … 589 608 590 609 if( pUserProc->GetName() == "DllMain" ){ 591 DllMain_EntryPoint=pUserProc-> beginOpAddress;610 DllMain_EntryPoint=pUserProc->GetBeginOpAddress(); 592 611 } 593 612 594 613 lpdwExportAddressTable=(DWORD *)HeapReAlloc(hHeap,0,lpdwExportAddressTable,(ExportNum+1)*sizeof(DWORD)); 595 lpdwExportAddressTable[ExportNum]=pUserProc-> beginOpAddress;614 lpdwExportAddressTable[ExportNum]=pUserProc->GetBeginOpAddress(); 596 615 597 616 lpdwExportNamePointerTable=(DWORD *)HeapReAlloc(hHeap,0,lpdwExportNamePointerTable,(ExportNum+1)*sizeof(DWORD)); … … 800 819 //(デバッグ情報で利用される) 801 820 extern int AllInitGlobalVarSize; 802 BOOST_FOREACH( Variable *pVar, globalVars ){ 803 if(pVar->offset&0x80000000){ 804 pVar->offset=(pVar->offset&0x7FFFFFFF)+AllInitGlobalVarSize; 821 BOOST_FOREACH( Variable *pVar, compiler.GetMeta().GetGlobalVars() ){ 822 if(pVar->GetOffsetAddress()&0x80000000){ 823 pVar->SetOffsetAddress( 824 (pVar->GetOffsetAddress()&0x7FFFFFFF)+AllInitGlobalVarSize 825 ); 805 826 } 806 827 } … … 1088 1109 // ※x86はRVAからのオフセット。x64はRPI(実行中アドレス)からのオフセット 1089 1110 for(i=0;i<pobj_ImportAddrSchedule->num;i++){ 1090 DllProc *pDllProc; 1091 pDllProc=pobj_ImportAddrSchedule->ppdi[i]; 1111 const DllProc *pDllProc = pobj_ImportAddrSchedule->ppdi[i]; 1092 1112 *((long *)(OpBuffer+pobj_ImportAddrSchedule->pObpValues[i]))= 1093 1113 MemPos_ImportSection+ … … 1101 1121 // プロシージャポインタスケジュール 1102 1122 for(i=0;i<pobj_SubAddrSchedule->num;i++){ 1103 if(pobj_SubAddrSchedule->ppsi[i]-> beginOpAddress==01104 &&pobj_SubAddrSchedule->ppsi[i]-> endOpAddress==0){1123 if(pobj_SubAddrSchedule->ppsi[i]->GetBeginOpAddress()==0 1124 &&pobj_SubAddrSchedule->ppsi[i]->GetEndOpAddress()==0){ 1105 1125 SetError(300,NULL,-1); 1106 1126 } … … 1108 1128 if(pobj_SubAddrSchedule->pbCall[i]){ 1109 1129 *((long *)(OpBuffer+pobj_SubAddrSchedule->pObpValues[i]))= 1110 pobj_SubAddrSchedule->ppsi[i]-> beginOpAddress-(pobj_SubAddrSchedule->pObpValues[i]+sizeof(long));1130 pobj_SubAddrSchedule->ppsi[i]->GetBeginOpAddress()-(pobj_SubAddrSchedule->pObpValues[i]+sizeof(long)); 1111 1131 } 1112 1132 else{ 1113 1133 *((long *)(OpBuffer+pobj_SubAddrSchedule->pObpValues[i]))= 1114 pobj_SubAddrSchedule->ppsi[i]-> beginOpAddress+ImageBase+MemPos_CodeSection;1134 pobj_SubAddrSchedule->ppsi[i]->GetBeginOpAddress()+ImageBase+MemPos_CodeSection; 1115 1135 } 1116 1136 } -
trunk/abdev/BasicCompiler64/NumOpe.cpp
r198 r206 1 #include "stdafx.h" 2 1 3 #include <jenga/include/smoothie/Smoothie.h> 2 4 #include <jenga/include/smoothie/LexicalAnalysis.h> … … 164 166 // 動的メソッドを検索 165 167 /////////////////////////////////////////////////////////////////// 166 vector< UserProc *> userProcs;168 vector<const UserProc *> userProcs; 167 169 168 170 char methodName[VN_SIZE], lpPtrOffset[VN_SIZE], parameter[VN_SIZE], dummy[1]; 169 CClass::RefTyperefType;171 ReferenceKind refType; 170 172 lstrcpy( methodName, member ); 171 173 GetVarFormatString(methodName,parameter,lpPtrOffset,dummy,refType); 172 174 173 175 objClass.GetMethods().Enum( methodName, userProcs ); 174 UserProc *pUserProc;175 176 if(userProcs.size()){ 176 177 //オーバーロードを解決 177 pUserProc=OverloadSolutionWithStrParam(termFull,userProcs,parameter,termLeft);178 const UserProc *pUserProc = OverloadSolutionWithStrParam(termFull,userProcs,parameter,termLeft); 178 179 179 180 if( pUserProc ){ … … 245 246 // パース 246 247 char member[VN_SIZE]; 247 CClass::RefTyperefType;248 if( CClass::SplitName( termFull, termLeft, member, refType ) ){248 ReferenceKind refType; 249 if( SplitMemberName( termFull, termLeft, member, refType ) ){ 249 250 /////////////////////////////////////////////////////////////////// 250 251 // オブジェクトとメンバに分解できるとき … … 309 310 if(lstrcmpi(termFull,"This")==0 && isProcedureCallOnly == false ){ 310 311 //Thisオブジェクト 311 resultType.SetType( DEF_OBJECT, Smoothie::Temp::pCompilingClass );312 resultType.SetType( DEF_OBJECT, compiler.pCompilingClass ); 312 313 313 314 SetThisPtrToReg( UseReg ); … … 385 386 return true; 386 387 } 387 else if(GetConstCalcBuffer(procName,parameter,temporary)){ 388 ///////////////////////// 389 // マクロ関数 390 ///////////////////////// 391 392 //閉じカッコ")"に続く文字がNULLでないときはエラーにする 393 if(termFull[i2+1+i4+1]!='\0') SetError(42,NULL,cp); 394 395 //マクロ関数の場合 396 NumOpe(&UseReg,temporary,Type(),resultType); 397 398 if(!IS_LITERAL(resultType.GetIndex())){ 399 //リテラル値ではなかったとき 400 isLiteral = false; 401 } 402 403 return true; 388 389 ConstMacro *pConstMacro = compiler.GetMeta().GetGlobalConstMacros().Find( procName ); 390 if( pConstMacro ) 391 { 392 if( pConstMacro->GetCalcBuffer( parameter, temporary ) ) 393 { 394 ///////////////////////// 395 // マクロ関数 396 ///////////////////////// 397 398 //閉じカッコ")"に続く文字がNULLでないときはエラーにする 399 if(termFull[i2+1+i4+1]!='\0') SetError(42,NULL,cp); 400 401 //マクロ関数の場合 402 NumOpe(&UseReg, temporary,Type(),resultType); 403 404 if(!IS_LITERAL(resultType.GetIndex())){ 405 //リテラル値ではなかったとき 406 isLiteral = false; 407 } 408 409 return true; 410 } 404 411 } 405 412 } … … 905 912 ////////////// 906 913 907 i3 = CDBConst::obj.GetBasicType(term);914 i3 = compiler.GetMeta().GetGlobalConsts().GetBasicType(term); 908 915 if(i3){ 909 if( CDBConst::obj.IsStringPtr( term ) ){916 if( compiler.GetMeta().GetGlobalConsts().IsStringPtr( term ) ){ 910 917 //リテラル文字列 911 918 912 double dbl = CDBConst::obj.GetDoubleData(term);919 double dbl = compiler.GetMeta().GetGlobalConsts().GetDoubleData(term); 913 920 memcpy(&i64data,&dbl,sizeof(double)); 914 921 … … 924 931 if(IsRealNumberType(i3)){ 925 932 //実数 926 double dbl = CDBConst::obj.GetDoubleData(term);933 double dbl = compiler.GetMeta().GetGlobalConsts().GetDoubleData(term); 927 934 memcpy(&i64data,&dbl,sizeof(double)); 928 935 goto Literal; … … 930 937 else if(IsWholeNumberType(i3)){ 931 938 //整数 932 i64data = CDBConst::obj.GetWholeData(term);939 i64data = compiler.GetMeta().GetGlobalConsts().GetWholeData(term); 933 940 goto Literal; 934 941 } -
trunk/abdev/BasicCompiler64/NumOpe_Arithmetic.cpp
r198 r206 1 #include "stdafx.h" 2 1 3 #include <Compiler.h> 2 4 … … 561 563 562 564 //call pow 563 extern UserProc *pSub_pow;565 extern const UserProc *pSub_pow; 564 566 op_call(pSub_pow); 565 567 -
trunk/abdev/BasicCompiler64/NumOpe_Logical.cpp
r64 r206 1 #include "stdafx.h" 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "Opcode.h" -
trunk/abdev/BasicCompiler64/NumOpe_Relation.cpp
r36 r206 1 #include "stdafx.h" 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "Opcode.h" -
trunk/abdev/BasicCompiler64/NumOpe_TypeOperation.cpp
r198 r206 1 #include "stdafx.h" 2 1 3 #include <jenga/include/smoothie/Smoothie.h> 2 4 -
trunk/abdev/BasicCompiler64/Opcode.h
r142 r206 1 //Opcode.h 1 #pragma once 2 3 #include <Type.h> 4 #include <Procedure.h> 2 5 3 6 … … 323 326 bool _member_offset(bool isErrorEnabled, bool isWriteAccess, const CClass &objClass, const char *member, RELATIVE_VAR *pRelativeVar, Type &resultType, BOOL bPrivateAccess); 324 327 void SetThisPtrToReg(int reg); 325 bool GetVarOffset(bool isErrorEnabled,bool isWriteAccess,const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType, int *pss = NULL);326 bool SetInitGlobalData(int offset,const Type &type,const int *SubScripts,const char *InitBuf);328 bool GetVarOffset(bool isErrorEnabled,bool isWriteAccess,const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType, Subscripts *pResultSubscripts = NULL ); 329 bool SetInitGlobalData(int offset,const Type &type,const Subscripts &subscripts,const char *InitBuf); 327 330 #define DIMFLAG_INITDEBUGVAR 0x01 328 331 #define DIMFLAG_NONCALL_CONSTRACTOR 0x02 329 332 #define DIMFLAG_STATIC 0x04 330 333 #define DIMFLAG_CONST 0x08 331 void dim( char *VarName, int *SubScripts,Type &type, const char *InitBuf,const char *ConstractParameter,DWORD dwFlags);334 void dim( char *VarName, const Subscripts &subscripts, Type &type, const char *InitBuf,const char *ConstractParameter,DWORD dwFlags); 332 335 void SetVarPtrToReg(int reg,RELATIVE_VAR *pRelativeVar); 333 336 bool Compile_AddGlobalRootsForGc(); … … 356 359 357 360 public: 358 UserProc *_OverloadSolution( const char *name, std::vector<UserProc *> &subs, bool isEnabledReturnType = false );359 UserProc *OverloadSolution( const char *name, std::vector<UserProc *> &subs, bool isEnabledReturnType = false );361 const UserProc *_OverloadSolution( const char *name, std::vector<const UserProc *> &subs, bool isEnabledReturnType = false ); 362 const UserProc *OverloadSolution( const char *name, std::vector<const UserProc *> &subs, bool isEnabledReturnType = false ); 360 363 361 364 void ApplyDefaultParameters( const Parameters ¶ms ); … … 389 392 #define PROCFLAG_NEW 1 390 393 bool Opcode_CallProcPtr(const char *variable, const char *lpszParms,ProcPointer *pProcPointer); 391 bool Opcode_CallProc(const char *Parameter, UserProc *pUserProc,DWORD dwFlags,const char *ObjectName,int RefType);394 bool Opcode_CallProc(const char *Parameter,const UserProc *pUserProc,DWORD dwFlags,const char *ObjectName,int RefType); 392 395 bool Opcode_CallDllProc( const char *lpszParms,DllProc *pDllProc); 393 396 … … 401 404 //OperatorProc.cpp 402 405 void FreeTempObject(int reg,const CClass *pobj_c); 403 int CallOperatorProc( intidCalc, const Type &baseType, int *type_stack,LONG_PTR *index_stack,BOOL *bUseHeap,int &sp);406 int CallOperatorProc(BYTE idCalc, const Type &baseType, int *type_stack,LONG_PTR *index_stack,BOOL *bUseHeap,int &sp); 404 407 void CallCastOperatorProc(int reg,Type &calcType,BOOL bCalcUseHeap,const Type &toType); 405 408 void CallIndexerGetterProc(int reg,const CClass *pobj_Class,char *ObjectName,char *Parameter,Type &resultType); … … 512 515 void op_fld_ptr_esp(int type); 513 516 void op_zero_reg(int reg); 514 void op_call( UserProc *pUserProc );515 void op_call( DllProc *pDllProc );517 void op_call( const UserProc *pUserProc ); 518 void op_call( const DllProc *pDllProc ); 516 519 void op_ret(); -
trunk/abdev/BasicCompiler64/OperatorProc.cpp
r135 r206 1 #include "stdafx.h" 2 3 #include <jenga/include/smoothie/LexicalAnalysis.h> 4 1 5 #include "../BasicCompiler_Common/common.h" 2 6 #include "Opcode.h" … … 16 20 17 21 //call DestructorProcAddr 18 op_call( method->pUserProc);22 op_call( &method->GetUserProc() ); 19 23 } 20 24 … … 23 27 24 28 //call free 25 extern UserProc *pSub_free;29 extern const UserProc *pSub_free; 26 30 op_call(pSub_free); 27 31 } 28 32 29 int CallOperatorProc( intidCalc, const Type &baseType, int *type_stack,LONG_PTR *index_stack,BOOL *bUseHeap,int &sp){33 int CallOperatorProc(BYTE idCalc, const Type &baseType, int *type_stack,LONG_PTR *index_stack,BOOL *bUseHeap,int &sp){ 30 34 //オーバーロードされたオペレータ関数を呼び出す 31 35 CClass *pobj_c; 32 36 pobj_c=(CClass *)index_stack[sp-2]; 33 37 34 std::vector< UserProc *> subs;38 std::vector<const UserProc *> subs; 35 39 pobj_c->GetMethods().Enum( idCalc, subs ); 36 40 if( subs.size() == 0 ){ … … 58 62 if(idCalc==CALC_EQUAL) lstrcpy(temporary,"=="); 59 63 else GetCalcName(idCalc,temporary); 60 UserProc *pUserProc = OverloadSolution( temporary, subs, params, baseType );64 const UserProc *pUserProc = OverloadSolution( temporary, subs, params, baseType ); 61 65 62 66 if(!pUserProc){ … … 118 122 119 123 //call calloc 120 extern UserProc *pSub_calloc;124 extern const UserProc *pSub_calloc; 121 125 op_call(pSub_calloc); 122 126 … … 319 323 void CallIndexerGetterProc(int reg,const CClass *pobj_Class,char *ObjectName,char *Parameter,Type &resultType ){ 320 324 321 std::vector< UserProc *> subs;325 std::vector<const UserProc *> subs; 322 326 pobj_Class->GetMethods().Enum( CALC_ARRAY_GET, subs ); 323 327 if( subs.size() == 0 ){ -
trunk/abdev/BasicCompiler64/Register.cpp
r131 r206 1 #include "stdafx.h" 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "Opcode.h" -
trunk/abdev/BasicCompiler64/amd64_main.cpp
r142 r206 1 #include "stdafx.h" 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "Opcode.h" … … 1791 1793 ///////////////////////////// 1792 1794 1793 void op_call( UserProc *pUserProc ){1795 void op_call( const UserProc *pUserProc ){ 1794 1796 OpBuffer[obp++] = (char)0xE8; 1795 1797 pobj_SubAddrSchedule->add( pUserProc, 1 ); … … 1797 1799 obp += sizeof(long); 1798 1800 } 1799 void op_call( DllProc *pDllProc ){1801 void op_call( const DllProc *pDllProc ){ 1800 1802 OpBuffer[obp++] = (char)0xFF; 1801 1803 OpBuffer[obp++] = (char)0x15; -
trunk/abdev/BasicCompiler64/increment.cpp
r129 r206 1 #include "stdafx.h" 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "Opcode.h" -
trunk/abdev/BasicCompiler64/stack_frame.cpp
r66 r206 1 #include "stdafx.h" 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "Opcode.h"
Note:
See TracChangeset
for help on using the changeset viewer.