Uwe Schindler
6e83f41e94
Merge branch 'more_def_cleanup' of https://github.com/rmuir/elasticsearch into more_def_cleanup
2016-06-15 21:47:28 +02:00
Uwe Schindler
5b11b15300
fix typo
2016-06-15 21:46:58 +02:00
Robert Muir
786c3b0fa8
speed up compound assignments
2016-06-15 14:38:37 -04:00
Robert Muir
a4036b8069
add compound assignment tests
2016-06-15 14:02:19 -04:00
Uwe Schindler
949e99bde3
Merge branch 'more_def_cleanup' of https://github.com/rmuir/elasticsearch into more_def_cleanup
2016-06-15 19:48:53 +02:00
Uwe Schindler
8d3c411298
Remove unneeded type adaption and add error message on violation
2016-06-15 19:48:38 +02:00
Robert Muir
e3f34730ae
and compound assignment
2016-06-15 13:37:10 -04:00
Robert Muir
27f8b6e6db
get compound assignment working
2016-06-15 13:30:21 -04:00
Uwe Schindler
ca2e0e1660
Some small cleanups around the lookup
2016-06-15 19:07:13 +02:00
Uwe Schindler
767bb49da8
Fix bug with first param (receiver) on the cache lookup
2016-06-15 19:00:22 +02:00
Uwe Schindler
283410b7ac
Merge branch 'more_def_cleanup' of https://github.com/rmuir/elasticsearch into more_def_cleanup
2016-06-15 18:37:07 +02:00
Uwe Schindler
04ab42cdf5
Use rethrow puzzler in the ClassValue
2016-06-15 18:36:45 +02:00
Robert Muir
d4db8c9c82
some cleanup
2016-06-15 12:32:38 -04:00
Uwe Schindler
6487940a79
Move type changes up to static part
2016-06-15 18:26:11 +02:00
Uwe Schindler
a473298f44
Add megamorphic cache
2016-06-15 18:21:42 +02:00
Robert Muir
b71f42a627
split MIC from PIC
2016-06-15 09:07:11 -04:00
Robert Muir
2b1ebc55a9
remove null guards from +, if not needed.
...
improve DefBootstrapTests
2016-06-14 23:52:21 -04:00
Robert Muir
5e4b2f2815
clean up compound assignment tests, fix shift bug
2016-06-14 20:40:16 -04:00
Robert Muir
cd4f4594d6
fix perf bug with xor promotion
2016-06-14 19:19:50 -04:00
Jack Conradson
5cef06fa3e
Add a test.
2016-06-14 14:28:47 -07:00
Jack Conradson
36f7632232
Correct type checking during casting related to Object.
2016-06-14 14:12:23 -07:00
Robert Muir
b69e8aadbd
refactor tests
2016-06-14 15:07:56 -04:00
Robert Muir
e4dc469e58
Merge pull request #18849 from rmuir/give_indy_ops_types
...
Remove casts and boxing for dynamic math
2016-06-14 13:01:04 -04:00
Robert Muir
79f0ab2fc6
rename this variable
2016-06-14 12:51:29 -04:00
Nik Everett
49c09f1527
Test: Fix error message check for Windows
...
Betrayal! CRLF strikes again. Weakened the test from equals to
containsString.
2016-06-14 09:56:49 -04:00
Robert Muir
a12937d548
painless: remove casts and boxing for dynamic math
2016-06-14 00:49:13 -04:00
Robert Muir
7ecb4ca4e9
Refactor def math
2016-06-13 18:56:28 -04:00
Nik Everett
6617b53422
Painless: Add support for /regex/
...
Adds `/regex/` as a regex constructor. A couple of fun points:
1. This makes generic the idea of arbitrary stuff adding a constant.
Both SFunction and LRegex create a statically initialized constant.
Both go through Locals to do this because they LRegex isn't directly
iterable from SScript.
2. Differentiating `/` as-in-division from `/` as-in-start-of-regex
is hard. See:
http://www-archive.mozilla.org/js/language/js20-2002-04/rationale/syntax.html#regular-expressions
The javascript folks have a way, way tougher time of it then we do
because they have semicolon insertion. We have the much simpler
delimiter rules. Even with our simpler life we still have to add
a hack to get lexing `/regex/` to work properly. I chose to add
token-level lookbehind because it seems to be a pretty contained hack.
I considered and rejected lexer modes, a lexer member variable,
having the parser set variables on the lexer (this is a fairly common
solution for js, I believe), and moving regex parsing to the parser
level.
3. I've only added a very small subset of java.util.regex to the
whitelist because it is the subset I needed to test LRegex sanely.
More deserves to be added, and maybe more regex syntax like `=~` and
`==~`. Those can probably be added without too much pain.
2016-06-13 18:11:45 -04:00
Robert Muir
c6e144f669
remove stray tab, fix comment
2016-06-13 13:35:11 -04:00
Robert Muir
faee2323ab
add array ctor refs
2016-06-12 12:53:37 -04:00
Robert Muir
5be9211761
cleanup grammar
2016-06-12 11:25:52 -04:00
Uwe Schindler
60cc152caf
Remove unused field
2016-06-11 22:34:17 +02:00
Robert Muir
5c352a063a
need not be public, should not be public
2016-06-11 16:03:45 -04:00
Robert Muir
07baefac32
Add comments
2016-06-11 16:01:50 -04:00
Uwe Schindler
fd9b0f9087
Remove some hardcoded strings, fix exception handling (remove rethrow), add some utility methods around the "handle$" fields
2016-06-11 21:53:15 +02:00
Robert Muir
454881eeb4
test interface default methods
2016-06-11 15:51:32 -04:00
Uwe Schindler
c08b45a277
More cleanup
2016-06-11 21:20:39 +02:00
Robert Muir
65352face2
fix too long line
2016-06-11 15:04:49 -04:00
Robert Muir
592042601f
def case working
2016-06-11 15:02:43 -04:00
Uwe Schindler
876f0a613e
Unfuck the MethodWriter nesting. All MethodWriters should only live separately from each other, no nesting
2016-06-11 21:00:06 +02:00
Robert Muir
e2f999b025
make this static final
2016-06-11 14:33:48 -04:00
Robert Muir
8d5a70200f
write refs for functions
2016-06-11 14:29:15 -04:00
Robert Muir
ab457be9d8
remove unnecessary semicolon and return
2016-06-11 13:48:04 -04:00
Robert Muir
0bfb166eeb
merge master
2016-06-11 13:23:17 -04:00
Nik Everett
4a265d0279
Painless: Add } as a delimiter. Kindof.
...
Add `}` is statement delimiter but only in places where it is
otherwise a valid part of the syntax, specificall the end of a block.
We do this by matching but not consuming it. Antlr 4 doesn't have
syntax for this so we have to kind of hack it together by actually
matching the `}` and then seeking backwards in the token stream to
"unmatch" it. This looks reasonably efficient. Not perfect, but way
better than the alternatives.
I tried and rejected a few options:
1. Actually consuming the `}` and piping a boolean all through the
grammar from the last statement in a block to the delimiter. This
ended up being a rather large change and made the grammar way more
complicated.
2. Adding a semantic predicate to delimiter that just does the
lookahead. This doesn't work out well because it doesn't work (I
never figured out why) and because it generates an *amazing*
`adaptivePredict` which makes a super huge DFA. It looks super
inefficient.
Closes #18821
2016-06-11 12:51:25 -04:00
Jack Conradson
e293000d8d
Merge branch 'master' into stubby
2016-06-10 16:22:17 -07:00
Jack Conradson
bd94c62adf
Added a stub node for lambda expressions.
2016-06-10 16:18:36 -07:00
Robert Muir
16d17351f7
don't use loadLocal, add new node to package-info
2016-06-10 17:37:57 -04:00
Robert Muir
9e0a70c4b2
Merge branch 'master' into capturingReferences
2016-06-10 17:10:56 -04:00
Jack Conradson
f98be6fa06
Add functions to Painless.
...
Closes #18810
2016-06-10 13:59:59 -07:00
Robert Muir
edb0fd3b88
painless: add capturing method references
2016-06-10 14:24:58 -04:00
Robert Muir
9826b64e1f
Exempt LocalDate from bridge method checks on java 9
...
The painless whitelist has a lot of self-checking, in this case, it checks
for missing covariant overrides. It fails on java 9, because LocalDate.getEra()
now returns IsoEra instead of Era: https://bugs.openjdk.java.net/browse/JDK-8072746
To our checker, it thinks we were lazy with whitelisting :)
This means painless works on java 9 again
2016-06-08 15:47:09 -04:00
Jack Conradson
be168f528b
Merge pull request #18771 from jdconrad/methods
...
Add Method to Get New MethodWriters
2016-06-07 11:47:29 -07:00
Jack Conradson
f9b45107c4
Added method to allow creation of new methods on-the-fly.
2016-06-07 11:24:33 -07:00
Robert Muir
f23e8c3722
more cleanups
2016-06-07 12:42:19 -04:00
Robert Muir
89224dbc3c
switch FunctionRef over to methodhandles
2016-06-07 11:56:44 -04:00
Robert Muir
32965f043a
convert FunctionRef/Def usage to methodhandles.
2016-06-07 10:23:49 -04:00
Robert Muir
3108c399f0
use painless types in FunctionRef
2016-06-07 09:49:54 -04:00
Robert Muir
39550354a7
compute functional interface stuff in Definition
2016-06-07 09:41:03 -04:00
Uwe Schindler
3238868cc4
Make checkstyle happy (add Lookup import, line length)
2016-06-07 13:06:23 +02:00
Uwe Schindler
cac111ff73
Don't hide LambdaConversionException and behave like real javac compiled code when a conversion fails. This works anyways, because fallback is allowed to throw any Throwable
2016-06-07 13:00:36 +02:00
Uwe Schindler
6913be2ec2
Pass through the lookup given by invokedynamic to the LambdaMetaFactory. Without it real lambdas won't work, as their implementations are private to script class
2016-06-07 12:32:59 +02:00
Robert Muir
950b093fc7
Merge branch 'master' into painless_method_references
2016-06-06 22:39:28 -04:00
Jack Conradson
b3804c47f7
Cleaned up SEach node.
2016-06-06 18:21:08 -07:00
Robert Muir
231268c89d
remove outdated TODO
2016-06-06 21:04:59 -04:00
Jack Conradson
6dace47c1f
Reverted S-node design change.
2016-06-06 17:59:39 -07:00
Robert Muir
8db9a971e5
enable test
2016-06-06 20:30:42 -04:00
Robert Muir
2852e82ab9
add def iteration over arrays
2016-06-06 20:07:32 -04:00
Robert Muir
d331f8768e
implement dynamic case for iterables
2016-06-06 19:41:37 -04:00
Jack Conradson
aeaf39f36d
Added a for each stub node for a target type of def.
2016-06-06 16:07:12 -07:00
Jack Conradson
a088d367f7
More comments.
2016-06-06 15:58:56 -07:00
Jack Conradson
f897342296
Updated package info documentation.
2016-06-06 15:34:51 -07:00
Jack Conradson
9a78f6955b
Added foreach for array types.
2016-06-06 15:25:09 -07:00
Robert Muir
23d7cdd043
ban slow methods in MethodHandle
2016-06-06 17:58:00 -04:00
Robert Muir
b32f6abb26
remove unnecessary caching
2016-06-06 17:29:03 -04:00
Jack Conradson
a4ffaa6e7a
Working iterable foreach with tests.
2016-06-06 13:53:31 -07:00
Jack Conradson
b2e648dfde
Implementation of iterable.
2016-06-06 12:33:25 -07:00
Jack Conradson
260b0fd40f
Stubbed foreach node.
2016-06-06 10:49:40 -07:00
Jack Conradson
0c9174decc
Merge branch 'master' into each
2016-06-06 09:23:01 -07:00
Robert Muir
881e4058ee
don't do a no-op filter, that was just for testing
2016-06-06 09:39:39 -04:00
Robert Muir
6dbf7ab1ea
initial messy impl of painless method references
2016-06-06 09:27:19 -04:00
Uwe Schindler
c0a3a20071
painless: Add support for the new Java 9 MethodHandles#arrayLength() factory (see https://bugs.openjdk.java.net/browse/JDK-8156915 )
2016-06-03 23:35:11 +02:00
Jack Conradson
9a0d0d7cff
Fixed a grammar mistake in a comment.
2016-06-02 15:30:11 -07:00
Robert Muir
b5393ce55e
Improve painless compile-time exceptions
2016-06-02 18:23:47 -04:00
Jack Conradson
b6e1429760
Merge branch 'master' into each
2016-05-31 09:36:04 -07:00
Robert Muir
2d1eb89aef
improve date api for expressions/painless fields
2016-05-31 09:32:33 -04:00
Jack Conradson
d1f4e2ef04
Merge branch 'master' into each
2016-05-30 16:22:14 -07:00
Jack Conradson
f5be0982d9
Added initial infrastructure to allow for each to be made.
2016-05-27 17:41:31 -07:00
Jack Conradson
2d8030f09f
Added foreach in grammar.
2016-05-27 13:50:38 -07:00
Robert Muir
aa53285448
add java.time packages to painless whitelist
2016-05-27 15:07:27 -04:00
Robert Muir
3f06d9f3b8
Merge pull request #18600 from rmuir/new_script_exception
...
replace ScriptException with a better one
2016-05-26 17:51:34 -04:00
Jack Conradson
cde83e363a
Add an update script equivalent test.
2016-05-26 13:16:22 -07:00
Robert Muir
f037807117
replace ScriptException with a better one
2016-05-26 11:43:29 -04:00
Jack Conradson
eefcafd831
Add method reference stub to Painless.
2016-05-25 10:34:21 -07:00
Ryan Ernst
82ae65bbb5
Tests: Make score tests unit tests
...
This change simply removes the need for single node tests from score
tests.
2016-05-24 19:53:50 -07:00
Robert Muir
a5d0ccf50b
painless: add trap tests
2016-05-23 23:36:40 -04:00
Robert Muir
0a9c036c3e
Merge branch 'master' into painless_more_whitelisting
2016-05-23 20:35:44 -04:00
Jack Conradson
1424f09c02
Remove Painless grammar ambiguities.
...
Closes #18531
2016-05-23 16:39:52 -07:00
Robert Muir
a56a9cb818
improve painless whitelist coverage of java api
2016-05-23 19:35:28 -04:00
Lee Hinman
fdfd2a2f18
Remove ScriptMode class in favor of boolean true/false
...
This removes the ScriptMode class entirely, which was an enum with two
options (ON and OFF) which essentially boiled down to true and false.
Now the boolean values are used instead.
2016-05-20 15:01:30 -06:00
Jack Conradson
b156438957
Proxy box method to use valueOf.
2016-05-20 11:22:18 -07:00
Jack Conradson
0e24ed49e6
Use the build-in valueOf method instead of the custom one.
2016-05-20 11:13:43 -07:00
Jack Conradson
d836194095
Fixed tests and added a comment to the box method.
2016-05-20 11:04:09 -07:00
Jack Conradson
2b793c1e06
Fix boxing.
2016-05-20 10:38:06 -07:00
Robert Muir
c0eb813e10
Merge branch 'clean' into whitelist_cleanup
2016-05-20 10:59:13 -04:00
Robert Muir
ce9b36590a
simplify tree node use of compiler settings
2016-05-20 09:36:09 -04:00
Robert Muir
b3c71c1e3a
improve style for these constants
2016-05-20 08:42:29 -04:00
Uwe Schindler
7bc91c00d9
More elegant way to force class initialization
2016-05-20 14:12:15 +02:00
Uwe Schindler
6205f79554
Remove Definitions's copy-ctor; fix RuntimeClass to be unmodifiable
...
Please note: The maps inside the pirvate singleton instance of Defininition are no longer unmodifiable, but nothing from the outside can modify it! All private :-)
2016-05-20 14:03:46 +02:00
Uwe Schindler
4ffa92c7c1
Remove the Definition instance passed around everywhere
2016-05-20 12:35:08 +02:00
Uwe Schindler
91f4bba042
Make Definition's public API completely static.
...
TODO: Remove Definition arguments everywhere and hide INSTANCE field!
2016-05-20 11:22:03 +02:00
Uwe Schindler
f5fc60ac67
Add utility type constant
2016-05-20 11:05:40 +02:00
Jack Conradson
4e454439bb
Fixed bugs in comparison with Def. Fixed may tests.n
2016-05-20 02:04:38 -07:00
Uwe Schindler
87ab39613d
more constants
2016-05-20 10:56:50 +02:00
Uwe Schindler
82aed08301
Restore constants as static final (first step)
2016-05-20 10:48:41 +02:00
Jack Conradson
64e2ef5807
Removed transforms. No user-facing boxing.
2016-05-19 23:38:14 -07:00
Jack Conradson
3962553551
Removed user-facing boxing.
2016-05-19 18:51:55 -07:00
Uwe Schindler
cfe555d216
move unused @SuppressWarnings one level up
2016-05-20 00:46:05 +02:00
Robert Muir
afa9ebad28
dce
2016-05-19 16:03:11 -04:00
Robert Muir
0ee726ed0d
nuke eclipse warnings
2016-05-19 15:35:26 -04:00
Robert Muir
a569130368
fix typo
2016-05-19 15:28:59 -04:00
Robert Muir
b9c7dbcfbd
nuke overflow detection as we cannot guarantee for def. simplify life :)
2016-05-19 15:25:31 -04:00
Robert Muir
915ab16176
First steps at whitelist cleanup
2016-05-19 09:29:48 -04:00
Robert Muir
1022123f59
Merge pull request #18400 from uschindler/painless_java9StringConcats
...
Use Java 9 Indy String Concats, if available
2016-05-18 08:00:20 -04:00
Uwe Schindler
ea9026e6d8
painless: fix checkstyle
2016-05-18 00:31:12 +02:00
Uwe Schindler
b418d01117
painless: Improve string concat tests; add state machine check after MethodWriter
2016-05-18 00:26:47 +02:00
Jack Conradson
f055ad641a
Made def variable casting consistent with invokedynamic rules.
2016-05-17 13:16:49 -07:00
Uwe Schindler
b27b0483d5
Merge branch 'master' into painless_java9StringConcats
...
# Conflicts:
# modules/lang-painless/src/test/java/org/elasticsearch/painless/StringTests.java
2016-05-17 18:47:33 +02:00
Uwe Schindler
5622e9c9d3
painless: use Java 9 Indy String Concats, if available
2016-05-17 17:44:46 +02:00
Robert Muir
fa5f099486
make semicolons only optional at the end
2016-05-17 10:55:40 -04:00
Robert Muir
92339c4763
painless: add method overloading based on arity
...
Closes #18385
Squashed commit of the following:
commit b2819df4d392d69b86e5c96d358eb03424e67e02
Author: Robert Muir <rmuir@apache.org>
Date: Tue May 17 09:15:47 2016 -0400
add note about tuple
commit 85fcac6a0d0674da24535121eab23e2c407d683f
Author: Robert Muir <rmuir@apache.org>
Date: Mon May 16 23:39:25 2016 -0400
painless: add method overloading based on arity
2016-05-17 09:17:43 -04:00
Uwe Schindler
75f27df376
painless: Refactor WriterUtils to extends ASM GeneratorAdapter as "MethodWriter" for easy usage (and more coming later)
2016-05-17 02:25:05 +02:00
Jack Conradson
3fd3d367ef
Moved ADefLink to be a marker interface instead.
2016-05-16 15:48:29 -07:00
Jack Conradson
3f23186712
Merge branch 'master' into types
2016-05-16 14:22:59 -07:00
Jack Conradson
95a1b5b2a3
Fixed a casting bug in Painless.
2016-05-16 14:18:05 -07:00
Robert Muir
e69305ae21
Merge pull request #18372 from rmuir/painless_whitelist_expansion
...
painless whitelist expansion
2016-05-16 17:08:49 -04:00
Robert Muir
8d4c1befe5
Merge pull request #18364 from rmuir/nukeRunAsFloat
...
Remove LeafSearchScript.runAsFloat(): Nothing calls it.
2016-05-16 17:08:25 -04:00
Jack Conradson
1d394868d4
Merge branch 'master' into types
2016-05-16 12:43:24 -07:00
Jack Conradson
43344eee82
Add more def tests including checking bytecode for specific
...
optimizations.
2016-05-16 12:42:25 -07:00
Jack Conradson
f664fa5f33
Merge pull request #18350 from uschindler/painless_isAssignableFrom
...
Use isAssignableFrom instead of relying on ClassCastException
2016-05-16 12:41:09 -07:00
Jack Conradson
a2c2628a78
Merge pull request #18359 from uschindler/painless_removeStoreBoxing
...
Remove boxing when loading and storing values in "def" fields/arrays, remove boxing onsimple method calls of "def" methods
2016-05-16 12:11:37 -07:00
Uwe Schindler
d6cbbdeb98
painless: Some reformatting in EChain to make it clear if "this" or inner "expression" is affected
2016-05-16 21:04:03 +02:00
Uwe Schindler
b05ac87a5d
painless: Add Jack's test
2016-05-16 20:37:51 +02:00
Uwe Schindler
3a5ef68ad0
painless: Fix issue with dup and cast
2016-05-16 20:31:27 +02:00
Robert Muir
2fc7ca46e1
expand whitelist for basic types
2016-05-16 09:56:29 -04:00
Uwe Schindler
07e4f416e6
painless: Small cleanup of Debugger class to use StringWriter
2016-05-16 15:52:14 +02:00
Robert Muir
8edf213492
Remove LeafSearchScript.runAsFloat(): Nothing calls it.
2016-05-15 22:59:28 -04:00
Uwe Schindler
65aca4f71c
painless: make compound statement like a[1]++ work with def. There was also a bug with the size of LDefArray: fixed
2016-05-15 23:00:32 +02:00
Uwe Schindler
d221cd14d2
painless: Also remove boxing for reads and method calls
2016-05-15 19:49:25 +02:00
Uwe Schindler
604bcd9320
painless: Make field stores not box; use GeneratorAdapter.invokeDynmaic for consistency with other method calls
2016-05-15 18:31:53 +02:00