本文整理汇总了Java中org.objectweb.asm.commons.GeneratorAdapter.invokeConstructor方法的典型用法代码示例。如果您正苦于以下问题:Java GeneratorAdapter.invokeConstructor方法的具体用法?Java GeneratorAdapter.invokeConstructor怎么用?Java GeneratorAdapter.invokeConstructor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.objectweb.asm.commons.GeneratorAdapter
的用法示例。
在下文中一共展示了GeneratorAdapter.invokeConstructor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeMissingMessageWithHash
import org.objectweb.asm.commons.GeneratorAdapter; //导入方法依赖的package包/类
void writeMissingMessageWithHash(GeneratorAdapter mv, String visitedClassName) {
mv.newInstance(INSTANT_RELOAD_EXCEPTION_TYPE);
mv.dup();
mv.push("int switch could not find %d in %s");
mv.push(3);
mv.newArray(OBJECT_TYPE);
mv.dup();
mv.push(0);
visitInt();
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Integer",
"valueOf",
"(I)Ljava/lang/Integer;", false);
mv.arrayStore(OBJECT_TYPE);
mv.dup();
mv.push(2);
mv.push(visitedClassName);
mv.arrayStore(OBJECT_TYPE);
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/String",
"format",
"(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;", false);
mv.invokeConstructor(INSTANT_RELOAD_EXCEPTION_TYPE,
Method.getMethod("void <init> (String)"));
mv.throwException();
}
示例2: writeMissingMessageWithHash
import org.objectweb.asm.commons.GeneratorAdapter; //导入方法依赖的package包/类
/**
* Generates a standard error exception with message similar to:
*
* String switch could not find 'equals.(Ljava/lang/Object;)Z' with hashcode 0
* in com/example/basic/GrandChild
*
* @param mv The generator adaptor used to emit the lookup switch code.
* @param visitedClassName The abstract string trie structure.
*/
void writeMissingMessageWithHash(GeneratorAdapter mv, String visitedClassName) {
mv.newInstance(INSTANT_RELOAD_EXCEPTION_TYPE);
mv.dup();
mv.push("String switch could not find '%s' with hashcode %s in %s");
mv.push(3);
mv.newArray(OBJECT_TYPE);
mv.dup();
mv.push(0);
visitString();
mv.arrayStore(OBJECT_TYPE);
mv.dup();
mv.push(1);
visitString();
visitHashMethod(mv);
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Integer",
"valueOf",
"(I)Ljava/lang/Integer;", false);
mv.arrayStore(OBJECT_TYPE);
mv.dup();
mv.push(2);
mv.push(visitedClassName);
mv.arrayStore(OBJECT_TYPE);
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/String",
"format",
"(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;", false);
mv.invokeConstructor(INSTANT_RELOAD_EXCEPTION_TYPE,
Method.getMethod("void <init> (String)"));
mv.throwException();
}
示例3: emitKeywordCallsites
import org.objectweb.asm.commons.GeneratorAdapter; //导入方法依赖的package包/类
private void emitKeywordCallsites(GeneratorAdapter clinitgen){
for(int i=0;i<keywordCallsites.count();i++)
{
Keyword k = (Keyword) keywordCallsites.nth(i);
clinitgen.newInstance(KEYWORD_LOOKUPSITE_TYPE);
clinitgen.dup();
emitValue(k,clinitgen);
clinitgen.invokeConstructor(KEYWORD_LOOKUPSITE_TYPE,
Method.getMethod("void <init>(clojure.lang.Keyword)"));
clinitgen.dup();
clinitgen.putStatic(objtype, siteNameStatic(i), KEYWORD_LOOKUPSITE_TYPE);
clinitgen.putStatic(objtype, thunkNameStatic(i), ILOOKUP_THUNK_TYPE);
}
}
示例4: emit
import org.objectweb.asm.commons.GeneratorAdapter; //导入方法依赖的package包/类
public void emit(C context, ObjExpr objx, GeneratorAdapter gen){
//emitting a Fn means constructing an instance, feeding closed-overs from enclosing scope, if any
//objx arg is enclosing objx, not this
// getCompiledClass();
if(isDeftype())
{
gen.visitInsn(Opcodes.ACONST_NULL);
}
else
{
gen.newInstance(objtype);
gen.dup();
if(supportsMeta())
gen.visitInsn(Opcodes.ACONST_NULL);
for(ISeq s = RT.seq(closesExprs); s != null; s = s.next())
{
LocalBindingExpr lbe = (LocalBindingExpr) s.first();
LocalBinding lb = lbe.b;
if(lb.getPrimitiveType() != null)
objx.emitUnboxedLocal(gen, lb);
else
objx.emitLocal(gen, lb, lbe.shouldClear);
}
gen.invokeConstructor(objtype, new Method("<init>", Type.VOID_TYPE, ctorTypes()));
}
if(context == C.STATEMENT)
gen.pop();
}