Branch: Tag:

2001-04-14

2001-04-14 09:44:22 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

Jumbopatch:

Saved 8 bytes per object (for objects that do not use their parent scope),
fixed some memory leaks and
first implementation of constant objects (Gmp.Bignum, Math.Matrix and Image.Colour)

Rev: src/backend.cmod:1.14
Rev: src/builtin.cmod:1.27
Rev: src/builtin_functions.c:1.362
Rev: src/docode.c:1.111
Rev: src/encode.c:1.98
Rev: src/gc.c:1.149
Rev: src/interpret.c:1.191
Rev: src/las.c:1.251
Rev: src/main.c:1.123
Rev: src/modules/Gmp/mpz_glue.c:1.93
Rev: src/modules/Image/colors.c:1.49
Rev: src/modules/Math/math_matrix.c:1.22
Rev: src/modules/Oracle/oracle.c:1.56
Rev: src/modules/files/socket.c:1.54
Rev: src/object.c:1.169
Rev: src/object.h:1.62
Rev: src/program.c:1.314
Rev: src/program.h:1.125
Rev: src/threads.h:1.114
Rev: src/version.h:1.273

5:   \*/   /**/   #include "global.h" - RCSID("$Id: las.c,v 1.250 2001/04/08 10:11:39 hubbe Exp $"); + RCSID("$Id: las.c,v 1.251 2001/04/14 09:44:20 hubbe Exp $");      #include "language.h"   #include "interpret.h"
885:    if (a) {    switch(a->token) {    case F_CONSTANT: -  if (a->u.sval.type == T_FUNCTION) { -  if (a->u.sval.subtype == FUNCTION_BUILTIN) { +  switch(a->u.sval.type) +  { +  case T_FUNCTION: +  if (a->u.sval.subtype == FUNCTION_BUILTIN) +  {    opt_flags = a->u.sval.u.efun->flags;    } else if (a->u.sval.u.object->prog) {    i = ID_FROM_INT(a->u.sval.u.object->prog, a->u.sval.subtype);    } else {    yyerror("Calling function in destructed module.");    } -  +  break; +  +  case T_PROGRAM: +  if(a->u.sval.u.program->flags & PROGRAM_CONSTANT) +  opt_flags=0; +  break;    }    break;    case F_EXTERNAL:
1835:    if(s->type == T_OBJECT ||    (s->type==T_FUNCTION && s->subtype!=FUNCTION_BUILTIN))    { +  if(!(s->u.object->prog && (s->u.object->prog->flags & PROGRAM_CONSTANT)))    res->node_info|=OPT_EXTERNAL_DEPEND;    }    res->type = get_type_of_svalue(s);
1877:    if(s->u.object->next == s->u.object)    {    int x=0; -  struct object *o; +     node *n=mkefuncallnode("this_object", 0); -  + #ifndef PARENT_INFO +  struct object *o;    for(o=Pike_compiler->fake_object;o!=s->u.object;o=o->parent)    {    n=mkefuncallnode("function_object",    mkefuncallnode("object_program",n));    } -  + #else +  struct program_state *state=Pike_compiler;; +  for(;state->fake_object!=s->u.object;state=state->previous) +  { +  state->new_program->flags |= PROGRAM_USES_PARENT; +  n=mkefuncallnode("function_object", +  mkefuncallnode("object_program",n)); +  } + #endif    return n;    }    break;