Commit Graph

71 Commits

Author SHA1 Message Date
Andreas Rumpf
71b7383f12 fixes #11479 (#11641) 2019-07-03 07:22:30 +02:00
Arne Döring
6f7f043c9b Fix type recursion check (#11144)
* fixes #3456
* add test #3456
2019-05-07 08:29:17 +02:00
Arne Döring
a432aedb54 Generic tuple recursion fix (#11115)
* fixes #1145
* unify error messages
2019-04-28 10:11:41 +02:00
Arne Döring
65ee80e50c Pure ref object; fixes #10721 (#10955) 2019-04-04 09:06:12 +02:00
cooldome
dc2986789b fixes #10942. Lent T bug (#10946)
* fixes #10942

* add test

* bug build
2019-04-03 15:55:53 +02:00
Arne Döring
97c3b113a5 Size ptr tuple (#10846)
* fixes #10117
* Add support for recursive tuples
* detect in generics
2019-03-18 11:37:09 +01:00
zah
ca4b971bc8 Initial version of the hot-code reloading support for native targets (#10729)
* squashed work by Zahary

* squashing a ton of useful history... otherwise rebasing on top of upstream Nim after commit 82c009a2cb would be impossible.

* Code review changes; Working test suite (without code reloading enabled)

* - documentation
- implemented the HCR test - almost works...
- fix the issue on Unix where for executable targets the source file for the main module of a project in nimcache was being overwritten with the binary itself (and thus the actual source code was lost)
- fixing embedded paths to shared objects on unix (the "lib" prefix was being prepended to the entire path instead of just the filename)
- other fixes
- removing unnecessary includes since that file is already included in chcks.nim which is in turn included in system.nim (and previously was getting imported in chcks.nim but then system.nim improts something... and that breaks HCR (perhaps it could be fixed but it would be nice not to import anything in system))

* fix for clang & C++ - explicitly casting a function pointer to void*
more stable mangling of parameter names when HCR is on
the length of the static arrays in the DatInit functions is now part of the name of the variables, so when they get resized they get also recreated
more stable mangling for inline functions - no longer depends on the module which first used them
work on the new complicated HCR test - turned surprisingly complex - WIP
test now successfully passes even when re-running `koch test` (previously when the nimcache wasn't cold that lead to errors)
better documentation
calling setStackBottomWith for PreMain
passes over the HcrInit/DatInit/Init calls of all modules are now in the proper order (first all of one type, then all of the next). Also typeinfo globals are registered (created) in a single pass before the DatInit pass (because of the way generic instantiations are handled)
Fix the test suite execution on macOs
fix for being able to query the program arguments when using HCR on posix!
other fixes

* Bugfix: Fix a compilation error in C++ mode when a function pointer
is converted to a raw pointer

* basic documentation for the new hot code reloading semantics

* Add change log entry

* Don't re-execute the top-level statements while reloading JS code

* fix a number of tests broken in a recent bugfix

* Review changes

* Added {.executeOnReload.} pragma that indicates top-level statements
  that should be executed on each reload. To make this work, I've modified
  the way the `if (hcr_init_) {...}` guards are produced in the init code.
  This still needs more work as the new guards seem to be inserted within
  the previously generated guards.

  This change also removes the need for `lastRegistedGlobal` in nimhcr.

* Implemented the `signatureHash` magic and the `hasModuleChanged` API
  depending on it (the actual logic is not imlemented yet).

* Add the "hcr" prefix to all HCR-related symbols in the system module.
  Added a new `hotcodereloading` module exporting the high-level API to
  the user.

  Besides being more hygienic, this was also required in order to make
  it possible to use macros in the high-level API. Without the split,
  `system` would have to import `macros`, which was going to produce
  the well-known init problems.

* Attempted to solve the "GC markers problem".

  Crashes were expected with the previous code, because the GC markers
  were compiled as normal procs are registered in the GC. When their
  module is unloaded, dangling pointers will remain in the GC tables.
  To solve this issue, I don't register any GC markers when HCR is on,
  but I add them to the HCR globals metadata and I use a single marker
  registed in nimhcr during the initialization of the system module that
  will be responsible for marking all globals.

* fix a compilation error

* - implemented the hasModuleChanged functionality
- tuples can be returned and broken into different vars in global scope
- added comments for the closnig scopes of the if statements in the init proc
- the new executeOnReload pragma works now!
- other fixes

* finally! fixing this hack in a proper way - declaring the destructor out of line (out of the class body) - we no longer need to forward-declare popCurrentExceptionEx

* Force full module parsing

This is a temporary hack that breaks some tests. I'll investigate
later how these can be fixed.

* tuples are now properly handled when global!

* these comments mess up the codegen in debug mode when $n is not actually a new line (or something like that) - these labels are intended only for GOTO labels anyway...

* "solved" the issue with the .pdb locks on windows when a binary is being debugged and hot code reloading is used at the same time

* fixes after rebasing...

* small fixes for the test

* better handling of globals! no more compiler crashes for locals with the global pragma, also simplified code around loops in global scope which have local vars (actually globals)

* we can now use the global pragma even for ... globals!

* the right output

* lets try those boehm GC tests

* after the test is ran it will be at its starting state - no git modifications

* clarification in the docs

* removed unnecessary line directives for forward declarations of functions - they were causing trouble with hot code reloading when no semantic change propagates to the main module but a line directive got changed and thus the main module had to be recompiled since the .c code had changed

* fixed bug! was inserting duplicate keys into the table and later was removing only 1 copy of all the duplicates (after a few reloads)

* no longer breaking into DatInit code when not supposed to

* fixes after rebasing

* yet more fixes after rebasing

* Update jssys.nim

* Rework the HCR path-handling logic

After reviewing the code more carefully, I've noticed that the old logic
will be broken when the user overrides the '--out:f' compiler option.

Besides fixing this issues, I took the opportunity to implement the
missing '--outdir:d' option.

Other changes:

* ./koch test won't overwrite any HCR and RTL builds located in nim/lib
* HCR and RTL are compiled with --threads:on by default

* Clean up the globals registration logic

* Handle non-flattened top-level stmtlists in JS as well

* The HCR is not supported with the Boehm GC yet

Also fixes some typos and the expected output of the HCR integration test

* The GC marker procs are now properly used as trampolines

* Fix the HCR integration test in release builds

* Fix ./koch tools

* this forward declaration doesn't seem to be necessary, and in fact breaks HCR because a 2nd function pointer is emitted for this externed/rtl func

* the forward declaration I removed in the last commit was actually necessary

* Attempt to make all tests green

* Fix tgenscript

* BAT file for running the HCR integration test on Windows [skip ci]

* Fix the docgen tests

* A final fix for Travis (hopefully)
2019-02-26 15:48:55 +01:00
Miran
e7878c0d08 add tests for recently closed issues (#10722) 2019-02-23 10:41:35 +01:00
Arne Döring
28394153ab 32 bit fixes (#10608) 2019-02-13 23:30:14 +01:00
Miran
0ebfcd4c0f Remove deprecated modules (asyncio, sockets, ftpclient) (#10401) 2019-01-22 16:06:44 +01:00
Andreas Rumpf
ac785b0623 testament: joinable is now an explicit concept of a test spec 2018-12-11 21:23:24 +01:00
Arne Döring
a5ecbf823f lots of small changes 2018-12-11 21:23:22 +01:00
Arne Döring
2a4c09ff88 megatest can be executed 2018-12-11 21:23:21 +01:00
Arne Döring
1105d03644 require errormsg to be specified before file. 2018-12-11 21:23:21 +01:00
cooldome
ea5fc9f204 fixes #9794: sizeof tuple is incorrect if contains imported object (#9795)
* fixes #9794

* Fix linux test
2018-11-26 09:46:19 +01:00
Araq
562d185cb7 cleanup tests; don't use non-working 'msg' spec field 2018-11-23 13:16:45 +01:00
Arne Döring
031bfdec6f make run the default action of a test in tester 2018-11-23 11:58:28 +01:00
Ian
5ddeead29c #9348 Merge some small test files (#9561)
* Consolidated types issue tests
* Consolidated vm issue tests
2018-10-30 06:30:39 +01:00
jcosborn
3b1ade0350 added test for #4674 (#9438) 2018-10-19 11:18:13 +02:00
Miran
749dbce4c6 Merge tests into a larger file (part 5 of ∞) (#9368)
* merge magics

* merge metatype tests

* merge method tests

* merge objects tests

* change `import future` to `import sugar`

Nim in Action tests are left with `import future`, to ensure compatibility.

* merge overload tests

* merge proc tests

* merge procvar tests

* merge range tests

* merge seq tests

* merge sets tests

* remove wrong assert from `tsets3`

* fix `jsTests`

* better fix
2018-10-16 10:50:10 +02:00
LemonBoy
4808ef72db [WIP] Early evaluation of mIs (#8723)
* Early evaluation of mIs

The `evalIs` implementation was just a broken copy of `isOpImpl` so
let's just avoid it alltogether: `mIs` nodes are either resolved during
the semantic phase or bust.

* Remove dead code and tidy it up
2018-10-14 08:53:41 +02:00
Timothee Cour
745f1642d6 implement sizeof and alignof operator (manually squashed #5664) (#9356) 2018-10-14 00:52:28 +02:00
Andreas Rumpf
9364369c1f make tests green again 2018-09-24 16:00:57 +02:00
Ganesh Viswanathan
9b2115558b Test cases for #6969 #7346 #7581 2018-09-12 12:00:01 -05:00
Araq
420ed0596b fixes more nil handling regressions 2018-08-13 17:27:44 +02:00
LemonBoy
7f148838a4 Reject ptr/ref void types (#8127)
Do this during the semantic pass to avoid tripping the following passes.

Fixes #6454
2018-06-27 21:41:40 +02:00
Andreas Rumpf
2a3a128e36 Merge branch 'devel' into typedesc-reforms 2018-06-26 18:33:51 +02:00
LemonBoy
e39baf46fc Don't blow up with recursive objects 2018-06-22 19:47:44 +02:00
LemonBoy
af66258dca Discriminate gensym'd type names in sigHash
The root cause of #7905 lies in the codegen phase. The two template
instantiations generate two different MyType types with different
members but same t.sym.name leading the caching mechanism to confuse
the two.

Fixes #7905
2018-06-22 13:09:33 +02:00
Zahary Karadjov
a49b06a52a Implement the is operator for the new static and typedesc type classes
This also makes the first baby steps towards a sound treatment of
higher-order kinds (type type int).

Adds test cases showcasing the new features.

* Also fixes breakage after the rebase
2018-06-16 16:46:32 +03:00
Araq
02b78d3f94 make tests green again 2018-05-14 21:38:18 +02:00
Fabian Keller
6df6ec27ec Improved collection-to-string behavior (#6825) 2017-12-14 14:02:13 +01:00
andri lim
b174e9f42a fixes #5521 object variants superclass trigger bad codegen (#6120) 2017-11-19 13:12:26 +01:00
Andreas Rumpf
a9ac241691 fixes #6073 2017-11-18 22:13:46 +01:00
Andreas Rumpf
6cb8bf8045 fixes bug reported in PR #5637 2017-10-30 09:19:02 +01:00
andri lim
57edf619fe fixes #6016 union alias trigger bad codegen (#6117)
* fixes #6016 union alias trigger bad codegen
* cpp test ok
* merging some test into one file
2017-08-03 11:03:47 +02:00
Arne Döring
000b8afd26 Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
Fabian Keller
62ffac25dc added test case for #1252 2017-06-20 11:53:32 +02:00
Zahary Karadjov
268b918150 Fix thardforward 2017-06-20 11:29:42 +02:00
Araq
c8cec27c0a file mode change 2017-05-17 22:13:47 +02:00
Zahary Karadjov
fceef77301 test case for #5640 2017-04-07 21:57:04 +03:00
Zahary Karadjov
0b7321651e fix #5658 2017-04-07 21:53:27 +03:00
Zahary Karadjov
eb635d9ccf fix #5648 2017-04-07 17:03:49 +03:00
andri lim
70237e1fdd fix taliasinequality test case (#5587) 2017-03-22 08:40:15 +01:00
andri lim
e99721a593 fixes #5360, fixes #5238 (#5539); fixes type alias inequality for types coming from templates/macros 2017-03-16 08:04:36 +01:00
andri lim
ebb15505dd fixes #5231 inheriting from partial specialized generic object (#5538) 2017-03-15 07:59:34 +01:00
andri lim
0ff1190fe7 fixes #5264 (#5520); inheriting from generic object 2017-03-14 21:40:09 +01:00
Matthew Baulch
d05e146b30 Recursively check literals for tyEmpty. 2016-07-11 19:12:05 +10:00
Andreas Rumpf
c870e831c8 fixes #4124 2016-04-29 20:56:30 +02:00
def
c50b5b62ef Fix a few deprecation warnings 2016-01-25 19:10:37 +01:00