Mercurial > hg > truffle
comparison src/share/vm/opto/library_call.cpp @ 1746:4b29a725c43c
6912064: type profiles need to be exploited more for dynamic language support
Reviewed-by: kvn
author | jrose |
---|---|
date | Fri, 20 Aug 2010 23:40:30 -0700 |
parents | 4311f23817fd |
children | 3e8fbc61cee8 |
comparison
equal
deleted
inserted
replaced
1730:f55c4f82ab9d | 1746:4b29a725c43c |
---|---|
904 | 904 |
905 const int value_offset = java_lang_String::value_offset_in_bytes(); | 905 const int value_offset = java_lang_String::value_offset_in_bytes(); |
906 const int count_offset = java_lang_String::count_offset_in_bytes(); | 906 const int count_offset = java_lang_String::count_offset_in_bytes(); |
907 const int offset_offset = java_lang_String::offset_offset_in_bytes(); | 907 const int offset_offset = java_lang_String::offset_offset_in_bytes(); |
908 | 908 |
909 _sp += 2; | 909 int nargs = 2; |
910 _sp += nargs; | |
910 Node* argument = pop(); // pop non-receiver first: it was pushed second | 911 Node* argument = pop(); // pop non-receiver first: it was pushed second |
911 Node* receiver = pop(); | 912 Node* receiver = pop(); |
912 | 913 |
913 // Null check on self without removing any arguments. The argument | 914 // Null check on self without removing any arguments. The argument |
914 // null check technically happens in the wrong place, which can lead to | 915 // null check technically happens in the wrong place, which can lead to |
915 // invalid stack traces when string compare is inlined into a method | 916 // invalid stack traces when string compare is inlined into a method |
916 // which handles NullPointerExceptions. | 917 // which handles NullPointerExceptions. |
917 _sp += 2; | 918 _sp += nargs; |
918 receiver = do_null_check(receiver, T_OBJECT); | 919 receiver = do_null_check(receiver, T_OBJECT); |
919 //should not do null check for argument for String.equals(), because spec | 920 //should not do null check for argument for String.equals(), because spec |
920 //allows to specify NULL as argument. | 921 //allows to specify NULL as argument. |
921 _sp -= 2; | 922 _sp -= nargs; |
922 | 923 |
923 if (stopped()) { | 924 if (stopped()) { |
924 return true; | 925 return true; |
925 } | 926 } |
926 | 927 |
941 | 942 |
942 // get String klass for instanceOf | 943 // get String klass for instanceOf |
943 ciInstanceKlass* klass = env()->String_klass(); | 944 ciInstanceKlass* klass = env()->String_klass(); |
944 | 945 |
945 if (!stopped()) { | 946 if (!stopped()) { |
947 _sp += nargs; // gen_instanceof might do an uncommon trap | |
946 Node* inst = gen_instanceof(argument, makecon(TypeKlassPtr::make(klass))); | 948 Node* inst = gen_instanceof(argument, makecon(TypeKlassPtr::make(klass))); |
949 _sp -= nargs; | |
947 Node* cmp = _gvn.transform(new (C, 3) CmpINode(inst, intcon(1))); | 950 Node* cmp = _gvn.transform(new (C, 3) CmpINode(inst, intcon(1))); |
948 Node* bol = _gvn.transform(new (C, 2) BoolNode(cmp, BoolTest::ne)); | 951 Node* bol = _gvn.transform(new (C, 2) BoolNode(cmp, BoolTest::ne)); |
949 | 952 |
950 Node* inst_false = generate_guard(bol, NULL, PROB_MIN); | 953 Node* inst_false = generate_guard(bol, NULL, PROB_MIN); |
951 //instanceOf == true, fallthrough | 954 //instanceOf == true, fallthrough |
2933 // For constant classes, the query will constant-fold in LoadNode::Value. | 2936 // For constant classes, the query will constant-fold in LoadNode::Value. |
2934 Node* query_value = top(); | 2937 Node* query_value = top(); |
2935 switch (id) { | 2938 switch (id) { |
2936 case vmIntrinsics::_isInstance: | 2939 case vmIntrinsics::_isInstance: |
2937 // nothing is an instance of a primitive type | 2940 // nothing is an instance of a primitive type |
2941 _sp += nargs; // gen_instanceof might do an uncommon trap | |
2938 query_value = gen_instanceof(obj, kls); | 2942 query_value = gen_instanceof(obj, kls); |
2943 _sp -= nargs; | |
2939 break; | 2944 break; |
2940 | 2945 |
2941 case vmIntrinsics::_getModifiers: | 2946 case vmIntrinsics::_getModifiers: |
2942 p = basic_plus_adr(kls, Klass::modifier_flags_offset_in_bytes() + sizeof(oopDesc)); | 2947 p = basic_plus_adr(kls, Klass::modifier_flags_offset_in_bytes() + sizeof(oopDesc)); |
2943 query_value = make_load(NULL, p, TypeInt::INT, T_INT); | 2948 query_value = make_load(NULL, p, TypeInt::INT, T_INT); |