Commit Graph

1993 Commits

Author SHA1 Message Date
gingerBill 3fd5c3cd85 Merge pull request #458 from Tetralux/linux-threads
Implement core:thread and core:sync on Unix using pthreads
2019-12-01 11:33:23 +00:00
Tetralux 99121d6ff2 Implement core:thread and core:sync on Unix using pthreads
Also do some cleanup and refactoring of the thread, sync and time APIs.

- remove 'semaphore_release' because 'post' and 'wait' is easier to understand

- change 'semaphore_wait' to '*_wait_for' to match Condition

- pthreads can be given a stack, but doing so requires the user to set up the guard
  pages manually. BE WARNED. The alignment requirements of the stack are also
  platform-dependant; it may need to be page size aligned on some systems.
  Unclear which systems, however. See 'os.get_page_size', and 'mem.make_aligned'.
  HOWEVER: I was unable to get custom stacks with guard pages working reliably,
  so while you can do it, the API does not support it.

- add 'os.get_page_size', 'mem.make_aligned', and 'mem.new_aligned'.

- removed thread return values because windows and linux are not consistent; windows returns 'i32'
  and pthreads return 'void*'; besides which, if you really wanted to communicate how the
  thread exited, you probably wouldn't do it with the thread's exit code.

- fixed 'thread.is_done' on Windows; it didn't report true immediately after calling 'thread.join'.

- moved time related stuff out of 'core:os' to 'core:time'.

- add 'mem.align_backward'

- fixed default allocator alignment
  The heap on Windows, and calloc on Linux, both have no facility to request alignment.
  It's a bit of hack, but the heap_allocator now overallocates; `size + alignment` bytes,
  and aligns things to at least 2.
  It does both of these things to ensure that there is at least two bytes before the payload,
  which it uses to store how much padding it needed to insert in order to fulfil the alignment
  requested.

- make conditions more sane by matching the Windows behaviour.
  The fact that they were signalled now lingers until a thread tries to wait,
  causing them to just pass by uninterrupted, without sleeping or locking the
  underlying mutex, as it would otherwise need to do.
  This means that a thread no longer has to be waiting in order to be signalled, which
  avoids timing bugs that causes deadlocks that are hard to debug and fix.
  See the comment on the `sync.Condition.flag` field.

