Hi Raihan, On Thu, 27 May 2021 at 17:44, Raihan Rasheed Apurbo <apurb...@gmail.com> wrote: > I have read the test codes of test_llinterp.py and llinterp.py. I am writing > a summary below. I just want you to point out my mistakes if I am wrong. > Please help me to understand this.
There are many tests doing various checks at various levels. I think you should focus on the "final" tests that try to translate the GC to C and run it: they are in rpython/translator/c/test/test_newgc.py. The reason I'm suggesting to focus on these tests instead of looking at all intermediate levels is that, if I'm understanding it correctly, you mostly want to plug in an existing library to do the GC. You're thus going to fight problems of integration more than problems of algorithmically correct code. It's OK if you ignore the other tests because they are likely to not work out of the box in your case. For example they're half-emulating the actual memory layout of the objects, but your external library cannot work with such emulation. So I'd recommend looking at test_newgc instead of, say, rpython/rtyper/llinterp.py, which is here only to make this emulation work. test_newgc contains tests of the form of a top-level RPython function (typically called f()) that does random RPython things that need memory allocation (which is almost anything that makes lists, tuples, instances of classes, etc.). These RPython things are automatically translated to calls to lltype.malloc(). Some of the tests in test_newgc are directly calling lltype.malloc() too. For the purpose of this test, the two kinds of approaches are equivalent. Note also that in the past, during development of the branch "stmgc-c8", we made a different GC in C directly and integrated it a bit differently, in a way that is simpler and makes more sense for external GCs. Maybe you want to look at this old branch instead. But it can also be confusing because this STM GC added many kinds of unusual barriers (rpython/memory/gctransform/stmframework.py in this branch). A bientôt, Armin. _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev