From b07918217b22ab99c6a1d1f2e65594cf302c0cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Mon, 27 Apr 1998 03:00:27 -0700 Subject: [PATCH] 'compiler_stack' removed (it was not used) Rev: src/compilation.h:1.10 Rev: src/docode.c:1.36 Rev: src/docode.h:1.6 Rev: src/language.yacc:1.90 --- src/compilation.h | 3 +-- src/docode.c | 49 +++-------------------------------------------- src/docode.h | 10 +--------- src/language.yacc | 18 +---------------- 4 files changed, 6 insertions(+), 74 deletions(-) diff --git a/src/compilation.h b/src/compilation.h index c69032220b..fe6389af69 100644 --- a/src/compilation.h +++ b/src/compilation.h @@ -1,5 +1,5 @@ /* - * $Id: compilation.h,v 1.9 1998/04/24 00:32:08 hubbe Exp $ + * $Id: compilation.h,v 1.10 1998/04/27 10:00:26 hubbe Exp $ * * Compilator state push / pop operator construction file * @@ -87,7 +87,6 @@ ZMEMBER(int,num_parse_error) ZMEMBER(struct compiler_frame *,compiler_frame) ZMEMBER(INT32,num_used_modules) - IMEMBER(int,comp_stackp) IMEMBER(int,compiler_pass) ZMEMBER(int,local_class_counter) ZMEMBER(int,catch_level) diff --git a/src/docode.c b/src/docode.c index ffa3b103ce..c94217a5bd 100644 --- a/src/docode.c +++ b/src/docode.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: docode.c,v 1.35 1998/04/06 03:51:54 hubbe Exp $"); +RCSID("$Id: docode.c,v 1.36 1998/04/27 10:00:26 hubbe Exp $"); #include "las.h" #include "program.h" #include "language.h" @@ -25,6 +25,8 @@ RCSID("$Id: docode.c,v 1.35 1998/04/06 03:51:54 hubbe Exp $"); #include "operators.h" #include "object.h" +static int do_docode2(node *n,int flags); + INT32 current_break=-1; INT32 current_continue=-1; @@ -44,48 +46,6 @@ INT32 read_int(int offset) } int store_linenumbers=1; - -/* - * A mechanism to remember addresses on a stack. - */ -int comp_stackp; -INT32 comp_stack[COMPILER_STACK_SIZE]; - -void push_address(void) -{ - if (comp_stackp >= COMPILER_STACK_SIZE) - { - yyerror("Compiler stack overflow"); - comp_stackp++; - return; - } - comp_stack[comp_stackp++] = PC; -} - -void push_explicit(INT32 address) -{ - if (comp_stackp >= COMPILER_STACK_SIZE) - { - yyerror("Compiler stack overflow"); - comp_stackp++; - return; - } - comp_stack[comp_stackp++] = address; -} - -INT32 pop_address(void) -{ - if (comp_stackp == 0) - fatal("Compiler stack underflow.\n"); - if (comp_stackp > COMPILER_STACK_SIZE) - { - --comp_stackp; - return 0; - } - return comp_stack[--comp_stackp]; -} - - static int label_no=0; int alloc_label(void) { return ++label_no; } @@ -97,8 +57,6 @@ int do_jump(int token,INT32 lbl) return lbl; } -static int do_docode2(node *n,int flags); - #define ins_label(L) do_jump(F_LABEL, L) void do_pop(int x) @@ -125,7 +83,6 @@ int do_docode(node *n,INT16 flags) return i; } - static int is_efun(node *n, c_fun fun) { return n && n->token == F_CONSTANT && diff --git a/src/docode.h b/src/docode.h index c37e2d609e..69e3a03377 100644 --- a/src/docode.h +++ b/src/docode.h @@ -5,25 +5,17 @@ \*/ /* - * $Id: docode.h,v 1.5 1998/03/28 15:38:02 grubba Exp $ + * $Id: docode.h,v 1.6 1998/04/27 10:00:27 hubbe Exp $ */ #ifndef DOCODE_H #define DOCODE_H -/* - * The compiler stack is used when compiling to keep track of data. - * This value need too be large enough for the programs you compile. - */ -#define COMPILER_STACK_SIZE 8000 - #define DO_LVALUE 1 #define DO_NOT_COPY 2 #define DO_POP 4 extern int store_linenumbers; -extern int comp_stackp; -extern INT32 comp_stack[COMPILER_STACK_SIZE]; #define emit(X,Y) insert_opcode((X),(Y),lex.current_line, lex.current_file) #define emit2(X) insert_opcode2((X),lex.current_line, lex.current_file) diff --git a/src/language.yacc b/src/language.yacc index 761ce41cd3..30cd82113f 100644 --- a/src/language.yacc +++ b/src/language.yacc @@ -171,7 +171,7 @@ /* This is the grammar definition of Pike. */ #include "global.h" -RCSID("$Id: language.yacc,v 1.89 1998/04/26 11:39:45 hubbe Exp $"); +RCSID("$Id: language.yacc,v 1.90 1998/04/27 10:00:27 hubbe Exp $"); #ifdef HAVE_MEMORY_H #include <memory.h> #endif @@ -207,17 +207,6 @@ static int varargs; static INT32 current_modifiers; static struct pike_string *last_identifier=0; -void fix_comp_stack(int sp) -{ - if(comp_stackp>sp) - { - yyerror("Compiler stack fixed."); - comp_stackp=sp; - }else if(comp_stackp<sp){ - fatal("Compiler stack frame underflow."); - } -} - /* * Kludge for Bison not using prototypes. @@ -1038,7 +1027,6 @@ continue: F_CONTINUE { $$=mknode(F_CONTINUE,0,0); } ; lambda: F_LAMBDA { push_compiler_frame(); - $<number>$=comp_stackp; if(compiler_frame->current_return_type) free_string(compiler_frame->current_return_type); @@ -1051,9 +1039,6 @@ lambda: F_LAMBDA int f,e; struct pike_string *name; - fix_comp_stack($<number>2); - - $4=mknode(F_ARG_LIST,$4,mknode(F_RETURN,mkintnode(0),0)); type=find_return_type($4); @@ -1093,7 +1078,6 @@ lambda: F_LAMBDA $$=mkidentifiernode(f); free_string(name); free_string(type); - comp_stackp=$<number>2; pop_compiler_frame(); } ; -- GitLab