1 | #include "../BasicCompiler_Common/common.h"
|
---|
2 |
|
---|
3 | #ifdef _AMD64_
|
---|
4 | #include "../BasicCompiler64/opcode.h"
|
---|
5 | #else
|
---|
6 | #include "../BasicCompiler32/opcode.h"
|
---|
7 | #endif
|
---|
8 |
|
---|
9 |
|
---|
10 | void Diagnose(){
|
---|
11 | char temporary[8192];
|
---|
12 |
|
---|
13 | // グローバル / ローカル コード領域のサイズを調べる
|
---|
14 | extern int obp;
|
---|
15 | extern int GlobalOpBufferSize;
|
---|
16 | sprintf(temporary, "%d", GlobalOpBufferSize/1024 );
|
---|
17 | Smoothie::Logger::Put( (string)"グローバル領域のコードサイズ: " + temporary + "KB" );
|
---|
18 | sprintf(temporary, "%d", (obp-GlobalOpBufferSize)/1024 );
|
---|
19 | Smoothie::Logger::Put( (string)"ローカル領域のコードサイズ: " + temporary + "KB" );
|
---|
20 |
|
---|
21 | {
|
---|
22 | // グローバル関数、クラスメソッドのサイズを調べる
|
---|
23 | int codeSizeOfGlobalProc = 0;
|
---|
24 | int codeSizeOfClassMethod = 0;
|
---|
25 | for(int i2=0;i2<MAX_HASH;i2++){
|
---|
26 | extern UserProc **ppSubHash;
|
---|
27 | UserProc *pUserProc = ppSubHash[i2];
|
---|
28 | while(pUserProc){
|
---|
29 | if( pUserProc->IsCompiled() ){
|
---|
30 | if( pUserProc->HasParentClass() ){
|
---|
31 | codeSizeOfClassMethod += pUserProc->GetCodeSize();
|
---|
32 | }
|
---|
33 | else{
|
---|
34 | codeSizeOfGlobalProc += pUserProc->GetCodeSize();
|
---|
35 | }
|
---|
36 | }
|
---|
37 |
|
---|
38 | pUserProc=pUserProc->pNextData;
|
---|
39 | }
|
---|
40 | }
|
---|
41 |
|
---|
42 | sprintf(temporary, "%d", codeSizeOfGlobalProc/1024 );
|
---|
43 | Smoothie::Logger::Put( (string)"グローバル関数のコードサイズ総量: " + temporary + "KB" );
|
---|
44 | sprintf(temporary, "%d", codeSizeOfClassMethod/1024 );
|
---|
45 | Smoothie::Logger::Put( (string)"クラスメソッドのコードサイズ総量: " + temporary + "KB" );
|
---|
46 |
|
---|
47 | Smoothie::Logger::Put( "\n\n" );
|
---|
48 | }
|
---|
49 |
|
---|
50 | {
|
---|
51 | // クラスのサイズを調べる
|
---|
52 |
|
---|
53 | // イテレータをリセット
|
---|
54 | extern CDBClass *pobj_DBClass;
|
---|
55 | pobj_DBClass->Iterator_Reset();
|
---|
56 |
|
---|
57 | while( pobj_DBClass->Iterator_HasNext() ){
|
---|
58 | int codeSizeOfClass = 0;
|
---|
59 |
|
---|
60 | CClass &objClass = *pobj_DBClass->Iterator_GetNext();
|
---|
61 |
|
---|
62 | // 動的メソッド
|
---|
63 | foreach( const CMethod &method, objClass.GetMethods() ){
|
---|
64 | if( method.pUserProc->IsCompiled() ){
|
---|
65 | codeSizeOfClass += method.pUserProc->GetCodeSize();
|
---|
66 | }
|
---|
67 | }
|
---|
68 |
|
---|
69 | // 静的メソッド
|
---|
70 | foreach( const CMethod &method, objClass.GetStaticMethods() ){
|
---|
71 | codeSizeOfClass += method.pUserProc->GetCodeSize();
|
---|
72 | }
|
---|
73 |
|
---|
74 | if( codeSizeOfClass ){
|
---|
75 | temporary[0]=0;
|
---|
76 | lstrcat( temporary, "------------------------------------------------------------------\n" );
|
---|
77 | sprintf( temporary + lstrlen(temporary), "【 %s クラスのコード情報】\n", objClass.name );
|
---|
78 | sprintf( temporary + lstrlen(temporary), "class code size: %d bytes\n", codeSizeOfClass );
|
---|
79 | lstrcat( temporary, "------------------------------------------------------------------\n" );
|
---|
80 | lstrcat( temporary, "\n" );
|
---|
81 | Smoothie::Logger::Put( temporary );
|
---|
82 | }
|
---|
83 | }
|
---|
84 |
|
---|
85 | }
|
---|
86 | }
|
---|