/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
// This workaround is because JVMTI doesn't have distinct entry points
// for methods that use static jfieldIDs and instance jfieldIDs.
// The workaround is to steal a low-order bit:
// a 1 means the jfieldID is an instance jfieldID,
// and the rest of the word is the offset of the field.
// a 0 means the jfieldID is a static jfieldID,
// and the rest of the word is the JNIid*.
//
// Another low-order bit is used to mark if an instance field
// is accompanied by an indication of which class it applies to.
//
// Bit-format of a jfieldID (most significant first):
// address:30 instance=0:1 checked=0:1
// offset:30 instance=1:1 checked=0:1
// klass:23 offset:7 instance=1:1 checked=1:1
//
// If the offset does not fit in 7 bits, or if the fieldID is
// not checked, then the checked bit is zero and the rest of
// the word (30 bits) contains only the offset.
//
private:
enum {
checked_shift = 0,
#ifndef _WIN64
#endif
};
#ifdef _WIN64
// These values are too big for Win64
#endif
// helper routines:
return ((as_uint & checked_mask_in_place) != 0);
}
}
}
public:
return ((as_uint & instance_mask_in_place) != 0);
}
return ((as_uint & instance_mask_in_place) == 0);
}
if (VerifyJNIFields) {
}
#ifndef ASSERT
// always verify in debug mode; switchable in anything else
if (VerifyJNIFields)
#endif // ASSERT
{
}
return result;
}
#ifndef ASSERT
// always verify in debug mode; switchable in anything else
if (VerifyJNIFields)
#endif // ASSERT
{
}
return raw_instance_offset(id);
}
return result;
}
"to_JNIid, but not static jfieldID");
return result;
}
if (is_static) {
} else {
}
}
};
#endif // SHARE_VM_RUNTIME_JFIELDIDWORKAROUND_HPP