# HG changeset patch # User Doug Simon # Date 1368448080 -7200 # Node ID 86fa3d9f9fddaca1896df8c3e0cb9eae9692263d # Parent eade47d311a33a76a332e28db15ca262faa5cfc3 replaced RegisterFinalizerStub with use of RuntimeStubCall diff -r eade47d311a3 -r 86fa3d9f9fdd graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Mon May 13 14:17:35 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Mon May 13 14:28:00 2013 +0200 @@ -54,7 +54,6 @@ import static com.oracle.graal.hotspot.stubs.NewInstanceStub.*; import static com.oracle.graal.hotspot.stubs.NewMultiArrayStub.*; import static com.oracle.graal.hotspot.stubs.OSRMigrationEndStub.*; -import static com.oracle.graal.hotspot.stubs.RegisterFinalizerStub.*; import static com.oracle.graal.hotspot.stubs.StubUtil.*; import static com.oracle.graal.hotspot.stubs.ThreadIsInterruptedStub.*; import static com.oracle.graal.hotspot.stubs.UnwindExceptionToCallerStub.*; @@ -255,14 +254,6 @@ /* ret */ ret(word), /* arg0: thread */ nativeCallingConvention(word, /* arg1: returnAddress */ word)); - addStubCall(REGISTER_FINALIZER, - /* ret */ ret(Kind.Void), - /* arg0: object */ javaCallingConvention(Kind.Object)); - - addCRuntimeCall(REGISTER_FINALIZER_C, config.registerFinalizerAddress, - /* ret */ ret(Kind.Void), - /* arg0: thread */ nativeCallingConvention(word, - /* arg1: object */ Kind.Object)); addStubCall(NEW_ARRAY, /* ret */ ret(Kind.Object), @@ -570,7 +561,6 @@ link(new NewInstanceStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(NEW_INSTANCE))); link(new NewArrayStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(NEW_ARRAY))); link(new NewMultiArrayStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(NEW_MULTI_ARRAY))); - link(new RegisterFinalizerStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(REGISTER_FINALIZER))); link(new ThreadIsInterruptedStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(THREAD_IS_INTERRUPTED))); link(new ExceptionHandlerStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(EXCEPTION_HANDLER))); link(new UnwindExceptionToCallerStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(UNWIND_EXCEPTION_TO_CALLER))); @@ -587,15 +577,16 @@ link(new WriteBarrierPreStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(WRITE_BARRIER_PRE))); link(new WriteBarrierPostStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(WRITE_BARRIER_POST))); - CompilerToVM c2vm = graalRuntime.getCompilerToVM(); - link(new RuntimeCallStub(config.identityHashCodeAddress, IDENTITY_HASHCODE, true, this, replacements, globalStubRegConfig, c2vm)); + linkRuntimeCall(IDENTITY_HASHCODE, config.identityHashCodeAddress, replacements); + linkRuntimeCall(REGISTER_FINALIZER, config.registerFinalizerAddress, replacements); } private static void link(Stub stub) { stub.getLinkage().setStub(stub); } - private void link(RuntimeCallStub stub) { + private void linkRuntimeCall(Descriptor descriptor, long address, Replacements replacements) { + RuntimeCallStub stub = new RuntimeCallStub(address, descriptor, true, this, replacements, globalStubRegConfig, graalRuntime.getCompilerToVM()); HotSpotRuntimeCallTarget linkage = stub.getLinkage(); HotSpotRuntimeCallTarget targetLinkage = stub.getTargetLinkage(); linkage.setStub(stub); diff -r eade47d311a3 -r 86fa3d9f9fdd graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/RegisterFinalizerStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/RegisterFinalizerStub.java Mon May 13 14:17:35 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2012, 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.stubs; - -import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; - -import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor; -import com.oracle.graal.api.code.*; -import com.oracle.graal.graph.Node.ConstantNodeParameter; -import com.oracle.graal.graph.Node.NodeIntrinsic; -import com.oracle.graal.hotspot.*; -import com.oracle.graal.hotspot.meta.*; -import com.oracle.graal.hotspot.nodes.*; -import com.oracle.graal.nodes.java.*; -import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.replacements.*; -import com.oracle.graal.word.*; - -/** - * Stub called from {@link RegisterFinalizerNode}. - */ -public class RegisterFinalizerStub extends CRuntimeStub { - - public RegisterFinalizerStub(final HotSpotRuntime runtime, Replacements replacements, TargetDescription target, HotSpotRuntimeCallTarget linkage) { - super(runtime, replacements, target, linkage); - } - - @Snippet - private static void registerFinalizer(Object object) { - registerFinalizerC(REGISTER_FINALIZER_C, thread(), object); - StubUtil.handlePendingException(false); - } - - public static final Descriptor REGISTER_FINALIZER_C = StubUtil.descriptorFor(RegisterFinalizerStub.class, "registerFinalizerC", false); - - @NodeIntrinsic(CRuntimeCall.class) - public static native void registerFinalizerC(@ConstantNodeParameter Descriptor registerFinalizerC, Word thread, Object object); -}