Re: Patches for wip-rtl

2013-04-23 Thread Andy Wingo
Heya,

On Tue 23 Apr 2013 04:38, Noah Lavine  writes:

> I assume you're talking about the box-ref and box-set! stuff with
> checking for non-variables, right? I agree in general, but those
> instructions could plausibly be emitted for any code that uses module
> introspection to get its own variable objects, right?

Ah I see what you mean.  There are two uses of variables in the VM: one
for calls to variable-ref or variable-set, and the other for internal
use.  For the internal uses, we know the variable should indeed be a
variable and so we should emit the checks.  For calls to variable-ref /
variable-set, I think it would be best if somehow the compiler could
replace those calls with (if (call variable? x) (primcall box-ref x)
(call error ...)).  Dunno.  WDYT?

> One thing that would be interesting - and I don't know if we do this
> now - is using different VMs for different parts of the
> code. Specifically, if the REPL ran in a different VM than user code,
> then the REPL wouldn't die in these cases.  That might also enable
> cool debugging things, like single-stepping the user VM and examining
> its registers. I noticed that we already have support for changing the
> active VM. What do you think?

We can do that already to a degree... probably the best "fallback" that
we have is the stack VM, actually.  What happens if you install traps on
the VM that call stack VM procedures and then you run an RTL function?
I would think that you should be able to do something useful there.

Just a thought!

Andy
-- 
http://wingolog.org/



Show source code from .debug_info section (Was Re: [PATCH] Add inspection command "source (, src)" which shows Scheme code of loaded module)

2013-04-23 Thread Nala Ginrut
On Mon, 2013-04-01 at 21:12 +0200, Andy Wingo wrote:
> On Sat 30 Mar 2013 22:17, Mark H Weaver  writes:
> 
> > I'd be glad to see something like this in Guile core.  This code is a
> > great demonstration, but it has some problems.
> 
> It would be nice to reify the original source as a compressed string in
> the debug section of the ELF file.  One day...
> 
> Andy

I've checked out our latest wip-rtl and found .debug_info is on the TODO
list. So I think the better solution to show source code is to take
advantage of this.
But this feature depends on our future RTL, so my previous patch could
be useful for the 'older' guile2 user, since our REPL is well
extensible, that ',src' could be a plugin for that.

Thanks!