动态类型的InvokeDynamic参数 [英] Dynamic Type of InvokeDynamic Arguments

查看:134
本文介绍了动态类型的InvokeDynamic参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了支持动态类型和方法调度,我的编程语言引入了一种名为 dynamic 的类型。在类型为 dynamic 的被调用者上调用方法时,编译器首先推送被调用者和堆栈上的所有参数,然后生成 invokedynamic 指令而不是正常的调用* 指令。该指令指向名为 DynamicLinker 的类中的特殊引导方法,但只有静态类型在调用时才可用。

To support dynamic types and method dispatch, my programming language introduces a type called dynamic. When calling a method on a callee whose type is dynamic, the compiler first pushes the callee and all arguments on the stack, and then generates an invokedynamic instruction instead of a normal invoke* instruction. The instruction points to a special bootstrap method in a class called DynamicLinker, but only static types are available when it is called.

我的问题:如何获取传递给 invokedynamic 指令的参数的运行时类型?

My Problem: How do I get the runtime type of the arguments that were passed to the invokedynamic instruction?

推荐答案

invokedynamic dynamic部分并不代表方法参数可以具有动态类型。这意味着可以自定义调用指令的行为。 invokedynamic 参数的确切类型在编译时是已知的。

The "dynamic" part of invokedynamic does not mean that a method arguments can have dynamic types. It rather means that the behavior of invoke instruction can be customized. The exact types of invokedynamic arguments are known at compile time.

这篇关于动态类型的InvokeDynamic参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