From: Stefan Ring Date: Tue, 14 Sep 2010 16:44:54 +0000 (+0200) Subject: * src/threads/posix/thread-posix.cpp: Eliminated some easy-to-fix or pointless compil... X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=cacao.git;a=commitdiff_plain;h=67702ed5605e84f33724aeee9ccf5f82ea774084 * src/threads/posix/thread-posix.cpp: Eliminated some easy-to-fix or pointless compiler warnings. * src/threads/posix/thread-posix.hpp: Likewise. * src/vm/class.cpp: Likewise. * src/vm/classcache.cpp: Likewise. * src/vm/jit/arm/codegen.c: Likewise. * src/vm/jit/arm/md.c: Likewise. * src/vm/jit/i386/md-atomic.hpp: Likewise. * src/vm/jit/codegen-common.cpp: Likewise. * src/vm/jit/trap.cpp: Likewise. * src/vm/jit/verify/typeinfo.cpp: Likewise. * src/vm/jit/x86_64/codegen.c: Likewise. * src/vm/jit/x86_64/patcher.c: Likewise. * src/vm/options.c: Likewise. * src/vm/vm.cpp: Likewise. --- diff --git a/src/threads/posix/thread-posix.cpp b/src/threads/posix/thread-posix.cpp index 8e855c90b..e5aa1126b 100644 --- a/src/threads/posix/thread-posix.cpp +++ b/src/threads/posix/thread-posix.cpp @@ -1,6 +1,6 @@ /* src/threads/posix/thread-posix.cpp - POSIX thread functions - Copyright (C) 1996-2005, 2006, 2007, 2008 + Copyright (C) 1996-2005, 2006, 2007, 2008, 2010 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -583,8 +583,6 @@ void threads_impl_thread_free(threadobject *t) void threads_impl_preinit(void) { - int result; - stopworldlock = new Mutex(); /* initialize exit mutex and condition (on exit we join all @@ -601,7 +599,7 @@ void threads_impl_preinit(void) #endif #if !defined(HAVE___THREAD) - result = pthread_key_create(&thread_current_key, NULL); + int result = pthread_key_create(&thread_current_key, NULL); if (result != 0) os::abort_errnum(result, "threads_impl_preinit: pthread_key_create failed"); #endif diff --git a/src/threads/posix/thread-posix.hpp b/src/threads/posix/thread-posix.hpp index 32503c4da..e24f6cc2e 100644 --- a/src/threads/posix/thread-posix.hpp +++ b/src/threads/posix/thread-posix.hpp @@ -256,7 +256,6 @@ inline static void thread_set_current(threadobject* t) result = pthread_setspecific(thread_current_key, t); if (result != 0) -#warning Use below method instead! //os::abort_errnum(result, "thread_set_current: pthread_setspecific failed"); vm_abort("thread_set_current: pthread_setspecific failed"); #endif diff --git a/src/vm/class.cpp b/src/vm/class.cpp index 601ac6cfd..066bcfdcf 100644 --- a/src/vm/class.cpp +++ b/src/vm/class.cpp @@ -612,7 +612,7 @@ bool class_load_attributes(classbuffer *cb) static void class_freecpool(classinfo *c) { - u4 idx; + int idx; u4 tag; void* info; @@ -669,7 +669,7 @@ void* class_getconstant(classinfo *c, u4 pos, u4 ctype) /* check index and type of constantpool entry */ /* (pos == 0 is caught by type comparison) */ - if ((pos >= c->cpcount) || (c->cptags[pos] != ctype)) { + if (((int) pos >= c->cpcount) || (c->cptags[pos] != ctype)) { exceptions_throw_classformaterror(c, "Illegal constant pool index"); return NULL; } @@ -688,7 +688,7 @@ void* innerclass_getconstant(classinfo *c, u4 pos, u4 ctype) { /* invalid position in constantpool */ - if (pos >= c->cpcount) { + if ((int) pos >= c->cpcount) { exceptions_throw_classformaterror(c, "Illegal constant pool index"); return NULL; } @@ -2104,7 +2104,7 @@ java_handle_t* class_get_enclosingmethod(classinfo *c) java_handle_objectarray_t* class_get_interfaces(classinfo *c) { classinfo* ic; - u4 i; + int i; if (!(c->state & CLASS_LINKED)) if (!link_class(c)) @@ -2380,13 +2380,13 @@ void class_classref_or_classinfo_println(classref_or_classinfo c) #if !defined(NDEBUG) void class_showconstantpool (classinfo *c) { - u4 i; + int i; void* e; printf ("---- dump of constant pool ----\n"); for (i=0; icpcount; i++) { - printf ("#%d: ", (int) i); + printf ("#%d: ", i); e = c -> cpinfos [i]; if (e) { diff --git a/src/vm/classcache.cpp b/src/vm/classcache.cpp index 9023da150..bb167636a 100644 --- a/src/vm/classcache.cpp +++ b/src/vm/classcache.cpp @@ -1,6 +1,6 @@ /* src/vm/classcache.cpp - loaded class cache and loading constraints - Copyright (C) 1996-2005, 2006, 2007, 2008 + Copyright (C) 1996-2005, 2006, 2007, 2008, 2010 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -1338,7 +1338,7 @@ static s4 classcache_number_of_loaded_classes(void) classcache_name_entry *en; classcache_class_entry *clsen; s4 number; - s4 i; + u4 i; /* initialize class counter */ @@ -1399,7 +1399,7 @@ void classcache_foreach_loaded_class(classcache_foreach_functionptr_t func, { classcache_name_entry *en; classcache_class_entry *clsen; - s4 i; + u4 i; CLASSCACHE_LOCK(); diff --git a/src/vm/jit/arm/codegen.c b/src/vm/jit/arm/codegen.c index 4a87bc949..ffb27b03e 100644 --- a/src/vm/jit/arm/codegen.c +++ b/src/vm/jit/arm/codegen.c @@ -1,6 +1,6 @@ /* src/vm/jit/arm/codegen.c - machine code generator for Arm - Copyright (C) 1996-2005, 2006, 2007, 2008, 2009 + Copyright (C) 1996-2005, 2006, 2007, 2008, 2009, 2010 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -257,7 +257,6 @@ void codegen_emit_instruction(jitdata* jd, instruction* iptr) int32_t disp; // Get required compiler data. - codeinfo* code = jd->code; codegendata* cd = jd->cd; /* the big switch */ diff --git a/src/vm/jit/arm/md.c b/src/vm/jit/arm/md.c index 1fecb0a83..4149a7eaa 100644 --- a/src/vm/jit/arm/md.c +++ b/src/vm/jit/arm/md.c @@ -1,6 +1,6 @@ /* src/vm/jit/arm/md.c - machine dependent ARM functions - Copyright (C) 1996-2005, 2006, 2007, 2008 + Copyright (C) 1996-2005, 2006, 2007, 2008, 2010 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO Copyright (C) 2009 Theobroma Systems Ltd. @@ -224,7 +224,7 @@ bool md_trap_decode(trapinfo_t* trp, int sig, void* xpc, executionstate_t* es) case TRAP_SIGSEGV: { // Sanity check for load/store instruction. -#warning Implement this! + // FIXME Implement this! // Retrieve base address of load/store instruction. uintptr_t addr = es->intregs[(mcode >> 16) & 0x0f]; diff --git a/src/vm/jit/codegen-common.cpp b/src/vm/jit/codegen-common.cpp index 6408466d7..9b1dad8cd 100644 --- a/src/vm/jit/codegen-common.cpp +++ b/src/vm/jit/codegen-common.cpp @@ -996,7 +996,7 @@ s4 codegen_reg_of_dst(jitdata *jd, instruction *iptr, s4 tempregnum) bool codegen_emit(jitdata *jd) { varinfo* var; - builtintable_entry* bte; + builtintable_entry* bte = 0; methoddesc* md; int32_t s1, s2, /*s3,*/ d; int32_t fieldtype; @@ -1518,6 +1518,8 @@ bool codegen_emit(jitdata *jd) disp = dseg_add_unique_address(cd, 0); pr = patcher_add_patch_ref(jd, PATCHER_get_putstatic, uf, disp); + + fi = NULL; /* Silence compiler warning */ } else { fi = iptr->sx.s23.s3.fmiref->p.field; @@ -1529,6 +1531,8 @@ bool codegen_emit(jitdata *jd) patcher_add_patch_ref(jd, PATCHER_initialize_class, fi->clazz, 0); PROFILE_CYCLE_START; } + + pr = NULL; /* Silence compiler warning */ } #if defined(USES_PATCHABLE_MEMORY_BARRIER) @@ -1570,6 +1574,9 @@ bool codegen_emit(jitdata *jd) M_DLD(d, REG_ITMP1, 0); break; #endif + default: + // Silence compiler warning. + d = 0; } emit_store_dst(jd, iptr, d); break; @@ -1593,6 +1600,8 @@ bool codegen_emit(jitdata *jd) disp = dseg_add_unique_address(cd, 0); pr = patcher_add_patch_ref(jd, PATCHER_get_putstatic, uf, disp); + + fi = NULL; /* Silence compiler warning */ } else { fi = iptr->sx.s23.s3.fmiref->p.field; @@ -1604,6 +1613,8 @@ bool codegen_emit(jitdata *jd) patcher_add_patch_ref(jd, PATCHER_initialize_class, fi->clazz, 0); PROFILE_CYCLE_START; } + + pr = NULL; /* Silence compiler warning */ } // XXX X86_64: Here We had this: diff --git a/src/vm/jit/i386/md-atomic.hpp b/src/vm/jit/i386/md-atomic.hpp index 84f7b3df5..f1e875234 100644 --- a/src/vm/jit/i386/md-atomic.hpp +++ b/src/vm/jit/i386/md-atomic.hpp @@ -1,6 +1,6 @@ /* src/vm/jit/i386/atomic.hpp - i386 atomic instructions - Copyright (C) 2008 + Copyright (C) 2008, 2010 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -67,7 +67,6 @@ inline uint32_t compare_and_swap(volatile uint32_t *p, uint32_t oldval, uint32_t */ inline uint64_t compare_and_swap(volatile uint64_t *p, uint64_t oldval, uint64_t newval) { -#warning Should we use cmpxchg8b or a generic version? return Atomic::generic_compare_and_swap(p, oldval, newval); } diff --git a/src/vm/jit/trap.cpp b/src/vm/jit/trap.cpp index d3781e33f..e8bfb9bee 100644 --- a/src/vm/jit/trap.cpp +++ b/src/vm/jit/trap.cpp @@ -231,8 +231,8 @@ void trap_handle(int sig, void *xpc, void *context) /* Get resulting exception (or pointer to compiled method). */ java_handle_t* p; - void* entry; - bool was_patched; + void* entry = 0; + bool was_patched = false; #if defined(ENABLE_REPLACEMENT) bool was_replaced; #endif diff --git a/src/vm/jit/verify/typeinfo.cpp b/src/vm/jit/verify/typeinfo.cpp index 0e6f46dc8..f4c2037fa 100644 --- a/src/vm/jit/verify/typeinfo.cpp +++ b/src/vm/jit/verify/typeinfo.cpp @@ -1,6 +1,6 @@ /* src/vm/jit/verify/typeinfo.c - type system used by the type checker - Copyright (C) 1996-2005, 2006, 2007, 2008 + Copyright (C) 1996-2005, 2006, 2007, 2008, 2010 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -2279,7 +2279,7 @@ typeinfo_inc_dimension(typeinfo_t *info) #define TYPEINFO_TEST_MAXDIM 10 static void -typeinfo_testrun(char *filename) +typeinfo_testrun(const char *filename) { char buf[TYPEINFO_TEST_BUFLEN]; char bufa[TYPEINFO_TEST_BUFLEN]; diff --git a/src/vm/jit/x86_64/codegen.c b/src/vm/jit/x86_64/codegen.c index 89f12c251..3a4acd2ea 100644 --- a/src/vm/jit/x86_64/codegen.c +++ b/src/vm/jit/x86_64/codegen.c @@ -1,6 +1,6 @@ /* src/vm/jit/x86_64/codegen.c - machine code generator for x86_64 - Copyright (C) 1996-2005, 2006, 2007, 2008, 2009 + Copyright (C) 1996-2005, 2006, 2007, 2008, 2009, 2010 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -1507,6 +1507,8 @@ void codegen_emit_instruction(jitdata* jd, instruction* iptr) pr = patcher_add_patch_ref(jd, PATCHER_get_putstatic, uf, disp); /* PROFILE_CYCLE_START; */ + + fi = NULL; /* Silence compiler warning */ } else { fi = iptr->sx.s23.s3.fmiref->p.field; @@ -1521,6 +1523,8 @@ void codegen_emit_instruction(jitdata* jd, instruction* iptr) //PROFILE_CYCLE_START; } + + pr = NULL; /* Silence compiler warning */ } /* This approach is much faster than moving the field @@ -1561,6 +1565,8 @@ void codegen_emit_instruction(jitdata* jd, instruction* iptr) patcher_add_patch_ref(jd, PATCHER_get_putfield, uf, 0); /* PROFILE_CYCLE_START; */ + + fi = NULL; /* Silence compiler warning */ } else { fi = iptr->sx.s23.s3.fmiref->p.field; @@ -1587,6 +1593,9 @@ void codegen_emit_instruction(jitdata* jd, instruction* iptr) d = codegen_reg_of_dst(jd, iptr, REG_FTMP1); M_DLD32(d, s1, disp); break; + default: + // Silence compiler warning. + d = 0; } emit_store_dst(jd, iptr, d); break; @@ -1606,11 +1615,15 @@ void codegen_emit_instruction(jitdata* jd, instruction* iptr) pr = patcher_add_patch_ref(jd, PATCHER_get_putfield, uf, 0); /* PROFILE_CYCLE_START; */ + + fi = NULL; /* Silence compiler warning */ } else { fi = iptr->sx.s23.s3.fmiref->p.field; fieldtype = fi->type; disp = fi->offset; + + pr = NULL; /* Silence compiler warning */ } /* implicit null-pointer check */ @@ -1648,11 +1661,15 @@ void codegen_emit_instruction(jitdata* jd, instruction* iptr) pr = patcher_add_patch_ref(jd, PATCHER_putfieldconst, uf, 0); /* PROFILE_CYCLE_START; */ + + fi = NULL; /* Silence compiler warning */ } else { fi = iptr->sx.s23.s3.fmiref->p.field; fieldtype = fi->type; disp = fi->offset; + + pr = NULL; /* Silence compiler warning */ } /* implicit null-pointer check */ diff --git a/src/vm/jit/x86_64/patcher.c b/src/vm/jit/x86_64/patcher.c index be4fd4e7a..2d394fff2 100644 --- a/src/vm/jit/x86_64/patcher.c +++ b/src/vm/jit/x86_64/patcher.c @@ -1,6 +1,6 @@ /* src/vm/jit/x86_64/patcher.c - x86_64 code patching functions - Copyright (C) 1996-2005, 2006, 2007, 2008, 2009 + Copyright (C) 1996-2005, 2006, 2007, 2008, 2009, 2010 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -87,9 +87,9 @@ static void patch_out_mfence(void *pc) assert((((uintptr_t) pc) & 3) < 2); if (((uintptr_t) pc) & 1) - *p = *p & 0x000000ff | 0x001f0f00; + *p = (*p & 0x000000ff) | 0x001f0f00; else - *p = *p & 0xff000000 | 0x00001f0f; + *p = (*p & 0xff000000) | 0x00001f0f; md_icacheflush(p, 4); } diff --git a/src/vm/options.c b/src/vm/options.c index 2fc95f346..f503ce682 100644 --- a/src/vm/options.c +++ b/src/vm/options.c @@ -1,6 +1,6 @@ /* src/vm/options.c - contains global options - Copyright (C) 1996-2005, 2006, 2007, 2008 + Copyright (C) 1996-2005, 2006, 2007, 2008, 2010 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -794,7 +794,7 @@ void options_xx(JavaVMInitArgs *vm_args) file = fopen(filename, "w"); if (file == NULL) -#warning Use below method instead! + /* FIXME Use below method instead! */ //os::abort_errno("options_xx: fopen failed"); vm_abort("options_xx: fopen failed"); diff --git a/src/vm/vm.cpp b/src/vm/vm.cpp index 70c0ae53c..38b9d4e4c 100644 --- a/src/vm/vm.cpp +++ b/src/vm/vm.cpp @@ -1,6 +1,6 @@ /* src/vm/vm.cpp - VM startup and shutdown functions - Copyright (C) 1996-2005, 2006, 2007, 2008, 2009 + Copyright (C) 1996-2005, 2006, 2007, 2008, 2009, 2010 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -718,7 +718,7 @@ VM::VM(JavaVMInitArgs* vm_args) is smaller or equal than the assumption made in src/vm/class.hpp. */ -#warning FIXME We need to check the size of java.lang.Class!!! +// FIXME We need to check the size of java.lang.Class!!! // if (sizeof(java_lang_Class) > sizeof(dummy_java_lang_Class)) // vm_abort("vm_create: java_lang_Class structure is bigger than classinfo.object (%d > %d)", sizeof(java_lang_Class), sizeof(dummy_java_lang_Class)); @@ -1795,7 +1795,6 @@ int vm_destroy(JavaVM *vm) /* VM is gone. */ // _created = false; -#warning Move to C++ /* Everything is ok. */ @@ -1816,7 +1815,6 @@ void vm_exit(s4 status) /* signal that we are exiting */ // _exiting = true; -#warning Move to C++ assert(class_java_lang_System); assert(class_java_lang_System->state & CLASS_LOADED);