- add thread priority: `thread.create(worker_proc, .High)`
2019-12-01 00:46:23 +00:00
gingerBill 0c0c83ee29 Disable find_visual_studio_and_windows_sdk_utf8 temporarily 2019-11-28 21:07:06 +00:00
gingerBill b75d59d6e0 Make sort.merge_sort in place; Add sort.heap_sort 2019-11-27 16:06:07 +00:00
gingerBill 71c8a3456e Update package odin/parser for #soa and #vector 2019-11-27 15:23:54 +00:00
gingerBill 37e3e081c6 Update microsoft_craziness.h to work correctly with the rest of the codebase (and not use WIN32_LEAN_AND_MEAN) 2019-11-27 15:18:32 +00:00
gingerBill 5ea9fc3fb0 Merge pull request #478 from castano/auto-search-sdk
Allow running Odin compiler without using visual studio command prompt or setting up environgment variables.
2019-11-26 22:29:08 +00:00
Mikkel Hjortshøj 53f65224f6 Merge pull request #459 from zhibog/master
Base32 added for core:encoding
2019-11-26 19:45:52 +01:00
gingerBill 902d313c6a Fix issue with os.write on *nix with writing nothing 2019-11-24 10:08:08 +00:00
gingerBill 45d844f9d2 Disable #soa compound literals 2019-11-21 20:05:45 +00:00
gingerBill 9b58781122 #soa[dynamic]Type (Experimental) 2019-11-21 19:36:07 +00:00
gingerBill b74f8f2047 Fix SOA entity usage error on -vet 2019-11-21 18:21:27 +00:00
gingerBill 88c90cf99a Update demo.odin 2019-11-21 14:41:33 +00:00
gingerBill 321dcc60e3 Update fmt.odin 2019-11-21 14:41:12 +00:00
gingerBill 400f12f31f Update demo.odin 2019-11-21 14:23:59 +00:00
gingerBill 2c5a84bb78 #soa[]Type (Experimental) 2019-11-21 00:07:21 +00:00
gingerBill e01d8a04a9 Fix String causes a crash when used in a polymorphic type #483 2019-11-20 22:07:12 +00:00
gingerBill 69afa33fa5 Fix Implicit Selector Expressions do not work at the global/package scope #484 2019-11-20 21:56:37 +00:00
gingerBill 44e0e96612 Prepare SOA Struct code for slices and dynamic arrays *to be implemented* 2019-11-19 23:54:36 +00:00
gingerBill 0839dccfdc Fix Compiler panic with SIMD Vector debug information #481 2019-11-19 23:24:49 +00:00
zhibog 2484f4d04b Removed CSV stuff. 2019-11-17 20:09:00 +01:00
gingerBill d22e5b697d Add new #soa and #vector syntax 2019-11-17 10:30:37 -08:00
gingerBill 301ee664e9 Add Handmade Seattle 2019 Demos 2019-11-16 06:59:48 -08:00
gingerBill 9b4d4a2c61 Minor fix to os.write on darwin 2019-11-16 06:59:14 -08:00
gingerBill d9647174a3 Merge pull request #479 from ThisDrunkDane/master
Fix CI badge on README.md
2019-11-14 22:57:08 +00:00
gingerBill 4d29b64196 Merge pull request #475 from hasenj/reverse
fix string reversal
2019-11-14 22:52:01 +00:00
gingerBill 8be1b2e1b1 Merge pull request #476 from castano/symlink-fix
Add support for running odin through a symlink.
2019-11-14 22:50:17 +00:00
Mikkel Hjortshoej b85258a9fc Add event query param to CI badge 2019-11-14 14:47:01 -08:00
gingerBill 07897ed78e Fix System V bitcast/transmute bug 2019-11-14 14:45:23 -08:00
Mikkel Hjortshoej 8115386217 Add branch query to CI badge 2019-11-14 14:39:11 -08:00
castano f8dd4816ff Integrate microsoft_craziness better. 2019-11-14 09:30:05 -08:00
castano 928a445a14 Fix definition. GB_SYSTEM_WINDOWS is not defined yet. Ideally microsoft_crazines.h should be included after common, but conflicts with defer macro. 2019-11-14 09:29:59 -08:00
castano 42cd78497a Use Jon's single file lib to find the latest compiler and SDK paths instead of relying on environment variables.
This allows you to run the odin compiler without having to use the visual studio command prompt or setting up environment variables. It would be nice to not rely on the automatic search exclusively, but allow specifying the desired compiler or SDK version.

This change introduces various library dependencies in order to interact with COM objects. Not sure if there's a way around that.
2019-11-14 09:29:45 -08:00
castano 813f5d211f Fix linux build. 2019-11-14 09:22:37 -08:00
castano 71d129a709 Add support for running odin through a symlink. Use realpath when obtaining root dir. 2019-11-14 00:50:26 -08:00
Hasen Judy c35762528c fix string reversal 2019-11-13 23:36:52 +09:00
gingerBill aa796a1032 v0.11.1 v0.11.1 2019-11-12 21:20:40 +00:00
gingerBill 5bf71ba75c big_int addition overflow rules 2019-11-11 22:47:25 +00:00
gingerBill 967981aacd Add -show-more-timings 2019-11-10 21:49:02 +00:00
gingerBill 33d05a07de Fix big_int_or and big_int_xor 2019-11-10 20:06:04 +00:00
gingerBill 8da8301b09 Fix big subtraction for very large numbers on edges of overflow. 2019-11-10 19:55:26 +00:00
gingerBill 536cceeef9 Add intrinsics.type_is_unsigned 2019-11-10 18:51:21 +00:00
gingerBill 098684a6fe Add 128-bit random procedures to package math/rand 2019-11-10 18:47:16 +00:00
zhibog 694ee02247 Missed one 2019-11-09 18:06:33 +01:00
zhibog 0451c88ab6 Fixed indenting 2019-11-09 18:04:30 +01:00
gingerBill 2ef7bfc06e Remove debug message 2019-11-09 10:45:03 +00:00
gingerBill 7bfdb4f9f4 Fix Compile time assert on non-constant boolean parameters #467 2019-11-09 10:44:42 +00:00
gingerBill 0a35b13411 Fix inline for bug for #468 2019-11-09 10:24:27 +00:00
zhibog 803f6a6651 Added procs to read and write just the data, without any file loading / writing 2019-11-08 22:17:24 +01:00
zhibog 672cfd51c3 Added names to return values 2019-11-08 20:21:18 +01:00