Updating some code

db4
Slava Pestov 2008-08-12 03:31:48 -05:00
parent 9e98e89494
commit 48fa2e2d0e
32 changed files with 80 additions and 116 deletions

View File

@ -3,10 +3,10 @@
USING: accessors compiler cpu.architecture vocabs.loader system USING: accessors compiler cpu.architecture vocabs.loader system
sequences namespaces parser kernel kernel.private classes sequences namespaces parser kernel kernel.private classes
classes.private arrays hashtables vectors classes.tuple sbufs classes.private arrays hashtables vectors classes.tuple sbufs
inference.dataflow hashtables.private sequences.private math hashtables.private sequences.private math classes.tuple.private
classes.tuple.private growable namespaces.private assocs words growable namespaces.private assocs words command-line vocabs io
generator command-line vocabs io io.encodings.string io.encodings.string prettyprint libc compiler.units math.order
prettyprint libc compiler.units math.order ; compiler.tree.builder compiler.tree.optimizer ;
IN: bootstrap.compiler IN: bootstrap.compiler
! Don't bring this in when deploying, since it will store a ! Don't bring this in when deploying, since it will store a
@ -80,6 +80,10 @@ nl
malloc calloc free memcpy malloc calloc free memcpy
} compile-uncompiled } compile-uncompiled
{
build-tree optimize-tree
} compile-uncompiled
vocabs [ words compile-uncompiled "." write flush ] each vocabs [ words compile-uncompiled "." write flush ] each
" done" print flush " done" print flush

View File

@ -1,7 +1,7 @@
! Copyright (C) 2006, 2008 Slava Pestov. ! Copyright (C) 2006, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types alien.strings alien.compiler USING: alien alien.c-types alien.strings
arrays assocs combinators compiler inference.transforms kernel arrays assocs combinators compiler kernel
math namespaces parser prettyprint prettyprint.sections math namespaces parser prettyprint prettyprint.sections
quotations sequences strings words cocoa.runtime io macros quotations sequences strings words cocoa.runtime io macros
memoize debugger io.encodings.ascii effects ; memoize debugger io.encodings.ascii effects ;

View File

@ -1,5 +1,5 @@
USING: kernel sequences math inference accessors macros USING: kernel sequences math stack-checker accessors macros
combinators.short-circuit ; combinators.short-circuit ;
IN: combinators.short-circuit.smart IN: combinators.short-circuit.smart

View File

@ -1,4 +1,4 @@
USING: generator help.markup help.syntax words io parser USING: compiler.generator help.markup help.syntax words io parser
assocs words.private sequences compiler.units ; assocs words.private sequences compiler.units ;
IN: compiler IN: compiler

View File

@ -1,10 +1,9 @@
! Copyright (C) 2004, 2008 Slava Pestov. ! Copyright (C) 2004, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel namespaces arrays sequences io inference.backend USING: kernel namespaces arrays sequences io debugger words
inference.state generator debugger words compiler.units compiler.units continuations vocabs assocs dlists definitions
continuations vocabs assocs alien.compiler dlists optimizer math compiler.errors threads graphs generic combinators dequeues
definitions math compiler.errors threads graphs generic search-dequeues ;
inference combinators dequeues search-dequeues ;
IN: compiler IN: compiler
SYMBOL: +failed+ SYMBOL: +failed+

View File

@ -1,4 +1,4 @@
IN: compiler.tests IN: compiler.tests
USING: words kernel inference alien.strings tools.test ; USING: words kernel stack-checker alien.strings tools.test ;
[ ] [ \ if redefined [ string>alien ] infer. ] unit-test [ ] [ \ if redefined [ string>alien ] infer. ] unit-test

View File

@ -1,6 +1,6 @@
! Testing templates machinery without compiling anything ! Testing templates machinery without compiling anything
IN: compiler.tests IN: compiler.tests
USING: compiler generator generator.registers USING: compiler compiler.generator compiler.generator.registers
generator.registers.private tools.test namespaces sequences generator.registers.private tools.test namespaces sequences
words kernel math effects definitions compiler.units accessors words kernel math effects definitions compiler.units accessors
cpu.architecture ; cpu.architecture ;

View File

