#include "md.h"
#include "md-abi.h"
-#include "mm/memory.h"
+#include "mm/memory.hpp"
#include "toolbox/avl.h"
-#include "toolbox/list.h"
-#include "toolbox/logging.h"
+#include "toolbox/list.hpp"
+#include "toolbox/logging.hpp"
#include "native/llni.h"
-#include "native/localref.h"
-#include "native/native.h"
+#include "native/localref.hpp"
+#include "native/native.hpp"
#include "threads/thread.hpp"
#include "vm/jit/builtin.hpp"
#include "vm/exceptions.hpp"
-#include "vm/method.h"
+#include "vm/method.hpp"
#include "vm/options.h"
#include "vm/string.hpp"
#include "vm/jit/dseg.h"
#include "vm/jit/emit-common.hpp"
#include "vm/jit/jit.hpp"
-#include "vm/jit/linenumbertable.h"
+#include "vm/jit/linenumbertable.hpp"
#include "vm/jit/methodheader.h"
#include "vm/jit/methodtree.h"
-#include "vm/jit/patcher-common.h"
+#include "vm/jit/patcher-common.hpp"
#include "vm/jit/replace.hpp"
#if defined(ENABLE_SSA)
# include "vm/jit/optimizing/lsra.h"
#include <vmlog_cacao.h>
#endif
-#include "show.h"
+#include "show.hpp"
/* codegen_init ****************************************************************
/* initialize members */
- cd->flags = 0;
+ // Set flags as requested.
+ if (opt_AlwaysEmitLongBranches) {
+ cd->flags = CODEGENDATA_FLAG_LONGBRANCHES;
+ }
+ else {
+ cd->flags = 0;
+ }
cd->mcodebase = (u1*) DumpMemory::allocate(MCODEINITSIZE);
cd->mcodeend = cd->mcodebase + MCODEINITSIZE;
cd->datareferences = NULL;
#endif
- cd->brancheslabel = list_create_dump(OFFSET(branch_label_ref_t, linkage));
- cd->linenumbers = list_create_dump(OFFSET(linenumbertable_list_entry_t, linkage));
+ cd->brancheslabel = new DumpList<branch_label_ref_t*>();
+ cd->linenumbers = new DumpList<Linenumber>();
}
cd->datareferences = NULL;
#endif
- cd->brancheslabel = list_create_dump(OFFSET(branch_label_ref_t, linkage));
- cd->linenumbers = list_create_dump(OFFSET(linenumbertable_list_entry_t, linkage));
+ cd->brancheslabel = new DumpList<branch_label_ref_t*>();
+ cd->linenumbers = new DumpList<Linenumber>();
/* We need to clear the mpc and the branch references from all
basic blocks as they will definitely change. */
void codegen_branch_label_add(codegendata *cd, s4 label, s4 condition, s4 reg, u4 options)
{
- list_t *l;
- branch_label_ref_t *br;
- s4 mpc;
-
- /* Get the label list. */
+ // Calculate the current mpc.
+ int32_t mpc = cd->mcodeptr - cd->mcodebase;
- l = cd->brancheslabel;
-
- /* calculate the current mpc */
-
- mpc = cd->mcodeptr - cd->mcodebase;
-
- br = (branch_label_ref_t*) DumpMemory::allocate(sizeof(branch_label_ref_t));
+ branch_label_ref_t* br = (branch_label_ref_t*) DumpMemory::allocate(sizeof(branch_label_ref_t));
br->mpc = mpc;
br->label = label;
br->reg = reg;
br->options = options;
- /* Add the branch to the list. */
-
- list_add_last(l, br);
+ // Add the branch to the list.
+ cd->brancheslabel->push_back(br);
}
/* Create the linenumber table. */
- linenumbertable_create(jd);
+ code->linenumbertable = new LinenumberTable(jd);
/* jump table resolving */