Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/back/VirtualMachineImpl.c
38765 views
/*1* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#include "util.h"26#include "VirtualMachineImpl.h"27#include "commonRef.h"28#include "inStream.h"29#include "outStream.h"30#include "eventHandler.h"31#include "eventHelper.h"32#include "threadControl.h"33#include "SDE.h"34#include "FrameID.h"3536static char *versionName = "Java Debug Wire Protocol (Reference Implementation)";37static int majorVersion = 1; /* JDWP major version */38static int minorVersion = 8; /* JDWP minor version */3940static jboolean41version(PacketInputStream *in, PacketOutputStream *out)42{43char buf[500];44char *vmName;45char *vmVersion;46char *vmInfo;4748if (gdata->vmDead) {49outStream_setError(out, JDWP_ERROR(VM_DEAD));50return JNI_TRUE;51}5253vmVersion = gdata->property_java_version;54if (vmVersion == NULL) {55vmVersion = "<unknown>";56}57vmName = gdata->property_java_vm_name;58if (vmName == NULL) {59vmName = "<unknown>";60}61vmInfo = gdata->property_java_vm_info;62if (vmInfo == NULL) {63vmInfo = "<unknown>";64}6566/*67* Write the descriptive version information68*/69(void)snprintf(buf, sizeof(buf),70"%s version %d.%d\nJVM Debug Interface version %d.%d\n"71"JVM version %s (%s, %s)",72versionName, majorVersion, minorVersion,73jvmtiMajorVersion(), jvmtiMinorVersion(),74vmVersion, vmName, vmInfo);75(void)outStream_writeString(out, buf);7677/*78* Write the JDWP version numbers79*/80(void)outStream_writeInt(out, majorVersion);81(void)outStream_writeInt(out, minorVersion);8283/*84* Write the VM version and name85*/86(void)outStream_writeString(out, vmVersion);87(void)outStream_writeString(out, vmName);8889return JNI_TRUE;90}9192static jboolean93classesForSignature(PacketInputStream *in, PacketOutputStream *out)94{95JNIEnv *env;96char *signature;9798if (gdata->vmDead) {99outStream_setError(out, JDWP_ERROR(VM_DEAD));100return JNI_TRUE;101}102103signature = inStream_readString(in);104if (signature == NULL) {105outStream_setError(out, JDWP_ERROR(OUT_OF_MEMORY));106return JNI_TRUE;107}108if (inStream_error(in)) {109return JNI_TRUE;110}111112env = getEnv();113114WITH_LOCAL_REFS(env, 1) {115116jint classCount;117jclass *theClasses;118jvmtiError error;119120error = allLoadedClasses(&theClasses, &classCount);121if ( error == JVMTI_ERROR_NONE ) {122/* Count classes in theClasses which match signature */123int matchCount = 0;124/* Count classes written to the JDWP connection */125int writtenCount = 0;126int i;127128for (i=0; i<classCount; i++) {129jclass clazz = theClasses[i];130jint status = classStatus(clazz);131char *candidate_signature = NULL;132jint wanted =133(JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY|134JVMTI_CLASS_STATUS_PRIMITIVE);135136/* We want prepared classes, primitives, and arrays only */137if ((status & wanted) == 0) {138continue;139}140141error = classSignature(clazz, &candidate_signature, NULL);142if (error != JVMTI_ERROR_NONE) {143break;144}145146if (strcmp(candidate_signature, signature) == 0) {147/* Float interesting classes (those that148* are matching and are prepared) to the149* beginning of the array.150*/151theClasses[i] = theClasses[matchCount];152theClasses[matchCount++] = clazz;153}154jvmtiDeallocate(candidate_signature);155}156157/* At this point matching prepared classes occupy158* indicies 0 thru matchCount-1 of theClasses.159*/160161if ( error == JVMTI_ERROR_NONE ) {162(void)outStream_writeInt(out, matchCount);163for (; writtenCount < matchCount; writtenCount++) {164jclass clazz = theClasses[writtenCount];165jint status = classStatus(clazz);166jbyte tag = referenceTypeTag(clazz);167(void)outStream_writeByte(out, tag);168(void)outStream_writeObjectRef(env, out, clazz);169(void)outStream_writeInt(out, map2jdwpClassStatus(status));170/* No point in continuing if there's an error */171if (outStream_error(out)) {172break;173}174}175}176177jvmtiDeallocate(theClasses);178}179180if ( error != JVMTI_ERROR_NONE ) {181outStream_setError(out, map2jdwpError(error));182}183184} END_WITH_LOCAL_REFS(env);185186jvmtiDeallocate(signature);187188return JNI_TRUE;189}190191static jboolean192allClasses1(PacketInputStream *in, PacketOutputStream *out, int outputGenerics)193{194JNIEnv *env;195196if (gdata->vmDead) {197outStream_setError(out, JDWP_ERROR(VM_DEAD));198return JNI_TRUE;199}200201env = getEnv();202203WITH_LOCAL_REFS(env, 1) {204205jint classCount;206jclass *theClasses;207jvmtiError error;208209error = allLoadedClasses(&theClasses, &classCount);210if ( error != JVMTI_ERROR_NONE ) {211outStream_setError(out, map2jdwpError(error));212} else {213/* Count classes in theClasses which are prepared */214int prepCount = 0;215/* Count classes written to the JDWP connection */216int writtenCount = 0;217int i;218219for (i=0; i<classCount; i++) {220jclass clazz = theClasses[i];221jint status = classStatus(clazz);222jint wanted =223(JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY);224225/* We want prepared classes and arrays only */226if ((status & wanted) != 0) {227/* Float interesting classes (those that228* are prepared) to the beginning of the array.229*/230theClasses[i] = theClasses[prepCount];231theClasses[prepCount++] = clazz;232}233}234235/* At this point prepared classes occupy236* indicies 0 thru prepCount-1 of theClasses.237*/238239(void)outStream_writeInt(out, prepCount);240for (; writtenCount < prepCount; writtenCount++) {241char *signature = NULL;242char *genericSignature = NULL;243jclass clazz = theClasses[writtenCount];244jint status = classStatus(clazz);245jbyte tag = referenceTypeTag(clazz);246jvmtiError error;247248error = classSignature(clazz, &signature, &genericSignature);249if (error != JVMTI_ERROR_NONE) {250outStream_setError(out, map2jdwpError(error));251break;252}253254(void)outStream_writeByte(out, tag);255(void)outStream_writeObjectRef(env, out, clazz);256(void)outStream_writeString(out, signature);257if (outputGenerics == 1) {258writeGenericSignature(out, genericSignature);259}260261(void)outStream_writeInt(out, map2jdwpClassStatus(status));262jvmtiDeallocate(signature);263if (genericSignature != NULL) {264jvmtiDeallocate(genericSignature);265}266267/* No point in continuing if there's an error */268if (outStream_error(out)) {269break;270}271}272jvmtiDeallocate(theClasses);273}274275} END_WITH_LOCAL_REFS(env);276277return JNI_TRUE;278}279280static jboolean281allClasses(PacketInputStream *in, PacketOutputStream *out)282{283return allClasses1(in, out, 0);284}285286static jboolean287allClassesWithGeneric(PacketInputStream *in, PacketOutputStream *out)288{289return allClasses1(in, out, 1);290}291292/***********************************************************/293294295static jboolean296instanceCounts(PacketInputStream *in, PacketOutputStream *out)297{298jint classCount;299jclass *classes;300JNIEnv *env;301int ii;302303if (gdata->vmDead) {304outStream_setError(out, JDWP_ERROR(VM_DEAD));305return JNI_TRUE;306}307308classCount = inStream_readInt(in);309310if (inStream_error(in)) {311return JNI_TRUE;312}313if (classCount == 0) {314(void)outStream_writeInt(out, 0);315return JNI_TRUE;316}317if (classCount < 0) {318outStream_setError(out, JDWP_ERROR(ILLEGAL_ARGUMENT));319return JNI_TRUE;320}321env = getEnv();322classes = jvmtiAllocate(classCount * (int)sizeof(jclass));323for (ii = 0; ii < classCount; ii++) {324jdwpError errorCode;325classes[ii] = inStream_readClassRef(env, in);326errorCode = inStream_error(in);327if (errorCode != JDWP_ERROR(NONE)) {328/*329* A class could have been unloaded/gc'd so330* if we get an error, just ignore it and keep331* going. An instanceCount of 0 will be returned.332*/333if (errorCode == JDWP_ERROR(INVALID_OBJECT) ||334errorCode == JDWP_ERROR(INVALID_CLASS)) {335inStream_clearError(in);336classes[ii] = NULL;337continue;338}339jvmtiDeallocate(classes);340return JNI_TRUE;341}342}343344WITH_LOCAL_REFS(env, 1) {345jlong *counts;346jvmtiError error;347348counts = jvmtiAllocate(classCount * (int)sizeof(jlong));349/* Iterate over heap getting info on these classes */350error = classInstanceCounts(classCount, classes, counts);351if (error != JVMTI_ERROR_NONE) {352outStream_setError(out, map2jdwpError(error));353} else {354(void)outStream_writeInt(out, classCount);355for (ii = 0; ii < classCount; ii++) {356(void)outStream_writeLong(out, counts[ii]);357}358}359jvmtiDeallocate(counts);360} END_WITH_LOCAL_REFS(env);361jvmtiDeallocate(classes);362return JNI_TRUE;363}364365static jboolean366redefineClasses(PacketInputStream *in, PacketOutputStream *out)367{368jvmtiClassDefinition *classDefs;369jboolean ok = JNI_TRUE;370jint classCount;371jint i;372JNIEnv *env;373374if (gdata->vmDead) {375/* quietly ignore */376return JNI_TRUE;377}378379classCount = inStream_readInt(in);380if (inStream_error(in)) {381return JNI_TRUE;382}383if ( classCount == 0 ) {384return JNI_TRUE;385}386/*LINTED*/387classDefs = jvmtiAllocate(classCount*(int)sizeof(jvmtiClassDefinition));388if (classDefs == NULL) {389outStream_setError(out, JDWP_ERROR(OUT_OF_MEMORY));390return JNI_TRUE;391}392/*LINTED*/393(void)memset(classDefs, 0, classCount*sizeof(jvmtiClassDefinition));394395env = getEnv();396for (i = 0; i < classCount; ++i) {397int byteCount;398unsigned char * bytes;399jclass clazz;400401clazz = inStream_readClassRef(env, in);402if (inStream_error(in)) {403ok = JNI_FALSE;404break;405}406byteCount = inStream_readInt(in);407if (inStream_error(in)) {408ok = JNI_FALSE;409break;410}411if ( byteCount <= 0 ) {412outStream_setError(out, JDWP_ERROR(INVALID_CLASS_FORMAT));413ok = JNI_FALSE;414break;415}416bytes = (unsigned char *)jvmtiAllocate(byteCount);417if (bytes == NULL) {418outStream_setError(out, JDWP_ERROR(OUT_OF_MEMORY));419ok = JNI_FALSE;420break;421}422(void)inStream_readBytes(in, byteCount, (jbyte *)bytes);423if (inStream_error(in)) {424ok = JNI_FALSE;425break;426}427428classDefs[i].klass = clazz;429classDefs[i].class_byte_count = byteCount;430classDefs[i].class_bytes = bytes;431}432433if (ok == JNI_TRUE) {434jvmtiError error;435436error = JVMTI_FUNC_PTR(gdata->jvmti,RedefineClasses)437(gdata->jvmti, classCount, classDefs);438if (error != JVMTI_ERROR_NONE) {439outStream_setError(out, map2jdwpError(error));440} else {441/* zap our BP info */442for ( i = 0 ; i < classCount; i++ ) {443eventHandler_freeClassBreakpoints(classDefs[i].klass);444}445}446}447448/* free up allocated memory */449for ( i = 0 ; i < classCount; i++ ) {450if ( classDefs[i].class_bytes != NULL ) {451jvmtiDeallocate((void*)classDefs[i].class_bytes);452}453}454jvmtiDeallocate(classDefs);455456return JNI_TRUE;457}458459static jboolean460setDefaultStratum(PacketInputStream *in, PacketOutputStream *out)461{462char *stratumId;463464if (gdata->vmDead) {465/* quietly ignore */466return JNI_TRUE;467}468469stratumId = inStream_readString(in);470if (inStream_error(in)) {471return JNI_TRUE;472} else if (strcmp(stratumId, "") == 0) {473stratumId = NULL;474}475setGlobalStratumId(stratumId);476477return JNI_TRUE;478}479480static jboolean481getAllThreads(PacketInputStream *in, PacketOutputStream *out)482{483JNIEnv *env;484485if (gdata->vmDead) {486outStream_setError(out, JDWP_ERROR(VM_DEAD));487return JNI_TRUE;488}489490env = getEnv();491492WITH_LOCAL_REFS(env, 1) {493494int i;495jint threadCount;496jthread *theThreads;497498theThreads = allThreads(&threadCount);499if (theThreads == NULL) {500outStream_setError(out, JDWP_ERROR(OUT_OF_MEMORY));501} else {502/* Squish out all of the debugger-spawned threads */503threadCount = filterDebugThreads(theThreads, threadCount);504505(void)outStream_writeInt(out, threadCount);506for (i = 0; i <threadCount; i++) {507(void)outStream_writeObjectRef(env, out, theThreads[i]);508}509510jvmtiDeallocate(theThreads);511}512513} END_WITH_LOCAL_REFS(env);514515return JNI_TRUE;516}517518static jboolean519topLevelThreadGroups(PacketInputStream *in, PacketOutputStream *out)520{521JNIEnv *env;522523if (gdata->vmDead) {524outStream_setError(out, JDWP_ERROR(VM_DEAD));525return JNI_TRUE;526}527528env = getEnv();529530WITH_LOCAL_REFS(env, 1) {531532jvmtiError error;533jint groupCount;534jthreadGroup *groups;535536groups = NULL;537error = JVMTI_FUNC_PTR(gdata->jvmti,GetTopThreadGroups)538(gdata->jvmti, &groupCount, &groups);539if (error != JVMTI_ERROR_NONE) {540outStream_setError(out, map2jdwpError(error));541} else {542int i;543544(void)outStream_writeInt(out, groupCount);545for (i = 0; i < groupCount; i++) {546(void)outStream_writeObjectRef(env, out, groups[i]);547}548549jvmtiDeallocate(groups);550}551552} END_WITH_LOCAL_REFS(env);553554return JNI_TRUE;555}556557static jboolean558dispose(PacketInputStream *in, PacketOutputStream *out)559{560return JNI_TRUE;561}562563static jboolean564idSizes(PacketInputStream *in, PacketOutputStream *out)565{566(void)outStream_writeInt(out, sizeof(jfieldID)); /* fields */567(void)outStream_writeInt(out, sizeof(jmethodID)); /* methods */568(void)outStream_writeInt(out, sizeof(jlong)); /* objects */569(void)outStream_writeInt(out, sizeof(jlong)); /* referent types */570(void)outStream_writeInt(out, sizeof(FrameID)); /* frames */571return JNI_TRUE;572}573574static jboolean575suspend(PacketInputStream *in, PacketOutputStream *out)576{577jvmtiError error;578579if (gdata->vmDead) {580outStream_setError(out, JDWP_ERROR(VM_DEAD));581return JNI_TRUE;582}583error = threadControl_suspendAll();584if (error != JVMTI_ERROR_NONE) {585outStream_setError(out, map2jdwpError(error));586}587return JNI_TRUE;588}589590static jboolean591resume(PacketInputStream *in, PacketOutputStream *out)592{593jvmtiError error;594595if (gdata->vmDead) {596outStream_setError(out, JDWP_ERROR(VM_DEAD));597return JNI_TRUE;598}599error = threadControl_resumeAll();600if (error != JVMTI_ERROR_NONE) {601outStream_setError(out, map2jdwpError(error));602}603return JNI_TRUE;604}605606static jboolean607doExit(PacketInputStream *in, PacketOutputStream *out)608{609jint exitCode;610611exitCode = inStream_readInt(in);612if (gdata->vmDead) {613/* quietly ignore */614return JNI_FALSE;615}616617/* We send the reply from here because we are about to exit. */618if (inStream_error(in)) {619outStream_setError(out, inStream_error(in));620}621outStream_sendReply(out);622623forceExit(exitCode);624625/* Shouldn't get here */626JDI_ASSERT(JNI_FALSE);627628/* Shut up the compiler */629return JNI_FALSE;630631}632633static jboolean634createString(PacketInputStream *in, PacketOutputStream *out)635{636JNIEnv *env;637char *cstring;638639if (gdata->vmDead) {640outStream_setError(out, JDWP_ERROR(VM_DEAD));641return JNI_TRUE;642}643644cstring = inStream_readString(in);645if (cstring == NULL) {646outStream_setError(out, JDWP_ERROR(OUT_OF_MEMORY));647return JNI_TRUE;648}649if (inStream_error(in)) {650return JNI_TRUE;651}652653env = getEnv();654655WITH_LOCAL_REFS(env, 1) {656657jstring string;658659string = JNI_FUNC_PTR(env,NewStringUTF)(env, cstring);660if (JNI_FUNC_PTR(env,ExceptionOccurred)(env)) {661outStream_setError(out, JDWP_ERROR(OUT_OF_MEMORY));662} else {663(void)outStream_writeObjectRef(env, out, string);664}665666} END_WITH_LOCAL_REFS(env);667668jvmtiDeallocate(cstring);669670return JNI_TRUE;671}672673static jboolean674capabilities(PacketInputStream *in, PacketOutputStream *out)675{676jvmtiCapabilities caps;677jvmtiError error;678679if (gdata->vmDead) {680outStream_setError(out, JDWP_ERROR(VM_DEAD));681return JNI_TRUE;682}683error = jvmtiGetCapabilities(&caps);684if (error != JVMTI_ERROR_NONE) {685outStream_setError(out, map2jdwpError(error));686return JNI_TRUE;687}688689(void)outStream_writeBoolean(out, (jboolean)caps.can_generate_field_modification_events);690(void)outStream_writeBoolean(out, (jboolean)caps.can_generate_field_access_events);691(void)outStream_writeBoolean(out, (jboolean)caps.can_get_bytecodes);692(void)outStream_writeBoolean(out, (jboolean)caps.can_get_synthetic_attribute);693(void)outStream_writeBoolean(out, (jboolean)caps.can_get_owned_monitor_info);694(void)outStream_writeBoolean(out, (jboolean)caps.can_get_current_contended_monitor);695(void)outStream_writeBoolean(out, (jboolean)caps.can_get_monitor_info);696return JNI_TRUE;697}698699static jboolean700capabilitiesNew(PacketInputStream *in, PacketOutputStream *out)701{702jvmtiCapabilities caps;703jvmtiError error;704705if (gdata->vmDead) {706outStream_setError(out, JDWP_ERROR(VM_DEAD));707return JNI_TRUE;708}709error = jvmtiGetCapabilities(&caps);710if (error != JVMTI_ERROR_NONE) {711outStream_setError(out, map2jdwpError(error));712return JNI_TRUE;713}714715(void)outStream_writeBoolean(out, (jboolean)caps.can_generate_field_modification_events);716(void)outStream_writeBoolean(out, (jboolean)caps.can_generate_field_access_events);717(void)outStream_writeBoolean(out, (jboolean)caps.can_get_bytecodes);718(void)outStream_writeBoolean(out, (jboolean)caps.can_get_synthetic_attribute);719(void)outStream_writeBoolean(out, (jboolean)caps.can_get_owned_monitor_info);720(void)outStream_writeBoolean(out, (jboolean)caps.can_get_current_contended_monitor);721(void)outStream_writeBoolean(out, (jboolean)caps.can_get_monitor_info);722723/* new since JDWP version 1.4 */724(void)outStream_writeBoolean(out, (jboolean)caps.can_redefine_classes);725(void)outStream_writeBoolean(out, (jboolean)JNI_FALSE /* can_add_method */ );726(void)outStream_writeBoolean(out, (jboolean)JNI_FALSE /* can_unrestrictedly_redefine_classes */ );727/* 11: canPopFrames */728(void)outStream_writeBoolean(out, (jboolean)caps.can_pop_frame);729/* 12: canUseInstanceFilters */730(void)outStream_writeBoolean(out, (jboolean)JNI_TRUE);731/* 13: canGetSourceDebugExtension */732(void)outStream_writeBoolean(out, (jboolean)caps.can_get_source_debug_extension);733/* 14: canRequestVMDeathEvent */734(void)outStream_writeBoolean(out, (jboolean)JNI_TRUE);735/* 15: canSetDefaultStratum */736(void)outStream_writeBoolean(out, (jboolean)JNI_TRUE);737/* 16: canGetInstanceInfo */738(void)outStream_writeBoolean(out, (jboolean)caps.can_tag_objects);739/* 17: canRequestMonitorEvents */740(void)outStream_writeBoolean(out, (jboolean)caps.can_generate_monitor_events);741/* 18: canGetMonitorFrameInfo */742(void)outStream_writeBoolean(out, (jboolean)caps.can_get_owned_monitor_stack_depth_info);743/* remaining reserved */744(void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 19 */745/* 20 Can get constant pool information */746(void)outStream_writeBoolean(out, (jboolean)caps.can_get_constant_pool);747/* 21 Can force early return */748(void)outStream_writeBoolean(out, (jboolean)caps.can_force_early_return);749(void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 22 */750(void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 23 */751(void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 24 */752(void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 25 */753(void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 26 */754(void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 27 */755(void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 28 */756(void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 29 */757(void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 30 */758(void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 31 */759(void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 32 */760return JNI_TRUE;761}762763static int764countPaths(char *string) {765int cnt = 1; /* always have one */766char *pos = string;767char *ps;768769ps = gdata->property_path_separator;770if ( ps == NULL ) {771ps = ";";772}773while ((pos = strchr(pos, ps[0])) != NULL) {774++cnt;775++pos;776}777return cnt;778}779780static void781writePaths(PacketOutputStream *out, char *string) {782char *pos;783char *ps;784char *buf;785int npaths;786int i;787788buf = jvmtiAllocate((int)strlen(string)+1);789790npaths = countPaths(string);791(void)outStream_writeInt(out, npaths);792793ps = gdata->property_path_separator;794if ( ps == NULL ) {795ps = ";";796}797798pos = string;799for ( i = 0 ; i < npaths ; i++ ) {800char *psPos;801int plen;802803psPos = strchr(pos, ps[0]);804if ( psPos == NULL ) {805plen = (int)strlen(pos);806} else {807plen = (int)(psPos-pos);808psPos++;809}810(void)memcpy(buf, pos, plen);811buf[plen] = 0;812(void)outStream_writeString(out, buf);813pos = psPos;814}815816jvmtiDeallocate(buf);817}818819820821static jboolean822classPaths(PacketInputStream *in, PacketOutputStream *out)823{824char *ud;825char *bp;826char *cp;827828ud = gdata->property_user_dir;829if ( ud == NULL ) {830ud = "";831}832cp = gdata->property_java_class_path;833if ( cp == NULL ) {834cp = "";835}836bp = gdata->property_sun_boot_class_path;837if ( bp == NULL ) {838bp = "";839}840(void)outStream_writeString(out, ud);841writePaths(out, cp);842writePaths(out, bp);843return JNI_TRUE;844}845846static jboolean847disposeObjects(PacketInputStream *in, PacketOutputStream *out)848{849int i;850int refCount;851jlong id;852int requestCount;853JNIEnv *env;854855if (gdata->vmDead) {856/* quietly ignore */857return JNI_TRUE;858}859860requestCount = inStream_readInt(in);861if (inStream_error(in)) {862return JNI_TRUE;863}864865env = getEnv();866for (i = 0; i < requestCount; i++) {867id = inStream_readObjectID(in);868refCount = inStream_readInt(in);869if (inStream_error(in)) {870return JNI_TRUE;871}872commonRef_releaseMultiple(env, id, refCount);873}874875return JNI_TRUE;876}877878static jboolean879holdEvents(PacketInputStream *in, PacketOutputStream *out)880{881eventHelper_holdEvents();882return JNI_TRUE;883}884885static jboolean886releaseEvents(PacketInputStream *in, PacketOutputStream *out)887{888eventHelper_releaseEvents();889return JNI_TRUE;890}891892void *VirtualMachine_Cmds[] = { (void *)21893,(void *)version894,(void *)classesForSignature895,(void *)allClasses896,(void *)getAllThreads897,(void *)topLevelThreadGroups898,(void *)dispose899,(void *)idSizes900,(void *)suspend901,(void *)resume902,(void *)doExit903,(void *)createString904,(void *)capabilities905,(void *)classPaths906,(void *)disposeObjects907,(void *)holdEvents908,(void *)releaseEvents909,(void *)capabilitiesNew910,(void *)redefineClasses911,(void *)setDefaultStratum912,(void *)allClassesWithGeneric913,(void *)instanceCounts914};915916917