< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/Stub.java

Print this page
rev 56282 : [mq]: graal
   1 /*
   2  * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 104             return false;
 105         }
 106         return allMatch(a, e -> b.contains(e));
 107     }
 108 
 109     public void initDestroyedCallerRegisters(EconomicSet<Register> registers) {
 110         assert registers != null;
 111         assert destroyedCallerRegisters == null || checkRegisterSetEquivalency(registers, destroyedCallerRegisters) : "cannot redefine";
 112         destroyedCallerRegisters = registers;
 113     }
 114 
 115     /**
 116      * Gets the registers destroyed by this stub from a caller's perspective. These are the
 117      * temporaries of this stub and must thus be caller saved by a callers of this stub.
 118      */
 119     public EconomicSet<Register> getDestroyedCallerRegisters() {
 120         assert destroyedCallerRegisters != null : "not yet initialized";
 121         return destroyedCallerRegisters;
 122     }
 123 
 124     /**
 125      * Determines if this stub preserves all registers apart from those it
 126      * {@linkplain #getDestroyedCallerRegisters() destroys}.
 127      */
 128     public boolean preservesRegisters() {
 129         return true;
 130     }
 131 
 132     protected final OptionValues options;
 133     protected final HotSpotProviders providers;
 134 
 135     /**
 136      * Creates a new stub.
 137      *
 138      * @param linkage linkage details for a call to the stub
 139      */
 140     public Stub(OptionValues options, HotSpotProviders providers, HotSpotForeignCallLinkage linkage) {
 141         this.linkage = linkage;
 142         this.options = new OptionValues(options, GraalOptions.TraceInlining, GraalOptions.TraceInliningForStubsAndSnippets.getValue(options));
 143         this.providers = providers;
 144     }
 145 
 146     /**
 147      * Gets the linkage for a call to this stub from compiled code.
 148      */
 149     public HotSpotForeignCallLinkage getLinkage() {


   1 /*
   2  * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 104             return false;
 105         }
 106         return allMatch(a, e -> b.contains(e));
 107     }
 108 
 109     public void initDestroyedCallerRegisters(EconomicSet<Register> registers) {
 110         assert registers != null;
 111         assert destroyedCallerRegisters == null || checkRegisterSetEquivalency(registers, destroyedCallerRegisters) : "cannot redefine";
 112         destroyedCallerRegisters = registers;
 113     }
 114 
 115     /**
 116      * Gets the registers destroyed by this stub from a caller's perspective. These are the
 117      * temporaries of this stub and must thus be caller saved by a callers of this stub.
 118      */
 119     public EconomicSet<Register> getDestroyedCallerRegisters() {
 120         assert destroyedCallerRegisters != null : "not yet initialized";
 121         return destroyedCallerRegisters;
 122     }
 123 
 124     public boolean shouldSaveRegistersAroundCalls() {
 125         return linkage.getEffect() == HotSpotForeignCallLinkage.RegisterEffect.COMPUTES_REGISTERS_KILLED;




 126     }
 127 
 128     protected final OptionValues options;
 129     protected final HotSpotProviders providers;
 130 
 131     /**
 132      * Creates a new stub.
 133      *
 134      * @param linkage linkage details for a call to the stub
 135      */
 136     public Stub(OptionValues options, HotSpotProviders providers, HotSpotForeignCallLinkage linkage) {
 137         this.linkage = linkage;
 138         this.options = new OptionValues(options, GraalOptions.TraceInlining, GraalOptions.TraceInliningForStubsAndSnippets.getValue(options));
 139         this.providers = providers;
 140     }
 141 
 142     /**
 143      * Gets the linkage for a call to this stub from compiled code.
 144      */
 145     public HotSpotForeignCallLinkage getLinkage() {


< prev index next >