Commit Graph

113 Commits

Author SHA1 Message Date
Bung
a9bd78d579 fix #12122 (#21096) 2022-12-16 08:01:15 +01:00
ringabout
06cd15663d fixes ptr to cstring warnings[backport] (#20848)
* fix =#13790 ptr char (+friends) should not implicitly convert to cstring

* Apply suggestions from code review

* first round; compiles on windows

* nimPreviewSlimSystem

* conversion is unsafe, cast needed

* fixes more tests

* fixes asyncnet

* another try another error

* last one

* true

* one more

* why bugs didn't show at once

* add `nimPreviewCstringConversion` switch

* typo

* fixes ptr to cstring warnings[backport]

* add fixes

Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
2022-11-16 10:22:51 +01:00
ringabout
4a1bda667c turn nimIncrSeqV3 into deadcode (#20388) 2022-09-20 14:59:50 +02:00
flywind
8cde6ba6bc remove noop option gc:v2 (#19810)
* remove noop option gc:v2

* changelog
2022-06-10 20:32:27 +02:00
Timothee Cour
f561afae41 followup #17225: simplify code after removing gc2, generational (#17242) 2021-03-03 13:37:42 +01:00
Timothee Cour
0fc5d3f13b fix #14655 setLen(seq) now zeros memory (#14656)
* simplify sysstr.nim

* fix #14655
2020-06-14 11:11:26 +02:00
Arne Döring
4005f0d0e4 forward type alignment information to seqs (#12430) 2020-04-19 07:52:01 +02:00
Nindaleth
34dbc5699e fix several typos in documentation and comments (#12553) 2019-10-30 09:08:45 +01:00
Araq
c94647aeca styleCheck: make the compiler and large parts of the stdlib compatible with --styleCheck:error 2019-07-10 12:42:41 +02:00
Andreas Rumpf
8e5c1436ad fixes #10845 2019-03-15 17:51:52 +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
Ș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
696c0c48c7 fixes merge conflict 2018-08-19 15:14:03 +02:00
Araq
babd31360a fixes more nil string bugs 2018-08-08 18:22:48 +02:00
Araq
05121d84b3 fixes a long standing nil bug in substr 2018-08-08 12:05:29 +02:00
Araq
7ac6462cbd make at least bootstrapping work 2018-08-05 14:17:24 +02:00
Andreas Rumpf
c57e320c94 fixes 7833 (#8533)
* fixes #7833; still to-do: fix setLen
* make tests green again
* also fixes setLen and string concats; refs #7833
* change formating to avoid a compiler warning
* emit the write barrier also for addChar
* fixes yet another regression
* make setLengthStr compile for the old version
* make growobjcrash complete earlier
2018-08-05 11:42:38 +02:00
Araq
c9f2c16da1 make setLengthStr compile for the old version 2018-08-04 23:23:10 +02:00
Araq
25b4d26e22 fixes yet another regression 2018-08-04 18:50:44 +02:00
Araq
1c80619ac5 WIP: avoid using the old growObj in order to fix the newly introduced seq leaks 2018-08-03 18:30:45 +02:00
Yuriy Glukhov
dfe3f16022 Don't depend on string.h in codegen (#8299) 2018-07-13 17:41:59 +02:00
Andreas Rumpf
5b59852406 system.substr is not implemented with compilerProcs anymore 2018-07-11 16:39:16 +02:00
Andreas Rumpf
ce01472ff3 refactorings in preparations for the new runtime 2018-07-10 10:39:53 +02:00
Andreas Rumpf
b5a96d28c7 codgen refactoring: prepare for alternative string/seq implementations 2018-06-29 11:34:39 +02:00
Dmitry Atamanov
e206a8d952 Use new binarySearch everywhere (#7876) 2018-05-25 00:04:30 +03:00
Araq
7d78707e36 fixes #7766 2018-05-04 08:11:13 +02:00
Andreas Rumpf
f64f9e50cc correct comparisons for nil strings/seqs 2018-04-28 15:13:44 +02:00
Andreas Rumpf
65c08212db system.nim: minor code cleanup 2018-04-28 07:57:44 +02:00
Andreas Rumpf
7c538b26ad nil in string concats does not produce crashes anymore 2018-04-27 21:33:05 +02:00
Andreas Rumpf
ce36b8efd6 setLen doesn't crash on nil strings/seqs anymore 2018-04-27 11:07:40 +02:00
Andreas Rumpf
ef1b547f35 'add' on a nil sequence doesn't produce a crash anymore 2018-04-27 09:57:20 +02:00
Andreas Rumpf
b25044286b sysstr.nim: fix minor typos 2018-04-02 17:01:40 +02:00
Araq
15e044416f fixes #7291 2018-03-05 13:38:32 +01:00
Andreas Rumpf
0b52466bb8 bugfix: do not call memcmp for nil strings 2018-01-19 09:26:11 +01:00
cooldome
2aebb8ed7e Fix for isssue in parseBiggestFloat #7060 (#7061) 2018-01-11 01:57:20 +01:00
Mathias Stearn
6bd3a2826f cmp(x, y: string) now uses memcmp rather than strcmp (#6869) (#6968) 2017-12-24 15:23:17 +01:00
Brent Pedersen
e016c9253e optimize setLen (#6816)
inline the call to setLengthSeq and avoid decref for types if ntfNoRefs

closes #6721 and speeds setLen when newLen < len for non reference
types.
2017-12-07 14:25:39 -05:00
Arne Döring
a11be5f21f added when statement (#6759) 2017-11-17 10:53:15 +01:00
Araq
742f43e572 fixes #6609; 'if' expressions support multiple statements; minor breaking change 2017-11-05 01:26:04 +01:00
Andreas Rumpf
6a3288a60e more replacements for the deprecated '<' 2017-10-29 08:55:30 +01:00
Andreas Rumpf
dcfc2b0e5f sysstr: code formatting 2017-10-28 12:10:22 +02:00
Araq
7ee825a6e5 make the Windows build green again 2017-10-17 09:27:44 +02:00
Andreas Rumpf
3308d26581 breaking change: arrays of char do not convert to cstring; ptr to array of char does 2017-10-10 00:17:20 +02:00
Andreas Rumpf
0314075639 revert the 'wasMoved' logic until the write barrier has been adapted 2017-09-29 11:33:40 +02:00
Andreas Rumpf
fe99495a9b new string behaviour now available under nimShallowStrings 2017-09-22 10:15:30 +02:00
Andreas Rumpf
c383e4d35e preparations for string optimizations 2017-09-22 09:57:18 +02:00
Andreas Rumpf
e7bcadaf32 hotfix: fixes seq.add and str.add for edge cases 2017-09-16 10:56:28 +02:00
Araq
6b3af6a5d7 WIP: --gc:regions instead of --gc:stack 2017-08-13 02:51:00 +02:00
Araq
346ea6d171 system.nim: don't use deprecated symbols/constructs 2017-02-08 14:55:30 +01:00
Andreas Rumpf
9ca15ad369 string.add for floats and ints for more performance (JS not yet supported) 2016-11-21 13:53:55 +01:00