Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Esr retargeting #489

Merged
merged 275 commits into from
Jun 5, 2021
Merged

Esr retargeting #489

merged 275 commits into from
Jun 5, 2021

Conversation

Mightyjo
Copy link
Contributor

@Mightyjo Mightyjo commented Jun 5, 2021

This includes ESR's PR #460 and my patches to fix up 'make distcheck'

Required defining a new method table entry and shuffling the order in
which things are generated a bit, but the generated-code diffs are all
trivial.  Some comments from the previous C code are now in the
skeleton.

#26 in the retargeting patch series
Also, remove two insertion points in the skel file
that are no longer used because we're now using m4
conditionals instead.

In the generated C, two magic comments from the insertion points go
away.

#27 in the retargeting patch series
…ted.

No changes in generated code.

#28 in the retargeting patch series
Diffs in generated code are trivial, a couple of
blank lines with continuations due to % directives.

#29 in the retargeting patch series
Generated-code diffs are blank lines with ] continuations and
shifted %% commends made by skel breakpoint directives.  I could garbage
collect those, but I plan to do that all at once in a commit of its
own for clarity's sake.

westes#30 in the retargeting patch series
No generated-code diffs from this change.

westes#31 in the retargeting patch series
Moves one table initializer in the generated code, but doesn't alter
it.

Leaves one FIXME. The computation of M4_YYL_BASE really ought to be
done in m4, but for some unknown reason I couldn't beat it into
dping the right thing.  Do be revisited, bu right now finishing
off the last bits of code generation is more important.

westes#32 in the retargeting patch series
Presently only C can do this.  Otherwise we fall through to storing
numeric indices for a tiny loss of performance.

No generated-code changes from this.

westes#33 in the retargeting patch series
Turned out to be mildly trick because %if/%endif pairs have push/pop
behavior rather than combining.

In generated code, the location of the debug declarations moves,
and that's all.

westes#34 in the retargeting patch series
Of course, this produces exactly that in diffs.

westes#35 in the retargeting patch series
No generated-code diffs from this change.

westes#36 in the retargeting patch series
Finally, scavenge trailing skel breakpoints that are no
longer used, as theey no longer carry information.

Diffs in generated code are all comments and whitesoace, as usual

westes#37 in the retargeting patch series
Diffs are comments and whiespace, as usual.

westes#38 in the retargeting patch series
I did some indentation of the end-of-file case statements with tabs to
make the generated code a bit more readable.  So there are trivial
whitespace diffs in generated code.

westes#39 in the retargeting patch series
Pull the C mode setting for M4_YYL_BASE into m4.

Use if/then/else extension of m4_ifdef to simplify how yy_flex_debug
is set.  In the process, fix a bug introduced earlier in this patchest
where yy_flex_debug initialization was inverted.

Remove unused skel breakpoints and renumber those left.

Diffs have only commenmt and whitespace changes *except* for the
corrected initialzation of yy_flex_debug.

westes#40 in the retargeting patch series
It was in a mix of several different styles tht made it hard
to read.  I've massaged it all ibto K&R with tabs and mandatory
braces.  No logic changes.
This patch is a pure refactoring step.  It changes the
interface between gen.c and the back end so that the
method table can shed a number of methods and no headers
are generated in gen.c any more.

Most methods now return the amount of memory they
allocate.  Eventually this will be used to add
a report on this to the generated code.

No diffs in generated code, even without ignoring whitespace.

westes#43 in the retargeting patch series, which turned out
not to be finished after all. These is ugly magic in skelout()
that needs to be factored out.
This feature is better implemented with m4 macroexpansion;
that way skelout() does not have to know that #define is a thing.

Also in skelout(), use the backend comment method rather than
embedding knowledge about /* and */, and int_format_define
to factor out knowedge about #define.

Produces only comment diffs in the generated test code.

westes#44 in the retargeting patch series
Produces only whitespace diffs in generated code for tests, except the
order of items in the initializer for table serialization changes.

westes#45 in the retargeting patch series
This should make it possible to eliminate much of the C-specific
prolog code.

Sadly, because of the moves of the generated comments this makes
a rather noisy diff.  All comments and whitespace, though;
what looks like being other than that is pieces of generated code
being shifteed around.

westes#46 in the retargeting patch series
The point of this change is to move the setting of the M4_MODE_*
controls up to the front of the generated code so that they can be
used for conditionalization earlier, notably in replacing the prolog
method.  I tried to do this in westes#46 but dididn't move the mode
setting far enough up.

