pike.git / src / docode.c

version» Context lines:

pike.git/src/docode.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: docode.c,v 1.41 1998/11/16 22:14:49 hubbe Exp $"); + RCSID("$Id: docode.c,v 1.42 1998/11/22 11:02:41 hubbe Exp $");   #include "las.h"   #include "program.h"   #include "language.h"   #include "pike_types.h"   #include "stralloc.h"   #include "interpret.h"   #include "constants.h"   #include "array.h"   #include "pike_macros.h"   #include "error.h"
pike.git/src/docode.c:311:    case F_OR_EQ:    case F_XOR_EQ:    case F_LSH_EQ:    case F_RSH_EQ:    case F_ADD_EQ:    case F_SUB_EQ:    case F_MULT_EQ:    case F_MOD_EQ:    case F_DIV_EQ:    tmp1=do_docode(CAR(n),DO_LVALUE); - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(tmp1 != 2)    fatal("HELP! FATAL INTERNAL COMPILER ERROR (7)\n");   #endif       if(match_types(CAR(n)->type,array_type_string) ||    match_types(CAR(n)->type,string_type_string))    {    code_expression(CDR(n), 0, "assignment");    emit2(F_LTOSVAL2);    }else{
pike.git/src/docode.c:453:    case F_RANGE:    tmp1=do_docode(CAR(n),DO_NOT_COPY);    if(do_docode(CDR(n),DO_NOT_COPY)!=2)    fatal("Compiler internal error (at %ld).\n",(long)lex.current_line);    emit2(n->token);    return tmp1;       case F_INC:    case F_POST_INC:    tmp1=do_docode(CAR(n),DO_LVALUE); - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(tmp1 != 2)    fatal("HELP! FATAL INTERNAL COMPILER ERROR (1)\n");   #endif       if(flags & DO_POP)    {    emit2(F_INC_AND_POP);    return 0;    }else{    emit2(n->token);    return 1;    }       case F_DEC:    case F_POST_DEC:    tmp1=do_docode(CAR(n),DO_LVALUE); - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(tmp1 != 2)    fatal("HELP! FATAL INTERNAL COMPILER ERROR (2)\n");   #endif    if(flags & DO_POP)    {    emit2(F_DEC_AND_POP);    return 0;    }else{    emit2(n->token);    return 1;
pike.git/src/docode.c:527:    INT32 *prev_switch_jumptable = current_switch_jumptable;    INT32 break_save = current_break;    INT32 continue_save = current_continue;       current_switch_jumptable=0;    current_break=alloc_label();    current_continue=alloc_label();       tmp2=do_docode(CAR(n),DO_NOT_COPY);    emit2(F_CONST0); - #ifdef DEBUG + #ifdef PIKE_DEBUG    /* This is really ugly because there is always a chance that the bug    * will disappear when new instructions are added to the code, but    * think it is worth it.    */    if(d_flag)    emit2(F_MARK);   #endif    tmp3=do_jump(F_BRANCH,-1);    tmp1=ins_label(-1);    DO_CODE_BLOCK(CDR(n));    ins_label(current_continue);    emit(F_LABEL,tmp3);    do_jump(n->token,tmp1);    ins_label(current_break);    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag)    emit2(F_POP_MARK);   #endif       current_switch_jumptable = prev_switch_jumptable;    current_break=break_save;    current_continue=continue_save;    do_pop(4);    return 0;    }
pike.git/src/docode.c:569:    {    INT32 *prev_switch_jumptable = current_switch_jumptable;    INT32 break_save = current_break;    INT32 continue_save = current_continue;       current_switch_jumptable=0;    current_break=alloc_label();    current_continue=alloc_label();       tmp2=do_docode(CAR(n),0); - #ifdef DEBUG + #ifdef PIKE_DEBUG    /* This is really ugly because there is always a chance that the bug    * will disappear when new instructions are added to the code, but    * think it is worth it.    */    if(d_flag)    emit2(F_MARK);   #endif    tmp3=do_jump(F_BRANCH,-1);    tmp1=ins_label(-1);       DO_CODE_BLOCK(CDR(n));    ins_label(current_continue);    emit(F_LABEL,tmp3);    do_jump(n->token,tmp1);    ins_label(current_break); - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag)    emit2(F_POP_MARK);   #endif       current_switch_jumptable = prev_switch_jumptable;    current_break=break_save;    current_continue=continue_save;    do_pop(3);    return 0;    }
pike.git/src/docode.c:739:       case F_SWITCH:    {    INT32 e,cases,*order;    INT32 *jumptable;    INT32 prev_switch_values_on_stack = current_switch_values_on_stack;    INT32 prev_switch_case = current_switch_case;    INT32 prev_switch_default = current_switch_default;    INT32 *prev_switch_jumptable = current_switch_jumptable;    INT32 break_save = current_break; - #ifdef DEBUG + #ifdef PIKE_DEBUG    struct svalue *save_sp=sp;   #endif       if(do_docode(CAR(n),0)!=1)    fatal("Internal compiler error, time to panic\n");       current_break=alloc_label();       cases=count_cases(CDR(n));   
pike.git/src/docode.c:769:    for(e=1; e<cases*2+2; e++)    {    jumptable[e]=emit(F_POINTER, 0);    current_switch_jumptable[e]=-1;    }       current_switch_jumptable[current_switch_case++]=-1;       DO_CODE_BLOCK(CDR(n));    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(sp-save_sp != cases)    fatal("Count cases is wrong!\n");   #endif       f_aggregate(cases);    order=get_switch_order(sp[-1].u.array);       /* Check for cases inside a range */    for(e=0; e<cases-1; e++)    {
pike.git/src/docode.c:822:    free((char *)current_switch_jumptable);       current_switch_jumptable = prev_switch_jumptable;    current_switch_default = prev_switch_default;    current_switch_case = prev_switch_case;    current_switch_values_on_stack = prev_switch_values_on_stack ;       emit(F_LABEL, current_break);       current_break=break_save; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(recoveries && sp-evaluator_stack < recoveries->sp)    fatal("Stack error after F_SWITCH (underflow)\n");   #endif    return 0;    }       case F_CASE:    {    if(!current_switch_jumptable)    {
pike.git/src/docode.c:960:    current_continue=continue_save;    current_switch_jumptable = prev_switch_jumptable;    return 1;    }       case F_LVALUE_LIST:    return do_docode(CAR(n),DO_LVALUE)+do_docode(CDR(n),DO_LVALUE);       case F_ARRAY_LVALUE:    tmp1=do_docode(CAR(n),DO_LVALUE); - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(tmp1 & 1)    fatal("Very internal compiler error.\n");   #endif    emit(F_ARRAY_LVALUE, tmp1>>1);    return 2;       case F_ARROW:    if(CDR(n)->token != F_CONSTANT || CDR(n)->u.sval.type!=T_STRING)    fatal("Bugg in F_ARROW, index not string.");    if(flags & WANT_LVALUE)
pike.git/src/docode.c:996:    return tmp1;       case F_INDEX:    if(flags & WANT_LVALUE)    {    int mklval=CAR(n) && match_types(CAR(n)->type, string_type_string);    tmp1=do_docode(CAR(n),    mklval ? DO_LVALUE_IF_POSSIBLE : 0);    if(tmp1==2)    { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(!mklval)    fatal("Unwanted lvalue!\n");   #endif    emit2(F_INDIRECT);    }       if(do_docode(CDR(n),0) != 1)    fatal("Internal compiler error, please report this (1).");    if(CDR(n)->token != F_CONSTANT &&    match_types(CDR(n)->type, string_type_string))
pike.git/src/docode.c:1062:    struct object *o;       for(o=fake_object->parent;o!=n->u.sval.u.object;o=o->parent)    x++;    emit(F_LDA, x);    emit(F_EXTERNAL, n->u.sval.subtype);    return 1;    }    }    - #ifdef DEBUG + #ifdef PIKE_DEBUG    case T_OBJECT:    if(n->u.sval.u.object->next == n->u.sval.u.object)    fatal("Internal error: Pointer to parent cannot be a compile time constant!\n");   #endif       default:    tmp1=store_constant(&(n->u.sval),!(n->tree_info & OPT_EXTERNAL_DEPEND));    emit(F_CONSTANT,tmp1);    return 1;