Branch: Tag:

2008-04-14

2008-04-14 10:14:41 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Pike compiler mega patch.
Added predef::CompilerEnvironment, which is a wrapper for struct compilation.
Moved the definition of struct compilation to the new header file "pike_compiler.h".
The compilation struct is now contained in the current context in the current_object during compilation.
The global variable lex is no more, it has moved into the compilation struct.
Added enter_compiler() and exit_compiler().
predef::compile() is now shorthand for predef::CompilerContext()->compile().

Rev: src/builtin_functions.c:1.652
Rev: src/compilation.h:1.35
Rev: src/docode.c:1.197
Rev: src/docode.h:1.20
Rev: src/dynamic_load.c:1.90
Rev: src/encode.c:1.263
Rev: src/language.yacc:1.411
Rev: src/las.c:1.406
Rev: src/lex.c:1.121
Rev: src/lex.h:1.36
Rev: src/lexer.h:1.66
Rev: src/module.c:1.52
Rev: src/object.c:1.284
Rev: src/operators.c:1.230
Rev: src/pike_compiler.h:1.1
Rev: src/pike_types.c:1.321
Rev: src/program.c:1.660
Rev: src/program.h:1.237

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: operators.c,v 1.229 2008/03/29 02:04:40 mast Exp $ + || $Id: operators.c,v 1.230 2008/04/14 10:14:40 grubba Exp $   */      #include "global.h"
30:   #include "builtin_functions.h"   #include "cyclic.h"   #include "pike_security.h" + #include "pike_compiler.h"      #define sp Pike_sp   
1737:      static int generate_sum(node *n)   { +  struct compilation *c = THIS_COMPILATION;    node **first_arg, **second_arg, **third_arg;    int num_args;    switch(count_args(CDR(n)))
2046:   {    if(count_args(CDR(n))==2)    { +  struct compilation *c = THIS_COMPILATION;    if(do_docode(CDR(n),DO_NOT_COPY) != 2)    Pike_fatal("Count args was wrong in generate_comparison.\n");   
2366:      static int generate_minus(node *n)   { +  struct compilation *c = THIS_COMPILATION;    switch(count_args(CDR(n)))    {    case 1:
2703:      static int generate_and(node *n)   { +  struct compilation *c = THIS_COMPILATION;    switch(count_args(CDR(n)))    {    case 1:
2937:      static int generate_or(node *n)   { +  struct compilation *c = THIS_COMPILATION;    switch(count_args(CDR(n)))    {    case 1:
3176:      static int generate_xor(node *n)   { +  struct compilation *c = THIS_COMPILATION;    switch(count_args(CDR(n)))    {    case 1:
3259:      static int generate_lsh(node *n)   { +  struct compilation *c = THIS_COMPILATION;    if(count_args(CDR(n))==2)    {    do_docode(CDR(n),DO_NOT_COPY_TOPLEVEL);
3342:   {    if(count_args(CDR(n))==2)    { +  struct compilation *c = THIS_COMPILATION;    do_docode(CDR(n),DO_NOT_COPY);    emit0(F_RSH);    return 1;
3623:      static int generate_multiply(node *n)   { +  struct compilation *c = THIS_COMPILATION;    switch(count_args(CDR(n)))    {    case 1:
3993:   {    if(count_args(CDR(n))==2)    { +  struct compilation *c = THIS_COMPILATION;    do_docode(CDR(n),DO_NOT_COPY_TOPLEVEL);    emit0(F_DIVIDE);    return 1;
4173:   {    if(count_args(CDR(n))==2)    { +  struct compilation *c = THIS_COMPILATION;    do_docode(CDR(n),DO_NOT_COPY_TOPLEVEL);    emit0(F_MOD);    return 1;
4252:   {    if(count_args(CDR(n))==1)    { +  struct compilation *c = THIS_COMPILATION;    do_docode(CDR(n),DO_NOT_COPY);    emit0(F_NOT);    return 1;
4373:   {    if(count_args(CDR(n))==1)    { +  struct compilation *c = THIS_COMPILATION;    do_docode(CDR(n),DO_NOT_COPY);    emit0(F_COMPL);    return 1;
5293:      static int generate_sizeof(node *n)   { +  struct compilation *c = THIS_COMPILATION;    if(count_args(CDR(n)) != 1) return 0;    if(do_docode(CDR(n),DO_NOT_COPY) != 1)    Pike_fatal("Count args was wrong in sizeof().\n");