Commit Graph

903 Commits (1f24cfdf2565974e0df6a1c4187c98cda943db2c)

Author SHA1 Message Date
Mike Gerwitz 1f24cfdf25 Remove :map: sym-dep generation
This was incorrect to begin with---it does not make sense that an input
mapping should depend upon the identifier that it maps to, in the sense that
we make use of these dependencies.  If we add weak symbol references in the
future, then this can be reintroduced.

By removing this, we free tameld from having to perform the check itself.

.rev-xmlo bumped to force rebuilding of object files since the linker now
expects that no such dependencies will exist within them.
2021-07-22 14:27:15 -04:00
Mike Gerwitz 8a2cc28ddb RELEASES.md: Update for v18.0.3 2021-07-21 15:05:52 -04:00
Mike Gerwitz c90566056d RELEASES.md: NEXT summary 2021-07-21 15:04:59 -04:00
Mike Gerwitz 90c6b51fd5 tamer: tameld: Place constants into static section in executable
This is something that changed when the TAMER POC was initially created, as
I was learning Rust.  I don't recall the original reason why this was moved,
but it could have been moved back long ago.

In our systems, constants can hold tables (as matrices) with tens or
hundreds of thousands of rows, and there are a number of them in certain
projects.  As an example, the YAML-based test cases for one of our systems
went from ~2m30s to ~45s after this change was made.  Much of the cost
savings comes from saving GC.
2021-07-21 14:53:15 -04:00
Mike Gerwitz 53360548da tame: Ignore duplicate conjunctive predicates in value list optimization error
This can occur in generated code (e.g. from proguic if a question-based
predicate inherits a predicate already specified).  This commit does not
change anything that's emitted; it merely allows proceeding.

TAMER can be smarter about this; I don't want to invest more time into
generalizing deduplication of predicates.
2021-07-19 14:53:25 -04:00
Mike Gerwitz 5dab913ecb RELEASES.md: Update for v18.0.2 2021-07-15 23:50:53 -04:00
Mike Gerwitz b2323e80ef RELEASES.md: Summary of NEXT 2021-07-15 23:50:00 -04:00
Mike Gerwitz 2ad0d1425a compiler: Correct handling of TRUE matches
There was a bug whereby TRUE matches would keep whatever value was being
matched on, even if it was not a boolean.  That was an oversight from the
proof-of-concept code, and this fixes it; that's why this is behind a flag!

This also adjusts the class aliasing optimization so that it doesn't check
for a `TRUE` symbol name, which was a bad idea to begin with.

This change also ends up expanding `lv:match[@value="TRUE"]` into the long
form, where it didn't previously; this will result in slightly larger xmlo
files in some cases, but it's nothing significant, and it does not impact
compilation times.
2021-07-15 14:55:32 -04:00
Mike Gerwitz 37977a8816 entry-form.xsl: Correctly generate HTML for params with imported types
This is a nearly-10-year-old bug that was introduced when the Summary Page
was modified to use the then-new symbol table.  The compiler previously
concatenated all packages into a single XML tree and processed that, so no
package resolution was necessary here before.
2021-07-14 09:59:45 -04:00
Mike Gerwitz 513b8d7b86 worksheet.xsl: Allow package name to auto-generate
A long time ago (about a decade), package names were required, but they are
now generated by the compiler relative to the root path.  The name here was
incorrect, which was generating an incorrect path for the linked symbols,
which was causing problems with the Summary Page.
2021-07-14 09:51:08 -04:00
Mike Gerwitz f5ba4b013b summary: Make Summay Page compiler less chatty
It produces a lot of output that either results in spam (internal errors) or
pollutes the log with unnecessary information.
2021-07-01 13:54:34 -04:00
Mike Gerwitz bc9c667c9d RELEASES.md: Update for v18.0.1 2021-06-24 10:37:25 -04:00
Mike Gerwitz d0e3a5622c Remove class-level notice for new system
This was not intentionally committed.
2021-06-24 09:59:00 -04:00
Mike Gerwitz 9a62bb2ace RELEASES.md: Update for v18.0.0 2021-06-23 12:54:25 -04:00
Mike Gerwitz eef2a5d4bc Compiler runtime optimizations with classification system rewrite
See RELEASES.md for a list of changes.

This was a significant effort that began about six months ago, but was
paused at a number of points.  Rather than risking further pauses from
interruptions, the new classification system has been gated behind a
package-level feature flag, since it causes BC breaks in certain buggy
situations.

Since this flag was introduced late, there is the potential that it causes
bugs when new optimizations are mixed with the old system.
2021-06-23 12:48:42 -04:00
Mike Gerwitz dd432d249d RELEASES.md: Update with compiler optimizations 2021-06-23 12:46:37 -04:00
Mike Gerwitz 4e859148c0 tools/pkg-graph: Debugging tool to output graph of package dependencies 2021-06-23 11:44:36 -04:00
Mike Gerwitz e9598b7cb5 Correct short runtime var declarations
They were not actually defined before being aliased.
2021-06-23 11:44:36 -04:00
Mike Gerwitz 6f2b4090cd Correct behavior of matrix matching with separate index sets in new system
This behavior was largely correct, but was not commutative if the size of
the matrices (rows or columns) was smaller than a following match.
2021-06-23 11:44:36 -04:00
Mike Gerwitz e90ebd226c Remove arrow functions from classifier runtime
We need to support as far back as IE11, unfortunately, which is ES5.
2021-06-23 11:44:36 -04:00
Mike Gerwitz 934824b2ee Reintroduce legacy classification system, place new behind flag
This largely reintroduces the legacy classification system, but there are a
number of things that are not affected by the flag.  For example:

  1. Alias classifications are still optimized when the flag is off;
  2. Classifications without predicates emit slightly different code than
     before, though their functionality has not changed;
  3. There's been a lot of refactoring and minor optimizations that are
     unaffected by the flag;
  4. lv:match/@pattern will now emit a warning; and
  5. Cleaning and casting of input data is not gated.

This allows us to incrementally migrate to the new system where behavior may
be different, but this is admittedly a bit dangerous in that the new system
was aggressively tested and reasoned about, so reintroducing the legacy
system may combine in unexpected ways.
2021-06-23 11:44:36 -04:00
Mike Gerwitz 5f6cb4cf51 .rev-xmlo: Bump version
The old and new classification systems are currently incompatible, but if the
old is reintroduced, this commit can go away.
2021-06-23 11:44:36 -04:00
Mike Gerwitz 7dbb653624 Inline intermediate any/all classifications
This is another significant milestone.

The next logical step with classification optimization is to inline all of
those intermediate classifications generated from any and all blocks, since
there are so many of them.  This means having the parent classification
absorb all dependencies; not output dependencies for the classification; not
compile the assignments for those classifications; and to inline them at the
match site.  They’re used only once, since they’re generated for each
individual block.

We need to keep the actual classification generation around (and just inline
them) for now, probably until TAMER, because we depend upon their symbol for
determining their dimensionality, which we need for the optimization work we
just did---we must inline them into the proper group (matrix, vector, or
scalar).

The optimization work done up to this point had inlining in mind---only a
little bit of work was needed to make sure that every classification can
simply be stripped of its assignment and be a valid expression that can be
inlined in place of the original reference.

The result of that was predictably significant for the `ui/package` program
that I've been testing with:

  - 4,514 classifications were inlined;
  - The file size dropped to 7.5MiB (from 8.2MiB previously---remember that
    we started at 16MiB); and
  - GC ticks were cut in half, from 67->31.

Unfortunately, this optimization added nearly 1m of time to the compilation
of that program.  Speaking from the future: the UI build optimizations in
liza-proguic were introduced to offset this difference (and provide a net
gain in performance).
2021-06-23 11:44:36 -04:00
Mike Gerwitz 97caefab1b Extract classify/@terminate into own template
Note that next-match does not cause a return from the template, as odd as it
looks.
2021-06-23 11:44:36 -04:00
Mike Gerwitz 1517a03994 Combine all class optimizations into one 2021-06-23 11:44:36 -04:00
Mike Gerwitz d1dae3e1b1 Explicit types for match raising 2021-06-23 11:44:36 -04:00
Mike Gerwitz 5adf1b7589 Combine all m* optimizations
With the recent refactoring, it's clear that these are the same thing.
2021-06-23 11:44:35 -04:00
Mike Gerwitz a563c3ce62 Remove lv:match checks from class optimization checks
We handle all cases now, and prohibited @pattern that wasn't.
2021-06-23 11:44:35 -04:00
Mike Gerwitz e3fd9388bb Abstract function wrapping for class type raising
This will let us clean up the implementation a bit more.
2021-06-23 11:44:35 -04:00
Mike Gerwitz 10089659b1 Extract lv:classify compilation into function
To support following commits for inlining.
2021-06-23 11:44:35 -04:00
Mike Gerwitz 0cd6d40dd9 compiler: Remove whitespace from vector/matrix constants 2021-06-23 11:44:35 -04:00
Mike Gerwitz 9dbda93b4f {precision=>p} to reduce byte count 2021-06-23 11:44:35 -04:00
Mike Gerwitz f14417f32a Remove unused domains var 2021-06-23 11:44:35 -04:00
Mike Gerwitz e0907c6db2 compiler: Do not output whitespace between nodes 2021-06-23 11:44:35 -04:00
Mike Gerwitz 4ee050323a Apply hositing optimization to classify/@any
This convets disjunctive classifications into conjunctive and places an
<any> within it.

