1 /* src/vm/jit/jit.c - calls the code generation functions
3 Copyright (C) 1996-2005, 2006, 2007, 2008
4 CACAOVM - Verein zu Foerderung der freien virtuellen Machine 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.h"
37 #include "native/native.h"
39 #include "toolbox/logging.h"
41 #include "threads/lock-common.h"
42 #include "threads/threads-common.h"
44 #include "vm/global.h"
45 #include "vm/initialize.h"
47 #include "vm/jit/asmpart.h"
49 #include "vm/jit/cfg.h"
51 #include "vm/jit/codegen-common.h"
52 #include "vm/jit/disass.h"
53 #include "vm/jit/dseg.h"
54 #include "vm/jit/jit.h"
55 #include "vm/jit/parse.h"
56 #include "vm/jit/reg.h"
58 #include "vm/jit/show.h"
59 #include "vm/jit/stack.h"
61 #include "vm/jit/allocator/simplereg.h"
62 #if defined(ENABLE_LSRA) && !defined(ENABLE_SSA)
63 # include "vm/jit/allocator/lsra.h"
66 #if defined(ENABLE_SSA)
67 # include "vm/jit/optimizing/lsra.h"
68 # include "vm/jit/optimizing/ssa.h"
71 #if defined(ENABLE_INLINING)
72 # include "vm/jit/inline/inline.h"
75 #include "vm/jit/ir/bytecode.h"
77 #include "vm/jit/loop/analyze.h"
78 #include "vm/jit/loop/graph.h"
79 #include "vm/jit/loop/loop.h"
81 #if defined(ENABLE_IFCONV)
82 # include "vm/jit/optimizing/ifconv.h"
85 #include "vm/jit/optimizing/reorder.h"
87 #if defined(ENABLE_PYTHON)
88 # include "vm/jit/python.h"
91 #include "vm/jit/verify/typecheck.h"
93 #include "vmcore/class.h"
94 #include "vmcore/loader.h"
95 #include "vmcore/method.h"
96 #include "vmcore/options.h"
97 #include "vmcore/rt-timing.h"
98 #include "vmcore/statistics.h"
101 /* debug macros ***************************************************************/
104 #define DEBUG_JIT_COMPILEVERBOSE(x) \
106 if (compileverbose) { \
107 log_message_method(x, m); \
111 #define DEBUG_JIT_COMPILEVERBOSE(x) /* nothing */
115 # define TRACECOMPILERCALLS() \
117 if (opt_TraceCompilerCalls) { \
119 log_print("[JIT compiler started: method="); \
126 # define TRACECOMPILERCALLS()
130 /* the ICMD table ************************************************************/
133 #define N(name) name,
138 /* abbreviations for flags */
140 #define PEI ICMDTABLE_PEI
141 #define CALLS ICMDTABLE_CALLS
143 /* some machine dependent values */
148 #define IDIV_CALLS ICMDTABLE_CALLS
151 #if (SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
154 #define LDIV_CALLS ICMDTABLE_CALLS
157 /* include the actual table */
159 icmdtable_entry_t icmd_table[256] = {
160 #include <vm/jit/icmdtable.inc>
167 /* XXX hack until the old "PEI" definition is removed */
171 /* jit_init ********************************************************************
173 Initializes the JIT subsystem.
175 *******************************************************************************/
179 #if defined(ENABLE_JIT)
180 /* initialize stack analysis subsystem */
185 /* initialize show subsystem */
191 /* initialize codegen subsystem */
195 /* initialize code subsystem */
199 /* Machine dependent initialization. */
201 #if defined(ENABLE_JIT)
202 # if defined(ENABLE_INTRP)
214 /* jit_close *******************************************************************
216 Close the JIT subsystem.
218 *******************************************************************************/
226 /* dummy function, used when there is no JavaVM code available */
228 static u1 *do_nothing_function(void)
234 /* jit_jitdata_new *************************************************************
236 Allocates and initalizes a new jitdata structure.
238 *******************************************************************************/
240 jitdata *jit_jitdata_new(methodinfo *m)
245 /* allocate jitdata structure and fill it */
250 jd->cd = DNEW(codegendata);
251 jd->rd = DNEW(registerdata);
252 #if defined(ENABLE_LOOP)
253 jd->ld = DNEW(loopdata);
256 /* Allocate codeinfo memory from the heap as we need to keep them. */
258 code = code_codeinfo_new(m);
260 /* Set codeinfo flags. */
262 #if defined(ENABLE_THREADS)
263 if (checksync && (m->flags & ACC_SYNCHRONIZED))
264 code_flag_synchronized(code);
266 if (checksync && (m->flags & ACC_SYNCHRONIZED))
267 code_unflag_leafmethod(code);
270 code_flag_leafmethod(code);
272 /* initialize variables */
276 jd->exceptiontable = NULL;
277 jd->exceptiontablelength = 0;
279 jd->branchtoentry = false;
280 jd->branchtoend = false;
282 jd->returnblock = NULL;
283 jd->maxlocals = m->maxlocals;
289 /* jit_compile *****************************************************************
291 Translates one method to machine code.
293 *******************************************************************************/
295 static u1 *jit_compile_intern(jitdata *jd);
297 u1 *jit_compile(methodinfo *m)
303 STATISTICS(count_jit_calls++);
305 /* Initialize the static function's class. */
307 /* ATTENTION: This MUST be done before the method lock is aquired,
308 otherwise we could run into a deadlock with <clinit>'s that
309 call static methods of it's own class. */
311 if ((m->flags & ACC_STATIC) && !(m->class->state & CLASS_INITIALIZED)) {
314 log_message_class("Initialize class ", m->class);
317 if (!initialize_class(m->class))
320 /* check if the method has been compiled during initialization */
322 if ((m->code != NULL) && (m->code->entrypoint != NULL))
323 return m->code->entrypoint;
326 /* enter a monitor on the method */
328 LOCK_MONITOR_ENTER(m);
330 /* if method has been already compiled return immediately */
332 if (m->code != NULL) {
333 LOCK_MONITOR_EXIT(m);
335 assert(m->code->entrypoint);
336 return m->code->entrypoint;
339 TRACECOMPILERCALLS();
341 STATISTICS(count_methods++);
343 #if defined(ENABLE_STATISTICS)
346 if (opt_getcompilingtime)
347 compilingtime_start();
350 /* mark start of dump memory area */
354 /* create jitdata structure */
356 jd = jit_jitdata_new(m);
358 /* set the flags for the current JIT run */
360 jd->flags = JITDATA_FLAG_PARSE;
362 #if defined(ENABLE_VERIFIER)
364 jd->flags |= JITDATA_FLAG_VERIFY;
367 #if defined(ENABLE_PROFILING)
369 jd->flags |= JITDATA_FLAG_INSTRUMENT;
372 #if defined(ENABLE_IFCONV)
374 jd->flags |= JITDATA_FLAG_IFCONV;
377 #if defined(ENABLE_INLINING) && defined(ENABLE_INLINING_DEBUG)
378 if (opt_inlining && opt_inline_debug_all)
379 jd->flags |= JITDATA_FLAG_INLINE;
382 if (opt_showintermediate)
383 jd->flags |= JITDATA_FLAG_SHOWINTERMEDIATE;
385 if (opt_showdisassemble)
386 jd->flags |= JITDATA_FLAG_SHOWDISASSEMBLE;
389 jd->flags |= JITDATA_FLAG_VERBOSECALL;
391 #if defined(ENABLE_REPLACEMENT) && defined(ENABLE_INLINING)
393 jd->flags |= JITDATA_FLAG_COUNTDOWN;
396 #if defined(ENABLE_JIT)
397 # if defined(ENABLE_INTRP)
400 /* initialize the register allocator */
406 /* setup the codegendata memory */
410 /* now call internal compile function */
412 r = jit_compile_intern(jd);
415 /* We had an exception! Finish stuff here if necessary. */
417 /* release codeinfo */
419 code_codeinfo_free(jd->code);
421 #if defined(ENABLE_PROFILING)
422 /* Release memory for basic block profiling information. */
424 if (JITDATA_HAS_FLAG_INSTRUMENT(jd))
425 if (jd->code->bbfrequency != NULL)
426 MFREE(jd->code->bbfrequency, u4, jd->code->basicblockcount);
430 DEBUG_JIT_COMPILEVERBOSE("Running: ");
433 /* release dump area */
437 #if defined(ENABLE_STATISTICS)
440 if (opt_getcompilingtime)
441 compilingtime_stop();
444 /* leave the monitor */
446 LOCK_MONITOR_EXIT(m);
448 /* return pointer to the methods entry point */
454 /* jit_recompile ***************************************************************
456 Recompiles a Java method.
458 *******************************************************************************/
460 u1 *jit_recompile(methodinfo *m)
467 /* check for max. optimization level */
469 optlevel = (m->code) ? m->code->optlevel : 0;
473 /* log_message_method("not recompiling: ", m); */
478 DEBUG_JIT_COMPILEVERBOSE("Recompiling start: ");
480 STATISTICS(count_jit_calls++);
482 #if defined(ENABLE_STATISTICS)
485 if (opt_getcompilingtime)
486 compilingtime_start();
489 /* mark start of dump memory area */
493 /* create jitdata structure */
495 jd = jit_jitdata_new(m);
497 /* set the current optimization level to the previous one plus 1 */
499 jd->code->optlevel = optlevel + 1;
501 /* get the optimization flags for the current JIT run */
503 #if defined(ENABLE_VERIFIER)
504 jd->flags |= JITDATA_FLAG_VERIFY;
507 /* jd->flags |= JITDATA_FLAG_REORDER; */
508 if (opt_showintermediate)
509 jd->flags |= JITDATA_FLAG_SHOWINTERMEDIATE;
510 if (opt_showdisassemble)
511 jd->flags |= JITDATA_FLAG_SHOWDISASSEMBLE;
513 jd->flags |= JITDATA_FLAG_VERBOSECALL;
515 #if defined(ENABLE_INLINING)
517 jd->flags |= JITDATA_FLAG_INLINE;
520 #if defined(ENABLE_JIT)
521 # if defined(ENABLE_INTRP)
524 /* initialize the register allocator */
529 /* setup the codegendata memory */
533 /* now call internal compile function */
535 r = jit_compile_intern(jd);
538 /* We had an exception! Finish stuff here if necessary. */
540 /* release codeinfo */
542 code_codeinfo_free(jd->code);
545 /* release dump area */
549 #if defined(ENABLE_STATISTICS)
552 if (opt_getcompilingtime)
553 compilingtime_stop();
556 DEBUG_JIT_COMPILEVERBOSE("Recompiling done: ");
558 /* return pointer to the methods entry point */
564 /* jit_compile_intern **********************************************************
566 Static internal function which does the actual compilation.
568 *******************************************************************************/
570 static u1 *jit_compile_intern(jitdata *jd)
576 #if defined(ENABLE_RT_TIMING)
577 struct timespec time_start,time_checks,time_parse,time_stack,
578 time_typecheck,time_loop,time_ifconv,time_alloc,
582 RT_TIMING_GET_TIME(time_start);
584 /* get required compiler data */
586 #if defined(ENABLE_LSRA) || defined(ENABLE_SSA)
593 #if defined(ENABLE_DEBUG_FILTER)
594 show_filters_apply(jd->m);
597 /* Handle native methods and create a native stub. */
599 if (m->flags & ACC_NATIVE) {
602 f = native_method_resolve(m);
607 code = codegen_generate_stub_native(m, f);
609 /* Native methods are never recompiled. */
615 return code->entrypoint;
618 /* if there is no javacode, print error message and return empty method */
620 if (m->jcode == NULL) {
621 DEBUG_JIT_COMPILEVERBOSE("No code given for: ");
623 code->entrypoint = (u1 *) (ptrint) do_nothing_function;
626 return code->entrypoint; /* return empty method */
629 #if defined(ENABLE_STATISTICS)
631 count_javacodesize += m->jcodelength + 18;
632 count_tryblocks += jd->exceptiontablelength;
633 count_javaexcsize += jd->exceptiontablelength * SIZEOF_VOID_P;
637 RT_TIMING_GET_TIME(time_checks);
639 #if defined(WITH_CLASSPATH_SUN)
640 /* Code for Sun's OpenJDK (see
641 hotspot/src/share/vm/classfile/verifier.cpp
642 (Verifier::is_eligible_for_verification)): Don't verify
643 dynamically-generated bytecodes. */
645 # if defined(ENABLE_VERIFIER)
646 if (class_issubclass(m->class, class_sun_reflect_MagicAccessorImpl))
647 jd->flags &= ~JITDATA_FLAG_VERIFY;
651 /* call the compiler passes ***********************************************/
653 DEBUG_JIT_COMPILEVERBOSE("Parsing: ");
655 /* call parse pass */
658 DEBUG_JIT_COMPILEVERBOSE("Exception while parsing: ");
662 RT_TIMING_GET_TIME(time_parse);
664 DEBUG_JIT_COMPILEVERBOSE("Parsing done: ");
666 #if defined(ENABLE_JIT)
667 # if defined(ENABLE_INTRP)
670 DEBUG_JIT_COMPILEVERBOSE("Analysing: ");
672 /* call stack analysis pass */
674 if (!stack_analyse(jd)) {
675 DEBUG_JIT_COMPILEVERBOSE("Exception while analysing: ");
679 RT_TIMING_GET_TIME(time_stack);
681 DEBUG_JIT_COMPILEVERBOSE("Analysing done: ");
683 /* Build the CFG. This has to be done after stack_analyse, as
684 there happens the JSR elimination. */
689 #ifdef ENABLE_VERIFIER
690 if (JITDATA_HAS_FLAG_VERIFY(jd)) {
691 DEBUG_JIT_COMPILEVERBOSE("Typechecking: ");
693 /* call typecheck pass */
694 if (!typecheck(jd)) {
695 DEBUG_JIT_COMPILEVERBOSE("Exception while typechecking: ");
700 DEBUG_JIT_COMPILEVERBOSE("Typechecking done: ");
703 RT_TIMING_GET_TIME(time_typecheck);
705 #if defined(ENABLE_LOOP)
710 jit_renumber_basicblocks(jd);
713 RT_TIMING_GET_TIME(time_loop);
715 #if defined(ENABLE_IFCONV)
716 if (JITDATA_HAS_FLAG_IFCONV(jd)) {
717 if (!ifconv_static(jd))
719 jit_renumber_basicblocks(jd);
722 RT_TIMING_GET_TIME(time_ifconv);
726 #if defined(ENABLE_INLINING)
727 if (JITDATA_HAS_FLAG_INLINE(jd)) {
728 if (!inline_inline(jd))
733 #if defined(ENABLE_PYTHON)
734 if (!pythonpass_run(jd, "langauer_tarjan", "main")) {
739 #if defined(ENABLE_PROFILING)
740 /* Basic block reordering. I think this should be done after
741 if-conversion, as we could lose the ability to do the
744 if (JITDATA_HAS_FLAG_REORDER(jd)) {
747 jit_renumber_basicblocks(jd);
751 DEBUG_JIT_COMPILEVERBOSE("Allocating registers: ");
753 #if defined(ENABLE_LSRA) && !defined(ENABLE_SSA)
754 /* allocate registers */
759 STATISTICS(count_methods_allocated_by_lsra++);
762 # endif /* defined(ENABLE_LSRA) && !defined(ENABLE_SSA) */
763 #if defined(ENABLE_SSA)
764 /* allocate registers */
765 if ((opt_lsra) && (jd->exceptiontablelength == 0)) {
766 jd->ls = DNEW(lsradata);
770 STATISTICS(count_methods_allocated_by_lsra++);
773 # endif /* defined(ENABLE_SSA) */
775 STATISTICS(count_locals_conflicts += (jd->maxlocals - 1) * (jd->maxlocals));
780 STATISTICS(simplereg_make_statistics(jd));
782 DEBUG_JIT_COMPILEVERBOSE("Allocating registers done: ");
783 # if defined(ENABLE_INTRP)
786 #endif /* defined(ENABLE_JIT) */
787 RT_TIMING_GET_TIME(time_alloc);
789 #if defined(ENABLE_PROFILING)
790 /* Allocate memory for basic block profiling information. This
791 _must_ be done after loop optimization and register allocation,
792 since they can change the basic block count. */
794 if (JITDATA_HAS_FLAG_INSTRUMENT(jd))
795 code->bbfrequency = MNEW(u4, jd->basicblockcount);
798 DEBUG_JIT_COMPILEVERBOSE("Generating code: ");
800 /* now generate the machine code */
802 #if defined(ENABLE_JIT)
803 # if defined(ENABLE_INTRP)
805 #if defined(ENABLE_VERIFIER)
807 DEBUG_JIT_COMPILEVERBOSE("Typechecking (stackbased): ");
809 if (!typecheck_stackbased(jd)) {
810 DEBUG_JIT_COMPILEVERBOSE("Exception while typechecking (stackbased): ");
815 if (!intrp_codegen(jd)) {
816 DEBUG_JIT_COMPILEVERBOSE("Exception while generating code: ");
823 if (!codegen_generate(jd)) {
824 DEBUG_JIT_COMPILEVERBOSE("Exception while generating code: ");
830 if (!intrp_codegen(jd)) {
831 DEBUG_JIT_COMPILEVERBOSE("Exception while generating code: ");
836 RT_TIMING_GET_TIME(time_codegen);
838 DEBUG_JIT_COMPILEVERBOSE("Generating code done: ");
840 #if !defined(NDEBUG) && defined(ENABLE_REPLACEMENT)
841 /* activate replacement points inside newly created code */
843 if (opt_TestReplacement)
844 replace_activate_replacement_points(code, false);
848 #if defined(ENABLE_DEBUG_FILTER)
849 if (jd->m->filtermatches & SHOW_FILTER_FLAG_SHOW_METHOD)
852 /* intermediate and assembly code listings */
854 if (JITDATA_HAS_FLAG_SHOWINTERMEDIATE(jd)) {
855 show_method(jd, SHOW_CODE);
857 else if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
858 # if defined(ENABLE_DISASSEMBLER)
859 DISASSEMBLE(code->entrypoint,
860 code->entrypoint + (code->mcodelength - cd->dseglen));
864 if (opt_showddatasegment)
869 /* switch to the newly generated code */
872 assert(code->entrypoint);
874 /* add the current compile version to the methodinfo */
876 code->prev = m->code;
879 RT_TIMING_TIME_DIFF(time_start,time_checks,RT_TIMING_JIT_CHECKS);
880 RT_TIMING_TIME_DIFF(time_checks,time_parse,RT_TIMING_JIT_PARSE);
881 RT_TIMING_TIME_DIFF(time_parse,time_stack,RT_TIMING_JIT_STACK);
882 RT_TIMING_TIME_DIFF(time_stack,time_typecheck,RT_TIMING_JIT_TYPECHECK);
883 RT_TIMING_TIME_DIFF(time_typecheck,time_loop,RT_TIMING_JIT_LOOP);
884 RT_TIMING_TIME_DIFF(time_loop,time_alloc,RT_TIMING_JIT_ALLOC);
885 RT_TIMING_TIME_DIFF(time_alloc,time_codegen,RT_TIMING_JIT_CODEGEN);
886 RT_TIMING_TIME_DIFF(time_start,time_codegen,RT_TIMING_JIT_TOTAL);
888 /* return pointer to the methods entry point */
890 return code->entrypoint;
894 /* jit_invalidate_code *********************************************************
896 Mark the compiled code of the given method as invalid and take care that
897 it is replaced if necessary.
899 XXX Not fully implemented, yet.
901 *******************************************************************************/
903 void jit_invalidate_code(methodinfo *m)
909 if (code == NULL || code_is_invalid(code))
912 code_flag_invalid(code);
914 /* activate mappable replacement points */
916 #if defined(ENABLE_REPLACEMENT)
917 replace_activate_replacement_points(code, true);
919 vm_abort("invalidating code only works with ENABLE_REPLACEMENT");
924 /* jit_request_optimization ****************************************************
926 Request optimization of the given method. If the code of the method is
927 unoptimized, it will be invalidated, so the next jit_get_current_code(m)
928 triggers an optimized recompilation.
929 If the method is already optimized, this function does nothing.
932 m................the method
934 *******************************************************************************/
936 void jit_request_optimization(methodinfo *m)
942 if (code && code->optlevel == 0)
943 jit_invalidate_code(m);
947 /* jit_get_current_code ********************************************************
949 Get the currently valid code for the given method. If there is no valid
950 code, (re)compile the method.
953 m................the method
956 the codeinfo* for the current code, or
957 NULL if an exception has been thrown during recompilation.
959 *******************************************************************************/
961 codeinfo *jit_get_current_code(methodinfo *m)
965 /* if we have valid code, return it */
967 if (m->code && !code_is_invalid(m->code))
970 /* otherwise: recompile */
972 if (!jit_recompile(m))
981 /* jit_asm_compile *************************************************************
983 This method is called from asm_vm_call_method and does:
985 - create stackframe info for exceptions
987 - patch the entrypoint of the method into the calculated address in
989 - flushes the instruction cache.
991 *******************************************************************************/
993 #if defined(ENABLE_JIT)
994 #if !defined(JIT_COMPILER_VIA_SIGNAL)
995 u1 *jit_asm_compile(methodinfo *m, u1 *mptr, u1 *sp, u1 *ra)
997 stackframeinfo_t sfi;
1002 /* create the stackframeinfo (subtract 1 from RA as it points to the */
1003 /* instruction after the call) */
1005 stacktrace_stackframeinfo_add(&sfi, NULL, sp, ra, ra-1);
1007 /* actually compile the method */
1009 entrypoint = jit_compile(m);
1011 /* remove the stackframeinfo */
1013 stacktrace_stackframeinfo_remove(&sfi);
1015 /* there was a problem during compilation */
1017 if (entrypoint == NULL)
1020 /* get the method patch address */
1022 pa = md_jit_method_patch_address(sfi.pv, (void *) ra, mptr);
1024 /* patch the method entry point */
1028 *p = (ptrint) entrypoint;
1030 /* flush the instruction cache */
1032 md_icacheflush(pa, SIZEOF_VOID_P);
1038 /* jit_compile_handle **********************************************************
1040 This method is called from the appropriate signal handler which
1041 handles compiler-traps and does the following:
1043 - compile the method
1044 - patch the entrypoint of the method into the calculated address in
1046 - flush the instruction cache
1048 *******************************************************************************/
1050 void *jit_compile_handle(methodinfo *m, void *pv, void *ra, void *mptr)
1052 void *newpv; /* new compiled method PV */
1053 void *pa; /* patch address */
1054 uintptr_t *p; /* convenience pointer */
1056 /* Compile the method. */
1058 newpv = jit_compile(m);
1060 /* There was a problem during compilation. */
1065 /* Get the method patch address. */
1067 pa = md_jit_method_patch_address(pv, ra, mptr);
1069 /* Patch the method entry point. */
1071 p = (uintptr_t *) pa;
1073 *p = (uintptr_t) newpv;
1075 /* Flush both caches. */
1077 md_cacheflush(pa, SIZEOF_VOID_P);
1081 #endif /* defined(ENABLE_JIT) */
1084 /* jit_complement_condition ****************************************************
1086 Returns the complement of the passed conditional instruction.
1088 We use the order of the different conditions, e.g.:
1093 If the passed opcode is odd, we simply add 1 to get the complement.
1094 If the opcode is even, we subtract 1.
1101 *******************************************************************************/
1103 s4 jit_complement_condition(s4 opcode)
1107 return ICMD_IFNONNULL;
1109 case ICMD_IFNONNULL:
1113 /* check if opcode is odd */
1123 /* jit_renumber_basicblocks ****************************************************
1125 Set the ->nr of all blocks so it increases when traversing ->next.
1128 jitdata..........the current jitdata
1130 *******************************************************************************/
1132 void jit_renumber_basicblocks(jitdata *jd)
1138 for (bptr = jd->basicblocks; bptr != NULL; bptr = bptr->next) {
1142 /* we have one block more than jd->basicblockcount (the end marker) */
1144 assert(nr == jd->basicblockcount + 1);
1148 /* jit_check_basicblock_numbers ************************************************
1150 Assert that the ->nr of the first block is zero and increases by 1 each
1151 time ->next is traversed.
1152 This function should be called before any analysis that relies on
1153 the basicblock numbers.
1156 jitdata..........the current jitdata
1158 NOTE: Aborts with an assertion if the condition is not met!
1160 *******************************************************************************/
1162 #if !defined(NDEBUG)
1163 void jit_check_basicblock_numbers(jitdata *jd)
1169 for (bptr = jd->basicblocks; bptr != NULL; bptr = bptr->next) {
1170 assert(bptr->nr == nr);
1174 /* we have one block more than jd->basicblockcount (the end marker) */
1176 assert(nr == jd->basicblockcount + 1);
1178 #endif /* !defined(NDEBUG) */
1182 * These are local overrides for various environment variables in Emacs.
1183 * Please do not remove this and leave it at the end of the file, where
1184 * Emacs will automagically detect them.
1185 * ---------------------------------------------------------------------
1188 * indent-tabs-mode: t
1192 * vim:noexpandtab:sw=4:ts=4: