Branch: Tag:

2014-12-04

2014-12-04 19:26:26 by Per Hedbor <ph@opera.com>

Changed push_text from a macro to a function.

This saves around 12Kb of binary size. And since make_shared_string()
does a lot of work anyway, there will be very little actual change in
speed.

The only drawback is that strlen() is no longer constant-optimized in
the fairly common push_text("str") case.

But doing a checksum of the string is bound to take about a magnitude
more time than strlen anyway.

There is no noticeable change in the 'make benchmark' times, at least.

378:    IF_CHECKER(SET_SVAL_SUBTYPE(*_sp_, 0)); \    }while(0)    - #define push_text(T) do { \ -  const char *_ = (T); \ -  struct svalue *_sp_ = Pike_sp++; \ -  SET_SVAL_SUBTYPE(*_sp_, 0); \ -  _sp_->u.string=make_shared_binary_string(_,strlen(_)); \ -  debug_malloc_touch(_sp_->u.string); \ -  SET_SVAL_TYPE(*_sp_, PIKE_T_STRING); \ -  }while(0) + PMOD_EXPORT extern void push_text( const char *x );      #define push_constant_text(T) do{ \    struct svalue *_sp_ = Pike_sp++; \