--- parser3/src/main/execute.C 2003/02/17 10:44:55 1.295.2.11 +++ parser3/src/main/execute.C 2003/02/17 15:34:19 1.295.2.13 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_EXECUTE_C="$Date: 2003/02/17 10:44:55 $"; +static const char* IDENT_EXECUTE_C="$Date: 2003/02/17 15:34:19 $"; #include "pa_opcode.h" #include "pa_array.h" @@ -23,7 +23,7 @@ static const char* IDENT_EXECUTE_C="$Dat #include "pa_vimage.h" #include "pa_wwrapper.h" -//#define DEBUG_EXECUTE +#define DEBUG_EXECUTE //#define DEBUG_STRING_APPENDS_VS_EXPANDS @@ -99,20 +99,14 @@ void debug_dump(SAPI_Info& sapi_info, in case OP_OBJECT_POOL: case OP_STRING_POOL: case OP_CALL: - ArrayOperation& local_ops=*i.next().ops; - debug_dump(sapi_info, level+1, local_ops); + case OP_CALL__WRITE: + if(ArrayOperation* local_ops=i.next().ops.get()) + debug_dump(sapi_info, level+1, *local_ops); } } } #endif -/*#define stack.push(value) stack.push(value.get()) -#define stack.pop().value static_cast(stack.pop()) - -#define stack.push(value) stack.push(value) -#define stack.pop().string static_cast(stack.pop())->as_string(&pool()).get() -#define POP_CODE() static_cast(stack.pop()) -*/ // Request void Request::execute(ArrayOperation& ops) { @@ -161,7 +155,7 @@ void Request::execute(ArrayOperation& op // maybe they do ^class:method[] call, remember the fact wcontext->set_somebody_entered_some_class(); - name=stack.pop().string; + name=stack.pop().string(); value=classes().get(name); if(!value) throw Exception("parser.runtime", @@ -203,7 +197,7 @@ void Request::execute(ArrayOperation& op case OP_CONSTRUCT_VALUE: { value=stack.pop().value; - name=stack.pop().string; + name=stack.pop().string(); ncontext=stack.pop().value.get(); ncontext->put_element(name, value, false); break; @@ -214,7 +208,7 @@ void Request::execute(ArrayOperation& op wcontext->set_in_expression(false); value=stack.pop().value; - name=stack.pop().string; + name=stack.pop().string(); ncontext=stack.pop().value.get(); ncontext->put_element(name, value->as_expr_result(), false); break; @@ -233,7 +227,7 @@ void Request::execute(ArrayOperation& op wcontext, local_ops)))); - name=stack.pop().string; + name=stack.pop().string(); ncontext=stack.pop().value.get(); ncontext->put_element(name, value, false); break; @@ -340,7 +334,7 @@ void Request::execute(ArrayOperation& op case OP_STORE_PARAM: { value=stack.pop().value; - VMethodFrame *frame=static_cast(stack.top_value().unknown); + VMethodFrame *frame=static_cast(stack.top_value().ptr); // this op is executed from CALL local_ops only, so may skip the check "method_frame_to_fill==0" frame->store_param(value); break; @@ -350,7 +344,7 @@ void Request::execute(ArrayOperation& op { // code local_ops=i.next().ops; - VMethodFrame *frame=static_cast(stack.top_value().unknown); + VMethodFrame *frame=static_cast(stack.top_value().ptr); #ifdef DEBUG_EXECUTE debug_printf(sapi_info, " (%d)\n", local_ops->count()); debug_dump(sapi_info, 1, *local_ops); @@ -391,8 +385,9 @@ void Request::execute(ArrayOperation& op { local_ops=i.next().ops; #ifdef DEBUG_EXECUTE - debug_printf(sapi_info, " (%d)\n", local_ops->count()); - debug_dump(sapi_info, 1, *local_ops); + debug_printf(sapi_info, " (%d)\n", local_ops?local_ops->count():0); + if(local_ops) + debug_dump(sapi_info, 1, *local_ops); debug_printf(sapi_info, "->\n"); #endif @@ -417,7 +412,7 @@ void Request::execute(ArrayOperation& op value->type()); */ - VMethodFrame frame(pool(), last_get_element_name, *junction, method_frame/*caller*/); + VMethodFrame frame(pool(), last_get_element_name, *junction, method_frame/*caller*/); frame.ref(); if(local_ops){ // store param code goes here stack.push(&frame); // argument for *STORE_PARAM ops execute(*local_ops); @@ -837,7 +832,7 @@ void Request::execute(ArrayOperation& op @bug ^superbase:method would dynamically call ^base:method if there is any */ ValuePtr Request::get_element(StringPtr& remember_name, bool can_call_operator) { - StringPtr name=stack.pop().string; remember_name=name; + StringPtr name=stack.pop().string(); remember_name=name; Value* ncontext=stack.pop().value.get(); ValuePtr value(0); if(can_call_operator) { @@ -980,15 +975,13 @@ StringPtr Request::execute_method(ValueP WContext *saved_wcontext=wcontext; Junction local_junction(aself, &method, 0,0,0, ArrayOperationPtr(0)); - VMethodFrame local_frame(pool(), method.name, local_junction, method_frame/*caller*/); + VMethodFrame local_frame(pool(), method.name, local_junction, method_frame/*caller*/); local_frame.ref(); if(optional_param && local_frame.can_store_param()) { local_frame.store_param(optional_param); local_frame.fill_unspecified_params(); } local_frame.set_self(aself); rcontext=wcontext=method_frame=&local_frame; - // preventing local object from deletes - local_frame.ref(); // prevent non-string writes for better error reporting if(do_return_string)