Since they can do whatever they want with the valves the engine can be high compression to accommodate diesel ignition and when using gasoline it just leave the exhaust valve open a bit longer to lower the compression just before injecting gasoline and activating the spark.