/usr/share/pyshared/dissy/JumpStreamHandler.py is in dissy 9-3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | ######################################################################
##
## Copyright (C) 2006, Blekinge Institute of Technology
##
## Author: Simon Kagstrom <simon.kagstrom@gmail.com>
## Description: Jump streams
##
## Licensed under the terms of GNU General Public License version 2
## (or later, at your option). See COPYING file distributed with Dissy
## for full text of the license.
##
######################################################################
INVALID=0
START=1
RUNNING=2
END=3
EXTRA=4
EXTRA2=5
class JumpStream:
def __init__(self):
self.state = INVALID
self.insnTuple = (None,None)
def start(self, insnTuple):
self.state = START
self.insnTuple = insnTuple
def running(self):
self.state = RUNNING
def end(self):
self.state = END
def invalid(self):
self.state = INVALID
def extra(self):
self.state = EXTRA
def extra2(self):
self.state = EXTRA2
class JumpStreamHandler:
def __init__(self):
self.streams = []
for i in range(0,3):
self.streams.append(JumpStream())
def alloc(self):
for stream in self.streams:
if stream.state == INVALID or stream.state == END:
return stream
for stream in self.streams:
stream.extra()
return None
def update(self, insn):
for stream in self.streams:
if stream.state == START and insn != stream.insnTuple[0]:
stream.running()
elif stream.state == END:
stream.invalid()
elif stream.state == EXTRA:
stream.extra2()
elif stream.state == EXTRA2:
stream.running()
# If this is the destination, switch to the end state
if insn == stream.insnTuple[1]:
stream.end()
def getStateTuple(self):
return (self.streams[0].state, self.streams[1].state, self.streams[2].state)
|