Merge git://factorcode.org/git/factor

db4
Doug Coleman 2008-01-12 15:00:47 -10:00
commit 03f6728e26
9 changed files with 151 additions and 122 deletions

View File

@ -8,12 +8,14 @@ implementation. It is not an introduction to the language itself.
- Platform support
- Compiling the Factor VM
- Libraries needed for compilation
- Bootstrapping the Factor image
- Running Factor on Unix with X11
- Running Factor on Mac OS X - Cocoa UI
- Running Factor on Mac OS X - X11 UI
- Running Factor on Windows
- Command line usage
- The Factor FAQ
- Source organization
- Community
@ -59,6 +61,17 @@ for your platform.
Compilation will yield an executable named 'factor' on Unix,
'factor-nt.exe' on Windows XP/Vista, and 'factor-ce.exe' on Windows CE.
* Libraries needed for compilation
For X11 support, you need recent development libraries for libc, Freetype,
X11, OpenGL and GLUT. On a Debian-derived Linux distribution (like Ubuntu),
you can use the line
sudo apt-get install libc6-dev libfreetype6-dev libx11-dev glutg3-dev
to grab everything (if you're on a non-debian-derived distro please tell us
what the equivalent command is on there and it can be added :)
* Bootstrapping the Factor image
The boot images are no longer included with the Factor distribution
@ -148,6 +161,10 @@ To run the listener in the command prompt:
factor-nt.exe -run=listener
* The Factor FAQ
The Factor FAQ lives online at http://factorcode.org/faq.fhtml
* Command line usage
The Factor VM supports a number of command line switches. To read

View File

@ -3,7 +3,7 @@
USING: byte-arrays arrays generator.registers assocs
kernel kernel.private libc math namespaces parser sequences
strings words assocs splitting math.parser cpu.architecture
alien quotations system ;
alien quotations system compiler.units ;
IN: alien.c-types
TUPLE: c-type
@ -227,10 +227,14 @@ M: long-long-type box-return ( type -- )
define-out ;
: expand-constants ( c-type -- c-type' )
#! We use word-def call instead of execute to get around
#! staging violations
dup array? [
unclip >r [ dup word? [ execute ] when ] map r> add*
unclip >r [ dup word? [ word-def call ] when ] map
r> add*
] when ;
[
[ alien-cell ]
[ set-alien-cell ]
bootstrap-cell
@ -354,3 +358,4 @@ bootstrap-cell
"ushort*" define-primitive-type
[ string>u16-alien ] "ushort*" c-type set-c-type-prep
] with-compilation-unit

View File

@ -8,10 +8,9 @@ IN: bootstrap.x86
: arg0 RDI ;
: arg1 RSI ;
: temp-reg RBX ;
: stack-reg RSP ;
: ds-reg R14 ;
: scan-reg RBX ;
: xt-reg RCX ;
: fixnum>slot@ ;
"resource:core/cpu/x86/bootstrap.factor" run-file

View File

@ -13,7 +13,8 @@ big-endian off
[
! Load word
temp-reg 0 [] MOV
temp-reg 0 MOV
temp-reg dup [] MOV
! Bump profiling counter
temp-reg profile-count-offset [+] 1 tag-fixnum ADD
! Load word->code
@ -22,7 +23,7 @@ big-endian off
temp-reg compiled-header-size ADD
! Jump to XT
temp-reg JMP
] rc-absolute-cell rt-literal 2 jit-profiling jit-define
] rc-absolute-cell rt-literal 1 jit-profiling jit-define
[
stack-frame-size PUSH ! save stack frame size
@ -31,10 +32,11 @@ big-endian off
] rc-absolute-cell rt-label 6 jit-prolog jit-define
[
arg0 0 [] MOV ! load literal
arg0 0 MOV ! load literal
arg0 dup [] MOV
ds-reg bootstrap-cell ADD ! increment datastack pointer
ds-reg [] arg0 MOV ! store literal on datastack
] rc-absolute-cell rt-literal 2 jit-push-literal jit-define
] rc-absolute-cell rt-literal 1 jit-push-literal jit-define
[
arg1 stack-reg MOV ! pass callstack pointer as arg 2
@ -60,14 +62,15 @@ big-endian off
] rc-absolute-cell rt-literal 1 jit-if-jump jit-define
[
arg1 0 [] MOV ! load dispatch table
arg1 0 MOV ! load dispatch table
arg1 dup [] MOV
arg0 ds-reg [] MOV ! load index
fixnum>slot@ ! turn it into an array offset
ds-reg bootstrap-cell SUB ! pop index
arg0 arg1 ADD ! compute quotation location
arg0 arg0 array-start [+] MOV ! load quotation
arg0 quot-xt@ [+] JMP ! execute branch
] rc-absolute-cell rt-literal 2 jit-dispatch jit-define
] rc-absolute-cell rt-literal 1 jit-dispatch jit-define
[
stack-reg stack-frame-size bootstrap-cell - ADD ! unwind stack frame

View File

@ -61,6 +61,11 @@ M: pair (bitfield-quot) ( spec -- quot )
\ set-slots [ <reversed> [get-slots] ] 1 define-transform
\ construct-boa [
dup tuple-size [ <tuple-boa> ] 2curry
] 1 define-transform
: [construct] ( word quot -- newquot )
>r dup +inlined+ depends-on dup tuple-size r> 2curry ;
\ construct-boa
[ [ <tuple-boa> ] [construct] ] 1 define-transform
\ construct-empty
[ [ <tuple> ] [construct] ] 1 define-transform

View File

@ -301,7 +301,7 @@ IN: temporary
] unit-test
[ ] [
"IN: temporary GENERIC: killer?"
"IN: temporary GENERIC: killer? ( a -- b )"
<string-reader> "removing-the-predicate" parse-stream drop
] unit-test

View File

@ -437,7 +437,7 @@ SYMBOL: bootstrap-syntax
smudged-usage forget-all
over empty? [ 2dup smudged-usage-warning ] unless 2drop ;
: finish-parsing ( contents quot -- )
: finish-parsing ( lines quot -- )
file get
[ record-form ] keep
[ record-modified ] keep
@ -447,8 +447,7 @@ SYMBOL: bootstrap-syntax
: parse-stream ( stream name -- quot )
[
[
contents
dup string-lines parse-fresh
lines dup parse-fresh
tuck finish-parsing
forget-smudged
] with-source-file

View File

@ -59,7 +59,7 @@ M: tuple class class-of-tuple ;
] unless
] when 2drop ;
GENERIC: tuple-size ( class -- size ) foldable
GENERIC: tuple-size ( class -- size )
M: tuple-class tuple-size "slot-names" word-prop length 2 + ;

View File

@ -1,4 +1,5 @@
USING: math.statistics help.markup help.syntax debugger ;
USING: help.markup help.syntax debugger ;
IN: math.statistics
HELP: geometric-mean
{ $values { "seq" "a sequence of numbers" } { "n" "a non-negative real number"} }