diff --git a/basis/cocoa/application/application.factor b/basis/cocoa/application/application.factor index 9437051dad..8b33986fc2 100644 --- a/basis/cocoa/application/application.factor +++ b/basis/cocoa/application/application.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.syntax io kernel namespaces core-foundation core-foundation.strings cocoa.messages cocoa cocoa.classes -cocoa.runtime sequences threads init summary kernel.private +cocoa.runtime sequences init summary kernel.private assocs ; IN: cocoa.application diff --git a/basis/compiler/codegen/codegen.factor b/basis/compiler/codegen/codegen.factor index 7df80c6b6e..65e70bd042 100755 --- a/basis/compiler/codegen/codegen.factor +++ b/basis/compiler/codegen/codegen.factor @@ -53,7 +53,7 @@ SYMBOL: labels V{ } clone literal-table set V{ } clone calls set compiling-word set - compiled-stack-traces? compiling-word get f ? add-literal ; + compiled-stack-traces? [ compiling-word get add-literal ] when ; : generate ( mr -- asm ) [ diff --git a/basis/compiler/tree/propagation/known-words/known-words.factor b/basis/compiler/tree/propagation/known-words/known-words.factor index ecfd415579..1b5d383353 100644 --- a/basis/compiler/tree/propagation/known-words/known-words.factor +++ b/basis/compiler/tree/propagation/known-words/known-words.factor @@ -312,7 +312,7 @@ generic-comparison-ops [ \ clone [ in-d>> first value-info literal>> { { V{ } [ [ drop { } 0 vector boa ] ] } - { H{ } [ [ drop hashtable new ] ] } + { H{ } [ [ drop 0 ] ] } [ drop f ] } case ] "custom-inlining" set-word-prop diff --git a/basis/core-foundation/strings/strings.factor b/basis/core-foundation/strings/strings.factor index 21f3d7efd4..413709d142 100644 --- a/basis/core-foundation/strings/strings.factor +++ b/basis/core-foundation/strings/strings.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: alien.syntax alien.strings io.encodings.string kernel sequences byte-arrays io.encodings.utf8 math core-foundation -core-foundation.arrays destructors unicode.data ; +core-foundation.arrays destructors ; IN: core-foundation.strings TYPEDEF: void* CFStringRef @@ -62,7 +62,7 @@ FUNCTION: CFStringRef CFStringCreateWithCString ( : prepare-CFString ( string -- byte-array ) [ dup HEX: 10ffff > - [ drop CHAR: replacement-character ] when + [ drop HEX: fffd ] when ] map utf8 encode ; : ( string -- alien ) diff --git a/basis/hints/hints.factor b/basis/hints/hints.factor index 597367c353..804ef035f4 100644 --- a/basis/hints/hints.factor +++ b/basis/hints/hints.factor @@ -119,6 +119,6 @@ SYNTAX: HINTS: \ >be { { bignum fixnum } { fixnum fixnum } } "specializer" set-word-prop -\ hashtable \ at* method { { fixnum hashtable } { word hashtable } } "specializer" set-word-prop +\ hashtable \ at* method { { fixnum object } { word object } } "specializer" set-word-prop \ hashtable \ set-at method { { object fixnum object } { object word object } } "specializer" set-word-prop diff --git a/basis/io/encodings/ascii/ascii.factor b/basis/io/encodings/ascii/ascii.factor index deb1a7121f..1654cb8b83 100644 --- a/basis/io/encodings/ascii/ascii.factor +++ b/basis/io/encodings/ascii/ascii.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Daniel Ehrenberg. ! See http://factorcode.org/license.txt for BSD license. -USING: io io.encodings kernel math io.encodings.private io.encodings.iana ; +USING: io io.encodings kernel math io.encodings.private ; IN: io.encodings.ascii n-table [ initial-e>n ] initialize [ n>e-table get-global set-at ] with each ] [ "Bad encoding registration" throw ] if* ] [ swap e>n-table get-global set-at ] 2bi ; + +ascii "ANSI_X3.4-1968" register-encoding diff --git a/basis/syndication/syndication-docs.factor b/basis/syndication/syndication-docs.factor index 47bdc3bb36..bc9612f55c 100644 --- a/basis/syndication/syndication-docs.factor +++ b/basis/syndication/syndication-docs.factor @@ -36,7 +36,7 @@ HELP: download-feed { $description "Downloads a feed from a URL using the " { $link "http.client" } "." } ; HELP: parse-feed -{ $values { "sequence" "a string or a byte array" } { "feed" feed } } +{ $values { "seq" "a string or a byte array" } { "feed" feed } } { $description "Parses a feed." } ; HELP: xml>feed diff --git a/basis/syndication/syndication.factor b/basis/syndication/syndication.factor index 75c1824c78..e30cd6826c 100755 --- a/basis/syndication/syndication.factor +++ b/basis/syndication/syndication.factor @@ -106,7 +106,7 @@ TUPLE: entry title url description date ; { "feed" [ atom1.0 ] } } case ; -GENERIC: parse-feed ( sequence -- feed ) +GENERIC: parse-feed ( seq -- feed ) M: string parse-feed [ string>xml xml>feed ] with-html-entities ; diff --git a/basis/tools/deploy/shaker/shaker.factor b/basis/tools/deploy/shaker/shaker.factor index 55433299ad..8ee0393091 100755 --- a/basis/tools/deploy/shaker/shaker.factor +++ b/basis/tools/deploy/shaker/shaker.factor @@ -157,6 +157,7 @@ IN: tools.deploy.shaker "specializer" "step-into" "step-into?" + "superclass" "transform-n" "transform-quot" "tuple-dispatch-generic" diff --git a/core/hashtables/hashtables.factor b/core/hashtables/hashtables.factor index 8aa13a5f5e..f95a7a7e67 100644 --- a/core/hashtables/hashtables.factor +++ b/core/hashtables/hashtables.factor @@ -79,7 +79,7 @@ TUPLE: hashtable : grow-hash ( hash -- ) [ [ >alist ] [ assoc-size 1+ ] bi ] keep [ reset-hash ] keep - swap (rehash) ; inline + swap (rehash) ; : ?grow-hash ( hash -- ) dup hash-large? [ @@ -95,7 +95,7 @@ TUPLE: hashtable PRIVATE> : ( n -- hash ) - hashtable new [ reset-hash ] keep ; + hashtable new [ reset-hash ] keep ; inline M: hashtable at* ( key hash -- value ? ) key@ [ 3 fixnum+fast slot t ] [ 2drop f f ] if ; diff --git a/core/namespaces/namespaces.factor b/core/namespaces/namespaces.factor index 623e2ddcda..b0e764c94d 100644 --- a/core/namespaces/namespaces.factor +++ b/core/namespaces/namespaces.factor @@ -30,6 +30,6 @@ PRIVATE> : bind ( ns quot -- ) swap >n call ndrop ; inline : counter ( variable -- n ) global [ 0 or 1+ dup ] change-at ; : make-assoc ( quot exemplar -- hash ) 20 swap new-assoc [ swap bind ] keep ; inline -: with-scope ( quot -- ) H{ } clone swap bind ; inline +: with-scope ( quot -- ) 5 swap bind ; inline : with-variable ( value key quot -- ) [ associate ] dip bind ; inline : initialize ( variable quot -- ) [ global ] dip [ unless* ] curry change-at ; inline \ No newline at end of file diff --git a/vm/callstack.c b/vm/callstack.c index d44a889756..b7e6b946bb 100755 --- a/vm/callstack.c +++ b/vm/callstack.c @@ -103,7 +103,7 @@ CELL frame_type(F_STACK_FRAME *frame) CELL frame_executing(F_STACK_FRAME *frame) { F_CODE_BLOCK *compiled = frame_code(frame); - if(compiled->literals == F) + if(compiled->literals == F || !stack_traces_p()) return F; else { diff --git a/vm/code_block.c b/vm/code_block.c index c6ecb2f431..8dda8bc16e 100644 --- a/vm/code_block.c +++ b/vm/code_block.c @@ -11,7 +11,7 @@ void iterate_relocations(F_CODE_BLOCK *compiled, RELOCATION_ITERATOR iter) { F_BYTE_ARRAY *relocation = untag_object(compiled->relocation); - CELL index = 1; + CELL index = stack_traces_p() ? 1 : 0; F_REL *rel = (F_REL *)(relocation + 1); F_REL *rel_end = (F_REL *)((char *)rel + byte_array_capacity(relocation)); @@ -368,11 +368,6 @@ void deposit_integers(CELL here, F_ARRAY *array, CELL format) } } -bool stack_traces_p(void) -{ - return to_boolean(userenv[STACK_TRACES_ENV]); -} - CELL compiled_code_format(void) { return untag_fixnum_fast(userenv[JIT_CODE_FORMAT]); @@ -429,6 +424,10 @@ F_CODE_BLOCK *add_code_block( UNREGISTER_ROOT(relocation); UNREGISTER_ROOT(literals); + /* slight space optimization */ + if(type_of(literals) == ARRAY_TYPE && array_capacity(untag_object(literals)) == 0) + literals = F; + /* compiled header */ compiled->block.type = type; compiled->block.last_scan = NURSERY; diff --git a/vm/code_block.h b/vm/code_block.h index b00e4be8b6..cb8ebf5e19 100644 --- a/vm/code_block.h +++ b/vm/code_block.h @@ -75,7 +75,10 @@ void relocate_code_block(F_CODE_BLOCK *relocating); CELL compiled_code_format(void); -bool stack_traces_p(void); +INLINE bool stack_traces_p(void) +{ + return userenv[STACK_TRACES_ENV] != F; +} F_CODE_BLOCK *add_code_block( CELL type, diff --git a/vm/debug.c b/vm/debug.c index adae1cdd36..6f7e883785 100755 --- a/vm/debug.c +++ b/vm/debug.c @@ -311,7 +311,7 @@ void find_data_references(CELL look_for_) /* Dump all code blocks for debugging */ void dump_code_heap(void) { - CELL size = 0; + CELL reloc_size = 0, literal_size = 0; F_BLOCK *scan = first_block(&code_heap); @@ -324,11 +324,13 @@ void dump_code_heap(void) status = "free"; break; case B_ALLOCATED: - size += object_size(((F_CODE_BLOCK *)scan)->relocation); + reloc_size += object_size(((F_CODE_BLOCK *)scan)->relocation); + literal_size += object_size(((F_CODE_BLOCK *)scan)->literals); status = "allocated"; break; case B_MARKED: - size += object_size(((F_CODE_BLOCK *)scan)->relocation); + reloc_size += object_size(((F_CODE_BLOCK *)scan)->relocation); + literal_size += object_size(((F_CODE_BLOCK *)scan)->literals); status = "marked"; break; default: @@ -343,7 +345,8 @@ void dump_code_heap(void) scan = next_block(&code_heap,scan); } - print_cell(size); print_string(" bytes of relocation data\n"); + print_cell(reloc_size); print_string(" bytes of relocation data\n"); + print_cell(literal_size); print_string(" bytes of literal data\n"); } void factorbug(void) diff --git a/vm/quotations.c b/vm/quotations.c index 86e47745b7..e18e6b6098 100755 --- a/vm/quotations.c +++ b/vm/quotations.c @@ -180,7 +180,8 @@ void jit_compile(CELL quot, bool relocate) GROWABLE_ARRAY(literals); REGISTER_ROOT(literals); - GROWABLE_ARRAY_ADD(literals,stack_traces_p() ? quot : F); + if(stack_traces_p()) + GROWABLE_ARRAY_ADD(literals,quot); bool stack_frame = jit_stack_frame_p(untag_object(array));