@ -1,10 +1,10 @@
! Copyright (C) 2005, 2007 Slava Pestov. ! Copyright (C) 2005, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types cpu.ppc.assembler cpu.architecture generic USING: alien.c-types cpu.ppc.assembler cpu.architecture generic
kernel kernel.private math memory namespaces sequences words kernel kernel.private math memory namespaces sequences words
assocs generator generator.registers generator.fixup system assocs compiler.generator compiler.generator.registers
layouts classes words.private alien combinators compiler.generator.fixup system layouts classes words.private
compiler.constants math.order ; alien combinators compiler.constants math.order ;
IN: cpu.ppc.architecture IN: cpu.ppc.architecture
! PowerPC register assignments ! PowerPC register assignments

View File

@ -1,7 +1,7 @@
! Copyright (C) 2005, 2008 Slava Pestov. ! Copyright (C) 2005, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: generator.fixup kernel namespaces words io.binary math USING: compiler.generator.fixup kernel namespaces words
math.order cpu.ppc.assembler.backend ; io.binary math math.order cpu.ppc.assembler.backend ;
IN: cpu.ppc.assembler IN: cpu.ppc.assembler
! See the Motorola or IBM documentation for details. The opcode ! See the Motorola or IBM documentation for details. The opcode

View File

@ -1,6 +1,6 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: generator.fixup kernel namespaces sequences USING: compiler.generator.fixup kernel namespaces sequences
words math math.bitfields io.binary parser lexer ; words math math.bitfields io.binary parser lexer ;
IN: cpu.ppc.assembler.backend IN: cpu.ppc.assembler.backend

View File

@ -1,7 +1,7 @@
! Copyright (C) 2007, 2008 Slava Pestov. ! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: bootstrap.image.private kernel kernel.private namespaces USING: bootstrap.image.private kernel kernel.private namespaces
system cpu.ppc.assembler generator.fixup compiler.units system cpu.ppc.assembler compiler.generator.fixup compiler.units
compiler.constants math math.private layouts words words.private compiler.constants math math.private layouts words words.private
vocabs slots.private ; vocabs slots.private ;
IN: bootstrap.ppc IN: bootstrap.ppc

View File

@ -4,10 +4,10 @@ USING: accessors alien alien.accessors alien.c-types arrays
cpu.ppc.assembler cpu.ppc.architecture cpu.ppc.allot cpu.ppc.assembler cpu.ppc.architecture cpu.ppc.allot
cpu.architecture kernel kernel.private math math.private cpu.architecture kernel kernel.private math math.private
namespaces sequences words generic quotations byte-arrays namespaces sequences words generic quotations byte-arrays
hashtables hashtables.private generator generator.registers hashtables hashtables.private compiler.generator
generator.fixup sequences.private sbufs vectors system layouts compiler.generator.registers generator.fixup sequences.private
math.floats.private classes slots.private combinators sbufs vectors system layouts math.floats.private classes
compiler.constants optimizer.allot ; slots.private combinators compiler.constants ;
IN: cpu.ppc.intrinsics IN: cpu.ppc.intrinsics
: %slot-literal-known-tag : %slot-literal-known-tag

View File

@ -3,9 +3,10 @@
USING: alien.c-types arrays cpu.x86.assembler USING: alien.c-types arrays cpu.x86.assembler
cpu.x86.architecture cpu.x86.intrinsics cpu.x86.allot cpu.x86.architecture cpu.x86.intrinsics cpu.x86.allot
cpu.architecture kernel kernel.private math namespaces sequences cpu.architecture kernel kernel.private math namespaces sequences
generator.registers generator.fixup generator system layouts compiler.generator.registers compiler.generator.fixup
alien.compiler combinators command-line compiler.generator system layouts alien.compiler combinators
compiler compiler.units io vocabs.loader accessors init ; command-line compiler compiler.units io vocabs.loader accessors
init ;
IN: cpu.x86.32 IN: cpu.x86.32
! We implement the FFI for Linux, OS X and Windows all at once. ! We implement the FFI for Linux, OS X and Windows all at once.

View File

@ -3,9 +3,9 @@
USING: accessors alien.c-types arrays cpu.x86.assembler USING: accessors alien.c-types arrays cpu.x86.assembler
cpu.x86.architecture cpu.x86.intrinsics cpu.x86.sse2 cpu.x86.architecture cpu.x86.intrinsics cpu.x86.sse2
cpu.x86.allot cpu.architecture kernel kernel.private math cpu.x86.allot cpu.architecture kernel kernel.private math
namespaces sequences generator.registers generator.fixup system namespaces sequences compiler.generator.registers
layouts alien alien.accessors alien.compiler alien.structs slots compiler.generator.fixup system layouts alien alien.accessors
splitting assocs ; alien.structs slots splitting assocs ;
IN: cpu.x86.64 IN: cpu.x86.64
M: x86.64 ds-reg R14 ; M: x86.64 ds-reg R14 ;

