equal
deleted
inserted
replaced
2128 } |
2128 } |
2129 |
2129 |
2130 public: |
2130 public: |
2131 AdapterFingerPrint(int total_args_passed, BasicType* sig_bt) { |
2131 AdapterFingerPrint(int total_args_passed, BasicType* sig_bt) { |
2132 // The fingerprint is based on the BasicType signature encoded |
2132 // The fingerprint is based on the BasicType signature encoded |
2133 // into an array of ints with four entries per int. |
2133 // into an array of ints with eight entries per int. |
2134 int* ptr; |
2134 int* ptr; |
2135 int len = (total_args_passed + 3) >> 2; |
2135 int len = (total_args_passed + 7) >> 3; |
2136 if (len <= (int)(sizeof(_value._compact) / sizeof(int))) { |
2136 if (len <= (int)(sizeof(_value._compact) / sizeof(int))) { |
2137 _value._compact[0] = _value._compact[1] = _value._compact[2] = 0; |
2137 _value._compact[0] = _value._compact[1] = _value._compact[2] = 0; |
2138 // Storing the signature encoded as signed chars hits about 98% |
2138 // Storing the signature encoded as signed chars hits about 98% |
2139 // of the time. |
2139 // of the time. |
2140 _length = -len; |
2140 _length = -len; |
2143 _length = len; |
2143 _length = len; |
2144 _value._fingerprint = NEW_C_HEAP_ARRAY(int, _length); |
2144 _value._fingerprint = NEW_C_HEAP_ARRAY(int, _length); |
2145 ptr = _value._fingerprint; |
2145 ptr = _value._fingerprint; |
2146 } |
2146 } |
2147 |
2147 |
2148 // Now pack the BasicTypes with 4 per int |
2148 // Now pack the BasicTypes with 8 per int |
2149 int sig_index = 0; |
2149 int sig_index = 0; |
2150 for (int index = 0; index < len; index++) { |
2150 for (int index = 0; index < len; index++) { |
2151 int value = 0; |
2151 int value = 0; |
2152 for (int byte = 0; byte < 4; byte++) { |
2152 for (int byte = 0; byte < 8; byte++) { |
2153 if (sig_index < total_args_passed) { |
2153 if (sig_index < total_args_passed) { |
2154 value = (value << 4) | adapter_encoding(sig_bt[sig_index++]); |
2154 value = (value << 4) | adapter_encoding(sig_bt[sig_index++]); |
2155 } |
2155 } |
2156 } |
2156 } |
2157 ptr[index] = value; |
2157 ptr[index] = value; |
2188 return (unsigned int)hash; |
2188 return (unsigned int)hash; |
2189 } |
2189 } |
2190 |
2190 |
2191 const char* as_string() { |
2191 const char* as_string() { |
2192 stringStream st; |
2192 stringStream st; |
|
2193 st.print("0x"); |
2193 for (int i = 0; i < length(); i++) { |
2194 for (int i = 0; i < length(); i++) { |
2194 st.print(PTR_FORMAT, value(i)); |
2195 st.print("%08x", value(i)); |
2195 } |
2196 } |
2196 return st.as_string(); |
2197 return st.as_string(); |
2197 } |
2198 } |
2198 |
2199 |
2199 bool equals(AdapterFingerPrint* other) { |
2200 bool equals(AdapterFingerPrint* other) { |