Bug 522316 - more miscellaneous drift from tamarin, r=dvander.

--HG--
extra : rebase_source : 7b92362823d4ef60ebced322c1588b6cd9f445e4
This commit is contained in:
Graydon Hoare 2009-10-14 13:48:00 -07:00
parent 4af41cb172
commit 95f52752f3
8 changed files with 47 additions and 33 deletions

View File

@ -45,6 +45,11 @@
#include "../core/CodegenLIR.h"
#endif
#ifdef _MSC_VER
// disable some specific warnings which are normally useful, but pervasive in the code-gen macros
#pragma warning(disable:4310) // cast truncates constant value
#endif
namespace nanojit
{
#ifdef NJ_VERBOSE

View File

@ -71,11 +71,13 @@ namespace nanojit
uint32_t lowwatermark; /* we pre-allocate entries from 0 upto this index-1; so dynamic entries are added above this index */
};
#ifdef AVMPLUS_WIN32
#define AVMPLUS_ALIGN16(type) __declspec(align(16)) type
#else
#define AVMPLUS_ALIGN16(type) type __attribute__ ((aligned (16)))
#endif
#ifndef AVMPLUS_ALIGN16
#ifdef AVMPLUS_WIN32
#define AVMPLUS_ALIGN16(type) __declspec(align(16)) type
#else
#define AVMPLUS_ALIGN16(type) type __attribute__ ((aligned (16)))
#endif
#endif
struct Stats
{

View File

@ -346,7 +346,7 @@ namespace nanojit
const Seq<Node>* current;
public:
Iter(HashMap<K,T,H>& map) : map(map), bucket(map.nbuckets-1), current(NULL)
Iter(HashMap<K,T,H>& map) : map(map), bucket((int)map.nbuckets-1), current(NULL)
{ }
/** return true if more (k,v) remain to be visited */

View File

@ -69,6 +69,7 @@
#endif
namespace nanojit {
class Fragment;
struct SideExit;
struct SwitchInfo;
@ -107,7 +108,7 @@ namespace nanojit {
#define stack_direction(n) -n
#endif
#define isSPorFP(r) ( (r)==SP || (r)==FP )
#define isSPorFP(r) ( (r)==SP || (r)==FP )
#ifdef MOZ_NO_VARADIC_MACROS
static void asm_output(const char *f, ...) {}
@ -129,8 +130,8 @@ namespace nanojit {
outputAddr=(_logc->lcbits & LC_NoCodeAddrs) ? false : true; \
} \
} while (0) /* no semi */
#define gpn(r) regNames[(r)]
#define fpn(r) regNames[(r)]
#define gpn(r) regNames[(r)]
#define fpn(r) regNames[(r)]
#else
#define asm_output(...)
#define gpn(r)

View File

@ -1098,7 +1098,11 @@ namespace nanojit
#else
if (pc - instr < top) {
verbose_only(if (_logc->lcbits & LC_Assembly) outputf("newpage %p:", pc);)
codeAlloc();
if (_inExit)
codeAlloc(exitStart, exitEnd, _nIns verbose_only(, exitBytes));
else
codeAlloc(codeStart, codeEnd, _nIns verbose_only(, codeBytes));
// this jump will call underrunProtect again, but since we're on a new
// page, nothing will happen.
br(pc, 0);
@ -1175,17 +1179,25 @@ namespace nanojit
void Assembler::nativePageSetup() {
if (!_nIns) {
codeAlloc();
codeAlloc(codeStart, codeEnd, _nIns verbose_only(, codeBytes));
IF_PEDANTIC( pedanticTop = _nIns; )
}
if (!_nExitIns) {
codeAlloc(true);
codeAlloc(exitStart, exitEnd, _nExitIns verbose_only(, exitBytes));
}
}
void Assembler::nativePageReset()
{}
// Increment the 32-bit profiling counter at pCtr, without
// changing any registers.
verbose_only(
void Assembler::asm_inc_m32(uint32_t* /*pCtr*/)
{
}
)
void Assembler::nPatchBranch(NIns *branch, NIns *target) {
// ppc relative offsets are based on the addr of the branch instruction
ptrdiff_t bd = target - branch;
@ -1279,6 +1291,7 @@ namespace nanojit
case LIR_qirsh:
case LIR_qilsh:
case LIR_qxor:
case LIR_qiadd:
asm_arith(ins);
break;
default:

View File

@ -992,13 +992,6 @@ namespace nanojit
FCMPD(rLhs, rRhs);
}
verbose_only(
void Assembler::asm_inc_m32(uint32_t* pCtr)
{
// TODO(asm_inc_m32);
}
)
void Assembler::nativePageReset()
{
}
@ -1016,13 +1009,20 @@ namespace nanojit
codeAlloc(exitStart, exitEnd, _nExitIns verbose_only(, exitBytes));
}
// Increment the 32-bit profiling counter at pCtr, without
// changing any registers.
verbose_only(
void Assembler::asm_inc_m32(uint32_t*)
{
// todo: implement this
}
)
void
Assembler::underrunProtect(int n)
{
NIns *eip = _nIns;
if (eip - n < (_inExit ? exitStart : codeStart)) {
// We are done with the current page. Tell Valgrind that new code
// has been generated.
if (_inExit)
codeAlloc(exitStart, exitEnd, _nIns verbose_only(, exitBytes));
else

View File

@ -1432,8 +1432,9 @@ namespace nanojit
// Increment the 32-bit profiling counter at pCtr, without
// changing any registers.
verbose_only(
void Assembler::asm_inc_m32(uint32_t* pCtr)
void Assembler::asm_inc_m32(uint32_t* /*pCtr*/)
{
// todo: implement this
}
)

View File

@ -40,15 +40,9 @@
* ***** END LICENSE BLOCK ***** */
#include "nanojit.h"
#ifdef _MAC
// for MakeDataExecutable
#include <CoreServices/CoreServices.h>
#endif
#if defined AVMPLUS_UNIX || defined AVMPLUS_MAC
#include <sys/mman.h>
#include <errno.h>
#include <stdlib.h>
#ifdef _MSC_VER
// disable some specific warnings which are normally useful, but pervasive in the code-gen macros
#pragma warning(disable:4310) // cast truncates constant value
#endif
namespace nanojit
@ -1731,8 +1725,6 @@ namespace nanojit
NIns *eip = _nIns;
NanoAssertMsg(n<=LARGEST_UNDERRUN_PROT, "constant LARGEST_UNDERRUN_PROT is too small");
if (eip - n < (_inExit ? exitStart : codeStart)) {
// We are done with the current page. Tell Valgrind that new code
// has been generated.
if (_inExit)
codeAlloc(exitStart, exitEnd, _nIns verbose_only(, exitBytes));
else