--- parser3/src/main/execute.C 2001/07/26 10:47:02 1.185 +++ parser3/src/main/execute.C 2001/08/02 06:54:12 1.188 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) */ -static const char *RCSId="$Id: execute.C,v 1.185 2001/07/26 10:47:02 parser Exp $"; +static const char *RCSId="$Id: execute.C,v 1.188 2001/08/02 06:54:12 parser Exp $"; #include "pa_opcode.h" #include "pa_array.h" @@ -24,7 +24,7 @@ static const char *RCSId="$Id: execute.C //#define DEBUG_EXECUTE -const uint ANTI_ENDLESS_EXECUTE_RECOURSION=500; +const uint ANTI_ENDLESS_EXECUTE_RECOURSION=400; #ifdef DEBUG_EXECUTE char *opcode_name[]={ @@ -32,7 +32,7 @@ char *opcode_name[]={ "VALUE", "CURLY_CODE__STORE_PARAM", "EXPR_CODE__STORE_PARAM", // actions - "WITH_SELF", "WITH_READ", "WITH_WRITE", + "WITH_ROOT", "WITH_SELF", "WITH_READ", "WITH_WRITE", "GET_CLASS", "CONSTRUCT_VALUE", "CONSTRUCT_EXPR", "CURLY_CODE__CONSTRUCT", "WRITE_VALUE", "WRITE_EXPR_RESULT", "STRING__WRITE", @@ -41,7 +41,7 @@ char *opcode_name[]={ "CREATE_SWPOOL", "REDUCE_SWPOOL", "GET_METHOD_FRAME", "STORE_PARAM", - "CALL_CONSTRUCTOR", "OP_CALL_METHOD", + "PREPARE_TO_CONSTRUCT_OBJECT", "CALL", // expression ops: unary "NEG", "INV", "NOT", "DEF", "IN", "FEXISTS", "DEXISTS", @@ -184,6 +184,11 @@ void Request::execute(const Array& ops) } // OP_WITH + case OP_WITH_ROOT: + { + PUSH(root); + break; + } case OP_WITH_SELF: { PUSH(self); @@ -290,7 +295,7 @@ void Request::execute(const Array& ops) PUSH(wcontext); PUSH((void *)flang); flang=String::UL_PASS_APPENDED; - wcontext=NEW WWrapper(pool(), 0 /*empty*/, true /*constructing*/); + wcontext=NEW WWrapper(pool(), 0 /*empty*/); break; } case OP_REDUCE_EWPOOL: @@ -305,7 +310,7 @@ void Request::execute(const Array& ops) case OP_CREATE_SWPOOL: { PUSH(wcontext); - wcontext=NEW WWrapper(pool(), 0 /*empty*/, false /*not constructing*/); + wcontext=NEW WWrapper(pool(), 0 /*empty*/); break; } case OP_REDUCE_SWPOOL: @@ -350,8 +355,12 @@ void Request::execute(const Array& ops) break; } - case OP_CALL_METHOD: - case OP_CALL_CONSTRUCTOR: + case OP_PREPARE_TO_CONSTRUCT_OBJECT: + { + wcontext->constructing(true); + break; + } + case OP_CALL: { #ifdef DEBUG_EXECUTE debug_printf(pool(), "->\n"); @@ -364,7 +373,8 @@ void Request::execute(const Array& ops) PUSH(wcontext); VStateless_class *called_class=frame->junction.self.get_class(); - if(op.code==OP_CALL_CONSTRUCTOR) { + if(wcontext->constructing()) { + wcontext->constructing(false); if(frame->junction.method->call_type!=Method::CT_STATIC) { // this is a constructor call @@ -772,7 +782,7 @@ Value& Request::process(Value& value, co frame=NEW VCodeFrame(pool(), *junction->wcontext); } else { // plain wwrapper - frame=NEW WWrapper(pool(), 0/*empty*/, false/*not constructing*/); + frame=NEW WWrapper(pool(), 0/*empty*/); } //frame->set_name(value.name()); @@ -814,7 +824,7 @@ const String *Request::execute_method(Va // initialize contexts root=rcontext=self=&aself; - wcontext=NEW WWrapper(pool(), &aself, false /*not constructing*/); + wcontext=NEW WWrapper(pool(), &aself); // execute! execute(*method.parser_code); @@ -842,7 +852,7 @@ const String *Request::execute_virtual_m if(Junction *junction=value->get_junction()) if(const Method *method=junction->method) return execute_method(aself, *method, return_cstr); - + return 0; }