~ach

New Zealand

https://acha.ninja

~ach/minipeg

Last active 5 months ago

~ach/minias

Last active 11 months ago

~ach/hermes-announcements

Last active 2 years ago

~ach/janetsh

Last active 3 years ago

~ach/terraform-provider-nix

Last active 3 years ago

~ach/orderly-dev

Last active 3 years ago

~ach/testlist

Last active 3 years ago
View more

Recent activity

regex gives empty capture contents 4 months ago

From Andrew Chambers to ~sircmpwn/hare-dev

Hello,

I have encountered a bug where regex is performing a successful match 
but the capture contents are an empty string. I have attached the 
reproduction and one other person confirmed it.

Regards,
Andrew Chambers

Re: io/fs abstractions in the stdlib. 4 months ago

From Andrew Chambers to ~sircmpwn/hare-dev

> I agree those two function make more sense in os:: than in fs::.
>
> I'm less sure about io::close, but if the other two functions get added then
> adding the os::close also makes sense.
>
Just to be clear, os::open and os::create already exist - they are 
implemented by calling fs::open_file and fs::create_file. My overall 
idea was for os to handle creation of files and fs to operate purely on 
io handles.

[PATCH hare] rt: Add more fcntl locking definitions. 4 months ago

From Andrew Chambers to ~sircmpwn/hare-dev

This change also updates existing definitions to match the flock struct.

Signed-off-by: Andrew Chambers <ac@acha.ninja>
---
 rt/+freebsd/types.ha | 7 ++++---
 rt/+linux/types.ha   | 4 ++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/rt/+freebsd/types.ha b/rt/+freebsd/types.ha
index d32b8949..71a376ec 100644
--- a/rt/+freebsd/types.ha
+++ b/rt/+freebsd/types.ha
@@ -378,12 +378,13 @@ export def F_SEAL_GROW: int = 0x0004;
export def F_SEAL_WRITE: int = 0x0008;
[message trimmed]

Re: io/fs abstractions in the stdlib. 4 months ago

From Andrew Chambers to ~sircmpwn/hare-dev

After further discussions and replies I have adjusted my position on the 
matter.  I see in hare io and fs sit below and do not depend on os and 
that is fine as is.

I do still think hare could add:

fn os::open(...) io::file;

fn os::create(...) io::file;

fn os::close(io::file);

and remove fs::create_file and fs::open_file from the abstract fs interface.

io/fs abstractions in the stdlib. 4 months ago

From Andrew Chambers to ~sircmpwn/hare-dev

I have some concern about the placement of the io and fs module in
the standard library dependency tree. I have already expressed them
(possibly poorly) on irc but I thought I would attempt to articulate
them better and document them for posterity here on the mailing list.
I am in no way asserting my opinion as the truth, this is just one
opinion from a software engineer using hare.

My concern is that io:: and fs:: both depend on the os:: module,
instead of the inverse that we see in C (as I will explain). In hare
using os files requires depending transitively on two io abstractions
(fs::fs and io::handle) such that you are unable to create a hare
program that accesses file descriptors without also depending on high
level io abstractions. In C terms, it would be as if <unistd.h> had a

Re: [PATCH] Add top level inline assembly. 11 months ago

From Andrew Chambers to ~mpu/qbe

> It would be nice to make sure that the syntax is extensible in the
> future should someone come along to add register mapping to it, so that
> we needn't break existing programs to do so.


I suppose the main difference between top level assembly and function 
level assembly would be 2/3 extra arguments in the function context and 
perhaps some extra escaping rules with regard to input output arguments.

asm ".section foobar"

vs

Re: [PATCH] Add top level inline assembly. 11 months ago

From Andrew Chambers to ~mpu/qbe

> This would be UB if s is an empty string, could such thing happen?
No - the string is surrounded by '"'.
> This truncates the last char of s always.
As intended.
> It seems there's a missing newline before printing this string, or is
> it part of s always?

This is a bug, i have fixed it locally by printing a newline only if the 
inline asm does not have one already.

Re: [PATCH] Add top level inline assembly. 11 months ago

From Andrew Chambers to ~mpu/qbe

 > Hi Andrew, thanks for your patch! Would you mind linking the patches
 > to cproc?


Simple top level 'basic asm' - http://sprunge.us/NclFXg

I also absolutely brutalized musl libc here:

https://git.sr.ht/~ach/cprocmusl/commit/2d0e166e92637649b982e15ebf630deaf28a5a64

Re: [PATCH] Add top level inline assembly. 11 months ago

From Andrew Chambers to ~mpu/qbe

> This seems to be of highly limited utility without the ability to map
> temporaries to registers and back, ala GCC's inline assembly.

So to add context, this allows you to do things like implement 
__attribute__((weak)) and __attribute__((alias("sym"))) for cproc, both 
of which are used in musl libc. For example attribute alias maps to asm 
".set sym1, sym2".

This also allowed me to compile crt1.c from musl which uses top level 
asm in this way. In the end I was able to compile a patched musl using 
this and other patches to cproc.

[PATCH] Add top level inline assembly. 11 months ago

From Andrew Chambers to ~mpu/qbe

---
 all.h          |  3 ++-
 doc/il.txt     | 14 ++++++++++++++
 gas.c          | 19 +++++++++++++++++++
 main.c         | 10 +++++++++-
 parse.c        | 16 ++++++++++++++--
 test/tlasm.ssa | 10 ++++++++++
 tools/lexh.c   |  2 +-
 7 files changed, 69 insertions(+), 5 deletions(-)
 create mode 100644 test/tlasm.ssa

diff --git a/all.h b/all.h
index 4b9eb0e..de5719d 100644
--- a/all.h
[message trimmed]