if (VM.TraceStkMaps) { VM.sysWrite("VM_ReferenceMaps-setupJSRsubroutineMap- nested jsrs extraUnusualMap = \n"); extraUnusualMap.showInfo(); VM.sysWrite( "\n"); VM.sysWrite("VM_ReferenceMaps-setupJSRsubroutineMap- nested jsrs thisMap =\n "); thisMap.showInfo(); VM.sysWrite( "\n"); VM.sysWrite("     setupJSRsubroutineMap- nested jsrs end of loop- = \n"); VM.sysWrite("      next jsraddress offset = "); VM.sysWrite(thisJsrAddressOffset); VM.sysWrite("\n      next callers address = "); VM.sysWrite(nextCallerAddress); VM.sysWrite("\n      next machinecodeoffset = "); VM.sysWrite(nextMachineCodeOffset); VM.sysWrite( "\n");
if (VM.TraceStkMaps) { VM.sysWrite("VM_ReferenceMaps-setupJSRsubroutineMap- nested jsrs extraUnusualMap = \n"); extraUnusualMap.showInfo(); VM.sysWrite( "\n"); VM.sysWrite("VM_ReferenceMaps-setupJSRsubroutineMap- nested jsrs thisMap =\n "); thisMap.showInfo(); VM.sysWrite( "\n"); VM.sysWrite("     setupJSRsubroutineMap- nested jsrs end of loop- = \n"); VM.sysWrite("      next jsraddress offset = "); VM.sysWrite(thisJsrAddressOffset); VM.sysWrite("\n      next callers address = "); VM.sysWrite(nextCallerAddress); VM.sysWrite("\n      next machinecodeoffset = "); VM.sysWrite(nextMachineCodeOffset); VM.sysWrite( "\n"); }
  setupJSRSubroutineMap(int frameAddress, int mapid, VM_CompiledMethod compiledMethod)  {    // first clear the  maps in the extraUnusualMap    //    int j = extraUnusualMap.getReferenceMapIndex();    int k = extraUnusualMap.getNonReferenceMapIndex();    int l = extraUnusualMap.getReturnAddressMapIndex();    for ( int i = 0; i <  bytesPerMap; i++,k++,l++)    {         unusualReferenceMaps[j + i] = 0;         unusualReferenceMaps[k + i] = 0;         unusualReferenceMaps[l + i] = 0;    }    // use the mapid to get index of the Unusual Map    //       if (VM.TraceStkMaps)	 {         VM.sysWrite("VM_ReferenceMaps-setupJSRSubroutineMap- mapid = " );         VM.sysWrite( mapid);         VM.sysWrite("   - mapid = " );         VM.sysWrite(- mapid);         VM.sysWrite( "\n");         VM.sysWrite("  -referenceMaps[(- mapid) * bytesPerMap] = " );         VM.sysWrite(referenceMaps[(- mapid) * bytesPerMap]);         VM.sysWrite( "\n");         VM.sysWrite("        unusual mapid index = " );         VM.sysWrite(referenceMaps[(- mapid) * bytesPerMap]&JSR_INDEX_MASK);          VM.sysWrite( "\n");	 }    int unusualMapid = (referenceMaps[(-mapid) * bytesPerMap] & JSR_INDEX_MASK);    // if jsr map is > 127 go search for the right one    if ( unusualMapid == JSR_INDEX_MASK)          unusualMapid = findUnusualMap(-mapid);    VM_UnusualMaps unusualMap = unusualMaps[unusualMapid];    //    unusualMapcopy(unusualMap, -mapid);      // deep copy unusual map into the extra map    unusualMapcopy(unusualMap);      // deep copy unusual map into the extra map    // from the unusual map and the frame - get the location of the jsr invoker    //    int jsrAddressOffset = unusualMap.getReturnAddressOffset();    int callerAddress    = VM_Magic.getMemoryWord(frameAddress + jsrAddressOffset);    // NOTE: -4 is subtracted when the map is determined ie locateGCpoint    // from the invoker address and the code base address - get the machine code offset    //    int machineCodeOffset = callerAddress - VM_Magic.objectAsAddress(compiledMethod.getInstructions());    if (VM.TraceStkMaps)       {        VM.sysWrite("VM_ReferenceMaps-setupJSRMap- inputMapid = ");        VM.sysWrite( mapid);        VM.sysWrite( "\n");        VM.sysWrite("       jsrReturnAddressOffset = ");        VM.sysWrite( jsrAddressOffset);  //        VM.sysWrite( "\n");        VM.sysWrite("       jsr callers address = ");        VM.sysWrite( callerAddress);        VM.sysWrite( "\n");        VM.sysWrite("       machine code offset of caller = ");        VM.sysWrite( machineCodeOffset);        VM.sysWrite( "\n");        if (machineCodeOffset <0)                   VM.sysWrite( "BAD MACHINE CODE OFFSET\n");                      }    // from the machine code offset locate the map for the jsr instruction    //    int jsrMapid = locateGCPoint(machineCodeOffset, compiledMethod.getMethod());    if (VM.TraceStkMaps)       {        VM.sysWrite("VM_ReferenceMaps-setupJSRMap- locateGCpoint returns mapid = ");        VM.sysWrite( jsrMapid);        VM.sysWrite( "\n");       }    // if the invoker was in a jsr (ie nested jsrs)- merge the delta maps of each jsr and    //   compute the new total delta    //    while ( jsrMapid < 0)    {      jsrMapid = -jsrMapid;      if (VM.TraceStkMaps)       {        VM.sysWrite("VM_ReferenceMaps-setupJSRsubroutineMap- outer MapIndex = ");        VM.sysWrite( jsrMapid);        VM.sysWrite("  unusualMapIndex = ");        VM.sysWrite( referenceMaps[jsrMapid]);        VM.sysWrite( "\n");       }      // merge unusual maps- occurs in nested jsr conditions      //  merge each nested delta into the maps of the extraUnusualmap      int unusualMapIndex = JSR_INDEX_MASK & referenceMaps[ jsrMapid*bytesPerMap];      if (unusualMapIndex == JSR_INDEX_MASK)	{        unusualMapIndex = findUnusualMap(jsrMapid);	}      // extraUnusualMap = combineDeltaMaps(jsrMapid, unusualMapid);      extraUnusualMap = combineDeltaMaps(unusualMapIndex);      // locate the next jsr from the current      //      VM_UnusualMaps thisMap = unusualMaps[unusualMapIndex];      int thisJsrAddressOffset = thisMap.getReturnAddressOffset();      int nextCallerAddress    = VM_Magic.getMemoryWord(frameAddress + thisJsrAddressOffset);      int nextMachineCodeOffset = nextCallerAddress - VM_Magic.objectAsAddress(compiledMethod.getInstructions());      jsrMapid = locateGCPoint(nextMachineCodeOffset, compiledMethod.getMethod());      if (VM.TraceStkMaps)         {           VM.sysWrite("VM_ReferenceMaps-setupJSRsubroutineMap- nested jsrs extraUnusualMap = \n");           extraUnusualMap.showInfo();           VM.sysWrite( "\n");           VM.sysWrite("VM_ReferenceMaps-setupJSRsubroutineMap- nested jsrs thisMap =\n ");           thisMap.showInfo();           VM.sysWrite( "\n");           VM.sysWrite("     setupJSRsubroutineMap- nested jsrs end of loop- = \n");           VM.sysWrite("      next jsraddress offset = ");           VM.sysWrite(thisJsrAddressOffset);           VM.sysWrite("\n      next callers address = ");           VM.sysWrite(nextCallerAddress);           VM.sysWrite("\n      next machinecodeoffset = ");           VM.sysWrite(nextMachineCodeOffset);           VM.sysWrite( "\n");	 }    }  // end while    // merge the jsr (unusual )map  with the base level (ie jsr instruction) map(s)    //  the results are stored in mergedReferenceMap and mergedReturnAddresMap    //  as indices in the referenceMaps table    //    finalMergeMaps((jsrMapid * bytesPerMap), extraUnusualMap);    if (VM.TraceStkMaps)         {           VM.sysWrite("VM_ReferenceMaps-setupJSRsubroutineMap- afterfinalMerge extraUnusualMap =\n ");           extraUnusualMap.showInfo();           VM.sysWrite( "\n");           VM.sysWrite("     mergedReferenceMap Index = ");           VM.sysWrite( mergedReferenceMap);           VM.sysWrite( "\n");           VM.sysWrite("     mergedReferenceMap  = ");           showAnUnusualMap(mergedReferenceMap);           VM.sysWrite( unusualReferenceMaps[mergedReferenceMap]);           VM.sysWrite( "\n");           VM.sysWrite("     mergedReturnAddressMap Index = ");           VM.sysWrite( mergedReturnAddressMap);           VM.sysWrite( "\n");           VM.sysWrite("    mergedReturnAddressMap  = ");           VM.sysWrite( unusualReferenceMaps[mergedReturnAddressMap]);           VM.sysWrite( "\n");           showUnusualMapInfo();         }  }