src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotBackend.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotBackend.java	Fri Jul  7 09:30:03 2017
--- new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotBackend.java	Fri Jul  7 09:30:03 2017

*** 57,68 **** --- 57,68 ---- import org.graalvm.compiler.code.DataSection.Data; import org.graalvm.compiler.core.common.CompilationIdentifier; import org.graalvm.compiler.core.common.alloc.RegisterAllocationConfig; import org.graalvm.compiler.core.common.cfg.AbstractBlockBase; import org.graalvm.compiler.core.sparc.SPARCNodeMatchRules; ! import org.graalvm.compiler.debug.Debug; ! import org.graalvm.compiler.debug.DebugCounter; ! import org.graalvm.compiler.debug.CounterKey; ! import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; import org.graalvm.compiler.hotspot.HotSpotDataBuilder; import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider; import org.graalvm.compiler.hotspot.HotSpotHostBackend; import org.graalvm.compiler.hotspot.HotSpotLIRGenerationResult;
*** 115,136 **** --- 115,136 ---- public SPARCHotSpotBackend(GraalHotSpotVMConfig config, HotSpotGraalRuntimeProvider runtime, HotSpotProviders providers) { super(config, runtime, providers); } private static class SizeEstimateStatistics { ! private static final ConcurrentHashMap<String, DebugCounter> counters = new ConcurrentHashMap<>(); ! private static final ConcurrentHashMap<String, CounterKey> counters = new ConcurrentHashMap<>(); private final String suffix; SizeEstimateStatistics(String suffix) { super(); this.suffix = suffix; } ! public void add(Class<?> c, int count, DebugContext debug) { String name = SizeEstimateStatistics.class.getSimpleName() + "_" + c.getSimpleName() + "." + suffix; ! DebugCounter m = counters.computeIfAbsent(name, (n) -> Debug.counter(n)); ! m.add(count); ! CounterKey m = counters.computeIfAbsent(name, (n) -> DebugContext.counter(n)); ! m.add(debug, count); } } @Override public FrameMapBuilder newFrameMapBuilder(RegisterConfig registerConfig) {
*** 237,247 **** --- 237,249 ---- Assembler masm = createAssembler(frameMap); // On SPARC we always use stack frames. HotSpotFrameContext frameContext = new HotSpotFrameContext(stub != null); DataBuilder dataBuilder = new HotSpotDataBuilder(getCodeCache().getTarget()); OptionValues options = lir.getOptions(); ! CompilationResultBuilder crb = factory.createBuilder(getProviders().getCodeCache(), getProviders().getForeignCalls(), frameMap, masm, dataBuilder, frameContext, options, compilationResult); ! DebugContext debug = lir.getDebug(); + CompilationResultBuilder crb = factory.createBuilder(getProviders().getCodeCache(), getProviders().getForeignCalls(), frameMap, masm, dataBuilder, frameContext, options, debug, + compilationResult); crb.setTotalFrameSize(frameMap.totalFrameSize()); crb.setMaxInterpreterFrameSize(gen.getMaxInterpreterFrameSize()); StackSlot deoptimizationRescueSlot = gen.getDeoptimizationRescueSlot(); if (deoptimizationRescueSlot != null && stub == null) { crb.compilationResult.setCustomStackAreaOffset(deoptimizationRescueSlot);
*** 251,276 **** --- 253,283 ---- // Even on sparc we need to save floating point registers EconomicSet<Register> destroyedCallerRegisters = gatherDestroyedCallerRegisters(lir); EconomicMap<LIRFrameState, SaveRegistersOp> calleeSaveInfo = gen.getCalleeSaveInfo(); updateStub(stub, destroyedCallerRegisters, calleeSaveInfo, frameMap); } ! assert registerSizePredictionValidator(crb, debug); return crb; } /** * Registers a verifier which checks if the LIRInstructions estimate of constants size is * greater or equal to the actual one. */ ! private static boolean registerSizePredictionValidator(final CompilationResultBuilder crb, DebugContext debug) { /** * Used to hold state between beforeOp and afterOp */ class ValidationState { LIRInstruction op; + final DebugContext debug; int constantSizeBefore; + ValidationState(DebugContext debug) { + this.debug = debug; + } + public void before(LIRInstruction before) { assert op == null : "LIRInstruction " + op + " no after call received"; op = before; constantSizeBefore = calculateDataSectionSize(crb.compilationResult.getDataSection()); }
*** 281,301 **** --- 288,308 ---- int actual = constantSizeAfter - constantSizeBefore; if (op instanceof SPARCLIRInstructionMixin) { org.graalvm.compiler.lir.sparc.SPARCLIRInstructionMixin.SizeEstimate size = ((SPARCLIRInstructionMixin) op).estimateSize(); assert size != null : "No size prediction available for op: " + op; Class<?> c = op.getClass(); ! CONSTANT_ESTIMATED_STATS.add(c, size.constantSize, debug); ! CONSTANT_ACTUAL_STATS.add(c, actual, debug); assert size.constantSize >= actual : "Op " + op + " exceeded estimated constant size; predicted: " + size.constantSize + " actual: " + actual; } else { assert actual == 0 : "Op " + op + " emitted to DataSection without any estimate."; } op = null; constantSizeBefore = 0; } } ! final ValidationState state = new ValidationState(debug); crb.setOpCallback(op -> state.before(op), op -> state.after(op)); return true; } private static int calculateDataSectionSize(DataSection ds) {

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotBackend.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File