Skip to content

Commit

Permalink
src: Remove trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiaomao committed Oct 29, 2024
1 parent 6ff1cb5 commit 2ad9cf6
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 38 deletions.
6 changes: 3 additions & 3 deletions src/allocator.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ static void flush_free_list( gc_pheader *ph ) {
int k;
for(k=0;k<p->free.count;k++) {
gc_fl *fl = GET_FL(&p->free,k);
printf("(%d-%d)",fl->pos,fl->pos+fl->count-1);
printf("(%d-%d)",fl->pos,fl->pos+fl->count-1);
}
printf("\n");
}
Expand All @@ -255,7 +255,7 @@ static void flush_free_list( gc_pheader *ph ) {
is_free = true;
}
}
bool is_marked = ((ph->bmp[bid>>3] & (1<<(bid&7))) != 0);
bool is_marked = ((ph->bmp[bid>>3] & (1<<(bid&7))) != 0);
if( is_marked && is_free ) {
// check if it was already free before
for(k=0;k<old_fl.count;k++) {
Expand Down Expand Up @@ -601,7 +601,7 @@ static void gc_get_stats( int *page_count, int *private_data ) {
}
*page_count = count;
*private_data = 0; // no malloc
}
}

static void gc_iter_pages( gc_page_iterator iter ) {
int i;
Expand Down
16 changes: 8 additions & 8 deletions src/code.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static void hl_read_type( hl_reader *r, hl_type *t ) {
case HMETHOD:
{
int i;
int nargs = READ();
int nargs = READ();
t->fun = (hl_type_fun*)hl_zalloc(&r->code->alloc,sizeof(hl_type_fun));
t->fun->nargs = nargs;
t->fun->args = (hl_type**)hl_malloc(&r->code->alloc,sizeof(hl_type*)*nargs);
Expand Down Expand Up @@ -386,7 +386,7 @@ static int *hl_read_debug_infos( hl_reader *r, int nops ) {
int curfile = -1, curline = 0;
hl_code *code = r->code;
int *debug = (int*)hl_malloc(&code->alloc, sizeof(int) * nops * 2);
int i = 0;
int i = 0;
while( i < nops ) {
int c = READ();
if( c & 1 ) {
Expand Down Expand Up @@ -423,7 +423,7 @@ static int *hl_read_debug_infos( hl_reader *r, int nops ) {
}

hl_code *hl_code_read( const unsigned char *data, int size, char **error_msg ) {
hl_reader _r = { data, size, 0, 0, NULL };
hl_reader _r = { data, size, 0, 0, NULL };
hl_reader *r = &_r;
hl_code *c;
hl_alloc alloc;
Expand All @@ -446,14 +446,14 @@ hl_code *hl_code_read( const unsigned char *data, int size, char **error_msg ) {
c->nints = UINDEX();
c->nfloats = UINDEX();
c->nstrings = UINDEX();
if( c->version >= 5 )
if( c->version >= 5 )
c->nbytes = UINDEX();
c->ntypes = UINDEX();
c->nglobals = UINDEX();
c->nnatives = UINDEX();
c->nfunctions = UINDEX();
c->nconstants = c->version >= 4 ? UINDEX() : 0;
c->entrypoint = UINDEX();
c->entrypoint = UINDEX();
c->hasdebug = flags & 1;
CHK_ERROR();
ALLOC(c->ints, int, c->nints);
Expand Down Expand Up @@ -606,7 +606,7 @@ static const unsigned int crc32_table[] =

#define H(b) hash = (hash >> 8) ^ crc32_table[(hash ^ (b)) & 0xFF]
#define H32(i) { H(i&0xFF); H((i>>8)&0xFF); H((i>>16)&0xFF); H(((unsigned int)i)>>24); }
#define HFUN(idx) H32(h->functions_signs[h->functions_indexes[idx]]);
#define HFUN(idx) H32(h->functions_signs[h->functions_indexes[idx]]);
#define HSTR(s) { const char *_c = s; while( *_c ) H(*_c++); }
#define HUSTR(s) { const uchar *_c = s; while( *_c ) H(*_c++); }
#define HTYPE(t) if( !isrec ) H32(hash_type_first(t,true))
Expand Down Expand Up @@ -924,11 +924,11 @@ hl_code_hash *hl_code_hash_alloc( hl_code *c ) {
case HOBJ:
case HSTRUCT:
if( t->obj->global_value )
h->globals_signs[(int)(int_val)t->obj->global_value - 1] = hl_code_hash_type(h,t);
h->globals_signs[(int)(int_val)t->obj->global_value - 1] = hl_code_hash_type(h,t);
break;
case HENUM:
if( t->tenum->global_value )
h->globals_signs[(int)(int_val)t->tenum->global_value - 1] = hl_code_hash_type(h,t);
h->globals_signs[(int)(int_val)t->tenum->global_value - 1] = hl_code_hash_type(h,t);
break;
default:
break;
Expand Down
26 changes: 13 additions & 13 deletions src/jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ struct jit_ctx {
# ifdef HL_DEBUG
# define error_i64() jit_error("i64-32")
# else
void error_i64() {
void error_i64() {
printf("The module you are loading is using 64 bit ints that are not supported by the HL32.\nPlease run using HL64 or compile with -D hl-legacy32");
jit_exit();
}
Expand Down Expand Up @@ -607,12 +607,12 @@ static void op( jit_ctx *ctx, CpuOp o, preg *a, preg *b, bool mode64 ) {
int_val cval = b->holds ? (int_val)b->holds : b->id;
// short byte form
if( f->r_i8 && IS_SBYTE(cval) ) {
if( (f->r_i8&FLAG_DUAL) && a->id > 7 ) r64 |= 4;
if( (f->r_i8&FLAG_DUAL) && a->id > 7 ) r64 |= 4;
OP(f->r_i8);
if( (f->r_i8&FLAG_DUAL) ) MOD_RM(3,a->id,a->id); else MOD_RM(3,GET_RM(f->r_i8)-1,a->id);
B((int)cval);
} else if( GET_RM(f->r_const) > 0 || (f->r_const&FLAG_DUAL) ) {
if( (f->r_i8&FLAG_DUAL) && a->id > 7 ) r64 |= 4;
if( (f->r_i8&FLAG_DUAL) && a->id > 7 ) r64 |= 4;
OP(f->r_const&0xFF);
if( (f->r_i8&FLAG_DUAL) ) MOD_RM(3,a->id,a->id); else MOD_RM(3,GET_RM(f->r_const)-1,a->id);
if( mode64 && IS_64 && o == MOV ) W64(cval); else W((int)cval);
Expand Down Expand Up @@ -1073,7 +1073,7 @@ static preg *fetch32( jit_ctx *ctx, vreg *r ) {
return fetch(r);
}

// make sure higher bits are zeroes
// make sure higher bits are zeroes
static preg *alloc_cpu64( jit_ctx *ctx, vreg *r, bool andLoad ) {
# ifndef HL_64
return alloc_cpu(ctx,r,andLoad);
Expand Down Expand Up @@ -2417,7 +2417,7 @@ static void jit_c2hl( jit_ctx *ctx ) {
op64(ctx,MOV,PEBP,PESP);

# ifdef HL_64

fptr = REG_AT(R10);
stack = PEAX;
stend = REG_AT(R11);
Expand Down Expand Up @@ -2554,7 +2554,7 @@ static void jit_hl2c( jit_ctx *ctx ) {
// case HF32: case HF64: return jit_wrapper_d(arg0,&args);
// default: return jit_wrapper_ptr(arg0,&args);
// }
if( !IS_64 )
if( !IS_64 )
op64(ctx,MOV,cl,pmem(&p,Ebp,HL_WSIZE*2)); // load arg0
op64(ctx,MOV,tmp,pmem(&p,cl->id,0)); // ->t
op64(ctx,MOV,tmp,pmem(&p,tmp->id,HL_WSIZE)); // ->fun
Expand All @@ -2566,7 +2566,7 @@ static void jit_hl2c( jit_ctx *ctx ) {
op32(ctx,CMP,tmp,pconst(&p,HF32));
XJump_small(JEq,jfloat2);

// 64 bits : ESP + EIP (+WIN64PAD)
// 64 bits : ESP + EIP (+WIN64PAD)
// 32 bits : ESP + EIP + PARAM0
int args_pos = IS_64 ? ((IS_WINCALL64 ? 32 : 0) + HL_WSIZE * 2) : (HL_WSIZE*3);

Expand Down Expand Up @@ -2897,7 +2897,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) {
vreg *r = R(i);
int creg = select_call_reg(&cregs,r->t,i);
if( creg < 0 || IS_WINCALL64 ) {
// use existing stack storage
// use existing stack storage
r->stackPos = argsSize + HL_WSIZE * 2;
argsSize += stack_size(r->t);
} else {
Expand Down Expand Up @@ -3050,7 +3050,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) {
preg *pb = alloc_cpu(ctx,ra,true);
op64(ctx,XOR,pa,pa);
op64(ctx,SUB,pa,pb);
store(ctx,dst,pa,true);
store(ctx,dst,pa,true);
# else
error_i64();
# endif
Expand Down Expand Up @@ -3313,7 +3313,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) {
ctx->calls = j;

set_native_arg(ctx,pconst64(&p,RESERVE_ADDRESS));
set_native_arg(ctx,pconst64(&p,(int_val)m->code->functions[m->functions_indexes[o->p2]].type));
set_native_arg(ctx,pconst64(&p,(int_val)m->code->functions[m->functions_indexes[o->p2]].type));
call_native(ctx,hl_alloc_closure_ptr,size);
store(ctx,dst,PEAX,true);
}
Expand Down Expand Up @@ -3403,7 +3403,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) {
{
int regids[64];
preg *pc = REG_AT(CALL_REGS[0]);
vreg *sc = R(f->nregs); // scratch register that we temporary rebind
vreg *sc = R(f->nregs); // scratch register that we temporary rebind
if( o->p3 >= 63 ) jit_error("assert");
memcpy(regids + 1, o->extra, o->p3 * sizeof(int));
regids[0] = f->nregs;
Expand Down Expand Up @@ -3442,7 +3442,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) {
error_i64();
break;
}
# endif
# endif
switch( ra->t->kind ) {
case HOBJ:
case HSTRUCT:
Expand Down Expand Up @@ -3707,7 +3707,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) {
// keep o->value in R(f->nregs)
int regids[64];
preg *pc = alloc_reg(ctx,RCPU_CALL);
vreg *sc = R(f->nregs); // scratch register that we temporary rebind
vreg *sc = R(f->nregs); // scratch register that we temporary rebind
if( o->p3 >= 63 ) jit_error("assert");
memcpy(regids, o->extra, o->p3 * sizeof(int));
regids[0] = f->nregs;
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ int main(int argc, pchar *argv[]) {
}
hl_module_free(ctx.m);
hl_free(&ctx.code->alloc);
// do not call hl_unregister_thread() or hl_global_free will display error
// do not call hl_unregister_thread() or hl_global_free will display error
// on global_lock if there are threads that are still running (such as debugger)
hl_global_free();
return 0;
Expand Down
4 changes: 2 additions & 2 deletions src/std/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ HL_PRIM varray *hl_alloc_array( hl_type *at, int size ) {
}

HL_PRIM void hl_array_blit( varray *dst, int dpos, varray *src, int spos, int len ) {
int size = hl_type_size(dst->at);
memmove( hl_aptr(dst,vbyte) + dpos * size, hl_aptr(src,vbyte) + spos * size, len * size);
int size = hl_type_size(dst->at);
memmove( hl_aptr(dst,vbyte) + dpos * size, hl_aptr(src,vbyte) + spos * size, len * size);
}

HL_PRIM hl_type *hl_array_type( varray *a ) {
Expand Down
2 changes: 1 addition & 1 deletion src/std/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ HL_PRIM void hl_null_access() {
}

HL_PRIM void hl_throw_buffer( hl_buffer *b ) {
vdynamic *d = hl_alloc_dynamic(&hlt_bytes);
vdynamic *d = hl_alloc_dynamic(&hlt_bytes);
d->v.ptr = hl_buffer_content(b,NULL);
hl_throw(d);
}
Expand Down
2 changes: 1 addition & 1 deletion src/std/maps.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ typedef struct {
} t_map;

#ifndef _MNO_EXPORTS
HL_PRIM
HL_PRIM
#endif
t_map *_MNAME(alloc)() {
t_map *m = (t_map*)hl_gc_alloc_raw(sizeof(t_map));
Expand Down
2 changes: 1 addition & 1 deletion src/std/obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ static void hl_dynobj_delete_field( vdynobj *o, hl_field_lookup *f ) {
int i;
unsigned int order = hl_dynobj_order(f);
int index = f->field_index & HL_DYNOBJ_INDEX_MASK;
bool is_ptr = hl_is_ptr(f->t);
bool is_ptr = hl_is_ptr(f->t);
// erase data
if( is_ptr ) {
memmove(o->values + index, o->values + index + 1, (o->nvalues - (index + 1)) * sizeof(void*));
Expand Down
2 changes: 1 addition & 1 deletion src/std/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ HL_PRIM void hl_sys_print( vbyte *msg ) {
hl_blocking(true);
# if defined(HL_XBO) || defined(HL_XBS)
OutputDebugStringW((LPCWSTR)msg);
# else
# else
# ifdef HL_WIN_DESKTOP
if( print_flags & PR_WIN_UTF8 ) _setmode(_fileno(stdout),_O_U8TEXT);
# endif
Expand Down
4 changes: 2 additions & 2 deletions src/std/sys_android.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
if (!hl_java_method_id_get_context) {
__android_log_print(ANDROID_LOG_ERROR, HL_JNI_LOG_TAG, "Error cannot get getContext() method on specified Activity class (not an Activity ?)");
}

return JNI_VERSION_1_4;
}

Expand Down Expand Up @@ -227,7 +227,7 @@ static const char* hl_sys_android_get_internal_storage_path(void)
return hl_android_internal_files_path;
}

const char *hl_sys_special( const char *key ) {
const char *hl_sys_special( const char *key ) {
if (strcmp(key, "android_external_storage_path")==0)
return hl_sys_android_get_external_storage_path();
else if (strcmp(key, "android_internal_storage_path")==0)
Expand Down
2 changes: 1 addition & 1 deletion src/std/sys_ios.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static int ios_get_retina_scale_factor()
return [[UIScreen mainScreen] scale];
}

const char *hl_sys_special( const char *key ) {
const char *hl_sys_special( const char *key ) {
if (strcmp(key, "ios_resource_path")==0)
return ios_get_resource_path();
else if (strcmp(key, "ios_document_path")==0)
Expand Down
8 changes: 4 additions & 4 deletions src/std/track.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ HL_PRIM int hl_track_entry( int id, hl_type **t, int *count, int *info, varray *
count_before += cur->bcount;
cur++;
}
b = cur->buckets + (id - count_before);
b = cur->buckets + (id - count_before);
prev_id++;
} else {
int i;
int i;
count_before = 0;
for(i=0;i<_KLAST;i++) {
bucket_list *data = &all_data[i];
Expand All @@ -251,7 +251,7 @@ HL_PRIM int hl_track_entry( int id, hl_type **t, int *count, int *info, varray *
prev_id = id;
cur = &all_data[i];
b = cur->buckets;
}
}
*t = b->t;
*count = b->hit_count;
*info = b->info;
Expand All @@ -276,7 +276,7 @@ HL_PRIM void hl_track_set_bits( int flags, bool thread ) {
# ifdef HL_TRACK_ENABLE
if( thread ) {
hl_thread_info *t = hl_get_thread();
if( t ) t->flags = (t->flags & ~(HL_TRACK_MASK<<HL_TREAD_TRACK_SHIFT)) | ((flags & HL_TRACK_MASK) << HL_TREAD_TRACK_SHIFT);
if( t ) t->flags = (t->flags & ~(HL_TRACK_MASK<<HL_TREAD_TRACK_SHIFT)) | ((flags & HL_TRACK_MASK) << HL_TREAD_TRACK_SHIFT);
} else {
hl_track.flags = (hl_track.flags & ~HL_TRACK_MASK) | (flags & HL_TRACK_MASK);
}
Expand Down

0 comments on commit 2ad9cf6

Please sign in to comment.