Changeset 75 in dev for BasicCompiler64/Compile_Object.cpp
- Timestamp:
- Mar 20, 2007, 4:36:16 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler64/Compile_Object.cpp
r73 r75 2 2 #include "opcode.h" 3 3 4 void _call_constructor( CClass *pobj_c,const char *CreateParameter,int ObjectSize,BOOL bSomeObjects){4 void _call_constructor( const CClass *pobj_c,const char *CreateParameter,int ObjectSize,BOOL bSomeObjects){ 5 5 //////////////////////////// 6 6 // コンストラクタの呼び出し … … 32 32 //////////////////////// 33 33 34 std::vector< SubInfo*> subs;34 std::vector<UserProc *> subs; 35 35 pobj_c->EnumMethod( pobj_c->name, subs ); 36 36 37 SubInfo *psi;37 UserProc *pUserProc; 38 38 if( subs.size() > 0 ){ 39 39 //オーバーロードを解決 40 p si=OverloadSolutionWithStrParam(pobj_c->name,41 subs,CreateParameter,"" ,NULL);42 43 if(!p si) return;40 pUserProc=OverloadSolutionWithStrParam(pobj_c->name, 41 subs,CreateParameter,""); 42 43 if(!pUserProc) return; 44 44 } 45 45 46 46 //コンストラクタを呼び出す 47 47 Opcode_CallProc(CreateParameter, 48 p si,48 pUserProc, 49 49 PROCFLAG_NEW,"",0); 50 50 … … 73 73 } 74 74 } 75 void Operator_New( CClass &classObj, const char *objectSizeStr, const char *parameter, const TYPEINFO &baseTypeInfo){75 void Operator_New( const CClass &classObj, const char *objectSizeStr, const char *parameter, const Type &baseType ){ 76 76 int typeSize = classObj.GetSize(); 77 77 … … 86 86 87 87 int reg=REG_RAX; 88 int type = NumOpe(®,objectSizeStr,0,0,0); 89 if(!IsWholeNumberType(type)) SetError(49,NULL,cp); 88 Type tempType; 89 NumOpe(®,objectSizeStr,Type(),tempType); 90 if( !tempType.IsWhole() ) SetError(49,NULL,cp); 90 91 91 92 //※添え字上限値であることを考慮 … … 117 118 } 118 119 119 if( baseTypeInfo.type == DEF_OBJECT ){ 120 //DeleteはGCで処理 120 if( baseType.IsObject() ){ 121 // オブジェクト インスタンス 122 // ※DeleteはGCで処理 121 123 122 124 //call _System_GC_malloc_ForObject 123 extern SubInfo*pSub_System_GC_malloc_ForObject;125 extern UserProc *pSub_System_GC_malloc_ForObject; 124 126 op_call(pSub_System_GC_malloc_ForObject); 125 127 } 126 128 else{ 127 //明示的なDeleteが必要 129 // オブジェクトポインタ 130 // ※明示的なDeleteが必要 128 131 129 132 //call _System_GC_malloc_ForObjectPtr 130 extern SubInfo*pSub_System_GC_malloc_ForObjectPtr;133 extern UserProc *pSub_System_GC_malloc_ForObjectPtr; 131 134 op_call(pSub_System_GC_malloc_ForObjectPtr); 132 135 } … … 162 165 op_mov_RV(sizeof(_int64),REG_RCX,0); 163 166 obp-=sizeof(long); 164 pobj_SubAddrSchedule->add(method->p si,0);165 method->p si->bUse=1;167 pobj_SubAddrSchedule->add(method->pUserProc,0); 168 method->pUserProc->Using(); 166 169 obp+=sizeof(long); 167 170 … … 190 193 pobj_sf->pop(REG_RAX); 191 194 } 192 int Operator_New(const char *Parameter,LONG_PTR *plpIndex,const TYPEINFO &baseTypeInfo ){193 char TypeName[VN_SIZE],CreateParameter[VN_SIZE],objectSizeStr[VN_SIZE];194 int i,i2;195 196 i=0;197 198 if(Parameter[0]=='['){199 i=GetStringInBracket(objectSizeStr,Parameter);200 201 SlideString(objectSizeStr+1,-1);202 objectSizeStr[i-2]=0;203 }204 else objectSizeStr[0]=0;205 206 for(i2=0;;i++,i2++){207 if(Parameter[i]=='('){208 TypeName[i2]=0;209 210 //コンストラクタに渡すパラメータを取得211 i2=GetStringInPare(CreateParameter,Parameter+i);212 RemoveStringPare(CreateParameter);213 i+=i2;214 if(Parameter[i]!='\0'){215 SetError(42,NULL,cp);216 return 0;217 }218 break;219 }220 TypeName[i2]=Parameter[i];221 if(Parameter[i]=='\0'){222 CreateParameter[0]=0;223 break;224 }225 }226 227 int type;228 type=GetTypeFixed(TypeName,plpIndex);229 if(type==-1){230 SetError(3,TypeName,cp);231 return 0;232 }233 234 if(type!=DEF_OBJECT){235 ////////////////////////236 // 通常のデータ型の場合237 ////////////////////////238 239 SetError(121,NULL,cp);240 return 0;241 }242 243 CClass *pobj_c;244 pobj_c=(CClass *)*plpIndex;245 246 Operator_New( *pobj_c, objectSizeStr, CreateParameter, baseTypeInfo );247 248 if( baseTypeInfo.type == DEF_OBJECT ){249 return DEF_OBJECT;250 }251 return DEF_PTR_OBJECT;252 }253 254 195 void OpcodeDelete(const char *Parameter, bool isSweeping){ 255 int type;256 257 196 int reg=REG_RAX; 258 type=NumOpe(®,Parameter,0,0,0); 259 if(type==-1) return; 260 if(!(type==DEF_PTR_OBJECT||type==DEF_PTR_VOID)) SetError(122,NULL,cp); 197 Type tempType; 198 if( !NumOpe(®,Parameter,Type(),tempType) ){ 199 return; 200 } 201 if(!( tempType.IsObjectPtr() || tempType.IsVoidPtr() )) SetError(122,NULL,cp); 261 202 262 203 //sub rax,PTR_SIZE*3 … … 328 269 if( isSweeping ){ 329 270 //call _System_GC_free_for_SweepingDelete 330 extern SubInfo*pSub_System_GC_free_for_SweepingDelete;271 extern UserProc *pSub_System_GC_free_for_SweepingDelete; 331 272 op_call(pSub_System_GC_free_for_SweepingDelete); 332 273 } 333 274 else{ 334 275 //call free 335 extern SubInfo*pSub_free;276 extern UserProc *pSub_free; 336 277 op_call(pSub_free); 337 278 }
Note:
See TracChangeset
for help on using the changeset viewer.