Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
minimize.MaskGen Class Reference
Inheritance diagram for minimize.MaskGen:

Public Member Functions

def __init__ (self, nbits, mask)
 
def __iter__ (self)
 
def __next__ (self)
 
def update_tested (self, new_mask)
 
def update_mask (self, new_mask)
 
def count_bits (self)
 
def inc_var (self)
 
def stop (self)
 
def next (self)
 

Public Attributes

 nbits
 
 mask
 
 convolution_idx
 
 max
 
 nbitsVar
 
 filter_mask
 
 tested
 
 gen_new_mask
 

Detailed Description

Generates bitpatterns of <nbits> bits which indicate which
statements or expressions should be masked when passed as the
--smask or --emask parameter to dartfuzz.dart.
The patterns are generated in the following manner:
11111111111111111111111111111111
11111111111111110000000000000000
00000000000000001111111111111111
11111111111111111111111100000000
11111111111111110000000011111111
11111111000000001111111111111111
00000000111111111111111111111111
...
If the error persists with a given a pattern it is stored in the
parameter <mask>.

Definition at line 22 of file minimize.py.

Constructor & Destructor Documentation

◆ __init__()

def minimize.MaskGen.__init__ (   self,
  nbits,
  mask 
)

Definition at line 40 of file minimize.py.

40 def __init__(self, nbits, mask):
41 # Mask bitlength.
42 self.nbits = nbits
43 # Mask determining which statements or expressions to skip.
44 self.mask = mask
45 # Current mask modification start index.
46 self.convolution_idx = 0
47 # Max mask with all bits set to 1.
48 self.max = (1 << (nbits + 1)) - 1
49 # Current number of bits set in the mask modification mask.
50 self.nbitsVar = int(nbits)
51 # Current mask modification mask.
52 # This will be folded over the current value of self.mask
53 # starting from 0.
54 self.filter_mask = (1 << self.nbitsVar) - 1
55 # All the masks already tested.
56 self.tested = set()
57 self.gen_new_mask = False
58
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
Definition: switches.h:76

Member Function Documentation

◆ __iter__()

def minimize.MaskGen.__iter__ (   self)

Definition at line 59 of file minimize.py.

59 def __iter__(self):
60 return self
61

◆ __next__()

def minimize.MaskGen.__next__ (   self)

Definition at line 62 of file minimize.py.

62 def __next__(self):
63 return self.next()
64

◆ count_bits()

def minimize.MaskGen.count_bits (   self)

Definition at line 83 of file minimize.py.

83 def count_bits(self):
84 return bin(self.mask).count('1')
85
int count
Definition: FontMgrTest.cpp:50

◆ inc_var()

def minimize.MaskGen.inc_var (   self)

Definition at line 86 of file minimize.py.

86 def inc_var(self):
87 self.convolution_idx = 0
88 self.nbitsVar = self.nbitsVar >> 1
89 self.filter_mask = (1 << self.nbitsVar) - 1
90 return self.filter_mask == 0
91

◆ next()

def minimize.MaskGen.next (   self)

Definition at line 105 of file minimize.py.

105 def next(self):
106 while not self.stop():
107 # Generate a new mask according to the mask generation algorithm.
108 new_mask = (self.mask |
109 (self.filter_mask << self.convolution_idx)) & self.max
110 # Update the counter variable for the mask generation algorithm.
111 self.convolution_idx += self.nbitsVar
112 # If the new_mask has new bits and has not been tested yet.
113 # We need to check both because only masks that produce an
114 # error are merged into self.mask.
115 if new_mask != self.mask and \
116 new_mask not in self.tested:
117 # Add new mask to the set of tested masks.
118 self.tested.add(new_mask)
119 # Mark that we generated a new mask on this run.
120 self.gen_new_mask = True
121 # Return the new mask to be tested.
122 return new_mask
123 raise StopIteration()
124
125
126# Generate a Dart program for the given statement (smask) and
127# expression (emask) masks. Dartfuzz parameters for seed, ffi and
128# fp are static and therefore contained in the dartfuzz_cmd parameter.
static float next(float f)

◆ stop()

def minimize.MaskGen.stop (   self)

Definition at line 92 of file minimize.py.

92 def stop(self):
93 if self.convolution_idx >= self.nbits and self.inc_var() > 0:
94 # Check if the last run generated a new mask.
95 if self.gen_new_mask:
96 # Restart mask generation from beginning.
97 self.nbitsVar = self.nbits >> 1
98 self.inc_var()
99 self.gen_new_mask = False
100 return False
101 print("STOP")
102 return True
103 return False
104
def print(*args, **kwargs)
Definition: run_tests.py:49

◆ update_mask()

def minimize.MaskGen.update_mask (   self,
  new_mask 
)

Definition at line 76 of file minimize.py.

76 def update_mask(self, new_mask):
77 new_mask = (self.mask | new_mask) & self.max
78 self.mask = new_mask
79

◆ update_tested()

def minimize.MaskGen.update_tested (   self,
  new_mask 
)

Definition at line 67 of file minimize.py.

67 def update_tested(self, new_mask):
68 self.tested.add(new_mask)
69

Member Data Documentation

◆ convolution_idx

minimize.MaskGen.convolution_idx

Definition at line 46 of file minimize.py.

◆ filter_mask

minimize.MaskGen.filter_mask

Definition at line 54 of file minimize.py.

◆ gen_new_mask

minimize.MaskGen.gen_new_mask

Definition at line 57 of file minimize.py.

◆ mask

minimize.MaskGen.mask

Definition at line 44 of file minimize.py.

◆ max

minimize.MaskGen.max

Definition at line 48 of file minimize.py.

◆ nbits

minimize.MaskGen.nbits

Definition at line 42 of file minimize.py.

◆ nbitsVar

minimize.MaskGen.nbitsVar

Definition at line 50 of file minimize.py.

◆ tested

minimize.MaskGen.tested

Definition at line 56 of file minimize.py.


The documentation for this class was generated from the following file: