src/share/vm/asm/assembler.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2009, 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  *
  23  */
  24 






















  25 // This file contains platform-independent assembler declarations.
  26 
  27 class CodeBuffer;
  28 class MacroAssembler;
  29 class AbstractAssembler;
  30 class Label;
  31 
  32 /**
  33  * Labels represent destinations for control transfer instructions.  Such
  34  * instructions can accept a Label as their target argument.  A Label is
  35  * bound to the current location in the code stream by calling the
  36  * MacroAssembler's 'bind' method, which in turn calls the Label's 'bind'
  37  * method.  A Label may be referenced by an instruction before it's bound
  38  * (i.e., 'forward referenced').  'bind' stores the current code offset
  39  * in the Label object.
  40  *
  41  * If an instruction references a bound Label, the offset field(s) within
  42  * the instruction are immediately filled in based on the Label's code
  43  * offset.  If an instruction references an unbound label, that
  44  * instruction is put on a list of instructions that must be patched


 331   /**
 332    * A platform-dependent method to patch a jump instruction that refers
 333    * to this label.
 334    *
 335    * @param branch the location of the instruction to patch
 336    * @param masm the assembler which generated the branch
 337    */
 338   void pd_patch_instruction(address branch, address target);
 339 
 340 #ifndef PRODUCT
 341   /**
 342    * Platform-dependent method of printing an instruction that needs to be
 343    * patched.
 344    *
 345    * @param branch the instruction to be patched in the buffer.
 346    */
 347   static void pd_print_patched_instruction(address branch);
 348 #endif // PRODUCT
 349 };
 350 
 351 #include "incls/_assembler_pd.hpp.incl"











   1 /*
   2  * Copyright (c) 1997, 2010, 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  *
  23  */
  24 
  25 #ifndef SHARE_VM_ASM_ASSEMBLER_HPP
  26 #define SHARE_VM_ASM_ASSEMBLER_HPP
  27 
  28 #include "code/oopRecorder.hpp"
  29 #include "code/relocInfo.hpp"
  30 #include "memory/allocation.hpp"
  31 #include "utilities/debug.hpp"
  32 #include "utilities/growableArray.hpp"
  33 #include "utilities/top.hpp"
  34 #ifdef TARGET_ARCH_x86
  35 # include "register_x86.hpp"
  36 # include "vm_version_x86.hpp"
  37 #endif
  38 #ifdef TARGET_ARCH_sparc
  39 # include "register_sparc.hpp"
  40 # include "vm_version_sparc.hpp"
  41 #endif
  42 #ifdef TARGET_ARCH_zero
  43 # include "register_zero.hpp"
  44 # include "vm_version_zero.hpp"
  45 #endif
  46 
  47 // This file contains platform-independent assembler declarations.
  48 
  49 class CodeBuffer;
  50 class MacroAssembler;
  51 class AbstractAssembler;
  52 class Label;
  53 
  54 /**
  55  * Labels represent destinations for control transfer instructions.  Such
  56  * instructions can accept a Label as their target argument.  A Label is
  57  * bound to the current location in the code stream by calling the
  58  * MacroAssembler's 'bind' method, which in turn calls the Label's 'bind'
  59  * method.  A Label may be referenced by an instruction before it's bound
  60  * (i.e., 'forward referenced').  'bind' stores the current code offset
  61  * in the Label object.
  62  *
  63  * If an instruction references a bound Label, the offset field(s) within
  64  * the instruction are immediately filled in based on the Label's code
  65  * offset.  If an instruction references an unbound label, that
  66  * instruction is put on a list of instructions that must be patched


 353   /**
 354    * A platform-dependent method to patch a jump instruction that refers
 355    * to this label.
 356    *
 357    * @param branch the location of the instruction to patch
 358    * @param masm the assembler which generated the branch
 359    */
 360   void pd_patch_instruction(address branch, address target);
 361 
 362 #ifndef PRODUCT
 363   /**
 364    * Platform-dependent method of printing an instruction that needs to be
 365    * patched.
 366    *
 367    * @param branch the instruction to be patched in the buffer.
 368    */
 369   static void pd_print_patched_instruction(address branch);
 370 #endif // PRODUCT
 371 };
 372 
 373 #ifdef TARGET_ARCH_x86
 374 # include "assembler_x86.hpp"
 375 #endif
 376 #ifdef TARGET_ARCH_sparc
 377 # include "assembler_sparc.hpp"
 378 #endif
 379 #ifdef TARGET_ARCH_zero
 380 # include "assembler_zero.hpp"
 381 #endif
 382 
 383 
 384 #endif // SHARE_VM_ASM_ASSEMBLER_HPP