|
|
| version 1.72, 2001/03/08 13:52:10 | version 1.74, 2001/03/08 15:19:37 |
|---|---|
| Line 92 void Request::execute(const Array& ops) | Line 92 void Request::execute(const Array& ops) |
| for(int i=0; i<size; i++) { | for(int i=0; i<size; i++) { |
| Operation op; | Operation op; |
| op.cast=ops.quick_get(i); | op.cast=ops.quick_get(i); |
| fprintf(stderr, "%d:%s", stack.top()+1, opcode_name[op.code]); fflush(stderr); | fprintf(stderr, "%d:%s", stack.top_index(), opcode_name[op.code]); fflush(stderr); |
| switch(op.code) { | switch(op.code) { |
| // param in next instruction | // param in next instruction |
| Line 105 void Request::execute(const Array& ops) | Line 105 void Request::execute(const Array& ops) |
| } | } |
| case OP_CODE__STORE_PARAM: | case OP_CODE__STORE_PARAM: |
| { | { |
| VMethodFrame *frame=static_cast<VMethodFrame *>(stack[stack.top()]); | VMethodFrame *frame=static_cast<VMethodFrame *>(stack.top_value()); |
| // code | // code |
| const Array *local_ops=reinterpret_cast<const Array *>(ops.quick_get(++i)); | const Array *local_ops=reinterpret_cast<const Array *>(ops.quick_get(++i)); |
| fprintf(stderr, " (%d)\n", local_ops->size()); | fprintf(stderr, " (%d)\n", local_ops->size()); |
| Line 258 void Request::execute(const Array& ops) | Line 258 void Request::execute(const Array& ops) |
| case OP_STORE_PARAM: | case OP_STORE_PARAM: |
| { | { |
| Value *value=POP(); | Value *value=POP(); |
| VMethodFrame *frame=static_cast<VMethodFrame *>(stack[0]); | VMethodFrame *frame=static_cast<VMethodFrame *>(stack.top_value()); |
| frame->store_param(value); | frame->store_param(value); |
| break; | break; |
| } | } |
| Line 274 void Request::execute(const Array& ops) | Line 274 void Request::execute(const Array& ops) |
| PUSH(wcontext); | PUSH(wcontext); |
| VClass *called_class=frame->junction.self.get_class(); | VClass *called_class=frame->junction.self.get_class(); |
| // constructing? | // is context object or class & is it my class or my parent's class? |
| if(wcontext->constructing()) { // yes | VClass *read_class=rcontext->get_class(); |
| // constructor call: $some(^class:method(..)) | if(read_class && read_class->is_or_derived_from(*called_class)) // yes |
| self=NEW VObject(pool(), *called_class); | self=rcontext; // class dynamic call |
| frame->write(*self); | else { // no, not me or relative of mine (total stranger) |
| } else { // no | // constructing? |
| // context is object or class & is it my class or my parent's class? | if(wcontext->constructing()) { // yes |
| VClass *read_class=rcontext->get_class(); | // constructor call: $some(^class:method(..)) |
| if(read_class && read_class->is_or_derived_from(*called_class)) // yes | self=NEW VObject(pool(), *called_class); |
| self=rcontext; // class dynamic call | frame->write(*self); |
| else // no | } else { // no |
| self=&frame->junction.self; // static or simple dynamic call | self=&frame->junction.self; // static or simple dynamic call |
| } | |
| } | } |
| frame->set_self(*self); | frame->set_self(*self); |
| root=rcontext=wcontext=frame; | root=rcontext=wcontext=frame; |