1 /* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is [Open Source Virtual Machine].
17 * The Initial Developer of the Original Code is
18 * Adobe System Incorporated.
19 * Portions created by the Initial Developer are Copyright (C) 2004-2007
20 * the Initial Developer. All Rights Reserved.
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
40 #ifndef __nanojit_Native__
41 #define __nanojit_Native__
45 #include "Nativei386.h"
46 #elif defined(NANOJIT_ARM)
48 #include "NativeThumb.h"
50 #include "NativeARM.h"
52 #elif defined(NANOJIT_PPC)
53 #include "NativePpc.h"
54 #elif defined(NANOJIT_AMD64)
55 #include "NativeAMD64.h"
57 #error "unknown nanojit architecture"
61 const uint32_t NJ_PAGE_SIZE
= 1 << NJ_LOG2_PAGE_SIZE
;
79 void addGuard(GuardRecord
* lr
)
87 #ifdef NJ_STACK_GROWTH_UP
88 #define stack_direction(n) n
90 #define stack_direction(n) -n
93 #define isSPorFP(r) ( (r)==SP || (r)==FP )
95 #if defined(_MSC_VER) && _MSC_VER < 1400
96 static void asm_output(const char *f
, ...) {}
97 #define gpn(r) regNames[(r)]
98 #define fpn(r) regNames[(r)]
99 #elif defined(NJ_VERBOSE)
100 #define asm_output(...) do {\
101 counter_increment(native);\
102 if (verbose_enabled()) {\
104 if (outputAddr) sprintf(outline, " %10p ",_nIns);\
105 else sprintf(outline, " ");\
106 sprintf(&outline[14], ##__VA_ARGS__);\
107 Assembler::outputAlign(outline, 45);\
108 RegAlloc::formatRegisters(_allocator, outline, _thisfrag);\
109 Assembler::output_asm(outline);\
110 outputAddr=false; /* set =true if you like to see addresses for each native instruction */ \
112 } while (0) /* no semi */
113 #define gpn(r) regNames[(r)]
114 #define fpn(r) regNames[(r)]
116 #define asm_output(f, ...)
119 #endif /* NJ_VERBOSE */
121 #endif // __nanojit_Native__