Commit Graph

63192 Commits

Author SHA1 Message Date
Mikhail Glukhikh 92ac1d3f3d FIR: use FirDefaultPropertyAccessor if no body also in lightTree builder 2020-03-23 15:13:17 +03:00
Jinseong Jeon e46a4246d2 FIR: regard property accessor without body as FirDefaultPropertyAccessor 2020-03-23 15:12:54 +03:00
Roman Elizarov e26a3ad033 Speed up stdlib readLine function (#3185)
There are several performance optimizations:

* ByteBuffer/CharBuffer/StringBuilder objects pre-allocated and are
  reused on each call to readLine.
* The state for readLine is lazily allocated via JVM classloading
  (using a singleton object).
* There is an auto-detection heuristic for "directEOL" encodings which
  represent LF ('\n') directly as the corresponding byte
  (UTF-8 and many single-byte encodings are like that).
  When "directEOL" encoding is used, then bytes are batched into
  ByteBuffer for a single call to CharsetDecoder.decode which
  results in higher throughput. Otherwise (UTF-16, etc), slower
  byte-by-byte approach is used.
* Bytes and chars are directly moved in/out of byte/char arrays and
  ByteBuffer/CharBuffer wrappers are used only to interface with
  JVM CharsetDecoder class (which is the slowest piece).
* StringBuilder is not used at all for short lines (<=32 chars).

There are also some function improvements to readLine functionality:

* Restriction on "max chars per byte" is lifted, so readLine works with
  all encodings that JVM supports.
* It support on-the-fly changes to system default charset, because
  it rechecks current charset on each call and updates it decoder
  when needed.

All the other features of readLine function are retained:

* It does not read more bytes from System.in than needed, so it
  is compatible with other ways to read System.in. On-the-fly
  changes to System.in are supported.
* It is thread-safe. Its internal mutable state is protected by
  synchronization.
* There is an internal method for tests that supports explicit
  charset specification, but the name of this method has changed.

There are additional tests:

* Check all supported encodings on JVM to make sure that readLine
  works correctly with them all.
* Check unicode code points of different bits length with all standard
  unicode encodings (UTF-8, UTF-16, and UTF-32 in LE/HE byte orders).

Benchmarks that compare different implementations of readLine,
including this one (readLine6NoLV in the set) can be found here:
https://github.com/elizarov/ReadLineBenchmark

Taking BufferedReader as 100% baseline we see that:

* Current readLine is 7.5 times slower than BufferedReader baseline.
* New implementation in this commit is 2.5 timer slower than baseline.
  It is ~3 times faster than existing implementation of readLine.

Altogether these optimizations are enough to enable reading of
~500K lines in sports programming setting under 2s time-limit with
plenty of headroom in time. Example that is using this version of
readLine can be found here:
https://codeforces.com/contest/1322/submission/73005366

#KT-37416 Fixed
2020-03-23 14:36:55 +03:00
Mikhail Bogdanov aae6319c39 Minor. Specify test runner to support parallel test execution 2020-03-23 12:27:52 +01:00
Vladimir Ilmov cd12226f20 (CoroutineDebugger) Alternative CoroutineInfoProvider added
Added way to retrieve coroutine information without an agent
in target JVM. 'kotlin.debugger.coroutines.switch' provides
two possibilities to test coroutines.
Agent way gets activated once kotlinx.coroutines.debug.DebugProbes
started with javaagent.
Library-less ways use DispatchedContinuation or ChildContinuationImpl
classes to retrieve coroutine information and stack traces.
2020-03-23 12:27:07 +01:00
pyos ac6036f366 JVM_IR: move state machine generation to ClassCodegen 2020-03-23 12:23:17 +01:00
pyos bc37a87974 JVM_IR: produce better debug messages on inlining failures
That's the only thing `compilationContextDescriptor` is used for; it
clearly shouldn't point to the callee, but to the caller.
2020-03-23 12:23:17 +01:00
pyos b317187f20 JVM_IR: buffer method bytecode in FunctionCodegen 2020-03-23 12:23:17 +01:00
pyos f6e7d7f7f1 JVM_IR: refactor FunctionCodegen a bit 2020-03-23 12:23:17 +01:00
pyos df5c5b163e JVM_IR: refactor ClassCodegen a bit 2020-03-23 12:23:17 +01:00
Andrey Uskov 79ec081bbf Add changelog for 1.4-M1 2020-03-23 13:50:16 +03:00
Dmitriy Dolovov 03cd229784 IDE perf tests for K/N: Drop redundant check for CommonLibraryKind 2020-03-23 16:49:58 +07:00
Dmitry Petrov b0e916769d Add test for KT-37570 2020-03-23 12:27:58 +03:00
Dmitriy Dolovov f46fc7d848 IDE: Fix i18n for KlibMetaFileType 2020-03-23 15:39:33 +07:00
Dmitriy Dolovov f4aa0fad44 IDE: Unify creation of KLIB package fragment providers (common, native) 2020-03-23 15:39:27 +07:00
Dmitriy Dolovov bf4a153c0c IDE: Use CachingIdeKlibMetadataLoader in Native & Common KLIB analysis 2020-03-23 15:39:21 +07:00
Dmitriy Dolovov c8a9b88504 IDE: Refactor NativePlatformKindResolution & NativeResolverForModuleFactory 2020-03-23 15:39:05 +07:00
Dmitriy Dolovov 98877eb87e IDE: Rename NativeLibraryInfo to NativeKlibLibraryInfo 2020-03-23 15:38:59 +07:00
Dmitriy Dolovov 816db96113 IDE: Drop NativeLibraryInfo.NATIVE_LIBRARY_CAPABILITY 2020-03-23 15:38:53 +07:00
Dmitriy Dolovov 5f7a6d55a8 KLIB: Fix compilation 2020-03-23 15:38:46 +07:00
Dmitry Savvinov 26ab9b4fc9 Move Klib-related logic from idea-native module 2020-03-23 15:38:40 +07:00
Dmitry Savvinov 417554dca0 Move .klib files from KotlinNativeFileTypeFactory to Kotlin-wide one 2020-03-23 15:38:32 +07:00
Dmitry Savvinov 987e1019a8 Rename everything non-Native specific to Klib 2020-03-23 15:38:26 +07:00
Dmitry Savvinov b6d811c69c Extract common logic of detecting klibs and creating LibraryInfo by klib 2020-03-23 15:38:19 +07:00
Dmitry Savvinov 6ccb8cd0a3 Properly check platform of klib by reading manifest 2020-03-23 15:38:11 +07:00
Georgy Bronnikov 4742057b51 IR: generate lambdas in place in Psi2Ir
even when arguments are to be rearranged.
Lambdas have no side effects, and storing them in temporary variables
prevents processing in the backend
(such as inserting continuation parameter in AddContinuationLowering).
2020-03-23 11:09:30 +03:00
nataliya.valtman 915e6107d1 make Bootstrap option available in buildSrc 2020-03-23 08:43:06 +03:00
Vladimir Dolzhenko 344dbeffe8 Fix IntentionTestGenerated$IntroduceImportAlias.testConflictPackage
Fix test data as find usages can handle import aliases

Relates to #KT-18619
2020-03-22 15:30:49 +01:00
Mikhail Zarechenskiy d4d35bb766 Revert "[NI] Prefer between two complex variables one with proper lower bounds"
This reverts commit ced8a92629.
2020-03-22 17:16:22 +03:00
Vladimir Dolzhenko f82e2db65d Fix effective search scope for find references
Relates to #KT-18619
2020-03-22 10:19:33 +01:00
Dmitriy Novozhilov 6ce8d661ad [FIR] Add nullability to ILT. #KT-37639 Fixed 2020-03-20 23:11:28 +03:00
Dmitriy Novozhilov 006e1f6528 [FIR-TEST] Add test for KT-37638 2020-03-20 23:11:28 +03:00
Dmitriy Novozhilov 5f9f01fe4e [FIR] Implement new completion mode calculator
Note that `testDelegates` now fails due to KT-37638 and
    `testSimpleIn` fails due to problems with type parameters
    of inner classes
2020-03-20 23:11:28 +03:00
Dmitriy Novozhilov ea02855ba6 [FIR] Fix type arguments and substitution for flexible types 2020-03-20 23:11:28 +03:00
Dmitriy Novozhilov 7bfe7061e7 [FIR] Add proper nullability for java enums 2020-03-20 23:11:28 +03:00
Nikolay Krasko 7764492761 Resolve failure with surefire on Windows agents in kotlin-java-example (KT-37654)
Remove version specification like it's done in other modules.
2020-03-20 21:14:23 +03:00
Leonid Startsev f0dc809255 Add explicit api mode flag to top-level kotlin {} DSL block in Gradle
for both MPP and single-target projects.

For now, it is only applied to source sets that are connected to 'main'
compilation. It seems fine for all projects except android ones.
There's a way to determine android variant for source set,
but importing android projects seems to be made via other code path.

 #KT-36019 Fixed
 #KT-37652 Open
2020-03-20 19:41:06 +03:00
Ilya Goncharov 59148cdce4 [Gradle, JS] Fix extracting package json from klib
#KT-37636 fixed
2020-03-20 19:18:02 +03:00
max-kammerer a3125849a0 Merge pull request #3204 from pyos/ir/fix-lambda-inner-classes
JVM_IR: restore InnerClasses for objects in lambdas
2020-03-20 17:15:41 +01:00
Ilya Goncharov 40a0e31be4 [Gradle, JS] Add other devtools
#KT-37635 fixed
2020-03-20 19:13:24 +03:00
Ilya Goncharov 5058c396c1 [Gradle, JS] Webpack devtool as a String
#KT-37635 fixed
2020-03-20 19:13:00 +03:00
Vladimir Dolzhenko e951f1a43a Find Usages and Go to declaration of element used via import alias
#KT-18619 Fixed
2020-03-20 14:59:24 +00:00
Mikhail Zarechenskiy ced8a92629 [NI] Prefer between two complex variables one with proper lower bounds
#KT-37554 Fixed
2020-03-20 15:44:53 +03:00
Dmitriy Dolovov b0254a27aa Fix. Provide the proper K/N dependencies in leaf HMPP source sets
Issue #MMPP-213
2020-03-20 19:43:18 +07:00
Dmitriy Dolovov 7f2839ee10 Fix. Don't inherit K/N dependencies in common source sets
Issue #MMPP-213
2020-03-20 19:43:08 +07:00
Dmitriy Dolovov 2d8bec19c0 Minor. Simplify generation of substituted dependencies 2020-03-20 19:42:56 +07:00
Dmitry Gridin d84f528a47 KotlinSdkType: fix i18n for 192
#KT-37632 Fixed
#KT-37483
2020-03-20 17:38:22 +07:00
Natalia Selezneva 39d019ec9d Tests: switch ScriptChangeNotifier off in tests 2020-03-20 13:14:48 +03:00
Ilya Goncharov dd7f10e76e [Gradle, JS] Fix after rebase 2020-03-20 12:55:50 +03:00
Ilya Goncharov a07425e7b0 [Gradle, JS] Fix test 2020-03-20 12:45:29 +03:00