1 /* src/vm/jit/jit.cpp - Just-In-Time compiler
3 Copyright (C) 1996-2005, 2006, 2007, 2008
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2, or (at
11 your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
35 #include "mm/memory.hpp"
37 #include "native/native.hpp"
39 #include "toolbox/logging.hpp"
41 #include "threads/mutex.hpp"
43 #include "vm/class.hpp"
44 #include "vm/global.h"
45 #include "vm/globals.hpp"
46 #include "vm/initialize.hpp"
47 #include "vm/loader.hpp"
48 #include "vm/method.hpp"
49 #include "vm/options.h"
50 #include "vm/rt-timing.h"
51 #include "vm/statistics.h"
53 #include "vm/jit/asmpart.h"
55 #include "vm/jit/cfg.h"
57 #include "vm/jit/codegen-common.hpp"
58 #include "vm/jit/disass.h"
59 #include "vm/jit/dseg.h"
60 #include "vm/jit/jit.hpp"
61 #include "vm/jit/parse.hpp"
62 #include "vm/jit/reg.h"
64 #include "vm/jit/show.hpp"
65 #include "vm/jit/stack.h"
66 #include "vm/jit/stubs.hpp"
68 #if defined(ENABLE_OPAGENT)
69 #include "vm/jit/oprofile-agent.hpp"
72 #include "vm/jit/allocator/simplereg.h"
73 #if defined(ENABLE_LSRA) && !defined(ENABLE_SSA)
74 # include "vm/jit/allocator/lsra.h"
77 #if defined(ENABLE_SSA)
78 # include "vm/jit/optimizing/lsra.h"
79 # include "vm/jit/optimizing/ssa.h"
82 #if defined(ENABLE_INLINING)
83 # include "vm/jit/inline/inline.hpp"
86 #include "vm/jit/ir/bytecode.h"
88 #include "vm/jit/loop/analyze.h"
89 #include "vm/jit/loop/graph.h"
90 #include "vm/jit/loop/loop.h"
92 #if defined(ENABLE_IFCONV)
93 # include "vm/jit/optimizing/ifconv.h"
96 #include "vm/jit/optimizing/reorder.h"
98 #if defined(ENABLE_PYTHON)
99 # include "vm/jit/python.h"
102 #include "vm/jit/verify/typecheck.hpp"
105 /* debug macros ***************************************************************/
108 #define DEBUG_JIT_COMPILEVERBOSE(x) \
110 if (compileverbose) { \
111 log_message_method(x, m); \
115 #define DEBUG_JIT_COMPILEVERBOSE(x) /* nothing */
119 # define TRACECOMPILERCALLS() \
121 if (opt_TraceCompilerCalls) { \
123 log_print("[JIT compiler started: method="); \
130 # define TRACECOMPILERCALLS()
134 /* jit_init ********************************************************************
136 Initializes the JIT subsystem.
138 *******************************************************************************/
142 TRACESUBSYSTEMINITIALIZATION("jit_init");
144 #if defined(ENABLE_JIT)
145 /* initialize stack analysis subsystem */
150 /* initialize show subsystem */
156 /* initialize codegen subsystem */
160 /* initialize code subsystem */
164 /* Machine dependent initialization. */
166 #if defined(ENABLE_JIT)
167 # if defined(ENABLE_INTRP)
177 #if defined(ENABLE_OPAGENT)
178 if (opt_EnableOpagent)
179 OprofileAgent::initialize();
184 /* jit_close *******************************************************************
186 Close the JIT subsystem.
188 *******************************************************************************/
192 #if defined(ENABLE_OPAGENT)
193 if (opt_EnableOpagent)
194 OprofileAgent::close();
199 /* dummy function, used when there is no JavaVM code available */
201 static u1 *do_nothing_function(void)
207 /* jit_jitdata_new *************************************************************
209 Allocates and initalizes a new jitdata structure.
211 *******************************************************************************/
213 jitdata *jit_jitdata_new(methodinfo *m)
218 /* allocate jitdata structure and fill it */
220 jd = (jitdata*) DumpMemory::allocate(sizeof(jitdata));
223 jd->cd = (codegendata*) DumpMemory::allocate(sizeof(codegendata));
224 jd->rd = (registerdata*) DumpMemory::allocate(sizeof(registerdata));
225 #if defined(ENABLE_LOOP)
226 jd->ld = (loopdata*) DumpMemory::allocate(sizeof(loopdata));
229 /* Allocate codeinfo memory from the heap as we need to keep them. */
231 code = code_codeinfo_new(m);
233 /* Set codeinfo flags. */
235 #if defined(ENABLE_THREADS)
236 if (checksync && (m->flags & ACC_SYNCHRONIZED))
237 code_flag_synchronized(code);
239 if (checksync && (m->flags & ACC_SYNCHRONIZED))
240 code_unflag_leafmethod(code);
243 code_flag_leafmethod(code);
245 /* initialize variables */
249 jd->exceptiontable = NULL;
250 jd->exceptiontablelength = 0;
252 jd->branchtoentry = false;
253 jd->branchtoend = false;
255 jd->returnblock = NULL;
256 jd->maxlocals = m->maxlocals;
262 /* jit_compile *****************************************************************
264 Translates one method to machine code.
266 *******************************************************************************/
268 static u1 *jit_compile_intern(jitdata *jd);
270 u1 *jit_compile(methodinfo *m)
275 STATISTICS(count_jit_calls++);
277 /* Initialize the static function's class. */
279 /* ATTENTION: This MUST be done before the method lock is aquired,
280 otherwise we could run into a deadlock with <clinit>'s that
281 call static methods of it's own class. */
283 if ((m->flags & ACC_STATIC) && !(m->clazz->state & CLASS_INITIALIZED)) {
286 log_message_class("Initialize class ", m->clazz);
289 if (!initialize_class(m->clazz))
292 /* check if the method has been compiled during initialization */
294 if ((m->code != NULL) && (m->code->entrypoint != NULL))
295 return m->code->entrypoint;
298 /* enter a monitor on the method */
302 /* if method has been already compiled return immediately */
304 if (m->code != NULL) {
307 assert(m->code->entrypoint);
308 return m->code->entrypoint;
311 TRACECOMPILERCALLS();
313 STATISTICS(count_methods++);
315 #if defined(ENABLE_STATISTICS)
318 if (opt_getcompilingtime)
319 compilingtime_start();
322 // Create new dump memory area.
325 /* create jitdata structure */
327 jd = jit_jitdata_new(m);
329 /* set the flags for the current JIT run */
331 jd->flags = JITDATA_FLAG_PARSE;
333 #if defined(ENABLE_VERIFIER)
335 jd->flags |= JITDATA_FLAG_VERIFY;
338 #if defined(ENABLE_PROFILING)
340 jd->flags |= JITDATA_FLAG_INSTRUMENT;
343 #if defined(ENABLE_IFCONV)
345 jd->flags |= JITDATA_FLAG_IFCONV;
348 #if defined(ENABLE_INLINING) && defined(ENABLE_INLINING_DEBUG)
349 if (opt_Inline && opt_InlineAll)
350 jd->flags |= JITDATA_FLAG_INLINE;
353 if (opt_showintermediate)
354 jd->flags |= JITDATA_FLAG_SHOWINTERMEDIATE;
356 if (opt_showdisassemble)
357 jd->flags |= JITDATA_FLAG_SHOWDISASSEMBLE;
360 jd->flags |= JITDATA_FLAG_VERBOSECALL;
362 #if defined(ENABLE_REPLACEMENT) && defined(ENABLE_INLINING)
363 if (opt_Inline && (jd->m->hitcountdown > 0) && (jd->code->optlevel == 0)) {
364 jd->flags |= JITDATA_FLAG_COUNTDOWN;
368 #if defined(ENABLE_JIT)
369 # if defined(ENABLE_INTRP)
372 /* initialize the register allocator */
378 /* setup the codegendata memory */
382 /* now call internal compile function */
384 r = jit_compile_intern(jd);
387 /* We had an exception! Finish stuff here if necessary. */
389 /* release codeinfo */
391 code_codeinfo_free(jd->code);
394 DEBUG_JIT_COMPILEVERBOSE("Running: ");
397 #if defined(ENABLE_STATISTICS)
400 if (opt_getcompilingtime)
401 compilingtime_stop();
404 #if defined(ENABLE_OPAGENT)
405 if (opt_EnableOpagent)
406 OprofileAgent::newmethod(m);
409 /* leave the monitor */
413 /* return pointer to the methods entry point */
419 /* jit_recompile ***************************************************************
421 Recompiles a Java method.
423 *******************************************************************************/
425 u1 *jit_recompile(methodinfo *m)
431 /* check for max. optimization level */
433 optlevel = (m->code) ? m->code->optlevel : 0;
437 /* log_message_method("not recompiling: ", m); */
442 DEBUG_JIT_COMPILEVERBOSE("Recompiling start: ");
444 STATISTICS(count_jit_calls++);
446 #if defined(ENABLE_STATISTICS)
449 if (opt_getcompilingtime)
450 compilingtime_start();
453 // Create new dump memory area.
456 /* create jitdata structure */
458 jd = jit_jitdata_new(m);
460 /* set the current optimization level to the previous one plus 1 */
462 jd->code->optlevel = optlevel + 1;
464 /* get the optimization flags for the current JIT run */
466 #if defined(ENABLE_VERIFIER)
467 jd->flags |= JITDATA_FLAG_VERIFY;
470 /* jd->flags |= JITDATA_FLAG_REORDER; */
471 if (opt_showintermediate)
472 jd->flags |= JITDATA_FLAG_SHOWINTERMEDIATE;
473 if (opt_showdisassemble)
474 jd->flags |= JITDATA_FLAG_SHOWDISASSEMBLE;
476 jd->flags |= JITDATA_FLAG_VERBOSECALL;
478 #if defined(ENABLE_INLINING)
480 jd->flags |= JITDATA_FLAG_INLINE;
483 #if defined(ENABLE_JIT)
484 # if defined(ENABLE_INTRP)
487 /* initialize the register allocator */
492 /* setup the codegendata memory */
496 /* now call internal compile function */
498 r = jit_compile_intern(jd);
501 /* We had an exception! Finish stuff here if necessary. */
503 /* release codeinfo */
505 code_codeinfo_free(jd->code);
508 #if defined(ENABLE_STATISTICS)
511 if (opt_getcompilingtime)
512 compilingtime_stop();
515 #if defined(ENABLE_OPAGENT)
516 if (opt_EnableOpagent)
517 OprofileAgent::newmethod(m);
520 DEBUG_JIT_COMPILEVERBOSE("Recompiling done: ");
522 /* return pointer to the methods entry point */
527 #if defined(ENABLE_PM_HACKS)
528 #include "vm/jit/jit_pm_1.inc"
531 /* jit_compile_intern **********************************************************
533 Static internal function which does the actual compilation.
535 *******************************************************************************/
537 static u1 *jit_compile_intern(jitdata *jd)
543 #if defined(ENABLE_RT_TIMING)
544 struct timespec time_start,time_checks,time_parse,time_stack,
545 time_typecheck,time_loop,time_ifconv,time_alloc,
549 RT_TIMING_GET_TIME(time_start);
551 /* get required compiler data */
553 #if defined(ENABLE_LSRA) || defined(ENABLE_SSA)
560 #if defined(ENABLE_DEBUG_FILTER)
561 show_filters_apply(jd->m);
564 // Handle native methods and create a native stub.
565 if (m->flags & ACC_NATIVE) {
566 NativeMethods& nm = VM::get_current()->get_nativemethods();
567 void* f = nm.resolve_method(m);
572 code = NativeStub::generate(m, (functionptr) f);
574 /* Native methods are never recompiled. */
580 return code->entrypoint;
583 /* if there is no javacode, print error message and return empty method */
585 if (m->jcode == NULL) {
586 DEBUG_JIT_COMPILEVERBOSE("No code given for: ");
588 code->entrypoint = (u1 *) (ptrint) do_nothing_function;
591 return code->entrypoint; /* return empty method */
594 #if defined(ENABLE_STATISTICS)
596 count_javacodesize += m->jcodelength + 18;
597 count_tryblocks += jd->exceptiontablelength;
598 count_javaexcsize += jd->exceptiontablelength * SIZEOF_VOID_P;
602 RT_TIMING_GET_TIME(time_checks);
604 #if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
605 /* Code for Sun's OpenJDK (see
606 hotspot/src/share/vm/classfile/verifier.cpp
607 (Verifier::is_eligible_for_verification)): Don't verify
608 dynamically-generated bytecodes. */
610 # if defined(ENABLE_VERIFIER)
611 if (class_issubclass(m->clazz, class_sun_reflect_MagicAccessorImpl))
612 jd->flags &= ~JITDATA_FLAG_VERIFY;
616 /* call the compiler passes ***********************************************/
618 DEBUG_JIT_COMPILEVERBOSE("Parsing: ");
620 /* call parse pass */
623 DEBUG_JIT_COMPILEVERBOSE("Exception while parsing: ");
627 RT_TIMING_GET_TIME(time_parse);
629 DEBUG_JIT_COMPILEVERBOSE("Parsing done: ");
631 #if defined(ENABLE_JIT)
632 # if defined(ENABLE_INTRP)
635 DEBUG_JIT_COMPILEVERBOSE("Analysing: ");
637 /* call stack analysis pass */
639 if (!stack_analyse(jd)) {
640 DEBUG_JIT_COMPILEVERBOSE("Exception while analysing: ");
644 RT_TIMING_GET_TIME(time_stack);
646 DEBUG_JIT_COMPILEVERBOSE("Analysing done: ");
648 #ifdef ENABLE_VERIFIER
649 if (JITDATA_HAS_FLAG_VERIFY(jd)) {
650 DEBUG_JIT_COMPILEVERBOSE("Typechecking: ");
652 /* call typecheck pass */
653 if (!typecheck(jd)) {
654 DEBUG_JIT_COMPILEVERBOSE("Exception while typechecking: ");
659 DEBUG_JIT_COMPILEVERBOSE("Typechecking done: ");
662 RT_TIMING_GET_TIME(time_typecheck);
664 #if defined(ENABLE_LOOP)
669 jit_renumber_basicblocks(jd);
672 RT_TIMING_GET_TIME(time_loop);
674 #if defined(ENABLE_IFCONV)
675 if (JITDATA_HAS_FLAG_IFCONV(jd)) {
676 if (!ifconv_static(jd))
678 jit_renumber_basicblocks(jd);
681 RT_TIMING_GET_TIME(time_ifconv);
685 #if defined(ENABLE_INLINING) && (!defined(ENABLE_ESCAPE) || 1)
686 if (JITDATA_HAS_FLAG_INLINE(jd)) {
687 if (!inline_inline(jd))
692 #if defined(ENABLE_SSA)
694 fix_exception_handlers(jd);
698 /* Build the CFG. This has to be done after stack_analyse, as
699 there happens the JSR elimination. */
704 #if defined(ENABLE_PROFILING)
705 /* Basic block reordering. I think this should be done after
706 if-conversion, as we could lose the ability to do the
709 if (JITDATA_HAS_FLAG_REORDER(jd)) {
712 jit_renumber_basicblocks(jd);
716 #if defined(ENABLE_PM_HACKS)
717 #include "vm/jit/jit_pm_2.inc"
719 DEBUG_JIT_COMPILEVERBOSE("Allocating registers: ");
721 #if defined(ENABLE_LSRA) && !defined(ENABLE_SSA)
722 /* allocate registers */
727 STATISTICS(count_methods_allocated_by_lsra++);
730 # endif /* defined(ENABLE_LSRA) && !defined(ENABLE_SSA) */
731 #if defined(ENABLE_SSA)
732 /* allocate registers */
735 jd->code->optlevel > 0)
736 /* strncmp(jd->m->name->text, "hottie", 6) == 0*/
737 /*&& jd->exceptiontablelength == 0*/
739 /*printf("=== %s ===\n", jd->m->name->text);*/
740 jd->ls = (lsradata*) DumpMemory::allocate(sizeof(lsradata));
743 /*lsra(jd);*/ regalloc(jd);
744 /*eliminate_subbasicblocks(jd);*/
745 STATISTICS(count_methods_allocated_by_lsra++);
748 # endif /* defined(ENABLE_SSA) */
750 STATISTICS(count_locals_conflicts += (jd->maxlocals - 1) * (jd->maxlocals));
755 STATISTICS(simplereg_make_statistics(jd));
757 DEBUG_JIT_COMPILEVERBOSE("Allocating registers done: ");
758 # if defined(ENABLE_INTRP)
761 #endif /* defined(ENABLE_JIT) */
762 RT_TIMING_GET_TIME(time_alloc);
764 #if defined(ENABLE_PROFILING)
765 /* Allocate memory for basic block profiling information. This
766 _must_ be done after loop optimization and register allocation,
767 since they can change the basic block count. */
769 if (JITDATA_HAS_FLAG_INSTRUMENT(jd)) {
770 code->basicblockcount = jd->basicblockcount;
771 code->bbfrequency = MNEW(u4, jd->basicblockcount);
775 DEBUG_JIT_COMPILEVERBOSE("Generating code: ");
777 /* now generate the machine code */
779 #if defined(ENABLE_JIT)
780 # if defined(ENABLE_INTRP)
782 #if defined(ENABLE_VERIFIER)
784 DEBUG_JIT_COMPILEVERBOSE("Typechecking (stackbased): ");
786 if (!typecheck_stackbased(jd)) {
787 DEBUG_JIT_COMPILEVERBOSE("Exception while typechecking (stackbased): ");
792 if (!intrp_codegen(jd)) {
793 DEBUG_JIT_COMPILEVERBOSE("Exception while generating code: ");
800 if (!codegen_generate(jd)) {
801 DEBUG_JIT_COMPILEVERBOSE("Exception while generating code: ");
807 if (!intrp_codegen(jd)) {
808 DEBUG_JIT_COMPILEVERBOSE("Exception while generating code: ");
813 RT_TIMING_GET_TIME(time_codegen);
815 DEBUG_JIT_COMPILEVERBOSE("Generating code done: ");
817 #if !defined(NDEBUG) && defined(ENABLE_REPLACEMENT)
818 /* activate replacement points inside newly created code */
820 if (opt_TestReplacement)
821 replace_activate_replacement_points(code, false);
825 #if defined(ENABLE_DEBUG_FILTER)
826 if (jd->m->filtermatches & SHOW_FILTER_FLAG_SHOW_METHOD)
829 /* intermediate and assembly code listings */
831 if (JITDATA_HAS_FLAG_SHOWINTERMEDIATE(jd)) {
832 show_method(jd, SHOW_CODE);
834 else if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
835 # if defined(ENABLE_DISASSEMBLER)
836 DISASSEMBLE(code->entrypoint,
837 code->entrypoint + (code->mcodelength - cd->dseglen));
841 if (opt_showddatasegment)
846 /* switch to the newly generated code */
849 assert(code->entrypoint);
851 /* add the current compile version to the methodinfo */
853 code->prev = m->code;
856 RT_TIMING_TIME_DIFF(time_start,time_checks,RT_TIMING_JIT_CHECKS);
857 RT_TIMING_TIME_DIFF(time_checks,time_parse,RT_TIMING_JIT_PARSE);
858 RT_TIMING_TIME_DIFF(time_parse,time_stack,RT_TIMING_JIT_STACK);
859 RT_TIMING_TIME_DIFF(time_stack,time_typecheck,RT_TIMING_JIT_TYPECHECK);
860 RT_TIMING_TIME_DIFF(time_typecheck,time_loop,RT_TIMING_JIT_LOOP);
861 RT_TIMING_TIME_DIFF(time_loop,time_alloc,RT_TIMING_JIT_ALLOC);
862 RT_TIMING_TIME_DIFF(time_alloc,time_codegen,RT_TIMING_JIT_CODEGEN);
863 RT_TIMING_TIME_DIFF(time_start,time_codegen,RT_TIMING_JIT_TOTAL);
865 /* return pointer to the methods entry point */
867 return code->entrypoint;
871 /* jit_invalidate_code *********************************************************
873 Mark the compiled code of the given method as invalid and take care that
874 it is replaced if necessary.
876 XXX Not fully implemented, yet.
878 *******************************************************************************/
880 void jit_invalidate_code(methodinfo *m)
886 if (code == NULL || code_is_invalid(code))
889 code_flag_invalid(code);
891 /* activate mappable replacement points */
893 #if defined(ENABLE_REPLACEMENT)
894 replace_activate_replacement_points(code, true);
896 vm_abort("invalidating code only works with ENABLE_REPLACEMENT");
901 /* jit_request_optimization ****************************************************
903 Request optimization of the given method. If the code of the method is
904 unoptimized, it will be invalidated, so the next jit_get_current_code(m)
905 triggers an optimized recompilation.
906 If the method is already optimized, this function does nothing.
909 m................the method
911 *******************************************************************************/
913 void jit_request_optimization(methodinfo *m)
919 if (code && code->optlevel == 0)
920 jit_invalidate_code(m);
924 /* jit_get_current_code ********************************************************
926 Get the currently valid code for the given method. If there is no valid
927 code, (re)compile the method.
930 m................the method
933 the codeinfo* for the current code, or
934 NULL if an exception has been thrown during recompilation.
936 *******************************************************************************/
938 codeinfo *jit_get_current_code(methodinfo *m)
942 /* if we have valid code, return it */
944 if (m->code && !code_is_invalid(m->code))
947 /* otherwise: recompile */
949 if (!jit_recompile(m))
958 /* jit_asm_compile *************************************************************
960 This method is called from asm_vm_call_method and does:
962 - create stackframe info for exceptions
964 - patch the entrypoint of the method into the calculated address in
966 - flushes the instruction cache.
968 *******************************************************************************/
970 #if defined(ENABLE_JIT)
971 #if !defined(JIT_COMPILER_VIA_SIGNAL)
973 void* jit_asm_compile(methodinfo *m, void* mptr, void* sp, void* ra)
975 stackframeinfo_t sfi;
980 /* create the stackframeinfo (subtract 1 from RA as it points to the */
981 /* instruction after the call) */
983 stacktrace_stackframeinfo_add(&sfi, NULL, sp, ra, ((uint8_t*) ra) - 1);
985 /* actually compile the method */
987 entrypoint = jit_compile(m);
989 /* remove the stackframeinfo */
991 stacktrace_stackframeinfo_remove(&sfi);
993 /* there was a problem during compilation */
995 if (entrypoint == NULL)
998 /* get the method patch address */
1000 pa = md_jit_method_patch_address(sfi.pv, (void *) ra, mptr);
1002 /* patch the method entry point */
1004 p = (uintptr_t*) pa;
1006 *p = (uintptr_t) entrypoint;
1008 /* flush the instruction cache */
1010 md_icacheflush(pa, SIZEOF_VOID_P);
1017 /* jit_compile_handle **********************************************************
1019 This method is called from the appropriate signal handler which
1020 handles compiler-traps and does the following:
1022 - compile the method
1023 - patch the entrypoint of the method into the calculated address in
1025 - flush the instruction cache
1027 *******************************************************************************/
1029 void *jit_compile_handle(methodinfo *m, void *pv, void *ra, void *mptr)
1031 void *newpv; /* new compiled method PV */
1032 void *pa; /* patch address */
1033 uintptr_t *p; /* convenience pointer */
1035 /* Compile the method. */
1037 newpv = jit_compile(m);
1039 /* There was a problem during compilation. */
1044 /* Get the method patch address. */
1046 pa = md_jit_method_patch_address(pv, ra, mptr);
1048 /* Patch the method entry point. */
1050 p = (uintptr_t *) pa;
1052 *p = (uintptr_t) newpv;
1054 /* Flush both caches. */
1056 md_cacheflush(pa, SIZEOF_VOID_P);
1060 #endif /* defined(ENABLE_JIT) */
1063 /* jit_complement_condition ****************************************************
1065 Returns the complement of the passed conditional instruction.
1067 We use the order of the different conditions, e.g.:
1072 If the passed opcode is odd, we simply add 1 to get the complement.
1073 If the opcode is even, we subtract 1.
1080 *******************************************************************************/
1082 s4 jit_complement_condition(s4 opcode)
1086 return ICMD_IFNONNULL;
1088 case ICMD_IFNONNULL:
1092 /* check if opcode is odd */
1102 /* jit_renumber_basicblocks ****************************************************
1104 Set the ->nr of all blocks so it increases when traversing ->next.
1107 jitdata..........the current jitdata
1109 *******************************************************************************/
1111 void jit_renumber_basicblocks(jitdata *jd)
1117 for (bptr = jd->basicblocks; bptr != NULL; bptr = bptr->next) {
1121 /* we have one block more than jd->basicblockcount (the end marker) */
1123 assert(nr == jd->basicblockcount + 1);
1127 /* jit_check_basicblock_numbers ************************************************
1129 Assert that the ->nr of the first block is zero and increases by 1 each
1130 time ->next is traversed.
1131 This function should be called before any analysis that relies on
1132 the basicblock numbers.
1135 jitdata..........the current jitdata
1137 NOTE: Aborts with an assertion if the condition is not met!
1139 *******************************************************************************/
1141 #if !defined(NDEBUG)
1142 void jit_check_basicblock_numbers(jitdata *jd)
1148 for (bptr = jd->basicblocks; bptr != NULL; bptr = bptr->next) {
1149 assert(bptr->nr == nr);
1153 /* we have one block more than jd->basicblockcount (the end marker) */
1155 assert(nr == jd->basicblockcount + 1);
1157 #endif /* !defined(NDEBUG) */
1161 * These are local overrides for various environment variables in Emacs.
1162 * Please do not remove this and leave it at the end of the file, where
1163 * Emacs will automagically detect them.
1164 * ---------------------------------------------------------------------
1167 * indent-tabs-mode: t
1171 * vim:noexpandtab:sw=4:ts=4: