--- parser3/src/main/execute.C 2003/01/31 12:34:35 1.295.2.4 +++ parser3/src/main/execute.C 2003/03/18 09:53:01 1.295.4.2 @@ -1,11 +1,11 @@ /** @file Parser: executor part of request class. - Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_EXECUTE_C="$Date: 2003/01/31 12:34:35 $"; +static const char* IDENT_EXECUTE_C="$Date: 2003/03/18 09:53:01 $"; #include "pa_opcode.h" #include "pa_array.h" @@ -62,13 +62,13 @@ char *opcode_name[]={ "IS" }; -void va_debug_printf(Pool& pool, const char* fmt,va_list args) { +void va_debug_printf(Pool& pool, const char *fmt,va_list args) { char buf[MAX_STRING]; vsnprintf(buf, MAX_STRING, fmt, args); SAPI::log(pool, "%s", buf); } -void debug_printf(Pool& pool, const char* fmt, ...) { +void debug_printf(Pool& pool, const char *fmt, ...) { va_list args; va_start(args,fmt); va_debug_printf(pool,fmt,args); @@ -100,6 +100,7 @@ void debug_dump(Pool& pool, int level, c case OP_OBJECT_POOL: case OP_STRING_POOL: case OP_CALL: + case OP_CALL__WRITE: const Array *local_ops=reinterpret_cast(i.next()); debug_dump(pool, level+1, *local_ops); } @@ -112,14 +113,6 @@ void debug_dump(Pool& pool, int level, c #define POP_NAME() static_cast(stack.pop())->as_string() #define POP_CODE() static_cast(stack.pop()) -// ArrayOperation - -ArrayOperation::~ArrayOperation() { - // go through code, and recoursively delete [free] array/value pointers -} - -// Request - void Request::execute(const Array& ops) { // _asm int 3; #ifdef DEBUG_EXECUTE @@ -133,7 +126,7 @@ void Request::execute(const Array& ops) while(i.has_next()) { if(interrupted()) throw Exception("parser.interrupted", - Exception::undefined_source, + 0, "execution stopped"); Operation op; @@ -394,6 +387,8 @@ void Request::execute(const Array& ops) case OP_CALL: case OP_CALL__WRITE: { +// pool().collect_garbage(); + Array *local_ops=static_cast(i.next()); #ifdef DEBUG_EXECUTE debug_printf(pool(), " (%d)\n", local_ops->size()); @@ -440,7 +435,7 @@ void Request::execute(const Array& ops) if(frame.junction.method->call_type!=Method::CT_STATIC) { // this is a constructor call - if(ValuePtr value=called_class->create_new_value()) { + if(Value *value=called_class->create_new_value(pool())) { // some stateless_class creatable derivates new_self=value; } else @@ -473,6 +468,16 @@ void Request::execute(const Array& ops) method.call_type==Method::CT_ANY || method.call_type==call_type) { // allowed call type? try { + { + char buf[MAX_STRING]; + const String& name=frame.name(); + snprintf(buf, MAX_STRING, "%s(%d): %s", + name.origin().file?name.origin().file:"unknown", + name.origin().line, + name.cstr()); + pool().log_high_watermark(buf); + } + method_frame=&frame; if(method.native_code) { // native code? method.check_actual_numbered_params( @@ -551,7 +556,7 @@ void Request::execute(const Array& ops) { /// @test String::cmp Value *operand=POP(); - const char* path=operand->as_string().cstr(); + const char *path=operand->as_string().cstr(); value=NEW VBool(pool(), info.uri && strncmp(path, info.uri, strlen(path))==0); PUSH(value);