File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/complex Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 85
85
import com .oracle .graal .python .builtins .objects .PNotImplemented ;
86
86
import com .oracle .graal .python .builtins .objects .floats .FloatBuiltins ;
87
87
import com .oracle .graal .python .builtins .objects .ints .PInt ;
88
+ import com .oracle .graal .python .builtins .objects .object .PythonObjectLibrary ;
88
89
import com .oracle .graal .python .builtins .objects .tuple .PTuple ;
89
90
import com .oracle .graal .python .nodes .ErrorMessages ;
90
91
import com .oracle .graal .python .nodes .call .special .LookupAndCallUnaryNode ;
110
111
import com .oracle .truffle .api .dsl .Specialization ;
111
112
import com .oracle .truffle .api .dsl .TypeSystemReference ;
112
113
import com .oracle .truffle .api .frame .VirtualFrame ;
114
+ import com .oracle .truffle .api .library .CachedLibrary ;
113
115
import com .oracle .truffle .api .profiles .ConditionProfile ;
114
116
115
117
@ CoreFunctions (extendClasses = PythonBuiltinClassType .PComplex )
@@ -827,10 +829,11 @@ abstract static class ImagNode extends PythonBuiltinNode {
827
829
abstract static class HashNode extends PythonUnaryBuiltinNode {
828
830
@ Specialization
829
831
@ TruffleBoundary
830
- int hash (PComplex self ) {
832
+ long hash (PComplex self ,
833
+ @ CachedLibrary (limit = "1" ) PythonObjectLibrary lib ) {
831
834
// just like CPython
832
- int realHash = Double . hashCode (self .getReal ());
833
- int imagHash = Double . hashCode (self .getImag ());
835
+ long realHash = lib . hash (self .getReal ());
836
+ long imagHash = lib . hash (self .getImag ());
834
837
return realHash + PComplex .IMAG_MULTIPLIER * imagHash ;
835
838
}
836
839
}
You can’t perform that action at this time.
0 commit comments