001    /*
002     *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003     *
004     *  This file is licensed to You under the Eclipse Public License (EPL);
005     *  You may not use this file except in compliance with the License. You
006     *  may obtain a copy of the License at
007     *
008     *      http://www.opensource.org/licenses/eclipse-1.0.php
009     *
010     *  See the COPYRIGHT.txt file distributed with this work for information
011     *  regarding copyright ownership.
012     */
013    package org.jikesrvm.ia32;
014    
015    import org.jikesrvm.ArchitectureSpecific;
016    import org.jikesrvm.compilers.common.assembler.ia32.Assembler;
017    import org.jikesrvm.runtime.Entrypoints;
018    import org.jikesrvm.runtime.Magic;
019    
020    /**
021     * Generate a "trampoline" that jumps to the shared lazy compilation stub.
022     * This is then copied into individual TIBs.
023     * <p>
024     * We do this to enable the optimizing compiler to use ptr equality of
025     * target instructions to imply logical (source) equality of target methods.
026     * This is used to perform guarded inlining using the "method test."
027     * Without per-class lazy compilation trampolines, ptr equality of target
028     * instructions does not imply source equality, since both targets may in fact
029     * be the globally shared lazy compilation stub.
030     */
031    public abstract class LazyCompilationTrampoline implements BaselineConstants {
032      public static final ArchitectureSpecific.CodeArray instructions;
033    
034      static {
035        Assembler asm = new ArchitectureSpecific.Assembler(0);
036        asm.emitJMP_Abs(Magic.getTocPointer().plus(Entrypoints.lazyMethodInvokerMethod.getOffset()));
037        instructions = asm.getMachineCodes();
038      }
039    }