Skip to content

Commit

Permalink
Fewer global symbols, compile fewer functions
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@16955 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Aug 31, 2013
1 parent 2bc2eeb commit 68c41e1
Show file tree
Hide file tree
Showing 16 changed files with 86 additions and 89 deletions.
2 changes: 1 addition & 1 deletion Makefile.common
Expand Up @@ -83,7 +83,7 @@ build/include/omc/gc_config_macros.h: 3rdParty/gc-7.2/include/gc_config_macros.h
build/include/omc/gc_version.h: 3rdParty/gc-7.2/include/gc_version.h mkbuilddirs
cp -pP $< $@
3rdParty/gc-7.2/Makefile: 3rdParty/gc-7.2/Makefile.in 3rdParty/gc-7.2/configure
(cd 3rdParty/gc-7.2 && ./configure --enable-large-config CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)")
(cd 3rdParty/gc-7.2 && ./configure $(GC_THREADS) --enable-large-config CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS) -DTHREAD_LOCAL_ALLOC -DPARALLEL_MARK")

fmi: interactive
$(MAKE) -C SimulationRuntime/fmi/import -f $(defaultMakefileTarget)
Expand Down
1 change: 1 addition & 0 deletions Makefile.in
Expand Up @@ -24,6 +24,7 @@ CPPFLAGS=@CPPFLAGS@
CXXFLAGS=@CXXFLAGS@
LINK=@LINK@
MSL_EXTRA_ARGS=@MSL_EXTRA_ARGS@
GC_THREADS=--enable-threds=posix

include Makefile.common

Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/c/Makefile.common
Expand Up @@ -6,7 +6,7 @@

include Makefile.objs

CPPFLAGS = -g -I. -I$(UTILPATH) -I. -I$(METAPATH) -I$(METAPATH)gc $(LIBF2CINC) -I$(top_builddir)/3rdParty/gc-7.2/include -I$(top_builddir)/3rdParty/FMIL/install/include/ $(CONFIG_CPPFLAGS)
CPPFLAGS = -g -I. -I$(UTILPATH) -I. -I$(METAPATH) -I$(METAPATH)gc $(LIBF2CINC) -I$(top_builddir)/3rdParty/gc-7.2/include -I$(top_builddir)/3rdParty/FMIL/install/include/ $(CONFIG_CPPFLAGS) -DGC_REDIRECT_TO_LOCAL
CFLAGS = $(CPPFLAGS) $(CONFIG_CFLAGS) $(EXTRA_CFLAGS)
CXXFLAGS = $(CFLAGS)
FFLAGS = -O -fexceptions
Expand Down
5 changes: 3 additions & 2 deletions SimulationRuntime/c/meta/gc/generational.c
Expand Up @@ -81,6 +81,8 @@

#include "generational.h"

#ifdef _MMC_GC_

/*#undef NDEBUG*/
#include <assert.h>

Expand Down Expand Up @@ -1037,5 +1039,4 @@ void *mmc_prim_alloc(mmc_uint_t nwords)
return p;
}



