Branch: Tag:

2015-08-22

2015-08-22 18:35:09 by Arne Goedeke <el@laramies.com>

Strings: generate more static strings

quick_add_function and make_shared_string will now create
static strings when the argument is a compile time constant

1020:   PMOD_EXPORT int pike_add_function2(const char *name, void (*cfun)(INT32),    const char *type, unsigned flags,    unsigned opt_flags); - PMOD_EXPORT int quick_add_function(const char *name, -  int name_length, + PMOD_EXPORT int low_quick_add_function(const struct pike_string *name_tmp,    void (*cfun)(INT32),    const char *type,    int type_length,
1085:    return low_find_lfun(p, lfun);   }    + #define quick_add_function(NAME, NLEN, FUNC, TYPE, TLEN, FLAGS, OPT) \ +  low_quick_add_function(__builtin_constant_p(NAME) \ +  ? make_shared_static_string(NAME, NLEN, eightbit) \ +  : make_shared_binary_string(NAME, NLEN), \ +  FUNC, TYPE, TLEN, FLAGS, OPT)    -  +    #ifndef PIKE_USE_MACHINE_CODE   #define make_program_executable(X)   #endif