Commit Graph

33 Commits

Author SHA1 Message Date
Jacek Sieka
75f01bd49f Ensure channels don't leak exception effects (#25318)
The forward declarations cause `Exception` to be inferred - also,
`llrecv` is an internal implementation detail and the type of the
received item is controlled by generics, thus the ValueError raised
there seems out of place for the generic api.

(cherry picked from commit 91febf1f4c)
2025-12-02 14:21:33 +01:00
ringabout
10a6e4c236 clean up gc:arc or gc:orc in docs and in error messages (#22408)
* clean up gc:arc/orc in docs

* in error messages
2023-08-08 05:55:18 -04:00
ringabout
0f3d6b5a52 small fixes for atomicArc (#22017)
* small fixes for atomicArc

* Update lib/system/arc.nim
2023-06-06 21:22:07 +02:00
Bung
a9bd78d579 fix #12122 (#21096) 2022-12-16 08:01:15 +01:00
ringabout
d5cc2085ea ref #20694; quit value gets saturated to ranges (#20753)
* quit value gets saturated to ranges

* add documentation

* minimal changes

* refactor

* small fix

* add documentation

* fixes

* Update lib/system.nim

Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>

Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>
2022-11-05 10:58:57 +01:00
RSDuck
d0dd923acf Switch maintanance (#18668)
* Fix and improve Nintendo Switch support

* Document the necessity for nimAllocPagesViaMalloc

* update changelog

* Use --gc:orc in examples
2021-08-11 08:54:49 +02:00
Andreas Rumpf
af3d2d8ad9 added nimAllocPagesViaMalloc switch (#18490)
* added  switch

* alloc.nim needs page aligned memory blocks
2021-07-15 17:58:47 +02:00
John
40ac19572a add OpenBSD MAP_STACK for coroutines (#14353) 2020-05-16 21:56:52 +02:00
Ico Doornekamp
54bfd69a27 Remove obsolete code from osalloc (#13158) 2020-01-16 09:11:05 +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
Arne Döring
99078d80d7 introduce csize_t instead of fixing csize (#12497) 2019-10-31 19:18:12 +01:00
Andreas Rumpf
889b745b2b Revert "Fixes #12187 (#12321)" (#12447)
This reverts commit 00c31e8766.
2019-10-18 15:59:22 +02:00
Clyybber
00c31e8766 Fixes #12187 (#12321)
* Fixes #12187
* Point to fork of compactdict
Since the original repo is now archived / read-only
2019-10-08 14:15:47 +02:00
alaviss
7ef268274f Haiku support for Nim (#8542)
* posix_other: Haiku now has spawn.h

This is added per https://dev.haiku-os.org/ticket/13446

* posix_other: Add Haiku specific Dirent members

* cpuinfo: Add an implementation for Haiku

* distros: Add basic Haiku support

* encodings: update Haiku support

* fenv, math: Haiku now provides libm

* times: Add Haiku struct members

* ansi_c, osalloc: Add Haiku constants

* threads: Add Haiku support

* testament: Haiku uses LIBRARY_PATH

* nim.cfg: Update Haiku support

libnetwork should only be linked if network functions are used

* threads: Haiku does not support -pthread switch

* tworkingdir: Haiku's env is in /bin

* posix_other: add SIGKILLTHR for Haiku

* sockets: link with libnetwork on Haiku

* coro: correct ucontext.h location

http://pubs.opengroup.org/onlinepubs/009696699/basedefs/ucontext.h.html

* coro: ucontext backend is not available on Haiku

Haiku doesn't provide the <ucontext.h> header, as it was removed from POSIX

* coro: fix setjmp backend

The compiler does not allow statements after a noreturn function

* nativesockets: Haiku doesn't support AI_V4MAPPED

* system: hostOS can contains "haiku"

* os: add support for Haiku's packagefs

packagefs is read-only, but there are writable holes to the underlying
file system as well

* os: update constant for Haiku
2018-08-14 09:35:07 +02:00
Joey
a1457bfa9f Rewrite the memory management code for Nintendo Switch (#8169)
Rewrite the memory management code for Nintendo Switch

The first implementation was naive and did not account for multiple
memory allocations. However, this implementation may still be
incomplete. Currently, when running applications, the code runs fine.
When the application is exited via code (the end of the program is
reached or quit() is called), the Switch will crash. Not sure why this
happens, but I suspect it is from Nim memory allocations.

I suspect the memory allocations because when I compile the helloworld
application without any Nim allocations (just C function calls) and use
`--gc:none` as a compile option, the application exits fine.
2018-07-05 16:33:15 +02:00
Joey
559a7615ad Nintendo switch support (#8069)
* Add config section for Nintendo Switch
* Add compiler configuration for Nintendo Switch and it's CPU
* Add specific lib code for Nintendo Switch
* Add GC support for Nintendo Switch
* Update changelog for Nintendo Switch
* Update changelog with more info about fixed paths
* Cleaned up GC memory management a bit
* Relocate docs for Switch
* Rename aarch64NoneElfGcc to nintendoSwitchGCC
* Remove armv8a57
* Fix installer.ini
* Reuse code in linux and amd64
* Add posix defs for nintendo switch
* Add more defined sections for nintendo switch
* Remove old comment
* Add what's not supported for Nintendo Switch docs
* Make nintendoswitch == posix
* Remove DEVKITPRO references from nim.cfg
* Make PR extccomp changes
* Remove Result type alias
* Add separate switch consts file
* Update docs for nintendo switch
* Fix travis errors with undefined consts and add correct wait.h procs
2018-06-27 12:35:09 +02:00
Emery Hemingway
22f714585b Native access to Genode environment
Add a 'GenodeEnv' type and a 'componentConstructHook' to the system
module. The 'componentConstructHook' allows for detection of POSIX style
programs that exit implicitly or native Genode components that
initialize to serve RPC requests and OS signals.

This hook takes a 'GenodeEnv' argument so that the environment interface
is passed cleanly to application code after globals are initialized.
This is an typed pointer to a C++ object, procedures for accessing the
environment will be available from a Nimble library and not included in
the standard library.

The standard library has an internal pointer to the environment object
but this is not for external use, the undocumented global environment
pointer has been removed.
2018-06-07 07:21:20 +02:00
Andreas Rumpf
1aa359febb warn about inconsistent spacing around binary operators; fixes #7582 2018-05-05 14:58:33 +02:00
Emery Hemingway
9e87531f04 Genode: constrain osTryAllocPages to RAM quota (#6883)
Genode software components all start with an explicit RAM resource quota
which may or may not be upgraded during runtime by the parent process.
With this patch `osTryAllocPages` will fail if allocation exceeds quotas
set by the parent and the `osAllocPages` procedure will trigger a
blocking request to the parent to increase quotas. The previous behavior
could potentially block both procedures indefinitely for a quota upgrade
rather than fail and trigger garbage collection.

This patch also adds tracking of Genode dataspace mappings into the
component address space so they can be detached and freed.
2017-12-14 10:23:47 +01:00
Araq
a0699870e3 osalloc: improve error message when virtualFree fails 2017-12-03 15:20:13 +01:00
Emery Hemingway
7e351fc7fa support for the Genode OS framework (#5560) 2017-03-31 23:13:06 +02:00
Araq
b26e6e3589 fixes #5301 2017-01-30 19:01:03 +01:00
Jacek Sieka
d2d618dde7 add MAP_ANONYMOUS const for amd64, fix MAP_PRIVATE on mips etc (see fe36254) 2016-10-12 22:31:59 +08:00
GaveUp
fe362543de Revert change to osalloc.nim from commit 8d7a45f.
Change caused MAP_ANONYMOUS to have an incorrect value when compiling
for mipsel.

Fixes #4852.
2016-10-04 15:22:36 -05:00
Jacek Sieka
b3846124e6 clean up a few stray c_stdout's in gc debug code 2016-07-31 08:34:42 +08:00
Jeff Ciesielski
4f4aafda6c Plumb {.intdefine.} and {.strdefine.} pragmas.
Shorthand so that users won't need to use the .magic pragma
2016-07-04 22:52:24 -04:00
Jeff Ciesielski
94d1aa5109 Add the ability to pass a value with the -d flag
This allows the end user to use the {.magic: "IntDefine"/"StrDefine"}
pragmas to pass values into code at compile time.  This has a nice side
effect of also allowing/requiring a default value to be assigned in the
code (see osalloc.nim/StandaloneHeapSize for an example)
2016-07-04 18:11:25 -04:00
Yuriy Glukhov
84876edbcb Fixed emscripten compilation 2016-06-13 17:00:13 +03:00
Jacek Sieka
8d7a45f205 prefer consts to importing #defines from headers
to be completed - better would be to have a libc wrapper that deals with
all pesky C ABI details
2016-06-06 23:00:00 +08:00
Hans Raaf
38b7581a28 Fixing pragmas (so syntax highligting works). 2016-05-20 20:26:20 +02:00
Andreas Rumpf
b4e2a846e1 munmap for LLVM 2016-03-28 02:43:16 +02:00
Andreas Rumpf
e2c8d9ade0 beginnings of --gc:stack 2016-03-28 02:26:38 +02:00