@Override public IClass getResultType() { return globalVariableMeta.getType(); }
@Override public IClass getResultType() { return field.getType(); }
@Override public IClass getResultType() { return meta.getType(); }
@Override public IClass getResultType() { return meta.getType(); }
@Override public void execute(ClassExecuteContext context) { if(value != null && !Modifiers.isStatic(modifiers)) { throw new ASMSupportException("The initial value '" + value + "' of field '" + name + "' is invalided, cause by the field is not static, and the initial value only support static field."); } if(value != null && value instanceof Boolean) { value = (Boolean) value ? 1 : 0; } context.getClassVisitor().visitField( fe.getModifiers(), name, fe.getType().getDescription(), null, value).visitEnd(); }
/** * * @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()); } }
@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 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 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 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()); }