This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: debug evaluator is faster than regular one?


Brad Knotwell <knotwell@ix.netcom.com> writes:

>  > The basic idea is the same.  I use GCC's `&&' operator to get labels'
>  > addresses and execute "goto *pc;" to run VM's instructions.
> 
> I suspect I've just missed something here, but if guile uses gcc's computed 
> gotos (what qscheme uses) won't that mean guile could *only* be compiled 
> with gcc.  If so, wouldn't that be a "bad thing?"

I think you can use `switch' in case you can't use GCC.

This is the case of GCC:

  void *pc = ...;
  *pc = &&op_push;

  op_start:
  {
    goto *pc++;
  }

  op_push:
  {
    /* do something */
    goto *pc++;
  }

This is the case of non-GCC:

  enum opcode *pc = ...;
  *pc = op_push;

  op_start:
  switch (*pc++)
  {

  case op_push:
  {
    /* do something */
    goto op_start;
  }

  }

The switch version will be possibly twice as slow as the goto version.

Kei

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]