2021-02-23  Luca Saiu  <positron@gnu.org>

	build system fix

	* configure.ac (JITTER_BUILDING_FROM_GIT): Redefine Automake conditional also
	accepting the existence of a *file* named $(srcdir)/.git , rather than a
	directory: a file will be used when the Jitter source directory is in a git
	submodule.

2021-02-23  Luca Saiu  <positron@gnu.org>

	fix ChangeLog generation dist hook

	* Makefile.am (dist-hook-changelog): Copy ChangeLog to the dist directory.

2021-02-23  Luca Saiu  <positron@gnu.org>

	avoid generating CPP directives (#line) within CPP macro arguments

	Thanks to Bruno Haible for the report.

	* jitterc/jitterc-generate.c (jitterc_emit_hash_line): New argument; add
	comment.  Change callers.

2021-02-23  Luca Saiu  <positron@gnu.org>

	do not delete generated example C files on distclean

	Suggested by Bruno Haible.  Thanks.

	* Makefile (clean-local, distclean-local, maintainer-clean-local): Delete
	generated example C files only on maintainer-clean.

2021-02-23  Luca Saiu  <positron@gnu.org>

	require label address differences to be constant expressions for direct threading

	This should fix TCC and some other compiler supporting GNU C computed goto, but
	where label address subtractions (even for labels in the same function) are not
	considered constant expressions.  The fix is, currently, disabling direct
	threading; in the future it should not be difficult to do better and just
	preventing disassembly.

	* configure.ac (ac_cv_have_gnu_c_constant_label_difference): New shell variable.
	New test defining it.
	(JITTER_HAVE_GNU_C_CONSTANT_LABEL_DIFFERENCE): New CPP feature macro.
	(default) <direct-threading enabling>: Change default to no if
	ac_cv_have_gnu_c_constant_label_difference is not yes.  Update help string.

	* jitter/jitter-config.h.in (JITTER_HAVE_GNU_C_CONSTANT_LABEL_DIFFERENCE): New
	CPP feature macro.

2021-02-23  Luca Saiu  <positron@gnu.org>

	do not unconditionally emit code using the GNU C address-of-label operator

	Thanks to Bruno Haible for his bug report.

	* jitterc/jitterc-generate.c (jitterc_emit_executor_main_function):
	Conditionalise code relying on computed goto.

2021-02-23  Luca Saiu  <positron@gnu.org>

	do not distribute generated file jitter/jitter-config.h

	Thanks to Bruno Haible for his bug report -- which I had initially mistook as
	describing something different from a Jitter bug.  This fix should also be very
	similar to his proposal.

	* Makefile.am (nodist_jitterinclude_HEADERS): New variable.
	(SOURCES_FOR_LIBJITTER, jitterinclude_HEADERS): Remove jitter/jitter-config.h.
	(SOURCES_FOR_LIBJITTER_NODIST): New variable.
	(nodist_jitterinclude_HEADERS): Add to new variable.
	(lib_libjitter__switch__partial_la_SOURCES)
	(lib_libjitter__direct_threading__partial_la_SOURCES)
	(lib_libjitter__minimal_threading__partial_la_SOURCES)
	(lib_libjitter__no_threading__partial_la_SOURCES): Use new variable
	SOURCES_FOR_LIBJITTER_NODIST.  Fill.
	(dist-hook): New dependency dist-hook-remove-nodist-sources.
	(dist-hook-remove-nodist-sources): New rule.

2021-02-22  Luca Saiu  <positron@gnu.org>

	jitterc parser: rename TRUE and FALSE tokens to TRUE_ and FALSE_

	On some obscure configurations TRUE and FALSE are predefined CPP macros.
	What is worse, Bison (I guess for Yacc compatibility) turns token names
	into unprefixed CPP macros as well.  Prevent clashes

	Thanks to Bruno Haible for his bug report.

	* jitterc/jitterc.y (TRUE, FALSE): Rename to TRUE_, FALSE_.  Add comment.
	* jitterc/jitterc.l: Use new tokens.

2021-02-22  Luca Saiu  <positron@gnu.org>

	documentation

	* THANKS: Documentation.

2021-02-22  Luca Saiu  <positron@gnu.org>

	do not explicitly define RANLIB and AR

	My way of doing this was complicated but ultimately incorrect on some unusual
	configurations (thanks to Bruno Haible for his bug report); moreover my
	technique was only beneficial with LTO, which is a bad fit for Jitter anyway.

	* configure (RANLIB, AR): Do not define.  Update comments.

2021-02-21  Luca Saiu  <positron@gnu.org>

	configure: rename generated object file, clean it up correctly

	Bug reported by Bruno Haible.  Thanks!

	* configure.ac (jitter_check_cc_option): Rename test.o to conftest.o, following
	the naming pattern for files generated by Autoconf tests.  Clean it up in case
	it gets in fact generated with success.

2021-02-21  Luca Saiu  <positron@gnu.org>

	build system: avoid grep -q, which is not portable

	Reported by Bruno Haible.  Thanks.

	* bin/jitter-config.in.m4sh: Use grep with redirection instead of grep -q.
	* example-build-systems/structured-simple/configure.ac: Likewise.
	* example-build-systems/structured-with-library/configure.ac: Likewise.
	* tests/jitterlisp/jitterlisp.test.in: Likewise.

2021-02-21  Luca Saiu  <positron@gnu.org>

	documentation changes

	* doc/jitter.texi: Documentation.
	* doc/missing-man-page.1: Documentation.
	* example-vms/jitterlisp/doc/jitterlisp.texi: Documentation.

2021-02-21  Luca Saiu  <positron@gnu.org>

	check that the C compiler compiling a VM is the same known by configure

	* jitter/jitter-c-compiler-version.h: New file.

	* jitter/jitter.h: Include new file.
	Change unrelated comment.

	* Makefile.am (SOURCES_FOR_LIBJITTER, jitterinclude_HEADERS): Add new file.

2021-02-21  Luca Saiu  <positron@gnu.org>

	configure: bug fix, update user message

	* configure.ac (test for GCC): use the x$varaible style.  Update user message.
	(test for actual GCC): bug fix: compare "x$GCC" with 'x' instead of an empty
	string.

2021-02-21  Luca Saiu  <positron@gnu.org>

	comment changes

	* jitter/jitter-config.h.in: Comment changes.

2021-02-21  Luca Saiu  <positron@gnu.org>

	jitter-cpp: add local poisoning definitions

	* jitter/jitter-cpp.h: (JITTER_PRAGMA, JITTER_PRAGMA_WARN_WITH_REASON)
	(JITTER_POISONED_IN_ANY_INSTRUCTION, JITTER_POISONED_IN_RELOCATABLE_INSTRUCTION)
	(JITTER_POISONED_IN_NON_BRANCHING_INSTRUCTION, JITTER_FORBIDDEN_EXPRESSION)
	(JITTER_FORBIDDEN_EXPRESSION_IN_RELOCATABLE)
	(JITTER_FORBIDDEN_EXPRESSION_IN_NON_BRANCHING): New macros.
	Comment.

2021-02-21  Luca Saiu  <positron@gnu.org>

	minor optimisation in remainder "overflow" check

	It is possible that the syntax infrastructure introduced here might be
	beneficial for other more important operations as well in the future.

	* jitter/jitter-arithmetic.h (JITTER_WOULD_REMAINDER_NOT_OVERFLOW): New macro.

	* scripts/generate-fast-branches.in.m4sh (emit_overflowing_operations):
	[JITTER_WOULD_${macroized_operation}_NOT_OVERFLOW]
	New macro in generated code,
	_JITTER_C_CONDITION_${macroized_operation}_DOES_NOT_OVERFLOW_.
	Define _JITTER_LOW_LEVEL_BRANCH_FAST_IF_${macroized_operation}_OVERFLOWS_, again
	in generated code, conditionally, using the new macro if available.
	Comments.

2021-02-21  Luca Saiu  <positron@gnu.org>

	introduce macros for word size in chars and in bits

	* jitter/jitter.h (JITTER_WORD_CHAR_NO, JITTER_WORD_BIT_NO): New macros.
	Use new macros.

2021-02-21  Luca Saiu  <positron@gnu.org>

	jitterlisp: minor factoring

	* example-vms/jitterlisp/jitterlisp-sexpression.h
	(JITTERLISP_FIXNUM_MOST_NEGATIVE, JITTERLISP_FIXNUM_MOST_POSITIVE): Redefine.

2021-02-21  Luca Saiu  <positron@gnu.org>

	update --version messages

	Make the messages prettier and move the closed parentheses in the first line to
	make the output easy to parse, following the GNU coding standards.  Update the
	printed copyright year.

2021-02-21  Luca Saiu  <positron@gnu.org>

	improve JitterLisp style file

	* example-vms/jitterlisp/jitterlisp-style.css (jitterlisp-banner)
	(jitterlisp-banner-feature-name, jitterlisp-banner-feature-value)
	(jitterlisp-log): Change whitespace, redefine.
	(jitterlisp-banner-feature-warning): New class

2021-02-21  Luca Saiu  <positron@gnu.org>

	fix incorrect comment

	* jitter/jitter-sections.h (JITTER_ASM_ENTER_SUBSECTION_GAS): Fix comment.

2021-02-21  Luca Saiu  <positron@gnu.org>

	disassemble: minor changes

	* jitter/jitter-disassemble.c (jitter_executable_routine_disassemble): Use
	styling.
	(jitter_executable_routine_disassemble): Update comments.  Omit threading
	label with no-threading dispatch.

2021-02-21  Luca Saiu  <positron@gnu.org>

	improve error message

	* machine/x86_64/jitter/machine/jitter-machine-c.c
	(jitter_patch_load_immediate_to_register): Add information to error message.

2021-02-21  Luca Saiu  <positron@gnu.org>

	patch-in, defects, locations: use basic asm instead of extended asm

	* jitter/jitter-data-locations.h (JITTER_DATA_LOCATION_HEADER)
	(JITTER_DATA_LOCATION_FOOTER): Redefine.

	* jitter/jitter-defect.h (JITTER_DEFECT_HEADER, JITTER_DEFECT_FOOTER): Redefine.

	* jitter/jitter-patch-in.h (JITTER_PATCH_IN_HEADER, JITTER_PATCH_IN_FOOTER):
	Redefine.

2021-02-21  Luca Saiu  <positron@gnu.org>

	fix incorrect comment

	* jitter/jitter-patch-in.c (jitter_make_patch_in_table): Fix incorrect comment.

2021-02-21  Luca Saiu  <positron@gnu.org>

	define replacement for no_reorder or __no_reorder__ where missing

	* jitter/jitter-missing.h [! JITTER_HAVE_ATTRIBUTE_NO_REORDER] (no_reorder)
	[! JITTER_HAVE_ATTRIBUTE_NO_REORDER] (__no_reorder__): New macros.

2021-02-21  Luca Saiu  <positron@gnu.org>

	update Emacs mode

	* emacs/jitter-mode.el (jitter-font-lock-keywords): Recognise new syntax.

2021-02-21  Luca Saiu  <positron@gnu.org>

	minor generate-fast-branches change

	* scripts/generate-fast-branches.in.m4sh (emit_low_level): Emit #undef.

2021-02-21  Luca Saiu  <positron@gnu.org>

	fix fallback division and remainder overflow checks

	* jitter/jitter-arithmetic.h (JITTER_WOULD_DIVIDED_OVERFLOW)
	(JITTER_WOULD_REMAINDER_OVERFLOW): Redefine.

2021-02-21  Luca Saiu  <positron@gnu.org>

	test suite improvements

	* tests/utility.in (jitter_timeout): Change default, update comments.

2021-02-21  Luca Saiu  <positron@gnu.org>

	manual: add stubs

	* doc/jitter.texi: Documentation

2021-02-21  Luca Saiu  <positron@gnu.org>

	build system, jitter-config: minor changes

	* amend-autom4te-output (--help): Use JITTER_PACKAGE_URL and
	JITTER_PACKAGE_BUGREPORT.
	* bin/jitter-config.in.m4sh (version): Update printed copyright notice.
	(--help): Improve user message.

2021-02-21  Luca Saiu  <positron@gnu.org>

	stacks: add backing reset function

	This functionality will be used in a forthcoming change set.  The idea is that
	resetting a VM state can be much faster than finalising and then re-initialising
	an existing state.

	* jitter/jitter-stack.h (jitter_stack_reset_backing): New prototype.

	* jitter/jitter-stack.c (jitter_stack_reset_backing): New function.
	(jitter_stack_initialize_backing): Change, using new function.

2021-02-21  Luca Saiu  <positron@gnu.org>

	documentation

	* doc/jitter.texi: Documentation.

2021-02-21  Luca Saiu  <positron@gnu.org>

	configure: check for "asm inline" GNU C syntax

	* configure.ac: Check for GNU C's asm inline, a relatively recent GCC feature.
	(ac_cv_have_gnu_c_asm_inline): New shell variable.
	(JITTER_HAVE_GNU_C_ASM_INLINE): New CPP feature macro.

	* jitter/jitter-config.h.in (JITTER_HAVE_GNU_C_ASM_INLINE): New feature macro.

2021-02-21  Luca Saiu  <positron@gnu.org>

	cosmetic change

	* jitter/jitter-mutable-routine.c (jitter_mutable_routine_print): Use
	jitter_digit_no_radix_10 instead of a temporary barbaric hack.

2021-02-21  Luca Saiu  <positron@gnu.org>

	add count-primes benchmarking example, in Structured and in C

	* example-vms/structured/examples/count-primes.structured: New file.
	* example-vms/structured/examples/count-primes.c: New file.

	* Makefile.am (EXTRA_PROGRAMS): Add new program.
	(EXTRA_DIST): Distribute new files.
	(example_vms_structured_examples_count_primes_in_c_SOURCES): New definition.

	* example-build-systems/structured-simple/Makefile.am (EXTRA_PROGRAMS): Add new
	program.
	(EXTRA_DIST): Distribute new files.
	(examples_count_primes_in_c_SOURCES): New definition.

	* example-build-systems/structured-with-library/Makefile.am (EXTRA_PROGRAMS):
	Add new program.
	(EXTRA_DIST): Distribute new files.  Distribute structured-style.css, that I had
	forgotten to mention before.
	(examples_count_primes_in_c_SOURCES): New definition.

2021-01-11  Luca Saiu  <positron@gnu.org>

	vm-main template: fix include order

	Thanks to Mohammad-Reza Nabipoor for reporting this bug.

	* templates/vm-main.c: Include jitter/jitter.h before checking for
	JITTER_HAVE_SETRLIMIT, which is defined by a header included by
	jitter/jitter.h.

2021-01-11  Luca Saiu  <positron@gnu.org>

	documentation

	* README: Documentation.
	* THANKS: Documentation.
	* AUTHORS: Documentation.

2021-01-03  Luca Saiu  <positron@gnu.org>

	mips r6: support literal materialisation with addiupc

	* machine/mips/jitter/machine/jitter-machine.h (enum jitter_snippet_to_patch)
	[r6]: New cases jitter_snippet_load_pcrel_address_to_register_0,
	jitter_snippet_load_pcrel_address_to_register_1,
	jitter_snippet_load_pcrel_address_to_register_2,
	jitter_snippet_load_pcrel_address_to_register_3,
	jitter_snippet_load_pcrel_address_to_register_4,
	jitter_snippet_load_pcrel_address_to_register_5.

	* machine/mips/jitter/machine/jitter-machine-assembly.S [r6]
	(LOAD_PCREL_ADDRESS_TO_REGISTER): New macro.
	(load_pcrel_address_to_register_0, load_pcrel_address_to_register_1)
	(load_pcrel_address_to_register_2, load_pcrel_address_to_register_3)
	(load_pcrel_address_to_register_4, load_pcrel_address_to_register_5): New
	snippets.

	* machine/mips/jitter/machine/jitter-machine-c.c (struct
	jitter_mips_21_bit_immediate_instruction): New type.
	(jitter_snippet_for_loading_register) [r6]: Check for a case where to use the new
	snippet.
	(jitter_patch_load_immediate_to_register) [r6]: Patch the new snippet.

2021-01-03  Luca Saiu  <positron@gnu.org>

	factor MIPS assembly

	* machine/mips/jitter/machine/jitter-machine-assembly.S: Fix a comment.
	(LOAD_ZERO_EXTENDED_16BIT_TO_REGISTER, LOAD_SIGN_EXTENDED_16BIT_TO_REGISTER)
	(LOAD_32BIT_TO_REGISTER): New macros.  Use the macros.

2021-01-01  Luca Saiu  <positron@gnu.org>

	documentation stub change

	* example-vms/jitterlisp/doc/jitterlisp.texi: Manual.

2020-12-31  Luca Saiu  <positron@gnu.org>

	profile: change style classes

	Use the following classes to print profiles, as usual with "vmprefix" replaced
	by the name of the VM:
	  - "vmprefix-warning";
	  - "vmprefix-profile-instruction";
	  - "vmprefix-profile-execution-count";
	  - "vmprefix-profile-run-time";
	  - "vmprefix-profile-time-ratio".
	Update example styles.

	* jitter/jitter-profile.h (jitter_profile_print): Change comment, introducing
	the new classes.
	jitter/jitter-profile.c (jitter_profile_print): Use the new classes.

	* example-vms/jitterlisp/jitterlisp-style.css: Define classes.
	* example-vms/structured/structured-style.css: Likewise.
	* example-vms/uninspired/uninspired-style.css: Likewise.

2020-12-31  Luca Saiu  <positron@gnu.org>

	jitterlisp: fix old GC stub code

	* example-vms/jitterlisp/jitterlisp.jitter (primitive-cons-special)
	[JITTER_GC_STUB]: Use JITTER_STATE_RUNTIME_FIELD correctly.  This example was
	written before the new Jitter GC, but the generated code is consistent with it.

2020-12-31  Luca Saiu  <positron@gnu.org>

	change user message

	When printing a profile with profiling disabled, show a warning message advising
	the user to recompile with *both* JITTER_PROFILE_COUNT and JITTER_PROFILE_SAMPLE
	defined, rather than just "one of" them.  Having both macros defined at the same
	time is the most common and most useful scenario.

	* jitter/jitter-profile.c (jitter_profile_print_uninstrumented): Change user
	message.

2020-12-30  Luca Saiu  <positron@gnu.org>

	make profile structs from runtime profile structs even with profiling off

	* jitter/jitter-profile.c (jitter_profile_make_empty): New static function.
	(jitter_profile_from_runtime): Use new function.

2020-12-28  Luca Saiu  <positron@gnu.org>

	fix jitter_dispatch_label bug

	Make sure that a label jitter_dispatch_label is defined with any dispatch, as
	required by profiling instrumentation.

	This fixes a bug reported by José Marchesi.  Thanks José.

	* jitter/jitter-executor.h [JITTER_DISPATCH_SWITCH] (jitter_dispatch_label):
	Remove the macro.  Change it into a real label...

	* jitterc/jitterc-generate.c (jitterc_emit_executor_main_function): ...Here.
	Emit the jitter_dispatch_label label unconditionally, even if it is in fact
	always unreachable.  For switch dispatch make it branch (goto) to the real
	dispatch label.  For the other dispatches it branch (goto *) to ip.
	Of course there is no real threaded ip with no-threading, but as
	usual I fool the compiler into using the base as if it were ip,
	in order to have something with an unpredictable value, and without using any
	other register.

2020-12-28  Luca Saiu  <positron@gnu.org>

	profiling instrumentation: relax ordering requirements

	After the previous fix I understood that, in fact, only sample-profiling
	instrumentation code needs to be executed before user code.  The count-profiling
	part can be freely reordered without affecting the profile accuracy; if this
	achieves better throughput by exploiting instruction-level-parallelism, good.
	In fact allowing this optimisation might better approximate the performance of a
	non-profiled run, which is desirable.

	Require GCC only for sample-profiling: count-profiling (only) is now supported
	with any compiler.

	* jitterc/jitterc-generate.c
	(jitterc_emit_executor_ordinary_specialized_instructions) <profile
	instrumentation>: Move JITTER_PRETEND_TO_POSSIBLY_JUMP_ANYWHERE to the
	conditional checking for sample-profiling.  Move the conditional checking for
	count-profiling after that point.

	* templates/vm1.c: Require GCC only if sample-profiling.

2020-12-28  Luca Saiu  <positron@gnu.org>

	profiling instrumentation ordering bug fix

	* jitterc/jitterc-generate.c
	(jitterc_emit_executor_ordinary_specialized_instructions) <profile
	instrumentation>: Check the definition of either one macro of the other in the
	preprocessor conditional, instead of the same one twice.

2020-12-28  Luca Saiu  <positron@gnu.org>

	fix comment

	* jitter/jitter-profile.h: Comment.

2020-12-28  Luca Saiu  <positron@gnu.org>

	profiling: force instrumentation instructions to be emitted before user code

	This makes profiling numbers more reliable.  It is still not perfect since
	the instrumentation code is still generated after residual materialisation,
	but the numbers will be more accurate now.

	* jitterc/jitterc-generate.c
	(jitterc_emit_executor_ordinary_specialized_instructions) <profiling
	instrumentation>: Emit JITTER_PRETEND_TO_POSSIBLY_JUMP_ANYWHERE when
	profiling, in order to prevent instruction reordering.

	* templates/vm1.c: On profiling, fail with a clear error message if
	not using GCC.  The use of JITTER_PRETEND_TO_POSSIBLY_JUMP_ANYWHERE,
	above, limits portability of profiled code.

2020-12-28  Luca Saiu  <positron@gnu.org>

	make JITTER_PRETEND_TO_POSSIBLY_JUMP_ANYWHERE usable with switch dispatching

	I am about to use it, in the next change set.  The fact that the expansion
	requires GNU C will not be a problem.

	* jitter/jitter-executor.h [JITTER_DISPATCH_SWITCH] (jitter_dispatch_label):
	Define as a macro, for compatibility with the other dispatches, to be used...
	(JITTER_PRETEND_TO_POSSIBLY_JUMP_ANYWHERE): ...Here.  Rename the asm operand
	from jitter_ip to _jitter_ip, to prevent macroexpansion.

2020-12-26  Luca Saiu  <positron@gnu.org>

	introduce sample profiling (incompatible profiling API change)

	No longer recognise JITTER_INSTRUMENT_FOR_PROFILING.  In its place there are now
	two different CPP macros which can be defined independently:
	JITTER_PROFILE_COUNT and JITTER_PROFILE_SAMPLE.  The two kinds of profiling work
	well together, but it is also possible to use only one.
	It is now possible to profile specialised or unspecialised VM instructions.
	Rationalise user API, with the intent of keeping it stable.
	Sample-profiling is still limited to one thread or state at a time; this
	restriction can be lifted later without changing the user API.
	Update examples.

	* configure.ac: Check for function setitimer.  New prefixed CPP feature macro
	JITTER_HAVE_SETITIMER.
	* jitter/jitter-config.h.in: New CPP feature macro JITTER_HAVE_SETITIMER.

	* jitter/jitter-profile.c: Rewrite.
	* jitter/jitter-profile.h: Rewrite.

	* jitter/jitter-vm.h (jitter_vm_instrumentation): New type.
	(struct jitter_vm_configuration): Replace bool field profile_instrumented with
	new enumerate field instrumentation.
	(struct jitter_vm): New field
	specialized_instruction_to_unspecialized_instruction.

	* jitter/jitter-vm.c (jitter_vm_instrumentation_to_string): New function.
	(jitter_print_vm_configuration): Use new function.

	* jitterc/jitterc-generate.c
	(jitterc_emit_specialized_instruction_to_unspecialized_instruction): New
	function.
	(jitterc_emit_executor_ordinary_specialized_instructions): Change profiling
	generated code.
	(jitterc_emit_executor_main_function): Likewise.
	(jitterc_generate): Call new function.

	* templates/vm-main.c (struct vmprefix_main_command_line): Replace bool field
	profile with two bool fields profile_specialized and profile_unspecialized.
	(enum vmprefix_vm_negative_option): Change options.  Renumber.
	(enum vmprefix_vm_long_only_option): Likewise.
	(parse_opt): Handle changed options.
	(static struct argp_option): Change options.
	(the_argp_program_version_hook): Print profiling kind.
	(main): Use new options.

	* templates/vm.h (struct jitter_special_purpose_state_data) Add comments.
	Remove field profile, replaced by profile_runtime, now a struct defined in
	the new jitter/jitter-profile.h.
	(vmprefix_specialized_instruction_to_unspecialized_instruction): New extern
	variable.
	Completely change profiling API.
	(vmprefix_profile_sample_initialize, vmprefix_profile_sample_start)
	(vmprefix_profile_sample_stop): New template prototypes.

	* templates/vm1.c: Whitespace.  Include sys/time.h.
	(vmprefix_vm_the_configuration): Change initialisation.
	(vmprefix_initialize_special_purpose_data)
	(vmprefix_finalize_special_purpose_data): Use new functions.
	(vmprefix_initialize): Initialise new field
	specialized_instruction_to_unspecialized_instruction.
	(vmprefix_timer_frequency, vmprefix_timer_disabled_frequency)
	(vmprefix_sample_profile_state): New static globals.
	(struct vmprefix_sample_profile_state): New types.
	(vmprefix_sigprof_handler, vmprefix_profile_sample_initialize)
	(vmprefix_profile_sample_start, vmprefix_profile_sample_stop): New functions.
	(vmprefix_make_place_for_slow_registers): Temporarily disable sampling if
	enabled on the state owning an Array being resized.
	Rewrite profiling API.

	* example-vms/jitterlisp/jitterlisp-main.c (the_argp_program_version_hook):
	Print the kind of profiling.

	* example-vms/jitterlisp/jitterlisp-primitives.c (primitives): Reimplement
	print_profile_specialized and reset_profileb.
	Implement print_profile_unspecialized.
	(jitterlisp_primitives): Add print-profile-unspecialized.

	* example-vms/structured/structured-main.c (structured_help): Change --help
	text.
	(structured_version): Print the kind of profiling.
	(struct structured_command_line): Replace field profile with two fields
	profile_specialized, profile_unspecialized.
	(structured_initialize_command_line): Change initialised fields.
	(structured_parse_command_line, structured_work): Hanlde changed options.

	* example-vms/jitterlisp/jitterlisp-banner.c: Include header.
	(jitterlisp_interactive_banner): print the kind of enabled profiling.

	* example-vms/jitterlisp/doc/jitterlisp.texi: Documentation.

2020-12-26  Luca Saiu  <positron@gnu.org>

	remove now spurious printed warning

	* jitter/jitter-data-locations.c (jitter_dump_data_locations): Do not
	print warning.

2020-12-26  Luca Saiu  <positron@gnu.org>

	minor changes in jitter.h

	* jitter/jitter.h: Include jitter/jitter-arithmetic.h.  Move inclusion of
	jitter/machine/jitter-machine.h down, allowing machine files to use the
	arithmetic header without it being expanded before the definition of
	jitter_int.

2020-12-26  Luca Saiu  <positron@gnu.org>

	arithmetic: add functions to compute the number of digits of an integer number

	* jitter/jitter-arithmetic.h (jitter_digit_no, jitter_digit_no_unsigned)
	(jitter_digit_no_radix_10, jitter_digit_no_unsigned_radix_10): New prototypes.

	* jitter/jitter-arithmetic.c: New file, implementing the functions above.

	* Makefile.am (lib_libjitterutility__partial_la_SOURCES): Add new file

2020-12-25  Luca Saiu  <positron@gnu.org>

	jitterlisp: fix type checking in optimised VM instruction (rewrite target)

	* example-vms/jitterlisp/jitterlisp.jitter (branch-if-register-non-zero): Check
	the register type, not the type of the TOS element.

2020-12-25  Luca Saiu  <positron@gnu.org>

	jitterlisp: fix test suite

	Omit littering warnings when testing with no GC: these interfere with the
	expected output, now that they are on stdout instead of stderr.

	* tests/jitterlisp/jitterlisp.test.in (jitterlisp_case_all_confs): Change
	options to always pass --no-verbose-litter.

2020-12-25  Luca Saiu  <positron@gnu.org>

	emit JITTER_VM_PREFIX_{LOWER,UPPER}_CASE in vm{1,2}.c

	Emit definitions for JITTER_VM_PREFIX_LOWER_CASE and JITTER_VM_PREFIX_UPPER_CASE
	in both vm1.c and vm2.c -- but not in any header, where they would make different
	VMs conflict with one another.

	This fixes switch dispatching, recently broken.

	* jitterc/jitterc-generate.c (jitterc_emit_vm_name_macros): Change argument and
	definition, in order to become the new common logic for...
	(jitterc_emit_vm_name_macros_vm1): New function, completely replacing the old
	definition.
	(jitterc_emit_vm_name_macros_vm2): New function.
	(jitterc_generate): Call both jitterc_emit_vm_name_macros_vm1 and
	jitterc_emit_vm_name_macros_vm2, to add the same code to different generated
	files.

2020-12-25  Luca Saiu  <positron@gnu.org>

	manual changes

	Add manual changes from the gc branch, before adding the garbage collector
	itself.  This will let me work more easily on other changes in the manual.

	* doc/jitter.texi: Documentation.

2020-12-25  Luca Saiu  <positron@gnu.org>

	profiling: print count ratios as well

	Print count ratios as a percentage.  This is still an execution count and does
	not measure the time spent executing each instruction.

	* jitter/jitter-profile.c (jitter_profile_print_specialized): Compute and print
	percentage.

2020-12-24  Luca Saiu  <positron@gnu.org>

	profiling cleanup and improvement

	Make the generated code more rational.  Use it better from examples.  Add
	profiling primitives to JitterLisp.
	Switch from argp_program_version to argp_program_version_hook in all the
	examples, in order to be able to print information about profiling -- doing that
	from a literal string is difficult, and the user must be informed: activating
	profile instrumentation by mistake would lead to surprisingly bad performance.

	In libjitter, do not conditionalise on JITTER_INSTRUMENT_FOR_PROFILING: this
	can be defined independently for each VM, which is important for an installed
	non-sub-package Jitter.

	* jitter/jitter-profile.h (jitter_profile_reset): New prototype.
	Comment changes.

	* jitter/jitter-profile.c (jitter_profile_make): Do not depend on
	JITTER_INSTRUMENT_FOR_PROFILING: use the VM instead.  Use jitter_profile_reset.
	(jitter_profile_reset): New function.
	(jitter_profile_merge_from): Do not depend on JITTER_INSTRUMENT_FOR_PROFILING:
	use the VM instead.
	(struct jitter_profile_item): New field count_as_text.
	(jitter_specialized_instruction_profile_items): Remove function attribute.  Set
	new struct field.
	(jitter_profile_item_compare, jitter_profile_items_sort): Remove funciton
	attribute.
	(JITTER_MAXIMUM_IN_ITEMS): New macro, factoring the next two new functions...
	(jitter_longest_name_in): ...Removed, turned into...:
	(jitter_maximal_name_length_in): ...New function.
	(jitter_maximal_count_width_in): New function.
	(jitter_profile_begin_class): Adapt to the change in struct jitter_vm.
	(jitter_profile_print_uninstrumented): New function, factoring code from...
	(jitter_profile_print_specialized):... Here.  Do not depend on
	JITTER_INSTRUMENT_FOR_PROFILING: use the VM instead.  Improve printed output.

	* jitter/jitter-vm.h (struct jitter_vm_configuration): Change comments.
	(dispatch): Rename field to dispatch_human_readable.
	(profile_instrumented): New field.
	(struct jitter_vm): Change field type for configuration, now a pointer.

	* jitter/jitter-vm.c (jitter_print_vm_configuration): Print profiling
	information.

	* jitter/jitter-data-locations.c (jitter_locations_begin_class): Adapt to the
	change in struct jitter_vm.
	* jitter/jitter-disassemble.c (jitter_disassemble_begin_class): Likewise.
	* jitter/jitter-mutable-routine.c (jitter_mutable_routine_begin_class): Likewise.

	* jitterc/jitterc-generate.c (jitterc_emit_vm_name, jitterc_emit_configuration):
	Remove functions.
	(jitterc_emit_configuration_macros): New function.
	(jitterc_emit_executor_main_function): Emit code checking CPPFLAGS consistency
	with respect to profiling in vm1.c and vm2.c.
	(jitterc_emit_executor, jitterc_generate): Remove calls to removed functions.
	Call new function.

	* templates/vm.h (vmprefix_profile_reset, vmprefix_profile_merge_from_state):
	New prototypes.

	* templates/vm1.c (vmprefix_vm_the_configuration): New static variable, not
	requiring initialisation from a function.
	(vmprefix_vm_configuration): Redefine.
	(vmprefix_initialize_vm_configuration): Remove forward-declaration.
	(vmprefix_initialize): Adapt to the change in struct jitter_vm; just set a
	pointer instead of the struct content, which is now statically initialised.
	(vmprefix_profile_reset, vmprefix_profile_merge_from_state): New functions.

	* templates/vm-main.c (argp_program_version): Remove.
	(the_argp_program_version_hook): New static function.
	(argp_program_version_hook): New variable.

	* example-vms/structured/structured-main.c (structured_help): Use
	structuredvm_vm_configuration.  Print profiling information.  Improve --help.
	(structured_version): Use structuredvm_vm_configuration.  Print profiling
	information.

	* example-vms/jitterlisp/jitterlisp-banner.c
	(jitterlisp_interactive_banner_text): Use a compact-form copyright notice for
	the interactive banner.
	(jitterlisp_interactive_banner): Use jitterlispvm_vm_configuration.  Print
	profiling information.

	* example-vms/jitterlisp/jitterlisp-main.c (argp_program_version): Remove.
	(the_argp_program_version_hook): New static function.
	(argp_program_version_hook): Define

	* example-vms/jitterlisp/jitterlisp-primitives.c (print_profile_specialized)
	(reset_profileb): New functions.
	(jitterlisp_primitives): New primitives print-profile-specialized,
	reset-profile!.

	* example-vms/jitterlisp/doc/jitterlisp.texi: Document new primitives

2020-12-24  Luca Saiu  <positron@gnu.org>

	examples: GNU libtextstyle styles cleanup

	* example-vms/jitterlisp/jitterlisp-style.css: Remove commented-out part.
	* example-vms/structured/structured-style.css (structuredvm-warning): New class.
	Remove commented-out part.
	* example-vms/uninspired/uninspired-style.css (uninspired-warning): New class.
	Remove commented-out part.

2020-12-24  Luca Saiu  <positron@gnu.org>

	add instrumentation support for instruction-count profiling

	Compile with -DJITTER_INSTRUMENT_FOR_PROFILING=1 in your CPPFLAGS in order to
	enable instrumentation for profiling.  Update main program in templates and in the
	structured example, showing how to use the feature.
	Right now only specialised instructions are profiled.  Support for unspecialised
	instructions is not difficult to implement, and will be added later.

	Feature requested by José Marchesi.

	* jitter/jitter-profile.h: New file.
	* jitter/jitter-profile.c: New file.

	* Makefile.am (SOURCES_FOR_LIBJITTER, jitterinclude_HEADERS): Add new files.

	* example-vms/structured/structured-main.c (structured_help): Update help user
	message.
	(struct structured_command_line): New field profile.
	(structured_initialize_command_line): Initialise new field.
	(structured_parse_command_line): Handle new options.
	(structured_work): Print profile if requested by the user.

	* jitterc/jitterc-generate.c
	(jitterc_emit_executor_ordinary_specialized_instructions): Emit instrumentation
	code as a macro call.

	* templates/vm-main.c (struct vmprefix_main_command_line): New field profile.
	(enum vmprefix_vm_negative_option): New case
	vmprefix_vm_negative_option_no_profile.  Renumber following cases.
	(enum vmprefix_vm_negative_option): New case
	vmprefix_vm_long_only_option_profile.  Renumber following cases.
	(parse_opt): Handle new struct field and new options.
	(vmprefix_main_option_specification): New options --profile, --no-profile.
	(main): Print profile if requested by the user.

	* templates/vm.h: Include new header.
	(struct jitter_special_purpose_state_data): New field profile.
	(vmprefix_profile, vmprefix_profile_destroy): New VM compatibility macros.
	(vmprefix_state_profile, vmprefix_profile_make, vmprefix_profile_merge_from)
	(vmprefix_profile_print_specialized): New VM compatibility prototypes.

	* templates/vm1.c (vmprefix_initialize_special_purpose_data): Initialise new
	field.
	(vmprefix_finalize_special_purpose_data): Finalise new field.
	(vmprefix_state_profile, vmprefix_profile_make, vmprefix_profile_merge_from)
	(vmprefix_profile_print_specialized): New functions.

2020-12-22  Luca Saiu  <positron@gnu.org>

	minor jitterlisp changes

	* example-vms/jitterlisp/jitterlisp-allocator.c (jitterlisp_add_litter_block):
	print newline at the end of each allocation logging message.

	* example-vms/jitterlisp/jitterlisp-printer.c (jitterlisp_print_internal)
	(jitterlisp_print_char_star_internal): Flush at the end.

2020-12-22  Luca Saiu  <positron@gnu.org>

	fix jitterlisp bug

	* example-vms/jitterlisp/jitterlisp-operations.h
	(JITTERLISP_REMAINDER_OR_OVERFLOW_) [unsafe]: Use remainder, not division.

2020-12-22  Luca Saiu  <positron@gnu.org>

	jitterlisp allocator: style litter logs

	* example-vms/jitterlisp/jitterlisp-allocator.c: Include header.
	(JITTERLIST_TO_MIB): Rename to JITTERLISP_TO_MIB.
	(jitterlisp_add_litter_block): Use a temporary string, print via the
	styled printer.

2020-12-22  Luca Saiu  <positron@gnu.org>

	structuredvm: fix register initialisation value

	* example-vms/structured/structured.jitter (r): Change c-initial-value.

2020-12-22  Luca Saiu  <positron@gnu.org>

	jitterlispvm: set correct initialisation values for registers and stack elements

	* example-vms/jitterlisp/jitterlisp.jitter (r): Fix c-initial-value, now
	that it is actually used.
	(m, t): Set c-initial-value.

2020-12-22  Luca Saiu  <positron@gnu.org>

	allow The Array to be larger than 4GB

	Allow The Array to take a ridiculously large size, typically because of a
	ridiculously large number of slow registers.

	* jitterc/jitterc-generate.c (jitterc_emit_state_h): Change field type for
	jitter_slow_register_no_per_class, in generated state struct.

	* templates/vm.h (vmprefix_make_place_for_slow_registers): Change argument
	type.

	* templates/vm1.c (vmprefix_make_place_for_slow_registers): Change argument
	type.  Add sign check.  Change index type to make sure it is not restricted
	to 32 bits.  Update disabled debugging messages.

2020-12-22  Luca Saiu  <positron@gnu.org>

	example change

	* example-vms/uninspired/uninspired.jitter (r): Initialise registers with an
	easy to recognise value, for debugging.

2020-12-22  Luca Saiu  <positron@gnu.org>

	initialise VM registers (fast, slow, link) following the user specification

	With this change set every user setting in register classes and stack should
	take effect.

	* jitterc/jitterc-generate.c (jitterc_emit_register_initializations): New
	function.
	(jitterc_emit_state): Call new function.  Update comment.
	(jitterc_emit_register_classes_h): Emit new macro
	VMPREFIX_INITIALIZE_SLOW_REGISTER_RANK in generated code.

	* templates/vm.h: Add comment defining slow register ranks.

	* templates/vm1.c (vmprefix_make_place_for_slow_registers): Rename formal.
	Use new macro VMPREFIX_INITIALIZE_SLOW_REGISTER_RANK.  Cosmetic changes.

2020-12-22  Luca Saiu  <positron@gnu.org>

	initialise stack TOS for TOS-optimised stacks with an initial value

	* jitter/jitter-stack.h  (JITTER_STACK_TOS_INITIALIZE): Add initialisation.
	(JITTER_STACK_NTOS_INITIALIZE): Remove wrong comment.

2020-12-22  Luca Saiu  <positron@gnu.org>

	runtime: accept large stack size

	Accept large stack sizes in stack backings.  Keep more information in
	backing structures, to make it easier to use GNU libsigsegv.

	* jitter/jitter-stack.h (struct jitter_stack_backing): Change field type for
	element_size_in_bytes, element_no, mmapped_memory_size. New fields
	underflow_page_beginning, overflow_page_beginning, page_length_in_bytes.  Add
	comment.
	(jitter_stack_initialize_tos_backing): Change argument types.
	(jitter_stack_initialize_ntos_backing): Likewise.

	* jitter/jitter-stack.c (jitter_stack_backing_update_and_allocate): Change
	local variable types.  Improve comments.  Set new struct fields, use them to
	simplify expressions.
	(jitter_stack_backing_destroy_content): Change argument types.
	(jitter_stack_initialize_backing): Initialise new fields.  Add commented-out
	testing code.
	(jitter_stack_initialize_tos_backing): Change argument types.
	(jitter_stack_initialize_ntos_backing): Likewise.

