guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lighter prompts?


From: Stefan Israelsson Tampe
Subject: lighter prompts?
Date: Mon, 18 Jul 2011 23:08:00 +0200

I noted that prompts in guile-2.0 is quite heavy e.g. using vanilla setjmp facilities.

So if I'm not miss-taken a prompt will save several machine registers. Is this really needed?

Why I am asking is that everything looks the same after a prompt returns e.g. basically
setting up registers from stored data and recall a structures from that info and do a named goto.

So. do we really need to store quite a large state before each jump to do this?

E.g. 8  64bit  values + basically 4 64 bit slots.

It should be enough to store a stack slot and a signal slot of the 9 slots in jmp_buf so we should be able
to cut down from 9+4 = 13  to 2+4 = 6 slots e.g. cut the storage in two and also probably cut down the overhead
of prompts. Am I right in principle?

Why I am asking is that prompts is a nice tool to base backtracking on, and using them have an impact on performance
compared to using lighter versions without setjmp (and not be as general and safe) e.g. keep in beeing in the same named
goto loop. So my thought was that making a more lightweight prompt could be of value.

Of cause implementing this is difficult in order to achieve portability.

REFERENCE:
control.h:

struct scm_prompt_registers
{
  scm_t_uint8 *ip;
  SCM *sp;
  SCM *fp;
  scm_t_int64 cookie;
  scm_i_jmp_buf regs; 
};

#define scm_i_jmp_buf jmp_buf

struct __jmp_buf_tag
  {
    /* NOTE: The machine-dependent definitions of `__sigsetjmp'
       assume that a `jmp_buf' begins with a `__jmp_buf' and that
       `__mask_was_saved' follows it.  Do not move these members
       or add others before it.  */
    __jmp_buf __jmpbuf;        /* Calling environment.  */
    int __mask_was_saved;    /* Saved the signal mask?  */
    __sigset_t __saved_mask;    /* Saved signal mask.  */
  };


__BEGIN_NAMESPACE_STD

typedef struct __jmp_buf_tag jmp_buf[1];

typedef long int __jmp_buf[8];


/Regards
Stefan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]