pike.git
/
src
/
docode.c
version
»
Context lines:
10
20
40
80
file
none
3
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.
70
2000/
04
/
30
23
:
15
:
16
hubbe Exp $");
+
RCSID("$Id: docode.c,v 1.
71
2000/
05
/
01
02
:
11
:
25
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:198:
struct compiler_frame *f=compiler_frame; while(--depth>=0) f=f->previous; return f; } int do_lfun_call(int id,node *args) { #if 1 if(id == compiler_frame->current_function_number) {
-
if(new_program->identifier_references[id].id_flags & ID_INLINE)
-
{
+
int n=count_args(args);
-
if(n ==
count
_
arguments(ID_FROM_INT(new_program, id)
->
type
)
)
+
if(n ==
compiler
_
frame
->
num_args
)
{
-
+
if(compiler_frame->is_inline)
+
{
emit0(F_MARK); do_docode(args,0);
-
emit1
(F_RECUR,
0);
/*
0
is
label
at
beginning
of
function
*/
+
compiler_frame->recur_label=do_jump
(F_RECUR,
+
compiler_frame->recur_label);
return 1;
-
+
}else{
+
emit0(F_MARK);
+
do_docode(args,0);
+
emit1(F_COND_RECUR,id);
+
compiler_frame->recur_label=do_jump(F_POINTER,
+
compiler_frame->recur_label);
+
return 1;
} } } #endif emit0(F_MARK); do_docode(args,0); emit1(F_CALL_LFUN, id); return 1; }
pike.git/src/docode.c:1289:
default: fatal("Infernal compiler error (unknown parse-tree-token).\n"); return 0; /* make gcc happy */ } } void do_code_block(node *n) { init_bytecode(); label_no=1;
+
+
emit1(F_BYTE,compiler_frame->max_number_of_locals);
+
emit1(F_BYTE,compiler_frame->num_args);
+
emit0(F_START_FUNCTION);
emit1(F_LABEL,0);
-
+
if(new_program->identifier_references[compiler_frame->
+
current_function_number].id_flags &
+
ID_INLINE)
+
{
+
compiler_frame->recur_label=0;
+
compiler_frame->is_inline=1;
+
}
+
DO_CODE_BLOCK(n);
-
+
+
if(compiler_frame->recur_label > 0)
+
{
+
#ifdef PIKE_DEBUG
+
if(l_flag)
+
{
+
fprintf(stderr,"Generating inline recursive function.\n");
+
}
+
#endif
+
/* generate code again, but this time it is inline */
+
compiler_frame->is_inline=1;
+
+
/* This is a no-op, but prevents optimizer to delete the bytes below */
+
emit1(F_LABEL,-1);
+
emit1(F_BYTE,compiler_frame->max_number_of_locals);
+
emit1(F_BYTE,compiler_frame->num_args);
+
emit0(F_START_FUNCTION);
+
emit1(F_LABEL,compiler_frame->recur_label);
+
DO_CODE_BLOCK(n);
+
}
assemble(); } int docode(node *n) { int tmp; int label_no_save = label_no; dynamic_buffer instrbuf_save = instrbuf; instrbuf.s.str=0; label_no=1; init_bytecode(); tmp=do_docode(n,0); assemble(); instrbuf=instrbuf_save; label_no = label_no_save; return tmp; }