#endif
1 change: 1 addition & 0 deletions SimulationRuntime/c/meta/gc/generational.h
Expand Up @@ -47,6 +47,7 @@ extern "C" {
#endif

#include "modelica.h"
#include "mmc_gc.h"

/* the allocated from C region */
typedef struct mmc_c_heap_region
Expand Down
4 changes: 1 addition & 3 deletions SimulationRuntime/c/meta/gc/marksweep.c
Expand Up @@ -40,6 +40,7 @@
*/

#include "modelica.h"
#include "mmc_gc.h"

#if defined(_MMC_GC_)

Expand Down Expand Up @@ -592,7 +593,6 @@ void *mmc_alloc_words(unsigned nwords)

static mmc_GC_state_type x_mmc_GC_state;
mmc_GC_state_type *mmc_GC_state = &x_mmc_GC_state;
mmc_GC_local_state_type dummy_local_GC_state = 0;

/* primary allocation routine for MetaModelica */
void *mmc_alloc_words(unsigned nwords)
Expand All @@ -604,7 +604,6 @@ void *mmc_alloc_words(unsigned nwords)

static mmc_GC_state_type x_mmc_GC_state;
mmc_GC_state_type *mmc_GC_state = &x_mmc_GC_state;
mmc_GC_local_state_type dummy_local_GC_state = 0;

void *mmc_alloc_bytes(unsigned nbytes)
{
Expand Down Expand Up @@ -654,4 +653,3 @@ int is_in_range(modelica_metatype p, modelica_metatype start, size_t bytes)

return 0;
}

4 changes: 0 additions & 4 deletions SimulationRuntime/c/meta/gc/mmc_gc.h
Expand Up @@ -120,8 +120,6 @@ static inline void mmc_GC_add_roots(modelica_metatype* p, int n, mmc_GC_local_st

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

extern mmc_GC_local_state_type dummy_local_GC_state;

#define LARGE_CONFIG
#include <gc.h>

Expand All @@ -132,8 +130,6 @@ extern mmc_GC_local_state_type dummy_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)
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/c/meta/gc/roots.h
Expand Up @@ -96,7 +96,7 @@ void mmc_GC_add_roots_fallback(modelica_metatype*, int, mmc_GC_local_state_type

#define mmc_GC_add_root(A,B,C)
#define mmc_GC_add_roots(p, n, local_GC_state, name)
#define mmc_GC_save_roots_state(name) (dummy_local_GC_state)
#define mmc_GC_save_roots_state(name) (0)
#define mmc_GC_undo_roots_state(local_GC_state)
#define mmc_GC_unwind_roots_state(local_GC_state)

Expand Down
36 changes: 18 additions & 18 deletions SimulationRuntime/c/meta/meta_modelica.h
Expand Up @@ -235,7 +235,7 @@ struct mmc_string {
#define MMC_TRUE (mmc_mk_icon(1))
#define mmc_mk_bcon(X) ((X) != 0 ? MMC_TRUE : MMC_FALSE)

static inline void* mmc_mk_icon(mmc_sint_t i)
static void* mmc_mk_icon(mmc_sint_t i)
{
return MMC_IMMEDIATE(MMC_TAGFIXNUM(i));
}
Expand All @@ -246,7 +246,7 @@ union mmc_double_as_words {
double d;
mmc_uint_t data[2];
};
static inline double mmc_prim_get_real(void *p)
static double mmc_prim_get_real(void *p)
{
union mmc_double_as_words u;
mmc_uint_t *data = &(MMC_REALDATA(p)[0]);
Expand All @@ -256,7 +256,7 @@ static inline double mmc_prim_get_real(void *p)
return u.d;
}

static inline void mmc_prim_set_real(struct mmc_real *p, double d)
static void mmc_prim_set_real(struct mmc_real *p, double d)
{
union mmc_double_as_words u;
mmc_uint_t *data;
Expand All @@ -267,7 +267,7 @@ static inline void mmc_prim_set_real(struct mmc_real *p, double d)
*(data + 1) = u.data[1];
}

static inline void* mmc_mk_scon(const char *s)
static void* mmc_mk_scon(const char *s)
{
unsigned nbytes = strlen(s);
unsigned header = MMC_STRINGHDR(nbytes);
Expand All @@ -290,7 +290,7 @@ static inline void* mmc_mk_scon(const char *s)
return res;
}

static inline void* mmc_mk_scon_len(unsigned nbytes)
static void* mmc_mk_scon_len(unsigned nbytes)
{
unsigned header = MMC_STRINGHDR(nbytes);
unsigned nwords = MMC_HDRSLOTS(header) + 1;
Expand All @@ -304,7 +304,7 @@ static inline void* mmc_mk_scon_len(unsigned nbytes)

char* mmc_mk_scon_len_ret_ptr(size_t nbytes);

static inline void *mmc_mk_box0(unsigned ctor)
static void *mmc_mk_box0(unsigned ctor)
{
struct mmc_struct *p = (struct mmc_struct *) mmc_alloc_words(1);
p->header = MMC_STRUCTHDR(0, ctor);
Expand All @@ -314,7 +314,7 @@ static inline void *mmc_mk_box0(unsigned ctor)
return MMC_TAGPTR(p);
}

static inline void *mmc_mk_box1(unsigned ctor, void *x0)
static void *mmc_mk_box1(unsigned ctor, void *x0)
{
mmc_GC_add_roots(&x0, 1, 0, "");
{
Expand All @@ -330,7 +330,7 @@ static inline void *mmc_mk_box1(unsigned ctor, void *x0)

void printAny(void* any);

static inline void *mmc_mk_box2(unsigned ctor, void *x0, void *x1)
static void *mmc_mk_box2(unsigned ctor, void *x0, void *x1)
{
mmc_GC_add_roots(&x0, 1, 0, "");
mmc_GC_add_roots(&x1, 1, 0, "");
Expand All @@ -349,7 +349,7 @@ static inline void *mmc_mk_box2(unsigned ctor, void *x0, void *x1)
}
}

static inline void *mmc_mk_box3(unsigned ctor, void *x0, void *x1, void *x2)
static void *mmc_mk_box3(unsigned ctor, void *x0, void *x1, void *x2)
{
mmc_GC_add_roots(&x0, 1, 0, "");
mmc_GC_add_roots(&x1, 1, 0, "");
Expand All @@ -370,7 +370,7 @@ static inline void *mmc_mk_box3(unsigned ctor, void *x0, void *x1, void *x2)
}
}

static inline void *mmc_mk_box4(unsigned ctor, void *x0, void *x1, void *x2, void *x3)
static void *mmc_mk_box4(unsigned ctor, void *x0, void *x1, void *x2, void *x3)
{
mmc_GC_add_roots(&x0, 1, 0, "");
mmc_GC_add_roots(&x1, 1, 0, "");
Expand All @@ -392,7 +392,7 @@ static inline void *mmc_mk_box4(unsigned ctor, void *x0, void *x1, void *x2, voi
}
}

static inline void *mmc_mk_box5(unsigned ctor, void *x0, void *x1, void *x2, void *x3, void *x4)
static void *mmc_mk_box5(unsigned ctor, void *x0, void *x1, void *x2, void *x3, void *x4)
{
mmc_GC_add_roots(&x0, 1, 0, "");
mmc_GC_add_roots(&x1, 1, 0, "");
Expand All @@ -416,7 +416,7 @@ static inline void *mmc_mk_box5(unsigned ctor, void *x0, void *x1, void *x2, voi
}
}

static inline void *mmc_mk_box6(unsigned ctor, void *x0, void *x1, void *x2, void *x3, void *x4, void *x5)
static void *mmc_mk_box6(unsigned ctor, void *x0, void *x1, void *x2, void *x3, void *x4, void *x5)
{
mmc_GC_add_roots(&x0, 1, 0, "");
mmc_GC_add_roots(&x1, 1, 0, "");
Expand All @@ -442,7 +442,7 @@ static inline void *mmc_mk_box6(unsigned ctor, void *x0, void *x1, void *x2, voi
}
}

static inline void *mmc_mk_box7(unsigned ctor, void *x0, void *x1, void *x2, void *x3, void *x4, void *x5, void *x6)
static void *mmc_mk_box7(unsigned ctor, void *x0, void *x1, void *x2, void *x3, void *x4, void *x5, void *x6)
{
mmc_GC_add_roots(&x0, 1, 0, "");
mmc_GC_add_roots(&x1, 1, 0, "");
Expand Down Expand Up @@ -470,7 +470,7 @@ static inline void *mmc_mk_box7(unsigned ctor, void *x0, void *x1, void *x2, voi
}
}

static inline void *mmc_mk_box8(unsigned ctor, void *x0, void *x1, void *x2, void *x3, void *x4, void *x5, void *x6, void *x7)
static void *mmc_mk_box8(unsigned ctor, void *x0, void *x1, void *x2, void *x3, void *x4, void *x5, void *x6, void *x7)
{
mmc_GC_add_roots(&x0, 1, 0, "");
mmc_GC_add_roots(&x1, 1, 0, "");
Expand Down Expand Up @@ -500,7 +500,7 @@ static inline void *mmc_mk_box8(unsigned ctor, void *x0, void *x1, void *x2, voi
}
}

static inline void *mmc_mk_box9(unsigned ctor, void *x0, void *x1, void *x2, void *x3, void *x4, void *x5, void *x6, void *x7, void *x8)
static void *mmc_mk_box9(unsigned ctor, void *x0, void *x1, void *x2, void *x3, void *x4, void *x5, void *x6, void *x7, void *x8)
{
mmc_GC_add_roots(&x0, 1, 0, "");
mmc_GC_add_roots(&x1, 1, 0, "");
Expand Down Expand Up @@ -532,7 +532,7 @@ static inline void *mmc_mk_box9(unsigned ctor, void *x0, void *x1, void *x2, voi
}
}

static inline void *mmc_mk_box(int slots, unsigned ctor, ...)
static void *mmc_mk_box(int slots, unsigned ctor, ...)
{
int i;
va_list argp;
Expand Down Expand Up @@ -569,12 +569,12 @@ static const MMC_DEFSTRUCT0LIT(mmc_none,1);

#define MMC_CONS_CTOR 1

static inline void *mmc_mk_cons(void *car, void *cdr)
static void *mmc_mk_cons(void *car, void *cdr)
{
return mmc_mk_box2(MMC_CONS_CTOR, car, cdr);
}

static inline void *mmc_mk_some(void *x)
static void *mmc_mk_some(void *x)
{
return mmc_mk_box1(1, x);
}
Expand Down
9 changes: 9 additions & 0 deletions SimulationRuntime/c/simulation/simulation_runtime.cpp
Expand Up @@ -1002,3 +1002,12 @@ void (*omc_assert)(FILE_INFO info, const char *msg, ...) = omc_assert_simulation
void (*omc_assert_warning)(FILE_INFO info, const char *msg, ...) = omc_assert_warning_simulation;
void (*omc_terminate)(FILE_INFO info, const char *msg, ...) = omc_terminate_simulation;
void (*omc_throw)() = omc_throw_simulation;

/* simulation JumpBuffer */
jmp_buf simulationJmpbuf;

/* integrator JumpBuffer */
jmp_buf integratorJmpbuf;

/* indicates the current possible jump place */
int currectJumpState;
48 changes: 28 additions & 20 deletions SimulationRuntime/c/simulation/simulation_runtime.h
@@ -1,31 +1,30 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-CurrentYear, Linköping University,
* Department of Computer and Information Science,
* Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC),
* c/o Linköpings universitet, Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3
* AND THIS OSMC PUBLIC LICENSE (OSMC-PL).
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S
* ACCEPTANCE OF THE OSMC PUBLIC LICENSE.
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE BSD NEW LICENSE OR THE
* GPL VERSION 3 LICENSE OR THE OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2.
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
* RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3,
* ACCORDING TO RECIPIENTS CHOICE.
*
* The OpenModelica software and the OSMC (Open Source Modelica Consortium)
* Public License (OSMC-PL) are obtained from OSMC, either from the above
* address, from the URLs: http://www.openmodelica.org or
* http://www.ida.liu.se/projects/OpenModelica, and in the OpenModelica
* distribution. GNU version 3 is obtained from:
* http://www.gnu.org/copyleft/gpl.html. The New BSD License is obtained from:
* http://www.opensource.org/licenses/BSD-3-Clause.
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Linköping University, either from the above address,
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or
* http://www.openmodelica.org, and in the OpenModelica distribution.
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
*
* This program is distributed WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS
* OF OSMC-PL.
*
* See the full OSMC Public License conditions for more details.
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS
* EXPRESSLY SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE
* CONDITIONS OF OSMC-PL.
*
*/

Expand Down Expand Up @@ -104,6 +103,15 @@ extern void printSimulationStepSize(double in_stepSize, double time);
extern int _main_SimulationRuntime(int argc, char**argv, DATA *data);
extern void communicateStatus(const char *phase, double completionPercent);

/* simulation JumpBuffer */
extern jmp_buf simulationJmpbuf;

/* integrator JumpBuffer */
extern jmp_buf integratorJmpbuf;

/* indicates the current possible jump place */
extern int currectJumpState;

#ifdef __cplusplus
}
#endif
Expand Down
4 changes: 4 additions & 0 deletions SimulationRuntime/c/simulation/solver/nonlinearSystem.c
Expand Up @@ -43,6 +43,10 @@
#include "simulation_info_xml.h"
#include "blaswrap.h"
#include "f2c.h"
#include "simulation_runtime.h"

/* nonlinear JumpBuffer */
jmp_buf nonlinearJmpbuf;

extern doublereal enorm_(integer *n, doublereal *x);

Expand Down
3 changes: 3 additions & 0 deletions SimulationRuntime/c/simulation/solver/nonlinearSystem.h
Expand Up @@ -73,4 +73,7 @@ int solve_nonlinear_system(DATA *data, int sysNumber);
int check_nonlinear_solutions(DATA *data, int printFailingSystems);
double extraPolate(DATA *data, double old1, double old2);

/* nonlinear JumpBuffer */
extern jmp_buf nonlinearJmpbuf;

#endif

0 comments on commit 68c41e1

Please sign in to comment.