Changeset 183 in dev for trunk/abdev/BasicCompiler64
- Timestamp:
- Jun 24, 2007, 6:50:40 PM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler64
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler64/BasicCompiler.vcproj
r169 r183 79 79 Name="VCLinkerTool" 80 80 AdditionalOptions="/MACHINE:AMD64" 81 AdditionalDependencies="comctl32.lib psapi.lib bufferoverflowu.lib commond.lib "81 AdditionalDependencies="comctl32.lib psapi.lib bufferoverflowu.lib commond.lib smoothied.lib" 82 82 OutputFile="../ActiveBasic/BasicCompiler64.exe" 83 83 LinkIncremental="2" … … 153 153 Optimization="2" 154 154 InlineFunctionExpansion="2" 155 EnableIntrinsicFunctions="true" 155 156 FavorSizeOrSpeed="1" 156 AdditionalIncludeDirectories="..\..\;..\..\cpplibs\ boost;..\BasicCompiler_Common\include"157 AdditionalIncludeDirectories="..\..\;..\..\cpplibs\STLPort;..\..\cpplibs\boost;..\BasicCompiler_Common\include" 157 158 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;JPN;_AMD64_;_WIN64" 158 159 MinimalRebuild="false" … … 187 188 Name="VCLinkerTool" 188 189 AdditionalOptions="/MACHINE:AMD64" 189 AdditionalDependencies="comctl32.lib psapi.lib bufferoverflowu.lib common.lib "190 AdditionalDependencies="comctl32.lib psapi.lib bufferoverflowu.lib common.lib smoothie.lib" 190 191 OutputFile="../ActiveBasic/BasicCompiler64.exe" 191 192 LinkIncremental="1" … … 275 276 </Filter> 276 277 <Filter 277 Name="Common Classes"278 >279 <File280 RelativePath="..\BasicCompiler_Common\include\Smoothie.h"281 >282 </File>283 <Filter284 Name="Meta Parts"285 >286 <File287 RelativePath="..\BasicCompiler_Common\include\Namespace.h"288 >289 </File>290 <File291 RelativePath="..\BasicCompiler_Common\Parameter.h"292 >293 </File>294 <File295 RelativePath="..\BasicCompiler_Common\Procedure.h"296 >297 </File>298 <File299 RelativePath="..\BasicCompiler_Common\include\Symbol.h"300 >301 </File>302 <File303 RelativePath="..\BasicCompiler_Common\Type.h"304 >305 </File>306 <File307 RelativePath="..\BasicCompiler_Common\TypeDef.h"308 >309 </File>310 <File311 RelativePath="..\BasicCompiler_Common\Variable.h"312 >313 </File>314 <Filter315 Name="Prototype"316 >317 <File318 RelativePath="..\BasicCompiler_Common\include\Class.h"319 >320 </File>321 <File322 RelativePath="..\BasicCompiler_Common\include\Member.h"323 >324 </File>325 <File326 RelativePath="..\BasicCompiler_Common\include\Method.h"327 >328 </File>329 <File330 RelativePath="..\BasicCompiler_Common\include\Prototype.h"331 >332 </File>333 </Filter>334 </Filter>335 <Filter336 Name="Lexical Parts"337 >338 <File339 RelativePath="..\BasicCompiler_Common\include\Source.h"340 >341 </File>342 </Filter>343 <Filter344 Name="Operation Statements"345 >346 <File347 RelativePath="..\BasicCompiler_Common\include\Exception.h"348 >349 </File>350 </Filter>351 <Filter352 Name="Module"353 >354 <File355 RelativePath="..\BasicCompiler_Common\include\ObjectModule.h"356 >357 </File>358 </Filter>359 </Filter>360 <Filter361 278 Name="Application Classes" 362 279 > 280 <File 281 RelativePath="..\BasicCompiler_Common\include\ClassImpl.h" 282 > 283 </File> 284 <File 285 RelativePath="..\BasicCompiler_Common\include\CodeGenerator.h" 286 > 287 </File> 288 <File 289 RelativePath="..\BasicCompiler_Common\include\Compiler.h" 290 > 291 </File> 292 <File 293 RelativePath="..\BasicCompiler_Common\include\DataTable.h" 294 > 295 </File> 296 <File 297 RelativePath="..\BasicCompiler_Common\include\Exception.h" 298 > 299 </File> 300 <File 301 RelativePath="..\BasicCompiler_Common\include\LexicalScopingImpl.h" 302 > 303 </File> 304 <File 305 RelativePath="..\BasicCompiler_Common\include\ProcedureImpl.h" 306 > 307 </File> 363 308 <File 364 309 RelativePath="..\BasicCompiler_Common\include\Program.h" … … 919 864 > 920 865 <File 921 RelativePath="..\BasicCompiler_Common\DataTable.cpp"922 >923 </File>924 <File925 RelativePath="..\BasicCompiler_Common\LoopRefCheck.cpp"926 >927 </File>928 <File929 866 RelativePath="..\BasicCompiler_Common\NonVolatile.cpp" 930 867 > … … 993 930 > 994 931 <File 995 RelativePath="..\BasicCompiler_Common\Class.cpp"996 >997 </File>998 <File999 RelativePath="..\BasicCompiler_Common\Class.h"1000 >1001 </File>1002 <File1003 932 RelativePath="..\BasicCompiler_Common\Enum.cpp" 1004 933 > … … 1022 951 </Filter> 1023 952 <Filter 1024 Name="LexicalScoping"1025 >1026 <File1027 RelativePath="..\BasicCompiler_Common\LexicalScoping.cpp"1028 >1029 </File>1030 <File1031 RelativePath="..\BasicCompiler_Common\LexicalScoping.h"1032 >1033 </File>1034 </Filter>1035 <Filter1036 953 Name="Constant" 1037 954 > … … 1066 983 <File 1067 984 RelativePath="..\BasicCompiler_Common\Subroutine.cpp" 1068 >1069 </File>1070 </Filter>1071 </Filter>1072 <Filter1073 Name="Common Classes"1074 >1075 <File1076 RelativePath="..\BasicCompiler_Common\src\Smoothie.cpp"1077 >1078 </File>1079 <Filter1080 Name="Meta Parts"1081 >1082 <File1083 RelativePath="..\BasicCompiler_Common\src\Member.cpp"1084 >1085 </File>1086 <File1087 RelativePath="..\BasicCompiler_Common\src\Method.cpp"1088 >1089 </File>1090 <File1091 RelativePath="..\BasicCompiler_Common\src\Namespace.cpp"1092 >1093 </File>1094 <File1095 RelativePath="..\BasicCompiler_Common\Procedure.cpp"1096 >1097 </File>1098 <File1099 RelativePath="..\BasicCompiler_Common\src\Prototype.cpp"1100 >1101 </File>1102 <File1103 RelativePath="..\BasicCompiler_Common\src\Symbol.cpp"1104 >1105 </File>1106 <File1107 RelativePath="..\BasicCompiler_Common\Type.cpp"1108 >1109 </File>1110 <File1111 RelativePath="..\BasicCompiler_Common\TypeDef.cpp"1112 >1113 </File>1114 <File1115 RelativePath="..\BasicCompiler_Common\Variable.cpp"1116 >1117 </File>1118 </Filter>1119 <Filter1120 Name="Lexical Parts"1121 >1122 <File1123 RelativePath="..\BasicCompiler_Common\src\Source.cpp"1124 >1125 </File>1126 </Filter>1127 <Filter1128 Name="Operation Statements"1129 >1130 <File1131 RelativePath="..\BasicCompiler_Common\src\Exception.cpp"1132 985 > 1133 986 </File> … … 1138 991 > 1139 992 <File 993 RelativePath="..\BasicCompiler_Common\src\ClassImpl.cpp" 994 > 995 </File> 996 <File 997 RelativePath="..\BasicCompiler_Common\src\CodeGenerator.cpp" 998 > 999 </File> 1000 <File 1001 RelativePath="..\BasicCompiler_Common\src\Compiler.cpp" 1002 > 1003 </File> 1004 <File 1005 RelativePath="..\BasicCompiler_Common\src\DataTable.cpp" 1006 > 1007 </File> 1008 <File 1009 RelativePath="..\BasicCompiler_Common\src\Exception.cpp" 1010 > 1011 </File> 1012 <File 1013 RelativePath="..\BasicCompiler_Common\src\LexicalScopingImpl.cpp" 1014 > 1015 </File> 1016 <File 1017 RelativePath="..\BasicCompiler_Common\src\ProcedureImpl.cpp" 1018 > 1019 </File> 1020 <File 1140 1021 RelativePath="..\BasicCompiler_Common\src\Program.cpp" 1022 > 1023 </File> 1024 <File 1025 RelativePath="..\BasicCompiler_Common\src\SmoothieImpl.cpp" 1141 1026 > 1142 1027 </File> -
trunk/abdev/BasicCompiler64/Compile_Calc.cpp
r159 r183 1 #include <jenga/include/smoothie/Smoothie.h> 2 #include <jenga/include/smoothie/LexicalAnalysis.h> 3 1 4 #include "../BasicCompiler_Common/common.h" 2 5 #include "Opcode.h" … … 227 230 } 228 231 229 if( varType.IsObject() && Smoothie:: meta.blittableTypes.IsExist( calcType ) ){232 if( varType.IsObject() && Smoothie::GetMeta().blittableTypes.IsExist( calcType ) ){ 230 233 // Blittable型をオブジェクトとして扱う 231 234 vector<UserProc *> userProcs; 232 Smoothie:: meta.blittableTypes.GetClass( calcType ).GetStaticMethods().Enum( "_Create", userProcs );235 Smoothie::GetMeta().blittableTypes.GetClass( calcType ).GetStaticMethods().Enum( "_Create", userProcs ); 233 236 if( userProcs.size() != 1 ){ 234 237 SetError(); -
trunk/abdev/BasicCompiler64/Compile_CallProc.cpp
r137 r183 1 #include <jenga/include/smoothie/Smoothie.h> 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "Opcode.h" … … 124 126 if(lstrcmpi(ObjectName,"Super")==0){ 125 127 //クラスメンバ関数内から基底クラスの呼び出し 126 pobj_c= pobj_CompilingClass;128 pobj_c=Smoothie::Temp::pCompilingClass; 127 129 } 128 130 else{ … … 132 134 pobj_c = &varType.GetClass(); 133 135 if( NATURAL_TYPE( varType.GetBasicType() ) != DEF_OBJECT ){ 134 pobj_c= pobj_DBClass->Find(ObjectName);136 pobj_c=Smoothie::GetMeta().GetClasses().Find(ObjectName); 135 137 if( pobj_c ){ 136 138 isStatic = true; … … 149 151 else{ 150 152 //クラスメンバ関数内から同一クラスのメンバ関数の呼び出し 151 pobj_c= pobj_CompilingClass;153 pobj_c=Smoothie::Temp::pCompilingClass; 152 154 } 153 155 } … … 178 180 if(ObjectName[0]){ 179 181 //外部からの呼び出し 180 if(pobj_c== pobj_CompilingClass){182 if(pobj_c==Smoothie::Temp::pCompilingClass){ 181 183 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 182 184 if( pMethod->IsNoneAccess() ){ -
trunk/abdev/BasicCompiler64/Compile_Func.cpp
r159 r183 1 #include <jenga/include/smoothie/Smoothie.h> 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "Opcode.h" … … 30 32 tempParm=temp2; 31 33 32 type.SetType( DEF_OBJECT, pobj_DBClass->GetStringClassPtr() );34 type.SetType( DEF_OBJECT, Smoothie::GetMeta().GetClasses().GetStringClassPtr() ); 33 35 } 34 36 … … 78 80 79 81 //オーバーロードを解決 80 pUserProc=OverloadSolution(name,subs,Smoothie:: meta.procPointers[ProcPtr_BaseIndex]->Params(), Type() );82 pUserProc=OverloadSolution(name,subs,Smoothie::GetMeta().GetProcPointers()[ProcPtr_BaseIndex]->Params(), Type() ); 81 83 82 84 if(!pUserProc){ … … 127 129 SetThisPtrToReg(REG_RCX); 128 130 129 pobj_c= pobj_CompilingClass;131 pobj_c=Smoothie::Temp::pCompilingClass; 130 132 } 131 133 -
trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp
r169 r183 1 #include <jenga/include/smoothie/Smoothie.h> 2 #include <jenga/include/smoothie/LexicalAnalysis.h> 3 1 4 #include <Program.h> 5 #include <LexicalScopingImpl.h> 6 #include <ClassImpl.h> 2 7 3 8 #include "../BasicCompiler_Common/common.h" … … 51 56 52 57 //クラスに属する静的メンバを定義 53 CMember::InitStaticMember();58 Smoothie::GetMeta().GetClasses().InitStaticMember(); 54 59 55 60 GetGlobalDataForDll(); … … 75 80 StackFrameSchedule=obp-sizeof(long); 76 81 77 foreach( Variable *pVar, globalVars ){82 BOOST_FOREACH( Variable *pVar, globalVars ){ 78 83 if(memicmp(pVar->GetName().c_str(),"Static%",7)==0){ 79 84 //コンストラクタ呼び出し … … 110 115 UserProc::CompileStartForGlobalArea(); 111 116 112 obj_LexScopes.CallDestructorsOfScopeEnd();117 GetLexicalScopes().CallDestructorsOfScopeEnd(); 113 118 114 119 UserProc::CompileStartForUserProc( pBackUserProc ); … … 210 215 && userProc.GetParentClass().GetName() == "_System_TypeBase" ){ 211 216 212 pobj_DBClass->Compile_System_InitializeUserTypes();217 Smoothie::GetMeta().GetClasses().Compile_System_InitializeUserTypes(); 213 218 } 214 219 else if( userProc.GetName() == "RegisterGlobalRoots" … … 255 260 256 261 //コンパイル中の関数が属するクラス 257 pobj_CompilingClass=pUserProc->GetParentClassPtr();262 Smoothie::Temp::pCompilingClass=pUserProc->GetParentClassPtr(); 258 263 259 264 //コンパイルスタートをクラス管理クラスに追加 260 pobj_DBClass->StartCompile( pUserProc );265 Smoothie::GetMeta().GetClasses().StartCompile( pUserProc ); 261 266 262 267 //コンパイル中の関数 … … 264 269 265 270 // コンパイル中の関数が属する名前空間 266 Smoothie:: Lexical::liveingNamespaceScopes = pUserProc->GetNamespaceScopes();271 Smoothie::Temp::liveingNamespaceScopes = pUserProc->GetNamespaceScopes(); 267 272 268 273 // コンパイル中の関数でImportsされている名前空間 … … 342 347 343 348 //レキシカルスコープ情報を初期化 344 obj_LexScopes.Init(obp);349 GetLexicalScopes().Init(obp); 345 350 346 351 … … 377 382 378 383 //レキシカルスコープ情報 379 pVar->ScopeLevel= obj_LexScopes.GetNowLevel();380 pVar->ScopeStartAddress= obj_LexScopes.GetStartAddress();384 pVar->ScopeLevel=GetLexicalScopes().GetNowLevel(); 385 pVar->ScopeStartAddress=GetLexicalScopes().GetStartAddress(); 381 386 pVar->bLiving=TRUE; 382 387 … … 504 509 } 505 510 506 if( pobj_CompilingClass){507 if( pUserProc->GetName() == pobj_CompilingClass->GetName() ){511 if(Smoothie::Temp::pCompilingClass){ 512 if( pUserProc->GetName() == Smoothie::Temp::pCompilingClass->GetName() ){ 508 513 //////////////////////////////////// 509 514 // コンストラクタをコンパイルするとき … … 511 516 512 517 //コンストラクタのコンパイル開始を通知 513 pobj_CompilingClass->NotifyStartConstructorCompile();518 Smoothie::Temp::pCompilingClass->NotifyStartConstructorCompile(); 514 519 515 520 //基底クラスかどうかの識別 516 521 //(継承元がインターフェイスの場合も基底クラスと見なす) 517 522 BOOL bThisIsSuperClass; 518 if( pobj_CompilingClass->pobj_InheritsClass==0) bThisIsSuperClass=1;519 else if( pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod() == NULL ){523 if(Smoothie::Temp::pCompilingClass->pobj_InheritsClass==0) bThisIsSuperClass=1; 524 else if( Smoothie::Temp::pCompilingClass->pobj_InheritsClass->GetConstructorMethod() == NULL ){ 520 525 //インターフェイスを継承したときはコンストラクタを持たない 521 526 bThisIsSuperClass=1; … … 536 541 temporary[i4]=basbuf[i3]; 537 542 } 538 if( pobj_CompilingClass->pobj_InheritsClass->GetName() == temporary ){543 if( Smoothie::Temp::pCompilingClass->pobj_InheritsClass->GetName() == temporary ){ 539 544 //基底クラスのコンストラクタを呼び出す 540 545 cp=i3; … … 553 558 Type dummyType; 554 559 CallProc( PROC_DEFAULT 555 , pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc556 , pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc->GetName().c_str()560 , Smoothie::Temp::pCompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc 561 , Smoothie::Temp::pCompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc->GetName().c_str() 557 562 , temporary 558 563 , dummyType ); … … 561 566 //基底クラスのコンストラクタを暗黙的に呼び出す 562 567 Opcode_CallProc("", 563 pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc,568 Smoothie::Temp::pCompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc, 564 569 0, 565 570 "", … … 569 574 570 575 //仮想関数テーブルを初期化 571 if( pobj_CompilingClass->IsExistVirtualFunctions()572 && ! pobj_CompilingClass->IsAbstract() ){576 if( Smoothie::Temp::pCompilingClass->IsExistVirtualFunctions() 577 && !Smoothie::Temp::pCompilingClass->IsAbstract() ){ 573 578 //関数テーブルに値をセット 574 int offset = (int) pobj_CompilingClass->GetVtblGlobalOffset();579 int offset = (int)Smoothie::Temp::pCompilingClass->GetVtblGlobalOffset(); 575 580 576 581 //mov rax,offset … … 591 596 592 597 //デストラクタのコンパイル開始を通知 593 pobj_CompilingClass->NotifyStartDestructorCompile();598 Smoothie::Temp::pCompilingClass->NotifyStartDestructorCompile(); 594 599 } 595 600 } … … 617 622 ////////////////////////////////////////// 618 623 619 if( pobj_CompilingClass ){620 621 if( pobj_CompilingClass->IsCompilingConstructor() ){624 if( Smoothie::Temp::pCompilingClass ){ 625 626 if( Smoothie::Temp::pCompilingClass->IsCompilingConstructor() ){ 622 627 // コンストラクタをコンパイルしていたとき 623 628 624 629 // コンストラクタのコンパイルが完了したことを通知 625 pobj_CompilingClass->NotifyFinishConstructorCompile();630 Smoothie::Temp::pCompilingClass->NotifyFinishConstructorCompile(); 626 631 } 627 632 else if( pUserProc->IsDestructor() ){ … … 631 636 632 637 // デストラクタのコンパイルが完了したことを通知 633 pobj_CompilingClass->NotifyFinishDestructorCompile();634 635 if( pobj_CompilingClass->pobj_InheritsClass){638 Smoothie::Temp::pCompilingClass->NotifyFinishDestructorCompile(); 639 640 if(Smoothie::Temp::pCompilingClass->pobj_InheritsClass){ 636 641 /* サブクラスのデストラクタをコンパイルしているときは、 637 642 基底クラスのデストラクタを呼び出す */ 638 643 639 const CMethod *method = pobj_CompilingClass->pobj_InheritsClass->GetDestructorMethod();644 const CMethod *method = Smoothie::Temp::pCompilingClass->pobj_InheritsClass->GetDestructorMethod(); 640 645 if( method ){ 641 646 Opcode_CallProc("", … … 677 682 678 683 //ローカルオブジェクト(レキシカルスコープレベル=0)の解放処理 679 obj_LexScopes.CallDestructorsOfScopeEnd();684 GetLexicalScopes().CallDestructorsOfScopeEnd(); 680 685 681 686 //プロシージャ抜け出しスケジュール(Exit Sub/Function) … … 738 743 } 739 744 HeapDefaultFree(pLocalVarAddrSchedule); 740 foreach( Variable *pVar, pUserProc->localVars ){745 BOOST_FOREACH( Variable *pVar, pUserProc->localVars ){ 741 746 //後にデバッグで利用する 742 747 pVar->offset = AllLocalVarSize + pobj_sf->GetFrameSize() - pVar->offset; -
trunk/abdev/BasicCompiler64/Compile_Statement.cpp
r135 r183 1 #include <jenga/include/smoothie/LexicalAnalysis.h> 2 3 #include <LexicalScopingImpl.h> 4 #include <Compiler.h> 5 1 6 #include "../BasicCompiler_Common/common.h" 2 7 #include "Opcode.h" … … 131 136 if(resultType.IsDouble()){ 132 137 double dbl=0; 133 offset= dataTable.Add( dbl );138 offset=Compiler::GetNativeCode().GetDataTable().Add( dbl ); 134 139 135 140 //comisd xmm0,qword ptr[data table offset] … … 145 150 else if(resultType.IsSingle()){ 146 151 float flt=0; 147 offset= dataTable.Add( flt );152 offset=Compiler::GetNativeCode().GetDataTable().Add( flt ); 148 153 149 154 //comiss xmm0,dword ptr[data table offset] … … 195 200 196 201 //レキシカルスコープをレベルアップ 197 obj_LexScopes.Start( obp, SCOPE_TYPE_IF );202 GetLexicalScopes().Start( obp, SCOPE_TYPE_IF ); 198 203 199 204 i2=CompileBuffer(ESC_ENDIF,0); 200 205 201 206 //レキシカルスコープをレベルダウン 202 obj_LexScopes.End();207 GetLexicalScopes().End(); 203 208 204 209 … … 218 223 219 224 //レキシカルスコープをレベルアップ 220 obj_LexScopes.Start( obp, SCOPE_TYPE_IF );225 GetLexicalScopes().Start( obp, SCOPE_TYPE_IF ); 221 226 222 227 CompileBuffer(ESC_ENDIF,0); 223 228 224 229 //レキシカルスコープをレベルダウン 225 obj_LexScopes.End();230 GetLexicalScopes().End(); 226 231 227 232 … … 320 325 321 326 //レキシカルスコープをレベルアップ 322 obj_LexScopes.Start( obp, SCOPE_TYPE_WHILE );327 GetLexicalScopes().Start( obp, SCOPE_TYPE_WHILE ); 323 328 324 329 //While内をコンパイル 325 330 CompileBuffer(0,COM_WEND); 326 331 327 obj_LexScopes.CallDestructorsOfScopeEnd();332 GetLexicalScopes().CallDestructorsOfScopeEnd(); 328 333 329 334 //jmp ... … … 335 340 336 341 //レキシカルスコープをレベルダウン 337 obj_LexScopes.End();342 GetLexicalScopes().End(); 338 343 339 344 *((long *)(OpBuffer+je_schedule-sizeof(long)))=obp-je_schedule; //jeジャンプ先のオフセット値 … … 457 462 458 463 //レキシカルスコープをレベルアップ 459 obj_LexScopes.Start( obp, SCOPE_TYPE_FOR );464 GetLexicalScopes().Start( obp, SCOPE_TYPE_FOR ); 460 465 461 466 //For内をコンパイル 462 467 CompileBuffer(0,COM_NEXT); 463 468 464 obj_LexScopes.CallDestructorsOfScopeEnd();469 GetLexicalScopes().CallDestructorsOfScopeEnd(); 465 470 466 471 if(szNextVariable[0]){ … … 480 485 481 486 //レキシカルスコープをレベルダウン 482 obj_LexScopes.End();487 GetLexicalScopes().End(); 483 488 484 489 *((long *)(OpBuffer+je_schedule))=obp-(je_schedule+sizeof(long)); //jeジャンプ先のオフセット値 … … 504 509 505 510 //レキシカルスコープをレベルアップ 506 obj_LexScopes.Start( obp, SCOPE_TYPE_DO );511 GetLexicalScopes().Start( obp, SCOPE_TYPE_DO ); 507 512 508 513 //Do内をコンパイル 509 514 CompileBuffer(0,COM_LOOP); 510 515 511 obj_LexScopes.CallDestructorsOfScopeEnd();516 GetLexicalScopes().CallDestructorsOfScopeEnd(); 512 517 513 518 extern char *basbuf; … … 565 570 566 571 //レキシカルスコープをレベルダウン 567 obj_LexScopes.End();572 GetLexicalScopes().End(); 568 573 569 574 *((long *)(OpBuffer+je_schedule))=obp-(je_schedule+sizeof(long)); //jmpジャンプ先のオフセット値 … … 599 604 600 605 //未解放のローカルオブジェクトのデストラクタを呼び出す 601 obj_LexScopes.CallDestructorsOfReturn();606 GetLexicalScopes().CallDestructorsOfReturn(); 602 607 603 608 //jmp ...(End Sub/Function) … … 831 836 832 837 //レキシカルスコープをレベルアップ 833 obj_LexScopes.Start( obp, SCOPE_TYPE_SELECT );838 GetLexicalScopes().Start( obp, SCOPE_TYPE_SELECT ); 834 839 835 840 //Select Case内をコンパイル … … 848 853 849 854 //レキシカルスコープをレベルダウン 850 obj_LexScopes.End();855 GetLexicalScopes().End(); 851 856 852 857 pCaseSchedule=temp_pCaseSchedule; -
trunk/abdev/BasicCompiler64/Compile_Var.cpp
r159 r183 1 #include <jenga/include/smoothie/Smoothie.h> 2 #include <jenga/include/smoothie/LexicalAnalysis.h> 3 4 #include <LexicalScopingImpl.h> 5 #include <CodeGenerator.h> 6 #include <Compiler.h> 7 1 8 #include "../BasicCompiler_Common/common.h" 2 9 #include "Opcode.h" … … 216 223 217 224 //アクセシビリティをチェック 218 if(&objClass== pobj_CompilingClass){225 if(&objClass==Smoothie::Temp::pCompilingClass){ 219 226 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 220 227 if(pMember->IsNoneAccess()){ … … 388 395 // 名前空間を分離 389 396 char namespaceStr[VN_SIZE]="", simpleName[VN_SIZE]; 390 Smoothie:: meta.namespaceScopesCollection.SplitNamespace( variable, namespaceStr, simpleName );397 Smoothie::GetMeta().namespaceScopesCollection.SplitNamespace( variable, namespaceStr, simpleName ); 391 398 392 399 // 先頭オブジェクトまたはクラス名と入れ子メンバに分割 … … 446 453 447 454 448 if( pobj_CompilingClass){455 if(Smoothie::Temp::pCompilingClass){ 449 456 ////////////////////// 450 457 // クラスメンバの参照 … … 457 464 pRelativeVar->dwKind=VAR_DIRECTMEM; 458 465 459 resultType.SetType( DEF_OBJECT, pobj_CompilingClass );466 resultType.SetType( DEF_OBJECT, Smoothie::Temp::pCompilingClass ); 460 467 return true; 461 468 } … … 470 477 471 478 bool isFound = false; 472 BOOST_FOREACH( CMember *pMember, pobj_CompilingClass->GetDynamicMembers() ){479 BOOST_FOREACH( CMember *pMember, Smoothie::Temp::pCompilingClass->GetDynamicMembers() ){ 473 480 if( pMember->GetName() == VarName ){ 474 481 isFound = true; … … 481 488 //Const修飾子のメソッド内でメンバ書き込みアクセスが発生したとき 482 489 //(コンストラクタ、デストラクタ内を除く) 483 const CMethod *pMethod = pobj_DBClass->GetNowCompilingMethodInfo();490 const CMethod *pMethod = Smoothie::GetMeta().GetClasses().GetNowCompilingMethodInfo(); 484 491 if( isWriteAccess && 485 492 pMethod->IsConst() && 486 pobj_CompilingClass->IsCompilingConstructor() == false &&487 pobj_CompilingClass->IsCompilingDestructor() == false493 Smoothie::Temp::pCompilingClass->IsCompilingConstructor() == false && 494 Smoothie::Temp::pCompilingClass->IsCompilingDestructor() == false 488 495 ){ 489 496 SetError(131, NULL, cp ); … … 497 504 isErrorEnabled, 498 505 isWriteAccess, 499 * pobj_CompilingClass,506 *Smoothie::Temp::pCompilingClass, 500 507 variable, 501 508 pRelativeVar, … … 541 548 } 542 549 543 int typeDefIndex = Smoothie:: meta.typeDefs.GetIndex( VarName );550 int typeDefIndex = Smoothie::GetMeta().typeDefs.GetIndex( VarName ); 544 551 if( typeDefIndex != -1 ){ 545 552 // TypeDef後の型名だったとき 546 lstrcpy( VarName, Smoothie:: meta.typeDefs[typeDefIndex].GetBaseName().c_str() );553 lstrcpy( VarName, Smoothie::GetMeta().typeDefs[typeDefIndex].GetBaseName().c_str() ); 547 554 } 548 555 … … 557 564 } 558 565 559 if( pobj_CompilingClass){566 if(Smoothie::Temp::pCompilingClass){ 560 567 //自身のクラスから静的メンバを参照する場合 561 568 char temp2[VN_SIZE]; 562 sprintf(temp2,"%s.%s", pobj_CompilingClass->GetName().c_str(),VarName);569 sprintf(temp2,"%s.%s",Smoothie::Temp::pCompilingClass->GetName().c_str(),VarName); 563 570 pVar = globalVars.Find( temp2 ); 564 571 if( pVar ){ … … 844 851 char *temp; 845 852 temp=(char *)i64data; 846 i2= dataTable.AddString( temp );853 i2=Compiler::GetNativeCode().GetDataTable().AddString( temp ); 847 854 HeapDefaultFree(temp); 848 855 … … 994 1001 char *temp; 995 1002 temp=(char *)i64data; 996 i2= dataTable.AddString( temp );1003 i2=Compiler::GetNativeCode().GetDataTable().AddString( temp ); 997 1004 HeapDefaultFree(temp); 998 1005 … … 1086 1093 1087 1094 //レキシカルスコープ 1088 pVar->ScopeLevel= obj_LexScopes.GetNowLevel();1089 pVar->ScopeStartAddress= obj_LexScopes.GetStartAddress();1095 pVar->ScopeLevel=GetLexicalScopes().GetNowLevel(); 1096 pVar->ScopeStartAddress=GetLexicalScopes().GetStartAddress(); 1090 1097 pVar->bLiving=TRUE; 1091 1098 … … 1121 1128 1122 1129 //レキシカルスコープ 1123 pVar->ScopeLevel= obj_LexScopes.GetNowLevel();1124 pVar->ScopeStartAddress= obj_LexScopes.GetStartAddress();1130 pVar->ScopeLevel=GetLexicalScopes().GetNowLevel(); 1131 pVar->ScopeStartAddress=GetLexicalScopes().GetStartAddress(); 1125 1132 pVar->bLiving=TRUE; 1126 1133 -
trunk/abdev/BasicCompiler64/MakePeHdr.cpp
r169 r183 1 1 #include <jenga/include/common/Environment.h> 2 3 #include <jenga/include/smoothie/Smoothie.h> 4 5 #include <LexicalScopingImpl.h> 6 #include <ClassImpl.h> 7 #include <Compiler.h> 2 8 3 9 #include "../BasicCompiler_Common/common.h" … … 119 125 ////////////////// 120 126 // データテーブル 121 dataTable.Init();127 Compiler::GetNativeCode().GetDataTable().Init(); 122 128 if(bDebugCompile){ 123 dataTable.Add( (long)0x00000002 );129 Compiler::GetNativeCode().GetDataTable().Add( (long)0x00000002 ); 124 130 } 125 131 … … 145 151 146 152 //関数ポインタ情報を初期化 147 Smoothie:: meta.procPointers.clear();153 Smoothie::GetMeta().GetProcPointers().clear(); 148 154 149 155 // 名前空間情報を取得 150 156 NamespaceScopesCollection::CollectNamespaces( 151 157 Smoothie::Lexical::source.GetBuffer(), 152 Smoothie:: meta.namespaceScopesCollection158 Smoothie::GetMeta().namespaceScopesCollection 153 159 ); 154 160 … … 156 162 // GetSubInfo関数の中で参照されるオブジェクト名を事前に取得する。 157 163 // ※オブジェクトの内容までは取得しない 158 pobj_DBClass=new Classes(); 159 pobj_DBClass->InitNames(); 164 Smoothie::GetMeta().GetClasses().CollectClassesForNameOnly( Smoothie::Lexical::source ); 160 165 161 166 //TypeDef情報を初期化 162 Smoothie:: meta.typeDefs.Init();167 Smoothie::GetMeta().typeDefs.Init(); 163 168 164 169 //定数情報を取得 … … 166 171 167 172 //サブルーチン(ユーザー定義、DLL関数)の識別子、アドレスを取得 168 pobj_CompilingClass=0;173 Smoothie::Temp::pCompilingClass = NULL; 169 174 GetSubInfo(); 170 175 171 176 //クラス情報を取得(※注 - GetSubInfoの後に呼び出す) 172 pobj_DBClass->GetAllClassInfo();177 Smoothie::GetMeta().GetClasses().GetAllClassInfo(); 173 178 174 179 //コードと行番号の関係 … … 280 285 281 286 obp_AllocSize=8192*2; 282 OpBuffer=(char *) HeapAlloc(hHeap,HEAP_ZERO_MEMORY,obp_AllocSize);287 OpBuffer=(char *)calloc(obp_AllocSize,1); 283 288 obp=0; 284 289 … … 287 292 288 293 //レキシカルスコープ情報を初期化 289 obj_LexScopes.Init(obp);294 GetLexicalScopes().Init(obp); 290 295 291 296 … … 311 316 if(!bDll){ 312 317 // 名前空間が初期化されているかをチェック 313 if( Smoothie:: Lexical::liveingNamespaceScopes.size() ){318 if( Smoothie::Temp::liveingNamespaceScopes.size() ){ 314 319 SetError(); 315 320 } … … 362 367 363 368 //クラスに属する静的メンバを定義 364 CMember::InitStaticMember();369 Smoothie::GetMeta().GetClasses().InitStaticMember(); 365 370 366 371 //グローバル実行領域をコンパイル開始 … … 426 431 427 432 // 名前空間が正しく閉じられているかをチェック 428 if( Smoothie:: Lexical::liveingNamespaceScopes.size() ){433 if( Smoothie::Temp::liveingNamespaceScopes.size() ){ 429 434 SetError(63,NULL,-1); 430 435 } … … 793 798 //(デバッグ情報で利用される) 794 799 extern int AllInitGlobalVarSize; 795 foreach( Variable *pVar, globalVars ){800 BOOST_FOREACH( Variable *pVar, globalVars ){ 796 801 if(pVar->offset&0x80000000){ 797 802 pVar->offset=(pVar->offset&0x7FFFFFFF)+AllInitGlobalVarSize; … … 876 881 877 882 //データセクションのファイル上のサイズ 878 if( dataTable.GetSize()%FILE_ALIGNMENT) FileSize_DataSection=dataTable.GetSize()+(FILE_ALIGNMENT-dataTable.GetSize()%FILE_ALIGNMENT);879 else FileSize_DataSection= dataTable.GetSize();883 if(Compiler::GetNativeCode().GetDataTable().GetSize()%FILE_ALIGNMENT) FileSize_DataSection=Compiler::GetNativeCode().GetDataTable().GetSize()+(FILE_ALIGNMENT-Compiler::GetNativeCode().GetDataTable().GetSize()%FILE_ALIGNMENT); 884 else FileSize_DataSection=Compiler::GetNativeCode().GetDataTable().GetSize(); 880 885 if(FileSize_DataSection) bUse_DataSection=1; 881 886 else bUse_DataSection=0; … … 1066 1071 //////////////////////////////////////// 1067 1072 //仮想関数データテーブルスケジュール 1068 pobj_DBClass->ActionVtblSchedule(ImageBase,MemPos_CodeSection);1073 Smoothie::GetMeta().GetClasses().ActionVtblSchedule(ImageBase,MemPos_CodeSection); 1069 1074 1070 1075 … … 1602 1607 if(bUse_DataSection){ 1603 1608 //データ テーブル 1604 WriteFile(hFile, dataTable.GetPtr(),dataTable.GetSize(),(DWORD *)&i2,NULL);1609 WriteFile(hFile,Compiler::GetNativeCode().GetDataTable().GetPtr(),Compiler::GetNativeCode().GetDataTable().GetSize(),(DWORD *)&i2,NULL); 1605 1610 i+=i2; 1606 1611 } … … 1698 1703 1699 1704 //コードバッファを解放 1700 HeapDefaultFree(OpBuffer);1705 free(OpBuffer); 1701 1706 OpBuffer=0; 1702 1707 … … 1714 1719 1715 1720 //クラスに関するメモリを解放 1716 delete pobj_DBClass; 1717 pobj_DBClass=0; 1721 Smoothie::GetMeta().GetClasses().Clear(); 1718 1722 } -
trunk/abdev/BasicCompiler64/NumOpe.cpp
r159 r183 1 #include <jenga/include/smoothie/Smoothie.h> 2 #include <jenga/include/smoothie/LexicalAnalysis.h> 3 4 #include <Compiler.h> 5 1 6 #include "../BasicCompiler_Common/common.h" 2 7 #include "Opcode.h" … … 18 23 SetStringQuotes( parameter ); 19 24 20 Operator_New( * pobj_DBClass->GetStringClassPtr(), "", parameter, Type( DEF_OBJECT, *pobj_DBClass->GetStringClassPtr() ) );25 Operator_New( *Smoothie::GetMeta().GetClasses().GetStringClassPtr(), "", parameter, Type( DEF_OBJECT, *Smoothie::GetMeta().GetClasses().GetStringClassPtr() ) ); 21 26 22 27 free( parameter ); … … 241 246 char member[VN_SIZE]; 242 247 CClass::RefType refType; 243 if( SplitMemberName( termFull, termLeft, member, refType ) ){248 if( CClass::SplitName( termFull, termLeft, member, refType ) ){ 244 249 /////////////////////////////////////////////////////////////////// 245 250 // オブジェクトとメンバに分解できるとき … … 253 258 Type leftType; 254 259 if( GetTermType( termLeft, leftType, isLiteral, &isClassName ) ){ 255 if( isClassName == false && Smoothie:: meta.blittableTypes.IsExist( leftType ) ){260 if( isClassName == false && Smoothie::GetMeta().blittableTypes.IsExist( leftType ) ){ 256 261 // 左側のオブジェクト部分がBlittable型のとき 257 262 … … 259 264 lstrcpy( temporary, termLeft ); 260 265 sprintf( termLeft, "%s(%s)", 261 Smoothie:: meta.blittableTypes.Find( leftType ).GetCreateStaticMethodFullName().c_str(),266 Smoothie::GetMeta().blittableTypes.Find( leftType ).GetCreateStaticMethodFullName().c_str(), 262 267 temporary ); 263 268 } … … 287 292 288 293 if( pIsClassName ){ 289 if( pobj_DBClass->Find( termFull ) ){294 if( Smoothie::GetMeta().GetClasses().Find( termFull ) ){ 290 295 *pIsClassName = true; 291 296 return true; … … 304 309 if(lstrcmpi(termFull,"This")==0 && isProcedureCallOnly == false ){ 305 310 //Thisオブジェクト 306 resultType.SetType( DEF_OBJECT, pobj_CompilingClass );311 resultType.SetType( DEF_OBJECT, Smoothie::Temp::pCompilingClass ); 307 312 308 313 SetThisPtrToReg( UseReg ); … … 588 593 } 589 594 590 i2 = dataTable.AddBinary( binary, num * tempBaseType.GetSize() );595 i2 = Compiler::GetNativeCode().GetDataTable().AddBinary( binary, num * tempBaseType.GetSize() ); 591 596 592 597 //mov reg,i2 … … 768 773 769 774 type_stack[sp]=DEF_OBJECT; 770 index_stack[sp]=(LONG_PTR) pobj_DBClass->GetStringClassPtr();775 index_stack[sp]=(LONG_PTR)Smoothie::GetMeta().GetClasses().GetStringClassPtr(); 771 776 bLiteralCalculation=0; 772 777 … … 781 786 bLiteralCalculation=0; 782 787 783 i2 = dataTable.AddString( term, i3 );788 i2 = Compiler::GetNativeCode().GetDataTable().AddString( term, i3 ); 784 789 785 790 //mov reg,i2 … … 877 882 } 878 883 else{ 879 index_stack[sp] = (LONG_PTR) pobj_DBClass->GetObjectClassPtr();884 index_stack[sp] = (LONG_PTR)Smoothie::GetMeta().GetClasses().GetObjectClassPtr(); 880 885 } 881 886 … … 966 971 } 967 972 else{ 968 i3 = dataTable.Add( i64data );973 i3 = Compiler::GetNativeCode().GetDataTable().Add( i64data ); 969 974 970 975 //movlpd xmm_reg,qword ptr[data table offset] … … 995 1000 } 996 1001 else{ 997 i3= dataTable.Add( i32data );1002 i3=Compiler::GetNativeCode().GetDataTable().Add( i32data ); 998 1003 999 1004 //movss xmm_reg,dword ptr[data table offset] … … 1134 1139 1135 1140 if(resultType.IsDouble()){ 1136 i3 = dataTable.Add( i64data );1141 i3 = Compiler::GetNativeCode().GetDataTable().Add( i64data ); 1137 1142 1138 1143 //movlpd xmm_reg,qword ptr[data table offset] … … 1154 1159 memcpy(&i32data,&flt,sizeof(long)); 1155 1160 1156 i3 = dataTable.Add( i32data );1161 i3 = Compiler::GetNativeCode().GetDataTable().Add( i32data ); 1157 1162 1158 1163 //movss xmm_reg,dword ptr[data table offset] -
trunk/abdev/BasicCompiler64/NumOpe_Arithmetic.cpp
r75 r183 1 #include <Compiler.h> 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "Opcode.h" … … 452 454 double dbl; 453 455 dbl=-1; 454 i32data = dataTable.Add( dbl );456 i32data = Compiler::GetNativeCode().GetDataTable().Add( dbl ); 455 457 456 458 //mulsd xmm_reg,qword ptr[data table offset] ※data = -1 … … 474 476 float flt; 475 477 flt=-1; 476 i32data = dataTable.Add( flt );478 i32data = Compiler::GetNativeCode().GetDataTable().Add( flt ); 477 479 478 480 //mulss xmm_reg,dword ptr[data table offset] ※data = -1 -
trunk/abdev/BasicCompiler64/NumOpe_TypeOperation.cpp
r56 r183 1 #include <jenga/include/smoothie/Smoothie.h> 2 3 #include <Compiler.h> 4 1 5 #include "../BasicCompiler_Common/common.h" 2 6 #include "Opcode.h" … … 10 14 //and reg,00000000FFFFFFFFh 11 15 } 12 else if(type==DEF_INTEGER || ( isUnicode&&type==DEF_CHAR)){16 else if(type==DEF_INTEGER || (Smoothie::IsUnicode()&&type==DEF_CHAR)){ 13 17 //movsx reg64,reg16 14 18 op_movsx64_FromReg16(reg,reg); … … 18 22 op_and64_value(reg,(int)0xFFFF); 19 23 } 20 else if(type==DEF_SBYTE || ( isUnicode==false&&type==DEF_CHAR)){24 else if(type==DEF_SBYTE || (Smoothie::IsUnicode()==false&&type==DEF_CHAR)){ 21 25 //movsx reg64,reg8 22 26 op_movsx64_FromReg8(reg,reg); … … 28 32 } 29 33 void ExtendTypeTo32(int type,int reg){ 30 if(type==DEF_INTEGER || ( isUnicode&&type==DEF_CHAR)){34 if(type==DEF_INTEGER || (Smoothie::IsUnicode()&&type==DEF_CHAR)){ 31 35 //movsx reg32,reg16 32 36 op_movsx32_FromReg16(reg,reg); … … 36 40 op_and32_value(reg,(int)0xFFFF); 37 41 } 38 else if(type==DEF_SBYTE || ( isUnicode==false&&type==DEF_CHAR)){42 else if(type==DEF_SBYTE || (Smoothie::IsUnicode()==false&&type==DEF_CHAR)){ 39 43 //movsx reg32,reg8 40 44 op_movsx32_FromReg8(reg,reg); … … 46 50 } 47 51 void ExtendTypeTo16(int type,int reg){ 48 if(type==DEF_SBYTE || ( isUnicode==false&&type==DEF_CHAR)){52 if(type==DEF_SBYTE || (Smoothie::IsUnicode()==false&&type==DEF_CHAR)){ 49 53 //movsx reg16,reg8 50 54 op_movsx16_FromReg8(reg,reg); … … 85 89 int temp; 86 90 _int64 i64data=0x43f0000000000000; 87 temp= dataTable.Add( i64data );91 temp=Compiler::GetNativeCode().GetDataTable().Add( i64data ); 88 92 OpBuffer[obp++]=(char)0xF2; 89 93 OpBuffer[obp++]=(char)0x0F; … … 144 148 int temp; 145 149 long i32data=0x5f800000; 146 temp= dataTable.Add( i32data );150 temp=Compiler::GetNativeCode().GetDataTable().Add( i32data ); 147 151 OpBuffer[obp++]=(char)0xF3; 148 152 OpBuffer[obp++]=(char)0x0F;
Note:
See TracChangeset
for help on using the changeset viewer.