Andrew Haley wrote:

Within reason that's OK, or you can use pastebin.

Done. Patch attached. All you need to do to build is the following:

svn co svn://openbios.org/openbios/trunk/openbios-devel
cd openbios-devel
patch -p0 < openbios-fibonacci.patch

Then to build on x86:
rm -rf obj-x86/; ./config/scripts/switch-arch x86; make

To run the benchmark:
time echo "28 fib-rec u. bye" | ./obj-x86/openbios-unix ./obj-x86/openbios-x86.dict

Uncomment the function pointer at the top of kernel/internal.c then rebuild and rerun the benchmark. I see the time change from 37s to 52s on my laptop here.

Interestingly enough, I just did an "svn up" which pulled in some more changes before submitting the patch, and now I see that the position is reversed!? So without the function pointer things run slow, but with it things run fast again. I think you may be thinking along the right lines in that it's related to alignment of something changing.

It is possible to run this test on a Linux system, isn't it?

Yes - I use x86_64 Linux as my main work environment.


Many thanks,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
Index: kernel/internal.c
===================================================================
--- kernel/internal.c	(revision 607)
+++ kernel/internal.c	(working copy)
@@ -13,6 +13,8 @@
  *  - address pointed by CFA is executed by CPU
  */
 
+//void (*debughook) (void);
+
 typedef void forth_word(void);
 
 static forth_word * const words[];
Index: forth/bootstrap/bootstrap.fs
===================================================================
--- forth/bootstrap/bootstrap.fs	(revision 607)
+++ forth/bootstrap/bootstrap.fs	(working copy)
@@ -1520,4 +1520,8 @@
   200 alloc-mem tmp-comp-buf !
 ;
 
+: fib-rec \ (n -- f)
+  dup 2 u< if exit then
+  1- dup recurse swap 1- recurse + ;
+
 \ the end
Index: Makefile.target
===================================================================
--- Makefile.target	(revision 607)
+++ Makefile.target	(working copy)
@@ -28,7 +28,7 @@
 CFLAGS+= -Wall -Wredundant-decls -Wshadow -Wpointer-arith
 CFLAGS+= -Wstrict-prototypes -Wmissing-declarations -Wundef -Wendif-labels
 CFLAGS+= -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes
-CFLAGS+= -Werror
+#CFLAGS+= -Werror
 INCLUDES := -I$(SRCDIR)/include -I$(SRCDIR)/kernel/include -I$(ODIR)/target/include
 AS_FLAGS+= -g
 

Reply via email to