This ends up handling all the generated qwhen classifications from proguic,
which were probably converted into <any> by a previous optimization pass.

The UI program I've been using to test these compiler optimizations has
decreased in size down from 8.2MiB since the beginning of this branch; we
started at ~16MiB.
2021-06-23 11:44:35 -04:00
Mike Gerwitz 658e55f2fa Hoist any-all common predicate for binary conjunctive classifications
See comments.  This is meant to help mitigate the damage done by one of our
code generation systems.  The benefit is significant, allowing the code
generator to remain simple.  By placing this optimization within the
compiler, hand-written and template-generated code also benefit.
2021-06-23 11:44:35 -04:00
Mike Gerwitz 25d500fec5 Generalized value list optimization
Note that this was also broken for vectors and scalars by the commit that
expanded non-TRUE @value.
2021-06-23 11:44:35 -04:00
Mike Gerwitz 8e457dab34 Strip single-predicate any/all instead of extracting
Rather than extracting every any/all into their own classifications,
eliminate them (and replace them with their body) if they contain only one
predicate.  This is most likely to happen after template expansion, and
there were an alarming number of them in our system.

Stripping them out of one of our programs saved ~0.2MiB of output, and
removed many intermediate classifications.  It removed ~1,075 lines, which
should correspond closely to the actual number of classifications.

Discovering this required stripping the template barriers, which was done in
a previous commit.

Unfortunately, the performance improvement from this wasn't significantly,
largely because of the nondeterminisim of GC, which can easily mask the
gains.  But a new line `v8::internal::FixedArray::set(int,
v8::internal::Object)` appeared in the profiler output, making me wonder
whether the JIT is starting to understand more interesting properties of the
system.

`mprotect` and `v8::internal::heap_internals::GenerationalBarrier` also
appeared, which are related to GC.
2021-06-23 11:44:35 -04:00
Mike Gerwitz 2d519947f7 Strip template barriers from expanded classifications
The barriers deeply frustrate static analysis.
2021-06-23 11:44:35 -04:00
Mike Gerwitz f8b166a42d Remove lv:join
This is a long-forgotten and long-unused feature that has been
long-superceded by symbol table introspection in inline-template.
2021-06-23 11:44:35 -04:00
Mike Gerwitz c191af8d53 Remove anyValue and related code
!!!

(Message from the future: this ends up being reintroduced and the new
classification system being placed behind a feature toggle.  But it will be
eliminated eventually.)
2021-06-23 11:44:35 -04:00
Mike Gerwitz 8147bec24f m*v*s*!
This is a major milestone for class optimization---the old anyValue-based
system is no longer in use; the classification system has been wholly
rewritten.

The ticks in the sampling profiler are now where they should be, open to
further optimization with a much more solid foundation.

  [JavaScript]:
     ticks  total  nonlib   name
        5    0.6%    3.0%  LazyCompile: *vu [...]/ui/package.strip.js:25191:16
        5    0.6%    3.0%  LazyCompile: *M [...]/ui/package.strip.js:25267:15
        3    0.4%    1.8%  LazyCompile: *vmu [...]/ui/package.strip.js:25144:17
        3    0.4%    1.8%  LazyCompile: *ve [...]/ui/package.strip.js:25204:16
        2    0.2%    1.2%  LazyCompile: *precision [...]/ui/package.strip.js:25137:23
        2    0.2%    1.2%  LazyCompile: *me [...]/ui/package.strip.js:25178:16
        2    0.2%    1.2%  LazyCompile: *cmatch [...]/ui/package.strip.js:25495:20
        2    0.2%    1.2%  LazyCompile: *ceq [...]/ui/package.strip.js:25273:17
        1    0.1%    0.6%  LazyCompile: *init_defaults [...]/ui/package.strip.js:25624:27
        1    0.1%    0.6%  LazyCompile: *MM [...]/ui/package.strip.js:25268:16
        1    0.1%    0.6%  LazyCompile: *E [...]/ui/package.strip.js:25239:15
        1    0.1%    0.6%  LazyCompile: *<anonymous> [...]/ui/package.strip.js:25184:13
        1    0.1%    0.6%  LazyCompile: *<anonymous> [...]/ui/package.strip.js:25171:13

