/** * Registers the currently running isolate as the AMS isolate. This function * must be called from within the context of a native method. */ void midpRegisterAmsIsolateId(void) { #if ENABLE_MULTIPLE_ISOLATES amsIsolateId = JVM_CurrentIsolateId(); #else amsIsolateId = 0; #endif }
/** * Get the current isolate id from VM in case of MVM mode. * For SVM, simply return 0 as an isolate ID. * * @return isolated : Isolate ID * */ int getCurrentIsolateId() { int amsIsolateId = midpGetAmsIsolateId(); /* * midpGetAmsIsolateId() returns 0 when VM is not running at all. It * also returns 0 when VM is running but it is in SVM mode. * * When VM is running in MVM mode, midpGetAmsIsolateId() returns * isolateID of an AMS isolate */ #if ENABLE_MULTIPLE_ISOLATES return ((amsIsolateId == 0)? 0:JVM_CurrentIsolateId()); #else return amsIsolateId; #endif /* ENABLE_MULTIPLE_ISOLATES */ }