Merge identical shader instances within a group.

In complex shader networks/groups, sometimes there are (inadvertently,
for convenience, or as an artifact of the lookdev tools) multiple
nodes/layers that are exact copies of each other.  For example, at SPI,
our character shaders are often organized into sub-nets for conceptual
"layers" (skin, oil, wet, etc.), each of which is structurally similar
and often may contain true redundancies including texture-reading
shaders that reference the same textures at the same coordinates.

This patch adds code that searches shader networks for pairs of shaders
that are identical -- same code, same parameter values, same upstream
connections, etc. -- and eliminate the redundant one, redirecting
downstream connections from the excised one to the retained one.

The cost for this is small: 3-4 seconds for our very complex scenes that
take many hours to render.  The results vary from scene to scene;
sometimes there's no change, but other shots have up to a 20%
improvement in both time and memory.

This new optimization can be disabled by setting the attribute
"opt_merge_instances" to 0.
oslc: Array indexing of undeclared variable hit an assertion.

This could happen for constructs like float 'float a = b[0]', if b was
never declared at all. The real error is use of undeclared 'b', but in
the chain of events that followed, it hit an assertion.
spline("constant") -- interpolate with discrete steps
Attribute "opt_layername" lets you arrange to optimize only one layer.
Improve debug info when dumping symbols
Fix subtle optimizer bug -- add_constant and replace_param_value type issues

Both of these methods took void*'s and assumed that the types of the
blind data had to match the known type where it was to be
copied. Unfortunately, there was a particular series of optimization
steps that could lead to these functions being applied to a "A=B"
instruction where A and B differed in type. In the case I was chasing
down, it was a float=int problem, and the int value was just being
memcpy'd rather than properly converted to a float. So I overhauled both
of these methods to handle the float=int, triple=float, and triple=int
cases, as well as more robustly catching any other cases that it fails
to handle.
Merge pull request #185 from lgritz/lg-optbug

Fix subtle runtime optimization bug
Bug fix in instance merging -- be careful of empty shader groups.
isconnected(var) queries whether var is an upstream-connected parameter.

This was a request from our Shading department, who wanted the ability
to write shader nodes that had logic that differed based on whether the
node was connected to upstream components or not.
Rebuild PDF docs
Allow whole-array assignment:  array1 = array2
Fix: Mistakenly compared to "xyz" for "XYZ" color space.
Minor refactor: split huge runtimeoptimize.cpp -> constfold.cpp
Subtle bug fix in how we "skip" inserted opcodes: we still need to clear
block aliases for args written by the ops we skip, or our notion of
which values are in which variables will be wrong.  This was not
reported as a bug, I just happened to notice it as I was working on
something else.
Constant folding of getattribute()

If both the attribute and object names are constants (and the object
name is non-empty). This is especially handy for shaders that use
getattribute() to query global renderer options.  If this behavior is
not desired (e.g., in a renderer where users are free to alter global
options without wanting to invalidate an optimized shader), just set the
ShadingSystem attribute "opt_fold_getattribute" to 0 (it defaults to 1).

Successes are folded -- they are expected to return the identical
results at shade time.  But failures during the speculative
optimization-time getattribute call are not folded, since it's possible
that they won't be failures at shade time.  We allow renderers to be
very flexible with what kind of information can be queried with
getattribute and how the renderer finds that data, and currently the
RendererServices API doesn't have a way to distinguish between "the
query will definitely fail" versus "I don't know yet whether it can
succeed at runtime."  This is something we can revisit in the future if
we find the need to fold getattribute even more aggressively.  But at
this point, the queries we desperately wanted to be folding were ones
that are guaranteed to succeed (mostly asking for global renderer
options).
Fix getattribute constant folding logic: check for empty string only AFTER
we make sure it's a constant (or else the data field won't be non-NULL).
Allow convert_value to handle uint8->int conversions, previously ignored.
This allows our renderer to properly convert native 'bool' values
retrieved by getattribute() into OSL int variables.
Simplify the logic of SS::convert_value
Merge pull request #193 from lgritz/lg-getattrib

Allow convert_value to handle uint8->int conversions, previously ignored.
OSL strtoi, strtof, split