@Override public SSAInstructionFactory getInstructionFactory() { return JS.instructionFactory(); }
@Override public SSAInstructionFactory getInstructionFactory() { return JS.instructionFactory(); }
@Override public SSAInstructionFactory getInstructionFactory() { return getLanguage().instructionFactory(); } }
@Override public SSAInstructionFactory getInstructionFactory() { return getLanguage().instructionFactory(); } }
@Override public SSAInstructionFactory getInstructionFactory() { return getLanguage().instructionFactory(); }
@Override public SSAInstructionFactory getInstructionFactory() { return getLanguage().instructionFactory(); }
/** * Process an element indicating an Athrow */ private void processAthrow(Attributes atts) { Language lang = scope.getLanguage(governingLoader.getLanguage()); SSAInstructionFactory insts = lang.instructionFactory(); // get the value thrown String V = atts.getValue(A_VALUE); if (V == null) { Assertions.UNREACHABLE("Must specify value for putfield " + governingMethod); } Integer valueNumber = symbolTable.get(V); if (valueNumber == null) { Assertions.UNREACHABLE("Cannot lookup value: " + V); } SSAThrowInstruction T = insts.ThrowInstruction(governingMethod.getNumberOfStatements(), valueNumber.intValue()); governingMethod.addStatement(T); }
/** * Process an element indicating an Athrow */ private void processAthrow(Attributes atts) { Language lang = scope.getLanguage(governingLoader.getLanguage()); SSAInstructionFactory insts = lang.instructionFactory(); // get the value thrown String V = atts.getValue(A_VALUE); if (V == null) { Assertions.UNREACHABLE("Must specify value for putfield " + governingMethod); } Integer valueNumber = symbolTable.get(V); if (valueNumber == null) { Assertions.UNREACHABLE("Cannot lookup value: " + V); } SSAThrowInstruction T = insts.ThrowInstruction(governingMethod.getNumberOfStatements(), valueNumber.intValue()); governingMethod.addStatement(T); }
SSAInstructionFactory insts = lang.instructionFactory();
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 SSAInstruction[] getStatements() { if (getReturnType().equals(TypeReference.Void)) { return NO_STATEMENTS; } else { int nullValue = getNumberOfParameters() + 1; SSAInstruction[] result = new SSAInstruction[1]; SSAInstructionFactory insts = l.instructionFactory(); result[0] = insts.ReturnInstruction(0, nullValue, getReturnType().isPrimitiveType()); return result; } }
/** * Process an element indicating a putstatic. */ private void processPutStatic(Attributes atts) { Language lang = scope.getLanguage(governingLoader.getLanguage()); SSAInstructionFactory insts = lang.instructionFactory(); // deduce the field written String classString = atts.getValue(A_CLASS); TypeReference type = TypeReference.findOrCreate(governingLoader, TypeName.string2TypeName(classString)); String fieldString = atts.getValue(A_FIELD); Atom fieldName = Atom.findOrCreateAsciiAtom(fieldString); String ftString = atts.getValue(A_FIELD_TYPE); TypeReference fieldType = TypeReference.findOrCreate(governingLoader, TypeName.string2TypeName(ftString)); FieldReference field = FieldReference.findOrCreate(type, fieldName, fieldType); // get the value stored String V = atts.getValue(A_VALUE); if (V == null) { Assertions.UNREACHABLE("Must specify value for putstatic " + governingMethod); } Integer valueNumber = symbolTable.get(V); if (valueNumber == null) { Assertions.UNREACHABLE("Cannot lookup value: " + V); } SSAPutInstruction P = insts.PutInstruction(governingMethod.getNumberOfStatements(), valueNumber.intValue(), field); governingMethod.addStatement(P); }
/** * Process an element indicating a putstatic. */ private void processPutStatic(Attributes atts) { Language lang = scope.getLanguage(governingLoader.getLanguage()); SSAInstructionFactory insts = lang.instructionFactory(); // deduce the field written String classString = atts.getValue(A_CLASS); TypeReference type = TypeReference.findOrCreate(governingLoader, TypeName.string2TypeName(classString)); String fieldString = atts.getValue(A_FIELD); Atom fieldName = Atom.findOrCreateAsciiAtom(fieldString); String ftString = atts.getValue(A_FIELD_TYPE); TypeReference fieldType = TypeReference.findOrCreate(governingLoader, TypeName.string2TypeName(ftString)); FieldReference field = FieldReference.findOrCreate(type, fieldName, fieldType); // get the value stored String V = atts.getValue(A_VALUE); if (V == null) { Assertions.UNREACHABLE("Must specify value for putstatic " + governingMethod); } Integer valueNumber = symbolTable.get(V); if (valueNumber == null) { Assertions.UNREACHABLE("Cannot lookup value: " + V); } SSAPutInstruction P = insts.PutInstruction(governingMethod.getNumberOfStatements(), valueNumber.intValue(), field); governingMethod.addStatement(P); }
@Override public SSAInstruction[] getStatements() { if (getReturnType().equals(TypeReference.Void)) { return NO_STATEMENTS; } else { int nullValue = getNumberOfParameters() + 1; SSAInstruction[] result = new SSAInstruction[1]; SSAInstructionFactory insts = l.instructionFactory(); result[0] = insts.ReturnInstruction(0, nullValue, getReturnType().isPrimitiveType()); return result; } }
public AppModelMethod(IClassHierarchy cha, AnalysisScope scope, AndroidSpecs specs) { this.cha = cha; this.scope = scope; Language lang = scope.getLanguage(ClassLoaderReference.Application.getLanguage()); insts = lang.instructionFactory(); startMethod(); buildTypeMap(specs); processTypeMap(); processCallBackParams(); createLoopAndSwitch(); }
/** * Process an element indicating a return statement. */ private void processReturn(Attributes atts) { Language lang = scope.getLanguage(governingLoader.getLanguage()); SSAInstructionFactory insts = lang.instructionFactory(); if (governingMethod.getReturnType() != null) { String retV = atts.getValue(A_VALUE); if (retV == null) { SSAReturnInstruction R = insts.ReturnInstruction(governingMethod.getNumberOfStatements()); governingMethod.addStatement(R); } else { Integer valueNumber = symbolTable.get(retV); if (valueNumber == null) { if (!retV.equals(V_NULL)) { Assertions.UNREACHABLE("Cannot return value with no def: " + retV); } else { valueNumber = getValueNumberForNull(); } } boolean isPrimitive = governingMethod.getReturnType().isPrimitiveType(); SSAReturnInstruction R = insts.ReturnInstruction(governingMethod.getNumberOfStatements(), valueNumber.intValue(), isPrimitive); governingMethod.addStatement(R); } } }
/** * Process an element indicating a return statement. */ private void processReturn(Attributes atts) { Language lang = scope.getLanguage(governingLoader.getLanguage()); SSAInstructionFactory insts = lang.instructionFactory(); if (governingMethod.getReturnType() != null) { String retV = atts.getValue(A_VALUE); if (retV == null) { SSAReturnInstruction R = insts.ReturnInstruction(governingMethod.getNumberOfStatements()); governingMethod.addStatement(R); } else { Integer valueNumber = symbolTable.get(retV); if (valueNumber == null) { if (!retV.equals(V_NULL)) { Assertions.UNREACHABLE("Cannot return value with no def: " + retV); } else { valueNumber = getValueNumberForNull(); } } boolean isPrimitive = governingMethod.getReturnType().isPrimitiveType(); SSAReturnInstruction R = insts.ReturnInstruction(governingMethod.getNumberOfStatements(), valueNumber.intValue(), isPrimitive); governingMethod.addStatement(R); } } }
@Override public IR getIR(CGNode node) { if (!irs.containsKey(node) || irs.get(node).get() == null) { MethodSummary code = new MethodSummary(node.getMethod().getReference()); SummarizedMethod m = new SummarizedMethod(node.getMethod().getReference(), code, node.getMethod().getDeclaringClass()); SSAInstructionFactory insts = node.getMethod().getDeclaringClass().getClassLoader().getLanguage().instructionFactory(); assert node.getContext().isA(FindContext.class); @SuppressWarnings("unchecked") IClass cls = node.getClassHierarchy().lookupClass(((HandlesItem<TypeReference>)node.getContext().get(CLASS_KEY)).item); @SuppressWarnings("unchecked") String selector = ((HandlesItem<String>)node.getContext().get(NAME_KEY)).item; int vn = 10; for(IMethod handleMethod : cls.getAllMethods()) { if (handleMethod.getName().toString().contains(selector)) { code.addStatement(insts.LoadMetadataInstruction(code.getNextProgramCounter(), vn, TypeReference.JavaLangInvokeMethodHandle, handleMethod.getReference())); code.addStatement(insts.ReturnInstruction(code.getNextProgramCounter(), vn , false)); vn++; } } irs.put(node, new SoftReference<>(m.makeIR(node.getContext(), SSAOptions.defaultOptions()))); } return irs.get(node).get(); } }
@Override public IR getIR(CGNode node) { if (!irs.containsKey(node) || irs.get(node).get() == null) { MethodSummary code = new MethodSummary(node.getMethod().getReference()); SummarizedMethod m = new SummarizedMethod(node.getMethod().getReference(), code, node.getMethod().getDeclaringClass()); SSAInstructionFactory insts = node.getMethod().getDeclaringClass().getClassLoader().getLanguage().instructionFactory(); assert node.getContext().isA(FindContext.class); @SuppressWarnings("unchecked") IClass cls = node.getClassHierarchy().lookupClass(((HandlesItem<TypeReference>)node.getContext().get(CLASS_KEY)).item); @SuppressWarnings("unchecked") String selector = ((HandlesItem<String>)node.getContext().get(NAME_KEY)).item; int vn = 10; for(IMethod handleMethod : cls.getAllMethods()) { if (handleMethod.getName().toString().contains(selector)) { code.addStatement(insts.LoadMetadataInstruction(code.getNextProgramCounter(), vn, TypeReference.JavaLangInvokeMethodHandle, handleMethod.getReference())); code.addStatement(insts.ReturnInstruction(code.getNextProgramCounter(), vn , false)); vn++; } } irs.put(node, new SoftReference<>(m.makeIR(node.getContext(), SSAOptions.defaultOptions()))); } return irs.get(node).get(); } }