Commit Graph

108 Commits

Author SHA1 Message Date
Timothee Cour
f561afae41 followup #17225: simplify code after removing gc2, generational (#17242) 2021-03-03 13:37:42 +01:00
Andreas Rumpf
edce5897a5 fixes #16214 [backport] (#16252) 2020-12-04 17:47:41 +01:00
Andreas Rumpf
e31ac81899 more checking for --gc:arc, no need for valgrind (#14467)
* sigmatch: removed dead code
2020-05-29 12:08:17 +02:00
Araq
8a339d1178 fixes #13862 2020-05-13 23:56:40 +02:00
Arne Döring
4005f0d0e4 forward type alignment information to seqs (#12430) 2020-04-19 07:52:01 +02:00
Andreas Rumpf
a6682de004 catchable defects (#13626)
* allow defects to be caught even for --exceptions:goto (WIP)
* implemented the new --panics:on|off switch; refs https://github.com/nim-lang/RFCs/issues/180
* new implementation for integer overflow checking
* produce a warning if a user-defined exception type inherits from Exception directly
* applied Timothee's suggestions; improved the documentation and replace the term 'checked runtime check' by 'panic'
* fixes #13627
* don't inherit from Exception directly
2020-03-12 23:44:33 +01:00
Ico Doornekamp
4f3dd33509 Cleaned up mmdisp.nim, moved implementations into lib/system/mm/ (#13254) 2020-01-25 17:14:31 +01:00
Ico Doornekamp
b68eb1cad0 Removed lib/system/allocators.nim. seqs_v2 and strs_v2 now uses allocShared0. (#13190)
* Cleanup, remove lib/system/allocators.nim. seqs_v2 and strs_v2 now use
allocShared0 by default.

* Fixed -d:useMalloc allocShared / reallocShared / deallocShared. These now use the alloc/dealloc/realloc implementation that also takes care of zeroing memory at realloc.

* Removed debug printfs

* Removed unpairedEnvAllocs() from tests/destructor/tnewruntime_misc

* More mmdisp cleanups. The shared allocators do not need to zero memory or throw since the regular ones already do that

* Introduced realloc0 and reallocShared0, these procs are now used by
strs_v2 and seqs_v2. This also allowed the -d:useMalloc allocator to
drop the extra header with allocation length.

* Moved strs_v2/seqs_v2 'allocated' flag into 'cap' field

* Added 'getAllocStats()' to get low level alloc/dealloc counters. Enable with -d:allocStats

* *allocShared implementations for boehm and go allocators now depend on the proper *allocImpl procs
2020-01-23 14:25:22 +01:00
Ico Doornekamp
79a326759a Added 'ansic' os support for minimal (embedded) targets (#13088)
* os:any implementation
* os:asny: omit flock/funlock calls in echoBinSafe
* Disabled default "unhandled expection" reporting for `--os:any` to reduce
code size. Added unhandledExceptionHook instead which can be used to get
a notification from Nim and handle it from the application.
2020-01-15 11:06:41 +01:00
Andreas Rumpf
852170cc78 take the one good idea from --os:standalone and enable it via -d:StandaloneHeapSize (#13077) 2020-01-09 11:48:37 +01:00
Andreas Rumpf
83a736a34a ARC: cycle detector (#12823)
* first implementation of the =trace and =dispose hooks for the cycle collector
* a cycle collector for ARC: progress
* manual: the .acyclic pragma is a thing once again
* gcbench: adaptations for --gc:arc
* enable valgrind tests for the strutils tests
* testament: better valgrind support
* ARC refactoring: growable jumpstacks
* ARC cycle detector: non-recursive algorithm
* moved and renamed core/ files back to system/
* refactoring: --gc:arc vs --gc:orc since 'orc' is even more experimental and we want to ship --gc:arc soonish
2019-12-17 17:37:50 +01:00
Andreas Rumpf
1746da2d9e --gc:destructors now means Nim uses pure refcounting (#12557) 2019-10-30 16:15:17 +01:00
Araq
0eae2217b6 first implementation of the new --seqsv2 switch 2019-10-20 08:11:07 +02:00
genotrance
9e62876647 Fixes #12286 - require explicit disabling of boehm interior pointer checking (#12406) [backport] 2019-10-11 07:39:18 +02:00
Federico Ceratto
39290cf88c Fix spellings (#12277) [backport] 2019-09-27 07:02:54 +02:00
Andreas Rumpf
62aa1a3cfe gc:destructors progress 2019-09-16 23:54:31 +02:00
Andreas Rumpf
e0f3e8432a fixes a critical --gc:boehm regression 2019-09-06 18:06:08 +02:00
Andreas Rumpf
d2684cdfd2 fixes #11447 2019-07-06 21:20:16 +02:00
yatsen1
c8268330be [feature] Add boehm gc finalizer (#11446) 2019-06-17 20:47:18 +02:00
Andreas Rumpf
e263702688 --newruntime: progress 2019-03-14 19:53:27 +01:00
Andreas Rumpf
2ab6b2c657 --newruntime: work in progress 2019-03-14 07:59:44 +01:00
Andreas Rumpf
0036014727 system refactorings (#10559)
* move IO subsystem into its own module; refs #10385
* make standalone test compile again
* make C++ examples compile again
* make more tests green
* make sysAssert and gcAssert work again
2019-02-06 21:00:00 +01:00
Reimer Behrends
06e3d3ab4d Disable interior pointer checking by default for the Boehm GC. (#10316)
The Boehm GC only needs interior pointer checking if pointers in global
variables or on the heap point to the interior of an object rather than
the beginning. If this does not happen, then checking for interior
pointers causes additional overhead, in particular because any objects
whose sizes are an exact multiple of two words gain another two words of
padding, wasting memory.

If checking of interior pointers is still desired, this can be achieved
by setting the environment variable GC_ALL_INTERIOR_POINTERS.

Pointers on the stack will always be treated as potential interior
pointers, as compiler optimizations may advance the only live reference
to a point past the beginning of an object.
2019-01-15 19:00:02 +01:00
Jacek Sieka
87568830ab Remove dead code (#9777)
* gc/gc2: remove unused ref counting stuff
* also removes some false threading support - hasSharedHeap is always
false in gc/gc2
* gc: remove some threading cruft
* remove asgnRefNoCycle
* compiler: remove TLoc.dup (unused)
2018-11-26 09:47:39 +01:00
Araq
3f6168b337 removes deprecated T/P types 2018-11-16 13:27:56 +01:00
Ștefan Talpalaru
10f5f67767 gogc: GCC-8.2.0 compatibility and other improvements (#9211)
- Go's write barriers are now plugged-in in all the relevant points
- "gcGo" is correctly classified by usesWriteBarrier()
- some gogc structures and functions now use golib wrappers to keep GCC
  version-specific conditions out of the compiler/stdlib code
- we no longer allow mixing the C malloc with Go's
- fix a problem with string copying
2018-10-11 22:15:17 +02:00
Andreas Rumpf
74bf316619 more progress on destructor based strings 2018-07-13 21:15:47 +02:00
Andreas Rumpf
16d8fab310 mmdisp: code cleanups 2018-07-11 16:38:13 +02:00
Charles Blake
ed4f1f4c43 hotfix 3221ac0943 broke gc:regions/aka gc:stack by
underallocating for sequences of any type larger than 1 byte.  This does the
necessary multiply to restore basic functionality.
2018-06-13 10:36:47 -04:00
Yuriy Glukhov
395b7506cf Expose GC_setStackBottom (#7885) 2018-06-04 11:12:18 +02:00
Andreas Rumpf
3221ac0943 hotfix for --gc:regions 2018-05-28 11:24:29 +02:00
Mathias Stearn
9f943dbc8e Don't zeroMem result of boehmAlloc() (#7029)
From the man page: "Unlike the standard implementations of malloc, GC_malloc
clears the newly allocated storage. GC_malloc_atomic does not."
2018-01-05 08:58:42 +01:00
Araq
226532f8f3 cleanup todo.txt 2017-12-07 15:58:46 +01:00
Araq
d27c0b2192 make asyncdispatch compile with the foreign GCs 2017-12-01 11:20:50 +01:00
Ștefan Talpalaru
908677a313 remove goFree() (#6808)
__go_free() was removed from gcc-7.2.0 so we stop trying to help the
garbage collector by marking no longer used memory regions
2017-11-25 16:08:27 +01:00
Andreas Rumpf
e5cb1a2dd5 newSeqOfCap: skip initialization step for non-GC-ed data 2017-09-24 01:22:48 +02:00
Jacek Sieka
22684370b0 remove ArrayDummySize with unchecked arrays (#5818) 2017-08-28 15:44:35 +02:00
Araq
6b3af6a5d7 WIP: --gc:regions instead of --gc:stack 2017-08-13 02:51:00 +02:00
Andreas Rumpf
88b65ea957 fixes #6234 2017-08-11 20:14:44 +02:00
Ștefan Talpalaru
0c8c878f5a support libgo from GCC 6.3 (#5964) 2017-06-08 09:53:35 +02:00
Yuriy Glukhov
2ad8e073d8 Control leakDetector from cmdline 2016-12-06 11:54:47 +02:00
cheatfate
f0ea9447ce Add define value nimBurnFree which allow deallocation procedures to fill memory with 0xFF before freeing it. 2016-09-20 17:34:36 +03:00
Andreas Rumpf
b7c1be03c8 added system.newSeqOfCap for improved efficiency 2016-07-15 17:04:14 +02:00
Jacek Sieka
64b0485207 fix types of ansi_c/sysio to more closely match C ABI
also fixes some instances of using C library functions when there are
nim alternatives available
2016-06-05 12:03:20 +08:00
Jacek Sieka
ba1a52614b Merge remote-tracking branch 'origin/devel' into malloc-store-size 2016-04-26 21:25:57 +08:00
Andreas Rumpf
79f64d2469 simple stuff works with --gc:stack 2016-04-18 11:40:06 +02:00
Andreas Rumpf
e2c8d9ade0 beginnings of --gc:stack 2016-03-28 02:26:38 +02:00
Jacek Sieka
25f9330928 store block size in when using malloc and nogc
this allows for a correct implementation of realloc, which is needed as
code using it assumes new values will be zeroed out / nil
2016-03-25 20:54:01 +08:00
Jacek Sieka
9928b9f48d newObj can clear memory, even when using malloc and nogc 2016-03-07 22:38:22 +08:00
Andreas Rumpf
8ec5c01cae further progress on --gc:v2 2016-02-17 14:52:02 +01:00