81 assert(vmIntrinsics::FLAG_LIMIT <= (1 << vmIntrinsics::log2_FLAG_LIMIT), "must fit in this bitfield");
82
83 if (!UseSharedSpaces) {
84 const char* string = &vm_symbol_bodies[0];
85 for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
86 Symbol* sym = SymbolTable::new_permanent_symbol(string, CHECK);
87 _symbols[index] = sym;
88 string += strlen(string); // skip string body
89 string += 1; // skip trailing null
90 }
91
92 _type_signatures[T_BYTE] = byte_signature();
93 _type_signatures[T_CHAR] = char_signature();
94 _type_signatures[T_DOUBLE] = double_signature();
95 _type_signatures[T_FLOAT] = float_signature();
96 _type_signatures[T_INT] = int_signature();
97 _type_signatures[T_LONG] = long_signature();
98 _type_signatures[T_SHORT] = short_signature();
99 _type_signatures[T_BOOLEAN] = bool_signature();
100 _type_signatures[T_VOID] = void_signature();
101 // no single signatures for T_OBJECT or T_ARRAY
102 #ifdef ASSERT
103 for (int i = (int)T_BOOLEAN; i < (int)T_VOID+1; i++) {
104 Symbol* s = _type_signatures[i];
105 if (s == NULL) continue;
106 BasicType st = signature_type(s);
107 assert(st == i, "");
108 }
109 #endif
110 }
111
112 #ifdef ASSERT
113 // Check for duplicates:
114 for (int i1 = (int)FIRST_SID; i1 < (int)SID_LIMIT; i1++) {
115 Symbol* sym = symbol_at((SID)i1);
116 for (int i2 = (int)FIRST_SID; i2 < i1; i2++) {
117 if (symbol_at((SID)i2) == sym) {
118 tty->print("*** Duplicate VM symbol SIDs %s(%d) and %s(%d): \"",
119 vm_symbol_enum_name((SID)i2), i2,
120 vm_symbol_enum_name((SID)i1), i1);
121 sym->print_symbol_on(tty);
201 it->push(&_type_signatures[i]);
202 }
203 }
204
205 void vmSymbols::serialize(SerializeClosure* soc) {
206 soc->do_region((u_char*)&_symbols[FIRST_SID],
207 (SID_LIMIT - FIRST_SID) * sizeof(_symbols[0]));
208 soc->do_region((u_char*)_type_signatures, sizeof(_type_signatures));
209 }
210
211
212 BasicType vmSymbols::signature_type(const Symbol* s) {
213 assert(s != NULL, "checking");
214 if (s->utf8_length() == 1) {
215 BasicType result = char2type(s->char_at(0));
216 if (is_java_primitive(result) || result == T_VOID) {
217 assert(s == _type_signatures[result], "");
218 return result;
219 }
220 }
221 return T_OBJECT;
222 }
223
224
225 static int mid_hint = (int)vmSymbols::FIRST_SID+1;
226
227 #ifndef PRODUCT
228 static int find_sid_calls, find_sid_probes;
229 // (Typical counts are calls=7000 and probes=17000.)
230 #endif
231
232 vmSymbols::SID vmSymbols::find_sid(const Symbol* symbol) {
233 // Handle the majority of misses by a bounds check.
234 // Then, use a binary search over the index.
235 // Expected trip count is less than log2_SID_LIMIT, about eight.
236 // This is slow but acceptable, given that calls are not
237 // dynamically common. (Method*::intrinsic_id has a cache.)
238 NOT_PRODUCT(find_sid_calls++);
239 int min = (int)FIRST_SID, max = (int)SID_LIMIT - 1;
240 SID sid = NO_SID, sid1;
241 int cmp1;
581 case vmIntrinsics::_floatToIntBits:
582 case vmIntrinsics::_doubleToLongBits:
583 case vmIntrinsics::_maxF:
584 case vmIntrinsics::_minF:
585 case vmIntrinsics::_maxD:
586 case vmIntrinsics::_minD:
587 if (!InlineMathNatives) return true;
588 break;
589 case vmIntrinsics::_fmaD:
590 case vmIntrinsics::_fmaF:
591 if (!InlineMathNatives || !UseFMA) return true;
592 break;
593 case vmIntrinsics::_arraycopy:
594 if (!InlineArrayCopy) return true;
595 break;
596 case vmIntrinsics::_updateCRC32:
597 case vmIntrinsics::_updateBytesCRC32:
598 case vmIntrinsics::_updateByteBufferCRC32:
599 if (!UseCRC32Intrinsics) return true;
600 break;
601 case vmIntrinsics::_getReference:
602 case vmIntrinsics::_getBoolean:
603 case vmIntrinsics::_getByte:
604 case vmIntrinsics::_getShort:
605 case vmIntrinsics::_getChar:
606 case vmIntrinsics::_getInt:
607 case vmIntrinsics::_getLong:
608 case vmIntrinsics::_getFloat:
609 case vmIntrinsics::_getDouble:
610 case vmIntrinsics::_putReference:
611 case vmIntrinsics::_putBoolean:
612 case vmIntrinsics::_putByte:
613 case vmIntrinsics::_putShort:
614 case vmIntrinsics::_putChar:
615 case vmIntrinsics::_putInt:
616 case vmIntrinsics::_putLong:
617 case vmIntrinsics::_putFloat:
618 case vmIntrinsics::_putDouble:
619 case vmIntrinsics::_getReferenceVolatile:
620 case vmIntrinsics::_getBooleanVolatile:
621 case vmIntrinsics::_getByteVolatile:
622 case vmIntrinsics::_getShortVolatile:
623 case vmIntrinsics::_getCharVolatile:
624 case vmIntrinsics::_getIntVolatile:
625 case vmIntrinsics::_getLongVolatile:
626 case vmIntrinsics::_getFloatVolatile:
627 case vmIntrinsics::_getDoubleVolatile:
628 case vmIntrinsics::_putReferenceVolatile:
629 case vmIntrinsics::_putBooleanVolatile:
630 case vmIntrinsics::_putByteVolatile:
631 case vmIntrinsics::_putShortVolatile:
632 case vmIntrinsics::_putCharVolatile:
633 case vmIntrinsics::_putIntVolatile:
634 case vmIntrinsics::_putLongVolatile:
635 case vmIntrinsics::_putFloatVolatile:
636 case vmIntrinsics::_putDoubleVolatile:
637 case vmIntrinsics::_getReferenceAcquire:
638 case vmIntrinsics::_getBooleanAcquire:
|
81 assert(vmIntrinsics::FLAG_LIMIT <= (1 << vmIntrinsics::log2_FLAG_LIMIT), "must fit in this bitfield");
82
83 if (!UseSharedSpaces) {
84 const char* string = &vm_symbol_bodies[0];
85 for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
86 Symbol* sym = SymbolTable::new_permanent_symbol(string, CHECK);
87 _symbols[index] = sym;
88 string += strlen(string); // skip string body
89 string += 1; // skip trailing null
90 }
91
92 _type_signatures[T_BYTE] = byte_signature();
93 _type_signatures[T_CHAR] = char_signature();
94 _type_signatures[T_DOUBLE] = double_signature();
95 _type_signatures[T_FLOAT] = float_signature();
96 _type_signatures[T_INT] = int_signature();
97 _type_signatures[T_LONG] = long_signature();
98 _type_signatures[T_SHORT] = short_signature();
99 _type_signatures[T_BOOLEAN] = bool_signature();
100 _type_signatures[T_VOID] = void_signature();
101 // no single signatures for T_OBJECT, T_VALUETYPE or T_ARRAY
102 #ifdef ASSERT
103 for (int i = (int)T_BOOLEAN; i < (int)T_VOID+1; i++) {
104 Symbol* s = _type_signatures[i];
105 if (s == NULL) continue;
106 BasicType st = signature_type(s);
107 assert(st == i, "");
108 }
109 #endif
110 }
111
112 #ifdef ASSERT
113 // Check for duplicates:
114 for (int i1 = (int)FIRST_SID; i1 < (int)SID_LIMIT; i1++) {
115 Symbol* sym = symbol_at((SID)i1);
116 for (int i2 = (int)FIRST_SID; i2 < i1; i2++) {
117 if (symbol_at((SID)i2) == sym) {
118 tty->print("*** Duplicate VM symbol SIDs %s(%d) and %s(%d): \"",
119 vm_symbol_enum_name((SID)i2), i2,
120 vm_symbol_enum_name((SID)i1), i1);
121 sym->print_symbol_on(tty);
201 it->push(&_type_signatures[i]);
202 }
203 }
204
205 void vmSymbols::serialize(SerializeClosure* soc) {
206 soc->do_region((u_char*)&_symbols[FIRST_SID],
207 (SID_LIMIT - FIRST_SID) * sizeof(_symbols[0]));
208 soc->do_region((u_char*)_type_signatures, sizeof(_type_signatures));
209 }
210
211
212 BasicType vmSymbols::signature_type(const Symbol* s) {
213 assert(s != NULL, "checking");
214 if (s->utf8_length() == 1) {
215 BasicType result = char2type(s->char_at(0));
216 if (is_java_primitive(result) || result == T_VOID) {
217 assert(s == _type_signatures[result], "");
218 return result;
219 }
220 }
221 return s->char_at(0) == 'Q' ? T_VALUETYPE : T_OBJECT;
222 }
223
224
225 static int mid_hint = (int)vmSymbols::FIRST_SID+1;
226
227 #ifndef PRODUCT
228 static int find_sid_calls, find_sid_probes;
229 // (Typical counts are calls=7000 and probes=17000.)
230 #endif
231
232 vmSymbols::SID vmSymbols::find_sid(const Symbol* symbol) {
233 // Handle the majority of misses by a bounds check.
234 // Then, use a binary search over the index.
235 // Expected trip count is less than log2_SID_LIMIT, about eight.
236 // This is slow but acceptable, given that calls are not
237 // dynamically common. (Method*::intrinsic_id has a cache.)
238 NOT_PRODUCT(find_sid_calls++);
239 int min = (int)FIRST_SID, max = (int)SID_LIMIT - 1;
240 SID sid = NO_SID, sid1;
241 int cmp1;
581 case vmIntrinsics::_floatToIntBits:
582 case vmIntrinsics::_doubleToLongBits:
583 case vmIntrinsics::_maxF:
584 case vmIntrinsics::_minF:
585 case vmIntrinsics::_maxD:
586 case vmIntrinsics::_minD:
587 if (!InlineMathNatives) return true;
588 break;
589 case vmIntrinsics::_fmaD:
590 case vmIntrinsics::_fmaF:
591 if (!InlineMathNatives || !UseFMA) return true;
592 break;
593 case vmIntrinsics::_arraycopy:
594 if (!InlineArrayCopy) return true;
595 break;
596 case vmIntrinsics::_updateCRC32:
597 case vmIntrinsics::_updateBytesCRC32:
598 case vmIntrinsics::_updateByteBufferCRC32:
599 if (!UseCRC32Intrinsics) return true;
600 break;
601 case vmIntrinsics::_makePrivateBuffer:
602 case vmIntrinsics::_finishPrivateBuffer:
603 case vmIntrinsics::_getReference:
604 case vmIntrinsics::_getBoolean:
605 case vmIntrinsics::_getByte:
606 case vmIntrinsics::_getShort:
607 case vmIntrinsics::_getChar:
608 case vmIntrinsics::_getInt:
609 case vmIntrinsics::_getLong:
610 case vmIntrinsics::_getFloat:
611 case vmIntrinsics::_getDouble:
612 case vmIntrinsics::_getValue:
613 case vmIntrinsics::_putReference:
614 case vmIntrinsics::_putBoolean:
615 case vmIntrinsics::_putByte:
616 case vmIntrinsics::_putShort:
617 case vmIntrinsics::_putChar:
618 case vmIntrinsics::_putInt:
619 case vmIntrinsics::_putLong:
620 case vmIntrinsics::_putFloat:
621 case vmIntrinsics::_putDouble:
622 case vmIntrinsics::_putValue:
623 case vmIntrinsics::_getReferenceVolatile:
624 case vmIntrinsics::_getBooleanVolatile:
625 case vmIntrinsics::_getByteVolatile:
626 case vmIntrinsics::_getShortVolatile:
627 case vmIntrinsics::_getCharVolatile:
628 case vmIntrinsics::_getIntVolatile:
629 case vmIntrinsics::_getLongVolatile:
630 case vmIntrinsics::_getFloatVolatile:
631 case vmIntrinsics::_getDoubleVolatile:
632 case vmIntrinsics::_putReferenceVolatile:
633 case vmIntrinsics::_putBooleanVolatile:
634 case vmIntrinsics::_putByteVolatile:
635 case vmIntrinsics::_putShortVolatile:
636 case vmIntrinsics::_putCharVolatile:
637 case vmIntrinsics::_putIntVolatile:
638 case vmIntrinsics::_putLongVolatile:
639 case vmIntrinsics::_putFloatVolatile:
640 case vmIntrinsics::_putDoubleVolatile:
641 case vmIntrinsics::_getReferenceAcquire:
642 case vmIntrinsics::_getBooleanAcquire:
|