May 21, 2017
On Tuesday, 16 May 2017 at 13:44:27 UTC, Stefan Koch wrote:
> On Thursday, 16 February 2017 at 21:05:51 UTC, Stefan Koch wrote:
>> [ ... ]
>
> So ...
> I just encountered more ABI issues; related to slices which are part of structures.
> struct R
> {
>   uint[] s1;
>   uint[] s2;
> }
>
> like this.
>
> R returnSlices(int[] s1, int[] s2)
> {
>     return R(s1[], s2[]);
> }
> static assert(returnSlices([1,2,3], [4,5,6,7]) == R([1,2,3][4.5.6.7])); // works
>
>
> R returnSlicedSlices(int[] s1, int[] s2)
> {
>     return R(s1[], s2[1 .. $-1]);
> }
> static assert(returnSlicedSlices([1,2,3], [4,5,6,7]) == R([1,2,3],[5,6])); // fails
> // returns R([1,2,3],null); at the moment
>
> The reason ABI issues.
> Where exactly ? No Idea.

Huh apparently I fixed this issue.
But I cannot rememberer when or how I did it.
This test will now magically work.
This concerns me.
May 23, 2017
On Sunday, 21 May 2017 at 14:49:32 UTC, Stefan Koch wrote:
>
> Huh apparently I fixed this issue.
> But I cannot rememberer when or how I did it.
> This test will now magically work.
> This concerns me.

I finally figured out what was going on.
I forgot to activate the -bc-ctfe switch ....
A few days of work into the wrong direction *sigh*
May 23, 2017
On Tuesday, 23 May 2017 at 17:26:01 UTC, Stefan Koch wrote:
> On Sunday, 21 May 2017 at 14:49:32 UTC, Stefan Koch wrote:
>>
>> Huh apparently I fixed this issue.
>> But I cannot rememberer when or how I did it.
>> This test will now magically work.
>> This concerns me.
>
> I finally figured out what was going on.
> I forgot to activate the -bc-ctfe switch ....
> A few days of work into the wrong direction *sigh*

Seems like you need to make -bc-ctfe the default in your dmd branch :P
May 23, 2017
On Tuesday, 23 May 2017 at 17:46:23 UTC, Petar Kirov [ZombineDev] wrote:
>
> Seems like you need to make -bc-ctfe the default in your dmd branch :P

That is what I usually do, however I re-enabled the switch in order to test which error messages the current Interpreter throws out.



May 28, 2017
On Thursday, 16 February 2017 at 21:05:51 UTC, Stefan Koch wrote:
> [ ... ]

Hi Guys,

I just fixed the sliceAssignment!
now overlapping assignments are correctly detected.

I also re-enabled a bailout on struct-member operation which are not simple integers.
Which means I chose to ignore some ABI issues for now ....

With that the dmd unittests are green again.

Phobos still fails an I am investigating.
June 04, 2017
On Sunday, 28 May 2017 at 22:26:18 UTC, Stefan Koch wrote:
> On Thursday, 16 February 2017 at 21:05:51 UTC, Stefan Koch wrote:
>> [ ... ]
>
> Hi Guys,
>
> I just fixed the sliceAssignment!
> now overlapping assignments are correctly detected.
>
> I also re-enabled a bailout on struct-member operation which are not simple integers.
> Which means I chose to ignore some ABI issues for now ....
>
> With that the dmd unittests are green again.
>
> Phobos still fails an I am investigating.

The failing phobos test works now.
However due to the corrected expression handling, I now encounter cases, which I overlooked before.
Thus we now fail the dmd testsuite.

June 05, 2017
On Thursday, 16 February 2017 at 21:05:51 UTC, Stefan Koch wrote:
> [ .. ]

Hi Guys,

I am still working on the buggy Slice-Assignment.
Just now I fixed a bug where an [Bytecode-Assert]
would flip it's the condition ... and trigger whenever it was true instead of false.
Assertions are one of things which cannot be tested at compiletime since they need to interact with dmd.... bummer.

Originally I intended for floating-point support to be implemented in this and the following month. Looks like I am not gonna make it.

My main system is waiting for replacement parts.
And as you know my laptop cannot link dmd when a gui is active... so that's not great either.

Cheers,
Stefan
June 06, 2017
On Monday, 5 June 2017 at 20:51:03 UTC, Stefan Koch wrote:
> On Thursday, 16 February 2017 at 21:05:51 UTC, Stefan Koch wrote:
>> [ .. ]
>
> Hi Guys,
>
> I am still working on the buggy Slice-Assignment.
> Just now I fixed a bug where an [Bytecode-Assert]
> would flip it's the condition ... and trigger whenever it was true instead of false.
> Assertions are one of things which cannot be tested at compiletime since they need to interact with dmd.... bummer.
>
> Originally I intended for floating-point support to be implemented in this and the following month. Looks like I am not gonna make it.
>
> My main system is waiting for replacement parts.
> And as you know my laptop cannot link dmd when a gui is active... so that's not great either.
>
> Cheers,
> Stefan

I solved the slice assignment case.
Now here is a subtle bug for you.

As you may know, newCTFE has it's own type-system in order to help make the IR simpler.
Later on typed version of the ir gets lowered though until only int32 expressions remain.
When processing Slice expression I lowered to early though, and returned an i32 to be interpreted as pointer to a slice descriptor.
However in the slice-assignment code I wanted to the the elmementType form the SliceExp, which came back as BCType(invalid).
Then I took it the size of it, which came back as 0. (an invalid size for an invalid type).
And multiplied the index and length, with it to move to the correct point in the slice-buffer.

That comes back as target[0 .. 0] = source[0 .. 0].
So no modification occurs.

Time to find this: roughly 2 weeks.

Why did it take so long ?
Because I thought the ABI was at fault; And spent a lot of time staring on memory dumps :(

June 06, 2017
On Tuesday, 6 June 2017 at 00:46:00 UTC, Stefan Koch wrote:
>
> Time to find this: roughly 2 weeks.
>

Damn. That's some commitment.

June 06, 2017
On Tuesday, 6 June 2017 at 02:03:46 UTC, jmh530 wrote:
> On Tuesday, 6 June 2017 at 00:46:00 UTC, Stefan Koch wrote:
>>
>> Time to find this: roughly 2 weeks.
>>
>
> Damn. That's some commitment.

There is no other way, really.
These things need to be fixed.