diff --git a/library/compiler/xt.factor b/library/compiler/xt.factor index 19d99cbfae..587b2c57a2 100644 --- a/library/compiler/xt.factor +++ b/library/compiler/xt.factor @@ -5,6 +5,24 @@ USING: assembler errors generic hashtables kernel kernel-internals lists math namespaces prettyprint sequences strings vectors words ; +! We use a hashtable "compiled-xts" that maps words to +! xt's that are currently being compiled. The commit-xt's word +! sets the xt of each word in the hashtable to the value in the +! hastable. +SYMBOL: compiled-xts + +: save-xt ( word -- ) + compiled-offset swap compiled-xts get set-hash ; + +: commit-xts ( -- ) + #! We must flush the instruction cache on PowerPC. + flush-icache + compiled-xts get [ swap set-word-xt ] hash-each + compiled-xts off ; + +: compiled-xt ( word -- xt ) + dup compiled-xts get hash [ ] [ word-xt ] ?if ; + ! To support saving compiled code to disk, generator words ! append relocation instructions to this vector. SYMBOL: relocation-table @@ -104,24 +122,6 @@ M: fixup-2/2 fixup ( addr fixup -- ) dup 0 0 rel-word compiled-offset cell - deferred-xt ; -! We use a hashtable "compiled-xts" that maps words to -! xt's that are currently being compiled. The commit-xt's word -! sets the xt of each word in the hashtable to the value in the -! hastable. -SYMBOL: compiled-xts - -: save-xt ( word -- ) - compiled-offset swap compiled-xts get set-hash ; - -: commit-xts ( -- ) - #! We must flush the instruction cache on PowerPC. - flush-icache - compiled-xts get [ swap set-word-xt ] hash-each - compiled-xts off ; - -: compiled-xt ( word -- xt ) - dup compiled-xts get hash [ ] [ word-xt ] ?if ; - ! When a word is encountered that has not been previously ! compiled, it is pushed onto this vector. Compilation stops ! when the vector is empty.