Commit Graph

163 Commits

Author SHA1 Message Date
gingerBill
a412d34574 Fix #1740 2022-04-26 11:35:34 +01:00
Jeroen van Rijn
7654afc2db Revert "Update mem.nil_allocator to match the same in runtime"
The change broke JSON unmarshaling.

This reverts commit 4484a3433d.
2022-04-19 15:01:54 +02:00
gingerBill
ed4cb72b19 Merge pull request #1696 from Despacito696969/master
Fix for `slice_to_components` compilation error
2022-04-16 21:56:13 +01:00
hikari
698fcb7813 mem: replace size procedures with constants 2022-04-06 18:44:43 +03:00
Despacito696969
7f6c6945ae Fix for slice_to_components
Using `slice_to_components` wouldn't compile because `s.data` is type of `rawptr` and return type is `^T`
2022-04-05 20:17:47 +02:00
gingerBill
4484a3433d Update mem.nil_allocator to match the same in runtime 2022-03-31 15:03:56 +01:00
gingerBill
9f2d710c35 Change intrinsics.Atomic_Memory_Order fields to use Ada_Case rather than snake_case 2022-03-31 12:57:24 +01:00
gingerBill
ba1930eb01 Update core to use new atomic intrinsics 2022-03-31 00:22:54 +01:00
gingerBill
4eb4ae6305 Replace sync with sync2 2022-03-30 17:42:44 +01:00
gingerBill
7e5342f41f Use contextless where possible 2022-03-01 15:52:14 +00:00
gingerBill
18607e53cb Correct alloc_from_memory_block 2022-03-01 15:38:04 +00:00
Jeroen van Rijn
f971126183 [mem] Add missing \n to tracking allocator example. 2022-03-01 13:51:41 +01:00
Jeroen van Rijn
a3d99765cc mem: Add doc.odin with Tracking_Allocator example. 2022-02-05 22:18:22 +01:00
Yawning Angel
61c581baeb core/sys/unix: Add syscalls_linux.odin
Linux is in the unfortunate situation where the system call number is
architecture specific.  This consolidates the system call number
definitions in a single location, adds some wrappers, and hopefully
fixes the existing non-portable invocations of the syscall intrinsic.
2021-11-17 14:00:00 +00:00
Yawning Angel
672fc9fc4d core/mem: Add zero_explicit
This call is intended to provide the ability to securely scrub memory
without compiler interference, in a similar manner to explicit_bzero,
memset_s, SecureZeroMemory.

The approach taken is a volatile memset followed by a seqentially
consistent memory fence, to prevent the call from being optimized away
by DSE, and from being reordered.  An identical approach is currently
being used by the zeroize Rust crate, and is effective in practice.

LLVM IR output:
```
; Function Attrs: nounwind
define internal i8* @mem.zero_explicit(i8* %0, i64 %1) #0 {
decls:
  call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 %1, i1 true)
  fence seq_cst
  ret i8* %0
}
```
2021-10-31 22:57:13 +00:00
gingerBill
aaaddd03a6 Improve internal procedures 2021-10-25 01:28:06 +01:00
gingerBill
58e3f779f2 Remove nonsense from static_arena_init 2021-10-05 17:12:24 +01:00
gingerBill
455d64fbd4 Add error value to commit 2021-10-05 17:11:12 +01:00
gingerBill
16ca677c1f Correct mmap usage 2021-10-05 17:05:33 +01:00
gingerBill
1f1434b384 Add arena_util.odin 2021-10-05 16:42:42 +01:00
gingerBill
f83370235f Add static_arena_bootstrap_new 2021-10-05 16:39:14 +01:00
gingerBill
4961aff51b Minor cleanup 2021-10-05 16:37:15 +01:00
gingerBill
0ed3143006 Merge branch 'master' of https://github.com/odin-lang/Odin 2021-10-05 16:28:25 +01:00
gingerBill
bc2b8b597c Add virtual.Static_Arena 2021-10-05 16:28:14 +01:00
gingerBill
ccc4c641c4 Clean up Memory_Block logic 2021-10-05 16:25:30 +01:00
Jeroen van Rijn
1931e3147d Remove assert from mem.ptr_to_bytes. Fixes #1206 2021-10-05 14:18:48 +02:00
gingerBill
9d9ec192f1 Rename to growing_arena.odin 2021-10-04 17:57:59 +01:00
gingerBill
586a000152 Add Protect_Flags for virtual.protect 2021-10-04 17:42:15 +01:00
gingerBill
728f143e33 Add virtual_linux.odin 2021-10-04 17:30:06 +01:00
gingerBill
f2e78dcc0b Separate out the virtual memory allocation procedures
`reserve`, `commit`, `reserve_and_commit`, `decommit`, `release`, `protect`
2021-10-04 16:43:52 +01:00
gingerBill
e05a305764 Minor clean up 2021-10-03 12:43:11 +01:00
gingerBill
a437c95fed Remove mutex from Growing_Arena; Add Growing_Arena_Temp 2021-10-03 12:41:24 +01:00
gingerBill
8fe70978ff Add @(init) usage to core:mem/virtual 2021-10-03 12:40:51 +01:00
gingerBill
08ac2fd1b6 Rename virtual.Arena to virtual.Growing_Arena 2021-09-29 16:50:36 +01:00
gingerBill
b2a36f204e Add a mutex to arena_free_all 2021-09-29 16:46:14 +01:00
gingerBill
efdd5cf499 Add a mutex to virtual.Arena 2021-09-29 16:43:58 +01:00
gingerBill
805e48ae1e Add core:mem/virtual 2021-09-29 16:39:20 +01:00
gingerBill
6fa3c992b5 mem.Raw_* alias runtime.Raw_* 2021-09-25 17:29:51 +01:00
gingerBill
bfc92d0aaf Make runtime.memset use int for the length from uint 2021-09-23 23:43:29 +01:00
Jeroen van Rijn
eb9665f836 fix mem.new_clone 2021-09-19 22:19:06 +02:00
Jeroen van Rijn
bf15e63130 Revert "Merge pull request #1177 from Kelimion/new_clone"
This reverts commit efa513262e, reversing
changes made to daccfca11d.
2021-09-19 22:16:02 +02:00
Jeroen van Rijn
64ce55944a fix mem.new_clone 2021-09-19 22:10:19 +02:00
gingerBill
ab85571ae6 Minor improvements to mem.odin 2021-09-11 16:33:05 +01:00
gingerBill
b712c84afb Fix typo 2021-09-10 16:37:43 +01:00
gingerBill
9980f81062 Add other constants to c and libc 2021-09-10 16:14:39 +01:00
gingerBill
12af657369 Unify memset usage across platforms and core:c/libc 2021-09-10 15:59:14 +01:00
gingerBill
99df0f1b12 libc changes: unify c and libc types; Add [^]T where appropriate 2021-09-10 15:41:51 +01:00
gingerBill
ca33cb990b Strip semicolons in core which were missing 2021-09-08 13:12:38 +01:00
gingerBill
3754af62d6 Correct "contextless" stuff in mem 2021-09-08 11:43:00 +01:00
gingerBill
12296cec2c Fix typo 2021-09-08 11:38:22 +01:00