afonso360 opened issue #5398:
:wave: Hey,
Feature
We should remove the unsigned variants of the DataValue structure.
Benefit
This brings this structure closer to CLIF's idea of a DataValue, which does not distinguish between signed and unsigned in types. Instead in CLIF we only have that distinction in the operations that are performed (see for example
sdiv
vsudiv
)It can also bring some issues to the interpreter if not handled correctly, for example. If a operation returns a unsigned
DataValue
it can cause a test failure such asFailed test: run: %usubof_i64(0, 0) == 0, actual: 0
since we parse the values in test cases as signed integers.Implementation
As far as I'm aware the only user of these values is the interpreter. Which casts values to unsigned when it needs to perform operations as unsigned, and then has to cast them back to signed values before returning them.
We can instead separate those operations like we do in CLIF instructions. As an example right now we have
Value::div
which does signed or unsigned division based on the signedness of the input DataValue, but we can change that to haveValue::sdiv
andValue::udiv
like we have for CLIF instructions.Alternatives
We can keep using this system and changing the PartialEq implementation to fix some of the issues above, but that does not sound like the best solution to me.
See the following zulip thread for some additional context.
afonso360 edited issue #5398:
:wave: Hey,
Feature
We should remove the unsigned variants of the DataValue structure.
Benefit
This brings this structure closer to CLIF's idea of a DataValue, which does not distinguish between signed and unsigned in types. Instead in CLIF we only have that distinction in the operations that are performed (see as an example
sdiv
vsudiv
)It can also bring some issues to the interpreter if not handled correctly. For example if a operation returns a unsigned
DataValue
it can cause a test failure such asFailed test: run: %usubof_i64(0, 0) == 0, actual: 0
since we parse the values in test cases as signed integers.Implementation
As far as I'm aware the only user of these values is the interpreter. Which casts values to unsigned when it needs to perform operations as unsigned, and then has to cast them back to signed values before returning them.
We can instead separate those operations like we do in CLIF instructions. As an example right now we have
Value::div
which does signed or unsigned division based on the signedness of the input DataValue, but we can change that to haveValue::sdiv
andValue::udiv
like we have for CLIF instructions.Alternatives
We can keep using this system and changing the PartialEq implementation to fix some of the issues above, but that does not sound like the best solution to me.
See the following zulip thread for some additional context.
afonso360 edited issue #5398:
:wave: Hey,
Feature
We should remove the unsigned variants of the DataValue structure.
Benefit
This brings this structure closer to CLIF's idea of a DataValue, which does not distinguish between signed and unsigned in types. Instead in CLIF we only have that distinction in the operations that are performed (see as an example
sdiv
vsudiv
)It can also bring some issues to the interpreter if not handled correctly. For example if a operation returns a unsigned
DataValue
it can cause a test failure such asFailed test: run: %usubof_i64(0, 0) == 0, actual: 0
since we parse the values in test cases as signed integers.Overall this is quite confusing in the interpreter and causes a bunch of casting between types that could probably be avoided.
Implementation
As far as I'm aware the only user of these values is the interpreter. Which casts values to unsigned when it needs to perform operations as unsigned, and then has to cast them back to signed values before returning them.
We can instead separate those operations like we do in CLIF instructions. As an example right now we have
Value::div
which does signed or unsigned division based on the signedness of the input DataValue, but we can change that to haveValue::sdiv
andValue::udiv
like we have for CLIF instructions.Alternatives
We can keep using this system and changing the PartialEq implementation to fix some of the issues above, but that does not sound like the best solution to me.
See the following zulip thread for some additional context.
jameysharp labeled issue #5398:
:wave: Hey,
Feature
We should remove the unsigned variants of the DataValue structure.
Benefit
This brings this structure closer to CLIF's idea of a DataValue, which does not distinguish between signed and unsigned in types. Instead in CLIF we only have that distinction in the operations that are performed (see as an example
sdiv
vsudiv
)It can also bring some issues to the interpreter if not handled correctly. For example if a operation returns a unsigned
DataValue
it can cause a test failure such asFailed test: run: %usubof_i64(0, 0) == 0, actual: 0
since we parse the values in test cases as signed integers.Overall this is quite confusing in the interpreter and causes a bunch of casting between types that could probably be avoided.
Implementation
As far as I'm aware the only user of these values is the interpreter. Which casts values to unsigned when it needs to perform operations as unsigned, and then has to cast them back to signed values before returning them.
We can instead separate those operations like we do in CLIF instructions. As an example right now we have
Value::div
which does signed or unsigned division based on the signedness of the input DataValue, but we can change that to haveValue::sdiv
andValue::udiv
like we have for CLIF instructions.Alternatives
We can keep using this system and changing the PartialEq implementation to fix some of the issues above, but that does not sound like the best solution to me.
See the following zulip thread for some additional context.
jameysharp labeled issue #5398:
:wave: Hey,
Feature
We should remove the unsigned variants of the DataValue structure.
Benefit
This brings this structure closer to CLIF's idea of a DataValue, which does not distinguish between signed and unsigned in types. Instead in CLIF we only have that distinction in the operations that are performed (see as an example
sdiv
vsudiv
)It can also bring some issues to the interpreter if not handled correctly. For example if a operation returns a unsigned
DataValue
it can cause a test failure such asFailed test: run: %usubof_i64(0, 0) == 0, actual: 0
since we parse the values in test cases as signed integers.Overall this is quite confusing in the interpreter and causes a bunch of casting between types that could probably be avoided.
Implementation
As far as I'm aware the only user of these values is the interpreter. Which casts values to unsigned when it needs to perform operations as unsigned, and then has to cast them back to signed values before returning them.
We can instead separate those operations like we do in CLIF instructions. As an example right now we have
Value::div
which does signed or unsigned division based on the signedness of the input DataValue, but we can change that to haveValue::sdiv
andValue::udiv
like we have for CLIF instructions.Alternatives
We can keep using this system and changing the PartialEq implementation to fix some of the issues above, but that does not sound like the best solution to me.
See the following zulip thread for some additional context.
bahildebrand commented on issue #5398:
Is this still available? If so I'd like to take a crack at it.
afonso360 commented on issue #5398:
As far as I'm aware no one has started working on it yet!
tnachen commented on issue #5398:
@bahildebrand I'm looking to do this but if you already started let me know, can defer this to you
bahildebrand commented on issue #5398:
@tnachen I have already started, but it seems like you might have as well.
afonso360 closed issue #5398:
:wave: Hey,
Feature
We should remove the unsigned variants of the DataValue structure.
Benefit
This brings this structure closer to CLIF's idea of a DataValue, which does not distinguish between signed and unsigned in types. Instead in CLIF we only have that distinction in the operations that are performed (see as an example
sdiv
vsudiv
)It can also bring some issues to the interpreter if not handled correctly. For example if a operation returns a unsigned
DataValue
it can cause a test failure such asFailed test: run: %usubof_i64(0, 0) == 0, actual: 0
since we parse the values in test cases as signed integers.Overall this is quite confusing in the interpreter and causes a bunch of casting between types that could probably be avoided.
Implementation
As far as I'm aware the only user of these values is the interpreter. Which casts values to unsigned when it needs to perform operations as unsigned, and then has to cast them back to signed values before returning them.
We can instead separate those operations like we do in CLIF instructions. As an example right now we have
Value::div
which does signed or unsigned division based on the signedness of the input DataValue, but we can change that to haveValue::sdiv
andValue::udiv
like we have for CLIF instructions.Alternatives
We can keep using this system and changing the PartialEq implementation to fix some of the issues above, but that does not sound like the best solution to me.
See the following zulip thread for some additional context.
Last updated: Dec 23 2024 at 12:05 UTC