+
+ static void replaceWithLoad(CodeLocationConvertibleLoad label)
+ {
+ AssemblerType::replaceWithLoad(label.dataLocation());
+ }
+
+ static void replaceWithAddressComputation(CodeLocationConvertibleLoad label)
+ {
+ AssemblerType::replaceWithAddressComputation(label.dataLocation());
+ }
+
+private:
+
+#if ENABLE(MASM_PROBE)
+
+ struct PrintArg {
+
+ enum class Type {
+ AllRegisters,
+ RegisterID,
+ FPRegisterID,
+ ConstCharPtr,
+ ConstVoidPtr,
+ IntptrValue,
+ UintptrValue,
+ };
+
+ PrintArg(AllRegisters&)
+ : type(Type::AllRegisters)
+ {
+ }
+
+ PrintArg(RegisterID regID)
+ : type(Type::RegisterID)
+ {
+ u.gpRegisterID = regID;
+ }
+
+ PrintArg(FPRegisterID regID)
+ : type(Type::FPRegisterID)
+ {
+ u.fpRegisterID = regID;
+ }
+
+ PrintArg(const char* ptr)
+ : type(Type::ConstCharPtr)
+ {
+ u.constCharPtr = ptr;
+ }
+
+ PrintArg(const void* ptr)
+ : type(Type::ConstVoidPtr)
+ {
+ u.constVoidPtr = ptr;
+ }
+
+ PrintArg(int value)
+ : type(Type::IntptrValue)
+ {
+ u.intptrValue = value;
+ }
+
+ PrintArg(unsigned value)
+ : type(Type::UintptrValue)
+ {
+ u.intptrValue = value;
+ }
+
+ PrintArg(intptr_t value)
+ : type(Type::IntptrValue)
+ {
+ u.intptrValue = value;
+ }
+
+ PrintArg(uintptr_t value)
+ : type(Type::UintptrValue)
+ {
+ u.uintptrValue = value;
+ }
+
+ Type type;
+ union {
+ RegisterID gpRegisterID;
+ FPRegisterID fpRegisterID;
+ const char* constCharPtr;
+ const void* constVoidPtr;
+ intptr_t intptrValue;
+ uintptr_t uintptrValue;
+ } u;
+ };
+
+ typedef Vector<PrintArg> PrintArgsList;
+
+ template<typename FirstArg, typename... Arguments>
+ static void appendPrintArg(PrintArgsList* argsList, FirstArg& firstArg, Arguments... otherArgs)
+ {
+ argsList->append(PrintArg(firstArg));
+ appendPrintArg(argsList, otherArgs...);
+ }
+
+ static void appendPrintArg(PrintArgsList*) { }
+
+
+ template<typename... Arguments>
+ static void printInternal(MacroAssemblerType* masm, Arguments... args)
+ {
+ auto argsList = std::make_unique<PrintArgsList>();
+ appendPrintArg(argsList.get(), args...);
+ masm->probe(printCallback, argsList.release());
+ }
+
+ static void printCallback(ProbeContext* context)
+ {
+ typedef PrintArg Arg;
+ PrintArgsList& argsList =
+ *reinterpret_cast<PrintArgsList*>(context->arg1);
+ for (size_t i = 0; i < argsList.size(); i++) {
+ auto& arg = argsList[i];
+ switch (arg.type) {
+ case Arg::Type::AllRegisters:
+ MacroAssemblerType::printCPU(context->cpu);
+ break;
+ case Arg::Type::RegisterID:
+ MacroAssemblerType::printRegister(context->cpu, arg.u.gpRegisterID);
+ break;
+ case Arg::Type::FPRegisterID:
+ MacroAssemblerType::printRegister(context->cpu, arg.u.fpRegisterID);
+ break;
+ case Arg::Type::ConstCharPtr:
+ dataLog(arg.u.constCharPtr);
+ break;
+ case Arg::Type::ConstVoidPtr:
+ dataLogF("%p", arg.u.constVoidPtr);
+ break;
+ case Arg::Type::IntptrValue:
+ dataLog(arg.u.intptrValue);
+ break;
+ case Arg::Type::UintptrValue:
+ dataLog(arg.u.uintptrValue);
+ break;
+ }
+ }
+ }
+
+#endif // ENABLE(MASM_PROBE)
+
+}; // class AbstractMacroAssembler