GNU bug report logs - #11087
vector limitation in compiling to bytecode

Previous Next

Package: guile;

Reported by: Ian Price <ianprice90 <at> googlemail.com>

Date: Sat, 24 Mar 2012 20:42:02 UTC

Severity: normal

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11087 in the body.
You can then email your comments to 11087 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#11087; Package guile. (Sat, 24 Mar 2012 20:42:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ian Price <ianprice90 <at> googlemail.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sat, 24 Mar 2012 20:42:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ian Price <ianprice90 <at> googlemail.com>
To: bug-guile <at> gnu.org
Subject: vector limitation in compiling to bytecode
Date: Sat, 24 Mar 2012 20:09:28 +0000
Hi guilers,

Earlier today I had a compilation warning while running a script.

~/src/mine/algorithms-course $ guile -L . -s invsinarray.scm 
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/ian/src/mine/algorithms-course/invsinarray.scm
;;; WARNING: compilation of /home/ian/src/mine/algorithms-course/invsinarray.scm failed:
;;; ERROR: In procedure bytevector-u8-set!: Value out of range: 390

It ran fine, but the compilation problem was that I had a vector
constant containing 100000 values[0]. Now, the vector instruction in the
vm expects the value to be less than 2^16, and when compiling this it
performs splits the value into two by taking the value and modulus from
dividing by 256. This leads to the instruction (vector 390 160), which
further on down the line write-byte fails on.

This limitation is documented, and somewhat reasonable, but on IRC mark
weaver asked me to file a bug anyway, since he thinks the assembler
should have a fall back plan.

[0] as you can guess from the names, it was data provided for an online
algorithms class I'm taking. I did the lazy thing and just wrapped the
file in #(...). I've since changed it to actually read the vector from
the file.

-- 
Ian Price

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"





Reply sent to Andy Wingo <wingo <at> pobox.com>:
You have taken responsibility. (Thu, 05 Jul 2012 21:07:01 GMT) Full text and rfc822 format available.

Notification sent to Ian Price <ianprice90 <at> googlemail.com>:
bug acknowledged by developer. (Thu, 05 Jul 2012 21:07:02 GMT) Full text and rfc822 format available.

Message #10 received at 11087-done <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: Ian Price <ianprice90 <at> googlemail.com>
Cc: 11087-done <at> debbugs.gnu.org
Subject: Re: bug#11087: vector limitation in compiling to bytecode
Date: Thu, 05 Jul 2012 23:01:42 +0200
On Sat 24 Mar 2012 21:09, Ian Price <ianprice90 <at> googlemail.com> writes:

> ;;; ERROR: In procedure bytevector-u8-set!: Value out of range: 390
> vector constant containing 100000 values
>
> This limitation is documented, and somewhat reasonable, but on IRC mark
> weaver asked me to file a bug anyway, since he thinks the assembler
> should have a fall back plan.

I agree with Mark.

For what it's worth, if the vector is really constant (e.g. just
composed of immediates), the RTL VM will emit the whole thing
statically.  Otherwise it will emit code to allocate a vector
of the right size at init time, initializing its elements with
individual instructions.   This latter strategy is probably the right
thing to do with the Guile 2.0 VM.

In the mean time, I added a check for the vector-length to
glil/compile-assembly.scm.  If the vector is too big, it hits the array
case, which has a 24-bit range.  It seems to hit some other problem
after that, but I gave it the ole college try, right?

Cheers,

Andy
-- 
http://wingolog.org/




Information forwarded to bug-guile <at> gnu.org:
bug#11087; Package guile. (Thu, 05 Jul 2012 21:10:01 GMT) Full text and rfc822 format available.

Message #13 received at 11087 <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: 11087 <at> debbugs.gnu.org
Subject: Re: bug#11087: vector limitation in compiling to bytecode
Date: Thu, 05 Jul 2012 23:04:41 +0200
On Thu 05 Jul 2012 23:01, Andy Wingo <wingo <at> pobox.com> writes:

> It seems to hit some other problem after that, but I gave it the ole
> college try, right?

FWIW the problem is that building an array first pushes all the elements
on the stack.  It can be fixed by setting a larger stack size.  The RTL
branch will also fix this.

Andy
-- 
http://wingolog.org/




Information forwarded to bug-guile <at> gnu.org:
bug#11087; Package guile. (Fri, 06 Jul 2012 06:58:01 GMT) Full text and rfc822 format available.

Message #16 received at 11087 <at> debbugs.gnu.org (full text, mbox):

From: Ian Price <ianprice90 <at> googlemail.com>
To: 11087 <at> debbugs.gnu.org
Cc: wingo <at> pobox.com
Subject: Re: bug#11087: vector limitation in compiling to bytecode
Date: Fri, 06 Jul 2012 07:52:15 +0100
Andy Wingo <wingo <at> pobox.com> writes:

> On Sat 24 Mar 2012 21:09, Ian Price <ianprice90 <at> googlemail.com> writes:
>
>> ;;; ERROR: In procedure bytevector-u8-set!: Value out of range: 390
>> vector constant containing 100000 values
>>
>> This limitation is documented, and somewhat reasonable, but on IRC mark
>> weaver asked me to file a bug anyway, since he thinks the assembler
>> should have a fall back plan.
>
> I agree with Mark.
>
> For what it's worth, if the vector is really constant (e.g. just
> composed of immediates), the RTL VM will emit the whole thing
> statically.  Otherwise it will emit code to allocate a vector
> of the right size at init time, initializing its elements with
> individual instructions.   This latter strategy is probably the right
> thing to do with the Guile 2.0 VM.
In my case, it was completely static. I had generated the vector from
another file, of existing data. It's good to hear this will work in the
future rtl based guile.

Thanks

-- 
Ian Price

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 03 Aug 2012 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 276 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.