mirror of
https://github.com/catseye/SixtyPical.git
synced 2024-11-25 23:49:17 +00:00
Set a location as touched when trashed with a trash
instruction.
This commit is contained in:
parent
f4befb45d3
commit
3f1f3bf16e
@ -6,6 +6,7 @@ History of SixtyPical
|
|||||||
|
|
||||||
* `copy` is now understood to trash `a`, thus `copy ..., a` is not valid.
|
* `copy` is now understood to trash `a`, thus `copy ..., a` is not valid.
|
||||||
Indirect addressing is supported in `ld`, as in `ld a, [ptr] + y`, to compensate.
|
Indirect addressing is supported in `ld`, as in `ld a, [ptr] + y`, to compensate.
|
||||||
|
* Fixed bug where `trash` was not marking the location as being virtually altered.
|
||||||
|
|
||||||
0.11
|
0.11
|
||||||
----
|
----
|
||||||
|
@ -207,8 +207,8 @@ class Analyzer(object):
|
|||||||
if routine.block is None:
|
if routine.block is None:
|
||||||
# it's an extern, that's fine
|
# it's an extern, that's fine
|
||||||
return
|
return
|
||||||
type = routine.location.type
|
type_ = routine.location.type
|
||||||
context = Context(self.routines, routine, type.inputs, type.outputs, type.trashes)
|
context = Context(self.routines, routine, type_.inputs, type_.outputs, type_.trashes)
|
||||||
if self.debug:
|
if self.debug:
|
||||||
print "at start of routine `{}`:".format(routine.name)
|
print "at start of routine `{}`:".format(routine.name)
|
||||||
print context
|
print context
|
||||||
@ -217,10 +217,10 @@ class Analyzer(object):
|
|||||||
print "at end of routine `{}`:".format(routine.name)
|
print "at end of routine `{}`:".format(routine.name)
|
||||||
print context
|
print context
|
||||||
if not self.has_encountered_goto:
|
if not self.has_encountered_goto:
|
||||||
for ref in type.outputs:
|
for ref in type_.outputs:
|
||||||
context.assert_meaningful(ref, exception_class=UnmeaningfulOutputError)
|
context.assert_meaningful(ref, exception_class=UnmeaningfulOutputError)
|
||||||
for ref in context.each_touched():
|
for ref in context.each_touched():
|
||||||
if ref not in type.outputs and ref not in type.trashes:
|
if ref not in type_.outputs and ref not in type_.trashes:
|
||||||
message = '%s in %s' % (ref.name, routine.name)
|
message = '%s in %s' % (ref.name, routine.name)
|
||||||
raise ForbiddenWriteError(message)
|
raise ForbiddenWriteError(message)
|
||||||
self.current_routine = None
|
self.current_routine = None
|
||||||
@ -466,6 +466,7 @@ class Analyzer(object):
|
|||||||
|
|
||||||
self.has_encountered_goto = True
|
self.has_encountered_goto = True
|
||||||
elif opcode == 'trash':
|
elif opcode == 'trash':
|
||||||
|
context.set_touched(instr.dest)
|
||||||
context.set_unmeaningful(instr.dest)
|
context.set_unmeaningful(instr.dest)
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError(opcode)
|
raise NotImplementedError(opcode)
|
||||||
|
@ -127,7 +127,7 @@ If a routine trashes a location, this must be declared.
|
|||||||
| {
|
| {
|
||||||
| trash x
|
| trash x
|
||||||
| }
|
| }
|
||||||
? UnmeaningfulOutputError: x in foo
|
? ForbiddenWriteError: x in foo
|
||||||
|
|
||||||
| routine foo
|
| routine foo
|
||||||
| outputs x
|
| outputs x
|
||||||
@ -162,7 +162,7 @@ If a routine causes a location to be trashed, this must be declared in the calle
|
|||||||
| {
|
| {
|
||||||
| call trash_x
|
| call trash_x
|
||||||
| }
|
| }
|
||||||
? UnmeaningfulOutputError: x in foo
|
? ForbiddenWriteError: x in foo
|
||||||
|
|
||||||
| routine trash_x
|
| routine trash_x
|
||||||
| trashes x, z, n
|
| trashes x, z, n
|
||||||
|
Loading…
Reference in New Issue
Block a user