View File

@ -1,9 +1,9 @@
! Copyright (C) 2006, 2007 Slava Pestov. ! Copyright (C) 2006, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel cpu.architecture cpu.x86.assembler USING: kernel cpu.architecture cpu.x86.assembler
cpu.x86.architecture kernel.private namespaces math cpu.x86.architecture kernel.private namespaces math sequences
sequences generic arrays generator generator.fixup generic arrays compiler.generator compiler.generator.fixup
generator.registers system layouts alien ; compiler.generator.registers system layouts alien ;
IN: cpu.x86.allot IN: cpu.x86.allot
: allot-reg ( -- reg ) : allot-reg ( -- reg )

View File

@ -1,10 +1,10 @@
! Copyright (C) 2005, 2008 Slava Pestov. ! Copyright (C) 2005, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types alien.compiler arrays USING: alien alien.c-types arrays cpu.x86.assembler
cpu.x86.assembler cpu.x86.assembler.private cpu.architecture cpu.x86.assembler.private cpu.architecture kernel kernel.private
kernel kernel.private math memory namespaces sequences words math memory namespaces sequences words generator
generator generator.registers generator.fixup system layouts compiler.generator.registers compiler.generator.fixup system
combinators compiler.constants math.order ; layouts combinators compiler.constants math.order ;
IN: cpu.x86.architecture IN: cpu.x86.architecture
HOOK: ds-reg cpu ( -- reg ) HOOK: ds-reg cpu ( -- reg )

View File

@ -1,6 +1,6 @@
! Copyright (C) 2005, 2008 Slava Pestov. ! Copyright (C) 2005, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays generator.fixup io.binary kernel USING: arrays compiler.generator.fixup io.binary kernel
combinators kernel.private math namespaces sequences combinators kernel.private math namespaces sequences
words system layouts math.order accessors words system layouts math.order accessors
cpu.x86.assembler.syntax ; cpu.x86.assembler.syntax ;

View File

@ -1,9 +1,9 @@
! Copyright (C) 2007, 2008 Slava Pestov. ! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: bootstrap.image.private kernel kernel.private namespaces USING: bootstrap.image.private kernel kernel.private namespaces
system cpu.x86.assembler layouts compiler.units math math.private system cpu.x86.assembler layouts compiler.units math
generator.fixup compiler.constants vocabs slots.private words math.private compiler.generator.fixup compiler.constants vocabs
words.private ; slots.private words words.private ;
IN: bootstrap.x86 IN: bootstrap.x86
big-endian off big-endian off

View File

@ -4,9 +4,10 @@ USING: accessors alien alien.accessors arrays cpu.x86.assembler
cpu.x86.allot cpu.x86.architecture cpu.architecture kernel cpu.x86.allot cpu.x86.architecture cpu.architecture kernel
kernel.private math math.private namespaces quotations sequences kernel.private math math.private namespaces quotations sequences
words generic byte-arrays hashtables hashtables.private words generic byte-arrays hashtables hashtables.private
generator generator.registers generator.fixup sequences.private compiler.generator compiler.generator.registers
sbufs sbufs.private vectors vectors.private layouts system compiler.generator.fixup sequences.private sbufs sbufs.private
strings.private slots.private compiler.constants optimizer.allot ; vectors vectors.private layouts system strings.private
slots.private compiler.constants ;
IN: cpu.x86.intrinsics IN: cpu.x86.intrinsics
! Type checks ! Type checks

View File

@ -1,10 +1,10 @@
! Copyright (C) 2005, 2007 Slava Pestov. ! Copyright (C) 2005, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.accessors arrays cpu.x86.assembler USING: alien alien.accessors arrays cpu.x86.assembler
cpu.x86.architecture cpu.x86.intrinsics generic kernel cpu.x86.architecture cpu.x86.intrinsics generic kernel
kernel.private math math.private memory namespaces sequences kernel.private math math.private memory namespaces sequences
words generator generator.registers cpu.architecture words compiler.generator compiler.generator.registers
math.floats.private layouts quotations ; cpu.architecture math.floats.private layouts quotations ;
IN: cpu.x86.sse2 IN: cpu.x86.sse2
: define-float-op ( word op -- ) : define-float-op ( word op -- )

