@Override public Iterator<Pair<CGNode, NewSiteReference>> getCreationSites(CallGraph CG) { CGNode cgn = CG.getNode(node, Everywhere.EVERYWHERE); assert cgn != null : node; return NonNullSingletonIterator.make(Pair.make(cgn, NewSiteReference.make(instructionIndex, createdType))); }
@Override public void visitNew(NewInstruction instruction) { ClassLoaderReference loader = getReference().getDeclaringClass().getClassLoader(); TypeReference t = ShrikeUtil.makeTypeReference(loader, instruction.getType()); newSites.add(NewSiteReference.make(getProgramCounter(), t)); }
@Override public Iterator<NewSiteReference> iterateNewSites(CGNode node) { if (node == null) { throw new IllegalArgumentException("node is null"); } assert understands(node); TypeReference tr = ((TypeAbstraction)node.getContext().get(ContextKey.RECEIVER)).getTypeReference(); if (tr != null) { return new NonNullSingletonIterator<>(NewSiteReference.make(0, tr)); } return EmptyIterator.instance(); }
@Override public Iterator<NewSiteReference> iterateNewSites(CGNode node) { if (node == null) { throw new IllegalArgumentException("node is null"); } assert understands(node); TypeReference tr = ((TypeAbstraction)node.getContext().get(ContextKey.RECEIVER)).getTypeReference(); if (tr != null) { return new NonNullSingletonIterator<>(NewSiteReference.make(0, tr)); } return EmptyIterator.instance(); }
@Override public void visitNew(NewInstruction instruction) { ClassLoaderReference loader = getReference().getDeclaringClass().getClassLoader(); TypeReference t = ShrikeUtil.makeTypeReference(loader, instruction.getType()); newSites.add(NewSiteReference.make(getProgramCounter(), t)); }
@Override public Iterator<NewSiteReference> iterateNewSites(CGNode node) { if (node == null) { throw new IllegalArgumentException("node is null"); } assert understands(node); Context context = node.getContext(); TypeReference tr = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getTypeReference(); if (tr != null) { return new NonNullSingletonIterator<>(NewSiteReference.make(0, tr)); } return EmptyIterator.instance(); }
@Override public Iterator<NewSiteReference> iterateNewSites(CGNode node) { if (node == null) { throw new IllegalArgumentException("node is null"); } assert understands(node); Context context = node.getContext(); TypeReference tr = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getTypeReference(); if (tr != null) { return new NonNullSingletonIterator<>(NewSiteReference.make(0, tr)); } return EmptyIterator.instance(); }
@Override public Iterator<NewSiteReference> iterateNewSites(CGNode node) { if (node == null) { throw new IllegalArgumentException("node is null"); } assert understands(node); Context context = node.getContext(); TypeReference tr = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getTypeReference(); if (tr != null) { return new NonNullSingletonIterator<>(NewSiteReference.make(0, tr)); } return EmptyIterator.instance(); }
@Override public SSANewInstruction addAllocation(TypeReference T) { if (cha.isSubclassOf(cha.lookupClass(T), cha.lookupClass(declaringClass.getClassLoader().getLanguage().getRootType()))) { int instance = nextLocal++; NewSiteReference ref = NewSiteReference.make(statements.size(), T); SSANewInstruction result = getDeclaringClass().getClassLoader().getInstructionFactory().NewInstruction(statements.size(), instance, ref); statements.add(result); return result; } else { return super.addAllocation(T); } }
public JavaScriptSummary(MethodReference ref, int declaredParameters) { super(ref); this.declaredParameters = declaredParameters; addStatement( JavaScriptLoader.JS.instructionFactory().NewInstruction(getNumberOfStatements(), declaredParameters+1, NewSiteReference.make( getNextProgramCounter(), JavaScriptTypes.Array))); }
public JavaScriptSummary(MethodReference ref, int declaredParameters) { super(ref); this.declaredParameters = declaredParameters; addStatement( JavaScriptLoader.JS.instructionFactory().NewInstruction(getNumberOfStatements(), declaredParameters+1, NewSiteReference.make( getNextProgramCounter(), JavaScriptTypes.Array))); }
@Override public SSANewInstruction addAllocation(TypeReference T) { if (cha.isSubclassOf(cha.lookupClass(T), cha.lookupClass(declaringClass.getClassLoader().getLanguage().getRootType()))) { int instance = nextLocal++; NewSiteReference ref = NewSiteReference.make(statements.size(), T); SSANewInstruction result = getDeclaringClass().getClassLoader().getInstructionFactory().NewInstruction(statements.size(), instance, ref); statements.add(result); return result; } else { return super.addAllocation(T); } }
/** * Add a NewInstruction to the body. */ private SSANewInstruction addNew(SSAValue val) { final int pc = this.body.getNextProgramCounter(); final NewSiteReference nRef = NewSiteReference.make(pc, val.getType()); final SSANewInstruction newInstr = this.instructionFactory.NewInstruction(pc, val, nRef); this.body.addStatement(newInstr); assert(val.getNumber() == newInstr.getDef()); return newInstr; }
/** * Add a NewInstruction to the body. */ private SSANewInstruction addNew(SSAValue val) { final int pc = this.body.getNextProgramCounter(); final NewSiteReference nRef = NewSiteReference.make(pc, val.getType()); final SSANewInstruction newInstr = this.instructionFactory.NewInstruction(pc, val, nRef); this.body.addStatement(newInstr); assert(val.getNumber() == newInstr.getDef()); return newInstr; }
/** * Add a NewInstruction to the body. */ private SSANewInstruction addNew(SSAValue val) { final int pc = this.body.getNextProgramCounter(); final NewSiteReference nRef = NewSiteReference.make(pc, val.getType()); final SSANewInstruction newInstr = this.instructionFactory.NewInstruction(pc, val, nRef); this.body.addStatement(newInstr); assert(val.getNumber() == newInstr.getDef()); return newInstr; }
/** * Add a NewInstruction to the body. */ private SSANewInstruction addNew(SSAValue val) { final int pc = this.body.getNextProgramCounter(); final NewSiteReference nRef = NewSiteReference.make(pc, val.getType()); final SSANewInstruction newInstr = this.instructionFactory.NewInstruction(pc, val, nRef); this.body.addStatement(newInstr); assert(val.getNumber() == newInstr.getDef()); return newInstr; }
@Override protected void doNewObject(WalkContext context, CAstNode newNode, int result, Object type, int[] arguments) { assert arguments == null; TypeReference typeRef = TypeReference.findOrCreate(JavaScriptTypes.jsLoader, TypeName.string2TypeName("L" + type)); context.cfg().addInstruction(insts.NewInstruction(context.cfg().getCurrentInstruction(), result, NewSiteReference.make(context.cfg().getCurrentInstruction(), typeRef))); }
@Override protected void doNewObject(WalkContext context, CAstNode newNode, int result, Object type, int[] arguments) { assert arguments == null; TypeReference typeRef = TypeReference.findOrCreate(JavaScriptTypes.jsLoader, TypeName.string2TypeName("L" + type)); context.cfg().addInstruction(insts.NewInstruction(context.cfg().getCurrentInstruction(), result, NewSiteReference.make(context.cfg().getCurrentInstruction(), typeRef))); }
@Override protected void doNewObject(WalkContext context, CAstNode newNode, int result, Object type, int[] arguments) { TypeReference typeRef = (TypeReference) type; NewSiteReference site = NewSiteReference.make(context.cfg().getCurrentInstruction(), typeRef); if (newNode.getKind() == CAstNode.NEW_ENCLOSING) { context.cfg().addInstruction(new AstJavaNewEnclosingInstruction(context.cfg().getCurrentInstruction(), result, site, arguments[0])); } else { context.cfg().addInstruction( (arguments == null) ? insts.NewInstruction(context.cfg().getCurrentInstruction(), result, site) : insts.NewInstruction(context.cfg().getCurrentInstruction(), result, site, arguments)); } processExceptions(newNode, context); }
@Override protected void doNewObject(WalkContext context, CAstNode newNode, int result, Object type, int[] arguments) { TypeReference typeRef = (TypeReference) type; NewSiteReference site = NewSiteReference.make(context.cfg().getCurrentInstruction(), typeRef); if (newNode.getKind() == CAstNode.NEW_ENCLOSING) { context.cfg().addInstruction(new AstJavaNewEnclosingInstruction(context.cfg().getCurrentInstruction(), result, site, arguments[0])); } else { context.cfg().addInstruction( (arguments == null) ? insts.NewInstruction(context.cfg().getCurrentInstruction(), result, site) : insts.NewInstruction(context.cfg().getCurrentInstruction(), result, site, arguments)); } processExceptions(newNode, context); }