Skip to content

Commit

Permalink
- rename SimulationRuntime/c/meta/gc.* to SimulationRuntime/c/meta/mm…
Browse files Browse the repository at this point in the history
…c_gc.*

- to use the Boehm GC uncomment:
  #define _MMC_USE_BOEHM_GC_
  in SimulationRuntime/c/meta/mmc_gc.h
  and recompile the SimulationRuntime/c and the bootstrapped compiler.
  note that you will have to link omc or the bootstrapped compiler with Boehm GC 
  (for OMDev the flags are already in place but commented out, search for boehm in the Makefiles.omdev.mingw,
   also the compiled libgc was added to OMDev).


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14098 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Nov 28, 2012
1 parent 32662df commit 4418a89
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 14 deletions.
2 changes: 1 addition & 1 deletion SimulationRuntime/c/Makefile.common
Expand Up @@ -17,7 +17,7 @@ RUNTIME_HEADERS = ./simulation/libf2c/f2c.h \
./math-support/blaswrap.h \
./math-support/matrix.h \
./meta/gc/common.h \
./meta/gc/gc.h \
./meta/gc/mmc_gc.h \
./meta/gc/generational.h \
./meta/gc/marksweep.h \
./meta/gc/roots.h \
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/c/meta/gc/generational.c
Expand Up @@ -34,7 +34,7 @@
* Adrian Pop [Adrian.Pop@liu.se]
* This file implements the new MetaModelica Garbage Collector
* which is a mark-and-sweep collector. See more information
* in gc.h file.
* in mmc_gc.h file.
*
* RCS: $Id: generational.c 8047 2011-03-01 10:19:49Z perost $
*
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/c/meta/gc/generational.h
Expand Up @@ -33,7 +33,7 @@
/*
* Adrian Pop [Adrian.Pop@liu.se]
* This file implements the MetaModelica generational garbage collector
* See more information in gc.h file.
* See more information in mmc_gc.h file.
*
* RCS: $Id: generational.h 8047 2011-03-01 10:19:49Z perost $
*
Expand Down
16 changes: 13 additions & 3 deletions SimulationRuntime/c/meta/gc/marksweep.c
Expand Up @@ -33,7 +33,7 @@
/*
* Adrian Pop [Adrian.Pop@liu.se]
* This file implements the new MetaModelica mark-and-sweep garbage collector
* See more information in gc.h file.
* See more information in mmc_gc.h file.
*
* RCS: $Id: marksweep.c 8047 2011-03-01 10:19:49Z perost $
*
Expand Down Expand Up @@ -585,7 +585,18 @@ void *mmc_alloc_words(unsigned nwords)
return mmc_gen_alloc_words(nwords);
}

#else /* normal GC */
#elif defined(_MMC_USE_BOEHM_GC_) /* use the BOEHM Garbage collector */

#define LARGE_CONFIG 1
#include <gc.h>

/* primary allocation routine for MetaModelica */
void *mmc_alloc_words(unsigned nwords)
{
return GC_MALLOC(nwords * sizeof(void*));
}

#else /* NO GC */

void *mmc_alloc_bytes(unsigned nbytes)
{
Expand Down Expand Up @@ -625,7 +636,6 @@ void *mmc_alloc_words(unsigned nwords)
return mmc_alloc_bytes(nwords * sizeof(void*));
}


#endif /* defined(_MMC_GC_) */

int is_in_range(modelica_metatype p, modelica_metatype start, size_t bytes)
Expand Down
File renamed without changes.
Expand Up @@ -40,16 +40,21 @@
* memory to allocate a new older generation we switch to a
* mark-and-sweep collector.
*
* RCS: $Id: gc.h 8047 2011-03-01 10:19:49Z perost $
* RCS: $Id: mmc_gc.h 8047 2011-03-01 10:19:49Z perost $
*
*/

#ifndef META_MODELICA_GC_H_
#define META_MODELICA_GC_H_
/*

/* uncomment this to use the MetaModelica Garbage collector
#define _MMC_GC_ 1
*/

/* uncomment this to use the BOEHM Garbage collector
#define _MMC_USE_BOEHM_GC_
*/

#if defined(__cplusplus)
extern "C" {
#endif
Expand Down Expand Up @@ -110,15 +115,30 @@ static inline void mmc_GC_add_roots(modelica_metatype* p, int n, mmc_GC_local_st
}
}

#else /* NO GC */
#else

#if defined(_MMC_USE_BOEHM_GC_) /* use the BOEHM Garbage collector */

extern mmc_GC_local_state_type dummy_local_GC_state;

#define mmc_GC_init(settings)
#define mmc_GC_init_default(void)
#define mmc_GC_clear(void)
#define mmc_GC_collect(local_GC_state)
#define LARGE_CONFIG
#include <gc.h>

#define mmc_GC_init(settings) GC_INIT()
#define mmc_GC_init_default(void) GC_INIT()
#define mmc_GC_clear(void)
#define mmc_GC_collect(local_GC_state)

#else /* NO_GC */

extern mmc_GC_local_state_type dummy_local_GC_state;

#define mmc_GC_init(settings)
#define mmc_GC_init_default(void)
#define mmc_GC_clear(void)
#define mmc_GC_collect(local_GC_state)

#endif
#endif /* defined(_MMC_GC_) */


Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/c/meta/meta_modelica.h
Expand Up @@ -43,7 +43,7 @@ extern "C" {
#endif

#include "openmodelica.h"
#include "gc.h"
#include "mmc_gc.h"
#include "meta_modelica_string_lit.h"
#include "meta_modelica_builtin.h"
#include <stdio.h>
Expand Down

0 comments on commit 4418a89

Please sign in to comment.