Re: pthread_mutex and resuming/stopping_java
Etienne Gagnon <[email protected]> Tue, 11 Oct 2005 01:51:41 -0400
| Newsgroups | gmane.comp.java.vm.sablevm.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Martin, > Hi all, we're new to sablevm and try to contribute to nizar's work. > We've lot of questions! Just ask... We'll do what we can to answer. > Why do we need these two calls in JVMDI (libsablevm/debug_interface.c)? > _svmm_resuming_java (env); > ... > _svmm_stopping_java (env); > or > _svmm_stopping_java (env); > ... > _svmm_resuming_java (env); This is due to garbage collection. SableVM's collector moves objects, so one must be very careful not to access an object while it is being moved. "stopping_java" means: We're going to run native code (very soon). We won't be using any direct pointer to an object anymore. GC is allowed to proceed if needed (on another thread). "resuming java" means: We're back from native code. We need to access objects, so, we now disable GC (other than at "checkpoints"). > Why is sometimes the following used > pthread_mutex_lock (&vm->global_mutex); > ... > pthread_mutex_unlock (&vm->global_mutex); > > instead of this? > _svmm_mutex_lock (jdwp->global_mutex); > ... > _svmm_mutex_unlock (); The second form should always be used. The only exception is when it's impossible to match lock/unlock. [There's an example of this in gc_copying.c]. Etienne -- Etienne M. Gagnon, Ph.D. http://www.info2.uqam.ca/~egagnon/ SableVM: http://www.sablevm.org/ SableCC: http://www.sablecc.org/ _______________________________________________ SableVM-devel mailing list [email protected] http://sablevm.org/lists/control/listinfo/sablevm-devel
signature.asc
(application/pgp-signature, 256 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDS1LtjyrJi4rH84gRAmHsAJ41xDAaYkyiKeN62CwlswsUhcKDrwCfbHKk emeC4965FsVYgSt2oED6ids= =zU7H -----END PGP SIGNATURE-----