Skip to content

Commit da5e044

Browse files
committed
modify select strategies
1 parent 09df5a8 commit da5e044

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

examples/lcms2/custom.rule

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// func_include cms*
1+
func_include cms*
22
// func_exclude cmsCreateBCHSWabstractProfile,cmsCreateBCHSWabstractProfileTHR
33
// func_exclude cmsSetLogErrorHandler,cmsSetLogErrorHandlerTHR
44
// func_exclude cmsPlugin,cmsPluginTHR,cmsUnregisterPlugins,cmsUnregisterPluginsTHR
5-
func_include cmsOpenProfileFromMem,cmsCreate_sRGBProfile,cmsCreateTransform,cmsDoTransform
5+
// func_include cmsOpenProfileFromMem,cmsCreate_sRGBProfile,cmsCreateTransform,cmsDoTransform
66

77
// type _cmsContext_struct* = $null
88
// func cmsCreateContext[$0] = $null

hopper-core/src/depot/select.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ impl Selector for SaSelector {
5353
let edge_num = feedback.path_len as u128;
5454
let t_used = feedback.time_used as f64;
5555
let call_num = program.stmts.iter().filter(|s| s.stmt.is_call()).count() as u128;
56-
assert!(call_num > 0, "The number of call statements cannot be zero!");
57-
let r = (edge_num / call_num) as f64 / t_used;
56+
// assert!(call_num > 0, "The number of call statements cannot be zero!");
57+
let r = edge_num as f64 / t_used;
5858
// make the range of `r` to be [0, 5];
5959
let avg = AVG_SCORE.with(|c| {
6060
let (mut avg, mut num) = c.get();
@@ -74,7 +74,7 @@ impl Selector for SaSelector {
7474
debug,
7575
"#edge: {edge_num}, #t: {t_used}, #call: {call_num}, score: {score}"
7676
);
77-
if feedback.has_new_uniq_path {
77+
if feedback.num_uniq_path > 5 {
7878
bonus += SA_UNIQ_NEW;
7979
}
8080
(bonus, score)

hopper-core/src/feedback/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub struct FeedbackSummary {
4747
// path's length
4848
pub path_len: usize,
4949
// is it reach uniq new path
50-
pub has_new_uniq_path: bool,
50+
pub num_uniq_path: usize,
5151
}
5252

5353
pub static mut INSTR_LIST: *mut InstrList = std::ptr::null_mut();

hopper-core/src/feedback/observer.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ impl Observer {
4444
self.branches_state.has_new_uniq(&trace, status)
4545
}
4646

47-
pub fn has_new_uniq_path(&self, trace: &[(usize, BucketType)], status: StatusType) -> bool {
48-
!self.branches_state.has_new_uniq(trace, status).is_empty()
49-
}
5047

5148
/// Merge the update list to global coverage
5249
pub fn merge_coverage(&mut self, update_list: &[(usize, BucketType)], status: StatusType) {
@@ -94,6 +91,6 @@ impl Observer {
9491
pub fn update_summary(&self, feedback: &mut FeedbackSummary, status: StatusType) {
9592
let path = self.feedback.path.get_list();
9693
feedback.path_len = path.len();
97-
feedback.has_new_uniq_path |= self.has_new_uniq_path(&path, status);
94+
feedback.num_uniq_path = self.branches_state.has_new_uniq(&path, status).len();
9895
}
9996
}

0 commit comments

Comments
 (0)