A programming and science geek, newly holder of a theoretical chemistry PhD.



Last active 5 months ago


Last active 7 months ago

#10 Support return by value without temporary stack slots 1 year, 10 months ago

Comment by ~lattay on ~mpu/qbe

Hi, Just to propose an alternative using what is already implemented because I think I had this same problem. I implemented a (kind of toy) system level QBE based programming language and I wanted to minimize copies when possible, and also had the return by value semantic. So for your snippet I would emit something like that:

%v1 =l alloc8 16  // allocate the stack slot for your pos and get %v1 to points to to it
call $mkcoords(l %v1) // because source mkcoords return a record, SSA mkcoords takes an %out parameter and return nothing
%v2_pos =l copy %v1  // copy the pointer from v1 to v2_pos, which map to the source pos (kind of pointless but easier to emit for me)

And then mkcoords would look something like:

function $mkcoords(l %v1_out) {  // no return, single out parameter
    %v2_x_p =l add %v1_out, 0  // get offset to x
    ... // store something into %v2_x_p to write the x member
    %v3_y_p =l add %v1_out, 8  // get offset to y
    ... // store something into %v2_y_p to write the y member

In my language, the user access this "no copy" feature by using a special "out" variable that is always the return slot, which makes it easy to emit for me (my compiler is pretty basic). However, I think some simple static analysis of the return(s) statement(s) should be enough to detect the use of some other variable as the return variable. Basically, when you can ensure that only one variable is used as the return value, you make it special and bind it to the return slot.

#10 Use move-file instead of rename-file 4 years ago

Comment by ~lattay on ~evhan/dust

Alright, thank you for having a look. Indeed, I tried to compile simply after switching from rename-file to move-file and it did not fix the problem. I will look for a solution on my side. If I find something satisfying, I may submit the patch to you.

#10 Use move-file instead of rename-file 4 years ago

Ticket created by ~lattay on ~evhan/dust


On my netbook I got the following error:

$ dust install base 5.1.0
Error: cannot rename file - Cross-device link (chicken-5.1.0-x86_64-linux-gnu /home/theo/.local/share/dust/user/theo/version/base)

It happens because rename-file is not usable on different file systems and the tar archive is (I guess) initially on the tmpfs mounted on /tmp

#8 Problem with file permissions 4 years ago

Comment by ~lattay on ~evhan/dust

Solved indeed, thank you for the quick reaction :)

#8 Problem with file permissions 4 years ago

Comment by ~lattay on ~evhan/dust

Look like creating and adding the group theo to my groups solved the problem, also I think it is not an acceptable fix and the problem show some kind of bug in dust.

#8 Problem with file permissions 4 years ago

Ticket created by ~lattay on ~evhan/dust

I cannot use dust in one of my archlinux pc because of a weird permission error.

$ DUST_HOME=~/.local/share/dust dust status
Error: cannot change file owner - Operation not permitted (/home/theo/.local/share/dust/user/theo -1 1000)

I check permissions of all files and I cannot find anything wrong. I did exactly the same thing on a different pc with manjaro and everything went well.

Note that on this config the main group for my user is users and not theo.