~lassipulkkinen

Finland

Recent activity

Thread-local storage problems 6 hours ago

From Lassi Pulkkinen to ~mpu/qbe

After an unsuccessful attempt at using thread locals in Hare, I've
identified two issues with qbe's TLS implementation, the first one
being the following bug:

$ cat a.ssa
thread data $local = { w 2 }

function l $getlocal() {
@start
	ret thread $local
}

export function w $main() {
@start

Re: [PATCH hare] types::c: initial commit 18 hours ago

From Lassi Pulkkinen to ~sircmpwn/hare-dev

> For the former, we could just require that all iconsts have a type hint.

+1. The default has only led to unintuitive compiler errors in my
experience.

> While we're on the topic of types that we may want to remove from the
> core language, I still don't really understand what the purpose of the
> `char` type is.

+1. Totally forgot about that.

Re: [PATCH hare] types::c: initial commit 20 hours ago

From Lassi Pulkkinen to ~sircmpwn/hare-dev

With this in place, is there any reason to retain the int type in the
core language? To me at least, C's arbitrary-sized int feels like a
vestigial feature that shouldn't need to exist in Hare outside of C
support interfaces.

[RFC PATCH hare-png] Fix split IDAT support, rework reader API accordingly 10 days ago

From Lassi Pulkkinen to ~sircmpwn/hare-dev

According to the PNG specification, each file has a single compression
stream spanning across IDAT chunk boundaries. However, the current
implementation incorrectly assumes each chunk to have its own stream.

To resolve this, breaking changes are made to the reader API, giving
chunk decoders the ability to read multiple consecutive chunks. Users of
the load API are not affected.

- chunk_reader is merged into reader, now an io::stream that restarts
  each time nextchunk is called.
- idat_reader now only concatenates the IDAT chunks, and outputs the
  compressed data stream. The old idat_reader is merged into decoder.
- new_chunk_decoder is removed, as it was unused and seemed unnecessary.
- Some chunk reader types are replaced with simple functions.
[message trimmed]

Re: [PATCH harec v2] Don't use gen_expr_at for assignments 11 days ago

From Lassi Pulkkinen to ~sircmpwn/hare-dev

Whoops, this should actually be v3.

[PATCH harec v2] Don't use gen_expr_at for assignments 11 days ago

From Lassi Pulkkinen to ~sircmpwn/hare-dev

This caused the assignment to be partially observable from the rhs
expression if it contained a reference to the destination, e.g.

let x = (1, 0);
x = (2, x.0);
fmt::println(x.1)!;

prints "2" when it should print "1".

Signed-off-by: Lassi Pulkkinen <lassi@pulk.fi>
---
v2: rebased.

 src/gen.c          | 2 +-
[message trimmed]

Re: [PATCH hare] gen: Copy unions with gen_copy_aligned 11 days ago

From Lassi Pulkkinen to ~sircmpwn/hare-dev

> Needs rebase, and the subject prefix is wrong (should be PATCH harec)

Eh, I noticed that immediately after submission and posted v2, which has
already been applied.

[PATCH hare-png 5/5] decoder_bufsiz: Allow PLTE with bit depth 4 13 days ago

From Lassi Pulkkinen to ~sircmpwn/hare-dev

Not sure why these lines were there in the first place.

Signed-off-by: Lassi Pulkkinen <lassi@pulk.fi>
---
 image/png/decoder.ha | 2 --
 1 file changed, 2 deletions(-)

diff --git a/image/png/decoder.ha b/image/png/decoder.ha
index 86bf4e9..643dd01 100644
--- a/image/png/decoder.ha
+++ b/image/png/decoder.ha
@@ -46,7 +46,6 @@ export fn decoder_bufsiz(ihdr: *ihdr) size = {
	case colortype::RGB =>
		yield 3;
[message trimmed]

[PATCH hare-png 4/5] Abort on attempt to create chunk reader at invalid position 13 days ago

From Lassi Pulkkinen to ~sircmpwn/hare-dev

To improve debuggability of bugs similar to the previous commit. Such a
bug could also occur in user code.

Signed-off-by: Lassi Pulkkinen <lassi@pulk.fi>
---
 image/png/reader.ha | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/image/png/reader.ha b/image/png/reader.ha
index 411f395..c3e6af1 100644
--- a/image/png/reader.ha
+++ b/image/png/reader.ha
@@ -7,6 +7,7 @@ use io;

[message trimmed]

[PATCH hare-png 3/5] plte_read: Finish chunk reader properly 13 days ago

From Lassi Pulkkinen to ~sircmpwn/hare-dev

Call io::read at EOF so that the chunk reader knows to read the
checksum.

Signed-off-by: Lassi Pulkkinen <lassi@pulk.fi>
---
 image/png/plte.ha | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/image/png/plte.ha b/image/png/plte.ha
index 07367a6..edc8f75 100644
--- a/image/png/plte.ha
+++ b/image/png/plte.ha
@@ -57,6 +57,8 @@ export fn plte_read(pr: *plte_reader, buf: []u32) (size | error) = {
		};
[message trimmed]