1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 22:31:36 +03:00
Commit Graph

25860 Commits

Author SHA1 Message Date
Patrick Thomson
bcc084f5ac move the TH import inside the ifdef 2018-10-17 17:38:35 -04:00
Patrick Thomson
b361c9ef79 Prevent unnecessary recompilation of Semantic.Version in dev mode.
Right now, Semantic.Version is recompiled on every invocation of
`stack build`, since we marked it as `-fforce-recomp` to ensure that
all deployments are tagged appropriately for haystack. However, this
entails a good deal of wasted time during development. With some
liberal application of `CPP`, we can make this recompilation only
happen on CI, thanks to the `release` flag and passing in a compiler
flag.

To test:

* apply the patch
* `stack build semantic`, then `stack exec semantic -- -v`. It should
  print `semantic version 0.4.0 (<development>)`.
* `stack clean semantic && stack build --ghc-options=-DCOMPUTE_GIT_SHA`.
  `stack exec semantic -- -v` should then print out the correct SHA.

Though it's probably not strictly necessary, I've marked the
`semantic` and `semanticd` executables to compile with
-DCOMPUTE_GIT_SHA, just in case.
2018-10-17 17:24:14 -04:00
Patrick Thomson
42bb569ba9 Merge pull request #2214 from github/nfdata-instances
Add NFData instances to enable more accurate benchmarking.
2018-10-17 16:43:12 -04:00
Patrick Thomson
f911b43b63 fix lints 2018-10-17 14:38:30 -04:00
Patrick Thomson
ac543651ee Add NFData instances to enable more accurate benchmarking.
Because we're getting serious about benchmarking in the run-up to
Windrose, it's time to bring in the `deepseq` package to ensure that
benchmarks can fully evaluate the result of a test case.

The `deepseq` package provides an `NFData` typeclass:

```
class NFData a where
  rnf :: a -> ()
```

Instances use the `seq` combinator to ensure that the argument to
`rnf` is fully evaluated, returning (). If there is a `Generic`
instance for `a`, the implementation can be omitted. This patch adds
NFData for every syntax node, graph vertex, environment data
structures, and exceptions. It is long, but the work is very
straightforward, so don't panick.

The benchmark suite (`stack bench`) now produces more accurate
results. The benchmarks previously mimicked `rnf` by calling `show` on
the result of an evaluation or graph construction; now that we have
actual `NFData` instances we can use the `nfIO` combinator from
criterion. This has sped up the evaluation benchmarks and reduced
their memory consumption, while it has slowed down the call graph
benchmarks, as those benchmarks weren't evaluating the whole of the
graph.

Unfortunately, this patch increases compile times, as we have to
derive a few more Generic instances. I wish this weren't the case, but
there's little we can do about it now. In the future I have some plans
for how to reduce compile time, and I bet that those gains will at
least nullify the speed hit from this patch.

Now that we have NFData instances for every data type, we can start
benchmarking assignments, in preparation for fixing #2205.

