dmd icon indicating copy to clipboard operation
dmd copied to clipboard

cod4.d: make even more use of opAssLoadReg() and more

Open WalterBright opened this issue 5 years ago • 12 comments

WalterBright avatar Aug 05 '20 03:08 WalterBright

Thanks for your pull request, @WalterBright!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#11511"

dlang-bot avatar Aug 05 '20 03:08 dlang-bot

C++ interop tests Heisenbug filed as https://issues.dlang.org/show_bug.cgi?id=21130

WalterBright avatar Aug 06 '20 23:08 WalterBright

C++ interop tests Heisenbug filed as https://issues.dlang.org/show_bug.cgi?id=21130

Please don't open bug reports that can't be fixed. In this case, absolutely nothing we can do. And re-triggering the CI will most likely fix it.

Geod24 avatar Aug 09 '20 08:08 Geod24

@WalterBright, rebase + force push please for the buildkite failure, unless you can retrigger a buildkite manually.

ghost avatar Aug 13 '20 12:08 ghost

Restarted the failures but the segfault in libmir/mir-algorithm might not be unrelated.

MoonlightSentinel avatar Aug 13 '20 12:08 MoonlightSentinel

@MoonlightSentinel, yeah we'll see.

ghost avatar Aug 13 '20 12:08 ghost

can I have an invite for buildkite ? I'm not sure that if I register I'll be able to retrigger.

ghost avatar Aug 13 '20 12:08 ghost

As expected, libmir/mir-algorith is persistent.

MoonlightSentinel avatar Aug 13 '20 12:08 MoonlightSentinel

This PR conflates mutliple changes that should at least be separate commits:

  • Refactoring to use opAssLoadReg
  • Additions to opAssLoadReg.
  • Comment fixes (allthough this one is neglegible)

MoonlightSentinel avatar Aug 13 '20 12:08 MoonlightSentinel

This PR conflates mutliple changes that should at least be separate commits:

I don't think any other dev here cares about the DMD backend (anymore), so as long as Walter doesn't break the testsuite there is no need to review, enforce style guidelines or stop his PRs.

wilzbach avatar Aug 13 '20 13:08 wilzbach

reminder: "Needs Works" b/c of libmir

ghost avatar Aug 28 '20 03:08 ghost

Found a reduced test case for the mir segfault. (Ignore the weird names, the test is adapted from the -vcg-ast output to manually expand the templates):

unittest
{
	uint[2] data = 0u;
	Slice_uintPtr sliced = Slice_uintPtr(data.length, data.ptr);
	Slice_FieldIterator_BitpackField_uintPtr_18u packed = bitpack(sliced);
	sort(packed);
}

struct Slice_uintPtr
{
	ulong[1] _structure;
	uint* _iterator;
}

Slice_FieldIterator_BitpackField_uintPtr_18u bitpack(Slice_uintPtr slice)
{
	ulong[1] structure = [0LU];
	structure = slice._structure;
	structure[] *= 4LU;
	structure[0] /= 18LU;
	return Slice_FieldIterator_BitpackField_uintPtr_18u(
				structure,
				FieldIterator_BitpackField_uintPtr_18u(
					0L,
					BitpackField_uintPtr_18u(slice._iterator)
				)
			);
}

struct BitpackField_uintPtr_18u
{
	uint* _field;
	uint opIndex(ulong index)
	{
		uint ret = this._field[index];
		return ret;
	}

	uint opIndexAssign(uint value, ulong index)
	{
		index *= 18LU;
		this._field[index] = this._field[1];
		return value;
	}
}

struct FieldIterator_BitpackField_uintPtr_18u
{
	long _index;
	BitpackField_uintPtr_18u _field;
}

struct Slice_FieldIterator_BitpackField_uintPtr_18u
{
	ulong[1] _structure;
	FieldIterator_BitpackField_uintPtr_18u _iterator;
}

Slice_FieldIterator_BitpackField_uintPtr_18u sort(Slice_FieldIterator_BitpackField_uintPtr_18u slice)
{
	FieldIterator_BitpackField_uintPtr_18u r = slice._iterator;
	r._field[r._index] = r._field[r._index];
	return slice;
}
> dmd\generated\windows\release\64\dmd.exe -m64 -unittest -main -run test.d
> Exit -1073741819
> dmd -m64 -unittest -main -run test.d
1 unittests passed
> Exit 0

MoonlightSentinel avatar Aug 30 '20 14:08 MoonlightSentinel