# HG changeset patch # User Roland Schatz # Date 1435759616 -7200 # Node ID ae67bd822493fafb7109031b56f053b8ce9c46d7 # Parent dd52addb374d93d18dea22bf98e52a513454b532 jvmci: Move Location.addFrameSize logic from C++ to Java. diff -r dd52addb374d -r ae67bd822493 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMap.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMap.java Tue Jun 30 16:56:46 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMap.java Wed Jul 01 16:06:56 2015 +0200 @@ -326,7 +326,7 @@ } public ReferenceMap initReferenceMap(boolean hasRegisters) { - ReferenceMap refMap = getTarget().createReferenceMap(hasRegisters, frameSize() / getTarget().wordSize); + ReferenceMap refMap = getTarget().createReferenceMap(hasRegisters, frameSize() / getTarget().wordSize, totalFrameSize()); return refMap; } } diff -r dd52addb374d -r ae67bd822493 jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/Location.java --- a/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/Location.java Tue Jun 30 16:56:46 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/Location.java Wed Jul 01 16:06:56 2015 +0200 @@ -30,19 +30,17 @@ public final Register reg; public final int offset; - public final boolean addFrameSize; - private Location(Register reg, int offset, boolean addFrameSize) { + private Location(Register reg, int offset) { this.reg = reg; this.offset = offset; - this.addFrameSize = addFrameSize; } /** * Create a {@link Location} for a register. */ public static Location register(Register reg) { - return new Location(reg, 0, false); + return new Location(reg, 0); } /** @@ -52,14 +50,14 @@ * @param offset the offset in bytes into the vector register */ public static Location subregister(Register reg, int offset) { - return new Location(reg, offset, false); + return new Location(reg, offset); } /** * Create a {@link Location} for a stack slot. */ - public static Location stack(int offset, boolean addFrameSize) { - return new Location(null, offset, addFrameSize); + public static Location stack(int offset) { + return new Location(null, offset); } public boolean isRegister() { @@ -72,20 +70,12 @@ @Override public String toString() { + String regName; if (isRegister()) { - if (offset == 0) { - return reg.name; - } else { - return reg.name + ":" + offset; - } + regName = reg.name + ":"; } else { - if (!addFrameSize) { - return "out:" + offset; - } else if (offset >= 0) { - return "in:" + offset; - } else { - return "stack:" + (-offset); - } + regName = "stack:"; } + return regName + offset; } } diff -r dd52addb374d -r ae67bd822493 jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/TargetDescription.java --- a/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/TargetDescription.java Tue Jun 30 16:56:46 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/TargetDescription.java Wed Jul 01 16:06:56 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -137,5 +137,5 @@ } } - public abstract ReferenceMap createReferenceMap(boolean hasRegisters, int stackSlotCount); + public abstract ReferenceMap createReferenceMap(boolean hasRegisters, int stackSlotCount, int totalFrameSize); } diff -r dd52addb374d -r ae67bd822493 jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotReferenceMap.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotReferenceMap.java Tue Jun 30 16:56:46 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotReferenceMap.java Wed Jul 01 16:06:56 2015 +0200 @@ -41,10 +41,12 @@ private int objectCount; private final TargetDescription target; + private final int totalFrameSize; - public HotSpotReferenceMap(TargetDescription target) { + public HotSpotReferenceMap(TargetDescription target, int totalFrameSize) { this.target = target; this.objectCount = 0; + this.totalFrameSize = totalFrameSize; } @Override @@ -114,12 +116,12 @@ return target.getSizeInBytes(platformKind) / platformKind.getVectorLength(); } - private static Location toLocation(Value v, int offset) { + private Location toLocation(Value v, int offset) { if (isRegister(v)) { return Location.subregister(asRegister(v), offset); } else { StackSlot s = asStackSlot(v); - return Location.stack(s.getRawOffset() + offset, s.getRawAddFrameSize()); + return Location.stack(s.getOffset(totalFrameSize) + offset); } } diff -r dd52addb374d -r ae67bd822493 jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotTargetDescription.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotTargetDescription.java Tue Jun 30 16:56:46 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotTargetDescription.java Wed Jul 01 16:06:56 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -31,7 +31,7 @@ } @Override - public ReferenceMap createReferenceMap(boolean hasRegisters, int stackSlotCount) { - return new HotSpotReferenceMap(this); + public ReferenceMap createReferenceMap(boolean hasRegisters, int stackSlotCount, int totalFrameSize) { + return new HotSpotReferenceMap(this, totalFrameSize); } } diff -r dd52addb374d -r ae67bd822493 src/share/vm/jvmci/jvmciCodeInstaller.cpp --- a/src/share/vm/jvmci/jvmciCodeInstaller.cpp Tue Jun 30 16:56:46 2015 +0200 +++ b/src/share/vm/jvmci/jvmciCodeInstaller.cpp Wed Jul 01 16:06:56 2015 +0200 @@ -81,9 +81,6 @@ return vmReg->next(offset / 4); } else { // stack slot - if (code_Location::addFrameSize(location)) { - offset += total_frame_size; - } assert(offset % 4 == 0, "must be aligned"); return VMRegImpl::stack2reg(offset / 4); } diff -r dd52addb374d -r ae67bd822493 src/share/vm/jvmci/jvmciJavaAccess.hpp --- a/src/share/vm/jvmci/jvmciJavaAccess.hpp Tue Jun 30 16:56:46 2015 +0200 +++ b/src/share/vm/jvmci/jvmciJavaAccess.hpp Wed Jul 01 16:06:56 2015 +0200 @@ -226,7 +226,6 @@ start_class(code_Location) \ oop_field(code_Location, reg, "Ljdk/internal/jvmci/code/Register;") \ int_field(code_Location, offset) \ - boolean_field(code_Location, addFrameSize) \ end_class \ start_class(code_Register) \ int_field(code_Register, number) \