source: dev/trunk/ab5.0/abdev/compiler_x64/NumOpe.cpp@ 676

Last change on this file since 676 was 676, checked in by dai_9181, 16 years ago

If/While/Doなどのステートメントに引き渡す式の戻り値がクラス型の場合はBoolean型へのキャストを試みるようにした。

File size: 37.7 KB
Line 
1#include "stdafx.h"
2
3#include <Compiler.h>
4
5#include "../BasicCompiler_Common/common.h"
6#include "Opcode.h"
7
8using namespace ActiveBasic::Compiler;
9
10void NewStringObject(int reg, const char *str){
11 ///////////////////////////////////////////////////////
12 // lpszTextを元にStringオブジェクトを生成し、
13 // オブジェクトポインタをregに格納する
14 ///////////////////////////////////////////////////////
15
16
17 //////////////////////////////////////////////////////
18 ///// レジスタ資源のバックアップ
19 { BACKUP_REGISTER_RESOURCE
20 //////////////////////////////////////////////////////
21
22 char *parameter = (char *)malloc( lstrlen( str ) + 32 );
23 sprintf( parameter, "%s%c%c*Char", str, 1, ESC_AS );
24
25 Operator_New( *compiler.GetObjectModule().meta.GetClasses().GetStringClassPtr(), "", parameter, Type( DEF_OBJECT, *compiler.GetObjectModule().meta.GetClasses().GetStringClassPtr() ) );
26
27 free( parameter );
28
29 //mov reg,rax
30 compiler.codeGenerator.op_mov_RR( reg, REG_RAX );
31
32 /////////////////////////////////////////////
33 ////// レジスタ資源を復元
34 RESTORE_REGISTER_RESOURCE
35 }////////////////////////////////////////////
36}
37
38void SetUseRegFromRax(int type,int UseReg,int XmmReg){
39 if(IsRealNumberType(type)){
40 //実数型
41 if(XmmReg==REG_XMM4){
42 if(type==DEF_DOUBLE){
43 //movsd qword ptr[rsp+offset],xmm0 ※スタックフレームを利用
44 pobj_sf->push(REG_XMM0,sizeof(double));
45 }
46 if(type==DEF_SINGLE){
47 //movss dword ptr[rsp+offset],xmm0 ※スタックフレームを利用
48 pobj_sf->push(REG_XMM0,sizeof(float));
49 }
50 }
51 else{
52 if(type==DEF_DOUBLE){
53 //movsd xmm_reg,xmm0
54 compiler.codeGenerator.op_movsd_RR(XmmReg,REG_XMM0);
55 }
56 else if(type==DEF_SINGLE){
57 //movss xmm_reg,xmm0
58 compiler.codeGenerator.op_movss_RR(XmmReg,REG_XMM0);
59 }
60 }
61 }
62 else{
63 //整数型
64 if(UseReg==REG_R14){
65 //mov qword ptr[rsp+offset],rax ※スタックフレームを利用
66 pobj_sf->push(REG_RAX);
67 }
68 else{
69 //mov reg,rax
70 compiler.codeGenerator.op_mov_RR(UseReg,REG_RAX);
71 }
72 }
73}
74
75void ExtendRegToBigType( int reg, int bigBasicType, int baseBasicType ){
76 switch( Type::GetBasicSize( bigBasicType ) ){
77 case sizeof(_int64):
78 ExtendTypeTo64(baseBasicType,reg);
79 break;
80 case sizeof(long):
81 ExtendTypeTo32(baseBasicType,reg);
82 break;
83 case sizeof(short):
84 ExtendTypeTo16(baseBasicType,reg);
85 break;
86 }
87}
88
89
90bool VarToReg( RELATIVE_VAR &relativeVar, const Type &baseType, Type &resultType ){
91 int UseReg=pobj_reg->GetNextReg();
92 int XmmReg=pobj_reg->GetNextXmmReg();
93
94 //大きな型への暗黙の変換
95 int bigType = AutoBigCast(baseType.GetBasicType(),resultType.GetBasicType());
96
97 if(resultType.GetBasicType()&FLAG_PTR){
98 //配列ポインタ
99 resultType.SetBasicType( GetPtrType(resultType.GetBasicType()^FLAG_PTR) );
100
101 SetVarPtrToReg(UseReg,&relativeVar);
102 }
103 else if(resultType.IsReal()){
104 //実数型
105 if( resultType.IsDouble() )
106 SetXmmReg_DoubleVariable(&relativeVar,XmmReg);
107 if( resultType.IsSingle() )
108 SetXmmReg_SingleVariable(&relativeVar,XmmReg);
109 }
110 else if( resultType.IsWhole() || resultType.IsObject()){
111 //整数型
112 SetReg_WholeVariable(resultType,&relativeVar,UseReg);
113 }
114 else if( resultType.IsStruct() ){
115 //構造体ポインタをUseRegへ格納(構造体は値型)
116 SetVarPtrToReg(UseReg,&relativeVar);
117 }
118 else{
119 return false;
120 }
121
122 if( resultType.GetBasicType() != bigType ){
123 // 大きな型へ変換された場合
124 // ※レジスタの値をキャストする
125 ExtendRegToBigType( UseReg, bigType, resultType.GetBasicType() );
126
127 resultType.SetBasicType( bigType );
128 }
129
130 return true;
131}
132bool TermMemberOpe( const Type &leftType, bool &isNeedHeapFreeStructure, const Type &baseType, Type &resultType, const char *termFull, const char *termLeft, const char *member, bool &isVariable, RELATIVE_VAR &relativeVar )
133{
134 const CClass &objClass = leftType.GetClass();
135
136 const int useReg=pobj_reg->GetNextReg();
137 const int xmmReg=pobj_reg->GetNextXmmReg();
138
139
140 ////////////////////////////////
141 // インデクサ(getアクセサ)
142 ////////////////////////////////
143 char VarName[VN_SIZE],ArrayElements[VN_SIZE];
144 GetArrayElement(member,VarName,ArrayElements);
145 if(ArrayElements[0]){
146 Type classType;
147 if( VarName[0] == '\0' )
148 {
149 classType = leftType;
150
151 if( classType.IsObject() )
152 {
153 // 既にuseRegにオブジェクトポインタが格納されており、それに対するインデクサを呼び出す場合
154 // ※「プロパティ値として返ってきたオブジェクトインスタンスのインデクサを呼び出す」場合にここにくる
155
156 // オブジェクトメンバのポインタは既にraxに入っている
157 }
158 }
159 else
160 {
161 GetMemberType( leftType, VarName, classType, 0, false );
162
163 if( classType.IsObject() )
164 {
165 //オブジェクトポインタをr11にコピー
166 compiler.codeGenerator.op_mov_RR( REG_R11, useReg );
167
168 RELATIVE_VAR tempRelativeVar;
169 tempRelativeVar.dwKind=VAR_DIRECTMEM;
170
171 if( !_member_offset(
172 true, //エラー表示あり
173 false, //読み込み専用
174 leftType,
175 VarName,&tempRelativeVar,classType,0)){
176 return false;
177 }
178
179 // オブジェクトメンバのポインタをraxにコピー
180 if( !VarToReg( tempRelativeVar, baseType, resultType ) ){
181 compiler.errorMessenger.Output(11,termFull,cp);
182 }
183 }
184 }
185
186 if( classType.IsObject() )
187 {
188 //////////////////////////////////////////////////////
189 ///// レジスタ資源のバックアップ
190 { BACKUP_REGISTER_RESOURCE
191 //////////////////////////////////////////////////////
192
193 //オブジェクトポインタをスタックに入れておく
194 //mov qword ptr[rsp+offset],reg ※スタックフレームを利用
195 pobj_sf->push( useReg );
196
197 char objectFullName[VN_SIZE], dummyArrayElements[VN_SIZE];
198 GetArrayElement(termFull,objectFullName,dummyArrayElements);
199
200 CallIndexerGetterProc(useReg,classType,objectFullName, ArrayElements,resultType, PROCFLAG_NEW );
201
202 pobj_sf->pop();
203
204 /////////////////////////////////////////////
205 ////// レジスタ資源を復元
206 RESTORE_REGISTER_RESOURCE
207 }////////////////////////////////////////////
208
209 return true;
210 }
211 }
212
213
214 ///////////////////////////////////////////////////////////////////
215 // メンバを検索
216 ///////////////////////////////////////////////////////////////////
217 if( GetMemberType( leftType, member, resultType, 0, false ) ){
218 // メンバが見つかったとき
219
220 if( isNeedHeapFreeStructure )
221 {
222 if( !leftType.IsStruct() )
223 {
224 compiler.errorMessenger.OutputFatalError();
225 }
226
227 pobj_reg->LockReg();
228
229 // 親となる構造体が一時メモリに存在していた場合、後ほど解放する必要がある
230 compiler.codeGenerator.op_AddNeedFreeTempStructure( useReg );
231 isNeedHeapFreeStructure = false;
232
233 pobj_reg->UnlockReg();
234 }
235
236 //オブジェクトポインタをr11にコピー
237 compiler.codeGenerator.op_mov_RR( REG_R11, useReg );
238
239 relativeVar.dwKind=VAR_DIRECTMEM;
240
241 if( !_member_offset(
242 true, //エラー表示あり
243 false, //読み込み専用
244 leftType,
245 member,&relativeVar,resultType,0)){
246 return false;
247 }
248
249 // 変数として扱う
250 isVariable = true;
251
252 return true;
253 }
254
255
256 ///////////////////////////////////////////////////////////////////
257 // 動的メソッドを検索
258 ///////////////////////////////////////////////////////////////////
259 std::vector<const UserProc *> userProcs;
260
261 char methodName[VN_SIZE], lpPtrOffset[VN_SIZE], parameter[VN_SIZE], dummy[1];
262 ReferenceKind refType;
263 PareOrBracket pareOrBracket = None;
264 lstrcpy( methodName, member );
265 GetVarFormatString( methodName, parameter, lpPtrOffset, dummy, refType, &pareOrBracket );
266
267 objClass.EnumDynamicMethodsOrInterfaceMethods( methodName, userProcs );
268 if(userProcs.size()){
269 //オーバーロードを解決
270 const UserProc *pUserProc = OverloadSolutionWithStrParam(termFull,userProcs,parameter,termLeft);
271
272 if( pUserProc )
273 {
274 if(
275 pUserProc->Params().size() == 0 // 仮引数の個数は0
276 && parameter[0] // 実引数は1つ以上
277 && pUserProc->ReturnType().IsObject() // 戻り値がクラス型の場合
278 && pareOrBracket == Bracket ) // 実引数は[]で囲まれている
279 {
280 // プロパティ値として返ってきたオブジェクトインスタンスのインデクサを呼び出す
281
282 // まずはプロパティ値を取得
283 bool dummyIsVariable;
284 RELATIVE_VAR dummyRelativeVar;
285 TermMemberOpe( leftType, isNeedHeapFreeStructure, baseType, resultType, termFull, termLeft, methodName, dummyIsVariable, dummyRelativeVar );
286
287 // 戻り値のオブジェクトインスタンスのインデクサを呼び出す
288 char temporary[VN_SIZE], temp2[VN_SIZE];
289 sprintf( temporary, "[%s]", parameter );
290 sprintf( temp2, "%s.%s", termLeft, methodName );
291 Type classType = resultType;
292 return TermMemberOpe( classType, isNeedHeapFreeStructure, baseType, resultType, termFull, temp2, temporary, isVariable, relativeVar );
293 }
294
295 resultType = pUserProc->ReturnType();
296
297
298 //////////////////////////////////////////////////////
299 ///// レジスタ資源のバックアップ
300 { BACKUP_REGISTER_RESOURCE
301 //////////////////////////////////////////////////////
302
303 //オブジェクトポインタをスタックに入れておく
304 //mov qword ptr[rsp+offset],reg ※スタックフレームを利用
305 pobj_sf->push( useReg );
306
307 if( !Opcode_CallProc(parameter,pUserProc,PROCFLAG_NEW,termLeft ) ){
308 //レジスタ資源を復元
309 RESTORE_REGISTER_RESOURCE
310
311 return false;
312 }
313
314 pobj_sf->pop();
315
316 /////////////////////
317 // 戻り値の処理
318 /////////////////////
319
320 //大きな型への暗黙の変換
321 int bigType = AutoBigCast(baseType.GetBasicType(), resultType.GetBasicType() );
322
323 if( resultType.GetBasicType() != bigType ){
324 // 大きな型へ変換された場合
325 // ※レジスタの値をキャストする
326 ExtendRegToBigType( REG_RAX, bigType, resultType.GetBasicType() );
327
328 resultType.SetBasicType( bigType );
329 }
330
331 SetUseRegFromRax(resultType.GetBasicType(),useReg,xmmReg);
332
333 // 型パラメータを解決
334 ResolveFormalGenericTypeParameter( resultType, leftType, pUserProc );
335
336
337 /////////////////////////////////////////////
338 ////// レジスタ資源を復元
339 RESTORE_REGISTER_RESOURCE
340 }////////////////////////////////////////////
341
342 return true;
343 }
344 }
345 else if( pareOrBracket == Pare )
346 {
347 // 関数ポインタ
348 compiler.errorMessenger.OutputFatalError();
349
350 ///////////////////////////////////////////////////////////////////
351 // メンバを検索
352 ///////////////////////////////////////////////////////////////////
353 if( GetMemberType( leftType, methodName, resultType, 0, false ) ){
354 // メンバが見つかったとき
355 }
356 }
357
358 compiler.errorMessenger.OutputFatalError();
359
360 return false;
361}
362bool _TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, bool &isNeedHeapFreeStructure, bool *pIsClassName, bool isProcedureCallOnly, bool &isVariable, RELATIVE_VAR &relativeVar, bool isWriteAccess )
363{
364 char parameter[VN_SIZE];
365
366 // Withを解決
367 char termFull[VN_SIZE];
368 if(term[0]=='.'){
369 GetWithName(termFull);
370 lstrcat(termFull,term);
371 }
372 else lstrcpy(termFull,term);
373
374 char termLeft[VN_SIZE];
375 lstrcpy(termLeft,termFull);
376
377 // パース
378 char member[VN_SIZE];
379 ReferenceKind refType;
380 if( SplitMemberName( termFull, termLeft, member, refType ) ){
381 ///////////////////////////////////////////////////////////////////
382 // オブジェクトとメンバに分解できるとき
383 // termLeft.member
384 ///////////////////////////////////////////////////////////////////
385
386 isLiteral = false;
387
388 // オブジェクト側の型を取得
389 bool isClassName = false;
390 Type leftType;
391 if( GetTermType( termLeft, Type(), leftType, isLiteral, &isClassName ) ){
392 if( isClassName == false && compiler.GetObjectModule().meta.GetBlittableTypes().IsExist( leftType ) ){
393 // 左側のオブジェクト部分がBlittable型のとき
394
395 char temporary[VN_SIZE];
396 lstrcpy( temporary, termLeft );
397 sprintf( termLeft, "%s(%s)",
398 compiler.GetObjectModule().meta.GetBlittableTypes().Find( leftType ).GetCreateStaticMethodFullName().c_str(),
399 temporary );
400 }
401 }
402
403 if( !TermOpe( termLeft, baseType, leftType, isLiteral, isNeedHeapFreeStructure, &isClassName ) ){
404 goto globalArea;
405 }
406
407 if( isClassName ){
408 // 静的メンバ/メソッドの場合
409 goto globalArea;
410 }
411
412 if( !leftType.HasMember() ){
413 // メンバを持たない型の場合
414 if( isProcedureCallOnly )
415 {
416 compiler.errorMessenger.Output(1,NULL,cp);
417 }
418 return false;
419 }
420
421 return TermMemberOpe( leftType, isNeedHeapFreeStructure, baseType, resultType, termFull, termLeft, member, isVariable, relativeVar );
422 }
423globalArea:
424
425 //////////////////////////////////////////////
426 // クラス名かどうかをチェック(静的メンバ用)
427 //////////////////////////////////////////////
428
429 if( pIsClassName ){
430 if( compiler.GetObjectModule().meta.FindClassSupportedTypeDef( LexicalAnalyzer::FullNameToSymbol( termFull ) ) ){
431 *pIsClassName = true;
432 return true;
433 }
434 }
435
436
437 /////////////////////////////////////////////////////////////////
438 // グローバル属性エリア
439 /////////////////////////////////////////////////////////////////
440
441 int UseReg=pobj_reg->GetNextReg();
442 int XmmReg=pobj_reg->GetNextXmmReg();
443
444
445 if(lstrcmpi(termFull,"This")==0 && isProcedureCallOnly == false ){
446 if( !compiler.IsCompilingClass() )
447 {
448 compiler.errorMessenger.Output(142,NULL,cp);
449 return false;
450 }
451
452 //Thisオブジェクト
453 resultType.SetType( DEF_OBJECT, &compiler.GetCompilingClass() );
454
455 SetThisPtrToReg( UseReg );
456
457 isLiteral = false;
458
459 return true;
460 }
461
462
463 //////////////////////////////////////
464 // 関数(DLL、ユーザー定義、組み込み)
465 //////////////////////////////////////
466 char procName[VN_SIZE];
467 char temporary[8192];
468
469 int i2=GetCallProcName(termFull,procName);
470 if(termFull[i2]=='('){
471 int i4=GetStringInPare_RemovePare(parameter,termFull+i2+1);
472
473 void *pInfo;
474 int idProc=GetProc(procName,(void **)&pInfo);
475
476 if(idProc){
477 //閉じカッコ")"に続く文字がNULLでないとき
478 if(termFull[i2+1+i4+1]!='\0'){
479 compiler.errorMessenger.Output(42,NULL,cp);
480 }
481
482
483 //////////////////////////////////////////////////////
484 ///// レジスタ資源のバックアップ
485 { BACKUP_REGISTER_RESOURCE
486 //////////////////////////////////////////////////////
487
488
489 ////////////////
490 // 呼び出し
491 ////////////////
492
493 CallProc(idProc,pInfo,procName,parameter, baseType,resultType);
494
495
496 /////////////////////
497 // 戻り値の処理
498 /////////////////////
499
500 //大きな型への暗黙の変換
501 int bigType = AutoBigCast(baseType.GetBasicType(), resultType.GetBasicType() );
502
503 if( resultType.GetBasicType() != bigType ){
504 // 大きな型へ変換された場合
505 // ※レジスタの値をキャストする
506 ExtendRegToBigType( REG_RAX, bigType, resultType.GetBasicType() );
507
508 resultType.SetBasicType( bigType );
509 }
510
511 SetUseRegFromRax(resultType.GetBasicType(),UseReg,XmmReg);
512
513 /////////////////////////////////////////////
514 ////// レジスタ資源を復元
515 RESTORE_REGISTER_RESOURCE
516 }////////////////////////////////////////////
517
518 if(resultType.IsStruct())
519 {
520 //構造体が戻ったときはヒープ領域にインスタンスが格納されている
521 //※後にfreeする必要あり
522 // TODO: 解放はGCに任せる
523 isNeedHeapFreeStructure = true;
524 }
525
526 isLiteral = false;
527
528 return true;
529 }
530
531 ConstMacro *pConstMacro = compiler.GetObjectModule().meta.GetGlobalConstMacros().Find(
532 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( procName )
533 );
534 if( pConstMacro )
535 {
536 if( ActiveBasic::Compiler::LexicalAnalyzer::ConstMacroToExpression( *pConstMacro, parameter, temporary ) )
537 {
538 /////////////////////////
539 // マクロ関数
540 /////////////////////////
541
542 //閉じカッコ")"に続く文字がNULLでないときはエラーにする
543 if(termFull[i2+1+i4+1]!='\0') compiler.errorMessenger.Output(42,NULL,cp);
544
545 //マクロ関数の場合
546 NumOpe(&UseReg, temporary,Type(),resultType);
547
548 if(!IS_LITERAL(resultType.GetIndex())){
549 //リテラル値ではなかったとき
550 isLiteral = false;
551 }
552
553 return true;
554 }
555 }
556 }
557 else if( isProcedureCallOnly ){
558 // 関数呼び出し以外は受け付けない
559 return false;
560 }
561
562
563 ////////////////////////////////
564 // インデクサ(getアクセサ)
565 ////////////////////////////////
566
567 char VarName[VN_SIZE],ArrayElements[VN_SIZE];
568 GetArrayElement(termFull,VarName,ArrayElements);
569 if(ArrayElements[0]){
570 Type classType;
571 GetVarType(VarName,classType,false);
572 if( classType.IsObject() )
573 {
574 CallIndexerGetterProc(UseReg,classType,VarName,ArrayElements,resultType);
575
576 isLiteral = false;
577
578 return true;
579 }
580 }
581
582
583 ////////////////////////////////
584 // 変数
585 ////////////////////////////////
586
587 if(GetVarOffset(
588 false, //エラー表示なし
589 isWriteAccess,
590 termFull,
591 &relativeVar,resultType)){
592 //////////
593 // 変数
594 //////////
595
596 // 変数として扱う
597 isVariable = true;
598
599 isLiteral = false;
600
601 return true;
602 }
603
604/*
605 ////////////////////////////////
606 // 型名
607 ////////////////////////////////
608
609 if( compiler.StringToType( termFull, resultType ) ){
610 resultType.SetBasicType( resultType.GetBasicType() | FLAG_CAST );
611 return true;
612 }*/
613
614
615 /////////////////////////////////
616 // プロパティ用のメソッド
617 /////////////////////////////////
618
619 //配列要素を排除
620 GetArrayElement(termFull,VarName,ArrayElements);
621
622 if(GetSubHash(VarName,0)){
623
624 //////////////////////////////////////////////////////
625 ///// レジスタ資源のバックアップ
626 { BACKUP_REGISTER_RESOURCE
627 //////////////////////////////////////////////////////
628
629 CallPropertyMethod(termFull,NULL,resultType);
630
631 //大きな型への暗黙の変換
632 int bigType = AutoBigCast(baseType.GetBasicType(), resultType.GetBasicType() );
633
634 if( resultType.GetBasicType() != bigType ){
635 // 大きな型へ変換された場合
636 // ※レジスタの値をキャストする
637 ExtendRegToBigType( REG_RAX, bigType, resultType.GetBasicType() );
638
639 resultType.SetBasicType( bigType );
640 }
641
642 SetUseRegFromRax(resultType.GetBasicType(),UseReg,XmmReg);
643
644 /////////////////////////////////////////////
645 ////// レジスタ資源を復元
646 RESTORE_REGISTER_RESOURCE
647 }////////////////////////////////////////////
648
649 if(resultType.IsStruct())
650 {
651 //構造体が戻ったときはヒープ領域にインスタンスが格納されている
652 //※後にfreeする必要あり
653 // TODO: 解放はGCに任せる
654 isNeedHeapFreeStructure = true;
655 }
656
657 isLiteral = false;
658
659 return true;
660 }
661
662 if( isProcedureCallOnly )
663 {
664 compiler.errorMessenger.Output(3, termLeft, cp );
665 }
666
667 return false;
668}
669
670bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, bool &isNeedHeapFreeStructure, bool *pIsClassName, bool isProcedureCallOnly, bool isWriteAccess )
671{
672 bool isInitRegSwitch = false;
673 if( !pobj_reg )
674 {
675 isInitRegSwitch = true;
676
677 //作業用レジスタを取得
678 pobj_reg = new CRegister( REG_RAX );
679 }
680
681 //エラー時の復旧用
682 CRegister objReg_Backup = *pobj_reg;
683
684
685 RELATIVE_VAR relativeVar;
686 bool isVariable = false;
687 bool result = _TermOpe( term, baseType, resultType, isLiteral, isNeedHeapFreeStructure, pIsClassName, isProcedureCallOnly, isVariable, relativeVar, isWriteAccess );
688
689 if( isVariable )
690 {
691 // 変数の場合はeaxに変数ポインタを格納する
692 if( !VarToReg( relativeVar, baseType, resultType ) ){
693 compiler.errorMessenger.Output(11,term,cp);
694 }
695 }
696
697
698 if( !result )
699 {
700 *pobj_reg = objReg_Backup;
701 }
702
703 if( isInitRegSwitch ){
704 //整合性をチェック(バグ回避)
705 if( result )
706 {
707 pobj_reg->bug_check();
708 }
709
710 //作業レジスタを解放
711 delete pobj_reg;
712 pobj_reg = NULL;
713 }
714
715 return result;
716}
717bool TermOpeOnlyVariable( const char *term, Type &resultType, RELATIVE_VAR &relativeVar, bool isWriteAccess )
718{
719 if( pobj_reg )
720 {
721 compiler.errorMessenger.OutputFatalError();
722 }
723
724 //作業用レジスタを取得
725 pobj_reg = new CRegister( REG_NON );
726
727 bool isLiteral, isVariable = false, isNeedHeapFreeStructure = false;
728 bool result = _TermOpe( term, Type(), resultType, isLiteral, isNeedHeapFreeStructure, NULL, false, isVariable, relativeVar, isWriteAccess );
729
730 if( !isVariable )
731 {
732 compiler.errorMessenger.OutputFatalError();
733 }
734
735 //整合性をチェック(バグ回避)
736 if( result )
737 {
738 pobj_reg->bug_check();
739 }
740
741 //作業レジスタを解放
742 delete pobj_reg;
743 pobj_reg=0;
744
745 return result;
746}
747
748
749bool _numope( int *pReg,
750 const char *expression,
751 const Type &baseType,
752 Type &resultType,
753 bool *pbIsNeedHeapFreeStructure )
754{
755 int i,i2,i3;
756 char temporary[1024],temp2[1024];
757
758 if(expression[0]=='\0'){
759 compiler.errorMessenger.Output(1,NULL,cp);
760 return false;
761 }
762
763 if( !baseType.IsNull() && expression[0] == '[' ){
764 // リテラル配列の場合
765
766 int dataTableOffset;
767 if( !ActiveBasic::Compiler::DataTableGenerator::MakeLiteralArrayBuffer( compiler.GetObjectModule().dataTable, expression, baseType, dataTableOffset ) )
768 {
769 return false;
770 }
771
772 //mov reg,i2
773 compiler.codeGenerator.op_mov_RV( sizeof(_int64), *pReg, dataTableOffset, Schedule::DataTable );
774
775 resultType = baseType;
776
777 return true;
778 }
779
780 bool isLiteralCalculation;
781 if( NumOpe_GetType( expression, baseType, resultType, &isLiteralCalculation ) )
782 {
783 if( isLiteralCalculation )
784 {
785 //右辺値が数値の定数式の場合
786 _int64 i64data;
787 StaticCalculation(true, expression,baseType.GetBasicType(),&i64data,resultType);
788
789 if(resultType.IsReal()){
790 if(baseType.IsReal()) resultType=baseType;
791
792 int xmmReg = pobj_reg->GetNextXmmReg();
793 *pReg = xmmReg;
794
795 if(resultType.IsDouble()){
796 i3 = compiler.GetObjectModule().dataTable.Add( i64data );
797
798 //movlpd xmm_reg,qword ptr[data table offset]
799 compiler.codeGenerator.op_movlpd_RM( xmmReg, 0, i3, MOD_DISP32, Schedule::DataTable );
800 }
801 if(resultType.IsSingle()){
802 double dbl;
803 memcpy(&dbl,&i64data,sizeof(_int64));
804
805 float flt;
806 int i32data;
807 flt=(float)dbl;
808 memcpy(&i32data,&flt,sizeof(long));
809
810 i3 = compiler.GetObjectModule().dataTable.Add( i32data );
811
812 //movss xmm_reg,dword ptr[data table offset]
813 compiler.codeGenerator.op_movss_RM( xmmReg, 0, i3, MOD_DISP32, Schedule::DataTable );
814 }
815 }
816 else{
817 if(!resultType.Is64()){
818 //整数(符号有り/無し)
819
820 i3=(long)i64data;
821
822 if(resultType.GetBasicSize()==sizeof(char)) i3=i3&0x000000FF;
823 if(resultType.GetBasicSize()==sizeof(short)) i3=i3&0x0000FFFF;
824
825 i64data=(_int64)i3;
826 }
827
828 //mov reg,i64data
829 compiler.codeGenerator.op_mov_RV64(*pReg,i64data);
830 }
831 return true;
832 }
833 }
834
835 if( expression[0] == 1 )
836 {
837 if( expression[1]==ESC_NEW )
838 {
839 //New演算子(オブジェクト生成)
840
841 if( pobj_BlockReg->check(REG_RAX) ){
842 compiler.errorMessenger.OutputFatalError();
843 }
844
845 //////////////////////////////////////////////////////
846 ///// レジスタ資源のバックアップ
847 { BACKUP_REGISTER_RESOURCE
848 //////////////////////////////////////////////////////
849
850 if( !Operator_New( expression+2, baseType, resultType ) ){
851 return false;
852 }
853
854 /////////////////////////////////////////////
855 ////// レジスタ資源を復元
856 RESTORE_REGISTER_RESOURCE
857 }////////////////////////////////////////////
858
859 //mov reg,rax
860 compiler.codeGenerator.op_mov_RR( *pReg, REG_RAX );
861
862 return true;
863 }
864 else if( expression[1] == ESC_SYSTEM_STATIC_NEW )
865 {
866 // 静的領域にオブジェクトを作る
867
868 // 静的領域にオブジェクトを生成
869 int dataTableOffset;
870 if( !ActiveBasic::Compiler::DataTableGenerator::MakeConstObjectToProcessStaticBuffer( compiler.GetObjectModule().dataTable, expression + 2, resultType, dataTableOffset ) )
871 {
872 return false;
873 }
874
875 //mov reg,i2
876 compiler.codeGenerator.op_mov_RV( sizeof(_int64), *pReg, dataTableOffset, Schedule::DataTable);
877
878 return true;
879 }
880 }
881
882
883 /////////////////////////////////
884 // 式要素を逆ポーランド式で取得
885 /////////////////////////////////
886
887 char *values[255];
888 long calc[255];
889 long stack[255];
890 int pnum;
891 if(!GetNumOpeElements(expression,&pnum,values,calc,stack)){
892 for(i=0;i<pnum;i++){
893 if(values[i]) HeapDefaultFree(values[i]);
894 }
895 return 0;
896 }
897
898
899 ////////////////////////////////
900 // 演算部分のコード生成を開始
901 ////////////////////////////////
902
903 BOOL bError;
904 bError=0;
905
906 //リテラル値のみの計算かどうかを判別するためのフラグ
907 BOOL bLiteralCalculation=1;
908
909 double dbl;
910 int sp;
911 int type_stack[255];
912 LONG_PTR index_stack[255];
913 bool isNothing_stack[255];
914 bool isNeedHeapFreeStructureStack[255];
915 _int64 i64data;
916 int UseReg,XmmReg;
917 BOOL bXmm;
918 for(i=0,sp=0;i<pnum;i++){
919 int idCalc;
920 idCalc=calc[i]%100;
921
922 if(idCalc){
923 if( sp>=2 && type_stack[sp-2]==DEF_OBJECT )
924 {
925 if( idCalc == CALC_AS
926 && type_stack[sp-1] == ( DEF_OBJECT | FLAG_CAST )
927 && index_stack[sp-1] == index_stack[sp-2]
928 || isNothing_stack[sp-2] ){
929 // 同一の型、またはNothingに対するAsはAs演算子を呼び出さない
930 }
931 else if( idCalc == CALC_AS
932 && type_stack[sp-1] == ( DEF_OBJECT | FLAG_CAST )
933 && ( ((CClass *)index_stack[sp-1])->IsEqualsOrSubClass( (CClass *)index_stack[sp-2] ) || ((CClass *)index_stack[sp-2])->IsEqualsOrSubClass( (CClass *)index_stack[sp-1] )
934 )){
935 // ダウンキャストを許可する
936 }
937 else{
938 //オーバーロードされたオペレータを呼び出す
939 i2=CallOperatorProc(idCalc,baseType,type_stack,index_stack,isNeedHeapFreeStructureStack,sp);
940 if(i2==0){
941 if(idCalc==CALC_EQUAL) lstrcpy(temp2,"==");
942 else GetCalcName(idCalc,temp2);
943 sprintf(temporary,"Operator %s",temp2);
944 compiler.errorMessenger.Output(27,temporary,cp);
945 goto error;
946 }
947 else if(i2==-1) goto error;
948
949 continue;
950 }
951 }
952
953 if(!CheckCalcType(idCalc,type_stack,sp)) goto error;
954 }
955
956 switch(idCalc){
957 //数値
958 case 0:
959 index_stack[sp]=-1;
960 isNothing_stack[sp] = false;
961 isNeedHeapFreeStructureStack[sp] = false;
962
963 UseReg=pobj_reg->GetNextReg();
964 XmmReg=pobj_reg->GetNextXmmReg();
965
966 bXmm=0;
967
968 char *term;
969 term=values[i];
970
971 if( calc[i+1]%100 == CALC_AS ){
972 // As演算子の右辺値
973 //型名
974 if( compiler.StringToType( term, resultType ) ){
975 resultType.SetBasicType( resultType.GetBasicType() | FLAG_CAST );
976 }
977 else{
978 compiler.errorMessenger.Output(3, term, cp );
979 goto error;
980 }
981
982 type_stack[sp] = resultType.GetBasicType();
983 index_stack[sp] = resultType.GetIndex();
984 sp++;
985
986 break;
987 }
988
989 if( (term[0]=='e'||term[0]=='E')
990 && (term[1]=='x'||term[1]=='X')
991 && term[2]=='\"'
992 || term[0] == '\"' )
993 {
994 bool isEx = true;
995 if( term[0] == '\"' )
996 {
997 isEx = false;
998 }
999
1000 if( isEx )
1001 {
1002 // 拡張版リテラル文字列(エスケープシーケンス可能)
1003 if(!RemoveStringQuotes(term+2)){
1004 compiler.errorMessenger.Output(43,NULL,cp);
1005 goto error;
1006 }
1007 i3=FormatString_EscapeSequence(term+2);
1008 term+=2;
1009 }
1010 else
1011 {
1012 // 通常文字列
1013 if(!RemoveStringQuotes(term)){
1014 compiler.errorMessenger.Output(43,NULL,cp);
1015 goto error;
1016 }
1017 i3=lstrlen(term);
1018 }
1019
1020 if( !baseType.IsPointer() )
1021 {
1022 //要求タイプがオブジェクト、または未定のとき
1023
1024 //String型オブジェクトを生成
1025 i2 = ActiveBasic::Compiler::DataTableGenerator::MakeConstStringObjectToProcessStaticBuffer( compiler.GetObjectModule().dataTable, term );
1026
1027 //mov reg,i2
1028 compiler.codeGenerator.op_mov_RV(sizeof(_int64),UseReg,i2, Schedule::DataTable);
1029
1030 type_stack[sp]=DEF_OBJECT;
1031 index_stack[sp]=(LONG_PTR)compiler.GetObjectModule().meta.GetClasses().GetStringClassPtr();
1032 bLiteralCalculation=0;
1033
1034 if(bXmm) pobj_reg->LockXmmReg();
1035 else pobj_reg->LockReg();
1036
1037 sp++;
1038 break;
1039 }
1040
1041StrLiteral:
1042
1043 type_stack[sp]=typeOfPtrChar;
1044 bLiteralCalculation=0;
1045
1046 if( compiler.IsUnicode() )
1047 {
1048 i2 = compiler.GetObjectModule().dataTable.AddWString( Jenga::Common::ToWString( std::string( term, i3 ) ) );
1049 }
1050 else
1051 {
1052 i2 = compiler.GetObjectModule().dataTable.AddString( std::string( term, i3 ) );
1053 }
1054
1055 //mov reg,i2
1056 compiler.codeGenerator.op_mov_RV(sizeof(_int64),UseReg,i2, Schedule::DataTable);
1057
1058 if(UseReg==REG_R14){
1059 //mov qword ptr[rsp+offset],r14 ※スタックフレームを利用
1060 pobj_sf->push(REG_R14);
1061 }
1062 }
1063 else if(IsVariableTopChar(term[0])||
1064 term[0]=='*'||
1065 (term[0]=='.'&&IsVariableTopChar(term[1])))
1066 {
1067 //////////////////
1068 // 何らかの識別子
1069
1070 bool isLiteral;
1071 if( TermOpe( term, baseType, resultType, isLiteral, isNeedHeapFreeStructureStack[sp] ) ){
1072 if(resultType.IsNull()){
1073 //戻り値が存在しないとき
1074 for(i2=0;;i2++){
1075 if(term[i2]=='('||term[i2]=='\0'){
1076 term[i2]=0;
1077 break;
1078 }
1079 }
1080 compiler.errorMessenger.Output(38,term,cp);
1081
1082 goto error;
1083 }
1084
1085 type_stack[sp] = resultType.GetBasicType();
1086 index_stack[sp] = resultType.GetIndex();
1087
1088 if( !isLiteral ){
1089 bLiteralCalculation=0;
1090 }
1091
1092 if( resultType.GetBasicType() & FLAG_CAST ){
1093 // 型名のみ
1094 compiler.errorMessenger.OutputFatalError();
1095 }
1096 else{
1097 if( resultType.IsReal() == false && UseReg==REG_R14 ){
1098 //mov qword ptr[rsp+offset],r14 ※スタックフレームを利用
1099 pobj_sf->push(REG_R14);
1100 }
1101 if( resultType.IsReal() && XmmReg==REG_XMM4 ){
1102 if(resultType.IsDouble()){
1103 //movsd qword ptr[rsp+offset],xmm4 ※スタックフレームを利用
1104 pobj_sf->push(REG_XMM4,sizeof(double));
1105 }
1106 if(resultType.IsSingle()){
1107 //movss dword ptr[rsp+offset],xmm4 ※スタックフレームを利用
1108 pobj_sf->push(REG_XMM4,sizeof(float));
1109 }
1110 }
1111
1112 if( resultType.IsReal() ){
1113 pobj_reg->LockXmmReg();
1114 }
1115 else{
1116 pobj_reg->LockReg();
1117 }
1118 }
1119
1120 sp++;
1121 break;
1122 }
1123
1124
1125 // Nothing
1126 if( lstrcmp( term, "Nothing" ) == 0 ){
1127 isNothing_stack[sp] = true;
1128
1129 if( baseType.IsObject() ){
1130 type_stack[sp] = DEF_OBJECT;
1131 index_stack[sp] = baseType.GetIndex();
1132 }
1133 else{
1134 type_stack[sp] = baseType.GetBasicType();
1135 index_stack[sp] = baseType.GetIndex();
1136 }
1137
1138 bLiteralCalculation = 0;
1139
1140 //xor reg,reg
1141 compiler.codeGenerator.op_zero_reg( UseReg );
1142
1143 if(UseReg==REG_R14){
1144 //mov qword ptr[rsp+offset],r14 ※スタックフレームを利用
1145 pobj_sf->push(REG_R14);
1146 }
1147
1148 pobj_reg->LockReg();
1149 sp++;
1150 break;
1151 }
1152
1153
1154 //////////////
1155 // 定数の場合
1156 //////////////
1157
1158 i3 = compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType(
1159 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( term )
1160 );
1161 if(i3){
1162 if( compiler.GetObjectModule().meta.GetGlobalConsts().IsStringPtr( ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( term ), compiler.IsUnicode() ) ){
1163 //リテラル文字列
1164
1165 if( baseType.IsObject() || baseType.IsNull() )
1166 {
1167 //要求タイプがオブジェクト、または未定のとき
1168
1169 //String型オブジェクトを生成
1170 NewStringObject(UseReg,term);
1171
1172 type_stack[sp]=DEF_OBJECT;
1173 index_stack[sp]=(LONG_PTR)compiler.GetObjectModule().meta.GetClasses().GetStringClassPtr();
1174 bLiteralCalculation=0;
1175
1176 if(bXmm) pobj_reg->LockXmmReg();
1177 else pobj_reg->LockReg();
1178
1179 sp++;
1180 break;
1181 }
1182
1183 double dbl = compiler.GetObjectModule().meta.GetGlobalConsts().GetDoubleData(
1184 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( term )
1185 );
1186 memcpy(&i64data,&dbl,sizeof(double));
1187
1188 //バイト数
1189 i3=lstrlen((char *)i64data);
1190
1191 memcpy(term,(char *)i64data,i3);
1192 term[i3]=0;
1193 goto StrLiteral;
1194 }
1195
1196 type_stack[sp] = i3;
1197 if(IsRealNumberType(i3)){
1198 //実数
1199 double dbl = compiler.GetObjectModule().meta.GetGlobalConsts().GetDoubleData(
1200 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( term )
1201 );
1202 memcpy(&i64data,&dbl,sizeof(double));
1203 goto Literal;
1204 }
1205 else if(IsWholeNumberType(i3)){
1206 //整数
1207 i64data = compiler.GetObjectModule().meta.GetGlobalConsts().GetWholeData(
1208 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( term )
1209 );
1210 goto Literal;
1211 }
1212 else{
1213 compiler.errorMessenger.Output(1,NULL,0);
1214 goto error;
1215 }
1216 }
1217
1218
1219 //該当する識別子が見当たらないときはエラー扱いにする
1220 bError=1;
1221 compiler.errorMessenger.Output(3,term,cp);
1222 type_stack[sp]=DEF_DOUBLE;
1223 }
1224 else{
1225 //リテラル値
1226 type_stack[sp]=GetLiteralValue(term,&i64data,baseType.GetBasicType());
1227Literal:
1228 if(type_stack[sp]==DEF_DOUBLE){
1229 //64ビット浮動小数型
1230 bXmm=1;
1231
1232 if(XmmReg==REG_XMM4){
1233 //mov r14,i64data
1234 compiler.codeGenerator.op_mov_RV64(REG_R14,i64data);
1235
1236
1237 //mov qword ptr[rsp+offset],r14 ※スタックフレームを利用
1238 pobj_sf->push(REG_R14);
1239 }
1240 else{
1241 i3 = compiler.GetObjectModule().dataTable.Add( i64data );
1242
1243 //movlpd xmm_reg,qword ptr[data table offset]
1244 compiler.codeGenerator.op_movlpd_RM( XmmReg, 0, i3, MOD_DISP32, Schedule::DataTable );
1245 }
1246 }
1247 else if(type_stack[sp]==DEF_SINGLE){
1248 //32ビット浮動小数型
1249 bXmm=1;
1250
1251 float flt;
1252 int i32data;
1253 memcpy(&dbl,&i64data,sizeof(double));
1254 flt=(float)dbl;
1255 memcpy(&i32data,&flt,sizeof(long));
1256
1257 if(XmmReg==REG_XMM4){
1258 compiler.errorMessenger.OutputFatalError(); // TODO: 未実装
1259 //push term
1260 //compiler.codeGenerator.op_push_value(i32data);
1261 }
1262 else{
1263 i3=compiler.GetObjectModule().dataTable.Add( i32data );
1264
1265 //movss xmm_reg,dword ptr[data table offset]
1266 compiler.codeGenerator.op_movss_RM( XmmReg, 0, i3, MOD_DISP32, Schedule::DataTable );
1267 }
1268 }
1269 else{
1270 //整数
1271
1272 index_stack[sp]=GetLiteralIndex(i64data);
1273
1274 //mov reg,i64data
1275 compiler.codeGenerator.op_mov_RV64(UseReg,i64data);
1276
1277 if(UseReg==REG_R14){
1278 //mov qword ptr[rsp+offset],r14 ※スタックフレームを利用
1279 pobj_sf->push(REG_R14);
1280 }
1281 }
1282 }
1283
1284 if(bXmm) pobj_reg->LockXmmReg();
1285 else pobj_reg->LockReg();
1286
1287 sp++;
1288 break;
1289
1290 //論理演算子
1291 case CALC_XOR:
1292 case CALC_OR:
1293 case CALC_AND:
1294 if(!CalcTwoTerm_Logical(idCalc,type_stack,index_stack,&sp)) goto error;
1295 break;
1296 case CALC_NOT:
1297 //value[sp-1]=Not value[sp-1]
1298 //NOT演算子
1299 if(!Calc_Not(type_stack,sp)) goto error;
1300 break;
1301
1302 //比較演算子
1303 case CALC_PE: //value[sp-2] <= value[sp-1]
1304 case CALC_QE: //value[sp-2] >= value[sp-1]
1305 case CALC_P: //value[sp-2] < value[sp-1]
1306 case CALC_Q: //value[sp-2] > value[sp-1]
1307 case CALC_NOTEQUAL: //value[sp-2] <> value[sp-1]
1308 case CALC_EQUAL: //value[sp-2] = value[sp-1]
1309 if(!CalcTwoTerm_Relational(idCalc,type_stack,index_stack,&sp)) goto error;
1310 break;
1311
1312 //ビットシフト
1313 case CALC_SHL: //value[sp-2] << value[sp-1]
1314 case CALC_SHR: //value[sp-2] >> value[sp-1]
1315 if(!Calc_Shift(idCalc,type_stack,&sp)) goto error;
1316 break;
1317
1318 //算術演算
1319 case CALC_ADDITION:
1320 case CALC_SUBTRACTION:
1321 case CALC_PRODUCT:
1322 if(!CalcTwoTerm_Arithmetic(idCalc,type_stack,index_stack,&sp)) goto error;
1323 break;
1324 case CALC_MOD:
1325 //value[sp-2]%=value[sp-1]
1326 //剰余演算
1327 if(!Calc_Mod(type_stack,index_stack,&sp)) goto error;
1328 break;
1329 case CALC_QUOTIENT:
1330 //value[sp-2]/=value[sp-1];
1331 //除算
1332 if(!Calc_Divide(type_stack,&sp,baseType.GetBasicType())) goto error;
1333 break;
1334 case CALC_INTQUOTIENT:
1335 //value[sp-2]/=value[sp-1]
1336 //整数除算
1337 if(!Calc_IntDivide(type_stack,index_stack,&sp)) goto error;
1338 break;
1339 case CALC_MINUSMARK:
1340 //value[sp-1]=-value[sp-1]
1341 //符号反転
1342 if(!Calc_MinusMark(type_stack,sp)) goto error;
1343 break;
1344 case CALC_POWER:
1345 //べき乗演算(浮動小数点演算のみ)
1346 if(!Calc_Power(type_stack,&sp)) goto error;
1347 break;
1348 case CALC_AS:
1349 //キャスト
1350 if(!Calc_Cast(type_stack,index_stack,&sp)) goto error;
1351 break;
1352 case CALC_BYVAL:
1353 //ポインタ型→参照型
1354 if( PTR_LEVEL( type_stack[sp-1] ) <= 0 ){
1355 //ポインタ型ではないとき
1356 compiler.errorMessenger.Output( 1, NULL, cp );
1357 goto error;
1358 }
1359
1360 type_stack[sp-1] = PTR_LEVEL_DOWN( type_stack[sp-1] );
1361
1362 break;
1363
1364 default:
1365 compiler.errorMessenger.Output(300,NULL,cp);
1366 goto error;
1367 }
1368 }
1369
1370 if(bError) goto error;
1371
1372 if(sp!=1){
1373 compiler.errorMessenger.Output(1,NULL,cp);
1374 goto error;
1375 }
1376
1377 if(bLiteralCalculation){
1378 compiler.errorMessenger.OutputFatalError();
1379 }
1380 else{
1381 //右辺値が数値の定数式ではないとき
1382 if(IS_LITERAL(index_stack[0])) index_stack[0]=-1;
1383 }
1384
1385 if( pbIsNeedHeapFreeStructure )
1386 {
1387 *pbIsNeedHeapFreeStructure = isNeedHeapFreeStructureStack[0];
1388 }
1389
1390 if(IsRealNumberType(type_stack[0]))
1391 *pReg=pobj_reg->UnlockXmmReg();
1392 else
1393 *pReg=pobj_reg->UnlockReg();
1394
1395
1396 resultType.SetType( type_stack[0], index_stack[0] );
1397
1398 bool isSuccessful = true;
1399 goto finish;
1400
1401
1402
1403 //////////////////
1404 // エラー処理
1405 //////////////////
1406
1407error:
1408
1409 isSuccessful = false;
1410 goto finish;
1411
1412
1413
1414
1415finish:
1416
1417 for(i=0;i<pnum;i++){
1418 if(values[i]) HeapDefaultFree(values[i]);
1419 }
1420
1421 return isSuccessful;
1422}
1423
1424bool NumOpe( int *pReg,
1425 const char *expression,
1426 const Type &baseType,
1427 Type &resultType,
1428 bool *pbIsNeedHeapFreeStructure )
1429{
1430 bool isInitRegSwitch = false;
1431 if( !pobj_reg )
1432 {
1433 isInitRegSwitch = true;
1434
1435 //作業用レジスタを取得
1436 pobj_reg = new CRegister( *pReg );
1437 }
1438
1439 //エラー時の復旧用
1440 CRegister objReg_Backup = *pobj_reg;
1441
1442 *pReg = pobj_reg->GetNextReg();
1443
1444
1445 bool result = _numope( pReg, expression, baseType, resultType, pbIsNeedHeapFreeStructure );
1446
1447
1448 if( !result )
1449 {
1450 *pobj_reg = objReg_Backup;
1451 }
1452
1453 if( isInitRegSwitch ){
1454 //整合性をチェック(バグ回避)
1455 if( result )
1456 {
1457 pobj_reg->bug_check();
1458 }
1459
1460 //作業レジスタを解放
1461 delete pobj_reg;
1462 pobj_reg = NULL;
1463 }
1464
1465 return result;
1466}
Note: See TracBrowser for help on using the repository browser.