Skip to content

Commit

Permalink
- Keep arrayLength static inline. Gives performance.
Browse files Browse the repository at this point in the history
- New function for debugger mmc_gdb_arrayLength.
- Use the new function in OMEdit.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@22244 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Sep 10, 2014
1 parent 364e40a commit 3b96e94
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
5 changes: 5 additions & 0 deletions SimulationRuntime/c/meta/meta_modelica.c
Expand Up @@ -795,6 +795,11 @@ void changeStdStreamBuffer(void) {
setbuf(stderr, NULL);
}

modelica_integer mmc_gdb_arrayLength(modelica_metatype arr)
{
return MMC_HDRSLOTS(MMC_GETHDR(arr));
}

/*
* Used by OMEdit for debugging.
* Returns the metatype element as an array e.g ^done,omc_element={name, displayName, type}
Expand Down
1 change: 1 addition & 0 deletions SimulationRuntime/c/meta/meta_modelica.h
Expand Up @@ -419,6 +419,7 @@ extern char* getTypeOfAny(void*any); /* For debugging */
extern char* getRecordElementName(void*any, int element); /* For debugging */
extern int isOptionNone(void*any); /* For debugging */
extern void changeStdStreamBuffer(void); /* For debugging */
extern modelica_integer mmc_gdb_arrayLength(modelica_metatype arr); /* For debugging */

/* Debugging functions used by OMEdit */
typedef enum metaType
Expand Down
5 changes: 0 additions & 5 deletions SimulationRuntime/c/meta/meta_modelica_builtin.c
Expand Up @@ -576,11 +576,6 @@ modelica_metatype arrayCreate(modelica_integer nelts, modelica_metatype val)
}
}

modelica_integer arrayLength(modelica_metatype arr)
{
return MMC_HDRSLOTS(MMC_GETHDR(arr));
}

modelica_metatype arrayList(modelica_metatype arr)
{
modelica_metatype result;
Expand Down
7 changes: 5 additions & 2 deletions SimulationRuntime/c/meta/meta_modelica_builtin.h
Expand Up @@ -108,8 +108,11 @@ extern modelica_metatype boxptr_listDelete(threadData_t*,modelica_metatype,model
#define optionNone(x) (0==MMC_HDRSLOTS(MMC_GETHDR(x)) ? 1 : 0)

/* Array Operations */
/* Do not define this function static inline. It is needed by the debugger. */
extern modelica_integer arrayLength(modelica_metatype arr);
static inline modelica_integer arrayLength(modelica_metatype arr)
{
return MMC_HDRSLOTS(MMC_GETHDR(arr));
}

extern modelica_metatype arrayList(modelica_metatype);
extern modelica_metatype listArray(modelica_metatype);
extern modelica_metatype arrayCopy(modelica_metatype);
Expand Down

0 comments on commit 3b96e94

Please sign in to comment.