[parrot/parrot] da8e94: Lots of assertions for debugging memory separation...

GitHub noreply at github.com
Fri Mar 23 16:08:55 UTC 2012


  Branch: refs/heads/threads
  Home:   https://github.com/parrot/parrot
  Commit: da8e94e871ff79ead41958885a1e8bc2f2d3c72f
      https://github.com/parrot/parrot/commit/da8e94e871ff79ead41958885a1e8bc2f2d3c72f
  Author: Stefan Seifert <nine at detonation.org>
  Date:   2012-03-11 (Sun, 11 Mar 2012)

  Changed paths:
    M include/parrot/gc_api.h
  M include/parrot/pobj.h
  M lib/Parrot/Pmc2c/PMC/Proxy.pm
  M src/gc/api.c
  M src/gc/gc_gms.c
  M src/oo.c
  M src/pmc/proxy.pmc
  M src/scheduler.c
  M src/thread.c

  Log Message:
  -----------
  Lots of assertions for debugging memory separation violations


  Commit: 460b9b5b899715f8681bd575ff9b245e8b364dac
      https://github.com/parrot/parrot/commit/460b9b5b899715f8681bd575ff9b245e8b364dac
  Author: Stefan Seifert <nine at detonation.org>
  Date:   2012-03-21 (Wed, 21 Mar 2012)

  Changed paths:
    M src/pmc/proxy.pmc

  Log Message:
  -----------
  Proxy workaround for TT #1219, see Parrot_ns_find_namespace_global


  Commit: 49e19be217d654a13f697639966581c39b203280
      https://github.com/parrot/parrot/commit/49e19be217d654a13f697639966581c39b203280
  Author: Stefan Seifert <nine at detonation.org>
  Date:   2012-03-23 (Fri, 23 Mar 2012)

  Changed paths:
    M src/oo.c

  Log Message:
  -----------
  Remove debug output


  Commit: 8fd28909747f5426d68e91924eb46bad11678cf4
      https://github.com/parrot/parrot/commit/8fd28909747f5426d68e91924eb46bad11678cf4
  Author: Stefan Seifert <nine at detonation.org>
  Date:   2012-03-23 (Fri, 23 Mar 2012)

  Changed paths:
    M include/parrot/interpreter.h
  M src/pmc/parrotinterpreter.pmc
  M src/thread.c

  Log Message:
  -----------
  Avoid calling init_world_once again for each thread

Pulled in a lot of interpreter setup code into clone_interpreter. Not
exactly pretty, but this is the only way to avoid running all the stuff
which really should only run once for the main thread. At least without
a major refactor that is. Also starting from a clean slate makes it much
easier to find leaks of unproxied PMCs to other threads.


  Commit: 6acce00495079a5b2234bf443212804f13985afc
      https://github.com/parrot/parrot/commit/6acce00495079a5b2234bf443212804f13985afc
  Author: Stefan Seifert <nine at detonation.org>
  Date:   2012-03-23 (Fri, 23 Mar 2012)

  Changed paths:
    M src/thread.c

  Log Message:
  -----------
  Don't block on writing to the notifierfd.

If a threads notification pipe is full, we don't need to notify the
thread anyway since it will check all expired alarms with a single
notification.


  Commit: 9ebf0d9e9a2cc401040c97649663cbb09a629331
      https://github.com/parrot/parrot/commit/9ebf0d9e9a2cc401040c97649663cbb09a629331
  Author: Stefan Seifert <nine at detonation.org>
  Date:   2012-03-23 (Fri, 23 Mar 2012)

  Changed paths:
    M include/parrot/pobj.h

  Log Message:
  -----------
  s/Parrot_Interp */Parrot_Interp/

Parrot_Interp is already a pointer, no need for the asterisk for the
orig_interp declaration. Fixes a lot of compiler warnings (otherwise
harmless, since we only compare this pointer)


  Commit: 5a9e01ea791f5dacf002fc22dc0372334d602749
      https://github.com/parrot/parrot/commit/5a9e01ea791f5dacf002fc22dc0372334d602749
  Author: Stefan Seifert <nine at detonation.org>
  Date:   2012-03-23 (Fri, 23 Mar 2012)

  Changed paths:
    M src/gc/gc_gms.c
  M src/gc/mark_sweep.c
  M src/pmc/sub.pmc
  M src/scheduler.c
  M src/thread.c

  Log Message:
  -----------
  Use PARROT_IS_THREAD flag instead of testing for interp->thread_data


  Commit: a4b87884625d1642350617b2b4d3c3fa2d7840dc
      https://github.com/parrot/parrot/commit/a4b87884625d1642350617b2b4d3c3fa2d7840dc
  Author: Stefan Seifert <nine at detonation.org>
  Date:   2012-03-23 (Fri, 23 Mar 2012)

  Changed paths:
    M compilers/imcc/pbc.c
  M include/parrot/gc_api.h
  M src/packfile/api.c
  M src/packfile/segments.c

  Log Message:
  -----------
  Flag packfile constants as shared and GC them only on the main thread

