Skip to content

Commit

Permalink
Merge pull request #502 from MasterDuke17/fix_order_of_args_in_MVM_ca…
Browse files Browse the repository at this point in the history
…llocs

Fix order of args in mvm callocs
  • Loading branch information
niner committed Jan 15, 2017
2 parents 1fd5d64 + 9751a18 commit f95c8f9
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/6model/serialization.c
Expand Up @@ -3052,10 +3052,10 @@ void MVM_serialization_deserialize(MVMThreadContext *tc, MVMSerializationContext
MVM_free(sc->body->root_objects);
if (sc->body->root_stables)
MVM_free(sc->body->root_stables);
sc->body->root_objects = MVM_calloc(1, reader->root.num_objects * sizeof(MVMObject *));
sc->body->root_objects = MVM_calloc(reader->root.num_objects, sizeof(MVMObject *));
sc->body->num_objects = reader->root.num_objects;
sc->body->alloc_objects = reader->root.num_objects;
sc->body->root_stables = MVM_calloc(1, reader->root.num_stables * sizeof(MVMSTable *));
sc->body->root_stables = MVM_calloc(reader->root.num_stables, sizeof(MVMSTable *));
sc->body->num_stables = reader->root.num_stables;
sc->body->alloc_stables = reader->root.num_stables;
reader->contexts = MVM_calloc(reader->root.num_contexts, sizeof(MVMFrame *));
Expand Down
2 changes: 1 addition & 1 deletion src/core/args.c
Expand Up @@ -43,7 +43,7 @@ void MVM_args_proc_cleanup(MVMThreadContext *tc, MVMArgProcContext *ctx) {
}

MVMCallsite * MVM_args_copy_callsite(MVMThreadContext *tc, MVMArgProcContext *ctx) {
MVMCallsite *res = MVM_calloc(sizeof(MVMCallsite), 1);
MVMCallsite *res = MVM_calloc(1, sizeof(MVMCallsite));
MVMCallsiteEntry *flags = NULL;
MVMCallsiteEntry *src_flags;
MVMint32 fsize;
Expand Down
8 changes: 4 additions & 4 deletions src/core/bytecodedump.c
Expand Up @@ -65,7 +65,7 @@ char * MVM_bytecode_dump(MVMThreadContext *tc, MVMCompUnit *cu) {
MVMuint32 s = 1024;
MVMuint32 l = 0;
MVMuint32 i, j, k;
char *o = MVM_calloc(sizeof(char) * s, 1);
char *o = MVM_calloc(s, sizeof(char));
char ***frame_lexicals = MVM_malloc(sizeof(char **) * cu->body.num_frames);
MVMString *name = MVM_string_utf8_decode(tc, tc->instance->VMString, "", 0);

Expand Down Expand Up @@ -176,8 +176,8 @@ char * MVM_bytecode_dump(MVMThreadContext *tc, MVMCompUnit *cu) {
/* current position in the bytestream */
MVMuint8 *cur_op = bytecode_start;
/* positions in the bytestream that are starts of ops and goto targets */
MVMuint8 *labels = MVM_calloc(bytecode_size, 1);
MVMuint32 *jumps = MVM_calloc(sizeof(MVMuint32) * bytecode_size, 1);
MVMuint8 *labels = MVM_calloc(1, bytecode_size);
MVMuint32 *jumps = MVM_calloc(1, sizeof(MVMuint32) * bytecode_size);
char **lines = MVM_malloc(sizeof(char *) * bytecode_size);
MVMuint32 *linelocs = MVM_malloc(sizeof(MVMuint32) * bytecode_size);
MVMuint32 lineno = 0;
Expand All @@ -199,7 +199,7 @@ char * MVM_bytecode_dump(MVMThreadContext *tc, MVMCompUnit *cu) {
/* allocate a line buffer */
s = 200;
l = 0;
o = MVM_calloc(sizeof(char) * s, 1);
o = MVM_calloc(s, sizeof(char));

lineloc = cur_op - bytecode_start;
/* mark that this line starts at this point in the bytestream */
Expand Down
2 changes: 1 addition & 1 deletion src/core/frame.c
Expand Up @@ -7,7 +7,7 @@
MVMRegister * MVM_frame_initial_work(MVMThreadContext *tc, MVMuint16 *local_types,
MVMuint16 num_locals) {
MVMuint16 i;
MVMRegister *work_initial = MVM_calloc(sizeof(MVMRegister), num_locals);
MVMRegister *work_initial = MVM_calloc(num_locals, sizeof(MVMRegister));
for (i = 0; i < num_locals; i++)
if (local_types[i] == MVM_reg_obj)
work_initial[i].o = tc->instance->VMNull;
Expand Down
2 changes: 1 addition & 1 deletion src/core/hll.c
Expand Up @@ -13,7 +13,7 @@ MVMHLLConfig *MVM_hll_get_config_for(MVMThreadContext *tc, MVMString *name) {
}

if (!entry) {
entry = MVM_calloc(sizeof(MVMHLLConfig), 1);
entry = MVM_calloc(1, sizeof(MVMHLLConfig));
entry->name = name;
entry->int_box_type = tc->instance->boot_types.BOOTInt;
entry->num_box_type = tc->instance->boot_types.BOOTNum;
Expand Down
2 changes: 1 addition & 1 deletion src/core/regionalloc.c
Expand Up @@ -19,7 +19,7 @@ void * MVM_region_alloc(MVMThreadContext *tc, MVMRegionAlloc *al, size_t bytes)
: MVM_REGIONALLOC_MEMBLOCK_SIZE;
if (buffer_size < bytes)
buffer_size = bytes;
block->buffer = MVM_calloc(buffer_size, 1);
block->buffer = MVM_calloc(1, buffer_size);
block->alloc = block->buffer;
block->limit = block->buffer + buffer_size;
block->prev = al->block;
Expand Down
2 changes: 1 addition & 1 deletion src/core/validation.c
Expand Up @@ -654,7 +654,7 @@ void MVM_validate_static_frame(MVMThreadContext *tc,
val->bc_size = fb->bytecode_size;
val->src_cur_op = fb->bytecode;
val->src_bc_end = fb->bytecode + fb->bytecode_size;
val->labels = MVM_calloc(fb->bytecode_size, 1);
val->labels = MVM_calloc(1, fb->bytecode_size);
val->cur_info = NULL;
val->cur_mark = NULL;
val->cur_instr = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/gc/collect.c
Expand Up @@ -462,7 +462,7 @@ static void pass_work_item(MVMThreadContext *tc, WorkToPass *wtp, MVMCollectable

/* See if there's a currently active list; create it if not. */
if (!target_info->work) {
target_info->work = MVM_calloc(sizeof(MVMGCPassedWork), 1);
target_info->work = MVM_calloc(1, sizeof(MVMGCPassedWork));
}

/* Add this item to the work list. */
Expand Down
2 changes: 1 addition & 1 deletion src/gc/gen2.c
Expand Up @@ -6,7 +6,7 @@ MVMGen2Allocator * MVM_gc_gen2_create(MVMInstance *i) {
MVMGen2Allocator *al = MVM_malloc(sizeof(MVMGen2Allocator));

/* Create empty size classes array data structure. */
al->size_classes = (MVMGen2SizeClass *)MVM_calloc(1, sizeof(MVMGen2SizeClass) * MVM_GEN2_BINS);
al->size_classes = (MVMGen2SizeClass *)MVM_calloc(MVM_GEN2_BINS, sizeof(MVMGen2SizeClass));

/* Set up overflows area. */
al->alloc_overflows = MVM_GEN2_OVERFLOWS;
Expand Down
2 changes: 1 addition & 1 deletion src/spesh/graph.c
Expand Up @@ -800,7 +800,7 @@ typedef struct {
/* Creates an SSAVarInfo for each local, initializing it with a list of nodes
* that assign to the local. */
static SSAVarInfo * initialize_ssa_var_info(MVMThreadContext *tc, MVMSpeshGraph *g) {
SSAVarInfo *var_info = MVM_calloc(sizeof(SSAVarInfo), g->num_locals);
SSAVarInfo *var_info = MVM_calloc(g->num_locals, sizeof(SSAVarInfo));
MVMint32 i;

/* Visit all instructions, looking for local writes. */
Expand Down
2 changes: 1 addition & 1 deletion src/strings/unicode_ops.c
Expand Up @@ -274,7 +274,7 @@ MVMint32 MVM_unicode_name_to_property_code(MVMThreadContext *tc, MVMString *name
}

static void generate_unicode_property_values_hashes(MVMThreadContext *tc) {
MVMUnicodeNameRegistry **hash_array = MVM_calloc(sizeof(MVMUnicodeNameRegistry *), MVM_NUM_PROPERTY_CODES);
MVMUnicodeNameRegistry **hash_array = MVM_calloc(MVM_NUM_PROPERTY_CODES, sizeof(MVMUnicodeNameRegistry *));
MVMuint32 index = 0;
MVMUnicodeNameRegistry *entry = NULL, *binaries = NULL;
for ( ; index < num_unicode_property_value_keypairs; index++) {
Expand Down

0 comments on commit f95c8f9

Please sign in to comment.