當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。