Make RoutineT::getEntry() type safe

RoutineT::getEntry() now returns the actual function pointer type,
rather than void*.

Also rename "callable" to "function", since a callable is a function-
like object (like RoutineT), while getEntry() returns a C function.

Bug: b/143479561
Change-Id: I879b7f9aa13d05d31390596e5e0c5b23f7f80d7d
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/51968
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Reactor/Routine.hpp b/src/Reactor/Routine.hpp
index 1c0ae1f..eb8929d 100644
--- a/src/Reactor/Routine.hpp
+++ b/src/Reactor/Routine.hpp
@@ -28,7 +28,7 @@
 	virtual const void *getEntry(int index = 0) const = 0;
 };
 
-// RoutineT is a type-safe wrapper around a Routine and its callable entry, returned by FunctionT
+// RoutineT is a type-safe wrapper around a Routine and its function entry, returned by FunctionT
 template<typename FunctionType>
 class RoutineT;
 
@@ -36,6 +36,8 @@
 class RoutineT<Return(Arguments...)>
 {
 public:
+	using FunctionType = Return (*)(Arguments...);
+
 	RoutineT() = default;
 
 	explicit RoutineT(const std::shared_ptr<Routine> &routine)
@@ -43,30 +45,29 @@
 	{
 		if(routine)
 		{
-			callable = reinterpret_cast<CallableType>(const_cast<void *>(routine->getEntry(0)));
+			function = reinterpret_cast<FunctionType>(const_cast<void *>(routine->getEntry(0)));
 		}
 	}
 
 	operator bool() const
 	{
-		return callable != nullptr;
+		return function != nullptr;
 	}
 
 	template<typename... Args>
 	Return operator()(Args &&... args) const
 	{
-		return callable(std::forward<Args>(args)...);
+		return function(std::forward<Args>(args)...);
 	}
 
-	const void *getEntry() const
+	const FunctionType getEntry() const
 	{
-		return reinterpret_cast<void *>(callable);
+		return function;
 	}
 
 private:
 	std::shared_ptr<Routine> routine;
-	using CallableType = Return (*)(Arguments...);
-	CallableType callable = nullptr;
+	FunctionType function = nullptr;
 };
 
 }  // namespace rr