锋盈数科-知识库 Logo
首页
软件开发
计算机基础
Hello Halo
新手必读
关于本知识库
登录 →
锋盈数科-知识库 Logo
首页 软件开发 计算机基础 Hello Halo 新手必读 关于本知识库
登录
  1. 首页
  2. 软件开发
  3. 详解JacoDB内置ifds功能遍历过程内指令

详解JacoDB内置ifds功能遍历过程内指令

0
  • 软件开发
  • 发布于 2024-09-20
  • 0 次阅读
黄健
黄健

getName方法源码

getName为被分析的方法,代码如下:

package org.example;

public class C {
    public void use(){
        int k = 1;
        getName(1);
    }
    public String getName(int orderNum) {
        int j = 0;
        int k = orderNum +j;
        if ( orderNum > j ) {
            k = orderNum + j;
        }
        while(orderNum < j) {
            orderNum ++;
            k ++;
        }
        return "";
    }
}

getName方法的CFG

%0 = 0
%1 = arg$0 + %0
%2 = %1
%5 = %2
if (arg$0 <= %0)
goto JcInstRef(index=10)
%3 = arg$0 + %0
%2 = %3
%5 = %2
goto JcInstRef(index=10)
if (arg$0 >= %0)
goto JcInstRef(index=15)
arg$0 = arg$0 + 1
%5 = %5 + 1
goto JcInstRef(index=10)
return ""

ifds分析getName方法时处理的edge(指令/三地址码)

------------>Start-Facts<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 8
startStatement: noop
facts: [[ZERO fact]]


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 8
current: noop
next: %0 = 0


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 9
current: %0 = 0
next: %1 = arg$0 + %0


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 10
current: %1 = arg$0 + %0
next: %2 = %1


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 10
current: %2 = %1
next: %5 = %2


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 11
current: %5 = %2
next: if (arg$0 <= %0)


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 11
current: if (arg$0 <= %0)
next: goto JcInstRef(index=10)


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 11
current: if (arg$0 <= %0)
next: %3 = arg$0 + %0


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 11
current: goto JcInstRef(index=10)
next: if (arg$0 >= %0)


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 12
current: %3 = arg$0 + %0
next: %2 = %3


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 14
current: if (arg$0 >= %0)
next: goto JcInstRef(index=15)


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 14
current: if (arg$0 >= %0)
next: arg$0 = arg$0 + 1


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 12
current: %2 = %3
next: %5 = %2


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 14
current: goto JcInstRef(index=15)
next: return ""


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 15
current: arg$0 = arg$0 + 1
next: %5 = %5 + 1


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 12
current: %5 = %2
next: goto JcInstRef(index=10)


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 16
current: %5 = %5 + 1
next: goto JcInstRef(index=10)


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 12
current: goto JcInstRef(index=10)
next: if (arg$0 >= %0)


------------>Normal<------------ 
positionMethod: (id:72)org.example.C#getName(int)
lineNumber: 16
current: goto JcInstRef(index=10)
next: if (arg$0 >= %0)

图示遍历过程

此处需要注意的是遇到条件判断语句时,由于静态分析无法判断条件是否成立,遇到条件语句时遍历path会拆分成两条。这就虽然CFG中if (arg$0 <= %0)只出现一次,ifds遍历时这条指令出现了两次的原因。上图的虚线说明,静态分析中循环语句并不会多次进入分析循环中的指令。

原文链接: https://blog.csdn.net/javajingling/article/details/134956291

标签: #软件开发 1171
相关文章

万字:支付“核心系统”详解 2024-11-02 15:33

专栏作者:隐墨星辰 \| 主编:陈天宇宙 这篇文章也尝试化繁为简,探寻支付系统的本质,讲清楚在线支付系统最核心的一些概念和设计理念。 虽然支付行业已经过了风头最劲的时光,但跨境支付仍然在蓬勃发展,每年依然有很多新人进入这个行业,这篇文章尝试为这些刚入行的新人提供一点帮助。 文章只介绍一些支付行业十几

资深支付架构师视角:实战从问题定义到代码落地的完整套路 2024-11-02 15:33

前言 今天从一个实际案例入手,介绍站在架构师的角度,如何识别并定义问题,提炼需求,技术方案选型,再到详细设计,最后利用AI的能力协助写出核心的代码,验证与调优。 解决问题存在一定的模式,也可以称之为框架,总结出自己的思考和解题框架,以后再碰到同类型的问题就可以如庖丁解牛一样容易。 很多年前,我写代码

Spring 实现 3 种异步接口 2024-10-18 09:07

大家好,我是苏三~ 如何处理比较耗时的接口? 这题我熟,直接上异步接口,使用 Callable、WebAsyncTask 和 DeferredResult、CompletableFuture等均可实现。 但这些方法有局限性,处理结果仅返回单个值。在某些场景下,如果需要接口异步处理的同时,还持续不断地

重学SpringBoot3-集成Redis(五)之布隆过滤器 2024-10-08 11:24

更多SpringBoot3内容请关注我的专栏:《SpringBoot3》 期待您的点赞👍收藏⭐评论✍ 重学SpringBoot3-集成Redis(五)之布隆过滤器 1. 什么是布隆过滤器? * 基本概念 适用场景 2. 使用 Redis 实现布隆过滤器 * 项目依赖 Redis 配置

设计模式第16讲——迭代器模式(Iterator) 2024-10-08 11:24

一、什么是迭代器模式 迭代器模式是一种行为型设计模式,它提供了一种统一的方式来访问集合对象中的元素,而不是暴露集合内部的表示方式。简单地说,就是将遍历集合的责任封装到一个单独的对象中,我们可以按照特定的方式访问集合中的元素。 二、角色组成 抽象迭代器(Iterator):定义了遍历聚合对象所需的方法

vue2路由和vue3路由区别及原理 2024-10-08 11:24

一、Vue2 与 Vue3 路由的区别 1. 创建路由实例方式的不同 Vue 2 中,通过 Vue.use() 注册路由插件,并通过 new VueRouter() 来创建路由实例。 import Vue from 'vue';import VueRouter from 'vue-router';i

目录

IT 外包服务商

  • 意见投递
  • zyf6619

软件开发应用

主菜单

  • 首页
  • 软件开发
  • 计算机基础
  • Hello Halo
  • 新手必读
  • 关于本知识库
Copyright © 2024 your company All Rights Reserved. Powered by Halo.