-CC = gcc
+CC = gcc34
# On FreeBSD, to use SDL and other libc_r libs:
-CFLAGS = -g -Wall -export-dynamic -pthread
+# CFLAGS = -g -Wall -export-dynamic -pthread
# On PowerPC G5:
# CFLAGS = -mcpu=970 -mtune=970 -mpowerpc64 -ffast-math -O3
# On Pentium 4:
-# CFLAGS = -march=pentium4 -ffast-math -Os -fomit-frame-pointer -export-dynamic -pthread
+CFLAGS = -march=pentium4 -ffast-math -Os -fomit-frame-pointer -export-dynamic -pthread
# Add -fomit-frame-pointer if you don't care about debugging
# CFLAGS = -Os -g -Wall
- BIN: 2: bad\r
\r
- compile word twice; no more 'cannot compile' error!\r
-\r
-- compiled? messy\r
+- doc comments in assoc, image, inferior\r
+- styles - could use some cleanup\r
+- list - trim down\r
+- move quadratic and simpson to contrib\r
+- init-assembler called twice\r
- compiler: drop literal peephole optimization\r
- compiling when*\r
- compiling unless*\r
-- eliminate uses of 2dip\r
- getenv/setenv: if literal arg, compile as a load/store\r
- inline words\r
\r
IN: compiler
USE: combinators
+USE: errors
USE: lists
USE: logic
+USE: namespaces
+USE: prettyprint
USE: stack
+USE: stdio
USE: vectors
USE: words
"can-compile" set-word-property
] ifte ;
+SYMBOL: compilable-word-list
+
: compilable-words ( -- list )
#! Make a list of all words that can be compiled.
[, [ dup can-compile? [ , ] [ drop ] ifte ] each-word ,] ;
+
+: init-compiler ( -- )
+ #! Compile all words.
+ compilable-word-list get [
+ [ compile ] [ [ "Cannot compile " write . ] when ] catch
+ ] each ;
: (compile) ( word -- )
#! Should be called inside the with-compiler scope.
- dup . flush
intern dup save-xt word-parameter compile-quot RET ;
: compile-postponed ( -- )
--- /dev/null
+! Loaded on non-x86 platforms.
+
+SYMBOL: compilable-word-list
+: compilable-words f ;
+: init-compiler ;
IN: init
USE: combinators
+USE: compiler
USE: errors
USE: kernel
USE: lists
+USE: namespaces
USE: parser
USE: stack
USE: strings
"/library/jedit/jedit-remote.factor"
"/library/jedit/jedit.factor"
- "/library/compiler/assembler.factor"
- "/library/compiler/assembly-x86.factor"
- "/library/compiler/compiler-macros.factor"
- "/library/compiler/compiler.factor"
- "/library/compiler/ifte.factor"
- "/library/compiler/generic.factor"
- "/library/compiler/interpret-only.factor"
- "/library/compiler/compile-all.factor"
- "/library/compiler/alien-types.factor"
- "/library/compiler/alien-macros.factor"
- "/library/compiler/alien.factor"
-
"/library/platform/native/primitives.factor"
"/library/init.factor"
- "/library/platform/native/init-stage2.factor"
] [
dup print
run-resource
] each
+cpu "x86" = [
+ [
+ "/library/compiler/assembler.factor"
+ "/library/compiler/assembly-x86.factor"
+ "/library/compiler/compiler-macros.factor"
+ "/library/compiler/compiler.factor"
+ "/library/compiler/ifte.factor"
+ "/library/compiler/generic.factor"
+ "/library/compiler/interpret-only.factor"
+ "/library/compiler/compile-all.factor"
+ "/library/compiler/alien-types.factor"
+ "/library/compiler/alien-macros.factor"
+ "/library/compiler/alien.factor"
+ ] [
+ dup print
+ run-resource
+ ] each
+] [
+ "/library/compiler/dummy-compiler.factor" dup print run-resource
+] ifte
+
+"/library/platform/native/init-stage2.factor" dup print run-resource
+
IN: init
DEFER: warm-boot
IN: compiler
-DEFER: init-assembler
+DEFER: compilable-words
+DEFER: compilable-word-list
+
+[ warm-boot ] set-boot
-: set-boot ( quot -- ) 8 setenv ;
-[ init-assembler warm-boot ] set-boot
+compilable-words compilable-word-list set
garbage-collection
"factor.image" save-image
t "user-init" set
t "interactive" set
t "ansi" set
+ t "compile" set
! The first CLI arg is the image name.
cli-args uncons parse-command-line "image" set
+ "compile" get [ init-compiler ] when
+
run-user-init
"ansi" get [ "stdio" get <ansi-stream> "stdio" set ] when
USE: unparser
USE: vectors
+: cpu ( -- arch )
+ #! Returns one of "x86" or "unknown".
+ 11 getenv ;
+
! The 'fake vtable' used here speeds things up a lot.
! It is quite clumsy, however. A higher-level CLOS-style
! 'generic words' system will be built later.
[ drop t ] [ ( return the object ) ]
] cond ;
+: set-boot ( quot -- )
+ #! Set the boot quotation.
+ 8 setenv ;
+
: java? f ;
: native? t ;
userenv[ARGS_ENV] = args;
+#if defined(i386) || defined(__i386) || defined(__i386__)
+ userenv[CPU_ENV] = tag_object(from_c_string("x86"));
+#else
+ userenv[CPU_ENV] = tag_object(from_c_string("unknown"));
+#endif
+
run();
return 0;
#define BOOT_ENV 8
#define RUNQUEUE_ENV 9 /* used by library only */
#define ARGS_ENV 10
+#define CPU_ENV 11
/* Profiling timer */
struct itimerval prof_timer;