View File

@ -1,7 +1,6 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: math kernel slots.private inference.known-words USING: math kernel slots.private sequences effects words ;
inference.backend sequences effects words ;
IN: locals.backend IN: locals.backend
: load-locals ( n -- ) : load-locals ( n -- )
@ -16,29 +15,3 @@ IN: locals.backend
: drop-locals ( n -- ) : drop-locals ( n -- )
dup zero? [ drop ] [ r> drop 1- drop-locals ] if ; dup zero? [ drop ] [ r> drop 1- drop-locals ] if ;
\ load-locals [
pop-literal nip
[ dup reverse <effect> infer-shuffle ]
[ infer->r ]
bi
] "infer" set-word-prop
\ get-local [
pop-literal nip
[ infer-r> ]
[ dup 0 prefix <effect> infer-shuffle ]
[ infer->r ]
tri
] "infer" set-word-prop
\ drop-locals [
pop-literal nip
[ infer-r> ]
[ { } <effect> infer-shuffle ] bi
] "infer" set-word-prop
<<
{ load-locals get-local drop-locals }
[ t "no-compile" set-word-prop ] each
>>

View File

@ -1,11 +1,11 @@
! Copyright (C) 2007, 2008 Slava Pestov, Eduardo Cavazos. ! Copyright (C) 2007, 2008 Slava Pestov, Eduardo Cavazos.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel namespaces sequences sequences.private assocs math USING: kernel namespaces sequences sequences.private assocs math
inference.transforms parser words quotations debugger macros parser words quotations debugger macros arrays macros splitting
arrays macros splitting combinators prettyprint.backend combinators prettyprint.backend definitions prettyprint
definitions prettyprint hashtables prettyprint.sections sets hashtables prettyprint.sections sets sequences.private effects
sequences.private effects effects.parser generic generic.parser effects.parser generic generic.parser compiler.units accessors
compiler.units accessors locals.backend memoize lexer ; locals.backend memoize lexer ;
IN: locals IN: locals
! Inspired by ! Inspired by

View File

@ -13,5 +13,5 @@ unit-test
[ \ see-test see ] with-string-writer = [ \ see-test see ] with-string-writer =
] unit-test ] unit-test
[ ] [ "USING: macros inference kernel ; IN: hanging-macro MACRO: c ( quot -- ) infer drop [ ] ; : a ( -- ) [ a ] c ;" eval ] unit-test [ ] [ "USING: macros stack-checker kernel ; IN: hanging-macro MACRO: c ( quot -- ) infer drop [ ] ; : a ( -- ) [ a ] c ;" eval ] unit-test

View File

@ -1,8 +1,8 @@
! Copyright (C) 2007, 2008 Slava Pestov. ! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: parser kernel sequences words effects USING: parser kernel sequences words effects
inference.transforms combinators assocs definitions quotations stack-checker.transforms combinators assocs definitions
namespaces memoize ; quotations namespaces memoize ;
IN: macros IN: macros
: real-macro-effect ( word -- effect' ) : real-macro-effect ( word -- effect' )

View File

@ -1,7 +1,7 @@
! Copyright (C) 2007, 2008 Slava Pestov. ! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays kernel math sequences words USING: arrays kernel math sequences words
namespaces inference.transforms ; namespaces stack-checker.transforms ;
IN: math.bitfields IN: math.bitfields
GENERIC: (bitfield) ( value accum shift -- newaccum ) GENERIC: (bitfield) ( value accum shift -- newaccum )

View File

@ -1,4 +1,4 @@
IN: optimizer.math.partial.tests IN: math.partial-dispatch.tests
USING: math.partial-dispatch tools.test math kernel sequences ; USING: math.partial-dispatch tools.test math kernel sequences ;
[ t ] [ \ + integer fixnum math-both-known? ] unit-test [ t ] [ \ + integer fixnum math-both-known? ] unit-test

View File

@ -58,11 +58,7 @@ IN: prettyprint
: pprint ( obj -- ) [ pprint* ] with-pprint ; : pprint ( obj -- ) [ pprint* ] with-pprint ;
: . ( obj -- ) : . ( obj -- ) pprint nl ;
H{
{ length-limit 1000 }
{ nesting-limit 10 }
} clone [ pprint ] bind nl ;
: pprint-use ( obj -- ) [ pprint* ] with-use ; : pprint-use ( obj -- ) [ pprint* ] with-use ;
@ -128,7 +124,7 @@ PRIVATE>
: callstack. ( callstack -- ) : callstack. ( callstack -- )
callstack>array 2 <groups> [ callstack>array 2 <groups> [
remove-breakpoints remove-breakpoints
2 nesting-limit [ . ] with-variable 3 nesting-limit [ . ] with-variable
] assoc-each ; ] assoc-each ;
: .c ( -- ) callstack callstack. ; : .c ( -- ) callstack callstack. ;

View File

@ -9,16 +9,6 @@ threads.private io.streams.string io.timeouts io.thread
sequences.private destructors combinators eval ; sequences.private destructors combinators eval ;
IN: stack-checker.tests IN: stack-checker.tests
: short-effect ( effect -- pair )
[ in>> length ] [ out>> length ] bi 2array ;
: must-infer-as ( effect quot -- )
>r 1quotation r> [ infer short-effect ] curry unit-test ;
: must-infer ( word/quot -- )
dup word? [ 1quotation ] when
[ infer drop ] curry [ ] swap unit-test ;
\ infer. must-infer \ infer. must-infer
{ 0 2 } [ 2 "Hello" ] must-infer-as { 0 2 } [ 2 "Hello" ] must-infer-as

View File

@ -2,8 +2,8 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: io.files io words alien kernel math.parser alien.syntax USING: io.files io words alien kernel math.parser alien.syntax
io.launcher system assocs arrays sequences namespaces qualified io.launcher system assocs arrays sequences namespaces qualified
system math generator.fixup io.encodings.ascii accessors system math compiler.generator.fixup io.encodings.ascii
generic tr ; accessors generic tr ;
IN: tools.disassembler IN: tools.disassembler
: in-file ( -- path ) "gdb-in.txt" temp-file ; : in-file ( -- path ) "gdb-in.txt" temp-file ;

View File

@ -3,7 +3,7 @@
USING: accessors namespaces arrays prettyprint sequences kernel USING: accessors namespaces arrays prettyprint sequences kernel
vectors quotations words parser assocs combinators continuations vectors quotations words parser assocs combinators continuations
debugger io io.styles io.files vocabs vocabs.loader source-files debugger io io.styles io.files vocabs vocabs.loader source-files
compiler.units summary inference effects tools.vocabs ; compiler.units summary stack-checker effects tools.vocabs ;
IN: tools.test IN: tools.test
SYMBOL: failures SYMBOL: failures

View File

@ -3,12 +3,12 @@
USING: continuations definitions ui.tools.browser USING: continuations definitions ui.tools.browser
ui.tools.interactor ui.tools.listener ui.tools.profiler ui.tools.interactor ui.tools.listener ui.tools.profiler
ui.tools.search ui.tools.traceback ui.tools.workspace generic ui.tools.search ui.tools.traceback ui.tools.workspace generic
help.topics inference summary inspector io.files io.styles kernel help.topics stack-checker summary inspector io.files io.styles
namespaces parser prettyprint quotations tools.annotations kernel namespaces parser prettyprint quotations
editors tools.profiler tools.test tools.time tools.walker tools.annotations editors tools.profiler tools.test tools.time
ui.commands ui.gadgets.editors ui.gestures ui.operations tools.walker ui.commands ui.gadgets.editors ui.gestures
ui.tools.deploy vocabs vocabs.loader words sequences ui.operations ui.tools.deploy vocabs vocabs.loader words
tools.vocabs classes compiler.units accessors ; sequences tools.vocabs classes compiler.units accessors ;
IN: ui.tools.operations IN: ui.tools.operations
V{ } clone operations set-global V{ } clone operations set-global

View File

@ -4,7 +4,7 @@
USING: alien alien.c-types alien.syntax kernel libc structs sequences USING: alien alien.c-types alien.syntax kernel libc structs sequences
continuations byte-arrays strings continuations byte-arrays strings
math namespaces system combinators vocabs.loader qualified math namespaces system combinators vocabs.loader qualified
accessors inference macros locals generalizations accessors stack-checker macros locals generalizations
unix.types debugger io prettyprint ; unix.types debugger io prettyprint ;
IN: unix IN: unix