Commit Graph

37 Commits

Author SHA1 Message Date
gingerBill
f0437a4242 Enforce core:builtin and core:intrinsics for imports 2021-08-21 13:44:16 +01:00
Jeroen van Rijn
2451014b6e datetime_to_time's ok should default to true. 2021-05-02 13:23:57 +02:00
gingerBill
72aa0e6e38 Replace many foreign llvm calls with intrinsics 2021-04-25 20:22:26 +01:00
Jeroen van Rijn
06c5a7fb3e Correct overflowed months. 2021-03-23 18:49:50 +01:00
Jeroen van Rijn
781f784375 Add core:datetime_to_time
datetime_to_time takes separate parameters for date and time values and returns a time.Time and an `ok` bool.

If the values are out of range, they're considered modulo and ok will be set to false.
2021-03-23 18:41:40 +01:00
gingerBill
b727b6438b Minimize unneeded casts 2021-03-03 14:31:17 +00:00
nakst
7b4ddd9b18 update essence API header 2021-02-26 14:46:38 +00:00
gingerBill
aa93305015 Replace usage of inline proc with #force_inline proc in the core library 2021-02-23 16:14:47 +00:00
gingerBill
aed63a6e8b Update package reflect 2021-01-27 15:27:59 +00:00
gingerBill
9e8c46b8de Add time.Tick for performance related timings 2021-01-09 01:08:16 +00:00
Platin21
6b83159b06 Switched to else instead of not equal 2020-09-27 22:17:35 +03:00
Platin21
f7e40b8572 Adds when statement for framework include 2020-09-27 22:08:33 +03:00
gingerBill
8cc5cd1494 Add package path/filepath; Add os.stat for windows (TODO: unix) 2020-09-25 20:20:53 +01:00
gingerBill
fc4fdd588e Remove usage of do in core library 2020-09-23 17:17:14 +01:00
Christian Seibold
577be4a8ae Get Odin compiling and produced exe's running on FreeBSD 2020-09-14 15:22:35 -05:00
gingerBill
1f2f3cb315 Fix #712 2020-08-26 22:40:03 +01:00
gingerBill
86448ee044 Add raw_data to replace cases in which &x[0] was used 2020-06-29 15:58:24 +01:00
gingerBill
6bd05ef5d7 Begin migration from sys/win32 to sys/windows 2020-06-26 19:11:34 +01:00
gingerBill
509e8b512f Add time.read_cycle_counter 2020-06-22 15:54:19 +01:00
gingerBill
c9d3b95b0d Fix time.now 2020-06-19 11:35:43 +01:00
gingerBill
e92fdb4a99 x if cond else y and x when cond else y expressions 2020-03-05 20:34:30 +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
Chris Heyes
044e64beb0 Add missing foreign import to time_darwin 2019-11-01 19:39:26 +00:00
Chris Heyes
adca5b57cd Move time code from os to time package 2019-11-01 19:33:48 +00:00
Chris Heyes
153e7525b5 Merge remote-tracking branch 'upstream/master' 2019-11-01 19:18:33 +00:00
gingerBill
66ae4e5afc Change ODIN_OS string for osx from "osx" to "darwin" to allow for other platforms 2019-10-01 20:38:50 +01:00
nakst
22e982c8fb New Essence OS layer; cross-compiling improvements 2019-09-02 16:46:50 +01:00
gingerBill
2c5c8192f8 Fix parsing for procedure literals expression statements; improve assert performance; other minor fixes 2019-07-28 22:58:56 +01:00
Chris Heyes
d85893954d Impl time for macOS 2019-07-16 23:49:53 +01:00
gingerBill
cd2c4c02e1 Merge pull request #320 from thebirk/add-diff-to-time
Added diff() to core:time.
2019-01-07 15:52:33 +00:00
thebirk
ca2220214e Added diff() to core:time. 2019-01-06 19:40:57 +01:00
matt
c60766f8e6 Vet time_linux 2019-01-06 05:25:27 -07:00
Mikkel Hjortshoej
1a6b7f9945 set time_linux IS_SUPPORTED to true 2018-12-08 21:12:01 +01:00
Mikkel Hjortshoej
03957cee64 Merge branch 'log_pr' 2018-12-08 21:08:27 +01:00
Jeroen van Rijn
1584260886 Add Linux support for core:time
In addition to sleep() and now(), it also defines nanosleep(), boot_time() and seconds_since_boot()
2018-12-08 20:39:33 +01:00
Mikkel Hjortshoej
411d1450b0 Add timestamp support using the new core:time 2018-12-08 16:02:33 +01:00
gingerBill
3bf01c8498 package time (windows only at the moment) 2018-12-08 14:32:00 +00:00