comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.tsoh.plus-bug.bauhaus@maps.futureapps.de>
Subject: GNAT's stack checking in Ubuntu 9.04  (and Shootout regex-dna)
Date: Tue, 04 Aug 2009 00:54:11 +0200
Date: 2009-08-04T00:54:12+02:00	[thread overview]
Message-ID: <4a776a94$0$31878$9b4e6d93@newsspool3.arcor-online.net> (raw)

The GNAT that comes with Ubuntu 9.04 (GCC 4.3.3)
produces storage errors where GNAT on Debian Lenny
(GCC 4.3.2) and GNAT 2007 on Windows (4.3.1) don't.
This happens with larger data structures.

The workaround is to introduce an indirection ... (.-)
Or at least I got the regex-dna test at the Shootout fixed
by introducing a pointer type and an allocator, diff
appended below.

If we use GNAT's Spitbol Patterns for matching
(from the Ada 2005 GNAT #4 version)
and then the technique of the Ada 2005 GNAT #3
version for match-replace (Bj�rn Persson's variation),
we will get a really, really fast regex-dna.
#4 is a lot faster than #3 when matching,
#3 is a lot faster when replacing matches.


The diff that get's #4 going again on Ubuntu 9.04,
look for type Dna_Lines_Pointer:


--- regexdna.gnat       6d8829eff6a278659ecb6ebc0f03672662de39b8
+++ regexdna.gnat       09cbee8b34b6bc62a921d8bfc66e2f18cb57eeb6
@@ -120,7 +120,8 @@ begin
       Num_Lines := Num_Lines + 1;
    end if;
    declare
-      Sequence_Lines : Dna_Lines(1..Num_Lines);
+      type Dna_Lines_Pointer is access Dna_Lines;  -- avoids stack issues
+      Sequence_Lines : Dna_Lines_Pointer := new Dna_Lines(1..Num_Lines);
       Low, Sub_Len : Natural;
    begin
       -- Distribute Sequence to Sequence_Lines
@@ -149,7 +150,7 @@ begin
       New_Line;
       Put(Item => Code_Length, Width => 1);
       New_Line;
-      Put(Item => Length(Sequence_Lines), Width => 1);
+      Put(Item => Length(Sequence_Lines.all), Width => 1);
       New_Line;
    end;



             reply	other threads:[~2009-08-03 22:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-03 22:54 Georg Bauhaus [this message]
2009-08-03 22:56 ` GNAT's stack checking in Ubuntu 9.04 (and Shootout regex-dna) Georg Bauhaus
2009-08-04  7:50   ` Ludovic Brenta
2009-08-04  9:17     ` Georg Bauhaus
2009-08-04  9:58       ` Vadim Godunko
2009-08-04 10:44         ` Georg Bauhaus
2009-08-04 12:30           ` Vadim Godunko
2009-08-04 14:15             ` Georg Bauhaus
2009-08-04 22:20         ` Egil
2009-08-04 15:38       ` Robert A Duff
2009-08-04 11:59 ` Brian Drummond
2009-08-04 14:18   ` Georg Bauhaus
2009-08-09 19:13   ` Georg Bauhaus
2009-08-10 13:10     ` jonathan
2009-08-10 20:12     ` jonathan
2009-08-10 20:29       ` Ludovic Brenta
2009-08-10 23:34       ` Georg Bauhaus
2009-08-11 20:02         ` jonathan
2009-08-11 21:19           ` jonathan
2009-08-11 21:38           ` Georg Bauhaus
2009-08-11  0:27       ` Georg Bauhaus
2009-08-11 19:05         ` jonathan
2009-08-12  9:32           ` Ludovic Brenta
2009-08-12 16:37             ` jonathan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox