Rename enable/disable-compiler to enable/disable-optimizer, and add with-optimizer and without-optimizer combinators
parent
3b840c652c
commit
e9e095f240
|
@ -23,7 +23,7 @@ IN: bootstrap.compiler
|
|||
|
||||
"cpu." cpu name>> append require
|
||||
|
||||
enable-compiler
|
||||
enable-optimizer
|
||||
|
||||
! Push all tuple layouts to tenured space to improve method caching
|
||||
gc
|
||||
|
|
|
@ -4,16 +4,16 @@ compiler.units help.markup help.syntax io parser quotations
|
|||
sequences words ;
|
||||
IN: compiler
|
||||
|
||||
HELP: enable-compiler
|
||||
HELP: enable-optimizer
|
||||
{ $description "Enables the optimizing compiler." } ;
|
||||
|
||||
HELP: disable-compiler
|
||||
HELP: disable-optimizer
|
||||
{ $description "Disable the optimizing compiler." } ;
|
||||
|
||||
ARTICLE: "compiler-usage" "Calling the optimizing compiler"
|
||||
"Normally, new word definitions are recompiled automatically. This can be changed:"
|
||||
{ $subsection disable-compiler }
|
||||
{ $subsection enable-compiler }
|
||||
{ $subsection disable-optimizer }
|
||||
{ $subsection enable-optimizer }
|
||||
"Removing a word's optimized definition:"
|
||||
{ $subsection decompile }
|
||||
"Compiling a single quotation:"
|
||||
|
|
|
@ -192,10 +192,13 @@ M: optimizing-compiler recompile ( words -- alist )
|
|||
compiled get >alist
|
||||
] with-scope ;
|
||||
|
||||
: enable-compiler ( -- )
|
||||
: with-optimizer ( quot -- )
|
||||
[ optimizing-compiler compiler-impl ] dip with-variable ; inline
|
||||
|
||||
: enable-optimizer ( -- )
|
||||
optimizing-compiler compiler-impl set-global ;
|
||||
|
||||
: disable-compiler ( -- )
|
||||
: disable-optimizer ( -- )
|
||||
f compiler-impl set-global ;
|
||||
|
||||
: recompile-all ( -- )
|
||||
|
|
|
@ -309,7 +309,7 @@ FUNCTION: bool check_sse2 ( ) ;
|
|||
check_sse2 ;
|
||||
|
||||
"-no-sse2" (command-line) member? [
|
||||
optimizing-compiler compiler-impl [ { check_sse2 } compile ] with-variable
|
||||
[ { check_sse2 } compile ] with-optimizer
|
||||
|
||||
"Checking if your CPU supports SSE2..." print flush
|
||||
sse2? [
|
||||
|
|
|
@ -199,10 +199,10 @@ IN: peg.tests
|
|||
|
||||
USE: compiler
|
||||
|
||||
[ ] [ disable-compiler ] unit-test
|
||||
[ ] [ disable-optimizer ] unit-test
|
||||
|
||||
[ ] [ "" epsilon parse drop ] unit-test
|
||||
|
||||
[ ] [ enable-compiler ] unit-test
|
||||
[ ] [ enable-optimizer ] unit-test
|
||||
|
||||
[ [ ] ] [ "" epsilon [ drop [ [ ] ] call ] action parse ] unit-test
|
||||
|
|
|
@ -19,7 +19,7 @@ IN: compiler.units.tests
|
|||
] unit-test
|
||||
|
||||
[ "A" "B" ] [
|
||||
disable-compiler
|
||||
disable-optimizer
|
||||
|
||||
gensym "a" set
|
||||
gensym "b" set
|
||||
|
@ -33,7 +33,7 @@ IN: compiler.units.tests
|
|||
] with-compilation-unit
|
||||
"b" get execute
|
||||
|
||||
enable-compiler
|
||||
enable-optimizer
|
||||
] unit-test
|
||||
|
||||
! Check that we notify observers
|
||||
|
|
|
@ -43,6 +43,9 @@ HOOK: recompile compiler-impl ( words -- alist )
|
|||
! Non-optimizing compiler
|
||||
M: f recompile [ dup def>> ] { } map>assoc ;
|
||||
|
||||
: without-optimizer ( quot -- )
|
||||
[ f compiler-impl ] dip with-variable ; inline
|
||||
|
||||
! Trivial compiler. We don't want to touch the code heap
|
||||
! during stage1 bootstrap, it would just waste time.
|
||||
SINGLETON: dummy-compiler
|
||||
|
|
Loading…
Reference in New Issue