Mercurial > hg > truffle
comparison src/share/vm/runtime/sharedRuntime.cpp @ 1681:126ea7725993
6953477: Increase portability and flexibility of building Hotspot
Summary: A collection of portability improvements including shared code support for PPC, ARM platforms, software floating point, cross compilation support and improvements in error crash detail.
Reviewed-by: phh, never, coleenp, dholmes
author | bobv |
---|---|
date | Tue, 03 Aug 2010 08:13:38 -0400 |
parents | 2a47bd84841f |
children | a62d332029cf |
comparison
equal
deleted
inserted
replaced
1680:a64438a2b7e8 | 1681:126ea7725993 |
---|---|
189 } | 189 } |
190 #endif | 190 #endif |
191 return ((jdouble)fmod((double)x,(double)y)); | 191 return ((jdouble)fmod((double)x,(double)y)); |
192 JRT_END | 192 JRT_END |
193 | 193 |
194 #ifdef __SOFTFP__ | |
195 JRT_LEAF(jfloat, SharedRuntime::fadd(jfloat x, jfloat y)) | |
196 return x + y; | |
197 JRT_END | |
198 | |
199 JRT_LEAF(jfloat, SharedRuntime::fsub(jfloat x, jfloat y)) | |
200 return x - y; | |
201 JRT_END | |
202 | |
203 JRT_LEAF(jfloat, SharedRuntime::fmul(jfloat x, jfloat y)) | |
204 return x * y; | |
205 JRT_END | |
206 | |
207 JRT_LEAF(jfloat, SharedRuntime::fdiv(jfloat x, jfloat y)) | |
208 return x / y; | |
209 JRT_END | |
210 | |
211 JRT_LEAF(jdouble, SharedRuntime::dadd(jdouble x, jdouble y)) | |
212 return x + y; | |
213 JRT_END | |
214 | |
215 JRT_LEAF(jdouble, SharedRuntime::dsub(jdouble x, jdouble y)) | |
216 return x - y; | |
217 JRT_END | |
218 | |
219 JRT_LEAF(jdouble, SharedRuntime::dmul(jdouble x, jdouble y)) | |
220 return x * y; | |
221 JRT_END | |
222 | |
223 JRT_LEAF(jdouble, SharedRuntime::ddiv(jdouble x, jdouble y)) | |
224 return x / y; | |
225 JRT_END | |
226 | |
227 JRT_LEAF(jfloat, SharedRuntime::i2f(jint x)) | |
228 return (jfloat)x; | |
229 JRT_END | |
230 | |
231 JRT_LEAF(jdouble, SharedRuntime::i2d(jint x)) | |
232 return (jdouble)x; | |
233 JRT_END | |
234 | |
235 JRT_LEAF(jdouble, SharedRuntime::f2d(jfloat x)) | |
236 return (jdouble)x; | |
237 JRT_END | |
238 | |
239 JRT_LEAF(int, SharedRuntime::fcmpl(float x, float y)) | |
240 return x>y ? 1 : (x==y ? 0 : -1); /* x<y or is_nan*/ | |
241 JRT_END | |
242 | |
243 JRT_LEAF(int, SharedRuntime::fcmpg(float x, float y)) | |
244 return x<y ? -1 : (x==y ? 0 : 1); /* x>y or is_nan */ | |
245 JRT_END | |
246 | |
247 JRT_LEAF(int, SharedRuntime::dcmpl(double x, double y)) | |
248 return x>y ? 1 : (x==y ? 0 : -1); /* x<y or is_nan */ | |
249 JRT_END | |
250 | |
251 JRT_LEAF(int, SharedRuntime::dcmpg(double x, double y)) | |
252 return x<y ? -1 : (x==y ? 0 : 1); /* x>y or is_nan */ | |
253 JRT_END | |
254 | |
255 // Functions to return the opposite of the aeabi functions for nan. | |
256 JRT_LEAF(int, SharedRuntime::unordered_fcmplt(float x, float y)) | |
257 return (x < y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0); | |
258 JRT_END | |
259 | |
260 JRT_LEAF(int, SharedRuntime::unordered_dcmplt(double x, double y)) | |
261 return (x < y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0); | |
262 JRT_END | |
263 | |
264 JRT_LEAF(int, SharedRuntime::unordered_fcmple(float x, float y)) | |
265 return (x <= y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0); | |
266 JRT_END | |
267 | |
268 JRT_LEAF(int, SharedRuntime::unordered_dcmple(double x, double y)) | |
269 return (x <= y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0); | |
270 JRT_END | |
271 | |
272 JRT_LEAF(int, SharedRuntime::unordered_fcmpge(float x, float y)) | |
273 return (x >= y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0); | |
274 JRT_END | |
275 | |
276 JRT_LEAF(int, SharedRuntime::unordered_dcmpge(double x, double y)) | |
277 return (x >= y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0); | |
278 JRT_END | |
279 | |
280 JRT_LEAF(int, SharedRuntime::unordered_fcmpgt(float x, float y)) | |
281 return (x > y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0); | |
282 JRT_END | |
283 | |
284 JRT_LEAF(int, SharedRuntime::unordered_dcmpgt(double x, double y)) | |
285 return (x > y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0); | |
286 JRT_END | |
287 | |
288 // Intrinsics make gcc generate code for these. | |
289 float SharedRuntime::fneg(float f) { | |
290 return -f; | |
291 } | |
292 | |
293 double SharedRuntime::dneg(double f) { | |
294 return -f; | |
295 } | |
296 | |
297 #endif // __SOFTFP__ | |
298 | |
299 #if defined(__SOFTFP__) || defined(E500V2) | |
300 // Intrinsics make gcc generate code for these. | |
301 double SharedRuntime::dabs(double f) { | |
302 return (f <= (double)0.0) ? (double)0.0 - f : f; | |
303 } | |
304 | |
305 double SharedRuntime::dsqrt(double f) { | |
306 return sqrt(f); | |
307 } | |
308 #endif | |
194 | 309 |
195 JRT_LEAF(jint, SharedRuntime::f2i(jfloat x)) | 310 JRT_LEAF(jint, SharedRuntime::f2i(jfloat x)) |
196 if (g_isnan(x)) | 311 if (g_isnan(x)) |
197 return 0; | 312 return 0; |
198 if (x >= (jfloat) max_jint) | 313 if (x >= (jfloat) max_jint) |
2044 int AdapterHandlerTable::_buckets; | 2159 int AdapterHandlerTable::_buckets; |
2045 int AdapterHandlerTable::_equals; | 2160 int AdapterHandlerTable::_equals; |
2046 int AdapterHandlerTable::_hits; | 2161 int AdapterHandlerTable::_hits; |
2047 int AdapterHandlerTable::_compact; | 2162 int AdapterHandlerTable::_compact; |
2048 | 2163 |
2164 #endif | |
2165 | |
2049 class AdapterHandlerTableIterator : public StackObj { | 2166 class AdapterHandlerTableIterator : public StackObj { |
2050 private: | 2167 private: |
2051 AdapterHandlerTable* _table; | 2168 AdapterHandlerTable* _table; |
2052 int _index; | 2169 int _index; |
2053 AdapterHandlerEntry* _current; | 2170 AdapterHandlerEntry* _current; |
2079 } else { | 2196 } else { |
2080 return NULL; | 2197 return NULL; |
2081 } | 2198 } |
2082 } | 2199 } |
2083 }; | 2200 }; |
2084 #endif | |
2085 | 2201 |
2086 | 2202 |
2087 // --------------------------------------------------------------------------- | 2203 // --------------------------------------------------------------------------- |
2088 // Implementation of AdapterHandlerLibrary | 2204 // Implementation of AdapterHandlerLibrary |
2089 AdapterHandlerTable* AdapterHandlerLibrary::_adapters = NULL; | 2205 AdapterHandlerTable* AdapterHandlerLibrary::_adapters = NULL; |
2617 | 2733 |
2618 JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) ) | 2734 JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) ) |
2619 FREE_C_HEAP_ARRAY(intptr_t,buf); | 2735 FREE_C_HEAP_ARRAY(intptr_t,buf); |
2620 JRT_END | 2736 JRT_END |
2621 | 2737 |
2622 #ifndef PRODUCT | |
2623 bool AdapterHandlerLibrary::contains(CodeBlob* b) { | 2738 bool AdapterHandlerLibrary::contains(CodeBlob* b) { |
2624 AdapterHandlerTableIterator iter(_adapters); | 2739 AdapterHandlerTableIterator iter(_adapters); |
2625 while (iter.has_next()) { | 2740 while (iter.has_next()) { |
2626 AdapterHandlerEntry* a = iter.next(); | 2741 AdapterHandlerEntry* a = iter.next(); |
2627 if ( b == CodeCache::find_blob(a->get_i2c_entry()) ) return true; | 2742 if ( b == CodeCache::find_blob(a->get_i2c_entry()) ) return true; |
2628 } | 2743 } |
2629 return false; | 2744 return false; |
2630 } | 2745 } |
2631 | 2746 |
2632 void AdapterHandlerLibrary::print_handler(CodeBlob* b) { | 2747 void AdapterHandlerLibrary::print_handler_on(outputStream* st, CodeBlob* b) { |
2633 AdapterHandlerTableIterator iter(_adapters); | 2748 AdapterHandlerTableIterator iter(_adapters); |
2634 while (iter.has_next()) { | 2749 while (iter.has_next()) { |
2635 AdapterHandlerEntry* a = iter.next(); | 2750 AdapterHandlerEntry* a = iter.next(); |
2636 if ( b == CodeCache::find_blob(a->get_i2c_entry()) ) { | 2751 if ( b == CodeCache::find_blob(a->get_i2c_entry()) ) { |
2637 tty->print("Adapter for signature: "); | 2752 st->print("Adapter for signature: "); |
2638 tty->print_cr("%s i2c: " INTPTR_FORMAT " c2i: " INTPTR_FORMAT " c2iUV: " INTPTR_FORMAT, | 2753 st->print_cr("%s i2c: " INTPTR_FORMAT " c2i: " INTPTR_FORMAT " c2iUV: " INTPTR_FORMAT, |
2639 a->fingerprint()->as_string(), | 2754 a->fingerprint()->as_string(), |
2640 a->get_i2c_entry(), a->get_c2i_entry(), a->get_c2i_unverified_entry()); | 2755 a->get_i2c_entry(), a->get_c2i_entry(), a->get_c2i_unverified_entry()); |
2756 | |
2641 return; | 2757 return; |
2642 } | 2758 } |
2643 } | 2759 } |
2644 assert(false, "Should have found handler"); | 2760 assert(false, "Should have found handler"); |
2645 } | 2761 } |
2762 | |
2763 #ifndef PRODUCT | |
2646 | 2764 |
2647 void AdapterHandlerLibrary::print_statistics() { | 2765 void AdapterHandlerLibrary::print_statistics() { |
2648 _adapters->print_statistics(); | 2766 _adapters->print_statistics(); |
2649 } | 2767 } |
2650 | 2768 |