• R/O
  • SSH
  • HTTPS

adp: Commit


Commit MetaInfo

Revision286 (tree)
Time2012-06-05 20:38:43
Authorohfuji

Log Message

若干高速化

Change Summary

Incremental Difference

--- trunk/adp_unify.cpp (revision 285)
+++ trunk/adp_unify.cpp (revision 286)
@@ -18,8 +18,6 @@
1818 */
1919 #include "adp.h"
2020
21-#define MYDEBUG_UNIFY 0
22-
2321 /*************************************** getPridicate() ******************************************/
2422 const PPredicate *PVeriable::getPredicate(VLocal *local) const
2523 {
--- trunk/adp_execute.h (revision 285)
+++ trunk/adp_execute.h (revision 286)
@@ -704,8 +704,9 @@
704704 virtual bool first(PException &excp) {
705705 // 親のローカル変数の値をcloneする、
706706 for ( size_t i = 0; i < p->hlocal.size(); i++ ) {
707- if ( p->hlocal[i] != 0 ) {
708- p->hlocal[i] = p->hlocal[i]->getval(p,&p->hlocal)->clone(&p->objs);
707+ const PObject *o = p->hlocal[i];
708+ if ( o != 0 && !o->isc() ) {
709+ p->hlocal[i] = o->getval(p,&p->hlocal)->clone(&p->objs);
709710 }
710711 }
711712 for ( size_t i = 0; i < p->goalidx; i++ ) {
--- trunk/adp.cpp (revision 285)
+++ trunk/adp.cpp (revision 286)
@@ -23,12 +23,12 @@
2323
2424 // 定数
2525 #ifdef ___X64____
26-#define VERSION_TEXT "ADP Ver 0.81.0280 X64 (http://www.adp.la/)\nCopyright (C) 2010-2012 Katsuhisa Ohfuji. This progman is distributed under GPL.\n"
26+#define VERSION_TEXT "ADP Ver 0.82.0286 X64 (http://www.adp.la/)\nCopyright (C) 2010-2012 Katsuhisa Ohfuji. This progman is distributed under GPL.\n"
2727 #else
2828 #if _WIN32
29-#define VERSION_TEXT "ADP Ver 0.81.0280 x86 (http://www.adp.la/)\nCopyright (C) 2010-2012 Katsuhisa Ohfuji. This progman is distributed under GPL.\n"
29+#define VERSION_TEXT "ADP Ver 0.82.0286 x86 (http://www.adp.la/)\nCopyright (C) 2010-2012 Katsuhisa Ohfuji. This progman is distributed under GPL.\n"
3030 #else
31-#define VERSION_TEXT "ADP Ver 0.81.0280 (http://www.adp.la/)\nCopyright (C) 2010-2012 Katsuhisa Ohfuji. This progman is distributed under GPL.\n"
31+#define VERSION_TEXT "ADP Ver 0.82.0286 (http://www.adp.la/)\nCopyright (C) 2010-2012 Katsuhisa Ohfuji. This progman is distributed under GPL.\n"
3232 #endif
3333 #endif
3434
--- trunk/adp_execute.cpp (revision 285)
+++ trunk/adp_execute.cpp (revision 286)
@@ -643,34 +643,30 @@
643643 if ( flg ) {
644644 size_t hsiz = horn->head.arglist.value.size();
645645 size_t gsiz = pred->arglist.value.size();
646- ExecContext *e = goal->nobacktrack == true ? this->p : this;
647- ArrayNoexpand<size_t> *bk = this->p->pafterunify;
648- this->p->pafterunify = 0;
649646 this->pafterunify = 0;
650647 // 実行後の代入処理
651648 for ( ArrayNoexpand<size_t>::iterator i = afterunify.begin(); i < afterunify.end(); i++ ) {
652649 if ( hsiz == gsiz || ((*i) < hsiz - 1 && (*i) < gsiz - 1) ) {
653- flg = horn->head.arglist.value[*i]->unify( *pred->arglist.value[*i], e, hl, gl);
650+ flg = horn->head.arglist.value[*i]->unify( *pred->arglist.value[*i], this, hl, gl);
654651 } else if ( gsiz < hsiz ) {
655- flg = pred->arglist.value[*i]->unify( *ao, e, gl, hl);
652+ flg = ao->unify( *pred->arglist.value[*i], this, hl, gl);
656653 } else {
657- flg = horn->head.arglist.value[*i]->unify( *ao, e, hl, gl);
654+ flg = horn->head.arglist.value[*i]->unify( *ao, this, hl, gl);
658655 }
659656 if ( !flg ) {
660657 break;
661658 }
662659 }
663- this->p->pafterunify = bk;
664660 if ( flg ) {
665661 if ( goal->nobacktrack == true ) {
666662 // ↓変数の受け渡しをclone/deleteで行っているが、objs間の移動の方が効率はよくないか?(検索が入るのでこちらの方が早い?)
667663 // バグフィックス
668664 #if 1
669- for ( size_t i = 0; i < pred->arglist.size(); i++ ) {
670- const PVeriable *v = dynamic_cast<const PVeriable*>((*pred)[i]);
665+ for ( ArrayNoexpand<size_t>::iterator i = afterunify.begin(); i < afterunify.end(); i++ ) {
666+ const PVeriable *v = dynamic_cast<const PVeriable*>((*pred)[*i]);
671667 if ( v ) {
672668 const PObject *p = (*gl)[v->idx];
673- if ( p ) (*gl)[v->idx] = p->getval(this->p,gl)->clone(&this->p->objs);
669+ if ( p ) (*gl)[v->idx] = p->getval(this,gl)->clone(&this->p->objs);
674670 }
675671 }
676672 #endif
@@ -730,32 +726,28 @@
730726 // 実行後の代入処理
731727 size_t hsiz = horn->head.arglist.value.size();
732728 size_t gsiz = pred->arglist.value.size();
733- ExecContext *e = goal->nobacktrack == true ? this->p : this;
734- ArrayNoexpand<size_t> *bk = this->p->pafterunify;
735- this->p->pafterunify = 0;
736729 this->pafterunify = 0;
737730 // 実行後の代入処理
738731 for ( ArrayNoexpand<size_t>::iterator i = afterunify.begin(); i < afterunify.end(); i++ ) {
739732 if ( hsiz == gsiz || ((*i) < hsiz - 1 && (*i) < gsiz - 1) ) {
740- flg = horn->head.arglist.value[*i]->unify( *pred->arglist.value[*i], e, hl, gl);
733+ flg = horn->head.arglist.value[*i]->unify( *pred->arglist.value[*i], this, hl, gl);
741734 } else if ( gsiz < hsiz ) {
742- flg = pred->arglist.value[*i]->unify( *ao, e, gl, hl);
735+ flg = ao->unify( *pred->arglist.value[*i], this, hl, gl);
743736 } else {
744- flg = horn->head.arglist.value[*i]->unify( *ao, e, hl, gl);
737+ flg = horn->head.arglist.value[*i]->unify( *ao, this, hl, gl);
745738 }
746739 if ( !flg ) break;
747740 }
748- this->p->pafterunify = bk;
749741 if ( flg ) {
750742 if ( goal->nobacktrack == true ) {
751743 // ↓変数の受け渡しをclone/deleteで行っているが、objs間の移動の方が効率はよくないか?(検索が入るのでこちらの方が早い?)
752744 // バグフィックス
753745 #if 1
754- for ( size_t i = 0; i < pred->arglist.size(); i++ ) {
755- const PVeriable *v = dynamic_cast<const PVeriable*>((*pred)[i]);
746+ for ( ArrayNoexpand<size_t>::iterator i = afterunify.begin(); i < afterunify.end(); i++ ) {
747+ const PVeriable *v = dynamic_cast<const PVeriable*>((*pred)[*i]);
756748 if ( v ) {
757749 const PObject *p = (*gl)[v->idx];
758- if ( p ) (*gl)[v->idx] = p->getval(this->p,gl)->clone(&this->p->objs);
750+ if ( p ) (*gl)[v->idx] = p->getval(this,gl)->clone(&this->p->objs);
759751 }
760752 }
761753 #endif
--- trunk/readme.txt (revision 285)
+++ trunk/readme.txt (revision 286)
@@ -1,5 +1,5 @@
11 ===========================================================================
2-ADP(Another Data Processor)Ver 0.81
2+ADP(Another Data Processor)Ver 0.82
33 Copyright (C) 2010-2012 Katsuhisa Ohfuji
44 This progman is distributed under GPL.
55
Show on old repository browser