当前位置: 首页>>代码示例>>Java>>正文


Java GeneratorAdapter.loadThis方法代码示例

本文整理汇总了Java中org.objectweb.asm.commons.GeneratorAdapter.loadThis方法的典型用法代码示例。如果您正苦于以下问题:Java GeneratorAdapter.loadThis方法的具体用法?Java GeneratorAdapter.loadThis怎么用?Java GeneratorAdapter.loadThis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.objectweb.asm.commons.GeneratorAdapter的用法示例。


在下文中一共展示了GeneratorAdapter.loadThis方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadMH

import org.objectweb.asm.commons.GeneratorAdapter; //导入方法依赖的package包/类
@Contract("null, null, _, _ -> fail")
private static void loadMH(GeneratorAdapter adapter, Type reflectorClass, int flags, int mhIndex) {
    if((flags & Magic.REFLECTOR_METHOD_USE_METHODHANDLE) == 0) return;

    /* Load MethodHandle field */
    adapter.loadThis();
    adapter.getField(notNull(reflectorClass, "Reflector class shouldn't be null!"), MHF, MH_ARRAY);

    /* Load index */
    if(mhIndex >= 0 && mhIndex <= 5)
        /* ICONST_x offset is 3, iow ICONST_0 = 3, ICONST_1 = 4 */
        adapter.visitInsn(ICONST_0 + mhIndex);
    else
        adapter.visitIntInsn(BIPUSH, mhIndex);

    /* Load MethodHandle from array */
    adapter.visitInsn(AALOAD);
}
 
开发者ID:mikroskeem,项目名称:Shuriken,代码行数:19,代码来源:MethodGenerator.java

示例2: emitAssignLocal

import org.objectweb.asm.commons.GeneratorAdapter; //导入方法依赖的package包/类
public void emitAssignLocal(GeneratorAdapter gen, LocalBinding lb,Expr val){
	if(!isMutable(lb))
		throw new IllegalArgumentException("Cannot assign to non-mutable: " + lb.name);
	Class primc = lb.getPrimitiveType();
	gen.loadThis();
	if(primc != null)
		{
		if(!(val instanceof MaybePrimitiveExpr && ((MaybePrimitiveExpr) val).canEmitPrimitive()))
			throw new IllegalArgumentException("Must assign primitive to primitive mutable: " + lb.name);
		MaybePrimitiveExpr me = (MaybePrimitiveExpr) val;
		me.emitUnboxed(C.EXPRESSION, this, gen);
		gen.putField(objtype, lb.name, Type.getType(primc));
		}
	else
		{
		val.emit(C.EXPRESSION, this, gen);
		gen.putField(objtype, lb.name, OBJECT_TYPE);
		}
}
 
开发者ID:mrange,项目名称:fsharpadvent2016,代码行数:20,代码来源:Compiler.java

示例3: loadInstance

import org.objectweb.asm.commons.GeneratorAdapter; //导入方法依赖的package包/类
@Contract("null, null, null, _ -> fail")
private static void loadInstance(GeneratorAdapter adapter, Type reflectorClass, Type targetClass, int flags) {
    if((flags & Magic.REFLECTOR_METHOD_USE_INSTANCE) == 0) return;

    adapter.loadThis();
    adapter.getField(reflectorClass, REFF, (flags & Magic.TARGET_CLASS_VISIBILITY_PUBLIC) != 0 ? targetClass : OBJECT);
}
 
开发者ID:mikroskeem,项目名称:Shuriken,代码行数:8,代码来源:MethodGenerator.java

示例4: emitUnboxedLocal

import org.objectweb.asm.commons.GeneratorAdapter; //导入方法依赖的package包/类
private void emitUnboxedLocal(GeneratorAdapter gen, LocalBinding lb){
	int argoff = canBeDirect ?0:1;
	Class primc = lb.getPrimitiveType();
	if(closes.containsKey(lb))
		{
		gen.loadThis();
		gen.getField(objtype, lb.name, Type.getType(primc));
		}
	else if(lb.isArg)
		gen.loadArg(lb.idx-argoff);
	else
		gen.visitVarInsn(Type.getType(primc).getOpcode(Opcodes.ILOAD), lb.idx);
}
 
开发者ID:mrange,项目名称:fsharpadvent2016,代码行数:14,代码来源:Compiler.java

示例5: emitMethods

import org.objectweb.asm.commons.GeneratorAdapter; //导入方法依赖的package包/类
protected void emitMethods(ClassVisitor cv){
	for(ISeq s = RT.seq(methods); s != null; s = s.next())
		{
		ObjMethod method = (ObjMethod) s.first();
		method.emit(this, cv);
		}
	//emit bridge methods
	for(Map.Entry<IPersistentVector,Set<Class>> e : covariants.entrySet())
		{
		java.lang.reflect.Method m = mmap.get(e.getKey());
		Class[] params = m.getParameterTypes();
		Type[] argTypes = new Type[params.length];

		for(int i = 0; i < params.length; i++)
			{
			argTypes[i] = Type.getType(params[i]);
			}

		Method target = new Method(m.getName(), Type.getType(m.getReturnType()), argTypes);

		for(Class retType : e.getValue())
			{
		        Method meth = new Method(m.getName(), Type.getType(retType), argTypes);

			GeneratorAdapter gen = new GeneratorAdapter(ACC_PUBLIC + ACC_BRIDGE,
	                                            meth,
	                                            null,
	                                            //todo don't hardwire this
	                                            EXCEPTION_TYPES,
	                                            cv);
			gen.visitCode();
			gen.loadThis();
			gen.loadArgs();
			gen.invokeInterface(Type.getType(m.getDeclaringClass()),target);
			gen.returnValue();
			gen.endMethod();
			}
		}
}
 
开发者ID:mrange,项目名称:fsharpadvent2016,代码行数:40,代码来源:Compiler.java


注:本文中的org.objectweb.asm.commons.GeneratorAdapter.loadThis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。