Mercurial > hg > graal-compiler
changeset 21561:ce2113326bc8
Merge.
line wrap: on
line diff
--- a/graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java Thu May 28 17:13:22 2015 +0200 @@ -72,6 +72,7 @@ CompilationResult compResult = new CompilationResult(); byte[] targetCode = test.generateCode(compResult, codeCache.getTarget(), registerConfig, cc); compResult.setTargetCode(targetCode, targetCode.length); + compResult.setTotalFrameSize(0); InstalledCode code = codeCache.addMethod(method, compResult, null, null);
--- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Thu May 28 17:13:22 2015 +0200 @@ -1282,20 +1282,23 @@ assert inputVal.getKind().getStackKind() == Kind.Int; LIRKind resultKind = LIRKind.derive(inputVal); - OperandSize resultSize; if (toBits > 32) { resultKind = resultKind.changeType(Kind.Long); - resultSize = QWORD; } else { resultKind = resultKind.changeType(Kind.Int); - resultSize = DWORD; } + /* + * Always emit DWORD operations, even if the resultKind is Long. On AMD64, all DWORD + * operations implicitly set the upper half of the register to 0, which is what we want + * anyway. Compared to the QWORD oparations, the encoding of the DWORD operations is + * sometimes one byte shorter. + */ switch (fromBits) { case 8: - return emitConvertOp(resultKind, MOVZXB, resultSize, inputVal); + return emitConvertOp(resultKind, MOVZXB, DWORD, inputVal); case 16: - return emitConvertOp(resultKind, MOVZX, resultSize, inputVal); + return emitConvertOp(resultKind, MOVZX, DWORD, inputVal); case 32: return emitConvertOp(resultKind, MOV, DWORD, inputVal); }
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/alloc/RegisterAllocationConfig.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/alloc/RegisterAllocationConfig.java Thu May 28 17:13:22 2015 +0200 @@ -37,6 +37,36 @@ */ public class RegisterAllocationConfig { + public static final class AllocatableRegisters { + public final Register[] allocatableRegisters; + public final int minRegisterNumber; + public final int maxRegisterNumber; + + public AllocatableRegisters(Register[] allocatableRegisters, int minRegisterNumber, int maxRegisterNumber) { + this.allocatableRegisters = allocatableRegisters; + this.minRegisterNumber = minRegisterNumber; + this.maxRegisterNumber = maxRegisterNumber; + assert verify(allocatableRegisters, minRegisterNumber, maxRegisterNumber); + } + + private static boolean verify(Register[] allocatableRegisters, int minRegisterNumber, int maxRegisterNumber) { + int min = Integer.MAX_VALUE; + int max = Integer.MIN_VALUE; + for (Register reg : allocatableRegisters) { + int number = reg.number; + if (number < min) { + min = number; + } + if (number > max) { + max = number; + } + } + assert minRegisterNumber == min; + assert maxRegisterNumber == max; + return true; + } + } + public static final String ALL_REGISTERS = "<all>"; private static Register findRegister(String name, Register[] all) { @@ -48,7 +78,7 @@ throw new IllegalArgumentException("register " + name + " is not allocatable"); } - private static Register[] initAllocatable(Register[] registers) { + protected Register[] initAllocatable(Register[] registers) { if (RegisterPressure.getValue() != null && !RegisterPressure.getValue().equals(ALL_REGISTERS)) { String[] names = RegisterPressure.getValue().split(","); Register[] regs = new Register[names.length]; @@ -61,11 +91,12 @@ return registers; } - private final RegisterConfig registerConfig; - private final Map<PlatformKind.Key, Register[]> categorized = new HashMap<>(); + protected final RegisterConfig registerConfig; + private final Map<PlatformKind.Key, AllocatableRegisters> categorized = new HashMap<>(); private Register[] cachedRegisters; public RegisterAllocationConfig(RegisterConfig registerConfig) { + assert registerConfig != null; this.registerConfig = registerConfig; } @@ -73,17 +104,19 @@ * Gets the set of registers that can be used by the register allocator for a value of a * particular kind. */ - public Register[] getAllocatableRegisters(PlatformKind kind) { + public AllocatableRegisters getAllocatableRegisters(PlatformKind kind) { PlatformKind.Key key = kind.getKey(); if (categorized.containsKey(key)) { - Register[] val = categorized.get(key); + AllocatableRegisters val = categorized.get(key); return val; } - - Register[] ret = registerConfig.filterAllocatableRegisters(kind, getAllocatableRegisters()); + AllocatableRegisters ret = createAllocatableRegisters(registerConfig.filterAllocatableRegisters(kind, getAllocatableRegisters())); categorized.put(key, ret); return ret; + } + protected AllocatableRegisters createAllocatableRegisters(Register[] registers) { + return new AllocatableRegisters(registers, registers[0].number, registers[registers.length - 1].number); } /**
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Thu May 28 17:13:22 2015 +0200 @@ -311,7 +311,7 @@ } try (Scope s = Debug.scope("LIRStages", nodeLirGen, lir)) { - return emitLowLevel(target, codeEmittingOrder, linearScanOrder, lirGenRes, lirGen, lirSuites); + return emitLowLevel(target, codeEmittingOrder, linearScanOrder, lirGenRes, lirGen, lirSuites, backend.newRegisterAllocationConfig(registerConfig)); } catch (Throwable e) { throw Debug.handle(e); } @@ -321,11 +321,11 @@ } public static <T extends AbstractBlockBase<T>> LIRGenerationResult emitLowLevel(TargetDescription target, List<T> codeEmittingOrder, List<T> linearScanOrder, LIRGenerationResult lirGenRes, - LIRGeneratorTool lirGen, LIRSuites lirSuites) { + LIRGeneratorTool lirGen, LIRSuites lirSuites, RegisterAllocationConfig registerAllocationConfig) { PreAllocationOptimizationContext preAllocOptContext = new PreAllocationOptimizationContext(lirGen); lirSuites.getPreAllocationOptimizationStage().apply(target, lirGenRes, codeEmittingOrder, linearScanOrder, preAllocOptContext); - AllocationContext allocContext = new AllocationContext(lirGen.getSpillMoveFactory()); + AllocationContext allocContext = new AllocationContext(lirGen.getSpillMoveFactory(), registerAllocationConfig); lirSuites.getAllocationStage().apply(target, lirGenRes, codeEmittingOrder, linearScanOrder, allocContext); PostAllocationOptimizationContext postAllocOptContext = new PostAllocationOptimizationContext(lirGen);
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java Thu May 28 17:13:22 2015 +0200 @@ -22,19 +22,8 @@ */ package com.oracle.graal.compiler.target; -import com.oracle.jvmci.code.stack.StackIntrospection; -import com.oracle.jvmci.code.DisassemblerProvider; -import com.oracle.jvmci.code.CompilationResult; -import com.oracle.jvmci.code.CodeCacheProvider; -import com.oracle.jvmci.code.TargetDescription; -import com.oracle.jvmci.code.ForeignCallsProvider; -import com.oracle.jvmci.code.RegisterConfig; -import com.oracle.jvmci.code.CallingConvention; -import com.oracle.jvmci.meta.ConstantReflectionProvider; -import com.oracle.jvmci.meta.MetaAccessProvider; -import com.oracle.jvmci.meta.ForeignCallDescriptor; -import com.oracle.jvmci.meta.ResolvedJavaMethod; import com.oracle.graal.asm.*; +import com.oracle.graal.compiler.common.alloc.*; import com.oracle.graal.compiler.gen.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; @@ -44,7 +33,10 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.tiers.*; import com.oracle.graal.phases.util.*; +import com.oracle.jvmci.code.*; +import com.oracle.jvmci.code.stack.*; import com.oracle.jvmci.common.*; +import com.oracle.jvmci.meta.*; /** * Represents a compiler backend for Graal. @@ -99,6 +91,8 @@ */ public abstract FrameMapBuilder newFrameMapBuilder(RegisterConfig registerConfig); + public abstract RegisterAllocationConfig newRegisterAllocationConfig(RegisterConfig registerConfig); + public abstract FrameMap newFrameMap(RegisterConfig registerConfig); public abstract LIRGeneratorTool newLIRGenerator(CallingConvention cc, LIRGenerationResult lirGenRes);
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Thu May 28 17:13:22 2015 +0200 @@ -42,6 +42,7 @@ import com.oracle.graal.asm.*; import com.oracle.graal.asm.amd64.*; import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag; +import com.oracle.graal.compiler.common.alloc.*; import com.oracle.graal.compiler.gen.*; import com.oracle.graal.compiler.target.*; import com.oracle.graal.hotspot.*; @@ -331,4 +332,10 @@ } } + @Override + public RegisterAllocationConfig newRegisterAllocationConfig(RegisterConfig registerConfig) { + RegisterConfig registerConfigNonNull = registerConfig == null ? getCodeCache().getRegisterConfig() : registerConfig; + return new AMD64HotSpotRegisterAllocationConfig(registerConfigNonNull); + } + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterAllocationConfig.java Thu May 28 17:13:22 2015 +0200 @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.hotspot.amd64; + +import static com.oracle.graal.amd64.AMD64.*; + +import java.util.*; + +import com.oracle.graal.compiler.common.alloc.*; +import com.oracle.jvmci.code.*; + +class AMD64HotSpotRegisterAllocationConfig extends RegisterAllocationConfig { + /** + * Specify priority of register selection within phases of register allocation. Highest priority + * is first. A useful heuristic is to give registers a low priority when they are required by + * machine instructions, like EAX and EDX on I486, and choose no-save registers before + * save-on-call, & save-on-call before save-on-entry. Registers which participate in fixed + * calling sequences should come last. Registers which are used as pairs must fall on an even + * boundary. + * + * Adopted from x86_64.ad. + */ + // @formatter:off + static final Register[] registerAllocationOrder = { + r10, r11, r8, r9, r12, rcx, rbx, rdi, rdx, rsi, rax, rbp, r13, r14, /*r15,*/ /*rsp,*/ + xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, + xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15 + }; + // @formatter:on + + public AMD64HotSpotRegisterAllocationConfig(RegisterConfig registerConfig) { + super(registerConfig); + } + + @Override + protected Register[] initAllocatable(Register[] registers) { + BitSet regMap = new BitSet(registerConfig.getAllocatableRegisters().length); + Register[] regs = super.initAllocatable(registers); + for (Register reg : regs) { + regMap.set(reg.number); + } + + Register[] allocatableRegisters = new Register[regs.length]; + int i = 0; + for (Register reg : registerAllocationOrder) { + if (regMap.get(reg.number)) { + allocatableRegisters[i++] = reg; + } + } + + assert i == allocatableRegisters.length; + return allocatableRegisters; + } + + @Override + protected AllocatableRegisters createAllocatableRegisters(Register[] registers) { + int min = Integer.MAX_VALUE; + int max = Integer.MIN_VALUE; + for (Register reg : registers) { + int number = reg.number; + if (number < min) { + min = number; + } + if (number > max) { + max = number; + } + } + assert min < max; + return new AllocatableRegisters(registers, min, max); + } +}
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Thu May 28 17:13:22 2015 +0200 @@ -45,6 +45,7 @@ import com.oracle.graal.asm.sparc.*; import com.oracle.graal.asm.sparc.SPARCMacroAssembler.ScratchRegister; import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Setx; +import com.oracle.graal.compiler.common.alloc.*; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.meta.*; @@ -383,4 +384,10 @@ return overlap; } } + + @Override + public RegisterAllocationConfig newRegisterAllocationConfig(RegisterConfig registerConfig) { + RegisterConfig registerConfigNonNull = registerConfig == null ? getCodeCache().getRegisterConfig() : registerConfig; + return new RegisterAllocationConfig(registerConfigNonNull); + } }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledRuntimeStub.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledRuntimeStub.java Thu May 28 17:13:22 2015 +0200 @@ -22,9 +22,9 @@ */ package com.oracle.graal.hotspot; -import com.oracle.jvmci.code.CompilationResult; import static com.oracle.graal.hotspot.HotSpotHostBackend.*; +import com.oracle.jvmci.code.*; import com.oracle.jvmci.code.CompilationResult.Call; import com.oracle.jvmci.code.CompilationResult.ConstantReference; import com.oracle.jvmci.code.CompilationResult.DataPatch; @@ -49,7 +49,7 @@ // Stubs cannot be recompiled so they cannot be compiled with // assumptions and there is no point in recording evol_method dependencies - assert compResult.getAssumptions().isEmpty() : "stubs should not use assumptions: " + this; + assert compResult.getAssumptions() == null : "stubs should not use assumptions: " + this; assert compResult.getMethods() == null : "stubs should not record evol_method dependencies: " + this; for (DataPatch data : compResult.getDataPatches()) { @@ -79,6 +79,6 @@ @Override public String toString() { - return String.valueOf(comp.getName()); + return name; } }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java Thu May 28 17:13:22 2015 +0200 @@ -621,13 +621,14 @@ return attributes(asRegister(operand)).isCallerSave(); } - <B extends AbstractBlockBase<B>> void allocate(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory) { + <B extends AbstractBlockBase<B>> void allocate(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory, + RegisterAllocationConfig registerAllocationConfig) { /* * This is the point to enable debug logging for the whole register allocation. */ try (Indent indent = Debug.logAndIndent("LinearScan allocate")) { - AllocationContext context = new AllocationContext(spillMoveFactory); + AllocationContext context = new AllocationContext(spillMoveFactory, registerAllocationConfig); createLifetimeAnalysisPhase().apply(target, lirGenRes, codeEmittingOrder, linearScanOrder, context, false);
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanAssignLocationsPhase.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanAssignLocationsPhase.java Thu May 28 17:13:22 2015 +0200 @@ -22,15 +22,13 @@ */ package com.oracle.graal.lir.alloc.lsra; -import com.oracle.jvmci.code.TargetDescription; -import com.oracle.jvmci.meta.Value; -import com.oracle.jvmci.meta.AllocatableValue; -import static com.oracle.jvmci.code.ValueUtil.*; import static com.oracle.graal.compiler.common.GraalOptions.*; import static com.oracle.graal.lir.LIRValueUtil.*; +import static com.oracle.jvmci.code.ValueUtil.*; import java.util.*; +import com.oracle.graal.compiler.common.alloc.*; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.LIRInstruction.OperandFlag; @@ -39,7 +37,9 @@ import com.oracle.graal.lir.gen.*; import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; import com.oracle.graal.lir.phases.*; +import com.oracle.jvmci.code.*; import com.oracle.jvmci.debug.*; +import com.oracle.jvmci.meta.*; /** * Phase 7: Assign register numbers back to LIR. @@ -53,7 +53,8 @@ } @Override - protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory, + RegisterAllocationConfig registerAllocationConfig) { assignLocations(); } @@ -123,7 +124,7 @@ * is a branch, spill moves are inserted before this branch and so the wrong operand * would be returned (spill moves at block boundaries are not considered in the live * ranges of intervals). - * + * * Solution: use the first opId of the branch target block instead. */ final LIRInstruction instr = allocator.ir.getLIRforBlock(block).get(allocator.ir.getLIRforBlock(block).size() - 1);
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanEliminateSpillMovePhase.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanEliminateSpillMovePhase.java Thu May 28 17:13:22 2015 +0200 @@ -22,14 +22,13 @@ */ package com.oracle.graal.lir.alloc.lsra; -import com.oracle.jvmci.code.TargetDescription; -import com.oracle.jvmci.meta.AllocatableValue; -import static com.oracle.jvmci.code.ValueUtil.*; import static com.oracle.graal.compiler.common.GraalOptions.*; import static com.oracle.graal.lir.LIRValueUtil.*; +import static com.oracle.jvmci.code.ValueUtil.*; import java.util.*; +import com.oracle.graal.compiler.common.alloc.*; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.StandardOp.MoveOp; @@ -38,7 +37,9 @@ import com.oracle.graal.lir.gen.*; import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; import com.oracle.graal.lir.phases.*; +import com.oracle.jvmci.code.*; import com.oracle.jvmci.debug.*; +import com.oracle.jvmci.meta.*; class LinearScanEliminateSpillMovePhase extends AllocationPhase { @@ -57,7 +58,8 @@ } @Override - protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory, + RegisterAllocationConfig registerAllocationConfig) { eliminateSpillMoves(); }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanLifetimeAnalysisPhase.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanLifetimeAnalysisPhase.java Thu May 28 17:13:22 2015 +0200 @@ -68,7 +68,8 @@ } @Override - protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory, + RegisterAllocationConfig registerAllocationConfig) { numberInstructions(); allocator.printLir("Before register allocation", true); computeLocalLiveSets();
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanOptimizeSpillPositionPhase.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanOptimizeSpillPositionPhase.java Thu May 28 17:13:22 2015 +0200 @@ -22,13 +22,12 @@ */ package com.oracle.graal.lir.alloc.lsra; -import com.oracle.jvmci.code.TargetDescription; -import com.oracle.jvmci.meta.AllocatableValue; +import static com.oracle.graal.compiler.common.cfg.AbstractControlFlowGraph.*; import static com.oracle.jvmci.code.ValueUtil.*; -import static com.oracle.graal.compiler.common.cfg.AbstractControlFlowGraph.*; import java.util.*; +import com.oracle.graal.compiler.common.alloc.*; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.LIRInstruction.OperandMode; @@ -36,7 +35,9 @@ import com.oracle.graal.lir.gen.*; import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; import com.oracle.graal.lir.phases.*; +import com.oracle.jvmci.code.*; import com.oracle.jvmci.debug.*; +import com.oracle.jvmci.meta.*; final class LinearScanOptimizeSpillPositionPhase extends AllocationPhase { @@ -50,7 +51,8 @@ } @Override - protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory, + RegisterAllocationConfig registerAllocationConfig) { optimizeSpillPosition(); allocator.printIntervals("After optimize spill position"); }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanPhase.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanPhase.java Thu May 28 17:13:22 2015 +0200 @@ -48,14 +48,15 @@ }); @Override - protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory, + RegisterAllocationConfig registerAllocationConfig) { final LinearScan allocator; if (LinearScanPhase.SSA_LSRA.getValue()) { - allocator = new SSALinearScan(target, lirGenRes, spillMoveFactory, new RegisterAllocationConfig(lirGenRes.getFrameMapBuilder().getRegisterConfig())); + allocator = new SSALinearScan(target, lirGenRes, spillMoveFactory, registerAllocationConfig); } else { - allocator = new LinearScan(target, lirGenRes, spillMoveFactory, new RegisterAllocationConfig(lirGenRes.getFrameMapBuilder().getRegisterConfig())); + allocator = new LinearScan(target, lirGenRes, spillMoveFactory, registerAllocationConfig); } - allocator.allocate(target, lirGenRes, codeEmittingOrder, linearScanOrder, spillMoveFactory); + allocator.allocate(target, lirGenRes, codeEmittingOrder, linearScanOrder, spillMoveFactory, registerAllocationConfig); } }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanRegisterAllocationPhase.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanRegisterAllocationPhase.java Thu May 28 17:13:22 2015 +0200 @@ -22,13 +22,14 @@ */ package com.oracle.graal.lir.alloc.lsra; -import com.oracle.jvmci.code.TargetDescription; import java.util.*; +import com.oracle.graal.compiler.common.alloc.*; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.lir.gen.*; import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; import com.oracle.graal.lir.phases.*; +import com.oracle.jvmci.code.*; import com.oracle.jvmci.debug.*; final class LinearScanRegisterAllocationPhase extends AllocationPhase { @@ -40,7 +41,8 @@ } @Override - protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory, + RegisterAllocationConfig registerAllocationConfig) { allocator.printIntervals("Before register allocation"); allocateRegisters(); allocator.printIntervals("After register allocation");
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanResolveDataFlowPhase.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanResolveDataFlowPhase.java Thu May 28 17:13:22 2015 +0200 @@ -22,16 +22,17 @@ */ package com.oracle.graal.lir.alloc.lsra; -import com.oracle.jvmci.code.TargetDescription; import static com.oracle.graal.compiler.common.GraalOptions.*; import java.util.*; +import com.oracle.graal.compiler.common.alloc.*; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.gen.*; import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; import com.oracle.graal.lir.phases.*; +import com.oracle.jvmci.code.*; import com.oracle.jvmci.debug.*; /** @@ -48,7 +49,8 @@ } @Override - protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory, + RegisterAllocationConfig registerAllocationConfig) { resolveDataFlow(); }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanWalker.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanWalker.java Thu May 28 17:13:22 2015 +0200 @@ -22,15 +22,13 @@ */ package com.oracle.graal.lir.alloc.lsra; -import com.oracle.jvmci.code.Register; -import com.oracle.jvmci.code.BailoutException; -import com.oracle.jvmci.meta.Value; +import static com.oracle.graal.lir.LIRValueUtil.*; import static com.oracle.jvmci.code.CodeUtil.*; import static com.oracle.jvmci.code.ValueUtil.*; -import static com.oracle.graal.lir.LIRValueUtil.*; import java.util.*; +import com.oracle.graal.compiler.common.alloc.RegisterAllocationConfig.AllocatableRegisters; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.compiler.common.util.*; import com.oracle.graal.lir.*; @@ -39,7 +37,9 @@ import com.oracle.graal.lir.alloc.lsra.Interval.RegisterPriority; import com.oracle.graal.lir.alloc.lsra.Interval.SpillState; import com.oracle.graal.lir.alloc.lsra.Interval.State; +import com.oracle.jvmci.code.*; import com.oracle.jvmci.debug.*; +import com.oracle.jvmci.meta.*; /** */ @@ -54,6 +54,10 @@ private MoveResolver moveResolver; // for ordering spill moves + private int minReg; + + private int maxReg; + /** * Only 10% of the lists in {@link #spillIntervals} are actually used. But when they are used, * they can grow quite long. The maximum length observed was 45 (all numbers taken from a @@ -99,10 +103,22 @@ } } + int maxRegisterNumber() { + return maxReg; + } + + int minRegisterNumber() { + return minReg; + } + + boolean isRegisterInRange(int reg) { + return reg >= minRegisterNumber() && reg <= maxRegisterNumber(); + } + void excludeFromUse(Interval i) { Value location = i.location(); int i1 = asRegister(location).number; - if (i1 >= availableRegs[0].number && i1 <= availableRegs[availableRegs.length - 1].number) { + if (isRegisterInRange(i1)) { usePos[i1] = 0; } } @@ -111,7 +127,7 @@ if (usePos != -1) { assert usePos != 0 : "must use excludeFromUse to set usePos to 0"; int i = asRegister(interval.location()).number; - if (i >= availableRegs[0].number && i <= availableRegs[availableRegs.length - 1].number) { + if (isRegisterInRange(i)) { if (this.usePos[i] > usePos) { this.usePos[i] = usePos; } @@ -130,7 +146,7 @@ void setBlockPos(Interval i, int blockPos) { if (blockPos != -1) { int reg = asRegister(i.location()).number; - if (reg >= availableRegs[0].number && reg <= availableRegs[availableRegs.length - 1].number) { + if (isRegisterInRange(reg)) { if (this.blockPos[reg] > blockPos) { this.blockPos[reg] = blockPos; } @@ -700,8 +716,7 @@ Register minFullReg = null; Register maxPartialReg = null; - for (int i = 0; i < availableRegs.length; ++i) { - Register availableReg = availableRegs[i]; + for (Register availableReg : availableRegs) { int number = availableReg.number; if (usePos[number] >= intervalTo) { // this register is free for the full interval @@ -862,7 +877,10 @@ } void initVarsForAlloc(Interval interval) { - availableRegs = allocator.regAllocConfig.getAllocatableRegisters(interval.kind().getPlatformKind()); + AllocatableRegisters allocatableRegisters = allocator.regAllocConfig.getAllocatableRegisters(interval.kind().getPlatformKind()); + availableRegs = allocatableRegisters.allocatableRegisters; + minReg = allocatableRegisters.minRegisterNumber; + maxReg = allocatableRegisters.maxRegisterNumber; } static boolean isMove(LIRInstruction op, Interval from, Interval to) {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LocationMarker.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LocationMarker.java Thu May 28 17:13:22 2015 +0200 @@ -22,17 +22,11 @@ */ package com.oracle.graal.lir.alloc.lsra; -import com.oracle.jvmci.code.RegisterAttributes; -import com.oracle.jvmci.code.ReferenceMap; -import com.oracle.jvmci.code.TargetDescription; -import com.oracle.jvmci.code.Register; -import com.oracle.jvmci.meta.Kind; -import com.oracle.jvmci.meta.Value; -import com.oracle.jvmci.meta.LIRKind; import static com.oracle.jvmci.code.ValueUtil.*; import java.util.*; +import com.oracle.graal.compiler.common.alloc.*; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.LIRInstruction.OperandFlag; @@ -41,7 +35,9 @@ import com.oracle.graal.lir.gen.*; import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; import com.oracle.graal.lir.phases.*; +import com.oracle.jvmci.code.*; import com.oracle.jvmci.debug.*; +import com.oracle.jvmci.meta.*; import com.oracle.jvmci.options.*; /** @@ -58,7 +54,8 @@ } @Override - protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory, + RegisterAllocationConfig registerAllocationConfig) { new Marker<B>(lirGenRes.getLIR(), lirGenRes.getFrameMap()).build(); }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/AllocationPhase.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/AllocationPhase.java Thu May 28 17:13:22 2015 +0200 @@ -22,29 +22,32 @@ */ package com.oracle.graal.lir.phases; -import com.oracle.jvmci.code.TargetDescription; import java.util.*; +import com.oracle.graal.compiler.common.alloc.*; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.lir.gen.*; import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; +import com.oracle.jvmci.code.*; public abstract class AllocationPhase extends LIRPhase<AllocationPhase.AllocationContext> { public static final class AllocationContext { private final SpillMoveFactory spillMoveFactory; + private final RegisterAllocationConfig registerAllocationConfig; - public AllocationContext(SpillMoveFactory spillMoveFactory) { + public AllocationContext(SpillMoveFactory spillMoveFactory, RegisterAllocationConfig registerAllocationConfig) { this.spillMoveFactory = spillMoveFactory; + this.registerAllocationConfig = registerAllocationConfig; } } @Override protected final <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, AllocationContext context) { - run(target, lirGenRes, codeEmittingOrder, linearScanOrder, context.spillMoveFactory); + run(target, lirGenRes, codeEmittingOrder, linearScanOrder, context.spillMoveFactory, context.registerAllocationConfig); } protected abstract <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, - SpillMoveFactory spillMoveFactory); + SpillMoveFactory spillMoveFactory, RegisterAllocationConfig registerAllocationConfig); }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java Thu May 28 17:13:22 2015 +0200 @@ -22,17 +22,13 @@ */ package com.oracle.graal.lir.stackslotalloc; -import com.oracle.jvmci.code.StackSlot; -import com.oracle.jvmci.code.TargetDescription; -import com.oracle.jvmci.code.VirtualStackSlot; -import com.oracle.jvmci.meta.Value; -import com.oracle.jvmci.meta.LIRKind; +import static com.oracle.graal.lir.phases.LIRPhase.Options.*; import static com.oracle.jvmci.code.ValueUtil.*; -import static com.oracle.graal.lir.phases.LIRPhase.Options.*; import java.util.*; import java.util.function.*; +import com.oracle.graal.compiler.common.alloc.*; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.LIRInstruction.OperandFlag; @@ -41,8 +37,10 @@ import com.oracle.graal.lir.gen.*; import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; import com.oracle.graal.lir.phases.*; +import com.oracle.jvmci.code.*; import com.oracle.jvmci.debug.*; import com.oracle.jvmci.debug.Debug.Scope; +import com.oracle.jvmci.meta.*; import com.oracle.jvmci.options.*; /** @@ -72,7 +70,8 @@ private static final DebugTimer AssignSlotsTimer = Debug.timer("LSStackSlotAllocator[AssignSlots]"); @Override - protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory, + RegisterAllocationConfig registerAllocationConfig) { lirGenRes.buildFrameMap(this); }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/SimpleStackSlotAllocator.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/SimpleStackSlotAllocator.java Thu May 28 17:13:22 2015 +0200 @@ -22,19 +22,18 @@ */ package com.oracle.graal.lir.stackslotalloc; -import com.oracle.jvmci.code.StackSlot; -import com.oracle.jvmci.code.TargetDescription; -import com.oracle.jvmci.code.VirtualStackSlot; import static com.oracle.jvmci.code.ValueUtil.*; import java.util.*; +import com.oracle.graal.compiler.common.alloc.*; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.framemap.*; import com.oracle.graal.lir.gen.*; import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; import com.oracle.graal.lir.phases.*; +import com.oracle.jvmci.code.*; import com.oracle.jvmci.common.*; import com.oracle.jvmci.debug.*; import com.oracle.jvmci.debug.Debug.Scope; @@ -42,7 +41,8 @@ public class SimpleStackSlotAllocator extends AllocationPhase implements StackSlotAllocator { @Override - protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory, + RegisterAllocationConfig registerAllocationConfig) { lirGenRes.buildFrameMap(this); }
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CompilationResult.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CompilationResult.java Thu May 28 17:13:22 2015 +0200 @@ -602,11 +602,10 @@ } /** - * Gets a fixed-size {@linkplain Arrays#asList(Object...) view} of the assumptions made during - * compilation. + * Gets the assumptions made during compilation. */ - public Collection<Assumption> getAssumptions() { - return assumptions == null ? Collections.emptyList() : Arrays.asList(assumptions); + public Assumption[] getAssumptions() { + return assumptions; } /** @@ -641,15 +640,14 @@ } /** - * Gets a fixed-size {@linkplain Arrays#asList(Object...) view} of the methods whose bytecodes - * were used as input to the compilation. + * Gets the methods whose bytecodes were used as input to the compilation. * * @return {@code null} if the compilation did not record method dependencies otherwise the * methods whose bytecodes were used as input to the compilation with the first element * being the root method of the compilation */ - public Collection<ResolvedJavaMethod> getMethods() { - return methods == null ? null : Arrays.asList(methods); + public ResolvedJavaMethod[] getMethods() { + return methods; } public DataSection getDataSection() {
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCompiledCode.java Thu May 28 16:39:41 2015 +0200 +++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCompiledCode.java Thu May 28 17:13:22 2015 +0200 @@ -36,6 +36,8 @@ import com.oracle.jvmci.code.CompilationResult.JumpTable; import com.oracle.jvmci.code.CompilationResult.Mark; import com.oracle.jvmci.code.CompilationResult.Site; +import com.oracle.jvmci.meta.Assumptions.Assumption; +import com.oracle.jvmci.meta.*; /** * A {@link CompilationResult} with additional HotSpot-specific information required for installing @@ -43,16 +45,29 @@ */ public abstract class HotSpotCompiledCode { - public final CompilationResult comp; - + public final String name; public final Site[] sites; public final ExceptionHandler[] exceptionHandlers; public final Comment[] comments; + public final Assumption[] assumptions; + + public final byte[] targetCode; + public final int targetCodeSize; public final byte[] dataSection; public final int dataSectionAlignment; public final DataPatch[] dataSectionPatches; + public final int totalFrameSize; + public final int customStackAreaOffset; + + /** + * The list of the methods whose bytecodes were used as input to the compilation. If + * {@code null}, then the compilation did not record method dependencies. Otherwise, the first + * element of this array is the root method of the compilation. + */ + public final ResolvedJavaMethod[] methods; + public static class Comment { public final String text; @@ -65,7 +80,7 @@ } public HotSpotCompiledCode(CompilationResult compResult) { - this.comp = compResult; + name = compResult.getName(); sites = getSortedSites(compResult); if (compResult.getExceptionHandlers().isEmpty()) { exceptionHandlers = null; @@ -90,8 +105,12 @@ comments[i] = new Comment(annotation.position, text); } } + assumptions = compResult.getAssumptions(); assert validateFrames(); + targetCode = compResult.getTargetCode(); + targetCodeSize = compResult.getTargetCodeSize(); + DataSection data = compResult.getDataSection(); data.finalizeLayout(); dataSection = new byte[data.getSectionSize()]; @@ -102,6 +121,11 @@ dataSectionAlignment = data.getSectionAlignment(); dataSectionPatches = patchBuilder.build().toArray(len -> new DataPatch[len]); + + totalFrameSize = compResult.getTotalFrameSize(); + customStackAreaOffset = compResult.getCustomStackAreaOffset(); + + methods = compResult.getMethods(); } /**
--- a/src/share/vm/classfile/systemDictionary.hpp Thu May 28 16:39:41 2015 +0200 +++ b/src/share/vm/classfile/systemDictionary.hpp Thu May 28 17:13:22 2015 +0200 @@ -224,7 +224,6 @@ JVMCI_ONLY(do_klass(DebugInfo_klass, com_oracle_jvmci_code_DebugInfo, Jvmci)) \ JVMCI_ONLY(do_klass(RegisterSaveLayout_klass, com_oracle_jvmci_code_RegisterSaveLayout, Jvmci)) \ JVMCI_ONLY(do_klass(BytecodeFrame_klass, com_oracle_jvmci_code_BytecodeFrame, Jvmci)) \ - JVMCI_ONLY(do_klass(CompilationResult_klass, com_oracle_jvmci_code_CompilationResult, Jvmci)) \ JVMCI_ONLY(do_klass(CompilationResult_Call_klass, com_oracle_jvmci_code_CompilationResult_Call, Jvmci)) \ JVMCI_ONLY(do_klass(CompilationResult_ConstantReference_klass, com_oracle_jvmci_code_CompilationResult_ConstantReference, Jvmci)) \ JVMCI_ONLY(do_klass(CompilationResult_DataPatch_klass, com_oracle_jvmci_code_CompilationResult_DataPatch, Jvmci)) \
--- a/src/share/vm/classfile/vmSymbols.hpp Thu May 28 16:39:41 2015 +0200 +++ b/src/share/vm/classfile/vmSymbols.hpp Thu May 28 17:13:22 2015 +0200 @@ -332,7 +332,6 @@ JVMCI_ONLY(template(com_oracle_jvmci_meta_Assumptions_NoFinalizableSubclass, "com/oracle/jvmci/meta/Assumptions$NoFinalizableSubclass")) \ JVMCI_ONLY(template(com_oracle_jvmci_meta_Assumptions_ConcreteMethod, "com/oracle/jvmci/meta/Assumptions$ConcreteMethod")) \ JVMCI_ONLY(template(com_oracle_jvmci_meta_Assumptions_CallSiteTargetValue, "com/oracle/jvmci/meta/Assumptions$CallSiteTargetValue")) \ - JVMCI_ONLY(template(com_oracle_jvmci_code_CompilationResult, "com/oracle/jvmci/code/CompilationResult")) \ JVMCI_ONLY(template(com_oracle_jvmci_code_CompilationResult_Call, "com/oracle/jvmci/code/CompilationResult$Call")) \ JVMCI_ONLY(template(com_oracle_jvmci_code_CompilationResult_ConstantReference, "com/oracle/jvmci/code/CompilationResult$ConstantReference")) \ JVMCI_ONLY(template(com_oracle_jvmci_code_CompilationResult_DataPatch, "com/oracle/jvmci/code/CompilationResult$DataPatch")) \
--- a/src/share/vm/jvmci/jvmciCodeInstaller.cpp Thu May 28 16:39:41 2015 +0200 +++ b/src/share/vm/jvmci/jvmciCodeInstaller.cpp Thu May 28 17:13:22 2015 +0200 @@ -390,7 +390,7 @@ CompilerThread* compilerThread = thread->is_Compiler_thread() ? thread->as_CompilerThread() : NULL; _oop_recorder = new OopRecorder(&_arena, true); _dependencies = new Dependencies(&_arena, _oop_recorder, compilerThread != NULL ? compilerThread->log() : NULL); - objArrayHandle assumptions = CompilationResult::assumptions(HotSpotCompiledCode::comp(compiled_code)); + objArrayHandle assumptions = HotSpotCompiledCode::assumptions(compiled_code); if (!assumptions.is_null()) { int length = assumptions->length(); for (int i = 0; i < length; ++i) { @@ -413,7 +413,7 @@ } } } - objArrayHandle methods = CompilationResult::methods(HotSpotCompiledCode::comp(compiled_code)); + objArrayHandle methods = HotSpotCompiledCode::methods(compiled_code); if (!methods.is_null()) { int length = methods->length(); for (int i = 0; i < length; ++i) { @@ -451,7 +451,7 @@ JVMCIEnv::CodeInstallResult result; if (!compiled_code->is_a(HotSpotCompiledNmethod::klass())) { - oop stubName = CompilationResult::name(HotSpotCompiledCode::comp(compiled_code_obj)); + oop stubName = HotSpotCompiledCode::name(compiled_code_obj); char* name = strdup(java_lang_String::as_utf8_string(stubName)); cb = RuntimeStub::new_runtime_stub(name, &buffer, @@ -483,7 +483,6 @@ } void CodeInstaller::initialize_fields(oop compiled_code) { - Handle comp_result = HotSpotCompiledCode::comp(compiled_code); if (compiled_code->is_a(HotSpotCompiledNmethod::klass())) { Handle hotspotJavaMethod = HotSpotCompiledNmethod::method(compiled_code); methodHandle method = getMethodFromHotSpotMethod(hotspotJavaMethod()); @@ -497,10 +496,10 @@ _sites_handle = JNIHandles::make_local(HotSpotCompiledCode::sites(compiled_code)); _exception_handlers_handle = JNIHandles::make_local(HotSpotCompiledCode::exceptionHandlers(compiled_code)); - _code_handle = JNIHandles::make_local(CompilationResult::targetCode(comp_result)); - _code_size = CompilationResult::targetCodeSize(comp_result); - _total_frame_size = CompilationResult::totalFrameSize(comp_result); - _custom_stack_area_offset = CompilationResult::customStackAreaOffset(comp_result); + _code_handle = JNIHandles::make_local(HotSpotCompiledCode::targetCode(compiled_code)); + _code_size = HotSpotCompiledCode::targetCodeSize(compiled_code); + _total_frame_size = HotSpotCompiledCode::totalFrameSize(compiled_code); + _custom_stack_area_offset = HotSpotCompiledCode::customStackAreaOffset(compiled_code); // Pre-calculate the constants section size. This is required for PC-relative addressing. _data_section_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSection(compiled_code));
--- a/src/share/vm/jvmci/jvmciCompilerToVM.cpp Thu May 28 16:39:41 2015 +0200 +++ b/src/share/vm/jvmci/jvmciCompilerToVM.cpp Thu May 28 17:13:22 2015 +0200 @@ -502,7 +502,6 @@ assert(installed_code_handle->is_a(InstalledCode::klass()), "wrong type"); InstalledCode::set_address(installed_code_handle, (jlong) cb); InstalledCode::set_version(installed_code_handle, InstalledCode::version(installed_code_handle) + 1); - oop comp_result = HotSpotCompiledCode::comp(compiled_code_handle); if (installed_code_handle->is_a(HotSpotInstalledCode::klass())) { HotSpotInstalledCode::set_size(installed_code_handle, cb->size()); HotSpotInstalledCode::set_codeStart(installed_code_handle, (jlong) cb->code_begin());
--- a/src/share/vm/jvmci/jvmciJavaAccess.hpp Thu May 28 16:39:41 2015 +0200 +++ b/src/share/vm/jvmci/jvmciJavaAccess.hpp Thu May 28 17:13:22 2015 +0200 @@ -68,13 +68,19 @@ boolean_field(HotSpotNmethod, isDefault) \ end_class \ start_class(HotSpotCompiledCode) \ - oop_field(HotSpotCompiledCode, comp, "Lcom/oracle/jvmci/code/CompilationResult;") \ + oop_field(HotSpotCompiledCode, name, "Ljava/lang/String;") \ objArrayOop_field(HotSpotCompiledCode, sites, "[Lcom/oracle/jvmci/code/CompilationResult$Site;") \ objArrayOop_field(HotSpotCompiledCode, exceptionHandlers, "[Lcom/oracle/jvmci/code/CompilationResult$ExceptionHandler;") \ objArrayOop_field(HotSpotCompiledCode, comments, "[Lcom/oracle/jvmci/hotspot/HotSpotCompiledCode$Comment;") \ + objArrayOop_field(HotSpotCompiledCode, assumptions, "[Lcom/oracle/jvmci/meta/Assumptions$Assumption;") \ + typeArrayOop_field(HotSpotCompiledCode, targetCode, "[B") \ + int_field(HotSpotCompiledCode, targetCodeSize) \ typeArrayOop_field(HotSpotCompiledCode, dataSection, "[B") \ int_field(HotSpotCompiledCode, dataSectionAlignment) \ objArrayOop_field(HotSpotCompiledCode, dataSectionPatches, "[Lcom/oracle/jvmci/code/CompilationResult$DataPatch;") \ + int_field(HotSpotCompiledCode, totalFrameSize) \ + int_field(HotSpotCompiledCode, customStackAreaOffset) \ + objArrayOop_field(HotSpotCompiledCode, methods, "[Lcom/oracle/jvmci/meta/ResolvedJavaMethod;") \ end_class \ start_class(HotSpotCompiledCode_Comment) \ oop_field(HotSpotCompiledCode_Comment, text, "Ljava/lang/String;") \ @@ -90,15 +96,6 @@ start_class(HotSpotForeignCallTarget) \ long_field(HotSpotForeignCallTarget, address) \ end_class \ - start_class(CompilationResult) \ - int_field(CompilationResult, totalFrameSize) \ - int_field(CompilationResult, customStackAreaOffset) \ - oop_field(CompilationResult, name, "Ljava/lang/String;") \ - typeArrayOop_field(CompilationResult, targetCode, "[B") \ - objArrayOop_field(CompilationResult, assumptions, "[Lcom/oracle/jvmci/meta/Assumptions$Assumption;") \ - objArrayOop_field(CompilationResult, methods, "[Lcom/oracle/jvmci/meta/ResolvedJavaMethod;") \ - int_field(CompilationResult, targetCodeSize) \ - end_class \ start_class(Assumptions_NoFinalizableSubclass) \ oop_field(Assumptions_NoFinalizableSubclass, receiverType, "Lcom/oracle/jvmci/meta/ResolvedJavaType;") \ end_class \