Commit Graph

44 Commits

Author SHA1 Message Date
Roman Artemev 6a37955a36 [KLIB] Implement new linker based on IdSignature
- Remove klib dependency on metadata and uniqID
 - Refactored proto format to make it more effective and compact
  -- Use special encoding for some types of data (coordinates, flags, types)
  -- Remove symbols table
  -- Use packed proto list if it is possible
 - Remove extension from metadata
 - Remove special ids for function interfaces
 - Fix klib IO
 - Fix incremental cache
 - General code clean up
2020-02-14 18:22:16 +03:00
Mikhail Zarechenskiy f7ce1c669b FIC: Introduce isFun property for descriptors and proto 2020-01-17 19:35:06 +03:00
Alexey Tsvetkov 6e9cd85b54 Exclude some proto messages from proto comparison in IC 2019-11-08 14:14:58 +03:00
Alexey Tsvetkov 28e6219b0b Fix proto comparison for fields mapped to type table 2019-11-08 14:14:58 +03:00
nikita.movshin 65244b4bea Update copyright.
Change the copyright from "JetBrains s.r.o." to
"JetBrains s.r.o. and Kotlin Project contributors"
Update only 2 lines copyright.
2019-04-23 20:09:22 +03:00
Alexander Udalov 76e133014b Minor, explain why we don't store array type arguments in ::class in proto 2019-02-26 19:09:42 +01:00
Sergey Rostov f35185b261 Build: remove explicit dependencies to org.jetbrains.annotations 2019-01-28 13:43:08 +03:00
Vyacheslav Gerasimov f58acbeef5 Build: implement useBootstrapStdlib flag
Excludes stdlib projects from build and uses bootstrap stdlib artifacts

 #KT-29205
2019-01-21 21:09:40 +03:00
Vyacheslav Gerasimov c7ab69829e Build: Convert protobuf to includable build with maven publication
#KT-29202
2019-01-17 20:45:11 +03:00
Sergey Rostov 883970fadb Add explicit dependencies to nullable annotations 2018-12-26 09:07:06 +03:00
Alexander Udalov 1ee1d15b91 Support annotations on property accessors in JS/common metadata
#KT-14529 Fixed
2018-10-24 18:17:12 +02:00
Mikhail Zarechenskiy 7d2bc5c0f6 Properly load top-level constant initializers from multifile classes
Before Kotlin 1.3-M2 we didn't write `has_field` flag for constants
 inside multifile classes. Now we write and rely on this when
 trying to load constant initializers, which is totally fine for
 binaries that were compiled with the 1.3-M2 or newer version.
 Unfortunately, constant initializers will not be loaded for old binaries.

 One way is to avoid relying on this flag, but then we'll get other
 problems (e.g. 3345dc81fd).

 Therefore, for binaries that were compiled with at least 1.3-M2 version,
 we'll rely on the flag, otherwise, we won't.
2018-09-17 16:21:02 +03:00
Ilya Gorbunov a18770fbbb Remove projectDist dependency helper usages
Use default configuration dependencies instead of projectDist ones.
2018-09-12 06:05:05 +03:00
Alexander Udalov 8c942752e8 Write flags to .kotlin_module files since metadata version 1.4
This value will be used for flags like pre-release (KT-21256) and other
similar info
2018-09-10 14:12:17 +03:00
Alexander Udalov f90303315d Support array class literals in annotation serializer/deserializer
Note that this change brings an incompatibility: `Array<Foo>::class`
will be seen as `Foo::class` by the old deserializer. We consider this
OK because the compiler never had any logic that relied on reading class
literal arguments correctly (otherwise it wouldn't have worked because
it could only see `Array<*>::class` before this commit), and the support
of annotations on types in JVM reflection is only available in the
upcoming 1.3 release (KT-16795)

 #KT-22069 Fixed
2018-09-06 14:40:06 +03:00
Alexander Udalov afd53c9870 Revert metadata version reading advancement for JS/Common
This commit reverts 59e2101a25 partially,
leaving only the implementation of KT-25972 for JVM. The reason is that
we can't fully commit to stabilizing JS (and .kotlin_metadata) binary
metadata formats so much as to postpone any changes done to it for a
whole release year time. It's likely that we will need to update JS
metadata format incompatibly pretty soon, and with the scheme where we
can read the "current + 1" version, it'd require advancing the metadata
version by 2, which would break the nice property that the metadata
version (since Kotlin 1.4) is equal to the version of the compiler that
produced it.

See KT-25972
2018-08-27 13:14:09 +02:00
Alexander Udalov 9c68f2be36 Advance metadata versions and JVM bytecode version
JVM versions are increased in order to differentiate pre-1.3-M2 .class
files where signatures mentioning inline classes were not mangled. Other
versions are increased in case something similar will need to be
detected
2018-08-24 13:01:53 +02:00
Alexander Udalov 59e2101a25 Support reading binary metadata of the next major release
Already existing tests testRequireKotlinInNestedClassesAgainst14{,Js}
now check that there's no error when loading a module/class with
metadata version 1.4.0

 #KT-25972 Fixed
2018-08-21 17:12:02 +02:00
Alexander Udalov ddb398645b Reformat modules 'metadata' and 'metadata.jvm', fix some inspections 2018-08-16 15:08:18 +02:00
Alexander Udalov c011bf61fe Support multiple version requirements on single element 2018-08-13 11:02:35 +02:00
Alexander Udalov 871b896a21 Add internal compiler argument to change metadata version
Will be used in tests to check how we behave on binaries produced by a
"future" compiler
2018-07-18 17:59:37 +02:00
Alexander Udalov cfc0f5e453 Support correct way of writing/loading version requirement table
Tests are added in subsequent commits.

