Tue Dec 7 04:17:05 PST 2010 John Meacham <[email protected]> * pre-initialize GC caches to avoid check in allocator gaining a couple percent in speed.
New patches:
[pre-initialize GC caches to avoid check in allocator gaining a couple percent in speed. John Meacham <[email protected]>**20101207121705 Ignore-this: 1e00392ff635becfb744d56d0a363a7f ] hunk ./src/C/FromGrin2.hs 55 wRequires :: Requires, wStructures :: Map.Map Name Structure, wTags :: Set.Set Atom, - wAllocs :: Set.Set Atom, + wAllocs :: Set.Set (Atom,Int), wEnums :: Map.Map Name Int, wFunctions :: Map.Map Name Function } hunk ./src/C/FromGrin2.hs 150 text "", body ] - jgcs = [ text "static struct s_cache *" <> tshow (nodeCacheName m) <> char ';' | m <- Set.toList wAllocs] + jgcs | fopts FO.Jgc = [ text "static struct s_cache *" <> tshow (nodeCacheName m) <> char ';' | (m,_) <- Set.toList wAllocs] + | otherwise = empty nh_stuff = text "static const void * const nh_stuff[] = {" $$ fsep (punctuate (char ',') (cafnames ++ constnames ++ [text "NULL"])) $$ text "};" includes = map include (snub $ reqIncludes req) include fn = text "#include <" <> text fn <> text ">" hunk ./src/C/FromGrin2.hs 155 - (header,body) = generateC (Map.elems fm) (Map.elems sm) + (header,body) = generateC (function (name "jhc_hs_init") voidType [] [] icaches:Map.elems fm) (Map.elems sm) + icaches :: Statement + icaches | fopts FO.Jgc = mconcat [ toStatement $ functionCall (name "find_cache") [reference (toExpression $ nodeCacheName t),toExpression $ name "arena", tbsize (sizeof (structType $ nodeStructName t)), toExpression nptrs] | (t,nptrs) <- Set.toList wAllocs ] + | otherwise = mempty cafnames = [ text "&_" <> tshow (varName v) | (v,_) <- grinCafs grin ] constnames = map (\n -> text "&_c" <> tshow n) [ 1 .. length $ Grin.HashConst.toList finalHcHash] ((cafs',finalHcHash,Written { wRequires = req, wFunctions = fm, wEnums = wenum, wStructures = sm, wTags = ts, .. }),cpr) = runC grin $ go >> mapM convertCAF (grinCafs grin) hunk ./src/C/FromGrin2.hs 797 Nothing -> do st <- nodeType t as' <- mapM convertVal as - let wmalloc = jhc_malloc (reference (toExpression $ nodeCacheName t)) nptrs' + let wmalloc | fopts FO.Jgc = \_ -> functionCall (name "s_alloc") [toExpression $ name "gc", (toExpression $ nodeCacheName t)] + | otherwise = jhc_malloc (reference (toExpression $ nodeCacheName t)) nptrs' nptrs = length (filter (not . nonPtr . getType) as) + if sf then 1 else 0 nptrs' = if nptrs > 0 && not sf && t `Map.notMember` cpr then nptrs + 1 else nptrs malloc = wmalloc (sizeof st) hunk ./src/C/FromGrin2.hs 811 v <- newVar st return (mempty,reference v) False -> do - tell mempty { wAllocs = Set.singleton t } + tell mempty { wAllocs = Set.singleton (t,nptrs') } ty `newTmpVar` malloc let tmp' = concrete t tmp ass = [ if isValUnknown aa then mempty else project' i tmp' =* a | a <- as' | aa <- as | i <- map arg [(1 :: Int) ..] ] hunk ./src/C/FromGrin2.hs 914 ---------------------------- --gc_roots vs = functionCall (name "gc_begin_frame0") (constant (number (fromIntegral $ length vs)):vs) -gc_roots vs = functionCall (name "gc_frame0") (v_gc:constant (number (fromIntegral $ length vs)):vs) +--gc_roots vs = functionCall (name "gc_frame0") (v_gc:constant (number (fromIntegral $ length vs)):vs) +gc_roots vs = case length vs of +-- 1 -> functionCall (name "gc_frame1") (v_gc:vs) +-- 2 -> functionCall (name "gc_frame2") (v_gc:vs) + lvs -> functionCall (name "gc_frame0") (v_gc:constant (number (fromIntegral lvs)):vs) gc_end = functionCall (name "gc_end") [] tbsize sz = functionCall (name "TO_BLOCKS") [sz] jhc_malloc ntn nptrs sz | fopts FO.Jgc = functionCall (name "gc_alloc") [v_gc,ntn, tbsize sz, toExpression nptrs] hunk ./src/rts/jhc_jgc.c 14 = { gc, n, { __VA_ARGS__ } }; gc_t gc = (gc_t)(void *)&l; #else #define gc_frame0(gc,n,...) void *ptrs[n] = { __VA_ARGS__ }; for(int i = 0; i < n; i++) gc[i] = (sptr_t)ptrs[i]; gc_t sgc = gc; gc_t gc = sgc + n; +#define gc_frame1(gc,p1) gc[0] = (sptr_t)p1; gc_t sgc = gc; gc_t gc = sgc + 1; +#define gc_frame2(gc,p1,p2) gc[0] = (sptr_t)p1; gc[1] = (sptr_t)p2; gc_t sgc = gc; gc_t gc = sgc + 2; #endif static unsigned number_gcs; // number of garbage collections hunk ./src/rts/jhc_jgc.c 100 debugf("Setting Roots:"); stack_check(&stack, root_stack.ptr); - for(int i = 0; i < root_stack.ptr; i++) { + for(unsigned i = 0; i < root_stack.ptr; i++) { gc_add_grey(&stack, root_stack.stack[i]); debugf(" %p", root_stack.stack[i]); } hunk ./src/rts/jhc_rts.c 57 static int hs_init_count; +static void jhc_hs_init(void); + void hs_init(int *argc, char **argv[]) { hunk ./src/rts/jhc_rts.c 73 assert(EOF == -1); jhc_alloc_init(); + jhc_hs_init(); hs_set_argv(*argc,*argv); #if JHC_isPosix if(!uname(&jhc_utsname)) { hunk ./src/rts/slub.c 214 memset(pg->used,0,BITARRAY_SIZE_IN_BYTES(num_entries) - sizeof(pg->used[0])); int excess = num_entries % BITS_PER_UNIT; pg->used[BITARRAY_SIZE(num_entries) - 1] = ~((1UL << excess) - 1); - if(JHC_VALGRIND) { +#if JHC_VALGRIND unsigned header = sizeof(struct s_block) + BITARRAY_SIZE_IN_BYTES(num_entries); VALGRIND_MAKE_MEM_NOACCESS((char *)pg + header, BLOCK_SIZE - header); hunk ./src/rts/slub.c 217 - } +#endif } static void * Context: [don't increment allocation count when we arn't using it for status updates. John Meacham <[email protected]>**20101207050322 Ignore-this: f5209ab8f28a19f301d0dc9a7d1539ec ] [remove quadratic behavior in programSetDs' John Meacham <[email protected]>**20101207033358 Ignore-this: d0a52945b310e2a599cc54510c18ea5b ] [fix bug where the static argument transformation would clear rules. clean up a lot of code. John Meacham <[email protected]>**20101207031557 Ignore-this: a78a8819ac6728d331b9a01e9a665152 ] [clean ups and remove unused module, make selftest work with the new ghc John Meacham <[email protected]>**20101206122555 Ignore-this: 5b56d3dcd7186aeab6e3b42c57db0f99 ] [fix type checker bug that occasionally reported false erros John Meacham <[email protected]>**20101206120451 Ignore-this: a34be6e294bde1e95ad7a9ca35b42055 ] [fix pretty printing fixity of core to reduce ambiguity John Meacham <[email protected]>**20101204231805 Ignore-this: 8adc87b15e09134f673da1b438adc5a2 ] [Fix a lot of compiler warnings, clean up dependencies. John Meacham <[email protected]>**20101204035931 Ignore-this: 7524be06d3ca6cd957316e50451b7208 ] [show text of exception when dumping core. John Meacham <[email protected]>**20100826091509 Ignore-this: 859d57d2a6184698e97f0083482b3039 ] [remove ePrettyEx John Meacham <[email protected]>**20100812102458 Ignore-this: 5ff9ed89d829f656c11012d75bab6f16 ] [clean up warnings John Meacham <[email protected]>**20100812102435 Ignore-this: 582526a443397ee875d3530d892b704d ] [clean up E showing, get rid of -dhtml mode, get rid of ANSI color coding, dump jhc_core to files on error John Meacham <[email protected]>**20100812101452 Ignore-this: ef81f8c50892ecfdda3b5a450d8fbac0 ] [when let-shrinking a tail, be sure to optimize function bodies John Meacham <[email protected]>**20100812054500 Ignore-this: eb1b56f28287a98b67bcd9c29d50ba82 ] [improve Grin Linting a little John Meacham <[email protected]>**20100812054446 Ignore-this: c7613a94c296e089a985904aa049d002 ] [add imported ghc typechecking regression tests John Meacham <[email protected]>**20100811014451 Ignore-this: 7f625abf2f8d562bc76b71396a7e03f0 ] [import ghc parsing regression tests John Meacham <[email protected]>**20100811002607 Ignore-this: 7a3676c7655fe26c52dd7eddd3c356dc ] [add 'skip' to regression options to skip certain tests John Meacham <[email protected]>**20100811002445 Ignore-this: 261b5e51fa22d7af25989ee078853590 ] [allow unicode characters in haskell source John Meacham <[email protected]>**20100810233304 Ignore-this: dd54c632455bd0660ff7b5170d81c8ed ] [add regex-compat to dependencies John Meacham <[email protected]>**20100810230216 Ignore-this: e7c03b8e187802ab75dbcc574614eabc ] [accept empty class contexts John Meacham <[email protected]>**20100810063832 Ignore-this: 9dea1ec61b874fcb3537b79b74b345df ] [add 'transformers' package to included libraries John Meacham <[email protected]>**20100810054906 Ignore-this: e27f376331b3fac2e3414145bf17a1c0 ] [fix desugaring of irrefutable lambda bindings John Meacham <[email protected]>**20100810053944 Ignore-this: 5c70934cbe42169850481562cd5b20f3 ] [add some strictness annotations John Meacham <[email protected]>**20100810053827 Ignore-this: 15ed2e2fc90656cc418a841848e43107 ] [clean ups John Meacham <[email protected]>**20100806112820 Ignore-this: 64c0ae0922073b65fc0dac4bd35ba968 ] [speed up name choosing a little John Meacham <[email protected]>**20100806111703 Ignore-this: ac159eeb0d34a7d26ad74253d00386ae ] [further seperate out concrete types to speed up checking John Meacham <[email protected]>**20100806092815 Ignore-this: f992ced583042d3c7797d4de93e3e3a8 ] [split type environment into concrete and mutable sets, to avoid retraversing the concrete imported types John Meacham <[email protected]>**20100806090349 Ignore-this: c276618b4b968d9149e6b3dfc36d162a ] [create a better relation representation, speed up export chasing signifigantly John Meacham <[email protected]>**20100806082622 Ignore-this: 9f49871e33348bbfc4e8fd2ee9fa71b8 ] [fix a few minor bugs in libraries found by better error reporting John Meacham <[email protected]>**20100806045809 Ignore-this: e7d43927c9e11b05de455a5d0ebd1017 ] [check export lists for unknown names John Meacham <[email protected]>**20100806045759 Ignore-this: 4b3ff8381117f2acae34dd6b936c8e8d ] [ret rid of seperate subtable and errortable in favor of unified namemap John Meacham <[email protected]>**20100806032455 Ignore-this: 9e8fbd31f988d77614bd49fc23cefae ] [treat () the same as tuples when renaming John Meacham <[email protected]>**20100806023948 Ignore-this: defa66a11f1081a4582a5301cff217e4 ] [move selector creation from desugar to renamer, detect multiply defined top level values and report an error properly. John Meacham <[email protected]>**20100806021241 Ignore-this: 507bce69ec8ffe0085c3a72ffc0ec571 ] [add initial version of jhc-prim John Meacham <[email protected]>**20100806000900 Ignore-this: 44a9f14db168b28d731fd750bba0fee9 ] [clean up preprocessing a little John Meacham <[email protected]>**20100803073754 Ignore-this: c1064468bed864231c2d5fb3a68bbeaf ] [utilize preprocessor rather than ./configure to handle System.Info John Meacham <[email protected]>**20100802100036 Ignore-this: 76681affa5b0269621974deeccda019b ] [fix some warnings John Meacham <[email protected]>**20100801083507 Ignore-this: fd350fd02d0ad5a611ee1811de28bce5 ] [fix build problem for tarball John Meacham <[email protected]>**20100801082137 Ignore-this: 33671b52398eef61afa670eb031ef575 ] [update strictness and UNPACK annotations John Meacham <[email protected]>**20100801080035 Ignore-this: e598a6098143c1a62373a443865b3cfb ] [add announcement for 0.7.6 John Meacham <[email protected]>**20100731111353 Ignore-this: 111c27548d94bdfe0042d61b02fe5728 ] [TAG 0.7.6 John Meacham <[email protected]>**20100731104908 Ignore-this: d5edc6edd6d300cbae451f0e056ee018 ] Patch bundle hash: 9ddefbf2388995fd21f1fde5531107d1080d9714
_______________________________________________ jhc mailing list [email protected] http://www.haskell.org/mailman/listinfo/jhc
