diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2016-04-11 13:34:17 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2016-04-20 08:53:46 +0200 |
commit | 765eb29a769488d56f9ff2e4dde105961dbd55db (patch) | |
tree | e991412e6db200b45d30b60292cbe87d8a37c44f /test/files/run/t2106.check | |
parent | d176f102bb6d0a6467e510583e61f363ff76d75e (diff) | |
download | scala-765eb29a769488d56f9ff2e4dde105961dbd55db.tar.gz scala-765eb29a769488d56f9ff2e4dde105961dbd55db.tar.bz2 scala-765eb29a769488d56f9ff2e4dde105961dbd55db.zip |
Clean up code gen for method invocations
The code was patched many times in the history and became a bit
scattered.
When emitting a virtual call, the receiver in the bytecode cannot just
be the method's owner (the class in which it is declared), because that
class may not be accessible at the callsite. Instead we use the type
of the receiver. This was basically done to fix
- aladdin bug 455 (9954eaf)
- SI-1430 (0bea2ab) - basically the same bug, slightly different
- SI-4283 (8707c9e) - the same for field reads
In this patch we extend the fix to field writes, and clean up the code.
This patch basically reverts 6eb55d4b, the fix for SI-4560, which was
rather a workaround than a fix. The underlying problem was that in some
cases, in a method invocation `foo.bar()`, the method `bar` was not
actually a member of `foo.tpe`, causing a NoSuchMethodErrors. The
issue was related to trait implementation classes. The idea of the fix
was to check, at code-gen time, `foo.tpe.member("bar")`, and if that
returns `NoSymbol`, use `barSym.owner`. With the new trait encoding
the underlying problem seems to be fixed - all tests still pass
(run/t4560.scala and run/t4560b.scala).
Diffstat (limited to 'test/files/run/t2106.check')
-rw-r--r-- | test/files/run/t2106.check | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/files/run/t2106.check b/test/files/run/t2106.check index b19165824b..c8ebe575f0 100644 --- a/test/files/run/t2106.check +++ b/test/files/run/t2106.check @@ -1,5 +1,5 @@ t2106.scala:7: warning: A::foo()Ljava/lang/Object; is annotated @inline but could not be inlined: -The callee A::foo()Ljava/lang/Object; contains the instruction INVOKEVIRTUAL java/lang/Object.clone ()Ljava/lang/Object; +The callee A::foo()Ljava/lang/Object; contains the instruction INVOKEVIRTUAL A.clone ()Ljava/lang/Object; that would cause an IllegalAccessError when inlined into class Test$. def main(args: Array[String]): Unit = x.foo ^ |