Mercurial > hg > truffle
changeset 10601:5acc3f3016b7
Merge.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 02 Jul 2013 14:51:22 +0200 |
parents | e93efe3ba5f4 (current diff) 17c5cc84560b (diff) |
children | b8fe1fe004ec |
files | |
diffstat | 8 files changed, 132 insertions(+), 81 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ExternalCompilationResult.java Tue Jul 02 14:51:05 2013 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ExternalCompilationResult.java Tue Jul 02 14:51:22 2013 +0200 @@ -22,21 +22,40 @@ */ package com.oracle.graal.api.code; +/** + * Represents the output from compiling a method generated by graal, but executing + * in a memory and computational subsystem outside the graal host system. + * + * Output may include the compiled machine code, associated + * data and references, relocation information, deoptimization information, + * as this result is generated from a structure graph on the graal host system. + */ public class ExternalCompilationResult extends CompilationResult { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - private long kernel; + /** + * Address of the point of entry to the external compilation result. + */ + private long entryPoint; public ExternalCompilationResult() { super(); } - public void setKernel(long k) { - kernel = k; + /** + * Set the address for the point of entry to the external compilation result. + * @param addr The address of the entry point. + */ + public void setEntryPoint(long addr) { + entryPoint = addr; } - public long getKernel() { - return kernel; + /** + * Return the address for the point of entry to the external compilation result. + * @return address value + */ + public long getEntryPoint() { + return entryPoint; } }
--- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXTargetMethodAssembler.java Tue Jul 02 14:51:05 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXTargetMethodAssembler.java Tue Jul 02 14:51:22 2013 +0200 @@ -52,7 +52,7 @@ try { if (validDevice) { long kernel = toGPU.generateKernel(graalCompile.getTargetCode(), method.getName()); - graalCompile.setKernel(kernel); + graalCompile.setEntryPoint(kernel); } } catch (Throwable th) { th.printStackTrace();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewArrayNode.java Tue Jul 02 14:51:22 2013 +0200 @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2009, 2011, 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.nodes.java; + +import com.oracle.graal.graph.*; +import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.spi.*; +import com.oracle.graal.nodes.type.*; + +/** + * The {@code AbstractNewArrayNode} is used for all 1-dimensional array allocations. + */ +public class AbstractNewArrayNode extends FixedWithNextNode implements Canonicalizable, Lowerable, ArrayLengthProvider, Node.IterableNodeType { + + @Input private ValueNode length; + private final boolean fillContents; + + @Override + public ValueNode length() { + return length; + } + + /** + * Constructs a new AbstractNewArrayNode. + * + * @param stamp the stamp of the newly created array + * @param length the node that produces the length for this allocation. + * @param fillContents determines whether the array elements should be initialized to zero/null. + */ + protected AbstractNewArrayNode(Stamp stamp, ValueNode length, boolean fillContents) { + super(stamp); + this.length = length; + this.fillContents = fillContents; + } + + /** + * @return <code>true</code> if the elements of the array will be initialized. + */ + public boolean fillContents() { + return fillContents; + } + + /** + * The list of node which produce input for this instruction. + */ + public ValueNode dimension(int index) { + assert index == 0; + return length(); + } + + /** + * The rank of the array allocated by this node, i.e. how many array dimensions. + */ + public int dimensionCount() { + return 1; + } + + @Override + public ValueNode canonical(CanonicalizerTool tool) { + if (usages().isEmpty() && length.integerStamp().isPositive()) { + return null; + } else { + return this; + } + } + + @Override + public void lower(LoweringTool tool, LoweringType loweringType) { + tool.getRuntime().lower(this, tool); + } +}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java Tue Jul 02 14:51:05 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java Tue Jul 02 14:51:22 2013 +0200 @@ -31,21 +31,17 @@ * The {@code DynamicNewArrayNode} is used for allocation of arrays when the type is not a * compile-time constant. */ -public class DynamicNewArrayNode extends FixedWithNextNode implements Canonicalizable, Lowerable, ArrayLengthProvider { +public class DynamicNewArrayNode extends AbstractNewArrayNode implements Canonicalizable { @Input private ValueNode elementType; - @Input private ValueNode length; - private final boolean fillContents; public DynamicNewArrayNode(ValueNode elementType, ValueNode length) { this(elementType, length, true); } public DynamicNewArrayNode(ValueNode elementType, ValueNode length, boolean fillContents) { - super(StampFactory.objectNonNull()); - this.length = length; + super(StampFactory.objectNonNull(), length, fillContents); this.elementType = elementType; - this.fillContents = fillContents; } public ValueNode getElementType() { @@ -53,31 +49,17 @@ } @Override - public ValueNode length() { - return length; - } - - public boolean fillContents() { - return fillContents; - } - - @Override public ValueNode canonical(CanonicalizerTool tool) { if (elementType.isConstant()) { Class<?> elementClass = (Class<?>) elementType.asConstant().asObject(); if (elementClass != null && !(elementClass.equals(void.class))) { ResolvedJavaType javaType = tool.runtime().lookupJavaType(elementClass); - return graph().add(new NewArrayNode(javaType, length, fillContents)); + return graph().add(new NewArrayNode(javaType, length(), fillContents())); } } return this; } - @Override - public void lower(LoweringTool tool, LoweringType loweringType) { - tool.getRuntime().lower(this, tool); - } - @NodeIntrinsic public static native Object newArray(Class<?> componentType, int length); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java Tue Jul 02 14:51:05 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java Tue Jul 02 14:51:22 2013 +0200 @@ -23,25 +23,18 @@ package com.oracle.graal.nodes.java; import com.oracle.graal.api.meta.*; -import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; import com.oracle.graal.nodes.virtual.*; /** - * The {@code NewArrayNode} is used for all 1-dimensional array allocations. + * The {@code NewArrayNode} is used for all array allocations where the element type is know at + * compile time. */ -public class NewArrayNode extends FixedWithNextNode implements Canonicalizable, Lowerable, VirtualizableAllocation, ArrayLengthProvider, Node.IterableNodeType { +public class NewArrayNode extends AbstractNewArrayNode implements VirtualizableAllocation { - @Input private ValueNode length; private final ResolvedJavaType elementType; - private final boolean fillContents; - - @Override - public ValueNode length() { - return length; - } /** * Constructs a new NewArrayNode. @@ -52,25 +45,8 @@ * @param fillContents determines whether the array elements should be initialized to zero/null. */ public NewArrayNode(ResolvedJavaType elementType, ValueNode length, boolean fillContents) { - super(StampFactory.exactNonNull(elementType.getArrayClass())); - this.length = length; + super(StampFactory.exactNonNull(elementType.getArrayClass()), length, fillContents); this.elementType = elementType; - this.fillContents = fillContents; - } - - /** - * @return <code>true</code> if the elements of the array will be initialized. - */ - public boolean fillContents() { - return fillContents; - } - - /** - * The list of node which produce input for this instruction. - */ - public ValueNode dimension(int index) { - assert index == 0; - return length(); } /** @@ -82,27 +58,6 @@ return elementType; } - /** - * The rank of the array allocated by this node, i.e. how many array dimensions. - */ - public int dimensionCount() { - return 1; - } - - @Override - public ValueNode canonical(CanonicalizerTool tool) { - if (usages().isEmpty() && length.integerStamp().isPositive()) { - return null; - } else { - return this; - } - } - - @Override - public void lower(LoweringTool tool, LoweringType loweringType) { - tool.getRuntime().lower(this, tool); - } - @Override public void virtualize(VirtualizerTool tool) { if (length().asConstant() != null) {
--- a/src/gpu/ptx/gpu_ptx.cpp Tue Jul 02 14:51:05 2013 +0200 +++ b/src/gpu/ptx/gpu_ptx.cpp Tue Jul 02 14:51:22 2013 +0200 @@ -164,7 +164,9 @@ gridX, gridY, gridZ, blockX, blockY, blockZ, 0, NULL, NULL, NULL); - tty->print_cr("gpu_ptx::_cuda_cu_launch_kernel(%x): %d", kernel, status); + if (TraceWarpLoading) { + tty->print_cr("gpu_ptx::_cuda_cu_launch_kernel(%x): %d", kernel, status); + } return status == 0; // CUDA_SUCCESS }
--- a/src/share/vm/graal/graalCompilerToVM.cpp Tue Jul 02 14:51:05 2013 +0200 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Tue Jul 02 14:51:22 2013 +0200 @@ -971,8 +971,10 @@ HotSpotInstalledCode::set_codeBlob(installed_code_handle, (jlong) cb); oop comp_result = HotSpotCompiledCode::comp(compiled_code_handle); if (comp_result->is_a(ExternalCompilationResult::klass())) { - tty->print_cr("installCode0: ExternalCompilationResult"); - HotSpotInstalledCode::set_start(installed_code_handle, ExternalCompilationResult::kernel(comp_result)); + if (TraceWarpLoading) { + tty->print_cr("installCode0: ExternalCompilationResult"); + } + HotSpotInstalledCode::set_start(installed_code_handle, ExternalCompilationResult::entryPoint(comp_result)); } else { HotSpotInstalledCode::set_start(installed_code_handle, (jlong) cb->code_begin()); }
--- a/src/share/vm/graal/graalJavaAccess.hpp Tue Jul 02 14:51:05 2013 +0200 +++ b/src/share/vm/graal/graalJavaAccess.hpp Tue Jul 02 14:51:22 2013 +0200 @@ -112,7 +112,7 @@ oop_field(ExceptionHandler, catchType, "Lcom/oracle/graal/api/meta/JavaType;") \ end_class \ start_class(ExternalCompilationResult) \ - long_field(ExternalCompilationResult, kernel) \ + long_field(ExternalCompilationResult, entryPoint) \ end_class \ start_class(CompilationResult) \ int_field(CompilationResult, frameSize) \