< prev index next >
src/share/vm/runtime/sharedRuntime.cpp
Print this page
rev 10541 : Adapter sharing fix
@@ -2188,18 +2188,25 @@
// Otherwise _value._fingerprint is the array.
// Remap BasicTypes that are handled equivalently by the adapters.
// These are correct for the current system but someday it might be
// necessary to make this mapping platform dependent.
- static int adapter_encoding(BasicType in) {
+ static int adapter_encoding(BasicType in, bool is_valuetype) {
switch (in) {
case T_BOOLEAN:
case T_BYTE:
case T_SHORT:
- case T_CHAR:
- // There are all promoted to T_INT in the calling convention
+ case T_CHAR: {
+ if (is_valuetype) {
+ // Do not widen value type field types
+ assert(ValueTypePassFieldsAsArgs, "must be enabled");
+ return in;
+ } else {
+ // They are all promoted to T_INT in the calling convention
return T_INT;
+ }
+ }
case T_OBJECT:
case T_VALUETYPE:
case T_ARRAY:
// In other words, we assume that any register good enough for
@@ -2242,21 +2249,38 @@
ptr = _value._fingerprint;
}
// Now pack the BasicTypes with 8 per int
int sig_index = 0;
+ BasicType prev_sbt = T_ILLEGAL;
+ bool is_valuetype = false;
+ int vt_count = 0;
for (int index = 0; index < len; index++) {
int value = 0;
for (int byte = 0; byte < _basic_types_per_int; byte++) {
- int bt = ((sig_index < total_args_passed)
- ? adapter_encoding(sig_bt[sig_index++])
- : 0);
+ int bt = 0;
+ if (sig_index < total_args_passed) {
+ BasicType sbt = sig_bt[sig_index++];
+ if (ValueTypePassFieldsAsArgs && sbt == T_VALUETYPE) {
+ // Found start of value type in signature
+ vt_count++;
+ continue;
+ } else if (sbt == T_VOID && prev_sbt != T_LONG && prev_sbt != T_DOUBLE) {
+ // Found end of value type in signature
+ vt_count--;
+ assert(vt_count >= 0, "invalid vt_count");
+ continue;
+ }
+ bt = adapter_encoding(sbt, vt_count > 0);
+ prev_sbt = sbt;
+ }
assert((bt & _basic_type_mask) == bt, "must fit in 4 bits");
value = (value << _basic_type_bits) | bt;
}
ptr[index] = value;
}
+ assert(vt_count == 0, "invalid vt_count");
}
~AdapterFingerPrint() {
if (_length > 0) {
FREE_C_HEAP_ARRAY(int, _value._fingerprint);
< prev index next >