Mercurial > hg > truffle
comparison src/share/vm/oops/oop.cpp @ 10155:f258c5828eb8
8011773: Some tests on Interned String crashed JVM with OOM
Summary: Instead of terminating the VM, throw OutOfMemoryError exceptions.
Reviewed-by: coleenp, dholmes
author | hseigel |
---|---|
date | Mon, 29 Apr 2013 16:13:57 -0400 |
parents | f34d701e952e |
children | 746b070f5022 |
comparison
equal
deleted
inserted
replaced
10153:3c9b7ef92c61 | 10155:f258c5828eb8 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
101 return ObjectSynchronizer::identity_hash_value_for(object); | 101 return ObjectSynchronizer::identity_hash_value_for(object); |
102 } | 102 } |
103 | 103 |
104 // When String table needs to rehash | 104 // When String table needs to rehash |
105 unsigned int oopDesc::new_hash(jint seed) { | 105 unsigned int oopDesc::new_hash(jint seed) { |
106 EXCEPTION_MARK; | |
106 ResourceMark rm; | 107 ResourceMark rm; |
107 int length; | 108 int length; |
108 jchar* chars = java_lang_String::as_unicode_string(this, length); | 109 jchar* chars = java_lang_String::as_unicode_string(this, length, THREAD); |
109 // Use alternate hashing algorithm on the string | 110 if (chars != NULL) { |
110 return AltHashing::murmur3_32(seed, chars, length); | 111 // Use alternate hashing algorithm on the string |
112 return AltHashing::murmur3_32(seed, chars, length); | |
113 } else { | |
114 vm_exit_out_of_memory(length, "unable to create Unicode strings for String table rehash"); | |
115 return 0; | |
116 } | |
111 } | 117 } |
112 | 118 |
113 VerifyOopClosure VerifyOopClosure::verify_oop; | 119 VerifyOopClosure VerifyOopClosure::verify_oop; |
114 | 120 |
115 void VerifyOopClosure::do_oop(oop* p) { VerifyOopClosure::do_oop_work(p); } | 121 void VerifyOopClosure::do_oop(oop* p) { VerifyOopClosure::do_oop_work(p); } |