KT-25120 Fixed
2018-07-18 17:59:37 +02:00
Mikhail Zarechenskiy 0c6757a8b0 Write is_unsigned flag into metadata for an annotation arguments
Instead of adding new kind of types, we'll use flag to disambiguate
 usual types from unsigned ones, this approach has two advantages:
 - less changes in the metadata format
 - it allows naturally extend format for unsigned arrays,
  which will be supported later

 #KT-25310 Fixed
 #KT-25273 Fixed
2018-07-09 20:06:05 +03:00
Alexander Udalov 50c515deca Do not serialize constructors for anonymous objects
The only client of this data is reflection, and since anonymous objects
do not have constructors in the source code, they shouldn't in
reflection as well

 #KT-20442 Fixed
2018-07-02 18:49:08 +02:00
Alexander Udalov 9309570752 Fix serialization of type parameters inner generic class
The call to `createTopLevel` instead of `create` (which creates
serializers for outer classes properly, with correct type parameter
contexts) caused MetadataSerializer to write type parameter metadata
incorrectly.  For example, in the following case:

    class A<E> {
        inner class B<T, E> { ... }
    }

A's type parameter E would get id 0, and B's type parameters T and E
would get ids 0 and 1. This is a problem because ids are supposed to be
unique for each class including its outer classes, and deserializer,
decompiler and stub builder rely on this assumption.

JVM metadata is unaffected because `create` is called correctly there,
see MemberCodegen#generateKotlinClassMetadataAnnotation

 #KT-24944 Fixed
2018-06-21 14:45:45 +02:00
Alexander Udalov b8722ad213 Fail with KotlinReflectionInternalError on non-found local delegated property
Instead of IndexOutOfBoundsException from the protobuf internals which
was thrown when loading extension with a non-existing index out of the
list of all extensions (KT-23413)
2018-06-14 11:07:26 +02:00
Alexander Udalov ffa6b6233b Minor, make BinaryVersion.numbers private
Use BinaryVersion.toArray instead, as in all other usages
2018-05-16 17:16:22 +02:00
Alexander Udalov 1b15619457 Move BinaryVersion to metadata, JVM versions to metadata.jvm
To be used in kotlinx-metadata
2018-05-16 17:16:22 +02:00
Alexander Udalov e4062f6447 Add kotlinx-metadata library for handling Kotlin metadata
#KT-23198
2018-05-16 17:16:21 +02:00
Denis Zharkov 003f381fcd Replace default-type dependencies to :kotlin-stdlib with distJar
Use distJar configuration instead.
It's necessary because currently when using default-type, subproject
starts having a transitive dependency to :kotlin-stdlib-common
and that leads to exception from KT-20897 when building light classes

This change might be reverted once KT-23942 is fixed

 #KT-23942 Submitted
2018-04-26 16:11:27 +03:00
Alexander Udalov 52a9cc06e0 Remove StringTable.serializeTo, add JvmProtoBufUtil.writeData
StringTable.serializeTo was effectively only used for JvmStringTable,
but was declared in StringTable because of the usage in
DescriptorSerializer.serialize (which, in turn, was only used from JVM
codegen)
2018-04-23 18:42:33 +02:00
Alexander Udalov 7bac9b62c7 Reformat VersionRequirement and move to 'metadata' 2018-04-23 18:42:33 +02:00
Alexander Udalov 13df75ef74 Minor, extract isInstanceType to protoTypeTableUtil 2018-03-26 17:21:08 +02:00
Alexander Udalov f7a3182982 Minor, add default value to contract expression flags 2018-03-26 17:21:07 +02:00
Alexey Tsvetkov 8a82c1618c Use Plugins DSL in Kotlin Gradle scripts
When plugins DSL is used, there is no need to
manually generate typesafe accessors for extensions and
conventions (by running `./gradlew kotlinDslAccessorsSnapshot`).
2018-03-26 16:09:29 +03:00
Yan Zhulanow e2ed77354f Pill: Update module structure, add missing modules metadata and metadata.jvm 2018-03-16 16:31:55 +03:00
Alexander Udalov e21c73229c Throw exceptions explicitly in protoTypeTableUtil
Previously, if both type and typeId messages were missing (for example,
ProtoBuf.Function.returnType/returnTypeId) because of some bug, the
behavior was unpredictable because a type with id 0 from the type table
would be returned, which could be a completely irrelevant type. This is
an incorrect situation and we should report a diagnostic instead.
Temporarily throw an exception instead, since this only affects how the
compiler works on bad metadata
2018-03-14 12:25:23 +01:00
Alexander Udalov 0a78fe8ae3 Move some serialization helpers to metadata/metadata.jvm 2018-03-14 12:25:22 +01:00
Alexander Udalov 407de206a3 Minor corrections in proto schemas, mostly in comments
Also set up code style for the protobuf plugin
2018-03-14 12:25:19 +01:00
Alexander Udalov 3f3e05a9d2 Move essential metadata-related classes to 'metadata' and 'metadata.jvm' 2018-03-14 12:25:16 +01:00
Alexander Udalov 88dea9aa70 Move NameResolver to module 'metadata' and J2K
Also move NameResolverImpl to 'metadata' and JvmNameResolver to
'metadata.jvm'
2018-03-14 12:25:16 +01:00
Alexander Udalov 27ad4f7d5d Move ProtoBuf classes to package org.jetbrains.kotlin.metadata 2018-03-14 12:25:10 +01:00
Alexander Udalov 575a388b11 Move core protobuf schemas to 'metadata' and 'metadata.jvm' 2018-03-14 12:25:09 +01:00
Alexander Udalov 368af867b8 Add modules metadata and metadata.jvm 2018-03-14 12:25:08 +01:00