Skip to content

Commit

Permalink
modify select strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
spinpx committed May 10, 2024
1 parent 09df5a8 commit da5e044
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/lcms2/custom.rule
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// func_include cms*
func_include cms*
// func_exclude cmsCreateBCHSWabstractProfile,cmsCreateBCHSWabstractProfileTHR
// func_exclude cmsSetLogErrorHandler,cmsSetLogErrorHandlerTHR
// func_exclude cmsPlugin,cmsPluginTHR,cmsUnregisterPlugins,cmsUnregisterPluginsTHR
func_include cmsOpenProfileFromMem,cmsCreate_sRGBProfile,cmsCreateTransform,cmsDoTransform
// func_include cmsOpenProfileFromMem,cmsCreate_sRGBProfile,cmsCreateTransform,cmsDoTransform

// type _cmsContext_struct* = $null
// func cmsCreateContext[$0] = $null
Expand Down
6 changes: 3 additions & 3 deletions hopper-core/src/depot/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ impl Selector for SaSelector {
let edge_num = feedback.path_len as u128;
let t_used = feedback.time_used as f64;
let call_num = program.stmts.iter().filter(|s| s.stmt.is_call()).count() as u128;
assert!(call_num > 0, "The number of call statements cannot be zero!");
let r = (edge_num / call_num) as f64 / t_used;
// assert!(call_num > 0, "The number of call statements cannot be zero!");
let r = edge_num as f64 / t_used;
// make the range of `r` to be [0, 5];
let avg = AVG_SCORE.with(|c| {
let (mut avg, mut num) = c.get();
Expand All @@ -74,7 +74,7 @@ impl Selector for SaSelector {
debug,
"#edge: {edge_num}, #t: {t_used}, #call: {call_num}, score: {score}"
);
if feedback.has_new_uniq_path {
if feedback.num_uniq_path > 5 {
bonus += SA_UNIQ_NEW;
}
(bonus, score)
Expand Down
2 changes: 1 addition & 1 deletion hopper-core/src/feedback/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub struct FeedbackSummary {
// path's length
pub path_len: usize,
// is it reach uniq new path
pub has_new_uniq_path: bool,
pub num_uniq_path: usize,
}

pub static mut INSTR_LIST: *mut InstrList = std::ptr::null_mut();
Expand Down
5 changes: 1 addition & 4 deletions hopper-core/src/feedback/observer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ impl Observer {
self.branches_state.has_new_uniq(&trace, status)
}

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

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

0 comments on commit da5e044

Please sign in to comment.