• R/O
  • SSH
  • HTTPS

adp: Commit


Commit MetaInfo

Revision302 (tree)
Time2012-06-08 00:51:39
Authorohfuji

Log Message

一部の関数を分割した

Change Summary

Incremental Difference

--- trunk/adp_builtin.h (revision 301)
+++ trunk/adp_builtin.h (revision 302)
@@ -196,7 +196,7 @@
196196 virtual bool first(PException &excp) {
197197 if ( pred->size() != 3 ) return RERR_argment_number(excp, 3);
198198 const PObject **args = &pred->arglist.value.front();
199- PObject *dst = add(args[0], args[1], pobjs, false);
199+ PObject *dst = add(args[0], args[1], pobjs);
200200 if ( !dst ) return RERR_NOTSUPPORT_EXPRESSION(excp);
201201 return args[2]->unify(*dst, this);
202202 };
@@ -516,7 +516,7 @@
516516 if ( !dst ) return RERR_argment_type(excp, 1);
517517
518518 const PObject **args = &pred->arglist.value.front();
519- PObject *result = add(args[1], args[0], p->pobjs, true); // debug
519+ PObject *result = addw(args[1], args[0], p->pobjs); // debug
520520 if ( !result ) return RERR_NOTSUPPORT_EXPRESSION(excp);
521521 let( result, dst);
522522 return true;
--- trunk/adp_execute.h (revision 301)
+++ trunk/adp_execute.h (revision 302)
@@ -303,21 +303,28 @@
303303
304304 // Expression functions
305305 // __forceinlineは指定しない方が速かった
306- PObject *add(const PObject *args0, const PObject *args1, PObjectArray *pobjs_, bool w) __attribute__((always_inline)) {
306+ PObject *add(const PObject *args0, const PObject *args1, PObjectArray *pobjs_) __attribute__((always_inline)) {
307307 // 試しの最適化
308308 const PINTEGER *a1 = args0->p_integer(this);
309309 const PINTEGER *a2 = args1->p_integer(this);
310310 if ( a1 && a2 ) {
311- if ( w ) {
312- PInteger *ret = dynamic_cast<PInteger *>(const_cast<PObject*>(args0));
313- if ( ret != 0 ) {
314- ret->value = *a1 + *a2;
315- return ret;
316- }
311+ return pmm.newPInteger( pobjs_, *a1 + *a2);
312+ }
313+ return args0->getval(this)->add(*args1->getval(this),pobjs_, false);
314+ }
315+ PObject *addw(const PObject *args0, const PObject *args1, PObjectArray *pobjs_) __attribute__((always_inline)) {
316+ // 試しの最適化
317+ const PINTEGER *a1 = args0->p_integer(this);
318+ const PINTEGER *a2 = args1->p_integer(this);
319+ if ( a1 && a2 ) {
320+ PInteger *ret = dynamic_cast<PInteger *>(const_cast<PObject*>(args0));
321+ if ( ret != 0 ) {
322+ ret->value = *a1 + *a2;
323+ return ret;
317324 }
318325 return pmm.newPInteger( pobjs_, *a1 + *a2);
319326 }
320- return args0->getval(this)->add(*args1->getval(this),pobjs_, w);
327+ return args0->getval(this)->add(*args1->getval(this),pobjs_, true);
321328 }
322329
323330 PObject *sub(const PObject *args0, const PObject *args1, PObjectArray *pobjs_) __attribute__((always_inline)) {
Show on old repository browser