// simple test for SafeFetchN static void test_safefetchN() { if (CanUseSafeFetchN()) { #ifdef _LP64 const intptr_t v1 = UCONST64(0xABCD00000000ABCD); const intptr_t v2 = UCONST64(0xDEFD00000000DEFD); #else const intptr_t v1 = 0xABCDABCD; const intptr_t v2 = 0xDEFDDEFD; #endif intptr_t dummy = v1; intptr_t* const p_invalid = (intptr_t*) get_segfault_address(); intptr_t* const p_valid = &dummy; intptr_t result_invalid = SafeFetchN(p_invalid, v2); assert(result_invalid == v2, "SafeFetchN error"); intptr_t result_valid = SafeFetchN(p_valid, v2); assert(result_valid == v1, "SafeFetchN error"); } }
uint64_t fingerprint() { // See if we fingerprinted this method already if (mh->constMethod()->fingerprint() != CONST64(0)) { return mh->constMethod()->fingerprint(); } if (mh->size_of_parameters() > max_size_of_parameters ) { _fingerprint = UCONST64(-1); mh->constMethod()->set_fingerprint(_fingerprint); return _fingerprint; } assert( (int)mh->result_type() <= (int)result_feature_mask, "bad result type"); _fingerprint = mh->result_type(); _fingerprint <<= static_feature_size; if (mh->is_static()) _fingerprint |= 1; _shift_count = result_feature_size + static_feature_size; iterate_parameters(); _fingerprint |= ((uint64_t)done_parm) << _shift_count;// mark end of sig mh->constMethod()->set_fingerprint(_fingerprint); return _fingerprint; }
_argcount++; } } public: SlowSignatureHandler(methodHandle method, address from, intptr_t* to, intptr_t *RegArgSig) : NativeSignatureIterator(method) { _from = from; _to = to; _RegArgSignature = RegArgSig; *_RegArgSignature = 0; _argcount = method->is_static() ? 2 : 1; } }; IRT_ENTRY(address, InterpreterRuntime::slow_signature_handler( JavaThread* thread, Method* method, intptr_t* from, intptr_t* to )) methodHandle m(thread, method); assert(m->is_native(), "sanity check"); // handle arguments // Warning: We use reg arg slot 00 temporarily to return the RegArgSignature // back to the code that pops the arguments into the CPU registers SlowSignatureHandler(m, (address)from, m->is_static() ? to+2 : to+1, to).iterate(UCONST64(-1)); // return result handler return Interpreter::result_handler(m->result_type()); IRT_END
: NativeSignatureIterator(method) { _from = from; _to = to; _int_args = to - (method->is_static() ? 14 : 15); _fp_args = to - 9; _fp_identifiers = to - 10; *(int*) _fp_identifiers = 0; _num_int_args = (method->is_static() ? 1 : 0); _num_fp_args = 0; } }; #endif IRT_ENTRY(address, InterpreterRuntime::slow_signature_handler(JavaThread* thread, methodOopDesc* method, intptr_t* from, intptr_t* to)) methodHandle m(thread, (methodOop)method); assert(m->is_native(), "sanity check"); // handle arguments SlowSignatureHandler(m, (address)from, to + 1).iterate(UCONST64(-1)); // return result handler return Interpreter::result_handler(m->result_type()); IRT_END
extern void basic_fatal(const char* msg); //---------------------------------------------------------------------------------------------------- // Special constants for debugging const jint badInt = -3; // generic "bad int" value const long badAddressVal = -2; // generic "bad address" value const long badOopVal = -1; // generic "bad oop" value const intptr_t badHeapOopVal = (intptr_t) CONST64(0x2BAD4B0BBAADBABE); // value used to zap heap after GC const int badHandleValue = 0xBC; // value used to zap vm handle area const int badResourceValue = 0xAB; // value used to zap resource area const int freeBlockPad = 0xBA; // value used to pad freed blocks. const int uninitBlockPad = 0xF1; // value used to zap newly malloc'd blocks. const juint uninitMetaWordVal= 0xf7f7f7f7; // value used to zap newly allocated metachunk const intptr_t badJNIHandleVal = (intptr_t) UCONST64(0xFEFEFEFEFEFEFEFE); // value used to zap jni handle area const juint badHeapWordVal = 0xBAADBABE; // value used to zap heap after GC const juint badMetaWordVal = 0xBAADFADE; // value used to zap metadata heap after GC const int badCodeHeapNewVal= 0xCC; // value used to zap Code heap at allocation const int badCodeHeapFreeVal = 0xDD; // value used to zap Code heap at deallocation // (These must be implemented as #defines because C++ compilers are // not obligated to inline non-integral constants!) #define badAddress ((address)::badAddressVal) #define badOop (cast_to_oop(::badOopVal)) #define badHeapWord (::badHeapWordVal) #define badJNIHandle (cast_to_oop(::badJNIHandleVal)) // Default TaskQueue size is 16K (32-bit) or 128K (64-bit) #define TASKQUEUE_SIZE (NOT_LP64(1<<14) LP64_ONLY(1<<17))