You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
1
(1) |
|
2
|
3
(6) |
4
(5) |
5
|
6
(2) |
7
(1) |
8
|
|
9
|
10
(4) |
11
(2) |
12
(2) |
13
(3) |
14
(1) |
15
|
|
16
(4) |
17
|
18
(3) |
19
(3) |
20
(3) |
21
|
22
|
|
23
(1) |
24
(10) |
25
(13) |
26
(6) |
27
(2) |
28
(3) |
29
(5) |
|
30
(6) |
|
|
|
|
|
|
Author: iraisr
Date: Wed Apr 19 22:21:22 2017
New Revision: 3351
Log:
Add support for HInstrIfThenElse into x86 instruction selector backend.
Now on to register allocator...
Modified:
branches/VEX_JIT_HACKS/priv/host_generic_reg_alloc2.c
branches/VEX_JIT_HACKS/priv/host_generic_regs.c
branches/VEX_JIT_HACKS/priv/host_generic_regs.h
branches/VEX_JIT_HACKS/priv/host_x86_defs.c
branches/VEX_JIT_HACKS/priv/host_x86_defs.h
branches/VEX_JIT_HACKS/priv/host_x86_isel.c
branches/VEX_JIT_HACKS/priv/ir_defs.c
branches/VEX_JIT_HACKS/priv/main_main.c
branches/VEX_JIT_HACKS/pub/libvex_ir.h
Modified: branches/VEX_JIT_HACKS/priv/host_generic_reg_alloc2.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/host_generic_reg_alloc2.c (original)
+++ branches/VEX_JIT_HACKS/priv/host_generic_reg_alloc2.c Wed Apr 19 22:21:22 2017
@@ -410,6 +410,7 @@
/* For debug printing only. */
void (*ppInstr)(const HInstr*, Bool);
+ void (*ppCondCode)(HCondCode);
void (*ppReg)(HReg);
/* 32/64bit mode */
@@ -428,8 +429,8 @@
void (*genReload)( HInstr**, HInstr**, HReg, Int, Bool),
HInstr* (*directReload)( HInstr*, HReg, Short),
UInt guest_sizeB,
- void (*ppInstr)(const HInstr*, Bool), void (*ppReg)(HReg),
- Bool mode64, const HInstrVec* instrs_in, UInt n_vregs)
+ void (*ppInstr)(const HInstr*, Bool), void (*ppCondCode)(HCondCode),
+ void (*ppReg)(HReg), Bool mode64, const HInstrVec* instrs_in, UInt n_vregs)
{
/* Initialize Register Allocator state. */
state->univ = univ;
@@ -442,6 +443,7 @@
state->directReload = directReload;
state->guest_sizeB = guest_sizeB;
state->ppInstr = ppInstr;
+ state->ppCondCode = ppCondCode;
state->ppReg = ppReg;
state->mode64 = mode64;
@@ -595,7 +597,7 @@
const HInstr* instr = instrs_in->insns[ii];
if (state->isIfThenElse(instr) != NULL) {
- vpanic("IfThenElse unimplemented");
+ vpanic("regAlloc_HInstrVec: IfThenElse unimplemented");
}
state->getRegUsage(&state->reg_usage_arr[ii], instr, state->mode64);
@@ -1689,6 +1691,7 @@
/* For debug printing only. */
void (*ppInstr) ( const HInstr*, Bool ),
+ void (*ppCondCode)(HCondCode),
void (*ppReg) ( HReg ),
/* 32/64bit mode */
@@ -1704,7 +1707,7 @@
RegAllocState state;
initRegAllocState(&state, univ, isMove, getRegUsage, mapRegs, isIfThenElse,
genSpill, genReload, directReload, guest_sizeB, ppInstr,
- ppReg, mode64, sb_in->insns, sb_in->n_vregs);
+ ppCondCode, ppReg, mode64, sb_in->insns, sb_in->n_vregs);
sb_out->insns = regAlloc_HInstrVec(&state, sb_in->insns);
return sb_out;
}
Modified: branches/VEX_JIT_HACKS/priv/host_generic_regs.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/host_generic_regs.c (original)
+++ branches/VEX_JIT_HACKS/priv/host_generic_regs.c Wed Apr 19 22:21:22 2017
@@ -304,25 +304,63 @@
addHInstr(hv, instr);
}
+HInstrIfThenElse* newHInstrIfThenElse(HCondCode condCode, HPhiNode* phi_nodes,
+ UInt n_phis)
+{
+ HInstrIfThenElse* hite = LibVEX_Alloc_inline(sizeof(HInstrIfThenElse));
+ hite->ccOOL = condCode;
+ hite->fallThrough = newHInstrVec();
+ hite->outOfLine = newHInstrVec();
+ hite->phi_nodes = phi_nodes;
+ hite->n_phis = n_phis;
+ return hite;
+}
+
static void print_depth(UInt depth) {
for (UInt i = 0; i < depth; i++) {
vex_printf(" ");
}
}
+void ppHPhiNode(const HPhiNode* phi_node)
+{
+ ppHReg(phi_node->dst);
+ vex_printf(" = phi(");
+ ppHReg(phi_node->srcFallThrough);
+ vex_printf(",");
+ ppHReg(phi_node->srcOutOfLine);
+ vex_printf(")");
+}
+
static void ppHInstrVec(const HInstrVec* code,
HInstrIfThenElse* (*isIfThenElse)(const HInstr*),
void (*ppInstr)(const HInstr*, Bool),
+ void (*ppCondCode)(HCondCode),
Bool mode64, UInt depth, UInt *insn_num)
{
for (UInt i = 0; i < code->insns_used; i++) {
const HInstr* instr = code->insns[i];
const HInstrIfThenElse* hite = isIfThenElse(instr);
if (UNLIKELY(hite != NULL)) {
- ppHInstrVec(hite->fallThrough, isIfThenElse, ppInstr, mode64,
- depth + 1, insn_num);
- ppHInstrVec(hite->outOfLine, isIfThenElse, ppInstr, mode64,
- depth + 1, insn_num);
+ print_depth(depth);
+ vex_printf(" if (!");
+ ppCondCode(hite->ccOOL);
+ vex_printf(") then fall-through {\n");
+ ppHInstrVec(hite->fallThrough, isIfThenElse, ppInstr, ppCondCode,
+ mode64, depth + 1, insn_num);
+ print_depth(depth);
+ vex_printf(" } else out-of-line {\n");
+ ppHInstrVec(hite->outOfLine, isIfThenElse, ppInstr, ppCondCode,
+ mode64, depth + 1, insn_num);
+ print_depth(depth);
+ vex_printf(" }\n");
+
+ for (UInt j = 0; j < hite->n_phis; j++) {
+ print_depth(depth);
+ vex_printf(" ");
+ ppHPhiNode(&hite->phi_nodes[j]);
+ vex_printf("\n");
+ }
} else {
vex_printf("%3u ", (*insn_num)++);
print_depth(depth);
@@ -342,10 +380,12 @@
void ppHInstrSB(const HInstrSB* code,
HInstrIfThenElse* (*isIfThenElse)(const HInstr*),
- void (*ppInstr)(const HInstr*, Bool), Bool mode64)
+ void (*ppInstr)(const HInstr*, Bool),
+ void (*ppCondCode)(HCondCode), Bool mode64)
{
UInt insn_num = 0;
- ppHInstrVec(code->insns, isIfThenElse, ppInstr, mode64, 0, &insn_num);
+ ppHInstrVec(code->insns, isIfThenElse, ppInstr, ppCondCode, mode64, 0,
+ &insn_num);
}
Modified: branches/VEX_JIT_HACKS/priv/host_generic_regs.h
==============================================================================
--- branches/VEX_JIT_HACKS/priv/host_generic_regs.h (original)
+++ branches/VEX_JIT_HACKS/priv/host_generic_regs.h Wed Apr 19 22:21:22 2017
@@ -368,18 +368,37 @@
}
}
+/* Host-independent condition code. Stands for X86CondCode, ARM64CondCode... */
+typedef UInt HCondCode;
+
+
+/* Phi node expressed in terms of HReg's. Analogy to IRPhi. */
+typedef
+ struct {
+ HReg dst;
+ HReg srcFallThrough;
+ HReg srcOutOfLine;
+ }
+ HPhiNode;
+
+extern void ppHPhiNode(const HPhiNode* phi_node);
+
/* Represents two alternative code paths:
- - one more likely taken (hot path)
- - one not so likely taken (cold path) */
+ - One more likely taken (hot path)
+ - One not so likely taken (cold path) */
typedef
struct {
- // HCondCode ccOOL; // TODO-JIT: condition code for the OOL branch
+ HCondCode ccOOL; // condition code for the OOL branch
HInstrVec* fallThrough; // generated from the likely-taken IR
HInstrVec* outOfLine; // generated from likely-not-taken IR
+ HPhiNode* phi_nodes;
+ UInt n_phis;
}
HInstrIfThenElse;
+extern HInstrIfThenElse* newHInstrIfThenElse(HCondCode, HPhiNode* phi_nodes,
+ UInt n_phis);
/* Code block of HInstr's.
n_vregs indicates the number of virtual registers mentioned in the code,
@@ -395,7 +414,8 @@
extern HInstrSB* newHInstrSB(void);
extern void ppHInstrSB(const HInstrSB* code,
HInstrIfThenElse* (*isIfThenElse)(const HInstr*),
- void (*ppInstr)(const HInstr*, Bool), Bool mode64);
+ void (*ppInstr)(const HInstr*, Bool),
+ void (*ppCondCode)(HCondCode), Bool mode64);
/*---------------------------------------------------------*/
@@ -500,6 +520,7 @@
/* For debug printing only. */
void (*ppInstr) ( const HInstr*, Bool ),
+ void (*ppCondCode)(HCondCode),
void (*ppReg) ( HReg ),
/* 32/64bit mode */
Modified: branches/VEX_JIT_HACKS/priv/host_x86_defs.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/host_x86_defs.c (original)
+++ branches/VEX_JIT_HACKS/priv/host_x86_defs.c Wed Apr 19 22:21:22 2017
@@ -922,6 +922,13 @@
i->tag = Xin_ProfInc;
return i;
}
+X86Instr* X86Instr_IfThenElse(HInstrIfThenElse* hite)
+{
+ X86Instr* i = LibVEX_Alloc_inline(sizeof(X86Instr));
+ i->tag = Xin_IfThenElse;
+ i->Xin.IfThenElse.hite = hite;
+ return i;
+}
void ppX86Instr ( const X86Instr* i, Bool mode64 ) {
vassert(mode64 == False);
@@ -1212,11 +1219,20 @@
vex_printf("(profInc) addl $1,NotKnownYet; "
"adcl $0,NotKnownYet+4");
return;
+ case Xin_IfThenElse:
+ vex_printf("if (!%s) then {...",
+ showX86CondCode(i->Xin.IfThenElse.hite->ccOOL));
+ return;
default:
vpanic("ppX86Instr");
}
}
+void ppX86CondCode(X86CondCode condCode)
+{
+ vex_printf("%s", showX86CondCode(condCode));
+}
+
/* --------- Helpers for register allocation. --------- */
void getRegUsage_X86Instr (HRegUsage* u, const X86Instr* i, Bool mode64)
Modified: branches/VEX_JIT_HACKS/priv/host_x86_defs.h
==============================================================================
--- branches/VEX_JIT_HACKS/priv/host_x86_defs.h (original)
+++ branches/VEX_JIT_HACKS/priv/host_x86_defs.h Wed Apr 19 22:21:22 2017
@@ -712,9 +712,11 @@
extern X86Instr* X86Instr_EvCheck ( X86AMode* amCounter,
X86AMode* amFailAddr );
extern X86Instr* X86Instr_ProfInc ( void );
+extern X86Instr* X86Instr_IfThenElse(HInstrIfThenElse*);
extern void ppX86Instr ( const X86Instr*, Bool );
+extern void ppX86CondCode(X86CondCode);
/* Some functions that insulate the register allocator from details
of the underlying instruction set. */
Modified: branches/VEX_JIT_HACKS/priv/host_x86_isel.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/host_x86_isel.c (original)
+++ branches/VEX_JIT_HACKS/priv/host_x86_isel.c Wed Apr 19 22:21:22 2017
@@ -124,6 +124,19 @@
// && e->Iex.Const.con->Ico.U64 == 0ULL;
//}
+static void print_depth(UInt depth)
+{
+ for (UInt i = 0; i < depth; i++) {
+ vex_printf(" ");
+ }
+}
+
+static void print_IRStmt_prefix(UInt depth)
+{
+ vex_printf("\n");
+ print_depth(depth);
+ vex_printf("-- ");
+}
/*---------------------------------------------------------*/
/*--- ISelEnv ---*/
@@ -147,7 +160,8 @@
32-bit virtual HReg, which holds the high half
of the value.
- - The code array, that is, the insns selected so far.
+ - The code vector, that is, the insns selected so far. HInstrVec 'code'
+ changes according to the current IRStmtVec being processed.
- A counter, for generating new virtual registers.
@@ -171,13 +185,12 @@
typedef
struct {
- /* Constant -- are set at the start and do not change. */
- IRTypeEnv* type_env;
- IRStmtVec* stmts;
+ /* Constant -- set at the start and do not change. */
+ const IRTypeEnv* type_env;
HReg* vregmap;
HReg* vregmapHI;
- Int n_vregmap;
+ UInt n_vregmap;
UInt hwcaps;
@@ -185,8 +198,10 @@
Addr32 max_ga;
/* These are modified as we go along. */
- HInstrSB* code;
- Int vreg_ctr;
+ HInstrSB* code_sb;
+ HInstrVec* code;
+ UInt vreg_ctr;
+ UInt depth;
}
ISelEnv;
@@ -209,8 +224,9 @@
static void addInstr ( ISelEnv* env, X86Instr* instr )
{
- addHInstr(env->code->insns, instr);
+ addHInstr(env->code, instr);
if (vex_traceflags & VEX_TRACE_VCODE) {
+ print_depth(env->depth);
ppX86Instr(instr, False);
vex_printf("\n");
}
@@ -3860,10 +3876,111 @@
/*--- ISEL: Statements ---*/
/*---------------------------------------------------------*/
+static void iselStmt(ISelEnv* env, IRStmt* stmt);
+
+static HPhiNode* convertPhiNodes(ISelEnv* env, const IRPhiVec* phi_nodes,
+ IRIfThenElse_Hint hint, UInt *n_phis)
+{
+ *n_phis = phi_nodes->phis_used;
+ HPhiNode* hphis = LibVEX_Alloc_inline(*n_phis * sizeof(HPhiNode));
+
+ for (UInt i = 0; i < *n_phis; i++) {
+ const IRPhi* phi = phi_nodes->phis[i];
+ hphis[i].dst = lookupIRTemp(env, phi->dst);
+
+ switch (hint) {
+ case IfThenElse_ThenLikely:
+ hphis[i].srcFallThrough = lookupIRTemp(env, phi->srcThen);
+ hphis[i].srcOutOfLine = lookupIRTemp(env, phi->srcElse);
+ break;
+ case IfThenElse_ElseLikely:
+ hphis[i].srcFallThrough = lookupIRTemp(env, phi->srcElse);
+ hphis[i].srcOutOfLine = lookupIRTemp(env, phi->srcThen);
+ break;
+ default:
+ vassert(0);
+ }
+ }
+ return hphis;
+}
+
+static void iselStmtVec(ISelEnv* env, IRStmtVec* stmts)
+{
+ for (UInt i = 0; i < stmts->stmts_used; i++) {
+ IRStmt* st = stmts->stmts[i];
+ if (st->tag != Ist_IfThenElse) {
+ iselStmt(env, stmts->stmts[i]);
+ continue;
+ }
+
+ /* Deal with IfThenElse. */
+ HInstrVec* current_code = env->code;
+ IRIfThenElse* ite = st->Ist.IfThenElse.details;
+ if (vex_traceflags & VEX_TRACE_VCODE) {
+ print_IRStmt_prefix(env->depth);
+ ppIRIfThenElseCondHint(ite);
+ vex_printf(" then {\n");
+ }
+
+ UInt n_phis;
+ HPhiNode* phi_nodes = convertPhiNodes(env, ite->phi_nodes,
+ ite->hint, &n_phis);
+
+ X86CondCode cc = iselCondCode(env, ite->cond);
+ HInstrIfThenElse* hite = newHInstrIfThenElse(cc, phi_nodes, n_phis);
+ X86Instr* instr = X86Instr_IfThenElse(hite);
+ addInstr(env, instr);
+
+ env->depth += 1;
+
+ IRStmtVec* likely_leg;
+ IRStmtVec* unlikely_leg;
+ switch (ite->hint) {
+ case IfThenElse_ThenLikely:
+ likely_leg = ite->then_leg;
+ unlikely_leg = ite->else_leg;
+ break;
+ case IfThenElse_ElseLikely:
+ likely_leg = ite->else_leg;
+ unlikely_leg = ite->then_leg;
+ break;
+ default:
+ vassert(0);
+ }
+
+ env->code = hite->fallThrough;
+ iselStmtVec(env, likely_leg);
+ if (vex_traceflags & VEX_TRACE_VCODE) {
+ print_IRStmt_prefix(env->depth - 1);
+ vex_printf("} else {\n");
+ }
+ env->code = hite->outOfLine;
+ iselStmtVec(env, unlikely_leg);
+
+ env->depth -= 1;
+ env->code = current_code;
+
+ if (vex_traceflags & VEX_TRACE_VCODE) {
+ print_IRStmt_prefix(env->depth);
+ vex_printf("}\n");
+
+ for (UInt j = 0; j < hite->n_phis; j++) {
+ print_IRStmt_prefix(env->depth);
+ ppIRPhi(ite->phi_nodes->phis[j]);
+ vex_printf("\n");
+
+ print_depth(env->depth);
+ ppHPhiNode(&hite->phi_nodes[j]);
+ vex_printf("\n");
+ }
+ }
+ }
+}
+
static void iselStmt ( ISelEnv* env, IRStmt* stmt )
{
if (vex_traceflags & VEX_TRACE_VCODE) {
- vex_printf("\n-- ");
+ print_IRStmt_prefix(env->depth);
ppIRStmt(stmt, env->type_env, 0);
vex_printf("\n");
}
@@ -4430,9 +4547,6 @@
Bool addProfInc,
Addr max_ga )
{
- Int i, j;
- HReg hreg, hregHI;
- ISelEnv* env;
UInt hwcaps_host = archinfo_host->hwcaps;
X86AMode *amCounter, *amFailAddr;
@@ -4449,17 +4563,16 @@
vassert(archinfo_host->endness == VexEndnessLE);
/* Make up an initial environment to use. */
- env = LibVEX_Alloc_inline(sizeof(ISelEnv));
+ ISelEnv* env = LibVEX_Alloc_inline(sizeof(ISelEnv));
env->vreg_ctr = 0;
- /* Set up output code array. */
- env->code = newHInstrSB();
+ /* Set up output HInstrSB and the first processed HInstrVec. */
+ env->code_sb = newHInstrSB();
+ env->code = env->code_sb->insns;
+ env->depth = 0;
/* Copy BB's type env. */
- /* TODO-JIT: Currently works only with no if-then-else statements. */
- vassert(bb->id_seq == 1);
env->type_env = bb->tyenv;
- env->stmts = bb->stmts;
/* Make up an IRTemp -> virtual HReg mapping. This doesn't
change as we go along. */
@@ -4474,9 +4587,10 @@
/* For each IR temporary, allocate a suitably-kinded virtual
register. */
- j = 0;
- for (i = 0; i < env->n_vregmap; i++) {
- hregHI = hreg = INVALID_HREG;
+ UInt j = 0;
+ for (UInt i = 0; i < env->n_vregmap; i++) {
+ HReg hreg = INVALID_HREG;
+ HReg hregHI = INVALID_HREG;
switch (bb->tyenv->types[i]) {
case Ity_I1:
case Ity_I8:
@@ -4509,14 +4623,13 @@
}
/* Ok, finally we can iterate over the statements. */
- for (i = 0; i < bb->stmts->stmts_used; i++)
- iselStmt(env, bb->stmts->stmts[i]);
+ iselStmtVec(env, bb->stmts);
iselNext(env, bb->next, bb->jumpkind, bb->offsIP);
/* record the number of vregs we used. */
- env->code->n_vregs = env->vreg_ctr;
- return env->code;
+ env->code_sb->n_vregs = env->vreg_ctr;
+ return env->code_sb;
}
Modified: branches/VEX_JIT_HACKS/priv/ir_defs.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/ir_defs.c (original)
+++ branches/VEX_JIT_HACKS/priv/ir_defs.c Wed Apr 19 22:21:22 2017
@@ -1610,13 +1610,19 @@
}
}
-void ppIRIfThenElse(const IRIfThenElse* ite, const IRTypeEnv* tyenv, UInt depth)
+void ppIRIfThenElseCondHint(const IRIfThenElse* ite)
{
vex_printf("if (");
ppIRExpr(ite->cond);
vex_printf(") [");
ppIRIfThenElse_Hint(ite->hint);
- vex_printf("] then {\n");
+ vex_printf("]");
+}
+
+void ppIRIfThenElse(const IRIfThenElse* ite, const IRTypeEnv* tyenv, UInt depth)
+{
+ ppIRIfThenElseCondHint(ite);
+ vex_printf(" then {\n");
ppIRStmtVec(ite->then_leg, tyenv, depth + 1);
print_depth(depth);
vex_printf("} else {\n");
Modified: branches/VEX_JIT_HACKS/priv/main_main.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/main_main.c (original)
+++ branches/VEX_JIT_HACKS/priv/main_main.c Wed Apr 19 22:21:22 2017
@@ -331,6 +331,7 @@
void (*genReload) ( HInstr**, HInstr**, HReg, Int, Bool );
HInstr* (*directReload) ( HInstr*, HReg, Short );
void (*ppInstr) ( const HInstr*, Bool );
+ void (*ppCondCode) ( HCondCode );
void (*ppReg) ( HReg );
HInstrSB* (*iselSB) ( const IRSB*, VexArch, const VexArchInfo*,
const VexAbiInfo*, Int, Int, Bool, Bool,
@@ -367,6 +368,7 @@
genReload = NULL;
directReload = NULL;
ppInstr = NULL;
+ ppCondCode = NULL;
ppReg = NULL;
iselSB = NULL;
emit = NULL;
@@ -419,6 +421,7 @@
genReload = (__typeof__(genReload)) X86FN(genReload_X86);
directReload = (__typeof__(directReload)) X86FN(directReload_X86);
ppInstr = (__typeof__(ppInstr)) X86FN(ppX86Instr);
+ ppCondCode = (__typeof__(ppCondCode)) X86FN(ppX86CondCode);
ppReg = (__typeof__(ppReg)) X86FN(ppHRegX86);
iselSB = X86FN(iselSB_X86);
emit = (__typeof__(emit)) X86FN(emit_X86Instr);
@@ -1044,7 +1047,7 @@
vex_printf("\n");
if (vex_traceflags & VEX_TRACE_VCODE) {
- ppHInstrSB(vcode, isIfThenElse, ppInstr, mode64);
+ ppHInstrSB(vcode, isIfThenElse, ppInstr, ppCondCode, mode64);
vex_printf("\n");
}
@@ -1053,7 +1056,7 @@
isMove, getRegUsage, mapRegs, isIfThenElse,
genSpill, genReload, directReload,
guest_sizeB,
- ppInstr, ppReg, mode64 );
+ ppInstr, ppCondCode, ppReg, mode64 );
vexAllocSanityCheck();
@@ -1061,7 +1064,7 @@
vex_printf("\n------------------------"
" Register-allocated code "
"------------------------\n\n");
- ppHInstrSB(rcode, isIfThenElse, ppInstr, mode64);
+ ppHInstrSB(rcode, isIfThenElse, ppInstr, ppCondCode, mode64);
vex_printf("\n");
}
Modified: branches/VEX_JIT_HACKS/pub/libvex_ir.h
==============================================================================
--- branches/VEX_JIT_HACKS/pub/libvex_ir.h (original)
+++ branches/VEX_JIT_HACKS/pub/libvex_ir.h Wed Apr 19 22:21:22 2017
@@ -2817,6 +2817,8 @@
IRIfThenElse;
extern void ppIRIfThenElse_Hint(IRIfThenElse_Hint hint);
+/* Pretty print only If-Then-Else preamble: condition and hint. Not the legs. */
+extern void ppIRIfThenElseCondHint(const IRIfThenElse* ite);
extern void ppIRIfThenElse(const IRIfThenElse* ite, const IRTypeEnv* tyenv,
UInt depth);
extern IRIfThenElse* mkIRIfThenElse(IRExpr* cond, IRIfThenElse_Hint hint,
|
|
From: <sv...@va...> - 2017-04-19 20:16:02
|
Author: philippe
Date: Wed Apr 19 21:15:50 2017
New Revision: 16306
Log:
Have a cleaner way to remove the massif preload from LD_PRELOAD.
The previous code was removing the massif preload (when --pages-as-heap=yes)
by replacing the entry with spaces.
This is not very clear, and I suspect this gives problems with the
android linker, which seems to use such a space entry as a real entry
to load (and then fails to start the application).
This patch really removes the entry, by shifting the characters.
Tested on amd64/debian.
Modified:
trunk/massif/ms_main.c
Modified: trunk/massif/ms_main.c
==============================================================================
--- trunk/massif/ms_main.c (original)
+++ trunk/massif/ms_main.c Wed Apr 19 21:15:50 2017
@@ -1947,8 +1947,6 @@
{
Int i;
HChar* LD_PRELOAD_val;
- HChar* s;
- HChar* s2;
/* We will record execontext up to clo_depth + overestimate and
we will store this as ec => we need to increase the backtrace size
@@ -1969,35 +1967,42 @@
// If --pages-as-heap=yes we don't want malloc replacement to occur. So we
// disable vgpreload_massif-$PLATFORM.so by removing it from LD_PRELOAD (or
- // platform-equivalent). We replace it entirely with spaces because then
- // the linker doesn't complain (it does complain if we just change the name
- // to a bogus file). This is a bit of a hack, but LD_PRELOAD is setup well
- // before tool initialisation, so this seems the best way to do it.
+ // platform-equivalent). This is a bit of a hack, but LD_PRELOAD is setup
+ // well before tool initialisation, so this seems the best way to do it.
if (clo_pages_as_heap) {
+ HChar* s1;
+ HChar* s2;
+
clo_heap_admin = 0; // No heap admin on pages.
LD_PRELOAD_val = VG_(getenv)( VG_(LD_PRELOAD_var_name) );
tl_assert(LD_PRELOAD_val);
+ VERB(2, "clo_pages_as_heap orig LD_PRELOAD '%s'\n", LD_PRELOAD_val);
+
// Make sure the vgpreload_core-$PLATFORM entry is there, for sanity.
- s2 = VG_(strstr)(LD_PRELOAD_val, "vgpreload_core");
- tl_assert(s2);
+ s1 = VG_(strstr)(LD_PRELOAD_val, "vgpreload_core");
+ tl_assert(s1);
// Now find the vgpreload_massif-$PLATFORM entry.
- s2 = VG_(strstr)(LD_PRELOAD_val, "vgpreload_massif");
- tl_assert(s2);
+ s1 = VG_(strstr)(LD_PRELOAD_val, "vgpreload_massif");
+ tl_assert(s1);
+ s2 = s1;
- // Blank out everything to the previous ':', which must be there because
+ // Position s1 on the previous ':', which must be there because
// of the preceding vgpreload_core-$PLATFORM entry.
- for (s = s2; *s != ':'; s--) {
- *s = ' ';
- }
+ for (; *s1 != ':'; s1--)
+ ;
- // Blank out everything to the end of the entry, which will be '\0' if
- // LD_PRELOAD was empty before Valgrind started, or ':' otherwise.
- for (s = s2; *s != ':' && *s != '\0'; s++) {
- *s = ' ';
- }
+ // Position s2 on the next ':' or \0
+ for (; *s2 != ':' && *s2 != '\0'; s2++)
+ ;
+
+ // Move all characters from s2 to s1
+ while ((*s1++ = *s2++))
+ ;
+
+ VERB(2, "clo_pages_as_heap cleaned LD_PRELOAD '%s'\n", LD_PRELOAD_val);
}
// Print alloc-fns and ignore-fns, if necessary.
|
|
From: zboom <net...@fo...> - 2017-04-19 01:50:51
|
Thanks for your reply! This problem occurred when I was running OpenSwitch (http://www.openswitch.net/) on my embedded system. As you know, the OpenSwitch use OVS (http://www.openvswitch.org/) as its control-plane. And It have much more configurations than OVS. For example, there are more than one hundred interfaces. When the ovsdb-client monitored this kind of messages, the ovsdb-server will return a huge JSON message (about 24KB). This huge message could cause the EAGAIN for several times, and then the ovsdb-server would be coredumped. Because there were two recursive functions, first I doubted the stack was overflowed. But I have confirmed with the ovs-dev group, and have counted the recursive depth. The result I got was safe for the stack size. The following are two typical call trace, and the ovsdb-server program coredumped at very different place every time. 1. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x000000fff464a154 in hmap_remove (node=0xfff36e89c0, hmap=0xfff36313c0) at /usr/src/debug/ops-openvswitch/git999-r0/lib/hmap.h:245 245 /usr/src/debug/ops-openvswitch/git999-r0/lib/hmap.h: No such file or directory. (gdb) bt #0 0x000000fff464a154 in hmap_remove (node=0xfff36e89c0, hmap=0xfff36313c0) at /usr/src/debug/ops-openvswitch/git999-r0/lib/hmap.h:245 #1 shash_steal (sh=0xfff36313c0, node=0xfff36e89c0) at /usr/src/debug/ops-openvswitch/git999-r0/lib/shash.c:187 #2 0x000000fff464a1cc in shash_delete (sh=<optimized out>, node=<optimized out>) at /usr/src/debug/ops-openvswitch/git999-r0/lib/shash.c:176 #3 0x000000fff463ae34 in json_destroy_object (object=0xfff36313c0) at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:386 #4 json_destroy (json=0xfff36313a0) at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:352 #5 0x000000fff463ae24 in json_destroy_object (object=0xfff38e9420) at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:385 #6 json_destroy (json=0xfff38e9400) at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:352 #7 0x000000fff463ae24 in json_destroy_object (object=0xfff38cd600) at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:385 #8 json_destroy (json=0xfff38cd620) at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:352 #9 0x000000fff465e100 in jsonrpc_send (rpc=0xfff3832680, msg=<optimized out>) at /usr/src/debug/ops-openvswitch/git999-r0/lib/jsonrpc.c:261 #10 0x000000fff465ed30 in jsonrpc_session_send (s=<optimized out>, msg=<optimized out>) at /usr/src/debug/ops-openvswitch/git999-r0/lib/jsonrpc.c:1029 #11 0x000000fff43ee87c in ovsdb_jsonrpc_session_send (s=s@entry=0xfff3619e00, msg=0xfff36dd170) at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:1290 #12 0x000000fff43f2ac4 in ovsdb_jsonrpc_session_got_request (request=0xfff381cbd0, s=<optimized out>) at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:1256 #13 ovsdb_jsonrpc_session_run (s=<optimized out>) at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:523 #14 ovsdb_jsonrpc_session_run_all (remote=<optimized out>) at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:562 #15 ovsdb_jsonrpc_server_run (svr=0x0) at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:366 #16 0x0000000120005d60 in main_loop (exiting=0xffdfaaf8d0, run_process=0x0, remotes=0xffdfaaf888, unixctl=0x12010e4a0, all_dbs=0xffdfaaf818, jsonrpc=0x0) at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/ovsdb-server.c:161 #17 main (argc=1, argv=0x12fc19e90) at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/ovsdb-server.c:357 (gdb) bt #0 json_serialize (json=0x3fd28f747, s=s@entry=0xffdfecf5a0) at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:1499 #1 0x000000ffe999a024 in json_serialize_array (s=0xffdfecf5a0, array=0xffe8818ec8) at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:1617 #2 json_serialize (json=0xffe8818ec0, s=s@entry=0xffdfecf5a0) at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:1517 #3 0x000000ffe9999c80 in json_serialize_object_member (i=i@entry=0, node=node@entry=0xffe8818d60, s=s@entry=0xffdfecf5a0) at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:1563 #4 0x000000ffe9999e60 in json_serialize_object (s=0xffdfecf5a0, object=0xffe8818de0) at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:1592 #5 json_serialize (json=<optimized out>, s=s@entry=0xffdfecf5a0) at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:1513 #6 0x000000ffe999d210 in json_to_ds (json=<optimized out>, flags=<optimized out>, ds=<optimized out>) at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:1491 #7 0x000000ffe99bde70 in jsonrpc_send (rpc=0xffe8c32680, msg=<optimized out>) at /usr/src/debug/ops-openvswitch/git999-r0/lib/jsonrpc.c:252 #8 0x000000ffe99be9a8 in jsonrpc_session_send (s=<optimized out>, msg=<optimized out>) at /usr/src/debug/ops-openvswitch/git999-r0/lib/jsonrpc.c:1013 #9 0x000000ffe974e87c in ovsdb_jsonrpc_session_send (s=s@entry=0xffe89b8600, msg=0xffe8a85060) at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:1290 #10 0x000000ffe9752ac4 in ovsdb_jsonrpc_session_got_request (request=0xffe8a85150, s=<optimized out>) at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:1256 #11 ovsdb_jsonrpc_session_run (s=<optimized out>) at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:523 #12 ovsdb_jsonrpc_session_run_all (remote=<optimized out>) at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:562 #13 ovsdb_jsonrpc_server_run (svr=0x0) at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:366 #14 0x0000000120005d3c in main_loop (exiting=0xffdfecf8b0, run_process=0x0, remotes=0xffdfecf868, unixctl=0x12010e4a0, all_dbs=0xffdfecf7f8, jsonrpc=0x0) at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/ovsdb-server.c:161 #15 main (argc=1, argv=0x12cf24060) at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/ovsdb-server.c:357 -- View this message in context: http://valgrind.10908.n7.nabble.com/Are-there-some-protective-mechanisms-of-valgrind-on-MIPS64-especially-on-Cavium-OCTEON3-tp57593p57596.html Sent from the Valgrind - Dev mailing list archive at Nabble.com. |