From 50d1d6be805f8f61db2a16a3b7d76dc8aeff4819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Sun, 30 Apr 2000 16:15:16 -0700 Subject: [PATCH] some more optimizations.. Rev: src/docode.c:1.70 Rev: src/interpret_functions.h:1.18 Rev: src/mapping.c:1.81 Rev: src/peep.in:1.34 --- src/docode.c | 3 ++- src/interpret_functions.h | 4 ++-- src/mapping.c | 13 ++++++++++--- src/peep.in | 4 +++- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/docode.c b/src/docode.c index 52b7c01d08..299d171fc8 100644 --- a/src/docode.c +++ b/src/docode.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: docode.c,v 1.69 2000/04/25 09:32:45 hubbe Exp $"); +RCSID("$Id: docode.c,v 1.70 2000/04/30 23:15:16 hubbe Exp $"); #include "las.h" #include "program.h" #include "language.h" @@ -383,6 +383,7 @@ static int do_docode2(node *n,int flags) if(match_types(CAR(n)->type,array_type_string) || match_types(CAR(n)->type,string_type_string) || + match_types(CAR(n)->type,mapping_type_string) || match_types(CAR(n)->type,object_type_string)) { code_expression(CDR(n), 0, "assignment"); diff --git a/src/interpret_functions.h b/src/interpret_functions.h index 87377fe863..c42eb8ada4 100644 --- a/src/interpret_functions.h +++ b/src/interpret_functions.h @@ -1,5 +1,5 @@ /* - * $Id: interpret_functions.h,v 1.17 2000/04/27 02:12:49 hubbe Exp $ + * $Id: interpret_functions.h,v 1.18 2000/04/30 23:15:16 hubbe Exp $ * * Opcode definitions for the interpreter. */ @@ -1211,7 +1211,7 @@ OPCODE0(F_PUSH_ARRAY, "@") push_array_items(Pike_sp->u.array); BREAK; -OPCODE2(F_LOCAL_LOCAL_INDEX, "local local index") +OPCODE2(F_LOCAL_LOCAL_INDEX, "local[local]") { struct svalue *s=Pike_fp->locals+arg1; if(s->type == PIKE_T_STRING) s->subtype=0; diff --git a/src/mapping.c b/src/mapping.c index c8c64d5859..b75ed0e42b 100644 --- a/src/mapping.c +++ b/src/mapping.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: mapping.c,v 1.80 2000/04/27 02:13:28 hubbe Exp $"); +RCSID("$Id: mapping.c,v 1.81 2000/04/30 23:15:16 hubbe Exp $"); #include "main.h" #include "object.h" #include "mapping.h" @@ -1363,8 +1363,15 @@ struct mapping *add_mappings(struct svalue *argp, INT32 args) #endif /* FIXME: need locking! */ - ret=allocate_mapping(MAP_SLOTS(e)); - for(d=0;d<args;d++) + if(argp[0].u.mapping->refs == 1) + { + ret=argp[0].u.mapping; + d=1; + }else{ + ret=allocate_mapping(MAP_SLOTS(e)); + d=0; + } + for(;d<args;d++) MAPPING_LOOP(argp[d].u.mapping) mapping_insert(ret, &k->ind, &k->val); return ret; diff --git a/src/peep.in b/src/peep.in index b1b24efc6e..15652e74a4 100644 --- a/src/peep.in +++ b/src/peep.in @@ -1,5 +1,5 @@ // -// $Id: peep.in,v 1.33 2000/04/30 16:46:36 nilsson Exp $ +// $Id: peep.in,v 1.34 2000/04/30 23:15:16 hubbe Exp $ // NOP : @@ -265,6 +265,8 @@ SimpleBranch( LOCAL_ARROW($1a, $1b), $2a ) SimpleBranch( LOCAL_ARROW($1a, $1b) ARROW($2a), $3a ) SimpleBranch( LOCAL_ARROW($1a, $1b) ARROW($2a) ARROW($3a), $4a ) SimpleBranch( LOCAL_ARROW($1a, $1b) ARROW($2a) ARROW($3a) ARROW($4a), $5a ) +SimpleBranch( GLOBAL_LOCAL_INDEX($1a, $1b) , $2a ) +SimpleBranch( LOCAL_LOCAL_INDEX($1a, $1b) , $2a ) SimpleBranch( GLOBAL($1a) ARROW ($2a), $3a ) -- GitLab