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