Generate inverses for filter regions
This commit is contained in:
+47
-11
@@ -127,6 +127,20 @@ $CONFIGS{no_native_call_data} = {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Generate the inverse filters to the regions defined above
|
||||||
|
for my $name ( keys %CONFIGS ) {
|
||||||
|
next unless $name =~ /^no_/;
|
||||||
|
( my $only_name = $name ) =~ s/^no_/only_/;
|
||||||
|
my $src = $CONFIGS{$name};
|
||||||
|
my $label = $src->{label} // $name;
|
||||||
|
$label =~ s/^Exclude/Keep only/;
|
||||||
|
$CONFIGS{$only_name} = {
|
||||||
|
label => $label,
|
||||||
|
invert => 1,
|
||||||
|
regions => $src->{regions},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
# Those will be executed automatically by runner.pl (+ no filter at all)
|
# Those will be executed automatically by runner.pl (+ no filter at all)
|
||||||
# my @DEFAULT_CONFIGS = ('no_aot_data');
|
# my @DEFAULT_CONFIGS = ('no_aot_data');
|
||||||
my @DEFAULT_CONFIGS = ();
|
my @DEFAULT_CONFIGS = ();
|
||||||
@@ -151,33 +165,55 @@ sub build_filter_clause {
|
|||||||
|
|
||||||
my $elf = "$experiment_dir/system.elf";
|
my $elf = "$experiment_dir/system.elf";
|
||||||
|
|
||||||
my @filters;
|
# Produce ($start, $end, $col)-tuple from a defined region
|
||||||
for my $config_name (@config_names) {
|
my $resolve = sub {
|
||||||
my $regions = $CONFIGS{$config_name}{regions};
|
my ($region) = @_;
|
||||||
next unless defined $regions;
|
|
||||||
|
|
||||||
for my $region (@$regions) {
|
|
||||||
my ( $start, $end, $col );
|
my ( $start, $end, $col );
|
||||||
|
|
||||||
if ( ref($region) eq 'HASH' ) {
|
if ( ref($region) eq 'HASH' ) {
|
||||||
|
|
||||||
# resolve [start, end) via symbol + size
|
# Symbol + size definition (e.g., native call function list)
|
||||||
$col = $region->{col};
|
$col = $region->{col};
|
||||||
( $start, $end ) = Util::elf_sym_range( $elf, $region->{func} );
|
( $start, $end ) = Util::elf_sym_range( $elf, $region->{func} );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# [start_sym, end_sym, col]
|
# Linker script definition (e.g., AOT region)
|
||||||
my ( $start_sym, $end_sym );
|
my ( $start_sym, $end_sym );
|
||||||
( $start_sym, $end_sym, $col ) = @$region;
|
( $start_sym, $end_sym, $col ) = @$region;
|
||||||
$start = Util::elf_sym_addr( $elf, $start_sym );
|
$start = Util::elf_sym_addr( $elf, $start_sym );
|
||||||
$end = Util::elf_sym_addr( $elf, $end_sym );
|
$end = Util::elf_sym_addr( $elf, $end_sym );
|
||||||
}
|
}
|
||||||
|
return unless defined $start && defined $end && $end > $start;
|
||||||
|
return ( $start, $end, $col );
|
||||||
|
};
|
||||||
|
|
||||||
next unless defined $start && defined $end && $end > $start;
|
my @excl_filters;
|
||||||
push @filters, "$col NOT BETWEEN $start AND @{[$end - 1]}";
|
my @keep_terms;
|
||||||
|
|
||||||
|
for my $config_name (@config_names) {
|
||||||
|
my $config = $CONFIGS{$config_name};
|
||||||
|
next unless defined $config;
|
||||||
|
my $regions = $config->{regions};
|
||||||
|
next unless defined $regions;
|
||||||
|
my $invert = $config->{invert};
|
||||||
|
|
||||||
|
for my $region (@$regions) {
|
||||||
|
my ( $start, $end, $col ) = $resolve->($region);
|
||||||
|
next unless defined $start;
|
||||||
|
|
||||||
|
if ($invert) {
|
||||||
|
push @keep_terms, "$col BETWEEN $start AND @{[$end - 1]}";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
push @excl_filters, "$col NOT BETWEEN $start AND @{[$end - 1]}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Including filters are combined with OR...
|
||||||
|
my @filters = @excl_filters;
|
||||||
|
push @filters, "(" . join( " OR ", @keep_terms ) . ")" if @keep_terms;
|
||||||
|
|
||||||
|
# ...excluding filters are combined with AND
|
||||||
return "" unless @filters;
|
return "" unless @filters;
|
||||||
return "\nAND " . join( "\nAND ", @filters );
|
return "\nAND " . join( "\nAND ", @filters );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user