Merge branch 'master' of git://factorcode.org/git/factor
commit
ce089a0879
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: namespaces make math math.parser sequences accessors
|
||||
USING: namespaces make math math.order math.parser sequences accessors
|
||||
kernel kernel.private layouts assocs words summary arrays
|
||||
combinators classes.algebra alien alien.c-types alien.structs
|
||||
alien.strings alien.arrays sets threads libc continuations.private
|
||||
|
@ -234,13 +234,26 @@ M: float-regs reg-class-variable drop float-regs ;
|
|||
|
||||
GENERIC: inc-reg-class ( register-class -- )
|
||||
|
||||
M: reg-class inc-reg-class
|
||||
dup reg-class-variable inc
|
||||
fp-shadows-int? [ reg-size stack-params +@ ] [ drop ] if ;
|
||||
: ?dummy-stack-params ( reg-class -- )
|
||||
dummy-stack-params? [ reg-size stack-params +@ ] [ drop ] if ;
|
||||
|
||||
: ?dummy-int-params ( reg-class -- )
|
||||
dummy-int-params? [ reg-size cell /i 1 max int-regs +@ ] [ drop ] if ;
|
||||
|
||||
: ?dummy-fp-params ( reg-class -- )
|
||||
drop dummy-fp-params? [ float-regs inc ] when ;
|
||||
|
||||
M: int-regs inc-reg-class
|
||||
[ reg-class-variable inc ]
|
||||
[ ?dummy-stack-params ]
|
||||
[ ?dummy-fp-params ]
|
||||
tri ;
|
||||
|
||||
M: float-regs inc-reg-class
|
||||
dup call-next-method
|
||||
fp-shadows-int? [ reg-size cell /i int-regs +@ ] [ drop ] if ;
|
||||
[ reg-class-variable inc ]
|
||||
[ ?dummy-stack-params ]
|
||||
[ ?dummy-int-params ]
|
||||
tri ;
|
||||
|
||||
GENERIC: reg-class-full? ( class -- ? )
|
||||
|
||||
|
|
|
@ -146,8 +146,14 @@ HOOK: struct-small-enough? cpu ( heap-size -- ? )
|
|||
! Do we pass value structs by value or hidden reference?
|
||||
HOOK: value-structs? cpu ( -- ? )
|
||||
|
||||
! If t, fp parameters are shadowed by dummy int parameters
|
||||
HOOK: fp-shadows-int? cpu ( -- ? )
|
||||
! If t, all parameters are shadowed by dummy stack parameters
|
||||
HOOK: dummy-stack-params? cpu ( -- ? )
|
||||
|
||||
! If t, all FP parameters are shadowed by dummy int parameters
|
||||
HOOK: dummy-int-params? cpu ( -- ? )
|
||||
|
||||
! If t, all int parameters are shadowed by dummy FP parameters
|
||||
HOOK: dummy-fp-params? cpu ( -- ? )
|
||||
|
||||
HOOK: %prepare-unbox cpu ( -- )
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors system kernel alien.c-types cpu.architecture cpu.ppc ;
|
||||
USING: accessors system kernel layouts
|
||||
alien.c-types cpu.architecture cpu.ppc ;
|
||||
IN: cpu.ppc.linux
|
||||
|
||||
<<
|
||||
|
@ -8,12 +9,16 @@ t "longlong" c-type (>>stack-align?)
|
|||
t "ulonglong" c-type (>>stack-align?)
|
||||
>>
|
||||
|
||||
M: linux reserved-area-size 2 ;
|
||||
M: linux reserved-area-size 2 cells ;
|
||||
|
||||
M: linux lr-save 1 ;
|
||||
M: linux lr-save 1 cells ;
|
||||
|
||||
M: float-regs param-regs { 1 2 3 4 5 6 7 8 } ;
|
||||
M: float-regs param-regs drop { 1 2 3 4 5 6 7 8 } ;
|
||||
|
||||
M: ppc value-structs? drop f ;
|
||||
M: ppc value-structs? f ;
|
||||
|
||||
M: ppc fp-shadows-int? drop f ;
|
||||
M: ppc dummy-stack-params? f ;
|
||||
|
||||
M: ppc dummy-int-params? f ;
|
||||
|
||||
M: ppc dummy-fp-params? f ;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors system kernel alien.c-types cpu.architecture cpu.ppc ;
|
||||
USING: accessors system kernel layouts
|
||||
alien.c-types cpu.architecture cpu.ppc ;
|
||||
IN: cpu.ppc.macosx
|
||||
|
||||
<<
|
||||
|
@ -9,12 +10,16 @@ IN: cpu.ppc.macosx
|
|||
4 "double" c-type (>>align)
|
||||
>>
|
||||
|
||||
M: macosx reserved-area-size 6 ;
|
||||
M: macosx reserved-area-size 6 cells ;
|
||||
|
||||
M: macosx lr-save 2 ;
|
||||
M: macosx lr-save 2 cells ;
|
||||
|
||||
M: float-regs param-regs { 1 2 3 4 5 6 7 8 9 10 11 12 13 } ;
|
||||
M: float-regs param-regs drop { 1 2 3 4 5 6 7 8 9 10 11 12 13 } ;
|
||||
|
||||
M: ppc value-structs? drop t ;
|
||||
M: ppc value-structs? t ;
|
||||
|
||||
M: ppc fp-shadows-int? drop t ;
|
||||
M: ppc dummy-stack-params? t ;
|
||||
|
||||
M: ppc dummy-int-params? t ;
|
||||
|
||||
M: ppc dummy-fp-params? f ;
|
||||
|
|
|
@ -349,12 +349,17 @@ M: ppc %gc
|
|||
"end" resolve-label ;
|
||||
|
||||
M: ppc %prologue ( n -- )
|
||||
0 scratch-reg LOAD32 rc-absolute-ppc-2/2 rel-this
|
||||
#! We use a volatile register (r11) here for scratch. Because
|
||||
#! callback bodies have a prologue too, we cannot assume
|
||||
#! that c_to_factor saved all non-volatile registers, so
|
||||
#! we have to respect the C calling convention. Also, we
|
||||
#! cannot touch any param-regs either.
|
||||
0 11 LOAD32 rc-absolute-ppc-2/2 rel-this
|
||||
0 MFLR
|
||||
1 1 pick neg ADDI
|
||||
scratch-reg 1 pick xt-save STW
|
||||
dup scratch-reg LI
|
||||
scratch-reg 1 pick next-save STW
|
||||
11 1 pick xt-save STW
|
||||
dup 11 LI
|
||||
11 1 pick next-save STW
|
||||
0 1 rot lr-save + STW ;
|
||||
|
||||
M: ppc %epilogue ( n -- )
|
||||
|
|
|
@ -274,6 +274,12 @@ M: x86.32 %callback-return ( n -- )
|
|||
[ drop 0 ]
|
||||
} cond RET ;
|
||||
|
||||
M: x86.32 dummy-stack-params? f ;
|
||||
|
||||
M: x86.32 dummy-int-params? f ;
|
||||
|
||||
M: x86.32 dummy-fp-params? f ;
|
||||
|
||||
os windows? [
|
||||
cell "longlong" c-type (>>align)
|
||||
cell "ulonglong" c-type (>>align)
|
||||
|
|
|
@ -26,6 +26,7 @@ M: x86.64 temp-reg-2 RCX ;
|
|||
|
||||
: param-reg-1 int-regs param-regs first ; inline
|
||||
: param-reg-2 int-regs param-regs second ; inline
|
||||
: param-reg-3 int-regs param-regs third ; inline
|
||||
|
||||
M: int-regs return-reg drop RAX ;
|
||||
M: float-regs return-reg drop XMM0 ;
|
||||
|
@ -40,13 +41,13 @@ M: x86.64 %prologue ( n -- )
|
|||
|
||||
M: stack-params %load-param-reg
|
||||
drop
|
||||
>r R11 swap stack@ MOV
|
||||
r> stack@ R11 MOV ;
|
||||
>r R11 swap param@ MOV
|
||||
r> param@ R11 MOV ;
|
||||
|
||||
M: stack-params %save-param-reg
|
||||
drop
|
||||
R11 swap next-stack@ MOV
|
||||
stack@ R11 MOV ;
|
||||
param@ R11 MOV ;
|
||||
|
||||
: with-return-regs ( quot -- )
|
||||
[
|
||||
|
@ -55,37 +56,6 @@ M: stack-params %save-param-reg
|
|||
call
|
||||
] with-scope ; inline
|
||||
|
||||
! The ABI for passing structs by value is pretty messed up
|
||||
<< "void*" c-type clone "__stack_value" define-primitive-type
|
||||
stack-params "__stack_value" c-type (>>reg-class) >>
|
||||
|
||||
: struct-types&offset ( struct-type -- pairs )
|
||||
fields>> [
|
||||
[ type>> ] [ offset>> ] bi 2array
|
||||
] map ;
|
||||
|
||||
: split-struct ( pairs -- seq )
|
||||
[
|
||||
[ 8 mod zero? [ t , ] when , ] assoc-each
|
||||
] { } make { t } split harvest ;
|
||||
|
||||
: flatten-small-struct ( c-type -- seq )
|
||||
struct-types&offset split-struct [
|
||||
[ c-type c-type-reg-class ] map
|
||||
int-regs swap member? "void*" "double" ? c-type
|
||||
] map ;
|
||||
|
||||
: flatten-large-struct ( c-type -- seq )
|
||||
heap-size cell align
|
||||
cell /i "__stack_value" c-type <repetition> ;
|
||||
|
||||
M: struct-type flatten-value-type ( type -- seq )
|
||||
dup heap-size 16 > [
|
||||
flatten-large-struct
|
||||
] [
|
||||
flatten-small-struct
|
||||
] if ;
|
||||
|
||||
M: x86.64 %prepare-unbox ( -- )
|
||||
! First parameter is top of stack
|
||||
param-reg-1 R14 [] MOV
|
||||
|
@ -102,7 +72,7 @@ M: x86.64 %unbox-long-long ( n func -- )
|
|||
|
||||
: %unbox-struct-field ( c-type i -- )
|
||||
! Alien must be in param-reg-1.
|
||||
param-reg-1 swap cells [+] swap reg-class>> {
|
||||
R11 swap cells [+] swap reg-class>> {
|
||||
{ int-regs [ int-regs get pop swap MOV ] }
|
||||
{ double-float-regs [ float-regs get pop swap MOVSD ] }
|
||||
} case ;
|
||||
|
@ -110,20 +80,20 @@ M: x86.64 %unbox-long-long ( n func -- )
|
|||
M: x86.64 %unbox-small-struct ( c-type -- )
|
||||
! Alien must be in param-reg-1.
|
||||
"alien_offset" f %alien-invoke
|
||||
! Move alien_offset() return value to param-reg-1 so that we don't
|
||||
! Move alien_offset() return value to R11 so that we don't
|
||||
! clobber it.
|
||||
param-reg-1 RAX MOV
|
||||
R11 RAX MOV
|
||||
[
|
||||
flatten-small-struct [ %unbox-struct-field ] each-index
|
||||
flatten-value-type [ %unbox-struct-field ] each-index
|
||||
] with-return-regs ;
|
||||
|
||||
M: x86.64 %unbox-large-struct ( n c-type -- )
|
||||
! Source is in param-reg-1
|
||||
heap-size
|
||||
! Load destination address
|
||||
param-reg-2 rot stack@ LEA
|
||||
param-reg-2 rot param@ LEA
|
||||
! Load structure size
|
||||
RDX swap MOV
|
||||
param-reg-3 swap MOV
|
||||
! Copy the struct to the C stack
|
||||
"to_value_struct" f %alien-invoke ;
|
||||
|
||||
|
@ -142,10 +112,7 @@ M: x86.64 %box ( n reg-class func -- )
|
|||
M: x86.64 %box-long-long ( n func -- )
|
||||
int-regs swap %box ;
|
||||
|
||||
M: x86.64 struct-small-enough? ( size -- ? )
|
||||
heap-size 2 cells <= ;
|
||||
|
||||
: box-struct-field@ ( i -- operand ) 1+ cells stack@ ;
|
||||
: box-struct-field@ ( i -- operand ) 1+ cells param@ ;
|
||||
|
||||
: %box-struct-field ( c-type i -- )
|
||||
box-struct-field@ swap reg-class>> {
|
||||
|
@ -156,15 +123,15 @@ M: x86.64 struct-small-enough? ( size -- ? )
|
|||
M: x86.64 %box-small-struct ( c-type -- )
|
||||
#! Box a <= 16-byte struct.
|
||||
[
|
||||
[ flatten-small-struct [ %box-struct-field ] each-index ]
|
||||
[ RDX swap heap-size MOV ] bi
|
||||
[ flatten-value-type [ %box-struct-field ] each-index ]
|
||||
[ param-reg-3 swap heap-size MOV ] bi
|
||||
param-reg-1 0 box-struct-field@ MOV
|
||||
param-reg-2 1 box-struct-field@ MOV
|
||||
"box_small_struct" f %alien-invoke
|
||||
] with-return-regs ;
|
||||
|
||||
: struct-return@ ( n -- operand )
|
||||
[ stack-frame get params>> ] unless* stack@ ;
|
||||
[ stack-frame get params>> ] unless* param@ ;
|
||||
|
||||
M: x86.64 %box-large-struct ( n c-type -- )
|
||||
! Struct size is parameter 2
|
||||
|
@ -178,7 +145,7 @@ M: x86.64 %prepare-box-struct ( -- )
|
|||
! Compute target address for value struct return
|
||||
RAX f struct-return@ LEA
|
||||
! Store it as the first parameter
|
||||
0 stack@ RAX MOV ;
|
||||
0 param@ RAX MOV ;
|
||||
|
||||
M: x86.64 %prepare-var-args RAX RAX XOR ;
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel layouts system compiler.cfg.registers
|
||||
cpu.architecture cpu.x86.assembler cpu.x86 ;
|
||||
USING: accessors arrays sequences math splitting make assocs
|
||||
kernel layouts system alien.c-types alien.structs
|
||||
cpu.architecture cpu.x86.assembler cpu.x86
|
||||
compiler.codegen compiler.cfg.registers ;
|
||||
IN: cpu.x86.64.unix
|
||||
|
||||
M: int-regs param-regs drop { RDI RSI RDX RCX R8 R9 } ;
|
||||
|
@ -10,3 +12,43 @@ M: float-regs param-regs
|
|||
drop { XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 } ;
|
||||
|
||||
M: x86.64 reserved-area-size 0 ;
|
||||
|
||||
! The ABI for passing structs by value is pretty messed up
|
||||
<< "void*" c-type clone "__stack_value" define-primitive-type
|
||||
stack-params "__stack_value" c-type (>>reg-class) >>
|
||||
|
||||
: struct-types&offset ( struct-type -- pairs )
|
||||
fields>> [
|
||||
[ type>> ] [ offset>> ] bi 2array
|
||||
] map ;
|
||||
|
||||
: split-struct ( pairs -- seq )
|
||||
[
|
||||
[ 8 mod zero? [ t , ] when , ] assoc-each
|
||||
] { } make { t } split harvest ;
|
||||
|
||||
: flatten-small-struct ( c-type -- seq )
|
||||
struct-types&offset split-struct [
|
||||
[ c-type c-type-reg-class ] map
|
||||
int-regs swap member? "void*" "double" ? c-type
|
||||
] map ;
|
||||
|
||||
: flatten-large-struct ( c-type -- seq )
|
||||
heap-size cell align
|
||||
cell /i "__stack_value" c-type <repetition> ;
|
||||
|
||||
M: struct-type flatten-value-type ( type -- seq )
|
||||
dup heap-size 16 > [
|
||||
flatten-large-struct
|
||||
] [
|
||||
flatten-small-struct
|
||||
] if ;
|
||||
|
||||
M: x86.64 struct-small-enough? ( size -- ? )
|
||||
heap-size 2 cells <= ;
|
||||
|
||||
M: x86.64 dummy-stack-params? f ;
|
||||
|
||||
M: x86.64 dummy-int-params? f ;
|
||||
|
||||
M: x86.64 dummy-fp-params? f ;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel layouts system alien.c-types compiler.cfg.registers
|
||||
cpu.architecture cpu.x86.assembler cpu.x86 ;
|
||||
USING: kernel layouts system math alien.c-types
|
||||
compiler.cfg.registers cpu.architecture cpu.x86.assembler cpu.x86 ;
|
||||
IN: cpu.x86.64.winnt
|
||||
|
||||
M: int-regs param-regs drop { RCX RDX R8 R9 } ;
|
||||
|
@ -10,6 +10,15 @@ M: float-regs param-regs drop { XMM0 XMM1 XMM2 XMM3 } ;
|
|||
|
||||
M: x86.64 reserved-area-size 4 cells ;
|
||||
|
||||
M: x86.64 struct-small-enough? ( size -- ? )
|
||||
heap-size cell <= ;
|
||||
|
||||
M: x86.64 dummy-stack-params? f ;
|
||||
|
||||
M: x86.64 dummy-int-params? t ;
|
||||
|
||||
M: x86.64 dummy-fp-params? t ;
|
||||
|
||||
<<
|
||||
"longlong" "ptrdiff_t" typedef
|
||||
"int" "long" typedef
|
||||
|
|
|
@ -467,6 +467,8 @@ M: x86 %compare-float-branch ( label cc src1 src2 -- )
|
|||
|
||||
: stack@ ( n -- op ) stack-reg swap [+] ;
|
||||
|
||||
: param@ ( n -- op ) reserved-area-size + stack@ ;
|
||||
|
||||
: spill-integer-base ( stack-frame -- n )
|
||||
[ params>> ] [ return>> ] bi + reserved-area-size + ;
|
||||
|
||||
|
@ -493,16 +495,16 @@ M: x86 %reload-float ( dst n -- ) spill-float@ MOVSD ;
|
|||
|
||||
M: x86 %loop-entry 16 code-alignment [ NOP ] times ;
|
||||
|
||||
M: int-regs %save-param-reg drop >r stack@ r> MOV ;
|
||||
M: int-regs %load-param-reg drop swap stack@ MOV ;
|
||||
M: int-regs %save-param-reg drop >r param@ r> MOV ;
|
||||
M: int-regs %load-param-reg drop swap param@ MOV ;
|
||||
|
||||
GENERIC: MOVSS/D ( dst src reg-class -- )
|
||||
|
||||
M: single-float-regs MOVSS/D drop MOVSS ;
|
||||
M: double-float-regs MOVSS/D drop MOVSD ;
|
||||
|
||||
M: float-regs %save-param-reg >r >r stack@ r> r> MOVSS/D ;
|
||||
M: float-regs %load-param-reg >r swap stack@ r> MOVSS/D ;
|
||||
M: float-regs %save-param-reg >r >r param@ r> r> MOVSS/D ;
|
||||
M: float-regs %load-param-reg >r swap param@ r> MOVSS/D ;
|
||||
|
||||
GENERIC: push-return-reg ( reg-class -- )
|
||||
GENERIC: load-return-reg ( n reg-class -- )
|
||||
|
@ -518,8 +520,6 @@ M: x86 %prepare-alien-invoke
|
|||
temp-reg-1 2 cells [+] ds-reg MOV
|
||||
temp-reg-1 3 cells [+] rs-reg MOV ;
|
||||
|
||||
M: x86 fp-shadows-int? ( -- ? ) f ;
|
||||
|
||||
M: x86 value-structs? t ;
|
||||
|
||||
M: x86 small-enough? ( n -- ? )
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2008 Slava Pestov, Eduardo Cavazos.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel sequences combinators parser splitting math
|
||||
quotations arrays make qualified words ;
|
||||
quotations arrays make words ;
|
||||
IN: fry
|
||||
|
||||
: _ ( -- * ) "Only valid inside a fry" throw ;
|
||||
|
|
|
@ -32,3 +32,14 @@ HELP: RENAME:
|
|||
"RENAME: + math => -"
|
||||
"2 3 - ! => 5" } } ;
|
||||
|
||||
ARTICLE: "qualified" "Qualified word lookup"
|
||||
"The " { $vocab-link "qualified" } " vocabulary provides a handful of parsing words which give more control over word lookup than is offered by " { $link POSTPONE: USE: } " and " { $link POSTPONE: USING: } "."
|
||||
$nl
|
||||
"These words are useful when there is no way to avoid using two vocabularies with identical word names in the same source file."
|
||||
{ $subsection POSTPONE: QUALIFIED: }
|
||||
{ $subsection POSTPONE: QUALIFIED-WITH: }
|
||||
{ $subsection POSTPONE: FROM: }
|
||||
{ $subsection POSTPONE: EXCLUDE: }
|
||||
{ $subsection POSTPONE: RENAME: } ;
|
||||
|
||||
ABOUT: "qualified"
|
||||
|
|
|
@ -1,24 +1,33 @@
|
|||
USING: tools.test qualified ;
|
||||
IN: foo
|
||||
USING: tools.test qualified eval accessors parser ;
|
||||
IN: qualified.tests.foo
|
||||
: x 1 ;
|
||||
IN: bar
|
||||
: y 5 ;
|
||||
IN: qualified.tests.bar
|
||||
: x 2 ;
|
||||
IN: baz
|
||||
: y 4 ;
|
||||
IN: qualified.tests.baz
|
||||
: x 3 ;
|
||||
|
||||
QUALIFIED: foo
|
||||
QUALIFIED: bar
|
||||
[ 1 2 3 ] [ foo:x bar:x x ] unit-test
|
||||
QUALIFIED: qualified.tests.foo
|
||||
QUALIFIED: qualified.tests.bar
|
||||
[ 1 2 3 ] [ qualified.tests.foo:x qualified.tests.bar:x x ] unit-test
|
||||
|
||||
QUALIFIED-WITH: bar p
|
||||
QUALIFIED-WITH: qualified.tests.bar p
|
||||
[ 2 ] [ p:x ] unit-test
|
||||
|
||||
RENAME: x baz => y
|
||||
RENAME: x qualified.tests.baz => y
|
||||
[ 3 ] [ y ] unit-test
|
||||
|
||||
FROM: baz => x ;
|
||||
FROM: qualified.tests.baz => x ;
|
||||
[ 3 ] [ x ] unit-test
|
||||
[ 3 ] [ y ] unit-test
|
||||
|
||||
EXCLUDE: bar => x ;
|
||||
EXCLUDE: qualified.tests.bar => x ;
|
||||
[ 3 ] [ x ] unit-test
|
||||
[ 4 ] [ y ] unit-test
|
||||
|
||||
[ "USE: qualified IN: qualified.tests FROM: qualified.tests => doesnotexist ;" eval ]
|
||||
[ error>> no-word-error? ] must-fail-with
|
||||
|
||||
[ "USE: qualified IN: qualified.tests RENAME: doesnotexist qualified.tests => blah" eval ]
|
||||
[ error>> no-word-error? ] must-fail-with
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
! Copyright (C) 2007, 2008 Daniel Ehrenberg.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel sequences assocs hashtables parser lexer
|
||||
vocabs words namespaces vocabs.loader debugger sets ;
|
||||
vocabs words namespaces vocabs.loader debugger sets fry ;
|
||||
IN: qualified
|
||||
|
||||
: define-qualified ( vocab-name prefix-name -- )
|
||||
[ load-vocab vocab-words ] [ CHAR: : suffix ] bi*
|
||||
[ -rot >r append r> ] curry assoc-map
|
||||
'[ [ [ _ ] dip append ] dip ] assoc-map
|
||||
use get push ;
|
||||
|
||||
: QUALIFIED:
|
||||
|
@ -19,27 +19,27 @@ IN: qualified
|
|||
|
||||
: expect=> ( -- ) scan "=>" assert= ;
|
||||
|
||||
: partial-vocab ( words name -- assoc )
|
||||
dupd [
|
||||
lookup [ "No such word: " swap append throw ] unless*
|
||||
] curry map zip ;
|
||||
|
||||
: partial-vocab-ignoring ( words name -- assoc )
|
||||
[ load-vocab vocab-words keys swap diff ] keep partial-vocab ;
|
||||
|
||||
: EXCLUDE:
|
||||
#! Syntax: EXCLUDE: vocab => words ... ;
|
||||
scan expect=>
|
||||
";" parse-tokens swap partial-vocab-ignoring use get push ; parsing
|
||||
: partial-vocab ( words vocab -- assoc )
|
||||
'[ dup _ lookup [ no-word-error ] unless* ]
|
||||
{ } map>assoc ;
|
||||
|
||||
: FROM:
|
||||
#! Syntax: FROM: vocab => words... ;
|
||||
scan dup load-vocab drop expect=>
|
||||
";" parse-tokens swap partial-vocab use get push ; parsing
|
||||
|
||||
: partial-vocab-excluding ( words vocab -- assoc )
|
||||
[ load-vocab vocab-words keys swap diff ] keep partial-vocab ;
|
||||
|
||||
: EXCLUDE:
|
||||
#! Syntax: EXCLUDE: vocab => words ... ;
|
||||
scan expect=>
|
||||
";" parse-tokens swap partial-vocab-excluding use get push ; parsing
|
||||
|
||||
: RENAME:
|
||||
#! Syntax: RENAME: word vocab => newname
|
||||
scan scan dup load-vocab drop lookup [ "No such word" throw ] unless*
|
||||
scan scan dup load-vocab drop
|
||||
dupd lookup [ ] [ no-word-error ] ?if
|
||||
expect=>
|
||||
scan associate use get push ; parsing
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ M: list focusable-child* drop t ;
|
|||
] if ;
|
||||
|
||||
: select-gadget ( gadget list -- )
|
||||
swap over children>> index
|
||||
tuck children>> index
|
||||
[ swap select-index ] [ drop ] if* ;
|
||||
|
||||
: clamp-loc ( point max -- point )
|
||||
|
|
|
@ -41,7 +41,7 @@ scroller H{
|
|||
dup model>> dependencies>> first <x-slider> >>x dup x>> @bottom grid-add
|
||||
dup model>> dependencies>> second <y-slider> >>y dup y>> @right grid-add
|
||||
|
||||
swap over model>> <viewport> >>viewport
|
||||
tuck model>> <viewport> >>viewport
|
||||
dup viewport>> @center grid-add ;
|
||||
|
||||
: <scroller> ( gadget -- scroller ) scroller new-scroller ;
|
||||
|
|
|
@ -271,17 +271,21 @@ check_os_arch_word() {
|
|||
|
||||
set_build_info() {
|
||||
check_os_arch_word
|
||||
MAKE_TARGET=$OS-$ARCH-$WORD
|
||||
if [[ $OS == macosx && $ARCH == ppc ]] ; then
|
||||
MAKE_IMAGE_TARGET=macosx-ppc
|
||||
MAKE_TARGET=macosx-ppc
|
||||
elif [[ $OS == linux && $ARCH == ppc ]] ; then
|
||||
MAKE_IMAGE_TARGET=linux-ppc
|
||||
MAKE_TARGET=linux-ppc
|
||||
elif [[ $OS == winnt && $ARCH == x86 && $WORD == 64 ]] ; then
|
||||
MAKE_IMAGE_TARGET=winnt-x86.64
|
||||
MAKE_TARGET=winnt-x86-64
|
||||
elif [[ $ARCH == x86 && $WORD == 64 ]] ; then
|
||||
MAKE_IMAGE_TARGET=unix-x86.64
|
||||
else
|
||||
MAKE_TARGET=$OS-x86-64
|
||||
else
|
||||
MAKE_IMAGE_TARGET=$ARCH.$WORD
|
||||
MAKE_TARGET=$OS-$ARCH-$WORD
|
||||
fi
|
||||
BOOT_IMAGE=boot.$MAKE_IMAGE_TARGET.image
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ $nl
|
|||
{ $subsection POSTPONE: PRIVATE> }
|
||||
{ $subsection "vocabulary-search-errors" }
|
||||
{ $subsection "vocabulary-search-shadow" }
|
||||
{ $see-also "words" } ;
|
||||
{ $see-also "words" "qualified" } ;
|
||||
|
||||
ARTICLE: "reading-ahead" "Reading ahead"
|
||||
"Parsing words can consume input:"
|
||||
|
|
|
@ -71,10 +71,10 @@ ERROR: no-current-vocab ;
|
|||
] keep
|
||||
] { } map>assoc ;
|
||||
|
||||
TUPLE: no-word-error name ;
|
||||
ERROR: no-word-error name ;
|
||||
|
||||
: no-word ( name -- newword )
|
||||
dup no-word-error boa
|
||||
dup \ no-word-error boa
|
||||
swap words-named [ forward-reference? not ] filter
|
||||
word-restarts throw-restarts
|
||||
dup vocabulary>> (use+) ;
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel namespaces continuations debugger sequences fry
|
||||
io.files io.launcher mason.common mason.platform
|
||||
io.files io.launcher bootstrap.image qualified mason.common
|
||||
mason.config ;
|
||||
FROM: mason.config => target-os ;
|
||||
IN: mason.release.tidy
|
||||
|
||||
: common-files ( -- seq )
|
||||
images [ boot-image-name ] map
|
||||
{
|
||||
"boot.x86.32.image"
|
||||
"boot.x86.64.image"
|
||||
"boot.macosx-ppc.image"
|
||||
"boot.linux-ppc.image"
|
||||
"vm"
|
||||
"temp"
|
||||
"logs"
|
||||
|
@ -20,7 +18,8 @@ IN: mason.release.tidy
|
|||
"unmaintained"
|
||||
"unfinished"
|
||||
"build-support"
|
||||
} ;
|
||||
}
|
||||
append ;
|
||||
|
||||
: remove-common-files ( -- )
|
||||
common-files [ delete-tree ] each ;
|
||||
|
|
|
@ -117,7 +117,7 @@ CELL frame_executing(F_STACK_FRAME *frame)
|
|||
F_STACK_FRAME *frame_successor(F_STACK_FRAME *frame)
|
||||
{
|
||||
if(frame->size == 0)
|
||||
critical_error("Stack frame has zero size",frame);
|
||||
critical_error("Stack frame has zero size",(CELL)frame);
|
||||
return (F_STACK_FRAME *)((CELL)frame - frame->size);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,14 +10,18 @@ and the callstack top is passed in EDX */
|
|||
#define DS_REG %esi
|
||||
#define RETURN_REG %eax
|
||||
|
||||
#define NV_TEMP_REG %ebx
|
||||
|
||||
#define CELL_SIZE 4
|
||||
#define STACK_PADDING 12
|
||||
|
||||
#define PUSH_NONVOLATILE \
|
||||
push %ebx ; \
|
||||
push %ebp ; \
|
||||
push %ebp
|
||||
|
||||
#define POP_NONVOLATILE \
|
||||
pop %ebp ; \
|
||||
pop %ebp ; \
|
||||
pop %ebx
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#define CELL_SIZE 8
|
||||
#define STACK_PADDING 56
|
||||
|
||||
#define NV_TEMP_REG %rbp
|
||||
|
||||
#ifdef WINDOWS
|
||||
|
||||
#define ARG0 %rcx
|
||||
|
@ -20,9 +22,11 @@
|
|||
push %rdi ; \
|
||||
push %rsi ; \
|
||||
push %rbx ; \
|
||||
push %rbp ; \
|
||||
push %rbp
|
||||
|
||||
#define POP_NONVOLATILE \
|
||||
pop %rbp ; \
|
||||
pop %rbp ; \
|
||||
pop %rbx ; \
|
||||
pop %rsi ; \
|
||||
|
@ -41,9 +45,11 @@
|
|||
push %rbx ; \
|
||||
push %rbp ; \
|
||||
push %r12 ; \
|
||||
push %r13 ; \
|
||||
push %r13
|
||||
|
||||
#define POP_NONVOLATILE \
|
||||
pop %r13 ; \
|
||||
pop %r13 ; \
|
||||
pop %r12 ; \
|
||||
pop %rbp ; \
|
||||
|
|
17
vm/cpu-x86.S
17
vm/cpu-x86.S
|
@ -1,20 +1,21 @@
|
|||
DEF(F_FASTCALL void,c_to_factor,(CELL quot)):
|
||||
PUSH_NONVOLATILE
|
||||
push ARG0
|
||||
|
||||
/* Save stack pointer */
|
||||
lea -CELL_SIZE(STACK_REG),ARG0
|
||||
mov ARG0,NV_TEMP_REG
|
||||
|
||||
/* Create register shadow area for Win64 */
|
||||
sub $32,STACK_REG
|
||||
sub $32,STACK_REG
|
||||
|
||||
/* Save stack pointer */
|
||||
lea -CELL_SIZE(STACK_REG),ARG0
|
||||
call MANGLE(save_callstack_bottom)
|
||||
add $32,STACK_REG
|
||||
|
||||
/* Call quot-xt */
|
||||
mov (STACK_REG),ARG0
|
||||
mov NV_TEMP_REG,ARG0
|
||||
call *QUOT_XT_OFFSET(ARG0)
|
||||
|
||||
pop ARG0
|
||||
/* Tear down register shadow area */
|
||||
add $32,STACK_REG
|
||||
|
||||
POP_NONVOLATILE
|
||||
ret
|
||||
|
||||
|
|
Loading…
Reference in New Issue