Commit Graph

59 Commits

Author SHA1 Message Date
Danil Yarantsev
f25454d5c6 Add a testcase for #14480. Fixes #14480 (#15037) 2020-07-22 09:52:38 +02:00
Andreas Rumpf
3a4e4cec4d cursor inference bugfix 2020-07-20 18:37:14 +02:00
Andreas Rumpf
d4984e069a arc: cursors for simple for loop variables (#15008)
* arc: cursors for simple for loop variables

* merged devel
2020-07-17 15:24:36 +02:00
Clyybber
1355b461aa Show that a variable is cursor in --expandArc (#15002) 2020-07-17 10:56:17 +02:00
Clyybber
282128ab66 Fix #14994 (#14996)
* Fix #14994

* Revert misplaced "optimization"

* Typo
2020-07-15 23:33:58 +02:00
Andreas Rumpf
c5358b0d4b An optimizer for ARC (#14962)
* WIP: an optimizer for ARC
* do not optimize away destructors in 'finally' if unstructured control flow is involved
* optimized the optimizer
* minor code cleanup
* first steps to .cursor inference
* cursor inference: big steps to a working solution
* baby steps
* better .cursor inference
* new feature: expandArc for easy inspection of the AST after ARC transformations
* added topt_cursor test
* adapt tests
* cleanups, make tests green
* optimize common traversal patterns
* moved test case
* fixes .cursor inference so that npeg compiles once again
* cursor inference: more bugfixes

Co-authored-by: Clyybber <darkmine956@gmail.com>
2020-07-15 23:00:06 +02:00
Clyybber
813dd1b670 repr_v2 improvements (#14992)
* Support proc in arc repr

* Typo

* Improve repr for strings and chars
2020-07-15 22:04:15 +02:00
Clyybber
08159733cd Fix #14985 (#14988) 2020-07-15 11:34:10 +02:00
Clyybber
2b0e336c97 injectdestructors fixes and refactor (#14964)
* injectdestructors fixes and refactor

* Tiny cleanup

* Refactor and expand testcase

* Closes #14902 by adding testcase

* Better naming

* Fix test failures

* Misc cleanup

* Add testcase for #14968

* Better approach; expand testcases

* Optimizations and fixes

* Add testcase

* typo

* Tiny cleanup
2020-07-14 14:15:39 +02:00
Clyybber
1850efbb6c Add testcase for #14383 (#14957) 2020-07-10 18:10:32 +02:00
Andreas Rumpf
06d776a582 fixes #14900, this time for real, maybe (#14934) 2020-07-08 14:47:14 +02:00
Araq
ecf8cbbbe0 fixes #14900 2020-07-08 10:48:12 +02:00
Araq
cdce245a23 fixes #14899 2020-07-08 10:48:12 +02:00
Andreas Rumpf
87f6a9592c fixes #14402 (#14908)
* fixes #14402

* added a test case
2020-07-08 08:21:55 +02:00
Clyybber
8480bef1c4 Add testcase for #14864 (#14928)
* Add testcase for #14864

* :D
2020-07-07 22:43:36 +02:00
Clyybber
ebd97884a0 Add testcase for #14472 (#14921) 2020-07-06 20:53:38 +02:00
Clyybber
af27e6bdea Fix #14396 (#14793)
* Correct Left-To-Right evaluation of proc args
* Fix CPP backend
* Add testcase
* closes #14396
* closes #14345
* Improve test and optimize
* Improve testcase and optimize literals
* Fix bug
* Expand testcase and use DFA to optimize
* Turn genParams into proc
* Turn withTmpIfNeeded into a proc
* Cleanup
* Fix crash
* Better analysis
* Cleanup
* Trailing newline..
* Fix build
* Tiny cleanup

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2020-07-04 17:45:07 +02:00
Andreas Rumpf
1854d29781 scoped memory management (#14790)
* fixes the regressions
* closes #13936
* scope based memory management implemented
* enabled tcontrolflow.nim test case
* final cleanups
2020-07-04 07:37:24 +02:00
Clyybber
52841dba09 Fix #14568 (#14583)
* Fix #14568
* Add testcase
* Fix bogus test
* Adapt other failing tests
* Declarations are always first writes
2020-06-07 23:32:41 +02:00
Andreas Rumpf
3105909f88 fixes #14495 [backport:1.2] (#14496) 2020-05-29 23:35:57 +02:00
Clyybber
7fe4c66f35 Small improvements for string and char repr with gc:arc (#14400)
* Small improvements for string and char repr with gc:arc

* Fix test
2020-05-20 12:54:04 +02:00
Clyybber
9f78f116b2 New "ping-pong" DFA (#14322)
* New ping-pong analysis

* Add testcase for #13456

* Remove debugging leftover

* Unquote "unstructured controlflow"

* Fix typo

* Fix exponential complexity in edge cases

* Add sanity testcase

* Fix
2020-05-15 19:24:43 +01:00
cooldome
5fb40af57e fix #14333 (#14336)
Co-authored-by: cooldome <ariabushenko@bk.ru>
2020-05-13 23:57:05 +02:00
Timothee Cour
1648f1dd99 fix #14320 (tasyncawait.nim is recently very flaky) + avoid hardcoding service ports everywhere + flakyAssert (#14327)
* hotfix #14320 tasyncawait.nim is recently very flaky
* fix #14327
* add flakyAssert
2020-05-13 11:05:47 +02:00
Timothee Cour
dddfbcf211 close #13071 by adding test: nim cpp -r --gc:arc` segfaults on caught AssertionError (#14323) 2020-05-12 19:19:31 +02:00
cooldome
2d7ccf0928 fix #14312 2020-05-12 10:23:05 +01:00
cooldome
a39123c93c fix #14219 (#14225)
Co-authored-by: cooldome <ariabushenko@bk.ru>
2020-05-11 23:11:20 +02:00
Clyybber
8e93105606 Fix #14269 (#14286) 2020-05-09 18:22:25 +02:00
Clyybber
120ea906fb Fix #14270 and add testcases (#14276) 2020-05-08 15:54:34 +02:00
cooldome
5fa7d374c4 fix #14243 (#14257)
* fix #14243

Co-authored-by: cooldome <ariabushenko@bk.ru>
2020-05-07 22:15:25 +02:00
Clyybber
42db75c970 Fix the DFA for "unstructured controlflow" (#14263)
* Fix the DFA for "unstructured controlflow"

* Add testcase from #14233
2020-05-07 21:41:55 +02:00
cooldome
0d8507cd3d fix #14236 (#14250)
Co-authored-by: cooldome <ariabushenko@bk.ru>
2020-05-07 00:13:59 +02:00
cooldome
6dba06f9e6 fixes #14244 (#14248)
Co-authored-by: cooldome <ariabushenko@bk.ru>
2020-05-06 20:43:18 +02:00
Andreas Rumpf
b6fb609e0d destructors: don't produce stupid code for 'cast' (#14208) [backport:1.2]
* destructors: don't produce stupid code for 'cast'

* fixes #14207
2020-05-04 07:43:22 +02:00
Andreas Rumpf
d9e907c0e2 fixes #14079 [backport:1.2] (#14163) 2020-04-29 21:58:59 +02:00
Jacek Sieka
7d6cbf290a Error -> Defect for defects (#13908)
* Error -> Defect for defects

The distinction between Error and Defect is subjective,
context-dependent and somewhat arbitrary, so when looking at an
exception, it's hard to guess what it is - this happens often when
looking at a `raises` list _without_ opening the corresponding
definition and digging through layers of inheritance.

With the help of a little consistency in naming, it's at least possible
to start disentangling the two error types and the standard lib can set
a good example here.
2020-04-28 19:56:01 +02:00
Andreas Rumpf
dedb04fa9e new implementations for --gc:orc (#14121)
* cycle collector: new implementation
* cycle collector: make self-adaptive based on its previous effectiveness
* cycle collector: added Lins's jump stack to improve traversal from 3*N to 2*N
* cycle collector: make tests green
* API extensions and bugfixes
* code cleanup and use --gc:orc for tasyncawait
2020-04-27 11:57:26 +02:00
Andreas Rumpf
269a458d74 cycle collector (#14071)
* figured out the wrong cycle trace proc problem
* cycle collector/break refactorings and minor improvements
2020-04-22 17:34:35 +02:00
cooldome
f10689d3d4 fixes #14003 (#14006) [backport:1.2]
Co-authored-by: cooldome <ariabushenko@bk.ru>
2020-04-17 13:23:04 +02:00
cooldome
d3b0132061 Step2: fixes #13781, fixes #13805 (#13897)
* Fix sym owner in wrapper proc
* threadpool changes
* revert lowerings
* add newFastMoveStmt
* try fixing test by switching to cpp

Co-authored-by: cooldome <ariabushenko@bk.ru>
2020-04-16 23:27:08 +02:00
cooldome
9295251e68 Implements RFCs #209 (#13995)
* add test
* add changelod entry
Co-authored-by: cooldome <ariabushenko@bk.ru>
2020-04-16 21:04:05 +02:00
cooldome
8ba915e449 error msg for #13864 (#13962)
Co-authored-by: cooldome <ariabushenko@bk.ru>
2020-04-13 14:17:22 +02:00
cooldome
c70b3952ff fixes #13810 (#13821)
Co-authored-by: cooldome <ariabushenko@bk.ru>
2020-03-31 21:15:06 +02:00
c-blake
b1aa3b1eea Unwind just the "pseudorandom probing" part of recent sets,tables changes (#13816)
* Unwind just the "pseudorandom probing" (whole hash-code-keyed variable
stride double hashing) part of recent sets & tables changes (which has
still been causing bugs over a month later (e.g., two days ago
https://github.com/nim-lang/Nim/issues/13794) as well as still having
several "figure this out" implementation question comments in them (see
just diffs of this PR).

This topic has been discussed in many places:
  https://github.com/nim-lang/Nim/issues/13393
  https://github.com/nim-lang/Nim/pull/13418
  https://github.com/nim-lang/Nim/pull/13440
  https://github.com/nim-lang/Nim/issues/13794

Alternative/non-mandatory stronger integer hashes (or vice-versa opt-in
identity hashes) are a better solution that is more general (no illusion
of one hard-coded sequence solving all problems) while retaining the
virtues of linear probing such as cache obliviousness and age-less tables
under delete-heavy workloads (still untested after a month of this change).

The only real solution for truly adversarial keys is a hash keyed off of
data unobservable to attackers.  That all fits better with a few families
of user-pluggable/define-switchable hashes which can be provided in a
separate PR more about `hashes.nim`.

This PR carefully preserves the better (but still hard coded!) probing
of the  `intsets` and other recent fixes like `move` annotations, hash
order invariant tests, `intsets.missingOrExcl` fixing, and the move of
`rightSize` into `hashcommon.nim`.

* Fix `data.len` -> `dataLen` problem.
2020-03-31 19:18:45 +02:00
Andreas Rumpf
35fb38629f cycle breaker (#13593)
* cycle breaking as an alternative to cycle detection
2020-03-19 22:58:16 +01:00
Andreas Rumpf
034dad8e32 fixes #13691 (#13694) 2020-03-19 12:57:45 +01:00
Andreas Rumpf
fb641483f0 arc optimizations (#13325)
* scope based destructors
* handle 'or' and 'and' expressions properly, see the new test arc/tcontrolflow.nim
* make this branch mergable, logic is disabled for now
2020-03-18 16:57:34 +01:00
Andreas Rumpf
3f29911a94 new feature: --staticBoundChecks:on to enforce static array index checking (#10965) 2020-03-18 14:25:10 +01:00
Andreas Rumpf
a87062393a fixes #13622 (#13679) 2020-03-18 13:42:33 +01:00
Araq
60f8fdcdab fixes #13240 2020-03-11 09:26:57 +01:00