|
|
|
Invokedynamic perfomance.
|
|||
|---|---|---|---|
|
#18+
BlazkowiczDoSOfRedRiverНу вообще MethodHandle позволяет задействовать инструкцию invokedynamic. Ткните нас, пожалуйста, носом в документацию где об этом написано. Ну, это только предположение. ;) авторDoSOfRedRiverНу и меряем производительность этой инструкции, вроде как. Не только инструкции но и кучи другой инфраструктуры вокруг. Да. Но упирается всё в эту инструкцию. Или JIT оптимизации. Так кажется по результатом тестов моих, во всяком случае. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.03.2013, 11:47:52 |
|
||
|
Invokedynamic perfomance.
|
|||
|---|---|---|---|
|
#18+
Вообщем оказалось, что на самом деле для поддержки MethodHandle используется другая инструкция - invokevirtual. От invokedynamic почему то решили отказаться. Никакой "быстрой рефлексии" из MethodHandle не выйдет, во всяком случае до выхода Java 8. Судя по всему, инструкция invokedynamic Java в данный момент не поддерживается. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.03.2013, 17:11:22 |
|
||
|
Invokedynamic perfomance.
|
|||
|---|---|---|---|
|
#18+
DoSOfRedRiverВообщем оказалось, что на самом деле для поддержки MethodHandle используется другая инструкция - invokevirtual. От invokedynamic почему то решили отказаться. Никакой "быстрой рефлексии" из MethodHandle не выйдет, во всяком случае до выхода Java 8. Не может быть! DoSOfRedRiverСудя по всему, инструкция invokedynamic Java в данный момент не поддерживается. Поддерживается. На уровне компилятора и байткода. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.03.2013, 17:12:51 |
|
||
|
Invokedynamic perfomance.
|
|||
|---|---|---|---|
|
#18+
BlazkowiczПоддерживается. На уровне компилятора. В каким конкретно случаях? Есть ссылка на документацию? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.03.2013, 17:28:45 |
|
||
|
Invokedynamic perfomance.
|
|||
|---|---|---|---|
|
#18+
DoSOfRedRiverВ каким конкретно случаях? Есть ссылка на документацию? http://docs.oracle.com/javase/7/docs/technotes/guides/vm/multiple-language-support.html ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.03.2013, 17:32:51 |
|
||
|
Invokedynamic perfomance.
|
|||
|---|---|---|---|
|
#18+
Blazkowicz, Что-то я не вижу в доке ни единого намёка на invokedynamic. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.03.2013, 17:57:22 |
|
||
|
Invokedynamic perfomance.
|
|||
|---|---|---|---|
|
#18+
DoSOfRedRiverЧто-то я не вижу в доке ни единого намёка на invokedynamic. По-моему кто-то нарывается на грубость. Вот это вот что тогда: The invokedynamic InstructionThe invokedynamic instruction simplifies and potentially improves implementations of compilers and runtime systems for dynamic languages on the JVM. The invokedynamic instruction does this by allowing the language implementer to define custom linkage behavior. This contrasts with other JVM instructions such as invokevirtual, in which linkage behavior specific to Java classes and interfaces is hard-wired by the JVM. Each instance of an invokedynamic instruction is called a dynamic call site. A dynamic call site is originally in an unlinked state, which means that there is no method specified for the call site to invoke. As previously mentioned, a dynamic call site is linked to a method by means of a bootstrap method. A dynamic call site's bootstrap method is a method specified by the compiler for the dynamically-typed language that is called once by the JVM to link the site. The object returned from the bootstrap method permanently determines the call site's behavior. The invokedynamic instruction contains a constant pool index (in the same format as for the other invoke instructions). This constant pool index references a CONSTANT_InvokeDynamic entry. This entry specifies the bootstrap method (a CONSTANT_MethodHandle entry), the name of the dynamically linked method, and the argument types and return type of the call to the dynamically linked method. The following is an example of an invokedynamic instruction. In this example, the runtime system links the dynamic call site specified by this invokedynamic instruction (which is +, the addition operator) to the IntegerOps.adder method by using the bootstrap method Example.mybsm. The methods adder and mybsm are defined in the section The Challenge of Compiling Dynamically Typed Languages (line breaks have been added for clarity): invokedynamic InvokeDynamic REF_invokeStatic: Example.mybsm: "(Ljava/lang/invoke/MethodHandles/Lookup; Ljava/lang/String; Ljava/lang/invoke/MethodType;) Ljava/lang/invoke/CallSite;": +: "(Ljava/lang/Integer; Ljava/lang/Integer;) Ljava/lang/Integer;"; Note: The bytecode examples in these sections use the syntax of the ASM Java bytecode manipulation and analysis framework. Invoking a dynamically linked method with the invokedynamic instruction involves the following steps: Defining the Bootstrap Method Specifying Constant Pool Entries Using the invokedynamic Instruction invokedynamic instructionsA dynamic call site is originally in an unlinked state. In this state, there is no target method for the call site to invoke. Before the JVM can execute a dynamic call site (an invokedynamic instruction), the call site must first be linked. Linking is accomplished by calling a bootstrap method which is given the static information content of the call site, and which must produce a method handle that gives the behavior of the call site. Each invokedynamic instruction statically specifies its own bootstrap method as a constant pool reference. The constant pool reference also specifies the call site's name and type descriptor, just like invokevirtual and the other invoke instructions. Linking starts with resolving the constant pool entry for the bootstrap method, and resolving a MethodType object for the type descriptor of the dynamic call site. This resolution process may trigger class loading. It may therefore throw an error if a class fails to load. This error becomes the abnormal termination of the dynamic call site execution. Linkage does not trigger class initialization. The bootstrap method is invoked on at least three values: a MethodHandles.Lookup, a lookup object on the caller class in which dynamic call site occurs a String, the method name mentioned in the call site a MethodType, the resolved type descriptor of the call optionally, between 1 and 251 additional static arguments taken from the constant pool Invocation is as if by MethodHandle.invoke. The returned result must be a CallSite (or a subclass). The type of the call site's target must be exactly equal to the type derived from the dynamic call site's type descriptor and passed to the bootstrap method. The call site then becomes permanently linked to the dynamic call site. As documented in the JVM specification, all failures arising from the linkage of a dynamic call site are reported by a BootstrapMethodError, which is thrown as the abnormal termination of the dynamic call site execution. If this happens, the same error will the thrown for all subsequent attempts to execute the dynamic call site. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.03.2013, 18:12:55 |
|
||
|
Invokedynamic perfomance.
|
|||
|---|---|---|---|
|
#18+
Blazkowicz, Прошу прощения, перепутал вкладку. Я тогда вообще не понимаю зачем нужен этот java.lang.invoke. Какой от него прок? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.03.2013, 18:55:47 |
|
||
|
Invokedynamic perfomance.
|
|||
|---|---|---|---|
|
#18+
DoSOfRedRiverЯ тогда вообще не понимаю зачем нужен этот java.lang.invoke. Какой от него прок? На сколько я понимаю, его должны использовать компиляторы таких языков как Scala и Groovy. Для программирования на Java эти классы не нужны. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.03.2013, 19:01:00 |
|
||
|
|

start [/forum/topic.php?fid=59&msg=38200895&tid=2129682]: |
0ms |
get settings: |
20ms |
get forum list: |
30ms |
check forum access: |
7ms |
check topic access: |
7ms |
track hit: |
68ms |
get topic data: |
16ms |
get forum data: |
5ms |
get page messages: |
74ms |
get tp. blocked users: |
2ms |
| others: | 328ms |
| total: | 557ms |

| 0 / 0 |
