comparison src/share/vm/utilities/resourceHash.hpp @ 14660:3c6ae9109a86

8035946: Use ResourceHashtable for dependency checking Summary: Use ResourceHashtable for dependency checking and delete GenericHashtable Reviewed-by: kvn, coleenp
author anoll
date Mon, 03 Mar 2014 08:04:14 +0100
parents bdd155477289
children 92aa6797d639
comparison
equal deleted inserted replaced
14514:2328dac1da27 14660:3c6ae9109a86
103 } else { 103 } else {
104 return NULL; 104 return NULL;
105 } 105 }
106 } 106 }
107 107
108 // Inserts or replaces a value in the table 108 /**
109 void put(K const& key, V const& value) { 109 * Inserts or replaces a value in the table.
110 * @return: true: if a new item is added
111 * false: if the item already existed and the value is updated
112 */
113 bool put(K const& key, V const& value) {
110 unsigned hv = HASH(key); 114 unsigned hv = HASH(key);
111 Node** ptr = lookup_node(hv, key); 115 Node** ptr = lookup_node(hv, key);
112 if (*ptr != NULL) { 116 if (*ptr != NULL) {
113 (*ptr)->_value = value; 117 (*ptr)->_value = value;
118 return false;
114 } else { 119 } else {
115 *ptr = new Node(hv, key, value); 120 *ptr = new Node(hv, key, value);
121 return true;
116 } 122 }
117 } 123 }
118 124
119 // ITER contains bool do_entry(K const&, V const&), which will be 125 // ITER contains bool do_entry(K const&, V const&), which will be
120 // called for each entry in the table. If do_entry() returns false, 126 // called for each entry in the table. If do_entry() returns false,