Define constant retrieval in header file

Allows for inline constant retrieval where this is used. Improves the
constant access benchmark slightly when running in the interpreter.