Much better than the 102 ticks that anyValue was taking some time ago!

A lot of time used to be spent compiling functions as well, a lot of which
was removed by previous commits, bringing us to:

 [C++]:
   ticks  total  nonlib   name
     50    5.9%   30.5%  node::contextify::ContextifyContext::CompileFunction(v8::FunctionCallbackInfo<v8::Value> const&)
     20    2.4%   12.2%  write
      9    1.1%    5.5%  node::native_module::NativeModuleEnv::CompileFunction(v8::FunctionCallbackInfo<v8::Value> const&)
      6    0.7%    3.7%  __pthread_cond_timedwait
      4    0.5%    2.4%  mmap

All of this work has simplified the output enough that it's obviated a slew
of other optimizations that can be done in future work, though a lot of that
may wait for TAMER, since performing them in XSLT will be difficult and not
performant; the compiler is slow enough as it is.
2021-06-23 11:44:35 -04:00
Mike Gerwitz 542ff46b6d m*v*s0 optimization
...getting close!
2021-06-23 11:44:35 -04:00
Mike Gerwitz 606a3fe987 m1v*s0 optimization 2021-06-23 11:44:35 -04:00
Mike Gerwitz a63eb4c5e6 m1v1s0*: Remove cmp args and support c:*/@anyOf
This supports all currently-optimized transformations, whereas previously we
were permitting only lv:match[@value].
2021-06-23 11:44:35 -04:00
Mike Gerwitz b735d91955 m0v*s* optimization
Building up to finalizing m*v*s*!

