mirror of
https://github.com/catseye/SixtyPical.git
synced 2025-01-23 10:30:16 +00:00
Change the serialization format to be (hopefully) clearer.
This commit is contained in:
parent
efe8859209
commit
cab84b8ebe
@ -73,7 +73,7 @@ class FallthruAnalyzer(object):
|
||||
if routine.name not in self.fall_out_map:
|
||||
self.fall_out_map[routine.name] = None
|
||||
|
||||
routine_list = []
|
||||
roster = []
|
||||
pending_routines = copy(self.fall_out_map)
|
||||
while pending_routines:
|
||||
# Pick a routine that is still pending to be serialized.
|
||||
@ -87,13 +87,11 @@ class FallthruAnalyzer(object):
|
||||
chains.sort(key=len, reverse=True)
|
||||
routines = chains[0]
|
||||
|
||||
# Remove (r1,r2,...,rn) from R and append them to L in that order.
|
||||
# Mark (r1,r2,...rn-1) as "will have their final goto removed."
|
||||
# Append (r1,r2,...,rn) to the roster and remove r1,r2,...rn from R.
|
||||
# A sublist like this appearing in the roster has meaning
|
||||
# "optimize the final goto out of all but the last routine in the sublist".
|
||||
for r in routines:
|
||||
del pending_routines[r]
|
||||
if r == routines[-1]:
|
||||
routine_list.append(['retain', r])
|
||||
else:
|
||||
routine_list.append(['fallthru', r])
|
||||
roster.append(routines)
|
||||
|
||||
return routine_list
|
||||
return roster
|
||||
|
@ -73,7 +73,6 @@ through to it.
|
||||
= *** serialization:
|
||||
= [
|
||||
= [
|
||||
= "retain",
|
||||
= "main"
|
||||
= ]
|
||||
= ]
|
||||
@ -97,18 +96,13 @@ If main does a `goto foo`, then it can fall through to `foo`.
|
||||
= *** serialization:
|
||||
= [
|
||||
= [
|
||||
= "fallthru",
|
||||
= "main"
|
||||
= ],
|
||||
= [
|
||||
= "retain",
|
||||
= "main",
|
||||
= "foo"
|
||||
= ]
|
||||
= ]
|
||||
|
||||
More than one routine can fall through to a routine.
|
||||
|
||||
If main does a `goto foo`, then it can fall through to `foo`.
|
||||
More than one routine can fall through to a routine. We pick one
|
||||
of them to fall through, when selecting the order of routines.
|
||||
|
||||
| define foo routine trashes a, z, n
|
||||
| {
|
||||
@ -134,15 +128,10 @@ If main does a `goto foo`, then it can fall through to `foo`.
|
||||
= *** serialization:
|
||||
= [
|
||||
= [
|
||||
= "fallthru",
|
||||
= "main"
|
||||
= ],
|
||||
= [
|
||||
= "retain",
|
||||
= "main",
|
||||
= "foo"
|
||||
= ],
|
||||
= [
|
||||
= "retain",
|
||||
= "bar"
|
||||
= ]
|
||||
= ]
|
||||
@ -188,15 +177,10 @@ fall through to the other.
|
||||
= *** serialization:
|
||||
= [
|
||||
= [
|
||||
= "retain",
|
||||
= "main"
|
||||
= ],
|
||||
= [
|
||||
= "fallthru",
|
||||
= "bar"
|
||||
= ],
|
||||
= [
|
||||
= "retain",
|
||||
= "bar",
|
||||
= "foo"
|
||||
= ]
|
||||
= ]
|
||||
@ -227,15 +211,12 @@ routine.
|
||||
= *** serialization:
|
||||
= [
|
||||
= [
|
||||
= "retain",
|
||||
= "main"
|
||||
= ],
|
||||
= [
|
||||
= "retain",
|
||||
= "bar"
|
||||
= ],
|
||||
= [
|
||||
= "retain",
|
||||
= "foo"
|
||||
= ]
|
||||
= ]
|
||||
@ -265,15 +246,12 @@ because we don't necessarily know what actual routine the vector contains.
|
||||
= *** serialization:
|
||||
= [
|
||||
= [
|
||||
= "retain",
|
||||
= "main"
|
||||
= ],
|
||||
= [
|
||||
= "retain",
|
||||
= "bar"
|
||||
= ],
|
||||
= [
|
||||
= "retain",
|
||||
= "foo"
|
||||
= ]
|
||||
= ]
|
||||
|
Loading…
x
Reference in New Issue
Block a user