/* toolbox/memory.c -
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
- M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
- P. Tomsich, J. Wenninger
+ Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
+ R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
+ C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
+ Institut f. Computersprachen - TU Wien
This file is part of CACAO.
Authors: Reinhard Grafl
- $Id: memory.c 1568 2004-11-23 16:02:31Z twisti $
+ $Id: memory.c 1735 2004-12-07 14:33:27Z twisti $
*/
#include <unistd.h>
#include "config.h"
-#include "exceptions.h"
-#include "global.h"
-#include "native.h"
-#include "options.h"
-#include "statistics.h"
-#include "threads/nativethread.h"
+#include "mm/memory.h"
+#include "vm/exceptions.h"
+#include "vm/global.h"
+#include "vm/options.h"
+#include "vm/statistics.h"
+#include "native/native.h"
+
+#if defined(USE_THREADS)
+# if defined(NATIVE_THREADS)
+# include "threads/native/threads.h"
+# else
+# include "threads/green/threads.h"
+# endif
+#endif
+
#include "toolbox/logging.h"
-#include "toolbox/memory.h"
/********* general types, variables and auxiliary functions *********/
*******************************************************************************/
-#if !defined(USE_THREADS)
+#if !defined(USE_THREADS) || (defined(USE_THREADS) && !defined(NATIVE_THREADS))
static dumpinfo nothreads_dumpinfo;
#endif
/* If no threads are used, the dumpinfo structure is a static structure */
/* defined at the top of this file. */
-#if defined(USE_THREADS)
+#if defined(USE_THREADS) && defined(NATIVE_THREADS)
di = &((threadobject *) THREADOBJECT)->dumpinfo;
#else
di = ¬hreads_dumpinfo;
/* If no threads are used, the dumpinfo structure is a static structure */
/* defined at the top of this file. */
-#if defined(USE_THREADS)
+#if defined(USE_THREADS) && defined(NATIVE_THREADS)
di = &((threadobject *) THREADOBJECT)->dumpinfo;
#else
di = ¬hreads_dumpinfo;
/* If no threads are used, the dumpinfo structure is a static structure */
/* defined at the top of this file. */
-#if defined(USE_THREADS)
+#if defined(USE_THREADS) && defined(NATIVE_THREADS)
di = &((threadobject *) THREADOBJECT)->dumpinfo;
#else
di = ¬hreads_dumpinfo;
#endif
+ if (!di)
+ return 0;
+
return di->useddumpsize;
}