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: # 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: # On PowerPC G5:
# CFLAGS = -mcpu=970 -mtune=970 -mpowerpc64 -ffast-math -O3 # CFLAGS = -mcpu=970 -mtune=970 -mpowerpc64 -ffast-math -O3
# On Pentium 4: # 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 # Add -fomit-frame-pointer if you don't care about debugging
# CFLAGS = -Os -g -Wall # CFLAGS = -Os -g -Wall

View File

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

View File

@ -27,9 +27,13 @@
IN: compiler IN: compiler
USE: combinators USE: combinators
USE: errors
USE: lists USE: lists
USE: logic USE: logic
USE: namespaces
USE: prettyprint
USE: stack USE: stack
USE: stdio
USE: vectors USE: vectors
USE: words USE: words
@ -99,6 +103,14 @@ DEFER: can-compile-vector?
"can-compile" set-word-property "can-compile" set-word-property
] ifte ; ] ifte ;
SYMBOL: compilable-word-list
: compilable-words ( -- list ) : compilable-words ( -- list )
#! Make a list of all words that can be compiled. #! Make a list of all words that can be compiled.
[, [ dup can-compile? [ , ] [ drop ] ifte ] each-word ,] ; [, [ 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 -- ) : (compile) ( word -- )
#! Should be called inside the with-compiler scope. #! Should be called inside the with-compiler scope.
dup . flush
intern dup save-xt word-parameter compile-quot RET ; intern dup save-xt word-parameter compile-quot RET ;
: compile-postponed ( -- ) : 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 IN: init
USE: combinators USE: combinators
USE: compiler
USE: errors USE: errors
USE: kernel USE: kernel
USE: lists USE: lists
USE: namespaces
USE: parser USE: parser
USE: stack USE: stack
USE: strings USE: strings
@ -135,6 +137,16 @@ USE: stdio
"/library/jedit/jedit-remote.factor" "/library/jedit/jedit-remote.factor"
"/library/jedit/jedit.factor" "/library/jedit/jedit.factor"
"/library/platform/native/primitives.factor"
"/library/init.factor"
] [
dup print
run-resource
] each
cpu "x86" = [
[
"/library/compiler/assembler.factor" "/library/compiler/assembler.factor"
"/library/compiler/assembly-x86.factor" "/library/compiler/assembly-x86.factor"
"/library/compiler/compiler-macros.factor" "/library/compiler/compiler-macros.factor"
@ -146,24 +158,26 @@ USE: stdio
"/library/compiler/alien-types.factor" "/library/compiler/alien-types.factor"
"/library/compiler/alien-macros.factor" "/library/compiler/alien-macros.factor"
"/library/compiler/alien.factor" "/library/compiler/alien.factor"
"/library/platform/native/primitives.factor"
"/library/init.factor"
"/library/platform/native/init-stage2.factor"
] [ ] [
dup print dup print
run-resource run-resource
] each ] each
] [
"/library/compiler/dummy-compiler.factor" dup print run-resource
] ifte
"/library/platform/native/init-stage2.factor" dup print run-resource
IN: init IN: init
DEFER: warm-boot DEFER: warm-boot
IN: compiler IN: compiler
DEFER: init-assembler DEFER: compilable-words
DEFER: compilable-word-list
: set-boot ( quot -- ) 8 setenv ; [ warm-boot ] set-boot
[ init-assembler warm-boot ] set-boot
compilable-words compilable-word-list set
garbage-collection garbage-collection
"factor.image" save-image "factor.image" save-image

View File

@ -62,10 +62,13 @@ USE: words
t "user-init" set t "user-init" set
t "interactive" set t "interactive" set
t "ansi" set t "ansi" set
t "compile" set
! The first CLI arg is the image name. ! The first CLI arg is the image name.
cli-args uncons parse-command-line "image" set cli-args uncons parse-command-line "image" set
"compile" get [ init-compiler ] when
run-user-init run-user-init
"ansi" get [ "stdio" get <ansi-stream> "stdio" set ] when "ansi" get [ "stdio" get <ansi-stream> "stdio" set ] when

View File

@ -46,6 +46,10 @@ USE: words
USE: unparser USE: unparser
USE: vectors USE: vectors
: cpu ( -- arch )
#! Returns one of "x86" or "unknown".
11 getenv ;
! The 'fake vtable' used here speeds things up a lot. ! The 'fake vtable' used here speeds things up a lot.
! It is quite clumsy, however. A higher-level CLOS-style ! It is quite clumsy, however. A higher-level CLOS-style
! 'generic words' system will be built later. ! 'generic words' system will be built later.
@ -116,6 +120,10 @@ IN: kernel
[ drop t ] [ ( return the object ) ] [ drop t ] [ ( return the object ) ]
] cond ; ] cond ;
: set-boot ( quot -- )
#! Set the boot quotation.
8 setenv ;
: java? f ; : java? f ;
: native? t ; : native? t ;

View File

@ -27,6 +27,12 @@ int main(int argc, char** argv)
userenv[ARGS_ENV] = args; 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(); run();
return 0; return 0;

View File

@ -11,6 +11,7 @@
#define BOOT_ENV 8 #define BOOT_ENV 8
#define RUNQUEUE_ENV 9 /* used by library only */ #define RUNQUEUE_ENV 9 /* used by library only */
#define ARGS_ENV 10 #define ARGS_ENV 10
#define CPU_ENV 11
/* Profiling timer */ /* Profiling timer */
struct itimerval prof_timer; struct itimerval prof_timer;