## ASSIGNMENT 07 - MOVING MARK AND SWEEP

jandalf
Erstie
Beiträge: 16
Registriert: 18. Apr 2015 20:36

### ASSIGNMENT 07 - MOVING MARK AND SWEEP

Currently, I get 17/19 on the hidden tests and 6/6 on the public ones. I really thought hard about what I possibly do wrong, but I have no idea, based on the sparse task description and logic reasoning what else it could be. Anyone has suggestions or the same passing percentage?

Kind regards

lkbaerenfaenger
Mausschubser
Beiträge: 44
Registriert: 13. Mär 2012 12:44

### Re: ASSIGNMENT 07 - MOVING MARK AND SWEEP

A friend of mine and me have exactly the same passing percentage, no idea why... Any help would be appreciated.

Talaron
Mausschubser
Beiträge: 85
Registriert: 26. Apr 2012 11:34

### Re: ASSIGNMENT 07 - MOVING MARK AND SWEEP

Some tests are a bit strict when it comes to reordering of values.

For example:

Code: Alles auswählen

Before GC:
Env = ('x -> 1, 'y -> 2)
Store = (0 -> NumV(12), 1 -> NumV(34), 2 -> NumV(56))

After GC:
Env = ('x -> 1, 'y -> 0)
Store = (0 -> NumV(56), 1 -> NumV(34))

This behaviour is not really an error but causes some of the tests to fail. In general, please make sure that the following rules apply for your GC:
1. If GC doesn't sweep any values, it should also not move anything around in the store.
2. If GC sweeps values, the order of the remaining values should stay the same.

jandalf
Erstie
Beiträge: 16
Registriert: 18. Apr 2015 20:36

### Re: ASSIGNMENT 07 - MOVING MARK AND SWEEP

When I test your example with my 17/19, then I get the following:

Code: Alles auswählen

STARTING GC
STACK = List(Map('y -> 2, 'x -> 1))
STORE = ArraySeq(NumV(12), NumV(34), NumV(56))
GC COMPLETE
STACK = List(Map('y -> 1, 'x -> 0))
STORE = ArraySeq(NumV(34), NumV(56), null)
NUMBER OF FREE SLOTS = 1
From what I can think of, reordering should not happen because you sweep from left to right, therefore never taking a value which is to the right before any to the left. Or am I wrong?

Talaron
Mausschubser
Beiträge: 85
Registriert: 26. Apr 2012 11:34

### Re: ASSIGNMENT 07 - MOVING MARK AND SWEEP

Please write a discussion ticket in Weblab. I can check if your code has another issue that makes it fail some tests. The re-ordering is just one of the most common issues.

You should also test that code which contains boxes isn't reordered as well.

Talaron
Mausschubser
Beiträge: 85
Registriert: 26. Apr 2012 11:34

### Re: ASSIGNMENT 07 - MOVING MARK AND SWEEP

One of the test cases that most of you have problems with looks like this:

Code: Alles auswählen

Store = (NumV(23), Box(0), NumV(42))
Stack = ('b -> 1, 'n -> 2)
GC should do nothing here, but it either rearranges the store or, even worse, cleans up the whole store!