# HG changeset patch # User William Astle # Date 1478231072 21600 # Node ID b4825b42c15124aa0ff5087254ab49e9d304f676 # Parent 9f0448022f1fd69422120672c3974dd50bf7cf77 Change to engage forwardrefmax pragma by default There are enough cases where the forward reference optimization scheme in lwasm makes assembly painfully slow that it warrants enabling this pragma by default to avoid bug reports about lwasm being too slow. Which is is when you have a lot of forward refences or other instruction sizes that don't reduce on pass one. This gets worse exponentially as the source file size gets bigger. The old behaviour is available to anyone who needs or wants it, though. It does work quite well on smallish files or files that do not have a lot of abiguous instruction sizes. It should be noted that this change does not change the correctness of the code output by lwasm. What it might do is result in slightly larger code if the assembler is forced to select a 16 bit mode when an 8 bit mode will do. However, in most cases I've seen, it makes very little difference overall. diff -r 9f0448022f1f -r b4825b42c151 lwasm/main.c --- a/lwasm/main.c Thu Nov 03 21:36:17 2016 -0600 +++ b/lwasm/main.c Thu Nov 03 21:44:32 2016 -0600 @@ -302,6 +302,10 @@ asmstate.nextcontext = 1; asmstate.exprwidth = 16; asmstate.tabwidth = 8; + + // enable the "forward reference maximum size" pragma; old available + // can be obtained with --pragma=noforwardrefmax + asmstate.pragmas = PRAGMA_FORWARDREFMAX; /* parse command line arguments */ lw_cmdline_parse(&cmdline_parser, argc, argv, 0, 0, &asmstate);