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

375 Commits

Author SHA1 Message Date
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
Patrick Thomson
d56377aea9 Prevent slowdowns when pretty-printing in ghci.
Right now, when opening a shell with `script/ghci`, you can encounter
a tremendous slowdown by turning on pretty-printing (with `pretty`)
then printing any value (`[0..3]` should work).

This stems from the fact that our `.ghci` specifies the `prettyShow`
function, defined in Semantic.Util, as its `-interactive-print`
function. While this is a good choice of a pretty-printer, the fact
that it is in Util, a file which imports many modules and uses fancy
types, is not good: pretty-printing cannot begin until Util is
recompiled and linked in. This explains why benchmarking this slowdown
revealed nothing but `dlsym` calls: we thought it was due to linking
in the tree-sitter libraries, but it was actually waiting for Util to
compile and link in.

The fix is simple: define `prettyShow` in another module. This should
provide significant speedups to our developer workflow.
2018-10-04 14:38:36 -04:00
Rob Rix
5c2dac35e8 Merge branch 'master' into first-order-closures 2018-09-27 13:37:25 -05:00
Timothy Clem
6b40e59c1d No SplitDiff! 2018-09-27 13:04:51 -05:00
Timothy Clem
c8dfe57a48 Remove Data.Record entirely 2018-09-26 14:05:29 -05:00
Timothy Clem
38a4bb38f2 WIP - replace Record across the project
Not quiet there with Diff and decorators yet
2018-09-21 13:46:25 -07:00
Rob Rix
038b56970e Parameterize Evaluator by the term type. 2018-09-20 12:43:59 -04:00
Patrick Thomson
ba18287311 Merge branch 'master' into reprinting-pipeline-rename 2018-09-19 13:08:52 -04:00
Patrick Thomson
8e1ca410bb Remove Hungarian-style T- prefix from tokens and scopes.
Prefixes on data constructors are generally an antipattern in Haskell:
if you're concerned about name collisions, have clients use qualified
imports for whatever modules they need. As such, this removes the T-
prefixes from the `Token` and `Context` types. This also renames
Context to Scope, which is a more exact and readable name.
2018-09-19 12:38:48 -04:00
Patrick Thomson
22cf72c20f Merge branch 'master' into term-rewriting-mk2 2018-09-19 11:51:28 -04:00
Patrick Thomson
d68c7975d7 Merge branch 'master' into new-take-on-parse-examples 2018-09-18 17:51:22 -04:00
Timothy Clem
6817193cbc Mark assignment timeouts as pending 2018-09-18 13:00:31 -07:00
Patrick Thomson
2dc8bb0041 Merge branch 'master' into term-rewriting-mk2 2018-09-18 15:18:21 -04:00
Rob Rix
13993af2c7 Merge branch 'master' into heap-widening 2018-09-18 14:46:36 -04:00
joshvera
906da72e54 Merge remote-tracking branch 'origin/master' into scopes-and-frames 2018-09-18 12:26:18 -04:00
Patrick Thomson
c2bfde5c95 move Fragment into its own file for clarity's sake 2018-09-18 11:38:10 -04:00
Rob Rix
f3d616fbd1 Merge branch 'master' into heap-widening 2018-09-18 11:17:21 -04:00
Rob Rix
87c609fa1c Duplicate the flow-sensitive caching module. 2018-09-18 10:27:47 -04:00
Rob Rix
58c22658d3 Rename the Caching module to note its flow-sensitivity. 2018-09-18 10:26:50 -04:00
Rob Rix
560c93784c Move the cache into the Caching module. 2018-09-18 10:21:25 -04:00
Rob Rix
86654a2dab Move Configuration into Data.Abstract.Cache. 2018-09-18 10:12:02 -04:00
Rob Rix
51be2081ae 🔥 Control.Abstract.Configuration. 2018-09-18 10:10:03 -04:00
Timothy Clem
38b692b17c Merge remote-tracking branch 'origin/master' into new-take-on-parse-examples 2018-09-17 16:47:00 -07:00
Timothy Clem
31ca888da7 Introduce datatype for these language examples 2018-09-17 16:46:45 -07:00
Timothy Clem
15f7e57571 First pass at doing parse-examples in haskell and hspec 2018-09-17 15:49:18 -07:00
Patrick Thomson
1ba38e3e57 Merge remote-tracking branch 'origin/master' into term-rewriting-mk2 2018-09-17 18:31:44 -04:00
Patrick Thomson
7c35cb524a Merge branch 'master' into bump-synopsis 2018-09-17 16:18:58 -04:00
joshvera
2d071e5090 Remove Data.Abstract.Frame for now 2018-09-17 13:05:24 -04:00
joshvera
5c96b3d6d7 Merge remote-tracking branch 'origin/master' into scopes-and-frames 2018-09-17 12:08:27 -04:00
Patrick Thomson
06b44c4fc9 Replace the "initial project from stack" synopsis.
I figure that since we're starting to show this to other teams, it
behooves our documentation to have a more meaningful description.
Happy to change this if y'all can come up with a snappier synopsis.
2018-09-17 11:21:21 -04:00
joshvera
68ca3b06bc Remove type-combinators dep 2018-09-14 19:04:09 -04:00
Timothy Clem
d2524e194d Merge branch 'master' into assignment-timeout 2018-09-14 14:03:37 -07:00
Patrick Thomson
d1cc400dc0 add spec file 2018-09-14 13:10:22 -04:00
Patrick Thomson
b8b8fe01c9 port over Control.Rewriting 2018-09-14 12:47:21 -04:00
Timothy Clem
a6ce4f672f Docs and sort out a common Duration datatype 2018-09-13 14:51:32 -07:00
Timothy Clem
7e1c7a1c84 Timeout effect 2018-09-13 14:20:42 -07:00
Patrick Thomson
7129435dc8 Merge remote-tracking branch 'origin/master' into simplify-reprinter
also incorporates a number of changes. oops.
2018-09-12 12:14:01 -04:00
Patrick Thomson
0802e0a9f2 Use a deep embedding for Tokenize. 2018-09-11 18:54:37 -04:00
Timothy Clem
2e48678e6b Rework diff grpc api as well, enable for all supported langauges 2018-09-11 10:32:29 -07:00
joshvera
1eac23ce2e Don't parameterize scopes by name 2018-09-10 18:50:40 -04:00
Timothy Clem
c806be4cfc Clean up, expand grpc support to larger language list 2018-09-10 11:43:42 -07:00
Timothy Clem
38e3cba57a Messy, but working multi-lang grpc parsing 2018-09-10 11:15:52 -07:00
Timothy Clem
a15155c4da Basics of TermVertex in grpc 2018-09-06 17:27:13 -07:00
Timothy Clem
f0d164f952 Rework control flow graph data types 2018-09-06 15:12:12 -07:00
joshvera
3ccdbdb692 Merge remote-tracking branch 'origin/master' into scopes-and-frames 2018-09-05 12:54:45 -04:00
joshvera
01af82bf53 WIP 2018-09-04 12:43:14 -04:00
joshvera
3d412f7d9e Add ScopeGraph 2018-08-29 13:47:44 -04:00
Timothy Clem
34648a263a Merge branch 'master' into source-aware-reprinter 2018-08-28 11:34:53 -07:00
Timothy Clem
5da417d01c Some basic pretty printing for mini Python 2018-08-28 09:14:48 -07:00
Timothy Clem
ea01f30de5 Put this back in order 2018-08-28 09:12:44 -07:00