Subject: bug#4470: Acknowledgement (23.1; threaded interpreter)

From: Andreas Schwab <[email-masked]>
Date: Fri, 18 Sep 2009 20:25:46 +0200

Tom Tromey <[email-masked]> writes:

> +      static int initialized;
> +
> +      if (!initialized)
> +	{
> +	  int i;
> +	  initialized = 1;
> +	  /* We must initialize every slot in the table.  An empty
> +	     slot before Bconstant should just abort.  All the opcodes
> +	     after Bconstant should use the same code as Bconstant.  */
> +	  for (i = 0; i < 256; ++i)
> +	    {
> +	      if (!targets[i])
> +		targets[i] = i < Bconstant ? &&insn_default : &&insn_Bconstant;
> +	    }
> +	}
> +#endif

You can use [0 ... 255] = &&insn_default, [Bconstant ... 255] =
&&insn_Bconstant to statically initialize the array, avoiding the
runtime initialisation.

Andreas.

-- 
Andreas Schwab, [email-masked]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."