(Also, rename instances of a duplicated mode switch.)

In generated code, the m4 controls move but nothing else changes.

westes#47 in the retargeting patch series
Also, clean up some unused and duplicative symbols.

In generated test code, comment and whitespace diffs only
except for YY_INT_ALIGNED going away.

westes#48 in the retargeting patch series
Now that all the mode conditionals are visible early, wverything that
used to be done in the prolog can be done as conditionalized code in the
skeleton.

Whitespace and comment diffs only.

westes#49 in the retargeting patch series
It was a no-op anyway in the C version, there as a placeholder
in case other languages needed it.  But in the new organization
of things, with everything being done by conditional expansion in
the skeleton file, there's no point.

No diffs at all in generated test code.

Thios does remove some cpde that was conditioned out, an abandoned
attempt to undefine all #defines at the end of code generation.
There were only two left, for YY_MAIN, and that definition
was moved so it's in the visible controls.

This is a step towards making *all* conditionalization symbols
viible in generated comments.

This commit also cleans up some misnamed mode symbols.  There are
still a couple of duplicative pairs, to be cleaned up in a later
commit.

We can now report generated M4 symbols with values in the "m4
controls" part of a generated file. Partly as a result, the following
symbols become visible in generare code from the tests:
M4_MODE_PREFIX, M4_YY_TABLES_VERIFY, M4_YY_REENTRANT, and
M4_MODE_PREFIX.

No other diffs.

westes#51 in the retargeting patch series. westes#50 was accidentally
unnumbered.
As I was working on some layer separation.  I realized that I
was getting confused a lot by the huge pile of globals that
control this program.

In particular, I need to be able to clearly distinguish those that set
m4 conditional symbols from those that don't.  So I've done something
about it. Almost all globals that can be set by options are now
bundled into two context structures, "ctrl" for options that have
corresponding m4 symbols and "env" for options that don't.

The few I haven't moved have sufficiently tricky interdependencies
that I'm going to break out any changes related to them into smaller
patches that can be easier to review.  In this one I did only the bulk
of straightforward changes that could be done mechanically with search
and replace.

I changed one varuable name to reflext its senantics better;
the performance_report global is now env.performance_hint.

Ideally there ought to be a third structure that bundles all the
shared state used by DFA/NDFSA table computation, so all globals would
live in one of three context structures.  I may do that in a later
commit, but this patch is already unpleasantly large as it is.

No diffs in generated test code, nor any logic changes.

westes#52 in the retargeting patch series.
This is separate from the big reorganization in commit westes#52 because
there's a comment about this variable in flexdef.h that makes me
nervous.  According to the comment this variable is a trit, but
it looks to me like flexinit sets it to false and I can't find
anywhere in the code that sets it to a non-boolean value.

This commit asumes that the comment is stale and the member
can be typed boolean. Should be audited.
This cleans up some loose ends before the next big move.

westes#54 in the retargeting patch series. westes#53 slipped out unnumbered.
eric-s-raymond and others added 19 commits November 20, 2020 07:32
)

Probably we could turn the section markers into m4 macros, but until
then this will prevent accidents.
autogen gets indigestion iv you give a suffix rule a prerequisite,
so don't do that.
Reviewing ESR's Retargeting branch from westes/flex
Automake attempts to compute default _SOURCES for the test-yydecl-*.sh runners generated by test-yydecl-gen.sh. Providing an intentionally empty _SOURCES variable for each script fixes the attendant errors.

Also removed EXTRA_DIST lines for deleted test inputs.
Wildcards were causing automake to generate build rules for the *-filename dummies. They're not generally portable.
Wildcards were causing automake to generate spurious build targets.
Override the TEXI2DVI and TEXI2PDF automake variables to add an include directory so VPATH builds work.
I'm not thrilled with doing this. The right thing is probably to move the included examples to doc/ and do the
VPATH magic in examples/manual/ where LaTeX is better able to deal with it.
Generating these test inputs on the fly breaks VPATH builds and 'make distcheck'.
Glad we have a lot fewer of them now, at least.
@Mightyjo
Copy link
Contributor Author

Mightyjo commented Jun 5, 2021

The merge commit a297d52 doesn't show up in my history when I try to rebase it away. I think it will disappear when the PR is merged. I'm very sorry if it ends up in 'git log'.

@westes
Copy link
Owner

westes commented Jun 5, 2021

Yes!

make distcheck is sweetly clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants