Bug 1130166 - Use SizePrintfMacros.h when printing line numbers. r=Waldo

This commit is contained in:
Tom Tromey 2015-02-27 08:19:00 -05:00
parent 50b2350e9d
commit 40cdae4e2c
21 changed files with 128 additions and 91 deletions

View File

@ -7,6 +7,7 @@
#include "gc/Tracer.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/SizePrintfMacros.h"
#include "jsapi.h"
#include "jsfun.h"
@ -273,7 +274,7 @@ JS_GetTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc, void *thing,
case JSTRACE_SCRIPT:
{
JSScript *script = static_cast<JSScript *>(thing);
JS_snprintf(buf, bufsize, " %s:%u", script->filename(), unsigned(script->lineno()));
JS_snprintf(buf, bufsize, " %s:%" PRIuSIZE, script->filename(), script->lineno());
break;
}

View File

@ -4,6 +4,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/SizePrintfMacros.h"
#include "jsprf.h"
#include "jsutil.h"
#include "jit/arm/Simulator-arm.h"
@ -961,9 +963,9 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
}
}
JitSpew(JitSpew_BaselineBailouts, " Resuming %s pc offset %d (op %s) (line %d) of %s:%d",
JitSpew(JitSpew_BaselineBailouts, " Resuming %s pc offset %d (op %s) (line %d) of %s:%" PRIuSIZE,
resumeAfter ? "after" : "at", (int) pcOff, js_CodeName[op],
PCToLineNumber(script, pc), script->filename(), (int) script->lineno());
PCToLineNumber(script, pc), script->filename(), script->lineno());
JitSpew(JitSpew_BaselineBailouts, " Bailout kind: %s",
BailoutKindString(bailoutKind));
#endif
@ -1119,13 +1121,13 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
char *buf = js_pod_malloc<char>(len);
if (buf == nullptr)
return false;
JS_snprintf(buf, len, "%s %s %s on line %d of %s:%d",
JS_snprintf(buf, len, "%s %s %s on line %u of %s:%" PRIuSIZE,
BailoutKindString(bailoutKind),
resumeAfter ? "after" : "at",
js_CodeName[op],
int(PCToLineNumber(script, pc)),
PCToLineNumber(script, pc),
filename,
int(script->lineno()));
script->lineno());
cx->runtime()->spsProfiler.markEvent(buf);
js_free(buf);
}

View File

@ -8,6 +8,7 @@
#include "mozilla/Casting.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/SizePrintfMacros.h"
#include "mozilla/TemplateLib.h"
#include "jslibmath.h"
@ -58,13 +59,13 @@ FallbackICSpew(JSContext *cx, ICFallbackStub *stub, const char *fmt, ...)
va_end(args);
JitSpew(JitSpew_BaselineICFallback,
"Fallback hit for (%s:%d) (pc=%d,line=%d,uses=%d,stubs=%d): %s",
"Fallback hit for (%s:%" PRIuSIZE ") (pc=%" PRIuSIZE ",line=%d,uses=%d,stubs=%" PRIuSIZE "): %s",
script->filename(),
script->lineno(),
(int) script->pcToOffset(pc),
script->pcToOffset(pc),
PCToLineNumber(script, pc),
script->getWarmUpCount(),
(int) stub->numOptimizedStubs(),
stub->numOptimizedStubs(),
fmtbuf);
}
}
@ -83,10 +84,10 @@ TypeFallbackICSpew(JSContext *cx, ICTypeMonitor_Fallback *stub, const char *fmt,
va_end(args);
JitSpew(JitSpew_BaselineICFallback,
"Type monitor fallback hit for (%s:%d) (pc=%d,line=%d,uses=%d,stubs=%d): %s",
"Type monitor fallback hit for (%s:%" PRIuSIZE ") (pc=%" PRIuSIZE ",line=%d,uses=%d,stubs=%d): %s",
script->filename(),
script->lineno(),
(int) script->pcToOffset(pc),
script->pcToOffset(pc),
PCToLineNumber(script, pc),
script->getWarmUpCount(),
(int) stub->numOptimizedMonitorStubs(),
@ -939,7 +940,7 @@ DoWarmUpCounterFallback(JSContext *cx, ICWarmUpCounter_Fallback *stub, BaselineF
// Ensure that Ion-compiled code is available.
JitSpew(JitSpew_BaselineOSR,
"WarmUpCounter for %s:%d reached %d at pc %p, trying to switch to Ion!",
"WarmUpCounter for %s:%" PRIuSIZE " reached %d at pc %p, trying to switch to Ion!",
script->filename(), script->lineno(), (int) script->getWarmUpCount(), (void *) pc);
void *jitcode = nullptr;
if (!EnsureCanEnterIon(cx, stub, frame, script, pc, &jitcode))
@ -3741,7 +3742,7 @@ TryAttachNativeGetElemStub(JSContext *cx, HandleScript script, jsbytecode *pc,
if (getterIsScripted) {
JitSpew(JitSpew_BaselineIC,
" Generating GetElem(Native %s%s call scripted %s:%d) stub "
" Generating GetElem(Native %s%s call scripted %s:%" PRIuSIZE ") stub "
"(obj=%p, shape=%p, holder=%p, holderShape=%p)",
(obj == holder) ? "direct" : "prototype",
needsAtomize ? " atomizing" : "",
@ -6504,7 +6505,7 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc,
return true;
}
JitSpew(JitSpew_BaselineIC, " Generating GetProp(NativeObj/ScriptedGetter %s:%d) stub",
JitSpew(JitSpew_BaselineIC, " Generating GetProp(NativeObj/ScriptedGetter %s:%" PRIuSIZE ") stub",
callee->nonLazyScript()->filename(), callee->nonLazyScript()->lineno());
ICGetProp_CallScripted::Compiler compiler(cx, monitorStub, obj, holder, callee,
@ -8110,7 +8111,7 @@ TryAttachSetAccessorPropStub(JSContext *cx, HandleScript script, jsbytecode *pc,
return true;
}
JitSpew(JitSpew_BaselineIC, " Generating SetProp(NativeObj/ScriptedSetter %s:%d) stub",
JitSpew(JitSpew_BaselineIC, " Generating SetProp(NativeObj/ScriptedSetter %s:%" PRIuSIZE ") stub",
callee->nonLazyScript()->filename(), callee->nonLazyScript()->lineno());
ICSetProp_CallScripted::Compiler compiler(cx, obj, holder, callee, script->pcToOffset(pc));
@ -9377,7 +9378,7 @@ TryAttachCallStub(JSContext *cx, ICCall_Fallback *stub, HandleScript script, jsb
}
JitSpew(JitSpew_BaselineIC,
" Generating Call_Scripted stub (fun=%p, %s:%d, cons=%s, spread=%s)",
" Generating Call_Scripted stub (fun=%p, %s:%" PRIuSIZE ", cons=%s, spread=%s)",
fun.get(), fun->nonLazyScript()->filename(), fun->nonLazyScript()->lineno(),
constructing ? "yes" : "no", isSpread ? "yes" : "no");
ICCallScriptedCompiler compiler(cx, stub->fallbackMonitorStub()->firstMonitorStub(),

View File

@ -8,6 +8,8 @@
#include "jit/C1Spewer.h"
#include "mozilla/SizePrintfMacros.h"
#include <time.h>
#include "jit/LinearScan.h"
@ -34,8 +36,8 @@ C1Spewer::beginFunction(MIRGraph *graph, HandleScript script)
fprintf(spewout_, "begin_compilation\n");
if (script) {
fprintf(spewout_, " name \"%s:%d\"\n", script->filename(), (int)script->lineno());
fprintf(spewout_, " method \"%s:%d\"\n", script->filename(), (int)script->lineno());
fprintf(spewout_, " name \"%s:%" PRIuSIZE "\"\n", script->filename(), script->lineno());
fprintf(spewout_, " method \"%s:%" PRIuSIZE "\"\n", script->filename(), script->lineno());
} else {
fprintf(spewout_, " name \"asm.js compilation\"\n");
fprintf(spewout_, " method \"asm.js compilation\"\n");

View File

@ -10,6 +10,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/SizePrintfMacros.h"
#include "jslibmath.h"
#include "jsmath.h"
@ -3645,7 +3646,7 @@ CodeGenerator::maybeCreateScriptCounts()
JSScript *innerScript = block->info().script();
description = (char *) js_calloc(200);
if (description) {
JS_snprintf(description, 200, "%s:%d",
JS_snprintf(description, 200, "%s:%" PRIuSIZE,
innerScript->filename(), innerScript->lineno());
}
}
@ -3912,7 +3913,8 @@ CodeGenerator::generateBody()
#ifdef DEBUG
const char *filename = nullptr;
unsigned lineNumber = 0, columnNumber = 0;
size_t lineNumber = 0;
unsigned columnNumber = 0;
if (current->mir()->info().script()) {
filename = current->mir()->info().script()->filename();
if (current->mir()->pc())
@ -3922,8 +3924,8 @@ CodeGenerator::generateBody()
lineNumber = current->mir()->lineno();
columnNumber = current->mir()->columnIndex();
}
JitSpew(JitSpew_Codegen, "# block%lu %s:%u:%u%s:", i,
filename ? filename : "?", lineNumber, columnNumber,
JitSpew(JitSpew_Codegen, "# block%" PRIuSIZE " %s:%" PRIuSIZE ":%u%s:",
i, filename ? filename : "?", lineNumber, columnNumber,
current->mir()->isLoopHeader() ? " (loop header)" : "");
#endif

View File

@ -7,6 +7,7 @@
#include "jit/Ion.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/SizePrintfMacros.h"
#include "mozilla/ThreadLocal.h"
#include "jscompartment.h"
@ -1938,7 +1939,7 @@ IonCompile(JSContext *cx, JSScript *script,
if (!recompile)
builderScript->setIonScript(cx, ION_COMPILING_SCRIPT);
JitSpew(JitSpew_IonLogs, "Can't log script %s:%d. (Compiled on background thread.)",
JitSpew(JitSpew_IonLogs, "Can't log script %s:%" PRIuSIZE ". (Compiled on background thread.)",
builderScript->filename(), builderScript->lineno());
JSRuntime *rt = cx->runtime();
@ -2080,13 +2081,13 @@ Compile(JSContext *cx, HandleScript script, BaselineFrame *osrFrame, jsbytecode
}
if (!CheckScript(cx, script, bool(osrPc))) {
JitSpew(JitSpew_IonAbort, "Aborted compilation of %s:%d", script->filename(), script->lineno());
JitSpew(JitSpew_IonAbort, "Aborted compilation of %s:%" PRIuSIZE, script->filename(), script->lineno());
return Method_CantCompile;
}
MethodStatus status = CheckScriptSize(cx, script);
if (status != Method_Compiled) {
JitSpew(JitSpew_IonAbort, "Aborted compilation of %s:%d", script->filename(), script->lineno());
JitSpew(JitSpew_IonAbort, "Aborted compilation of %s:%" PRIuSIZE, script->filename(), script->lineno());
return status;
}
@ -2506,7 +2507,7 @@ InvalidateActivation(FreeOp *fop, const JitActivationIterator &activations, bool
type = "Baseline";
else if (it.isBailoutJS())
type = "Bailing";
JitSpew(JitSpew_IonInvalidate, "#%d %s JS frame @ %p, %s:%d (fun: %p, script: %p, pc %p)",
JitSpew(JitSpew_IonInvalidate, "#%d %s JS frame @ %p, %s:%" PRIuSIZE " (fun: %p, script: %p, pc %p)",
frameno, type, it.fp(), it.script()->filename(), it.script()->lineno(),
it.maybeCallee(), (JSScript *)it.script(), it.returnAddressToFp());
break;
@ -2682,7 +2683,7 @@ jit::Invalidate(TypeZone &types, FreeOp *fop,
if (!co->ion())
continue;
JitSpew(JitSpew_IonInvalidate, " Invalidate %s:%u, IonScript %p",
JitSpew(JitSpew_IonInvalidate, " Invalidate %s:%" PRIuSIZE ", IonScript %p",
co->script()->filename(), co->script()->lineno(), co->ion());
// Keep the ion script alive during the invalidation and flag this
@ -2771,7 +2772,7 @@ jit::Invalidate(JSContext *cx, JSScript *script, bool resetUses, bool cancelOffT
return false;
// Construct the descriptive string.
JS_snprintf(buf, len, "Invalidate %s:%u", filename, (unsigned int)script->lineno());
JS_snprintf(buf, len, "Invalidate %s:%" PRIuSIZE, filename, script->lineno());
cx->runtime()->spsProfiler.markEvent(buf);
js_free(buf);
}
@ -2815,7 +2816,7 @@ jit::FinishInvalidation(FreeOp *fop, JSScript *script)
void
jit::ForbidCompilation(JSContext *cx, JSScript *script)
{
JitSpew(JitSpew_IonAbort, "Disabling Ion compilation of script %s:%d",
JitSpew(JitSpew_IonAbort, "Disabling Ion compilation of script %s:%" PRIuSIZE,
script->filename(), script->lineno());
CancelOffThreadIonCompile(cx->compartment(), script);

View File

@ -1834,7 +1834,7 @@ CheckOperand(const MNode *consumer, const MUse *use, int32_t *usesBalance)
#ifdef _DEBUG_CHECK_OPERANDS_USES_BALANCE
fprintf(stderr, "==Check Operand\n");
use->producer()->dump(stderr);
fprintf(stderr, " index: %zu\n", use->consumer()->indexOf(use));
fprintf(stderr, " index: %" PRIuSIZE "\n", use->consumer()->indexOf(use));
use->consumer()->dump(stderr);
fprintf(stderr, "==End\n");
#endif
@ -1852,7 +1852,7 @@ CheckUse(const MDefinition *producer, const MUse *use, int32_t *usesBalance)
#ifdef _DEBUG_CHECK_OPERANDS_USES_BALANCE
fprintf(stderr, "==Check Use\n");
use->producer()->dump(stderr);
fprintf(stderr, " index: %zu\n", use->consumer()->indexOf(use));
fprintf(stderr, " index: %" PRIuSIZE "\n", use->consumer()->indexOf(use));
use->consumer()->dump(stderr);
fprintf(stderr, "==End\n");
#endif

View File

@ -7,6 +7,7 @@
#include "jit/IonBuilder.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/SizePrintfMacros.h"
#include "builtin/Eval.h"
#include "builtin/TypedObject.h"
@ -390,7 +391,7 @@ IonBuilder::InliningDecision
IonBuilder::DontInline(JSScript *targetScript, const char *reason)
{
if (targetScript) {
JitSpew(JitSpew_Inlining, "Cannot inline %s:%u: %s",
JitSpew(JitSpew_Inlining, "Cannot inline %s:%" PRIuSIZE ": %s",
targetScript->filename(), targetScript->lineno(), reason);
} else {
JitSpew(JitSpew_Inlining, "Cannot inline: %s", reason);
@ -777,14 +778,14 @@ IonBuilder::build()
#ifdef DEBUG
if (info().isAnalysis()) {
JitSpew(JitSpew_IonScripts, "Analyzing script %s:%d (%p) %s",
JitSpew(JitSpew_IonScripts, "Analyzing script %s:%" PRIuSIZE " (%p) %s",
script()->filename(), script()->lineno(), (void *)script(),
AnalysisModeString(info().analysisMode()));
} else {
JitSpew(JitSpew_IonScripts, "%sompiling script %s:%d (%p) (warmup-counter=%d, level=%s)",
JitSpew(JitSpew_IonScripts, "%sompiling script %s:%" PRIuSIZE " (%p) (warmup-counter=%" PRIuSIZE ", level=%s)",
(script()->hasIonScript() ? "Rec" : "C"),
script()->filename(), script()->lineno(), (void *)script(),
(int)script()->getWarmUpCount(), OptimizationLevelString(optimizationInfo().level()));
script()->getWarmUpCount(), OptimizationLevelString(optimizationInfo().level()));
}
#endif
@ -933,7 +934,7 @@ IonBuilder::buildInline(IonBuilder *callerBuilder, MResumePoint *callerResumePoi
if (!init())
return false;
JitSpew(JitSpew_IonScripts, "Inlining script %s:%d (%p)",
JitSpew(JitSpew_IonScripts, "Inlining script %s:%" PRIuSIZE " (%p)",
script()->filename(), script()->lineno(), (void *)script());
callerBuilder_ = callerBuilder;
@ -1191,7 +1192,7 @@ IonBuilder::initScopeChain(MDefinition *callee)
bool
IonBuilder::initArgumentsObject()
{
JitSpew(JitSpew_IonMIR, "%s:%d - Emitting code to initialize arguments object! block=%p",
JitSpew(JitSpew_IonMIR, "%s:%" PRIuSIZE " - Emitting code to initialize arguments object! block=%p",
script()->filename(), script()->lineno(), current);
MOZ_ASSERT(info().needsArgsObj());
MCreateArgumentsObject *argsObj = MCreateArgumentsObject::New(alloc(), current->scopeChain());
@ -4767,7 +4768,7 @@ IonBuilder::makeInliningDecision(JSObject *targetArg, CallInfo &callInfo)
info().analysisMode() != Analysis_DefiniteProperties)
{
trackOptimizationOutcome(TrackedOutcome::CantInlineNotHot);
JitSpew(JitSpew_Inlining, "Cannot inline %s:%u: callee is insufficiently hot.",
JitSpew(JitSpew_Inlining, "Cannot inline %s:%" PRIuSIZE ": callee is insufficiently hot.",
targetScript->filename(), targetScript->lineno());
return InliningDecision_WarmUpCountTooLow;
}

View File

@ -6,6 +6,7 @@
#include "jit/IonCaches.h"
#include "mozilla/SizePrintfMacros.h"
#include "mozilla/TemplateLib.h"
#include "jstypes.h"
@ -414,7 +415,7 @@ IonCache::linkAndAttachStub(JSContext *cx, MacroAssembler &masm, StubAttacher &a
}
if (pc_) {
JitSpew(JitSpew_IonIC, "Cache %p(%s:%d/%d) generated %s %s stub at %p",
JitSpew(JitSpew_IonIC, "Cache %p(%s:%" PRIuSIZE "/%" PRIuSIZE ") generated %s %s stub at %p",
this, script_->filename(), script_->lineno(), script_->pcToOffset(pc_),
attachKind, CacheName(kind()), code->raw());
} else {
@ -1889,7 +1890,7 @@ GetPropertyIC::update(JSContext *cx, HandleScript outerScript, size_t cacheIndex
// 2) There's no need to dynamically monitor the return type. This would
// be complicated since (due to GVN) there can be multiple pc's
// associated with a single idempotent cache.
JitSpew(JitSpew_IonIC, "Invalidating from idempotent cache %s:%d",
JitSpew(JitSpew_IonIC, "Invalidating from idempotent cache %s:%" PRIuSIZE,
outerScript->filename(), outerScript->lineno());
outerScript->setInvalidatedIdempotentCache();

View File

@ -6,6 +6,8 @@
#include "jit/JitFrames-inl.h"
#include "mozilla/SizePrintfMacros.h"
#include "jsfun.h"
#include "jsobj.h"
#include "jsscript.h"
@ -2595,8 +2597,8 @@ JitFrameIterator::dumpBaseline() const
fprintf(stderr, " global frame, no callee\n");
}
fprintf(stderr, " file %s line %u\n",
script()->filename(), (unsigned) script()->lineno());
fprintf(stderr, " file %s line %" PRIuSIZE "\n",
script()->filename(), script()->lineno());
JSContext *cx = GetJSContextFromJitCode();
RootedScript script(cx);
@ -2644,8 +2646,8 @@ InlineFrameIterator::dump() const
fprintf(stderr, " global frame, no callee\n");
}
fprintf(stderr, " file %s line %u\n",
script()->filename(), (unsigned) script()->lineno());
fprintf(stderr, " file %s line %" PRIuSIZE "\n",
script()->filename(), script()->lineno());
fprintf(stderr, " script = %p, pc = %p\n", (void*) script(), pc());
fprintf(stderr, " current op: %s\n", js_CodeName[*pc()]);
@ -2774,9 +2776,9 @@ JitFrameIterator::verifyReturnAddressUsingNativeToBytecodeMap()
JitSpew(JitSpew_Profiling, "Found bytecode location of depth %d:", depth);
for (size_t i = 0; i < location.length(); i++) {
JitSpew(JitSpew_Profiling, " %s:%d - %d",
JitSpew(JitSpew_Profiling, " %s:%" PRIuSIZE " - %" PRIuSIZE,
location[i].script->filename(), location[i].script->lineno(),
(int) (location[i].pc - location[i].script->code()));
size_t(location[i].pc - location[i].script->code()));
}
if (type_ == JitFrame_IonJS) {
@ -2786,14 +2788,15 @@ JitFrameIterator::verifyReturnAddressUsingNativeToBytecodeMap()
MOZ_ASSERT(idx < location.length());
MOZ_ASSERT_IF(idx < location.length() - 1, inlineFrames.more());
JitSpew(JitSpew_Profiling, "Match %d: ION %s:%d(%d) vs N2B %s:%d(%d)",
JitSpew(JitSpew_Profiling,
"Match %d: ION %s:%" PRIuSIZE "(%" PRIuSIZE ") vs N2B %s:%" PRIuSIZE "(%" PRIuSIZE ")",
(int)idx,
inlineFrames.script()->filename(),
inlineFrames.script()->lineno(),
inlineFrames.pc() - inlineFrames.script()->code(),
size_t(inlineFrames.pc() - inlineFrames.script()->code()),
location[idx].script->filename(),
location[idx].script->lineno(),
location[idx].pc - location[idx].script->code());
size_t(location[idx].pc - location[idx].script->code()));
MOZ_ASSERT(inlineFrames.script() == location[idx].script);

View File

@ -8,6 +8,7 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/SizePrintfMacros.h"
#include "mozilla/UniquePtr.h"
#include "jsprf.h"
#include "gc/Marking.h"
@ -311,7 +312,7 @@ JitcodeGlobalEntry::createScriptString(JSContext *cx, JSScript *script, size_t *
size_t linenoLength = 0;
char linenoStr[15];
if (hasName || (script->functionNonDelazifying() || script->isForEval())) {
linenoLength = JS_snprintf(linenoStr, 15, "%u", (unsigned) script->lineno());
linenoLength = JS_snprintf(linenoStr, 15, "%" PRIuSIZE, script->lineno());
hasLineno = true;
}
@ -1236,14 +1237,14 @@ JitcodeIonTable::WriteIonTable(CompactBufferWriter &writer,
MOZ_ASSERT(writer.length() == 0);
MOZ_ASSERT(scriptListSize > 0);
JitSpew(JitSpew_Profiling, "Writing native to bytecode map for %s:%d (%d entries)",
JitSpew(JitSpew_Profiling, "Writing native to bytecode map for %s:%" PRIuSIZE " (%" PRIuSIZE " entries)",
scriptList[0]->filename(), scriptList[0]->lineno(),
int(end - start));
mozilla::PointerRangeSize(start, end));
JitSpew(JitSpew_Profiling, " ScriptList of size %d", int(scriptListSize));
for (uint32_t i = 0; i < scriptListSize; i++) {
JitSpew(JitSpew_Profiling, " Script %d - %s:%d",
int(i), scriptList[i]->filename(), int(scriptList[i]->lineno()));
JitSpew(JitSpew_Profiling, " Script %d - %s:%" PRIuSIZE,
int(i), scriptList[i]->filename(), scriptList[i]->lineno());
}
// Write out runs first. Keep a vector tracking the positive offsets from payload

View File

@ -8,6 +8,7 @@
#include "mozilla/FloatingPoint.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/SizePrintfMacros.h"
#include <ctype.h>
@ -761,8 +762,8 @@ MConstant::printOpcode(FILE *fp) const
}
if (fun->hasScript()) {
JSScript *script = fun->nonLazyScript();
fprintf(fp, " (%s:%d)",
script->filename() ? script->filename() : "", (int) script->lineno());
fprintf(fp, " (%s:%" PRIuSIZE ")",
script->filename() ? script->filename() : "", script->lineno());
}
fprintf(fp, " at %p", (void *) fun);
break;

View File

@ -6,6 +6,8 @@
#include "jit/OptimizationTracking.h"
#include "mozilla/SizePrintfMacros.h"
#include "ds/Sort.h"
#include "jit/IonBuilder.h"
#include "jit/JitcodeMap.h"
@ -842,7 +844,7 @@ SpewConstructor(TypeSet::Type ty, JSFunction *constructor)
JS_snprintf(buf, mozilla::ArrayLength(buf), "??");
const char *filename;
uint32_t lineno;
size_t lineno;
if (constructor->hasScript()) {
filename = constructor->nonLazyScript()->filename();
lineno = constructor->nonLazyScript()->lineno();
@ -851,7 +853,7 @@ SpewConstructor(TypeSet::Type ty, JSFunction *constructor)
lineno = constructor->lazyScript()->lineno();
}
JitSpew(JitSpew_OptimizationTracking, " Unique type %s has constructor %s (%s:%u)",
JitSpew(JitSpew_OptimizationTracking, " Unique type %s has constructor %s (%s:%" PRIuSIZE ")",
TypeSet::TypeString(ty), buf, filename, lineno);
#endif
}

View File

@ -205,8 +205,8 @@ PerfSpewer::writeProfile(JSScript *script,
size_t size = code->instructionsSize();
if (size > 0) {
fprintf(PerfFilePtr, "%zx %zx %s:%zu: Func%02d\n",
reinterpret_cast<uintptr_t>(code->raw()),
fprintf(PerfFilePtr, "%p %" PRIxSIZE " %s:%" PRIuSIZE ": Func%02d\n",
code->raw(),
size,
script->filename(),
script->lineno(),
@ -229,7 +229,7 @@ PerfSpewer::writeProfile(JSScript *script,
size_t prologueSize = masm.actualOffset(basicBlocks_[0].start.offset());
if (prologueSize > 0) {
fprintf(PerfFilePtr, "%zx %zx %s:%zu: Func%02d-Prologue\n",
fprintf(PerfFilePtr, "%" PRIxSIZE " %" PRIxSIZE " %s:%" PRIuSIZE ": Func%02d-Prologue\n",
funcStart, prologueSize, script->filename(), script->lineno(), thisFunctionIndex);
}
@ -242,9 +242,8 @@ PerfSpewer::writeProfile(JSScript *script,
MOZ_ASSERT(cur <= blockStart);
if (cur < blockStart) {
fprintf(PerfFilePtr, "%zx %zx %s:%zu: Func%02d-Block?\n",
static_cast<uintptr_t>(cur),
static_cast<uintptr_t>(blockStart - cur),
fprintf(PerfFilePtr, "%" PRIxPTR " %" PRIxPTR " %s:%" PRIuSIZE ": Func%02d-Block?\n",
cur, blockStart - cur,
script->filename(), script->lineno(),
thisFunctionIndex);
}
@ -253,8 +252,8 @@ PerfSpewer::writeProfile(JSScript *script,
size_t size = blockEnd - blockStart;
if (size > 0) {
fprintf(PerfFilePtr, "%zx %zx %s:%d:%d: Func%02d-Block%d\n",
static_cast<uintptr_t>(blockStart), size,
fprintf(PerfFilePtr, "%" PRIxPTR " %" PRIxSIZE " %s:%d:%d: Func%02d-Block%d\n",
blockStart, size,
r.filename, r.lineNumber, r.columnNumber,
thisFunctionIndex, r.id);
}
@ -262,7 +261,7 @@ PerfSpewer::writeProfile(JSScript *script,
MOZ_ASSERT(cur <= funcEndInlineCode);
if (cur < funcEndInlineCode) {
fprintf(PerfFilePtr, "%zx %zx %s:%zu: Func%02d-Epilogue\n",
fprintf(PerfFilePtr, "%" PRIxPTR " %" PRIxPTR " %s:%" PRIuSIZE ": Func%02d-Epilogue\n",
cur, funcEndInlineCode - cur,
script->filename(), script->lineno(),
thisFunctionIndex);
@ -270,7 +269,7 @@ PerfSpewer::writeProfile(JSScript *script,
MOZ_ASSERT(funcEndInlineCode <= funcEnd);
if (funcEndInlineCode < funcEnd) {
fprintf(PerfFilePtr, "%zx %zx %s:%zu: Func%02d-OOL\n",
fprintf(PerfFilePtr, "%" PRIxPTR " %" PRIxPTR " %s:%" PRIuSIZE ": Func%02d-OOL\n",
funcEndInlineCode, funcEnd - funcEndInlineCode,
script->filename(), script->lineno(),
thisFunctionIndex);
@ -292,7 +291,7 @@ js::jit::writePerfSpewerBaselineProfile(JSScript *script, JitCode *code)
size_t size = code->instructionsSize();
if (size > 0) {
fprintf(PerfFilePtr, "%zx %zx %s:%zu: Baseline\n",
fprintf(PerfFilePtr, "%" PRIxPTR " %" PRIxSIZE " %s:%" PRIuSIZE ": Baseline\n",
reinterpret_cast<uintptr_t>(code->raw()),
size, script->filename(), script->lineno());
}
@ -311,7 +310,7 @@ js::jit::writePerfSpewerJitCodeProfile(JitCode *code, const char *msg)
size_t size = code->instructionsSize();
if (size > 0) {
fprintf(PerfFilePtr, "%zx %zx %s (%p 0x%zx)\n",
fprintf(PerfFilePtr, "%" PRIxPTR " %" PRIxSIZE " %s (%p 0x%" PRIxSIZE ")\n",
reinterpret_cast<uintptr_t>(code->raw()),
size, msg, code->raw(), size);
}
@ -330,7 +329,8 @@ js::jit::writePerfSpewerAsmJSFunctionMap(uintptr_t base, uintptr_t size,
if (!lockPerfMap())
return;
fprintf(PerfFilePtr, "%zx %zx %s:%d:%d: Function %s\n", base, size, filename, lineno, colIndex, funcName);
fprintf(PerfFilePtr, "%" PRIxPTR " %" PRIxPTR " %s:%u:%u: Function %s\n",
base, size, filename, lineno, colIndex, funcName);
unlockPerfMap();
}
@ -378,7 +378,7 @@ js::jit::writePerfSpewerAsmJSBlocksMap(uintptr_t baseAddress, size_t funcStartOf
size_t funcEnd = baseAddress + funcStartOffset + funcSize;
if (prologueSize > 0) {
fprintf(PerfFilePtr, "%zx %zx %s: Function %s - Prologue\n",
fprintf(PerfFilePtr, "%" PRIxSIZE " %" PRIxSIZE " %s: Function %s - Prologue\n",
baseAddress + funcStartOffset, prologueSize, filename, funcName);
}
@ -390,7 +390,7 @@ js::jit::writePerfSpewerAsmJSBlocksMap(uintptr_t baseAddress, size_t funcStartOf
MOZ_ASSERT(cur <= blockStart);
if (cur < blockStart) {
fprintf(PerfFilePtr, "%zx %zx %s: Function %s - unknown block\n",
fprintf(PerfFilePtr, "%" PRIxSIZE " %" PRIxSIZE " %s: Function %s - unknown block\n",
cur, blockStart - cur,
filename,
funcName);
@ -399,7 +399,7 @@ js::jit::writePerfSpewerAsmJSBlocksMap(uintptr_t baseAddress, size_t funcStartOf
size_t size = blockEnd - blockStart;
if (size > 0) {
fprintf(PerfFilePtr, "%zx %zx %s:%d:%d: Function %s - Block %d\n",
fprintf(PerfFilePtr, "%" PRIxSIZE " %" PRIxSIZE " %s:%u:%u: Function %s - Block %d\n",
blockStart, size,
filename, r.lineNumber, r.columnNumber,
funcName, r.id);
@ -408,12 +408,12 @@ js::jit::writePerfSpewerAsmJSBlocksMap(uintptr_t baseAddress, size_t funcStartOf
MOZ_ASSERT(cur <= funcEndInlineCode);
if (cur < funcEndInlineCode)
fprintf(PerfFilePtr, "%zx %zx %s: Function %s - Epilogue\n",
fprintf(PerfFilePtr, "%" PRIxSIZE " %" PRIxSIZE " %s: Function %s - Epilogue\n",
cur, funcEndInlineCode - cur, filename, funcName);
MOZ_ASSERT(funcEndInlineCode <= funcEnd);
if (funcEndInlineCode < funcEnd) {
fprintf(PerfFilePtr, "%zx %zx %s: Function %s - OOL\n",
fprintf(PerfFilePtr, "%" PRIxSIZE " %" PRIxSIZE " %s: Function %s - OOL\n",
funcEndInlineCode, funcEnd - funcEndInlineCode, filename, funcName);
}
@ -429,7 +429,8 @@ js::jit::writePerfSpewerAsmJSEntriesAndExits(uintptr_t base, size_t size)
if (!lockPerfMap())
return;
fprintf(PerfFilePtr, "%zx %zx AsmJS Entries and Exits (0x%zx 0x%zx)\n", base, size, base, size);
fprintf(PerfFilePtr, "%" PRIxPTR " %" PRIxSIZE " AsmJS Entries and Exits (0x%" PRIxPTR " 0x%" PRIxSIZE ")\n",
base, size, base, size);
unlockPerfMap();
}

View File

@ -6,6 +6,8 @@
#include "jit/RematerializedFrame.h"
#include "mozilla/SizePrintfMacros.h"
#include "jit/JitFrames.h"
#include "vm/ArgumentsObject.h"
#include "vm/Debugger.h"
@ -168,8 +170,8 @@ RematerializedFrame::dump()
fprintf(stderr, " global frame, no callee\n");
}
fprintf(stderr, " file %s line %u offset %zu\n",
script()->filename(), (unsigned) script()->lineno(),
fprintf(stderr, " file %s line %" PRIuSIZE " offset %" PRIuSIZE "\n",
script()->filename(), script()->lineno(),
script()->pcToOffset(pc()));
fprintf(stderr, " script = %p\n", (void*) script());

View File

@ -33,6 +33,7 @@
#include "mozilla/FloatingPoint.h"
#include "mozilla/Likely.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/SizePrintfMacros.h"
#include "asmjs/AsmJSValidate.h"
#include "jit/arm/Assembler-arm.h"
@ -1045,7 +1046,7 @@ Simulator::setLastDebuggerInput(char *input)
void
Simulator::FlushICache(void *start_addr, size_t size)
{
JitSpewCont(JitSpew_CacheFlush, "[%p %zx]", start_addr, size);
JitSpewCont(JitSpew_CacheFlush, "[%p %" PRIxSIZE "]", start_addr, size);
if (Simulator::ICacheCheckingEnabled) {
Simulator *sim = Simulator::Current();

View File

@ -13,6 +13,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/SizePrintfMacros.h"
#include "mozilla/TemplateLib.h"
#include <string.h>
@ -3764,8 +3765,8 @@ dumpValue(const Value &v)
}
if (fun->hasScript()) {
JSScript *script = fun->nonLazyScript();
fprintf(stderr, " (%s:%d)",
script->filename() ? script->filename() : "", (int) script->lineno());
fprintf(stderr, " (%s:%" PRIuSIZE ")",
script->filename() ? script->filename() : "", script->lineno());
}
fprintf(stderr, " at %p>", (void *) fun);
} else if (v.isObject()) {
@ -4002,8 +4003,8 @@ js_DumpInterpreterFrame(JSContext *cx, InterpreterFrame *start)
}
fputc('\n', stderr);
fprintf(stderr, "file %s line %u\n",
i.script()->filename(), (unsigned) i.script()->lineno());
fprintf(stderr, "file %s line %" PRIuSIZE "\n",
i.script()->filename(), i.script()->lineno());
if (jsbytecode *pc = i.pc()) {
fprintf(stderr, " pc = %p\n", pc);

View File

@ -10,6 +10,8 @@
#include "jsopcodeinlines.h"
#include "mozilla/SizePrintfMacros.h"
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
@ -289,10 +291,10 @@ js::DumpCompartmentPCCounts(JSContext *cx)
if (!sprinter.init())
return;
fprintf(stdout, "--- SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno());
fprintf(stdout, "--- SCRIPT %s:%" PRIuSIZE " ---\n", script->filename(), script->lineno());
DumpPCCounts(cx, script, &sprinter);
fputs(sprinter.string(), stdout);
fprintf(stdout, "--- END SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno());
fprintf(stdout, "--- END SCRIPT %s:%" PRIuSIZE " ---\n", script->filename(), script->lineno());
}
}
@ -731,7 +733,7 @@ DisassembleAtPC(JSContext *cx, JSScript *scriptArg, bool lines,
return false;
if (showAll)
Sprint(sp, "%s:%u\n", script->filename(), script->lineno());
Sprint(sp, "%s:%" PRIuSIZE "\n", script->filename(), script->lineno());
if (pc != nullptr)
sp->put(" ");

View File

@ -471,6 +471,11 @@ BuildArgArray(const char *fmt, va_list ap, NumArgStateVector& nas)
nas[cn].type = TYPE_INT64;
c = *p++;
}
} else if (c == 'z' || c == 'I') {
static_assert(sizeof(size_t) == sizeof(int32_t) || sizeof(size_t) == sizeof(int64_t),
"size_t is not one of the expected sizes");
nas[cn].type = sizeof(size_t) == sizeof(int64_t) ? TYPE_INT64 : TYPE_INT32;
c = *p++;
}
// format
@ -700,6 +705,11 @@ dosprintf(SprintfState *ss, const char *fmt, va_list ap)
type = TYPE_INT64;
c = *fmt++;
}
} else if (c == 'z' || c == 'I') {
static_assert(sizeof(size_t) == sizeof(int32_t) || sizeof(size_t) == sizeof(int64_t),
"size_t is not one of the expected sizes");
type = sizeof(size_t) == sizeof(int64_t) ? TYPE_INT64 : TYPE_INT32;
c = *fmt++;
}
// format

View File

@ -7,6 +7,7 @@
#include "vm/ScopeObject-inl.h"
#include "mozilla/PodOperations.h"
#include "mozilla/SizePrintfMacros.h"
#include "jscompartment.h"
#include "jsiter.h"
@ -2609,14 +2610,14 @@ AnalyzeEntrainedVariablesInScript(JSContext *cx, HandleScript script, HandleScri
buf.printf(" ");
}
buf.printf("(%s:%d) has variables entrained by ", script->filename(), script->lineno());
buf.printf("(%s:%" PRIuSIZE ") has variables entrained by ", script->filename(), script->lineno());
if (JSAtom *name = innerScript->functionNonDelazifying()->displayAtom()) {
buf.putString(name);
buf.printf(" ");
}
buf.printf("(%s:%d) ::", innerScript->filename(), innerScript->lineno());
buf.printf("(%s:%" PRIuSIZE ") ::", innerScript->filename(), innerScript->lineno());
for (PropertyNameSet::Range r = remainingNames.all(); !r.empty(); r.popFront()) {
buf.printf(" ");

View File

@ -9,6 +9,7 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/PodOperations.h"
#include "mozilla/SizePrintfMacros.h"
#include "jsapi.h"
#include "jscntxt.h"
@ -2357,7 +2358,7 @@ TypeZone::addPendingRecompile(JSContext *cx, const RecompileInfo &info)
if (!co || !co->isValid() || co->pendingInvalidation())
return;
InferSpew(ISpewOps, "addPendingRecompile: %p:%s:%d",
InferSpew(ISpewOps, "addPendingRecompile: %p:%s:%" PRIuSIZE,
co->script(), co->script()->filename(), co->script()->lineno());
co->setPendingInvalidation();
@ -4152,7 +4153,7 @@ TypeScript::printTypes(JSContext *cx, HandleScript script) const
fprintf(stderr, "Eval");
else
fprintf(stderr, "Main");
fprintf(stderr, " %p %s:%d ", script.get(), script->filename(), (int) script->lineno());
fprintf(stderr, " %p %s:%" PRIuSIZE " ", script.get(), script->filename(), script->lineno());
if (script->functionNonDelazifying()) {
if (js::PropertyName *name = script->functionNonDelazifying()->name())