|
|
| version 1.368, 2012/03/16 09:24:12 | version 1.373, 2015/04/08 18:08:53 |
|---|---|
| Line 21 | Line 21 |
| #include "pa_vimage.h" | #include "pa_vimage.h" |
| #include "pa_wwrapper.h" | #include "pa_wwrapper.h" |
| volatile const char * IDENT_EXECUTE_C="$Id$" IDENT_PA_VCODE_FRAME_H IDENT_PA_WWRAPPER_H; | volatile const char * IDENT_EXECUTE_C="$Id$" IDENT_PA_OPCODE_H IDENT_PA_OPERATION_H IDENT_PA_VCODE_FRAME_H IDENT_PA_WWRAPPER_H; |
| //#define DEBUG_EXECUTE | //#define DEBUG_EXECUTE |
| Line 76 char *opcode_name[]={ | Line 76 char *opcode_name[]={ |
| "WITH_SELF__VALUE__CONSTRUCT_VALUE", | "WITH_SELF__VALUE__CONSTRUCT_VALUE", |
| #endif | #endif |
| #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL | |
| "GET_ELEMENT__SPECIAL", | |
| "GET_ELEMENT__SPECIAL__WRITE", | |
| #endif | |
| // expression ops: unary | // expression ops: unary |
| "NEG", "INV", "NOT", "DEF", "IN", "FEXISTS", "DEXISTS", | "NEG", "INV", "NOT", "DEF", "IN", "FEXISTS", "DEXISTS", |
| // expression ops: binary | // expression ops: binary |
| Line 263 void Request::execute(ArrayOperation& op | Line 267 void Request::execute(ArrayOperation& op |
| wcontext->set_somebody_entered_some_class(); | wcontext->set_somebody_entered_some_class(); |
| debug_origin=i.next().origin; | debug_origin=i.next().origin; |
| Value& value=*i.next().value; | const String& name=*i.next().value->get_string(); debug_name=&name; |
| const String& name=*value.get_string(); debug_name=&name; | |
| DEBUG_PRINT_STRING(name) | DEBUG_PRINT_STRING(name) |
| Line 277 void Request::execute(ArrayOperation& op | Line 280 void Request::execute(ArrayOperation& op |
| stack.push(*class_value); | stack.push(*class_value); |
| break; | break; |
| } | } |
| #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL | |
| case OP::OP_GET_ELEMENT__SPECIAL: | |
| case OP::OP_GET_ELEMENT__SPECIAL__WRITE: | |
| { | |
| const String& name=stack.pop().string(); debug_name=&name; | |
| Value& ncontext=stack.pop().value(); | |
| Value* value=0; | |
| if(VStateless_class* vclass=ncontext.get_class()){ | |
| if(name==class_element_name){ | |
| value=vclass; | |
| } else if(name==class_name_element_name){ | |
| value=new VString(vclass->name()); | |
| } | |
| } else { | |
| // Value | |
| if(name==class_element_name){ | |
| value=&ncontext; | |
| }else if(name==class_name_element_name){ | |
| value=new VString(*new String(ncontext.type())); | |
| } | |
| }; | |
| if(opcode==OP::OP_GET_ELEMENT__SPECIAL){ | |
| stack.push(*value); | |
| } else { | |
| write_assign_lang(*value); | |
| } | |
| break; | |
| } | |
| #endif | |
| // OP_WITH | // OP_WITH |
| case OP::OP_WITH_ROOT: | case OP::OP_WITH_ROOT: |
| { | { |
| Line 397 void Request::execute(ArrayOperation& op | Line 432 void Request::execute(ArrayOperation& op |
| const String& name=stack.pop().string(); debug_name=&name; | const String& name=stack.pop().string(); debug_name=&name; |
| Value& ncontext=stack.pop().value(); | Value& ncontext=stack.pop().value(); |
| if(const VJunction* vjunction=ncontext.put_element(name, &value, false)) | if(const VJunction* vjunction=ncontext.put_element(name, &value)) |
| if(vjunction!=PUT_ELEMENT_REPLACED_ELEMENT) | if(vjunction!=PUT_ELEMENT_REPLACED_ELEMENT) |
| throw Exception(PARSER_RUNTIME, | throw Exception(PARSER_RUNTIME, |
| 0, | 0, |
| Line 720 void Request::execute(ArrayOperation& op | Line 755 void Request::execute(ArrayOperation& op |
| value.type()); | value.type()); |
| } | } |
| VMethodFrame frame(*junction->method, method_frame, junction->self); | Value *result; |
| METHOD_FRAME_ACTION(op_call(frame)); | { |
| stack.push(frame.result().as_value()); | VMethodFrame frame(*junction->method, method_frame, junction->self); |
| METHOD_FRAME_ACTION(op_call(frame)); | |
| result=&frame.result().as_value(); | |
| // VMethodFrame desctructor deletes junctions in stack params here | |
| } | |
| stack.push(*result); | |
| DEBUG_PRINT_STR("<-returned") | DEBUG_PRINT_STR("<-returned") |
| Line 833 void Request::execute(ArrayOperation& op | Line 873 void Request::execute(ArrayOperation& op |
| DEBUG_PRINT_OPS(local_ops) | DEBUG_PRINT_OPS(local_ops) |
| DEBUG_PRINT_STR("->\n") | DEBUG_PRINT_STR("->\n") |
| Value &object=construct(*class_value, *constructor_junction->method); | Value *result; |
| VConstructorFrame frame(*constructor_junction->method, method_frame, object); | { |
| METHOD_FRAME_ACTION(op_call(frame)); | Value& object=construct(*class_value, *constructor_junction->method); |
| object.enable_default_setter(); | VConstructorFrame frame(*constructor_junction->method, method_frame, object); |
| METHOD_FRAME_ACTION(op_call(frame)); | |
| object.enable_default_setter(); | |
| result=&frame.result().as_value(); | |
| // VMethodFrame desctructor deletes junctions in stack params here | |
| } | |
| if(opcode==OP::OP_CONSTRUCT_OBJECT) | if(opcode==OP::OP_CONSTRUCT_OBJECT) |
| stack.push(frame.result().as_value()); | stack.push(*result); |
| else | else |
| write_pass_lang(frame.result()); | write_pass_lang(*result); |
| DEBUG_PRINT_STR("<-returned") | DEBUG_PRINT_STR("<-returned") |
| break; | break; |
| Line 1268 Value& Request::get_element(Value& ncont | Line 1313 Value& Request::get_element(Value& ncont |
| void Request::put_element(Value& ncontext, const String& name, Value* value) { | void Request::put_element(Value& ncontext, const String& name, Value* value) { |
| // put_element can return property-setting-junction | // put_element can return property-setting-junction |
| if(const VJunction* vjunction=ncontext.put_element(name, value, false)) | if(const VJunction* vjunction=ncontext.put_element(name, value)) |
| if(vjunction!=PUT_ELEMENT_REPLACED_ELEMENT) { | if(vjunction!=PUT_ELEMENT_REPLACED_ELEMENT) { |
| const Junction& junction = vjunction->junction(); | const Junction& junction = vjunction->junction(); |
| VConstructorFrame frame(*junction.method, method_frame /*caller*/, junction.self); | VConstructorFrame frame(*junction.method, method_frame /*caller*/, junction.self); |
| Line 1584 const String* Request::get_method_filena | Line 1629 const String* Request::get_method_filena |
| origin=i.next().origin; | origin=i.next().origin; |
| break; | break; |
| } | } |
| default: break; | |
| } | } |
| if(origin.file_no) | if(origin.file_no) |
| return get_used_filename(origin.file_no); | return get_used_filename(origin.file_no); |