machine ops in JSCallReducer

34 views
Skip to first unread message

snek

unread,
Jun 17, 2024, 9:50:44 PM (12 days ago) Jun 17
to v8-dev
Hiya, I'm trying to write a reducer that looks something like this:

Reduction JSCallReducer::ReduceGetContinuationPreservedEmbedderData(Node* node) {
  JSCallNode n(node);
  Effect effect = n.effect();
  Control control = n.control();

  Node* data = effect = graph()->NewNode(
      jsgraph()->machine()->Load(MachineType::AnyTagged()),
      jsgraph()->ExternalConstant(
          ExternalReference::continuation_preserved_embedder_data(isolate())),
      jsgraph()->IntPtrConstant(0), effect, control);

  ReplaceWithValue(node, data, effect, control);
  return Replace(node);
}

But I'm getting assertion failures like this:

# Fatal error in ../../src/compiler/representation-change.cc, line 165
# Debug check failed: !output_type.IsNone() implies !output_type.Is(Type::Machine()).

It seems like machine ops like Load are not really supposed to be used this soon in the compiler pipeline, so I'm curious what the "right way" to go about doing this is.

Darius Mercadier

unread,
Jun 18, 2024, 4:08:09 PM (11 days ago) Jun 18
to v8-...@googlegroups.com
Hi,

Indeed, machine operations are not allowed before SimplifiedLowering (with some exceptions, which usually require using EnterMachineGraph/ExitMachineGraph).

Given the lowering that you're showing, I would suggest to move it to machine-lowering-reducer-inl.h in Turboshaft, or maybe just do on-the-fly in the Turbofan->Turboshaft translation (in turboshaft/graph-builder.cc) so that you don't even need to define the Turboshaft operation.

Cheers,
Darius


--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/2b7d1a4b-349a-4ea9-ae1c-00a644f64347n%40googlegroups.com.

Darius Mercadier

Software Engineer

dmerc...@google.com


Google Germany GmbH

Erika-Mann-Straße 33

80636 München


Geschäftsführer: Paul Manicle, Liana Sebastian

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg


Diese E-Mail ist vertraulich. Falls Sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde. 

     

This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.

Reply all
Reply to author
Forward
0 new messages