This patch also pulls in updates to `effects` and `fastsum` that add
appropriate NFData instances for the data they vend.
2018-10-17 14:08:47 -04:00
Timothy Clem
a19d8bd02e Revert removal of wait 2018-10-17 10:03:46 -07:00
Ayman Nadeem
1dce4b089b Merge branch 'quiet-parsing' of https://github.com/github/semantic into quiet-parsing 2018-10-17 12:12:23 -04:00
Ayman Nadeem
97b6c48c95 remove results 2018-10-17 12:12:12 -04:00
Timothy Clem
3b0a19238f Merge branch 'quiet-parsing' of github.com:github/semantic into quiet-parsing 2018-10-17 08:37:21 -07:00
Timothy Clem
070c15a947 Merge remote-tracking branch 'origin/master' into quiet-parsing 2018-10-17 08:18:33 -07:00
Patrick Thomson
abce41c1e1 Merge pull request #2211 from github/bracket-effect
Fix crash/race associated with `bracket` (#2207)
2018-10-16 23:34:04 -04:00
Patrick Thomson
d3db754004 weirdness in tests 2018-10-16 23:04:39 -04:00
Patrick Thomson
d56badfb29 Use upstream Resource effect. 2018-10-16 20:11:38 -04:00
Rob Rix
c9e6912068 Port most of the system over to higher-order-effects. 2018-10-16 18:48:08 -04:00
Ayman Nadeem
f0dcd1d2fc attempt to make this less manual 2018-10-16 18:01:28 -04:00
Timothy Clem
602432359b Merge remote-tracking branch 'origin/bracket-effect' into quiet-parsing 2018-10-16 14:57:14 -07:00
Patrick Thomson
ebda4bfaa1 Merge branch 'master' into bracket-effect 2018-10-16 17:52:30 -04:00
Patrick Thomson
a9ab40b7a5 Merge pull request #2197 from github/port-rewriting-examples
Port rewriting examples to the Rewrite DSL.
2018-10-16 17:46:02 -04:00
Patrick Thomson
1de1f0b5c1 try catching ParserTimedOut exceptions in parse-examples 2018-10-16 17:39:36 -04:00
Patrick Thomson
fb1806f3e9 whoops 2018-10-16 17:18:59 -04:00
Patrick Thomson
37522ddc35 lints 2018-10-16 17:15:36 -04:00
Patrick Thomson
1dfb4981cc warnings 2018-10-16 17:10:34 -04:00
Patrick Thomson
75bf696e47 Fix crash/race associated with bracket (#2207)
The bracket that I wrote inside effects does not properly handle
asynchronous exceptions, as it has no way to call the mask function.
As such, because the asynchronous exception is rethrown by both
`bracket` and `wait`, the exception handler will trigger twice. This
is what is causing the crash: `bracket` is passing the TSParser we
create in parseToAST to ts_parser_delete twice.

The best thing to do here is to create the new `Resource` effect,
which is interpreted down to `Control.Exception.bracket`, which has
the correct asynchronous-masking behavior, unlike the `bracket` in
`Control.Monad.Effect.Exception`, which I propose to remove in a patch
to `effects`.

This also bumps haskell-tree-sitter so that the
`ts_node_copy_child_nodes` function is considered `interruptible`.

To test:

1. Download [this file](https://gist.ghe.io/tclem/c2ffe3d20b248fdac59588aa98f168ae)
2. Run `TREE_SITTER_PARSE_TIMEOUT=1000 stack exec semantic -- --log-level=debug parse lexer.rb`

Before applying this patch, you will see a crash associated with a
double-free; afterwards, it should time out normally.
2018-10-16 17:05:29 -04:00
Ayman Nadeem
f9a3966a3c github universe results 2018-10-16 15:55:24 -04:00
Ayman Nadeem
2cb9b43ad5 entitlements results 2018-10-16 15:55:02 -04:00
Ayman Nadeem
66c397bd73 airflow results 2018-10-16 15:54:50 -04:00
Timothy Clem
0d762fba86 Include blob language in output too 2018-10-16 11:40:26 -07:00
Timothy Clem
4fc7bb59ae No need for double async (timeout already does this) 2018-10-16 11:28:53 -07:00
Patrick Thomson
5e52bede0a Fix the test suite. 2018-10-15 12:47:18 -04:00
Patrick Thomson
b7364f6df7 Merge remote-tracking branch 'origin/master' into port-rewriting-examples 2018-10-15 11:22:06 -04:00
Rob Rix
800c459bb0 Bump higher-order-effects for catchIO/bracket. 2018-10-14 22:16:07 -04:00
Patrick Thomson
14b4ed0bc7 Merge pull request #2204 from github/declaration-matching-improvement
Refactor: remove duplicate code in Analysis.Declaration
2018-10-12 20:22:34 -04:00
Rob Rix
a66788c682 Only re-export Generic/Generic1. 2018-10-12 17:54:57 -04:00
Timothy Clem
7663c46d79 New cli switch for quiet parsing with timing stats 2018-10-12 12:47:11 -07:00
Rob Rix
56dabab68f Bump higher-order-effects for hmap. 2018-10-12 14:46:00 -04:00
Rob Rix
0db8091c5e Bump higher-order-effects. 2018-10-12 14:22:50 -04:00
Rob Rix
298d861a20 Add a dependency on higher-order-effects. 2018-10-12 14:08:49 -04:00
Rob Rix
6fb6fd3d4e Add higher-order-effects. 2018-10-12 12:37:08 -04:00
Timothy Clem
c04d165a2b Merge branch 'master' into declaration-matching-improvement 2018-10-10 15:22:20 -07:00
Patrick Thomson
deb0956a8e remove annoying duplication 2018-10-10 12:49:25 -04:00
Patrick Thomson
8c19724cbe Merge branch 'port-rewriting-examples' of github.com:github/semantic into port-rewriting-examples 2018-10-10 12:37:37 -04:00
Patrick Thomson
ecb3d0cec3 Merge branch 'master' into port-rewriting-examples 2018-10-10 12:20:33 -04:00
Patrick Thomson
ea66d5323a Merge pull request #2203 from github/lts-upgrade-12.12
Upgrade to LTS 12.12.
2018-10-10 12:18:55 -04:00
Patrick Thomson
8549d70b77 Refactor: remove duplicate code in Analysis.Declaration
The family of functions that extracted a meaningful "identifier" for a
declaration contained a large amount of duplication, owing to
type-specific pattern-matching. Encapsulating this pattern-matching in
a Rule means we can go from six functions to one.
2018-10-10 12:17:10 -04:00
Patrick Thomson
c4561184ff Merge branch 'master' into lts-upgrade-12.12 2018-10-09 16:31:05 -04:00
Patrick Thomson
156f3f6dbc fix ansi-terminal 2018-10-09 15:38:52 -04:00
Timothy Clem
ad3ceb7ab3 Merge pull request #2198 from github/pair-down-symbols-output
Change up what Declarations we identify
2018-10-09 09:28:01 -07:00
Patrick Thomson
0ae629142a License revitalization. 2018-10-09 11:32:42 -04:00
Rob Rix
6ac9b657f0 Merge branch 'master' into pair-down-symbols-output 2018-10-09 10:45:03 -04:00
Patrick Thomson
989d38f27d Update to LTS 12.12.
The major bumps we get here are `algebraic-graphs` v0.2, which
contains a number of speed improvements, and the removal of the
`foundation` as a dependency.
2018-10-09 01:06:55 -04:00