compile all by default

cvs
Slava Pestov 2004-10-09 19:14:49 +00:00
parent 7b362d7562
commit 60607268f9
10 changed files with 73 additions and 23 deletions

View File

@ -1,11 +1,11 @@
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

View File

@ -4,12 +4,14 @@ FFI:
- BIN: 2: bad
- compile word twice; no more 'cannot compile' error!
- compiled? messy
- doc comments in assoc, image, inferior
- styles - could use some cleanup
- list - trim down
- move quadratic and simpson to contrib
- init-assembler called twice
- compiler: drop literal peephole optimization
- compiling when*
- compiling unless*
- eliminate uses of 2dip
- getenv/setenv: if literal arg, compile as a load/store
- inline words

View File

@ -27,9 +27,13 @@
IN: compiler
USE: combinators
USE: errors
USE: lists
USE: logic
USE: namespaces
USE: prettyprint
USE: stack
USE: stdio
USE: vectors
USE: words
@ -99,6 +103,14 @@ DEFER: can-compile-vector?
"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 ;

View File

@ -211,7 +211,6 @@ SYMBOL: compile-callstack
: (compile) ( word -- )
#! Should be called inside the with-compiler scope.
dup . flush
intern dup save-xt word-parameter compile-quot RET ;
: compile-postponed ( -- )

View File

@ -0,0 +1,5 @@
! Loaded on non-x86 platforms.
SYMBOL: compilable-word-list
: compilable-words f ;
: init-compiler ;

View File

@ -27,9 +27,11 @@
IN: init
USE: combinators
USE: compiler
USE: errors
USE: kernel
USE: lists
USE: namespaces
USE: parser
USE: stack
USE: strings
@ -135,35 +137,47 @@ USE: stdio
"/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
: set-boot ( quot -- ) 8 setenv ;
[ init-assembler warm-boot ] set-boot
[ warm-boot ] set-boot
compilable-words compilable-word-list set
garbage-collection
"factor.image" save-image

View File

@ -62,10 +62,13 @@ USE: words
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

View File

@ -46,6 +46,10 @@ USE: words
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.
@ -116,6 +120,10 @@ IN: kernel
[ drop t ] [ ( return the object ) ]
] cond ;
: set-boot ( quot -- )
#! Set the boot quotation.
8 setenv ;
: java? f ;
: native? t ;

View File

@ -27,6 +27,12 @@ int main(int argc, char** argv)
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;

View File

@ -11,6 +11,7 @@
#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;