Commit 69e5942b authored by EXT Iulian Ober's avatar EXT Iulian Ober
Browse files

Fully switch to 64bit types to avoid padding in simulator structures and thus ensure unique hashing

parent 35d4b3ca
......@@ -41,7 +41,7 @@
CC = g++
CFLAGS = -Wno-tautological-compare
CFLAGS = -Wno-tautological-compare -O3
LDFLAGS =
......
......@@ -49,9 +49,9 @@ IF = ../..
CC = g++
CFLAGS = -c\ -Wall\ -O3 #-g
CFLAGS = -c\ -Wall\ -O3 #\ -g
LDFLAGS =
LDFLAGS = #-g
AR = ar
......
......@@ -381,7 +381,7 @@ inline type_name(boolean) if_$1_in
define(`string_type_decl', `
struct type_name($1) {
int length;
long int length;
type_name($2) elem[$3];
type_name($2)& operator[](const int i)
......
......@@ -88,4 +88,4 @@ $(LIB) : $(OBJ)
$(AR) cql $@ $(OBJ)
$(OBJDIR)/%.o: %.C
$(CC) $(CFLAGS) -o $(OBJDIR)/$*.o $*.C
$(CC) $(CFLAGS) -Wpadded -o $(OBJDIR)/$*.o $*.C
......@@ -44,14 +44,14 @@
*
*/
typedef int if_boolean_type;
typedef long if_boolean_type;
typedef int if_integer_type;
typedef long if_integer_type;
typedef float if_real_type;
typedef double if_real_type;
typedef unsigned if_pid_type;
typedef long unsigned if_pid_type;
typedef int if_clock_type;
typedef long if_clock_type;
typedef unsigned if_void_type;
typedef long unsigned if_void_type;
......@@ -86,7 +86,7 @@
#define if_integer_compare(x,y) (x)-(y)
#define if_integer_print(x,f) fprintf(f,"%d",x)
#define if_integer_print(x,f) fprintf(f,"%lu",x)
#define if_integer_print_xml(x,b) b << "<integer value='" << x << "' />"
......@@ -195,13 +195,13 @@
#define if_pid_compare(x,y) (x)-(y)
#define if_pid_print(x,f) \
fprintf(f,"{%s}%d", IfInstance::PROCNAME[if_pid_proc(x)],if_pid_idet(x))
fprintf(f,"{%s}%lu", IfInstance::PROCNAME[if_pid_proc(x)],if_pid_idet(x))
#define if_pid_print_xml(x,b) \
b << "<pid name='" << IfInstance::PROCNAME[if_pid_proc(x)] << "' no='" << if_pid_idet(x) << "' />"
#define if_pid_sprint(x,s) \
sprintf(s,"{%s}%d", IfInstance::PROCNAME[if_pid_proc(x)],if_pid_idet(x))
sprintf(s,"{%s}%lu", IfInstance::PROCNAME[if_pid_proc(x)],if_pid_idet(x))
#define if_pid_reset(x) x=0
......@@ -227,11 +227,11 @@
#define if_clock_compare(x,y) (x)-(y)
#define if_clock_print(x,f) fprintf(f,"%d",x)
#define if_clock_print(x,f) fprintf(f,"%lu",x)
#define if_clock_print_xml(x,b) b << "<clock id='" << x << "' />"
#define if_clock_sprint(x,f) sprintf(f,"%d",x)
#define if_clock_sprint(x,f) sprintf(f,"%lu",x)
#define if_clock_reset(x) \
if (IfInstance::STATUS & IfInstance::CREATE) \
......
......@@ -103,9 +103,9 @@ class IfBuffer : public IfInstance {
protected:
if_pid_type m_from; // from process class
if_pid_type m_to; // to process class
unsigned m_flags; // buffer flags
int m_lower; // transit time lower bound
int m_upper; // transit time upper bound
long unsigned m_flags; // buffer flags
long int m_lower; // transit time lower bound
long int m_upper; // transit time upper bound
double m_lossProba;
......
......@@ -84,7 +84,7 @@ class IfConfig : public IfObject {
protected:
IfString<Chunk> m_chunks;
unsigned m_mark;
long unsigned m_mark;
};
......@@ -119,7 +119,7 @@ void if_print_vector(if_type_vector vector, unsigned dimension, FILE* file){
#define if_vector_table_size 8191
typedef struct if_struct_vector_node {
unsigned dimension;
long unsigned dimension;
if_type_vector_list list;
struct if_struct_vector_node * next;
} * if_type_vector_node;
......@@ -128,9 +128,9 @@ static struct {
struct {
struct {
if_type_vector_node node;
unsigned count;
long unsigned count;
} entry[if_vector_table_size];
unsigned count;
long unsigned count;
} table;
} if_vector;
......@@ -171,7 +171,7 @@ void if_info_vector_table(FILE* file){
if (max < if_vector.table.entry[i].count)
max = if_vector.table.entry[i].count;
}
fprintf(file, "%d vectors stored (%d/max, %d/min, %d/avg)\n",
fprintf(file, "%ld vectors stored (%d/max, %d/min, %ld/avg)\n",
if_vector.table.count, max, min,
if_vector.table.count / if_vector_table_size);
}
......@@ -260,7 +260,7 @@ void if_print_matrix(if_type_matrix matrix, unsigned dimension, FILE* file){
#define if_matrix_max_dimension 64
typedef struct if_struct_matrix_node {
unsigned dimension;
long unsigned dimension;
if_type_matrix_list list;
struct if_struct_matrix_node * next;
} * if_type_matrix_node;
......@@ -269,9 +269,9 @@ static struct {
struct {
struct {
if_type_matrix_node node;
unsigned count;
long unsigned count;
} entry[if_matrix_table_size];
unsigned count;
long unsigned count;
} table;
struct {
if_type_matrix lines;
......@@ -330,7 +330,7 @@ void if_info_matrix_table(FILE* file){
if (max < if_matrix.table.entry[i].count)
max = if_matrix.table.entry[i].count;
}
fprintf(file, "%d matrixes stored (%d/max, %d/min, %d/avg)\n",
fprintf(file, "%ld matrixes stored (%d/max, %d/min, %ld/avg)\n",
if_matrix.table.count, max, min,
if_matrix.table.count / if_matrix_table_size);
}
......
......@@ -114,9 +114,9 @@ enum {
template <unsigned L, typename T>
struct if_state {
const char* name; // state name
unsigned parent; // parent state
unsigned entry; // entry state
unsigned flags; // stable, queue, none, success, error
long unsigned parent; // parent state
long unsigned entry; // entry state
long unsigned flags; // stable, queue, none, success, error
char sigtab[L]; // saved, input
T dispatch; // message dispatcher
};
......@@ -110,8 +110,8 @@ class IfLabelHandler : public IfHandler {
protected:
IfLabel m_label; // traced label
unsigned m_length; // traced label length
unsigned m_tab[LABELMAXSIZE]; // event level table
long unsigned m_length; // traced label length
long unsigned m_tab[LABELMAXSIZE]; // event level table
};
......@@ -375,10 +375,10 @@ class IfIterator : public IfEngine {
IfConfigHandler m_config; // running configuration handler
IfLabelHandler m_label; // running trace handler
int m_priority;
int m_complete;
long int m_priority;
long int m_complete;
unsigned m_nCutFlags;
long unsigned m_nCutFlags;
};
......
......@@ -157,7 +157,7 @@ class IfEvent : public IfObject {
static const char* NAME[];
protected:
unsigned m_data;
long unsigned m_data;
if_pid_type m_pid;
char* m_value;
......
......@@ -97,6 +97,6 @@ class IfObserverInstance : public IfInstance {
if_boolean_type if_obs_probability();
if_real_type if_obs_probability_ext();
unsigned m_bCut;
long unsigned m_bCut;
};
......@@ -80,7 +80,7 @@ class IfMessage : public IfObject {
static const char* SIGNAME[SIGMAXNUM];
protected:
unsigned m_sid;
long unsigned m_sid;
if_pid_type m_destination; // buffer use
if_clock_type m_wait; // buffer use
......
......@@ -134,7 +134,7 @@ class IfVector {
void copy(const IfVector<T>*);
protected:
int m_length;
long int m_length;
T* m_data;
};
......@@ -209,10 +209,10 @@ class IfHeap {
void put(const C*);
protected:
int m_length;
long m_length;
C* *m_objects;
int m_count;
long int m_count;
};
......
......@@ -251,7 +251,7 @@ void IfDiscreteTime::print(FILE* file) const {
IfInstance::print(file);
fprintf(file, "\n @run\t\t");
for(int i = 0; i < dimension(); i++)
fprintf(file, "%d/%d ", m_values.getAt(i), m_clocks.getAt(i));
fprintf(file, "%lu/%lu ", m_values.getAt(i), m_clocks.getAt(i));
}
void IfDiscreteTime::printXML(std::ostream& buf) const {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment