780 @Override 781 public void write(int b) throws IOException { 782 write(new byte[]{(byte) b}, 0, 1); 783 } 784 785 @Override 786 public void flush() throws IOException { 787 compilerToVm.flushDebugOutput(); 788 } 789 }; 790 } 791 792 /** 793 * Collects the current values of all JVMCI benchmark counters, summed up over all threads. 794 */ 795 public long[] collectCounters() { 796 return compilerToVm.collectCounters(); 797 } 798 799 /** 800 * The offset from the origin of an array to the first element. 801 * 802 * @return the offset in bytes 803 */ 804 public int getArrayBaseOffset(JavaKind kind) { 805 switch (kind) { 806 case Boolean: 807 return compilerToVm.ARRAY_BOOLEAN_BASE_OFFSET; 808 case Byte: 809 return compilerToVm.ARRAY_BYTE_BASE_OFFSET; 810 case Char: 811 return compilerToVm.ARRAY_CHAR_BASE_OFFSET; 812 case Short: 813 return compilerToVm.ARRAY_SHORT_BASE_OFFSET; 814 case Int: 815 return compilerToVm.ARRAY_INT_BASE_OFFSET; 816 case Long: 817 return compilerToVm.ARRAY_LONG_BASE_OFFSET; 818 case Float: 819 return compilerToVm.ARRAY_FLOAT_BASE_OFFSET; | 780 @Override 781 public void write(int b) throws IOException { 782 write(new byte[]{(byte) b}, 0, 1); 783 } 784 785 @Override 786 public void flush() throws IOException { 787 compilerToVm.flushDebugOutput(); 788 } 789 }; 790 } 791 792 /** 793 * Collects the current values of all JVMCI benchmark counters, summed up over all threads. 794 */ 795 public long[] collectCounters() { 796 return compilerToVm.collectCounters(); 797 } 798 799 /** 800 * @return the current number of per thread counters. May be set through 801 * {@code -XX:JVMCICompilerSize=} command line option or the 802 * {@link #setCountersSize(int)} call. 803 */ 804 public int getCountersSize() { 805 return compilerToVm.getCountersSize(); 806 } 807 808 /** 809 * Attempt to enlarge the number of per thread counters available. Requires a safepoint so 810 * resizing should be rare to avoid performance effects. 811 * 812 * @param newSize 813 * @return false if the resizing failed 814 */ 815 public boolean setCountersSize(int newSize) { 816 return compilerToVm.setCountersSize(newSize); 817 } 818 819 /** 820 * The offset from the origin of an array to the first element. 821 * 822 * @return the offset in bytes 823 */ 824 public int getArrayBaseOffset(JavaKind kind) { 825 switch (kind) { 826 case Boolean: 827 return compilerToVm.ARRAY_BOOLEAN_BASE_OFFSET; 828 case Byte: 829 return compilerToVm.ARRAY_BYTE_BASE_OFFSET; 830 case Char: 831 return compilerToVm.ARRAY_CHAR_BASE_OFFSET; 832 case Short: 833 return compilerToVm.ARRAY_SHORT_BASE_OFFSET; 834 case Int: 835 return compilerToVm.ARRAY_INT_BASE_OFFSET; 836 case Long: 837 return compilerToVm.ARRAY_LONG_BASE_OFFSET; 838 case Float: 839 return compilerToVm.ARRAY_FLOAT_BASE_OFFSET; |