Mercurial > hg > release > icedtea6-1.5
changeset 1472:c1db7ce41839
2009-04-23 Xerxes R?nby <xerxes@zafena.se>
* ports/hotspot/src/share/vm/shark/sharkBuilder.cpp
(zero_cmpxchg_int_fn): New function.
(zero_cmpxchg_ptr_fn): Likewise.
(SharkBuilder::init_external_functions): Use the above on arm.
author | Xerxes R?nby <xerxes@zafena.se> |
---|---|
date | Thu, 23 Apr 2009 16:57:41 +0200 |
parents | 7408dba85141 |
children | 7c7835fceadc |
files | ChangeLog ports/hotspot/src/share/vm/shark/sharkBuilder.cpp |
diffstat | 2 files changed, 53 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Apr 17 09:57:01 2009 -0400 +++ b/ChangeLog Thu Apr 23 16:57:41 2009 +0200 @@ -1,3 +1,10 @@ +2009-04-23 Xerxes RĂ„nby <xerxes@zafena.se> + + * ports/hotspot/src/share/vm/shark/sharkBuilder.cpp + (zero_cmpxchg_int_fn): New function. + (zero_cmpxchg_ptr_fn): Likewise. + (SharkBuilder::init_external_functions): Use the above on arm. + 2009-04-17 Lillian Angel <langel@redhat.com> * Makefile.am
--- a/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Fri Apr 17 09:57:01 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Thu Apr 23 16:57:41 2009 +0200 @@ -28,6 +28,38 @@ using namespace llvm; +#ifdef ARM +/* + * ARM lacks atomic operation implementation in LLVM + * http://llvm.org/bugs/show_bug.cgi?id=3877 + * + * These two functions zero_cmpxchg_int_fn and zero_cmpxchg_ptr_fn + * are defined so that they can be inserted into llvm as a workaround to + * make shark reroute all atomic calls back to the implementation in zero. + * The actual insertion are done in SharkBuilder::init_external_functions(). + */ + +extern "C" { + jint zero_cmpxchg_int_fn(volatile jint *ptr, + jint *oldval, + jint *newval) + { + return Atomic::cmpxchg(*newval, + ptr, + *oldval); + } + + intptr_t* zero_cmpxchg_ptr_fn(volatile void* ptr, + intptr_t* oldval, + intptr_t* newval) + { + return (intptr_t *) Atomic::cmpxchg_ptr((void *) newval, + ptr, + (void *) oldval); + } +}; +#endif + SharkBuilder::SharkBuilder(SharkCompiler* compiler) : IRBuilder<>(), _compiler(compiler) @@ -81,7 +113,14 @@ params.push_back(SharkType::jint_type()); type = FunctionType::get(SharkType::jint_type(), params, false); set_llvm_cmpxchg_int_fn( +#ifdef ARM + make_function( + (intptr_t) zero_cmpxchg_int_fn, + type, + "zero_cmpxchg_int_fn")); +#else module()->getOrInsertFunction("llvm.atomic.cmp.swap.i32", type)); +#endif params.clear(); params.push_back(PointerType::getUnqual(SharkType::intptr_type())); @@ -89,8 +128,15 @@ params.push_back(SharkType::intptr_type()); type = FunctionType::get(SharkType::intptr_type(), params, false); set_llvm_cmpxchg_ptr_fn( +#ifdef ARM + make_function( + (intptr_t) zero_cmpxchg_ptr_fn, + type, + "zero_cmpxchg_ptr_fn")); +#else module()->getOrInsertFunction( "llvm.atomic.cmp.swap.i" LP64_ONLY("64") NOT_LP64("32"), type)); +#endif params.clear(); for (int i = 0; i < 5; i++)