Visit parent contexts in disassociate_from_playback

My libgccjit port of GNU Octave's JIT was segfaulting due to corruption
of playback::location values when running Octave's JIT unittests.  After
lots of debugging, I found that recording::locations in a parent context
weren't having their playback::locations cleaned away between compiles,
and hence continue to point to a GC-allocated object for which no marking
is performed (by design: these objects aren't meant to outlive the compile
and hence should always be collected).

Hence we have pointers to supposedly-dead objects that don't get NULLed,
and point to bytes that eventually get repurposed by the GC, leading
to crashes.

The fix is to ensure that when clearing the playback objects from all
recording objects we visit those in parent contexts (and above), and not
just those in the bottommost context.

This bug was elusive, since most recording classes blithely
overwrite the old invalid pointers on replay, but recording::location
checks for a pre-existing playback::location (since
gcc_jit_context_dump_to_file can lead to playback::locations being needed
before they would normally be created), and can thus reuse the now-invalid
pointer - provided it's in a parent context.

We can reproduce this bug by using gcc_jit_context_dump_to_file in
test-nested-contexts.c on each context, to set up fake "source locations"
on the various entities in each context.  Doing so also gives us test
coverage of that function.

gcc/jit/
	* internal-api.c (gcc::jit::recording::context::
	disassociate_from_playback): Recursively visit parent contexts.

gcc/testsuite/
	* jit.dg/test-nested-contexts.c (main): Dump the contexts to
	files, setting up source locations, and adding test coverage for
	gcc_jit_context_dump_to_file.
Tweaks to location-handling

gcc/jit/
	* internal-api.c (gcc::jit::playback::context::handle_locations):
	Add a disabled call to line_table_dump, in case it's handy for
	debugging in the future.
	(gcc::jit::playback::context::set_tree_location): Assert that
	the location is non-NULL.
	(gcc::jit::playback::location::location): Initialize m_src_loc
	to UNKNOWN_LOCATION.  This field should always be overwritten by
	handle_locations before use, but given recent issues with bogus
	locations it seems safer to initialize it.
Add creating globals to C++ wrapper API

gcc/jit/
	* libgccjit++.h (gccjit::context::new_global): New.
Reorganize jit.dg/test-functions.c

gcc/testsuite/
	* jit.dg/test-functions.c: Reorder function definitions, grouping
	them by subject-matter rather than by create-vs-verify phase.
Add GCC_JIT_FUNCTION_ALWAYS_INLINE and fix GCC_JIT_FUNCTION_INTERNAL.

gcc/jit/
	* libgccjit.h (enum gcc_jit_function_kind): Add
	GCC_JIT_FUNCTION_ALWAYS_INLINE.
	* internal-api.c (gcc::jit::recording::function::write_to_dump):
	Handle GCC_JIT_FUNCTION_ALWAYS_INLINE.
	(gcc::jit::playback::context::new_function): Likewise.
	(gcc::jit::playback::context::postprocess): Handle
	GCC_JIT_FUNCTION_INTERNAL and GCC_JIT_FUNCTION_ALWAYS_INLINE by
	clearing DECL_EXTERNAL and TREE_PUBLIC.  Doing so fixes the
	"undefined symbol" bug seen with GCC_JIT_FUNCTION_INTERNAL.
	* TODO.rst: Update.

gcc/testsuite/
	* jit.dg/test-functions.c (create_test_of_hidden_function): New,
	adding test coverage for GCC_JIT_FUNCTION_ALWAYS_INLINE and
	GCC_JIT_FUNCTION_INTERNAL.
	(create_tests_of_hidden_functions): Likewise.
	(verify_hidden_functions): Likewise.
	(create_code): Add call to create_tests_of_hidden_functions.
	(verify_code): Add call to verify_hidden_functions.
	* jit.dg/test-quadratic.c (make_calc_discriminant): Convert
	from GCC_JIT_FUNCTION_EXPORTED to GCC_JIT_FUNCTION_INTERNAL.