Commit 51d98676 by Nicolas Capens Committed by Nicolas Capens

Fix materialization of function arguments

Subzero does not appear to preserve function arguments passed in as registers onto the stack by itself. Any scratch registers can get reused for local variable register allocation. This workaround simply materializes each concrete Reactor variable constructed from an argument on definition. It does not ensure that arguments turned into variables at a later point are properly preserved. Also this solution does not centralize the materialization, making it bug prone when new concrete Reactor types are implemented. Bug b/129757459 Change-Id: I1007ea0e7204d05e60203b2e896589a03fc515a9 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28309Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com>
parent 3f20ba6b
...@@ -89,6 +89,7 @@ namespace rr ...@@ -89,6 +89,7 @@ namespace rr
Bool::Bool(Argument<Bool> argument) Bool::Bool(Argument<Bool> argument)
{ {
materialize(); // FIXME(b/129757459)
storeValue(argument.value); storeValue(argument.value);
} }
...@@ -164,6 +165,7 @@ namespace rr ...@@ -164,6 +165,7 @@ namespace rr
Byte::Byte(Argument<Byte> argument) Byte::Byte(Argument<Byte> argument)
{ {
materialize(); // FIXME(b/129757459)
storeValue(argument.value); storeValue(argument.value);
} }
...@@ -421,6 +423,7 @@ namespace rr ...@@ -421,6 +423,7 @@ namespace rr
SByte::SByte(Argument<SByte> argument) SByte::SByte(Argument<SByte> argument)
{ {
materialize(); // FIXME(b/129757459)
storeValue(argument.value); storeValue(argument.value);
} }
...@@ -666,6 +669,7 @@ namespace rr ...@@ -666,6 +669,7 @@ namespace rr
Short::Short(Argument<Short> argument) Short::Short(Argument<Short> argument)
{ {
materialize(); // FIXME(b/129757459)
storeValue(argument.value); storeValue(argument.value);
} }
...@@ -904,6 +908,7 @@ namespace rr ...@@ -904,6 +908,7 @@ namespace rr
UShort::UShort(Argument<UShort> argument) UShort::UShort(Argument<UShort> argument)
{ {
materialize(); // FIXME(b/129757459)
storeValue(argument.value); storeValue(argument.value);
} }
...@@ -2119,6 +2124,7 @@ namespace rr ...@@ -2119,6 +2124,7 @@ namespace rr
Int::Int(Argument<Int> argument) Int::Int(Argument<Int> argument)
{ {
materialize(); // FIXME(b/129757459)
storeValue(argument.value); storeValue(argument.value);
} }
...@@ -2503,6 +2509,7 @@ namespace rr ...@@ -2503,6 +2509,7 @@ namespace rr
UInt::UInt(Argument<UInt> argument) UInt::UInt(Argument<UInt> argument)
{ {
materialize(); // FIXME(b/129757459)
storeValue(argument.value); storeValue(argument.value);
} }
...@@ -3662,6 +3669,7 @@ namespace rr ...@@ -3662,6 +3669,7 @@ namespace rr
Float::Float(Argument<Float> argument) Float::Float(Argument<Float> argument)
{ {
materialize(); // FIXME(b/129757459)
storeValue(argument.value); storeValue(argument.value);
} }
......
...@@ -2626,6 +2626,7 @@ namespace rr ...@@ -2626,6 +2626,7 @@ namespace rr
template<class T> template<class T>
Pointer<T>::Pointer(Argument<Pointer<T>> argument) : alignment(1) Pointer<T>::Pointer(Argument<Pointer<T>> argument) : alignment(1)
{ {
LValue<Pointer<T>>::materialize(); // FIXME(b/129757459)
LValue<Pointer<T>>::storeValue(argument.value); LValue<Pointer<T>>::storeValue(argument.value);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment