source: dev/trunk/ab5.0/abdev/compiler_x64/Compile_Var.cpp@ 746

Last change on this file since 746 was 746, checked in by dai, 16 years ago

[745]を64bit版にマージ。

File size: 35.7 KB
Line 
1#include "stdafx.h"
2
3#include "Opcode.h"
4
5//変数
6// TODO: xml未完成
7int AllLocalVarSize;
8
9using namespace ActiveBasic::Compiler;
10
11void SetRelativeOffset( Type &resultType, RELATIVE_VAR *pRelativeVar,const char *lpPtrOffset){
12 /////////////////////////////////////////////
13 // 先頭ポインタをr12に取得してメモリへ退避
14 /////////////////////////////////////////////
15
16 SetReg_WholeVariable(Type(DEF_INT64),pRelativeVar,REG_R11);
17
18 //mov qword ptr[rsp+offset],r11 ※スタックフレームを利用
19 pobj_sf->push(REG_R11);
20
21
22 ////////////////////////////////
23 // 添え字を計算する
24 ////////////////////////////////
25
26 int reg=REG_NON;
27 Type type;
28 NumOpe( &reg, lpPtrOffset, Type(), type );
29 if( !type.IsWhole() ){
30 compiler.errorMessenger.Output(46,NULL,cp);
31 }
32 ExtendTypeTo64(type.GetBasicType(),reg);
33
34 if(reg==REG_R14){
35 //mov r14,qword ptr[rsp+offset] ※スタックフレームを利用
36 pobj_sf->pop(REG_R14);
37 }
38
39 if( resultType.PtrLevel() ){
40 resultType.PtrLevelDown();
41
42 int typeSize = resultType.GetSize();
43 if(typeSize>=2){
44 //imul reg,i2
45 compiler.codeGenerator.op_imul_RV(sizeof(_int64),reg,typeSize);
46 }
47 }
48 else{
49 //エラー
50 compiler.errorMessenger.Output(1,NULL,cp);
51 return;
52 }
53
54
55 //////////////////////////////
56 // 先頭ポインタに添え字を加算
57 //////////////////////////////
58
59 //mov r11,qword ptr[rsp+offset] ※スタックフレームを利用
60 pobj_sf->pop(REG_R11);
61
62 //add r11,reg
63 compiler.codeGenerator.op_add_RR(REG_R11,reg);
64}
65void SetRelativeOffset( RELATIVE_VAR &relativeVar ){
66 if(relativeVar.dwKind==VAR_DIRECTMEM){
67 //mov r11,qword ptr[r11]
68 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_R11,0,MOD_BASE);
69 }
70 else{
71 //直接参照に切り替え
72 SetVarPtrToReg(REG_R12,&relativeVar);
73 relativeVar.dwKind=VAR_DIRECTMEM;
74
75 //mov r11,qword ptr[r12]
76 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE);
77 }
78}
79bool GetArrayOffset(const Subscripts &subscripts,char *array, const Type &type){
80 extern HANDLE hHeap;
81 int i,i2,i3,i4;
82 char temporary[VN_SIZE],*pParm[MAX_PARMS];
83
84 for(i=0,i2=0,i3=0;;i++,i2++){
85 if(array[i]=='('){
86 i4=GetStringInPare(temporary+i2,array+i);
87 i+=i4-1;
88 i2+=i4-1;
89 continue;
90 }
91 if(array[i]=='['){
92 i4=GetStringInBracket(temporary+i2,array+i);
93 i+=i4-1;
94 i2+=i4-1;
95 continue;
96 }
97 if(array[i]==','||array[i]=='\0'){
98 if( i3 >= (int)subscripts.size() )
99 {
100 for(i3--;i3>=0;i3--) HeapDefaultFree(pParm[i3]);
101 return false;
102 }
103
104 temporary[i2]=0;
105
106 pParm[i3]=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
107 lstrcpy(pParm[i3],temporary);
108
109 i3++;
110
111 if(array[i]=='\0'){
112 if( i3 < (int)subscripts.size() )
113 {
114 for(i3--;i3>=0;i3--) HeapDefaultFree(pParm[i3]);
115 return false;
116 }
117 break;
118 }
119
120 i2=-1;
121 continue;
122 }
123 temporary[i2]=array[i];
124 }
125
126 //mov qword ptr[rsp+offset],r11 ※スタックフレームを利用
127 pobj_sf->push(REG_R11);
128
129 //xor r12,r12
130 compiler.codeGenerator.op_zero_reg(REG_R12);
131
132 for(i=i3-1;i>=0;i--){
133 //mov qword ptr[rsp+offset],r12 ※スタックフレームを利用
134 pobj_sf->push(REG_R12);
135
136 int reg=REG_NON;
137 Type type;
138 bool isNeedHeapFreeStructure;
139 NumOpe( &reg, pParm[i], Type( DEF_LONG ), type, &isNeedHeapFreeStructure );
140 if( type.IsObject() )
141 {
142 //キャスト演算子のオーバーロードに対応する
143 CallCastOperatorProc(reg,
144 type,
145 isNeedHeapFreeStructure, Type(DEF_LONG) );
146 type.SetBasicType( DEF_LONG );
147 }
148
149 if( !type.IsWhole() )
150 {
151 compiler.errorMessenger.Output(46,NULL,cp);
152 }
153 ExtendTypeTo64( type.GetBasicType(), reg );
154
155 if(reg==REG_R14){
156 //mov r14,qword ptr[rsp+offset] ※スタックフレームを利用
157 pobj_sf->pop(REG_R14);
158 }
159
160 //mov r12,qword ptr[rsp+offset] ※スタックフレームを利用
161 pobj_sf->pop(REG_R12);
162
163 for(i2=i+1,i4=1;i2<i3;i2++) i4*=subscripts[i2]+1;
164
165 //imul reg,i4
166 compiler.codeGenerator.op_imul_RV(sizeof(_int64),reg,i4);
167
168 //add r12,reg
169 compiler.codeGenerator.op_add_RR(REG_R12,reg);
170
171 HeapDefaultFree(pParm[i]);
172 }
173
174 //imul r12,TypeSize
175 compiler.codeGenerator.op_imul_RV( sizeof(_int64), REG_R12, type.GetSize() );
176
177 //mov r11,qword ptr[rsp+offset] ※スタックフレームを利用
178 pobj_sf->pop(REG_R11);
179
180 //add r11,r12
181 compiler.codeGenerator.op_add_RR( REG_R11, REG_R12 );
182
183 return true;
184}
185bool _member_offset(bool isErrorEnabled, bool isWriteAccess, const Type &classType, const char *member, RELATIVE_VAR *pRelativeVar, Type &resultType, BOOL bPrivateAccess)
186{
187 const CClass &objClass = classType.GetClass();
188
189 //////////////////////////////////////
190 // クラス、配列の構成要素を解析する
191 //////////////////////////////////////
192
193 char VarName[VN_SIZE]; //変数名
194 char array[VN_SIZE]; //第1次配列
195 char lpPtrOffset[VN_SIZE]; //第2次配列
196 char NestMember[VN_SIZE]; //入れ子メンバ
197 ReferenceKind refType;
198 lstrcpy(VarName,member);
199 if(!GetVarFormatString(VarName,array,lpPtrOffset,NestMember,refType)) return false;
200
201
202 ////////////////////////////
203 // メンバオフセットを取得
204 ////////////////////////////
205
206 const Member *pMember = objClass.FindDynamicMember( VarName );
207 if( !pMember )
208 {
209 if(isErrorEnabled) compiler.errorMessenger.Output(103,VarName,cp);
210 return false;
211 }
212
213 int offset = objClass.GetMemberOffset( VarName );
214
215
216 //アクセシビリティをチェック
217 if( compiler.IsCompilingClass() && &objClass == &compiler.GetCompilingClass() ){
218 //同一クラスオブジェクトの場合はプライベートアクセスを容認する
219 if(pMember->IsNoneAccess()){
220 if(isErrorEnabled) compiler.errorMessenger.Output(107,VarName,cp);
221 return false;
222 }
223 }
224 else{
225 if((bPrivateAccess==0&&pMember->IsPrivate())||
226 pMember->IsNoneAccess()){
227 if(isErrorEnabled) compiler.errorMessenger.Output(107,VarName,cp);
228 return false;
229 }
230 else if(bPrivateAccess==0&&pMember->IsProtected()){
231 if(isErrorEnabled) compiler.errorMessenger.Output(108,VarName,cp);
232 return false;
233 }
234 }
235
236 //Const定義の場合は書き込みアクセスを制限する
237 //※コンストラクタをコンパイル中の場合は例外的に許可する
238 if( pMember->IsConst() && //定数メンバである
239 isWriteAccess && //書き込みアクセスを要求されている
240 objClass.IsCompilingConstructor() == false //コンストラクタ コンパイル中を除く
241 ){
242 //Const定義の変数に書き込みアクセスをしようとした場合
243 compiler.errorMessenger.Output(61,VarName,cp);
244 }
245
246 resultType = pMember->GetType();
247
248 // 型パラメータを解決
249 ResolveFormalGenericTypeParameter( resultType, classType );
250
251 //ポインタ変数の場合
252 if( resultType.IsPointer() ){
253 if( pMember->GetSubscripts().size() == 0 ){
254 lstrcpy(lpPtrOffset,array);
255 array[0]=0;
256 }
257 }
258 else{
259 if(lpPtrOffset[0]){
260 if(isErrorEnabled) compiler.errorMessenger.Output(16,member,cp);
261 return false;
262 }
263 }
264
265 if(offset){
266 //add r11,offset
267 compiler.codeGenerator.op_add_RV( REG_R11, offset );
268 }
269
270 if(array[0]){
271 //配列オフセット
272 if(!GetArrayOffset(pMember->GetSubscripts(),array,pMember->GetType())){
273 if(isErrorEnabled) compiler.errorMessenger.Output(14,member,cp);
274 return false;
275 }
276 }
277 else if( pMember->GetSubscripts().size() > 0 ){
278 resultType.SetBasicType( resultType.GetBasicType() | FLAG_PTR );
279 }
280
281 if(NestMember[0]){
282 //入れ子構造の場合
283
284 if( resultType.IsObject() || resultType.IsStruct() ){
285 if( refType != RefDot ){
286 if(isErrorEnabled) compiler.errorMessenger.Output(104,member,cp);
287 return false;
288 }
289
290 if( resultType.IsObject() ){
291 // 参照内容へのポインタを抽出
292 SetRelativeOffset( *pRelativeVar );
293 }
294 }
295 else if( resultType.IsObjectPtr() || resultType.IsStructPtr() ){
296 //構造体ポインタ型メンバ変数
297
298 if(lpPtrOffset[0]){
299 //pObj[n].member
300 if( ( resultType.IsObjectPtr() || resultType.IsStructPtr() )
301 && refType != RefDot ){
302 if(isErrorEnabled) compiler.errorMessenger.Output(104,member,cp);
303 return false;
304 }
305
306 //直接参照に切り替え
307 SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset);
308 pRelativeVar->dwKind=VAR_DIRECTMEM;
309
310 lpPtrOffset[0]=0;
311 }
312 else{
313 //pObj->member
314 if( (resultType.IsObjectPtr() || resultType.IsStructPtr() )
315 && refType != RefPointer ){
316 if(isErrorEnabled) compiler.errorMessenger.Output(104,member,cp);
317 return false;
318 }
319
320 SetRelativeOffset( *pRelativeVar );
321 }
322 }
323 else if( resultType.GetBasicType() == MAKE_PTR_TYPE(DEF_OBJECT,2)
324 || resultType.GetBasicType() == MAKE_PTR_TYPE(DEF_STRUCT,2)){
325 //構造体ポインタのポインタ型メンバ変数
326
327 if(lpPtrOffset[0]){
328 //ppObj[n]->member
329 if( refType != RefPointer ){
330 if(isErrorEnabled) compiler.errorMessenger.Output(104,member,cp);
331 return false;
332 }
333
334 //直接参照に切り替え
335 SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset);
336 pRelativeVar->dwKind=VAR_DIRECTMEM;
337
338 lpPtrOffset[0]=0;
339
340 //mov r11,qword ptr[r11]
341 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_R11,0,MOD_BASE);
342 }
343 else{
344 if(isErrorEnabled) compiler.errorMessenger.Output(104,member,cp);
345 return false;
346 }
347 }
348
349 if(!_member_offset(
350 isErrorEnabled,
351 isWriteAccess,
352 pMember->GetType(),
353 NestMember,
354 pRelativeVar,
355 resultType,
356 0)) return false;
357 }
358
359 if(lpPtrOffset[0]){
360 SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset);
361 pRelativeVar->dwKind=VAR_DIRECTMEM;
362 }
363
364 return true;
365}
366
367int LocalVar_ThisPtrOffset;
368void SetThisPtrToReg(int reg){
369 //自身のオブジェクトのThisポインタをregにコピー
370
371 RELATIVE_VAR RelativeVar;
372 RelativeVar.dwKind=VAR_LOCAL;
373 RelativeVar.bOffsetOffset=0;
374 RelativeVar.offset=-LocalVar_ThisPtrOffset;
375
376 SetReg_WholeVariable(Type(DEF_PTR_VOID),&RelativeVar,reg);
377}
378bool GetVarOffset(bool isErrorEnabled,bool isWriteAccess,const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType, Subscripts *pResultSubscripts ){
379 char variable[VN_SIZE];
380
381 if(NameBuffer[0]=='.'){
382 GetWithName(variable);
383 lstrcat(variable,NameBuffer);
384 }
385 else lstrcpy(variable,NameBuffer);
386
387 // 名前空間を分離
388 char namespaceStr[VN_SIZE]="", simpleName[VN_SIZE];
389 compiler.GetObjectModule().meta.GetNamespaces().SplitNamespace( variable, namespaceStr, simpleName );
390
391 // 先頭オブジェクトまたはクラス名と入れ子メンバに分割
392 ReferenceKind refType;
393 char member[VN_SIZE],array[VN_SIZE],lpPtrOffset[VN_SIZE];
394 GetVarFormatString(simpleName,array,lpPtrOffset,member,refType);
395
396 // 名前空間を分離していた場合は結合
397 char VarName[VN_SIZE];
398 if( namespaceStr[0] ){
399 sprintf( VarName, "%s.%s", namespaceStr, simpleName );
400 }
401 else{
402 lstrcpy( VarName, simpleName );
403 }
404
405 const Subscripts *pSubscripts;
406 bool bConst = false;
407
408
409 if( compiler.IsLocalAreaCompiling() ){
410 //////////////////
411 // ローカル変数
412 //////////////////
413
414 const Variable *pVar = compiler.GetCompilingUserProc().GetLocalVars().BackSearch(
415 LexicalAnalyzer::FullNameToSymbol( VarName ),
416 compiler.codeGenerator.lexicalScopes.GetNowLevel()
417 );
418 if( pVar ){
419 //ポインタ変数の場合
420 if( pVar->GetType().IsPointer() ){
421 if( !pVar->IsArray() ){
422 lstrcpy(lpPtrOffset,array);
423 array[0]=0;
424 }
425 }
426 else{
427 if(lpPtrOffset[0]){
428 compiler.errorMessenger.Output(16,variable,cp);
429 pRelativeVar->dwKind=NON_VAR;
430 return false;
431 }
432 }
433
434 pRelativeVar->offset=-pVar->GetOffsetAddress();
435 pRelativeVar->bOffsetOffset=0;
436 if( pVar->IsRef() || pVar->IsByValStructParameter() )
437 {
438 // 参照型
439 pRelativeVar->dwKind = VAR_REFLOCAL;
440 }
441 else pRelativeVar->dwKind=VAR_LOCAL;
442 resultType = pVar->GetType();
443 pSubscripts = &pVar->GetSubscripts();
444 bConst = pVar->IsConst();
445
446 /////////////////////////////////////////////////////////
447 // ☆★☆ ジェネリクスサポート ☆★☆
448
449 if( resultType.IsTypeParameter() )
450 {
451 // 型パラメータだったとき
452
453 int ptrLevel = PTR_LEVEL( resultType.GetBasicType() );
454
455 // 制約クラス(指定されていないときはObjectクラス)にセットする
456 resultType.SetBasicType( DEF_OBJECT );
457
458 for( int i=0; i<ptrLevel; i++ )
459 {
460 resultType.PtrLevelUp();
461 }
462 }
463
464 //
465 /////////////////////////////////////////////////////////
466
467 goto ok;
468 }
469 }
470
471 if( compiler.IsCompilingClass() ){
472 //////////////////////
473 // クラスメンバの参照
474 //////////////////////
475
476 if(lstrcmpi(variable,"This")==0){
477 //自身のオブジェクトのThisポインタをr11にコピー
478 SetThisPtrToReg(REG_R11);
479
480 pRelativeVar->dwKind=VAR_DIRECTMEM;
481
482 resultType.SetType( DEF_OBJECT, &compiler.GetCompilingClass() );
483 return true;
484 }
485
486 if(memicmp(variable,"This.",5)==0){
487 //Thisオブジェクトのメンバを参照するとき
488 SlideString(variable+5,-5);
489 lstrcpy(VarName,variable);
490 }
491 else{
492 //クラス内の動的メンバを参照するとき(通常)
493
494 if( !compiler.GetCompilingClass().HasDynamicMember( VarName ) )
495 {
496 goto NonClassMember;
497 }
498 }
499
500 //Const修飾子のメソッド内でメンバ書き込みアクセスが発生したとき
501 //(コンストラクタ、デストラクタ内を除く)
502 const CMethod *pMethod = &compiler.GetCompilingUserProc().GetMethod();
503 if( isWriteAccess &&
504 pMethod->IsConst() &&
505 compiler.GetCompilingClass().IsCompilingConstructor() == false &&
506 compiler.GetCompilingClass().IsCompilingDestructor() == false
507 ){
508 compiler.errorMessenger.Output(131, NULL, cp );
509 }
510
511 //自身のオブジェクトのThisポインタをr11にコピー
512 SetThisPtrToReg(REG_R11);
513
514 pRelativeVar->dwKind=VAR_DIRECTMEM;
515 if(!_member_offset(
516 isErrorEnabled,
517 isWriteAccess,
518 Type( DEF_OBJECT, compiler.GetCompilingClass() ),
519 variable,
520 pRelativeVar,
521 resultType,1)) return false;
522 return true;
523 }
524
525NonClassMember:
526
527 {
528 const Variable *pVar;
529
530 //////////////////////////
531 // 静的ローカル変数
532 // ※"Static.Object.Method.Variable"
533 //////////////////////////
534
535 char temporary[VN_SIZE];
536 if( compiler.IsLocalAreaCompiling() ){
537 GetNowStaticVarFullName(VarName,temporary);
538
539 pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( LexicalAnalyzer::FullNameToSymbol( temporary ) );
540 if( pVar ){
541 goto GlobalOk;
542 }
543 }
544
545
546 //////////////////////////
547 // クラスの静的メンバ
548 //////////////////////////
549
550 if(member[0]){
551 lstrcpy(temporary,member);
552
553 // TODO: 名前空間を考慮したコードになっていない
554
555 char tempMember[VN_SIZE];
556 char tempArray[VN_SIZE];
557 {
558 ReferenceKind refType;
559 GetVarFormatString(temporary,tempArray,lpPtrOffset,tempMember, refType );
560 }
561
562 const TypeDef *pTypeDef = compiler.GetObjectModule().meta.GetTypeDefs().Find(
563 LexicalAnalyzer::FullNameToSymbol( VarName )
564 );
565 if( pTypeDef )
566 {
567 // TypeDef後の型名だったとき
568 lstrcpy( VarName, pTypeDef->GetBaseName().c_str() );
569 }
570
571 char temp2[VN_SIZE];
572 sprintf(temp2,"%s.%s",VarName,temporary);
573 pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( LexicalAnalyzer::FullNameToSymbol( temp2 ) );
574 if( pVar ){
575 lstrcpy(member,tempMember);
576 lstrcpy(array,tempArray);
577 goto GlobalOk;
578 }
579 }
580
581 if( compiler.IsCompilingClass() ){
582 //自身のクラスから静的メンバを参照する場合
583 char temp2[VN_SIZE];
584 sprintf(temp2,"%s.%s",compiler.GetCompilingClass().GetName().c_str(),VarName);
585 pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( LexicalAnalyzer::FullNameToSymbol( temp2 ) );
586 if( pVar ){
587 goto GlobalOk;
588 }
589 }
590
591 /////////////////////
592 // グローバル変数
593 /////////////////////
594
595 pVar = compiler.GetObjectModule().meta.GetGlobalVars().BackSearch(
596 LexicalAnalyzer::FullNameToSymbol( VarName ),
597 compiler.codeGenerator.lexicalScopes.GetNowLevel()
598 );
599 if( pVar ){
600 goto GlobalOk;
601 }
602
603 if(isErrorEnabled) compiler.errorMessenger.Output(3,variable,cp);
604 pRelativeVar->dwKind=NON_VAR;
605 return false;
606
607
608
609GlobalOk:
610 //ポインタ変数の場合
611 if( pVar->GetType().IsPointer() ){
612 if( !pVar->IsArray() ){
613 lstrcpy(lpPtrOffset,array);
614 array[0]=0;
615 }
616 }
617 else{
618 if(lpPtrOffset[0]){
619 compiler.errorMessenger.Output(16,variable,cp);
620 pRelativeVar->dwKind=NON_VAR;
621 return false;
622 }
623 }
624
625 pRelativeVar->offset=pVar->GetOffsetAddress();
626 pRelativeVar->bOffsetOffset=0;
627 if( pVar->IsRef() ){
628 // 参照型
629 pRelativeVar->dwKind = VAR_REFGLOBAL;
630 }
631 else pRelativeVar->dwKind=VAR_GLOBAL;
632 resultType = pVar->GetType();
633 pSubscripts=&pVar->GetSubscripts();
634 bConst = pVar->IsConst();
635 }
636
637
638
639ok:
640
641 if( bConst && isWriteAccess ){
642 //Const定義の変数に書き込みアクセスをしようとした場合
643 if( resultType.IsObject() ){
644 //オブジェクト定数
645 compiler.errorMessenger.Output(130, VarName, cp );
646 }
647 else{
648 //一般のConst変数
649 compiler.errorMessenger.Output(61,VarName,cp);
650 }
651 }
652
653 if( array[0] == 0 && pSubscripts->size() > 0 ){
654 //配列の先頭ポインタを示す場合
655 resultType.SetBasicType( resultType.GetBasicType() | FLAG_PTR );
656
657 if( pResultSubscripts )
658 {
659 (*pResultSubscripts) = *pSubscripts;
660 }
661 return true;
662 }
663
664 if( array[0] || member[0] ){
665 //xor r11,r11(r11を0に初期化する)
666 //※r11は変数ベースアドレスからの相対オフセットを示す
667 compiler.codeGenerator.op_zero_reg(REG_R11);
668
669 pRelativeVar->bOffsetOffset=1;
670 }
671 if(array[0]){
672 if(!GetArrayOffset(*pSubscripts,array,resultType)){
673 compiler.errorMessenger.Output(14,variable,cp);
674 pRelativeVar->dwKind=NON_VAR;
675 return false;
676 }
677 }
678 if(member[0]){
679 if( resultType.IsObject() || resultType.IsStruct() ){
680 //実態オブジェクトのメンバを参照(obj.member)
681 if( refType != RefDot ){
682 compiler.errorMessenger.Output(104,VarName,cp);
683 pRelativeVar->dwKind=NON_VAR;
684 return false;
685 }
686
687 if( resultType.IsObject() ){
688 // 参照内容へのポインタを抽出
689 SetRelativeOffset( *pRelativeVar );
690 }
691 }
692 else if( resultType.IsObjectPtr() || resultType.IsStructPtr() ){
693 //ポインタオブジェクトが示すメンバを参照
694 if(lpPtrOffset[0]){
695 //pObj[n].member
696 if( refType != RefDot ){
697 compiler.errorMessenger.Output(104,VarName,cp);
698 pRelativeVar->dwKind=NON_VAR;
699 return false;
700 }
701 SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset);
702 pRelativeVar->dwKind=VAR_DIRECTMEM;
703 }
704 else{
705 //pObj->member
706 if( refType != RefPointer ){
707 compiler.errorMessenger.Output(104,VarName,cp);
708 pRelativeVar->dwKind=NON_VAR;
709 return false;
710 }
711
712 SetVarPtrToReg(REG_R12,pRelativeVar);
713 pRelativeVar->dwKind=VAR_DIRECTMEM;
714
715 //mov r11,qword ptr[r12]
716 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE);
717 }
718 }
719 else if( resultType.GetBasicType()==MAKE_PTR_TYPE(DEF_OBJECT,2) || resultType.GetBasicType()==MAKE_PTR_TYPE(DEF_STRUCT,2)){
720 //ポインタオブジェクトが示すメンバを参照
721 if(lpPtrOffset[0]){
722 //ppObj[n]->member
723 if( refType != RefPointer ){
724 compiler.errorMessenger.Output(104,VarName,cp);
725 pRelativeVar->dwKind=NON_VAR;
726 return false;
727 }
728
729 SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset);
730 pRelativeVar->dwKind=VAR_DIRECTMEM;
731
732
733 SetVarPtrToReg(REG_R12,pRelativeVar);
734
735 //mov r11,qword ptr[r12]
736 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE);
737 }
738 else{
739 compiler.errorMessenger.Output(104,VarName,cp);
740 pRelativeVar->dwKind=NON_VAR;
741 return false;
742 }
743 }
744 else{
745 compiler.errorMessenger.Output(102,VarName,cp);
746 pRelativeVar->dwKind=NON_VAR;
747 return false;
748 }
749
750 if(!_member_offset(
751 isErrorEnabled,
752 isWriteAccess,
753 resultType,
754 member,pRelativeVar,resultType,0)) return false;
755
756 return true;
757 }
758
759 if(lpPtrOffset[0]){
760 SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset);
761 pRelativeVar->dwKind=VAR_DIRECTMEM;
762 }
763
764 return true;
765}
766
767bool SetInitGlobalData(int offset,const Type &type,const Subscripts &subscripts,const char *lpszInitBuf){
768 int i2,i3;
769 char temporary[VN_SIZE];
770 char InitBuf[VN_SIZE];
771 lstrcpy( InitBuf, lpszInitBuf );
772
773 if(InitBuf[0]=='['){
774 SlideString(InitBuf+1,-1);
775 InitBuf[lstrlen(InitBuf)-1]=0;
776
777 int typeSize = type.GetSize();
778
779 if( subscripts.size() > 0 ){
780 Subscripts nestSubscripts;
781 for( int i=1; i<(int)subscripts.size(); i++ )
782 {
783 nestSubscripts.push_back( subscripts[i] );
784 }
785
786 typeSize*=JumpSubScripts( nestSubscripts );
787 {
788 int i=0;
789 i2=0;
790 while(1){
791 if( subscripts[0] < i2 ){
792 compiler.errorMessenger.Output(41,0,cp);
793 return 0;
794 }
795 i=GetOneParameter(InitBuf,i,temporary);
796 if(!SetInitGlobalData(
797 offset+i2*typeSize,
798 type,
799 nestSubscripts,
800 temporary)) return false;
801 i2++;
802 if(InitBuf[i]=='\0') break;
803 }
804 }
805 return true;
806 }
807
808 if(type.IsStruct()){
809 const CClass &objClass = type.GetClass();
810
811 int i = 0;
812 BOOST_FOREACH( Member *pMember, objClass.GetDynamicMembers() ){
813 if(InitBuf[i]=='\0'){
814 compiler.errorMessenger.Output(41,0,cp);
815 return false;
816 }
817
818 i=GetOneParameter(InitBuf,i,temporary);
819
820 i3=objClass.GetMemberOffset( pMember->GetName().c_str() );
821
822 if(!SetInitGlobalData(offset+i3,
823 pMember->GetType(),
824 pMember->GetSubscripts(),
825 temporary)) return false;
826 }
827 return true;
828 }
829
830 compiler.errorMessenger.Output(41,0,cp);
831 return false;
832 }
833
834
835 ///////////////////////////////////////
836 // 単発式([]で囲まれていない)
837 ///////////////////////////////////////
838
839 if( subscripts.size() > 0 ){
840 compiler.errorMessenger.Output(41,0,cp);
841 return false;
842 }
843
844 double dbl;
845 _int64 i64data;
846 Type calcType;
847
848 if( !StaticCalculation(false, InitBuf,type.GetBasicType(),&i64data,calcType) ){
849 //動的データだった場合
850 return false;
851 }
852 if( calcType.IsReal() ){
853 memcpy(&dbl,&i64data,sizeof(double));
854 i64data=(_int64)dbl;
855 }
856 else dbl=(double)i64data;
857
858 //型チェック
859 CheckDifferentType(
860 type,
861 calcType,
862 0,0);
863
864 if( type.IsDouble() ){
865 compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite(
866 offset,
867 (const char *)&dbl,
868 sizeof(double)
869 );
870 }
871 else if( type.IsSingle() ){
872 float flt = (float)dbl;
873 compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite(
874 offset,
875 (const char *)&flt,
876 sizeof(float)
877 );
878 }
879 else if( type.Is64() || type.IsPointer() ){
880 if( type.GetBasicType() == typeOfPtrChar && type.GetIndex() == LITERAL_STRING ){
881 //文字列定数のとき
882
883 char *temp;
884 temp=(char *)i64data;
885 i2 = compiler.AddStringToDataTable( temp );
886 HeapDefaultFree(temp);
887
888 //mov rax,DataPos
889 compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RAX,i2, Schedule::DataTable );
890
891 //mov qword ptr[offset],rax
892 compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RAX,0,offset,MOD_DISP32, Schedule::GlobalVar );
893 }
894 else{
895 compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite(
896 offset,
897 (const char *)&i64data,
898 sizeof(_int64)
899 );
900 }
901 }
902 else if( type.IsDWord() || type.IsLong() ){
903 long l = (long)i64data;
904 compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite(
905 offset,
906 (const char *)&l,
907 sizeof(long)
908 );
909 }
910 else if( type.IsWord() || type.IsInteger() ){
911 short s = (short)i64data;
912 compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite(
913 offset,
914 (const char *)&s,
915 sizeof(short)
916 );
917 }
918 else if( type.IsSByte() || type.IsByte() || type.IsBoolean() ){
919 char c = (char)i64data;
920 compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite(
921 offset,
922 (const char *)&c,
923 sizeof(char)
924 );
925 }
926
927 return true;
928}
929bool InitLocalVar(int offset,const Type &type,const Subscripts &subscripts,const char *lpszInitBuf){
930 int i2,i3;
931 char temporary[VN_SIZE];
932 char InitBuf[VN_SIZE];
933 lstrcpy( InitBuf, lpszInitBuf );
934
935 if(InitBuf[0]=='['){
936 SlideString(InitBuf+1,-1);
937 InitBuf[lstrlen(InitBuf)-1]=0;
938
939 int typeSize = type.GetSize();
940
941 if( subscripts.size() > 0 ){
942 Subscripts nestSubscripts;
943 for( int i=1; i<(int)subscripts.size(); i++ )
944 {
945 nestSubscripts.push_back( subscripts[i] );
946 }
947
948 typeSize*=JumpSubScripts( nestSubscripts );
949 {
950 int i=0;
951 i2=0;
952 while(1){
953 if( subscripts[0] < i2 ){
954 compiler.errorMessenger.Output(41,0,cp);
955 return 0;
956 }
957 i=GetOneParameter(InitBuf,i,temporary);
958 if(!InitLocalVar(
959 offset+i2*typeSize,
960 type,
961 nestSubscripts,
962 temporary)) return false;
963 i2++;
964 if(InitBuf[i]=='\0') break;
965 }
966 }
967 return true;
968 }
969
970 if(type.IsStruct()){
971 const CClass &objClass = type.GetClass();
972
973 int i = 0;
974 BOOST_FOREACH( Member *pMember, objClass.GetDynamicMembers() ){
975 if(InitBuf[i]=='\0'){
976 compiler.errorMessenger.Output(41,0,cp);
977 return false;
978 }
979
980 i=GetOneParameter(InitBuf,i,temporary);
981
982 i3=objClass.GetMemberOffset( pMember->GetName().c_str() );
983
984 if(!InitLocalVar(offset+i3,
985 pMember->GetType(),
986 pMember->GetSubscripts(),
987 temporary)) return false;
988
989 if(InitBuf[i]=='\0') break;
990 }
991 return true;
992 }
993
994 compiler.errorMessenger.Output(41,0,cp);
995 return false;
996 }
997
998
999 ///////////////////////////////////////
1000 // 単発式([]で囲まれていない)
1001 ///////////////////////////////////////
1002
1003 if( subscripts.size() > 0 ){
1004 compiler.errorMessenger.Output(41,0,cp);
1005 return false;
1006 }
1007
1008 double dbl;
1009 _int64 i64data;
1010 Type calcType;
1011
1012 if( !StaticCalculation(false, InitBuf,type.GetBasicType(),&i64data,calcType) ){
1013 //動的データだった場合
1014 return false;
1015 }
1016 if( calcType.IsReal() ){
1017 memcpy(&dbl,&i64data,sizeof(double));
1018 i64data=(_int64)dbl;
1019 }
1020 else dbl=(double)i64data;
1021
1022 //型チェック
1023 CheckDifferentType(
1024 type,
1025 calcType,
1026 0,0);
1027
1028 if( type.IsDouble() ){
1029 memcpy(&i64data,&dbl,sizeof(double));
1030
1031 //mov rax,i64data
1032 compiler.codeGenerator.op_mov_RV64(REG_RAX,i64data);
1033
1034 //mov qword ptr[rsp+offset],rax
1035 compiler.codeGenerator.localVarPertialSchedules.push_back(
1036 compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,offset,MOD_BASE_DISP32, Schedule::None, true )
1037 );
1038 }
1039 else if( type.IsSingle() ){
1040 float flt;
1041 flt=(float)dbl;
1042
1043 //mov dword ptr[rsp+offset],value
1044 compiler.codeGenerator.localVarPertialSchedules.push_back(
1045 compiler.codeGenerator.op_mov_MV(sizeof(long),REG_RSP,offset, Schedule::None, true, USE_OFFSET,*(int *)&flt)
1046 );
1047 }
1048 else if( type.Is64() || type.IsPointer() ){
1049 if( type.GetBasicType() == typeOfPtrChar && type.GetIndex() == LITERAL_STRING ){
1050 //文字列定数のとき
1051
1052 char *temp;
1053 temp=(char *)i64data;
1054 i2 = compiler.AddStringToDataTable( temp );
1055 HeapDefaultFree(temp);
1056
1057 //mov rax,i2
1058 compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RAX,i2, Schedule::DataTable );
1059
1060 //mov qword ptr[rsp+offset],rax
1061 compiler.codeGenerator.localVarPertialSchedules.push_back(
1062 compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,offset,MOD_BASE_DISP32, Schedule::None, true )
1063 );
1064 }
1065 else{
1066 if(i64data&0xFFFFFFFF00000000){
1067 //mov rax,i64data
1068 compiler.codeGenerator.op_mov_RV64(REG_RAX,i64data);
1069
1070 //mov qword ptr[rsp+offset],rax
1071 compiler.codeGenerator.localVarPertialSchedules.push_back(
1072 compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,offset,MOD_BASE_DISP32, Schedule::None, true )
1073 );
1074 }
1075 else{
1076 //mov qword ptr[rsp+offset],value
1077 compiler.codeGenerator.localVarPertialSchedules.push_back(
1078 compiler.codeGenerator.op_mov_MV(sizeof(_int64),REG_RSP,offset, Schedule::None, true, USE_OFFSET,(int)i64data)
1079 );
1080 }
1081 }
1082 }
1083 else if( type.IsDWord() || type.IsLong() ){
1084 //mov dword ptr[rsp+offset],value
1085 compiler.codeGenerator.localVarPertialSchedules.push_back(
1086 compiler.codeGenerator.op_mov_MV(sizeof(long),REG_RSP,offset, Schedule::None, true, USE_OFFSET,(int)i64data)
1087 );
1088 }
1089 else if( type.IsWord() || type.IsInteger() ){
1090 //mov word ptr[rsp+offset],value
1091 compiler.codeGenerator.localVarPertialSchedules.push_back(
1092 compiler.codeGenerator.op_mov_MV(sizeof(short),REG_RSP,offset, Schedule::None, true, USE_OFFSET,(int)i64data)
1093 );
1094 }
1095 else if( type.IsSByte() || type.IsByte() || type.IsBoolean() ){
1096 //mov byte ptr[rsp+offset],value
1097 compiler.codeGenerator.localVarPertialSchedules.push_back(
1098 compiler.codeGenerator.op_mov_MV(sizeof(char),REG_RSP,offset, Schedule::None, true, USE_OFFSET,(int)i64data)
1099 );
1100 }
1101 return true;
1102}
1103
1104void dim( char *VarName, const Subscripts &subscripts, const Type &type,const char *InitBuf,const char *ConstractParameter,DWORD dwFlags)
1105{
1106 if( compiler.IsGlobalAreaCompiling() ){
1107 /////////////////////////
1108 // グローバル変数
1109 /////////////////////////
1110
1111 AddGlobalVariable(VarName,subscripts,type,InitBuf,ConstractParameter,dwFlags);
1112 }
1113 else{
1114 /////////////////
1115 // ローカル変数
1116 /////////////////
1117
1118 if( compiler.GetCompilingUserProc().GetLocalVars().DuplicateCheck( LexicalAnalyzer::FullNameToSymbol( VarName ), compiler.codeGenerator.lexicalScopes.GetNowLevel() ) ){
1119 //2重定義のエラー
1120 compiler.errorMessenger.Output(15,VarName,cp);
1121 return;
1122 }
1123
1124 bool isConst = ( dwFlags & DIMFLAG_CONST ) ? true:false;
1125
1126 Variable *pVar = new Variable(
1127 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( VarName ),
1128 type,
1129 isConst,
1130 false,
1131 ConstractParameter,
1132 false
1133 );
1134
1135 if( subscripts.size() > 0 ){
1136 //配列あり
1137 pVar->SetArray( subscripts );
1138 }
1139
1140 //レキシカルスコープ
1141 pVar->SetScopeLevel( compiler.codeGenerator.lexicalScopes.GetNowLevel() );
1142 pVar->SetScopeStartAddress( compiler.codeGenerator.lexicalScopes.GetStartAddress() );
1143 pVar->isLiving = true;
1144
1145 //エラー用
1146 pVar->source_code_address=cp;
1147
1148 // 変数を追加
1149 compiler.GetCompilingUserProc().GetLocalVars().push_back( pVar );
1150
1151 //アラインメントを考慮
1152 if( pVar->GetType().IsStruct() ){
1153 int alignment = pVar->GetType().GetClass().GetFixedAlignment();
1154
1155 if( alignment ){
1156 if( AllLocalVarSize % alignment ){
1157 AllLocalVarSize += alignment - (AllLocalVarSize % alignment);
1158 }
1159 }
1160
1161 if( alignment == PTR_SIZE*2 ){
1162 // ポインタに要するサイズよりも一回り大きなアラインメントが指定されているとき
1163 // (例:CONTEXT構造体など)
1164 // 呼び出し側のオフセットズレを考慮する
1165
1166 if( 0 == ( compiler.GetCompilingUserProc().RealParams().GetMemorySize() + PTR_SIZE /* ret分 */ ) % alignment ){
1167 AllLocalVarSize += PTR_SIZE;
1168 }
1169 }
1170 }
1171
1172 AllLocalVarSize += pVar->GetMemorySize();
1173 pVar->SetOffsetAddress( AllLocalVarSize );
1174
1175 //レキシカルスコープ
1176 pVar->SetScopeLevel( compiler.codeGenerator.lexicalScopes.GetNowLevel() );
1177 pVar->SetScopeStartAddress( compiler.codeGenerator.lexicalScopes.GetStartAddress() );
1178 pVar->isLiving = true;
1179
1180 if(InitBuf[0]){
1181 //初期代入時のみ、書き込みアクセスを許可する
1182 if( isConst ){
1183 pVar->ConstOff();
1184 }
1185
1186 int result = 0;
1187 if( !pVar->GetType().IsObject() ){
1188 result = InitLocalVar(-pVar->GetOffsetAddress(),
1189 pVar->GetType(),
1190 pVar->GetSubscripts(),
1191 InitBuf);
1192 }
1193
1194 if(!result){
1195 //動的な式だった場合は代入演算を行う
1196 char temporary[8192];
1197 sprintf(temporary,"%s=%s",VarName,InitBuf);
1198 OpcodeCalc(temporary);
1199 }
1200
1201 if( isConst ){
1202 pVar->ConstOn();
1203 }
1204 }
1205 else{
1206 //0初期化
1207
1208 //mov r8, 0
1209 compiler.codeGenerator.op_zero_reg( REG_R8 );
1210
1211 //mov rdx, VarSize
1212 compiler.codeGenerator.op_mov_RV( sizeof(_int64), REG_RDX, pVar->GetMemorySize() );
1213
1214 //mov rcx, rsp
1215 compiler.codeGenerator.op_mov_RR( REG_RCX, REG_RSP );
1216
1217 //add rcx, offset
1218 compiler.codeGenerator.localVarPertialSchedules.push_back(
1219 compiler.codeGenerator.op_add_RV( REG_RCX, -pVar->GetOffsetAddress(), Schedule::None, true )
1220 );
1221
1222 //call FillMemory
1223 DllProc *pDllProc;
1224 pDllProc=GetDeclareHash("FillMemory");
1225 compiler.codeGenerator.op_call( pDllProc );
1226 }
1227 }
1228
1229 //New呼び出し
1230 if( type.IsObject()
1231 && !type.IsInterface() && !type.IsComInterface()
1232 &&(dwFlags&DIMFLAG_NONCALL_CONSTRACTOR)==0
1233 &&InitBuf[0]=='\0')
1234 {
1235 char objectSize[255];
1236 if( subscripts.size() == 0 ){
1237 objectSize[0] = 0;
1238 }
1239 else{
1240 if( subscripts.size() > 1 ){
1241 compiler.errorMessenger.Output(300,NULL,cp);
1242 }
1243 sprintf( objectSize, "%d", subscripts[0] );
1244 }
1245 Operator_New( type.GetClass(), objectSize, ConstractParameter, type );
1246
1247 Type tempType;
1248 RELATIVE_VAR RelativeVar;
1249 GetVarOffset( true, false, VarName, &RelativeVar, tempType );
1250 if( RelativeVar.dwKind == VAR_DIRECTMEM ){
1251 compiler.errorMessenger.OutputFatalError();
1252 }
1253 SetVariableFromRax( Type( DEF_OBJECT, *compiler.GetObjectModule().meta.GetClasses().GetObjectClassPtr() ), DEF_OBJECT, &RelativeVar );
1254 }
1255}
1256void SetVarPtrToReg(int reg,RELATIVE_VAR *pRelativeVar){
1257 if(!IsGeneralReg(reg)) compiler.errorMessenger.Output(300,NULL,cp);
1258
1259 if(pRelativeVar->dwKind==VAR_GLOBAL){
1260 if(pRelativeVar->bOffsetOffset){
1261 //add r11,offset
1262 compiler.codeGenerator.op_add_RV( REG_R11, (long)pRelativeVar->offset, Schedule::GlobalVar );
1263
1264 //mov reg,r11
1265 compiler.codeGenerator.op_mov_RR(reg,REG_R11);
1266 }
1267 else{
1268 //mov reg,offset
1269 compiler.codeGenerator.op_mov_RV( sizeof(_int64), reg, (long)pRelativeVar->offset, Schedule::GlobalVar );
1270 }
1271 }
1272 else if( pRelativeVar->dwKind == VAR_REFGLOBAL ){
1273 if(pRelativeVar->bOffsetOffset){
1274 //add r11,qword ptr[offset]
1275 compiler.codeGenerator.op_add_RM( sizeof(_int64), REG_R11, REG_NON, (int)pRelativeVar->offset, MOD_DISP32, Schedule::GlobalVar );
1276 }
1277 else{
1278 //mov r11,qword ptr[offset]
1279 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelativeVar->offset,MOD_DISP32, Schedule::GlobalVar );
1280 }
1281
1282 goto directmem;
1283 }
1284 else if(pRelativeVar->dwKind==VAR_LOCAL){
1285 if(pRelativeVar->bOffsetOffset){
1286 //add r11,offset
1287 compiler.codeGenerator.localVarPertialSchedules.push_back(
1288 compiler.codeGenerator.op_add_RV( REG_R11, (long)pRelativeVar->offset, Schedule::None, true )
1289 );
1290
1291 //add r11,rsp
1292 compiler.codeGenerator.op_add_RR(REG_R11,REG_RSP);
1293
1294 //mov reg,r11
1295 compiler.codeGenerator.op_mov_RR(reg,REG_R11);
1296 }
1297 else{
1298 //mov reg,rsp
1299 compiler.codeGenerator.op_mov_RR(reg,REG_RSP);
1300
1301 //add reg,offset
1302 compiler.codeGenerator.localVarPertialSchedules.push_back(
1303 compiler.codeGenerator.op_add_RV(reg,(long)pRelativeVar->offset, Schedule::None, true )
1304 );
1305 }
1306 }
1307 else if( pRelativeVar->dwKind == VAR_REFLOCAL ){
1308 if(pRelativeVar->bOffsetOffset){
1309 //add r11,qword ptr[rsp+offset]
1310 compiler.codeGenerator.localVarPertialSchedules.push_back(
1311 compiler.codeGenerator.op_add_RM( sizeof(_int64), REG_R11, REG_RSP, (long)pRelativeVar->offset, MOD_BASE_DISP32, Schedule::None, true )
1312 );
1313 }
1314 else{
1315 //mov r11,qword ptr[rsp+offset]
1316 compiler.codeGenerator.localVarPertialSchedules.push_back(
1317 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32, Schedule::None, true )
1318 );
1319 }
1320
1321 goto directmem;
1322 }
1323 else if(pRelativeVar->dwKind==VAR_DIRECTMEM){
1324directmem:
1325 //mov reg,r11
1326 compiler.codeGenerator.op_mov_RR(reg,REG_R11);
1327 }
1328}
1329
1330bool Compile_AddGlobalRootsForGc()
1331{
1332 const UserProc *pUserProc_AddGlobalRootPtr = GetClassMethod( "_System_CGarbageCollection", "AddGlobalRootPtr" );
1333 if( !pUserProc_AddGlobalRootPtr )
1334 {
1335 compiler.errorMessenger.Output(3, "_System_CGarbageCollection.AddGlobalRootPtr", -1 );
1336 return false;
1337 }
1338
1339 BOOST_FOREACH( const Variable *pVar, compiler.GetObjectModule().meta.GetGlobalVars() ){
1340 if( pVar->GetType().IsObject() || pVar->GetType().IsPointer() || pVar->GetType().IsStruct() ){
1341 // オブジェクトまたはポインタだったとき
1342 // ※構造体も含む(暫定対応)
1343
1344 // 変数領域に要するLONG_PTR単位の個数を引き渡す
1345 //mov r8,count
1346 compiler.codeGenerator.op_mov_RV(sizeof(_int64), REG_R8,pVar->GetMemorySize()/PTR_SIZE);
1347
1348 // ルートポインタを引き渡す
1349 //mov rdx,offset
1350 compiler.codeGenerator.op_mov_RV(sizeof(_int64), REG_RDX,(int)pVar->GetOffsetAddress(), Schedule::GlobalVar );
1351
1352 // Thisポインタを引き渡す
1353 SetThisPtrToReg(REG_RCX);
1354
1355 // call AddGlobalRootPtr
1356 compiler.codeGenerator.op_call( pUserProc_AddGlobalRootPtr );
1357 }
1358 }
1359
1360 return true;
1361}
Note: See TracBrowser for help on using the repository browser.