powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Java [игнор отключен] [закрыт для гостей] / Invokedynamic perfomance.
10 сообщений из 35, страница 2 из 2
Invokedynamic perfomance.
    #38197065
DoSOfRedRiver
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
BlazkowiczDoSOfRedRiverНу вообще MethodHandle позволяет задействовать инструкцию invokedynamic.
Ткните нас, пожалуйста, носом в документацию где об этом написано.

Ну, это только предположение. ;)

авторDoSOfRedRiverНу и меряем производительность этой инструкции, вроде как.
Не только инструкции но и кучи другой инфраструктуры вокруг.

Да. Но упирается всё в эту инструкцию. Или JIT оптимизации. Так кажется по результатом тестов моих, во всяком случае.
...
Рейтинг: 0 / 0
Invokedynamic perfomance.
    #38200891
DoSOfRedRiver
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Вообщем оказалось, что на самом деле для поддержки MethodHandle используется другая инструкция - invokevirtual.
От invokedynamic почему то решили отказаться.
Никакой "быстрой рефлексии" из MethodHandle не выйдет, во всяком случае до выхода Java 8.
Судя по всему, инструкция invokedynamic Java в данный момент не поддерживается.
...
Рейтинг: 0 / 0
Invokedynamic perfomance.
    #38200895
Фотография Blazkowicz
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
DoSOfRedRiverВообщем оказалось, что на самом деле для поддержки MethodHandle используется другая инструкция - invokevirtual. От invokedynamic почему то решили отказаться.
Никакой "быстрой рефлексии" из MethodHandle не выйдет, во всяком случае до выхода Java 8.
Не может быть!

DoSOfRedRiverСудя по всему, инструкция invokedynamic Java в данный момент не поддерживается.
Поддерживается. На уровне компилятора и байткода.
...
Рейтинг: 0 / 0
Invokedynamic perfomance.
    #38200935
DoSOfRedRiver
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
BlazkowiczПоддерживается. На уровне компилятора.

В каким конкретно случаях? Есть ссылка на документацию?
...
Рейтинг: 0 / 0
Invokedynamic perfomance.
    #38200944
Фотография Blazkowicz
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
DoSOfRedRiverВ каким конкретно случаях? Есть ссылка на документацию?
http://docs.oracle.com/javase/7/docs/technotes/guides/vm/multiple-language-support.html
...
Рейтинг: 0 / 0
Invokedynamic perfomance.
    #38200945
Фотография Blazkowicz
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
...
Рейтинг: 0 / 0
Invokedynamic perfomance.
    #38201004
DoSOfRedRiver
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Blazkowicz,

Что-то я не вижу в доке ни единого намёка на invokedynamic.
...
Рейтинг: 0 / 0
Invokedynamic perfomance.
    #38201047
Фотография Blazkowicz
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
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.
...
Рейтинг: 0 / 0
Invokedynamic perfomance.
    #38201133
DoSOfRedRiver
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Blazkowicz,

Прошу прощения, перепутал вкладку.

Я тогда вообще не понимаю зачем нужен этот java.lang.invoke. Какой от него прок?
...
Рейтинг: 0 / 0
Invokedynamic perfomance.
    #38201144
Фотография Blazkowicz
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
DoSOfRedRiverЯ тогда вообще не понимаю зачем нужен этот java.lang.invoke. Какой от него прок?
На сколько я понимаю, его должны использовать компиляторы таких языков как Scala и Groovy. Для программирования на Java эти классы не нужны.
...
Рейтинг: 0 / 0
10 сообщений из 35, страница 2 из 2
Форумы / Java [игнор отключен] [закрыт для гостей] / Invokedynamic perfomance.
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]