Packfiles are no PMCs so we cannot simply create a proxy for them. But
they naturally belong to the main thread, so we use the "shared" PMC
flag to tell the GC that only the main thread should mark and sweep
them.


  Commit: c41af2930a51ded2f3546f3b1abe8935c9e36cfd
      https://github.com/parrot/parrot/commit/c41af2930a51ded2f3546f3b1abe8935c9e36cfd
  Author: Stefan Seifert <nine at detonation.org>
  Date:   2012-03-23 (Fri, 23 Mar 2012)

  Changed paths:
    M include/parrot/thread.h
  M src/thread.c

  Log Message:
  -----------
  Don't create proxies for Subs but clone them

When executing a proxied Sub, the context belonging to the foreign
interp would be used. This context for example contains globals and
namespaces.
get_global in this Sub would therefore fetch a global from an unproxied
namespace and get an unproxied global in return without any chance for
us to catch this and create a proxy.

Better to clone the sub and create proxies for all its PMC attributes
(most of all namespaces)


  Commit: 031e9683e9f1754e48f8b1dccf7d03408790b587
      https://github.com/parrot/parrot/commit/031e9683e9f1754e48f8b1dccf7d03408790b587
  Author: Stefan Seifert <nine at detonation.org>
  Date:   2012-03-23 (Fri, 23 Mar 2012)

  Changed paths:
    M lib/Parrot/Pmc2c/PMC/Proxy.pm

  Log Message:
  -----------
  Run proxied VTABLE methods with the threads interp

Even read only methods can cause garbage collection (e.g. with parameter
passing). This would have catastrophic results, since a foreign thread
would be running this GC and it would find both threads' PMCs. Even
worse, the proxied interp could be running the GC at the same time.

Blocking the foreign GC is not possible without lots of locking since
even if we Parrot_block_GC_mark, the foreign interp could already be
running its GC.

Running the method with the thread's interp seems like the smaller
problem. The interps are closely related, so the data the method needs
should be available (and well suited to the caller). On the other hand
we no longer can unconditionally create proxies for all returned PMCs
since those could as well have been created by the call and would now
belong to the thread's interp. So we now check the PMC's orig_interp and
use it to decide if we need to create a proxy.

Since this enlarges every PMC by a pointer, this has some negative
impact on performance. A possible optimization could be to tell the GC
to set a flag on all newly created PMCs since we don't need to know
which interp exactly created the PMC, just if it was the current one.

We still have to block GC since during the call foreign PMCs might be on
the C stack which should not be handled by our GC.


  Commit: d1852f86a4fe5da7a047bb0bbc7927e4eca53c0a
      https://github.com/parrot/parrot/commit/d1852f86a4fe5da7a047bb0bbc7927e4eca53c0a
  Author: Stefan Seifert <nine at detonation.org>
  Date:   2012-03-23 (Fri, 23 Mar 2012)

  Changed paths:
    M src/pmc/parrotinterpreter.pmc
  M src/scheduler.c
  M src/thread.c

  Log Message:
  -----------
  Lock the proxied interp while scheduling a task

Scheduling a task could cause garbage collection. To be able to savely
disable the GC the proxied interp must be in a known state, so we have
to lock it. Same mechanism is already used for thread interps. Just do
the same for the main thread.


  Commit: e46e799645ff269904f05cfbb42e6883515f7f98
      https://github.com/parrot/parrot/commit/e46e799645ff269904f05cfbb42e6883515f7f98
  Author: Stefan Seifert <nine at detonation.org>
  Date:   2012-03-23 (Fri, 23 Mar 2012)

  Changed paths:
    M src/thread.c

  Log Message:
  -----------
  Don't exit a thread if no tasks are running

Keep threads running even if no tasks are in the queue since the main
thread may schedule new tasks any time.


Compare: https://github.com/parrot/parrot/compare/7b7202e...e46e799


More information about the parrot-commits mailing list