For context, here is the survey prior to this commit:

   3476 m0v1s1
   3385 m1v2s0
    582 m1v1s0
    531 m2v0s0
    225 m3v0s0
    171 m0v2s1
    169 m4v0s0
    135 m5v0s0
    102 m1v0s0
     85 m0v1s5
     71 m6v0s0
     67 m14v0s0
     57 m7v0s0
     50 m0v2s5
     48 m8v0s0
     41 m9v0s0
     39 m1v0s1
     39 m10v0s0
     34 m0v1s2
     26 m0v1s9
     22 m12v0s0
     20 m11v0s0
     20 m0v2s4
     20 m0v1s3
     19 m15v0s0
     19 m0v4s7
     17 m0v5s7
     17 m0v3s1
     17 m0v1s6
     16 m13v0s0
     16 m0v4s9
     16 m0v2s8
     16 m0v1s4
     15 m0v5s4
     15 m0v4s3
     15 m0v3s9
     15 m0v3s5
     15 m0v2s6
     14 m0v12s10
     13 m0v5s14
     13 m0v3s8
     12 m18v0s0
     12 m0v4s4
     12 m0v4s2
     12 m0v3s7
     12 m0v3s2
     12 m0v2s2
     12 m0v12s6
     11 m0v7s7
     11 m0v6s2
     11 m0v5s2
     11 m0v53s9
     11 m0v2s60
     11 m0v28s1
     11 m0v23s8
     11 m0v13s6
     10 m17v0s0
      9 m0v2s3
      8 m0v11s10
      7 m85v0s0
      7 m20v0s0
      7 m0v4s5
      7 m0v1s8
      6 m87v0s0
      6 m35v0s0
      6 m33v0s0
      6 m30v0s0
      6 m19v0s0
      6 m16v0s0
      6 m0v5s6
      5 m21v0s0
      5 m0v7s9
      5 m0v3s10
      4 m53v0s0
      4 m50v0s0
      4 m28v0s0
      4 m114v0s0
      4 m0v6s10
      4 m0v5s8
      4 m0v3s6
      4 m0v3s3
      4 m0v1s7
      4 m0v13s10
      3 m86v0s0
      3 m24v0s0
      3 m23v0s0
      3 m0v6s4
      3 m0v5s5
      3 m0v4s6
      3 m0v3s19
      3 m0v2s12
      3 m0v1s11
      3 m0v11s9
      3 m0v11s1
      2 m99v0s0
      2 m97v0s0
      2 m95v0s0
      2 m79v0s0
      2 m74v0s0
      2 m71v0s0
      2 m60v0s0
      2 m5v18s7
      2 m55v0s0
      2 m49v0s0
      2 m419v0s0
      2 m374v0s0
      2 m34v0s0
      2 m32v0s0
      2 m31v0s0
      2 m27v0s0
      2 m201v0s0
      2 m1v1s1
      2 m1v13s3
      2 m161v0s0
      2 m159v0s0
      2 m157v0s0
      2 m151v0s0
      2 m144v0s0
      2 m142v0s0
      2 m0v9s7
      2 m0v9s11
      2 m0v8s9
      2 m0v8s7
      2 m0v8s19
      2 m0v7s12
      2 m0v6s6
      2 m0v6s11
      2 m0v5s9
      2 m0v5s3
      2 m0v5s11
      2 m0v5s1
      2 m0v4s8
      2 m0v4s11
      2 m0v3s4
      2 m0v3s20
      2 m0v3s15
      2 m0v3s12
      2 m0v2s7
      2 m0v2s16
      2 m0v2s11
      2 m0v29s20
      2 m0v19s7
      2 m0v19s3
      2 m0v17s12
      2 m0v16s16
      2 m0v15s23
      2 m0v15s10
      2 m0v13s9
      2 m0v13s15
      2 m0v11s8
      2 m0v10s15
      1 m94v0s0
      1 m93v0s0
      1 m92v0s0
      1 m90v0s0
      1 m81v0s0
      1 m76v7s0
      1 m76v0s0
      1 m70v0s0
      1 m68v0s0
      1 m66v11s11
      1 m64v0s0
      1 m58v0s0
      1 m54v0s0
      1 m51v0s0
      1 m514v20s19
      1 m4v4s7
      1 m48v0s0
      1 m481v20s14
      1 m451v0s0
      1 m44v0s0
      1 m43v0s0
      1 m42v0s0
      1 m3v16s7
      1 m38v4s6
      1 m38v0s0
      1 m370v0s0
      1 m2v2s3
      1 m2v2s0
      1 m2v25s25
      1 m29v0s0
      1 m26v0s0
      1 m25v0s0
      1 m22v0s0
      1 m213v0s0
      1 m1v3s0
      1 m1454v3215s1422
      1 m13v11s37
      1 m1374v1s0
      1 m131v0s0
      1 m10v30s23
      1 m102v0s0
      1 m0v9s9
      1 m0v9s8
      1 m0v9s12
      1 m0v8s12
      1 m0v7s4
      1 m0v7s15
      1 m0v7s11
      1 m0v6s9
      1 m0v6s8
      1 m0v6s5
      1 m0v6s20
      1 m0v6s16
      1 m0v6s12
      1 m0v4s17
      1 m0v4s10
      1 m0v4s1
      1 m0v46s23
      1 m0v3s17
      1 m0v3s16
      1 m0v33s21
      1 m0v32s38
      1 m0v2s9
      1 m0v2s10
      1 m0v23s30
      1 m0v22s9
      1 m0v22s31
      1 m0v20s29
      1 m0v18s24
      1 m0v18s10
      1 m0v17s26
      1 m0v17s14
      1 m0v16s9
      1 m0v16s27
      1 m0v15s20
      1 m0v15s14
      1 m0v15s11
      1 m0v14s6
      1 m0v14s5
      1 m0v14s13
      1 m0v13s7
      1 m0v13s20
      1 m0v12s9
      1 m0v12s8
      1 m0v11s11
      1 m0v10s17
      1 m0v10s14
      1 m0v10s11
      1 m0v10s10

There are some horridly large ones in there!  They were missing from output
in previous commits because of how I was gathering information.

Those large ones come from liza-proguic's __proguiClasses.
2021-06-23 11:44:35 -04:00
Mike Gerwitz 8045c9d99a Remove v{u,e} second argument; always match truthful
Add optimization notes, note the impact on FALSE with implicit 0 (see mega
commit).
2021-06-23 11:44:35 -04:00
Mike Gerwitz 5ae5c226f9 lv:match/c:* optimizations for v* and s*
This will make m1v*s0 worth doing now.
2021-06-23 11:44:35 -04:00
Mike Gerwitz db88f6aba5 div function 2021-06-23 11:44:33 -04:00
Mike Gerwitz fc96880b85 lv:match/c:* optimizations
A large number of classification optimizations were being thwarted by my not
handling this case.
2021-06-22 15:00:58 -04:00