Commit Graph

40 Commits

Author SHA1 Message Date
gingerBill 8b066b2456 Fix runtime.memset issue 2020-05-14 17:56:24 +01:00
gingerBill e0a242e9a1 Enforce explicit context definition for procedure calls 2020-05-14 13:44:28 +01:00
gingerBill 117ade0700 Fix errors in package win32 2020-04-30 17:48:35 +01:00
gingerBill 97f7a558fa #optional_ok tag for procedures 2020-04-19 21:45:04 +01:00
gingerBill baf5b9edc3 Add runtime.bswap_* required for -llvm-api 2020-04-11 19:26:16 +01:00
gingerBill c6c6c56ba9 Fix mem.set for LLVM C API 2020-03-08 18:44:45 +00:00
gingerBill c74d8405ec Merge branch 'master' into llvm-integration 2020-03-08 10:13:19 +00:00
Tetralux 0190f90979 Fix mem.align_backward when pointer is already aligned 2020-02-28 12:22:30 +00:00
gingerBill e197af766d Merge branch 'master' into llvm-integration 2020-02-23 10:39:57 +00:00
gingerBill 2180f4a475 Basic work on obj generation 2020-02-23 10:04:25 +00:00
Tetralux 1f0c1943da Fix #552.
- Fix comparisons involving one or more empty string.
- Fix comparisons against two strings of different lengths.
2020-02-12 11:25:12 +00:00
gingerBill 13107628f8 Make mem.set use llvm.memset.p0i8.iXX 2019-12-31 14:09:51 +00:00
gingerBill ab52f8d795 Move definition of mem.Allocator and log.Logger to package runtime, to reduce import cycle magic 2019-12-31 12:15:19 +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 40546fbde2 Use runtime.mem_copy in package me 2019-11-03 19:59:41 +00:00
gingerBill 927d6814f2 slice_data_cast 2019-07-09 11:09:46 +01:00
gingerBill 79b585ada8 Add minor additions to mem, sync, and sys/win32 2019-02-21 21:45:33 +00:00
gingerBill 53d8216311 Reorganize package mem 2019-02-10 22:15:34 +00:00
gingerBill 9647fb2a4b Add Stack and Small_Stack allocators to package mem 2019-02-10 22:04:58 +00:00
gingerBill a194aa5a9e Minimize mem.zero use 2019-02-06 13:33:31 +00:00
gingerBill fa5d00521b Remove inline from many of the mem.* procedures 2019-02-04 12:15:51 +00:00
gingerBill 238a40321a inline certain mem.* procedures 2019-01-29 22:08:48 +00:00
gingerBill 775f1e2c95 Fix default parameter assignment checking 2018-12-28 11:20:31 +00:00
gingerBill 28583bfff8 Change procedure group syntax from proc[] to proc{}; deprecate proc[] (raises warning currently) 2018-12-02 18:01:03 +00:00
gingerBill e496b95881 Subset and superset operators for bit_set: < <= > >= 2018-11-25 16:19:17 +00:00
gingerBill 834308d8ce Fix using import override "bug" 2018-09-29 13:07:46 +01:00
gingerBill 5bdb424c6b context.allocator = a; Remove __ from runtime procs; improve division for complex numbers 2018-09-15 10:14:24 +01:00
gingerBill 220485a2d2 typeid as keyword (ready to implement polymorphic name parameters) 2018-09-02 15:56:36 +01:00
gingerBill ae58502a21 Make free_all built-in 2018-08-30 12:21:16 +01:00
gingerBill 001837e6bb Temporary allocator for context 2018-08-29 19:55:55 +01:00
gingerBill 28523f17e2 Add default allocator to allocation related procedures e.g. alloc, free, delete, make 2018-08-28 20:14:56 +01:00
gingerBill cdbf831a7a Replace context <- c {} with context = c;. context assignments are scope based 2018-08-04 23:14:55 +01:00
gingerBill 0718f14774 Reduce number of range and slice operators #239
Replace .. and ... with : and ..
2018-08-01 21:34:59 +01:00
gingerBill a6fe656f21 foreign import x {"foo.lib", "bar.lib"} 2018-07-29 20:56:09 +01:00
gingerBill ba67e474d3 Make source code compile with 32 bit (but not build 32 bit code) 2018-06-15 21:46:03 +01:00
gingerBill d556fa2cd8 Remove special shared scope for runtime stuff 2018-06-03 15:06:40 +01:00
gingerBill 398109ac84 Remove need for __llvm_core 2018-06-03 10:51:43 +01:00
gingerBill 547a2831c7 Clean up name mangling by using unique package names per project 2018-05-27 22:09:11 +01:00
gingerBill 5c52ffe24e Reorganize runtime package 2018-05-27 21:22:25 +01:00
gingerBill 5b6770f3d2 Parse directories to be packages 2018-05-21 20:47:52 +01:00