| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Previously, in certain cases, the compiler would generate debug info for
the correct line number, but for the wrong .nim source file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#23388)
…instantiations (C/C++ backend)
AFAIK, #22802 expanded `noinit`'s utility by allowing the pragma to be
attached to types (thanks @jmgomez !).
I suggest broadening the scope a bit further: try to avoid `nimZeroMem`s
on a type level beyond imported C/C++ types[^1], saving us from
annotating the type instantiations with `noinit`.
If this change is deemed acceptable, I will also adjust the docs, of
course.
Adding tests for this change seems a bit problematic, as the effect of
this type annotation will be to work with uninitialized memory, which
*might* match 0 patterns.
[^1]: "complex value types" as already defined here:
https://github.com/nim-lang/Nim/blob/94c599687796f4ee3872c8aa866827b9ed33f52b/compiler/cgen.nim#L470-L471
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the function name extension encoded by paths could be useful for
debugging where the function is from
Before:
```js
function newSeq_33556909(len_33556911)
```
After:
```js
function newSeq__system_u2477(len_p0)
```
|
| |
|
|
|
|
|
|
|
|
|
| |
static/dynlib libraries (#23357)
fixes #20945
fixes #18262
todo
- [ ] perhaps export with lib prefix when the option is enabled
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is just one of those tiny steps towards the goal of an "optimized"
C and C++ codegen I raised elsewhere before - what does me babbling
"optimized" mainly entail?
(not mutually-exclusive ascertainment proposals following:)
- less and simplified resulting code: easier to pick up/grasp for the
C/C++ compiler for to do its own optimization heuristics, less parsing
effort for us mere humans trying to debug, especially in the case of
interop
- build time reduction: less code emission I/O, runtime string
formatting for output...
- easier access for fresh contributors and better maintainability
- interop improvements
- further runtime optimizations
I am eagerly looking forward to the results of the LLVM-based
undertakings, but I also think we can do a bit better (as outlined
above) with our current C/C++ backends till those come to fruition.
**Long story short**: this PR here focuses on the C++ backend,
augmenting the current codegen method of establishing "temporary"
variables by using C++11's auto type deduction. The reasons for adopting
an "Almost Always Auto" style have been collected [here
](https://herbsutter.com/2013/08/12/gotw-94-solution-aaa-style-almost-always-auto/)
for the C++ world. For those hopping between C++'s and Nim's realms,
this change also results in a bit less code and less work for the
codegen part (no redundant `getTypeDesc`s): no need to tell the C++
compiler the type it already knows of (in most cases).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
which corrupts the compiler (#23271)
fixes #22909
required by https://github.com/nim-lang/Nim/pull/23267
```nim
proc foo: string =
assert false
result = ""
```
In the function `foo`, `assert false` raises an exception, which can
cause `result` to be uninitialized if the default result initialization
is optimized out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fixes #22597
```nim
proc autoToOpenArray*[T](s: Slice[T]): openArray[T] =
echo "here twice"
result = toOpenArray(s.p, s.first, s.last)
```
For functions returning openarray types, `fixupCall` creates a temporary
variable to store the return value: `let tmp = autoToOpenArray()`. But
`genOpenArrayConv` cannot handle openarray assignements with side
effects. It should have stored the right part of the assignment first
instead of calling the right part twice.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
(#23004)
follow up https://github.com/nim-lang/Nim/pull/22991
- [x] turning it into an experimental feature
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
new strictions on methods (#22991)
**TODO**
- [x] fixes changelog
With the new option `nimPreviewVtables`, `methods` are confined in the
same module where the type of the first parameter is defined
- [x] make it opt in after CI checks its feasibility
## In the following-up PRs
- [ ] in the following PRs, refactor code into a more efficient one
- [ ] cpp needs special treatments since it cannot embed array in light
of the preceding limits: ref
https://github.com/nim-lang/Nim/pull/20977#discussion_r1035528927; we
can support cpp backends with vtable implementations later on the
comprise that uses indirect vtable access
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
| |
follow up https://github.com/nim-lang/Nim/pull/22851
|
|
|
|
|
|
| |
Done:
- [x] Implement conversions to openArray/varargs.
- [x] Implement index/range checking.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Theoretical Benefits / Plans:
- Typed assembler-like language.
- Allows for a CPS transformation.
- Can replace the existing C backend by a new C backend.
- Can replace the VM.
- Can do more effective "not nil" checking and static array bounds
checking.
- Can be used instead of the DFA.
- Easily translatable to LLVM.
- Reasonably easy to produce native code from.
- Tiny memory consumption. No pointers, no cry.
**In very early stages of development.**
Todo:
- [x] Map Nim types to IR types.
- [ ] Map Nim AST to IR instructions:
- [x] Map bitsets to bitops.
- [ ] Implement string cases.
- [ ] Implement range and index checks.
- [x] Implement `default(T)` builtin.
- [x] Implement multi string concat.
- [ ] Write some analysis passes.
- [ ] Write a backend.
- [x] Integrate into the compilation pipeline.
|
| |
|
|
|
| |
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
| |
|
|
|
|
| |
proc return it (#22684)
|
|
|
|
|
|
|
| |
fixes #22669 constructor pragma doesnt init Nim default fields
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
| |
proc return it (#22681)
|
|
|
| |
Fix #22366 by making nimlf_/nimln_ part of the same line so the debugger doesn't advance to the next line before executing it
|
|
|
| |
fixes #22469; generates `nimTestErrorFlag` for top level statements
|
| |
|
|
|
| |
getTemp and friends now return `TLoc`
|
|
|
| |
`initLocExpr` and friends now return TLoc
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* [C++] Member pragma RFC #530
rebase devel
* changes the test so `echo` is not used before Nim is init
* rebase devel
* fixes Error: use explicit initialization of X for clarity [Uninit]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* wip; use strictdefs for compiler
* checkpoint
* complete the chores
* more fixes
* first phase cleanup
* Update compiler/bitsets.nim
* cleanup
|
|
|
|
|
| |
* fixes #22321; Building DLL with --noMain produces an unexpected DllMain on devel branch
* remove implicit nomain
|
|
|
|
|
|
|
| |
* Expands codegenDecl to work in function params. fixes #22306
* makes the test more concrete so T{lit} params dont match
* adds sfCodegenDecl
|
|
|
|
|
|
|
| |
(#22318)
* implemented 'push quirky' switch for fine grained control over the exception handling overhead
* documentation
|
|
|
| |
adds optonal --nimbasepattern
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* implements: [C++] constructor pragma improvement (fix #21921)
t
* fix test so it doesnt use echo in globals
* Update compiler/ccgtypes.nim
* Update lib/std/private/dragonbox.nim
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
| |
|
|
|
|
|
| |
* fix PreMain for hot code reloading with arc/orc
* fix regression? actually test nimhcr_basic
|
| |
|
|
|
| |
fixes #21885
|
| |
|
|
|
| |
actually fixes #21889
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* introduces virtual pragma, modifies proc def, prevents proc decl
* marks virtual procs as infix
* forward declare vfuncs inside the typedef
* adds naked callConv to virtual
* virtual proc error if not defined in the same top level scope as the type
* first param is now this. extracts genvirtualheaderproc
* WIP syntax
* supports obj. Removes the need for the prefix
* parameter count starts as this. Cleanup
* clean up
* sem tests
* adds integration tests
* uses constraint to store the virtual content
* introduces genVirtualProcParams
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
| |
|
| |
|
|
|
| |
resync fork
|