On Sat, Feb 21, 2009 at 9:46 PM, john skaller
<skal...@users.sourceforge.net> wrote:
> Check generated code to see if the usage of these is inlined.
> Also check if the nested procedures slow things down.
> No stack frames should be created: loop_ is tail  rec.

Yep, it was completely inlined and turned into a bunch of gotos. I
don't really see anything obvious. The algorithm itself is pretty
straightforward. I'm not sure if there's really that much we could do
to that g++ isn't able to do. Here's what was generated. Can you see
anything missing?

void FLX_REGPARM _init_(FLX_APAR_DECL_ONLY){
  timeval tv;
  int y;
  int x;
  int _i6480_v6480_i;
  double bailout;
  double zi;
  double zr;
  int i;
  double zr2;
  double zi2;
  _a2309t_7191 _urv6394;
  timeval _i6503_v6503_tv;
  _a2309t_7191 _urv6556;
      PTF runs = 1;
      PTF max_iterations = 99888;
/*Lazy inline call to get_time<5200>*/
      {
      timeval* _tmp7299 = & tv ;
      gettimeofday(_tmp7299, NULL);
      }
      PTF start_time = (static_cast<double>((tv.tv_sec))) +
(static_cast<double>((tv.tv_usec))) / 1.0e6  ;
      PTF iter = 1;
    _mandelbrot_9:;
/*Lazy inline call to le<1333>*/
/*Lazy inline call to gt<6988>*/
      if(FLX_UNLIKELY(!!(PTF runs < PTF iter )  )) goto _mandelbrot_10;
/*Lazy inline call to mandelbrot<5219>*/
      y = -39;
    _6464:;
/*Lazy inline call to le<1333>*/
/*Lazy inline call to gt<1327>*/
      if(FLX_UNLIKELY(!!(38 < y )  )) goto _6477;
      if(!(PTF iter == 1 ) ) goto _6466;
      std::cout << std::endl;
    _6466:;
      x = -39;
    _6467:;
/*Lazy inline call to le<1333>*/
/*Lazy inline call to gt<1327>*/
      if(FLX_UNLIKELY(!!(38 < x )  )) goto _6476;
/*Lazy inline call to iterate<5207>*/
      bailout = 4.0;
/*Eager inline call to loop_<5210>*/
      zi = 0.0;
      zr = 0.0;
      i = 1;
    _6468:;
/*Lazy inline call to le<1333>*/
/*Lazy inline call to gt<1327>*/
/*begin match*/
/*match case 1:|case 1*/
      if(!(!(PTF max_iterations < i ) ==1) ) goto _6470;
/*begin match*/
/*match case 1:zr2*/
      zr2 = zr * zr ;
/*begin match*/
/*match case 1:zi2*/
      zi2 = zi * zi ;
/*Lazy inline call to le<1333>*/
/*Lazy inline call to gt<1327>*/
/*begin match*/
/*match case 1:|case 1*/
      if(!(!(bailout < zi2 + zr2  ) ==1) ) goto _6469;
/*parallel assignment*/
      zi = zr * zi  * 2.0  + (static_cast<double>(x)) / 40.0  ;
      i = i + 1 ;
      zr = zr2 - zi2  + ((static_cast<double>(y)) / 40.0  - 0.5 ) ;
      goto _6468;
/*match case 2:any*/
    _6469:;
      _i6480_v6480_i = i;
      goto _6471;
/*match case 2:any*/
    _6470:;
      _i6480_v6480_i = 0;
    _6471:;
      if(!(PTF iter == 1 ) ) goto _6475;
/*begin match*/
/*match case 1:|case 1*/
      if(!(0 == _i6480_v6480_i ==1) ) goto _6472;
      _urv6394 = (_a2309t_7191)("*");
      goto _6473;
/*match case 2:any*/
    _6472:;
      _urv6394 = (_a2309t_7191)(" ");
    _6473:;
/*Lazy inline call to print<3359>*/
/*Lazy inline call to str<3835>*/
      *(&std::cout)<<_urv6394;
    _6475:;
      {
      int* _tmp7300 = (int*)&x;
      ++*_tmp7300;
      }
      goto _6467;
    _6476:;
      {
      int* _tmp7301 = (int*)&y;
      ++*_tmp7301;
      }
      goto _6464;
    _6477:;
      {
      int* _tmp7302 = (int*)&PTF iter;
      ++*_tmp7302;
      }
      goto _mandelbrot_9;
    _mandelbrot_10:;
      std::cout << std::endl;
/*Lazy inline call to get_time<5200>*/
      {
      timeval* _tmp7303 = & _i6503_v6503_tv ;
      gettimeofday(_tmp7303, NULL);
      }
/*Lazy inline call to println<3365>*/
/*Lazy inline call to str<2421>*/
/*begin match*/
/*match case 1:|case 1*/
      if(!(std::isnan(((static_cast<double>((_i6503_v6503_tv.tv_sec)))
+ (static_cast<double>((_i6503_v6503_tv.tv_usec))) / 1.0e6   - PTF
start_time ))==1) ) goto _6557;
      _urv6556 = (_a2309t_7191)("nan");
      goto _end_inline_str_6562;
/*match case 2:any*/
    _6557:;
/*begin match*/
/*match case 1:|case 1*/
      if(!(std::isinf(((static_cast<double>((_i6503_v6503_tv.tv_sec)))
+ (static_cast<double>((_i6503_v6503_tv.tv_usec))) / 1.0e6   - PTF
start_time ))==1) ) goto _6559;
/*Lazy inline call to gt<1327>*/
/*begin match*/
/*match case 1:|case 1*/
      if(!(0.0 < (static_cast<double>((_i6503_v6503_tv.tv_sec))) +
(static_cast<double>((_i6503_v6503_tv.tv_usec))) / 1.0e6   - PTF
start_time  ==1) ) goto _6558;
      _urv6556 = (_a2309t_7191)("+inf");
      goto _end_inline_str_6562;
/*match case 2:any*/
    _6558:;
      _urv6556 = (_a2309t_7191)("-inf");
      goto _end_inline_str_6562;
/*match case 2:any*/
    _6559:;
      _urv6556 =
flx::rtl::strutil::str<double>(((static_cast<double>((_i6503_v6503_tv.tv_sec)))
+ (static_cast<double>((_i6503_v6503_tv.tv_usec))) / 1.0e6   - PTF
start_time ));
    _end_inline_str_6562:;
      *(&std::cout)<<_urv6556;
      *(&std::cout)<<std::endl;
}

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to