if(gv.getName().equals(name)){ found.add(gv);
final LinkedList<Field> found = new LinkedList<>(); for (Field gv : getFields()) { if (gv.getName().equals(name)) { found.add(gv);
@Override public void push(MethodExecuteContext context) { if(!IClassUtils.visible(context.getMethod().getDeclaringClass(), meta.getDirectOwnerType(), meta.getDeclaringClass(), meta.getModifiers())){ throw new IllegalArgumentException("Cannot access field " + meta.getDeclaringClass() + "#" + meta.getName() + " from " + context.getMethod().getDeclaringClass()); } if(LOG.isPrintEnabled()){ LOG.print("Get field " + meta.getName() + " from variable " + meta.getName() + " and push to stack!"); } owner.push(context); context.getInstructions().getField(meta.getDirectOwnerType().getType(), meta.getName(), meta.getType().getType()); }
@Override public void push(MethodExecuteContext context) { if (!IClassUtils.visible(context.getMethod().getDeclaringClass(), meta.getDirectOwnerType(), meta.getDeclaringClass(), meta.getModifiers())) { throw new IllegalArgumentException("Cannot access field " + meta.getDeclaringClass() + "#" + meta.getName() + " from " + context.getMethod().getDeclaringClass()); } if (LOG.isPrintEnabled()) { LOG.print("get field " + meta.getName() + " from class " + meta.getDirectOwnerType().getName() + " and push to stack!"); } context.getInstructions().getStatic(owner.getType(), meta.getName(), meta.getType().getType()); }
@Override public void doExecute(MethodExecuteContext context) { if(LOG.isPrintEnabled()){ LOG.print("assign value to global variable '" + var.getMeta().getName() + "' from " + value ); } value.push(context); autoCast(context); context.getInstructions().putStatic(var.getOwner().getType(), var.getMeta().getName(), var.getMeta().getType().getType()); }
@Override public void doExecute(MethodExecuteContext context) { if(LOG.isPrintEnabled()){ LOG.print("assign value to global variable '" + var.getMeta().getName() + "' from " + value ); } KernelProgramBlock block = getParent(); if(Modifier.isStatic(block.getMethod().getMeta().getModifiers())){ throw new ASMSupportException("Current method " + block.getMethod() + " is static cannot use non-static field " + var.getMeta().getName() ); } var.getOwner().push(context); value.push(context); autoCast(context); context.getInstructions().putField(var.getOwner().getResultType().getType(), var.getMeta().getName(), var.getMeta().getType().getType()); }
/** * * @param var */ public void commonPutField(ExplicitVariable var) { if (var instanceof LocalVariable) { storeInsn((LocalVariable) var); } else if (var instanceof NonStaticGlobalVariable) { NonStaticGlobalVariable gv = (NonStaticGlobalVariable) var; putField(gv.getOwner().getResultType().getType(), gv.getMeta().getName(), gv .getMeta().getType().getType()); } else if (var instanceof StaticGlobalVariable) { StaticGlobalVariable gv = (StaticGlobalVariable) var; putStatic(gv.getOwner().getType(), gv.getMeta().getName(), gv.getMeta().getType() .getType()); } }