--- a/src/Pure/PIDE/session.scala Wed Aug 28 10:18:50 2019 +0200
+++ b/src/Pure/PIDE/session.scala Wed Aug 28 22:59:49 2019 +0200
@@ -52,6 +52,7 @@
deps_changed: Boolean,
doc_edits: List[Document.Edit_Command],
consolidate: List[Document.Node.Name],
+ share_common_data: Boolean,
version: Document.Version)
case object Change_Flush
@@ -63,7 +64,8 @@
case class Statistics(props: Properties.T)
case class Global_Options(options: Options)
case object Caret_Focus
- case class Raw_Edits(doc_blobs: Document.Blobs, edits: List[Document.Edit_Text])
+ case class Raw_Edits(
+ doc_blobs: Document.Blobs, edits: List[Document.Edit_Text], share_common_data: Boolean)
case class Dialog_Result(id: Document_ID.Generic, serial: Long, result: String)
case class Build_Theories(id: String, master_dir: Path, theories: List[(Options, List[Path])])
case class Commands_Changed(
@@ -235,15 +237,17 @@
doc_blobs: Document.Blobs,
text_edits: List[Document.Edit_Text],
consolidate: List[Document.Node.Name],
+ share_common_data: Boolean,
version_result: Promise[Document.Version])
private val change_parser = Consumer_Thread.fork[Text_Edits]("change_parser", daemon = true)
{
- case Text_Edits(previous, doc_blobs, text_edits, consolidate, version_result) =>
+ case Text_Edits(previous, doc_blobs, text_edits, consolidate, share_common_data, version_result) =>
val prev = previous.get_finished
val change =
Timing.timeit("parse_change", timing) {
- resources.parse_change(reparse_limit, prev, doc_blobs, text_edits, consolidate)
+ resources.parse_change(
+ reparse_limit, prev, doc_blobs, text_edits, consolidate, share_common_data)
}
version_result.fulfill(change.version)
manager.send(change)
@@ -390,7 +394,8 @@
def handle_raw_edits(
doc_blobs: Document.Blobs = Document.Blobs.empty,
edits: List[Document.Edit_Text] = Nil,
- consolidate: List[Document.Node.Name] = Nil)
+ consolidate: List[Document.Node.Name] = Nil,
+ share_common_data: Boolean = false)
//{{{
{
require(prover.defined)
@@ -401,8 +406,9 @@
val version = Future.promise[Document.Version]
global_state.change(_.continue_history(previous, edits, version))
- raw_edits.post(Session.Raw_Edits(doc_blobs, edits))
- change_parser.send(Text_Edits(previous, doc_blobs, edits, consolidate, version))
+ raw_edits.post(Session.Raw_Edits(doc_blobs, edits, share_common_data))
+ change_parser.send(
+ Text_Edits(previous, doc_blobs, edits, consolidate, share_common_data, version))
}
//}}}
@@ -440,6 +446,10 @@
val assignment = global_state.value.the_assignment(change.previous).check_finished
global_state.change(_.define_version(change.version, assignment))
+
+ if (change.share_common_data) {
+ prover.get.protocol_command("ML_Heap.share_common_data")
+ }
prover.get.update(change.previous.id, change.version.id, change.doc_edits, change.consolidate)
resources.commit(change)
}
@@ -610,8 +620,9 @@
case Cancel_Exec(exec_id) if prover.defined =>
prover.get.cancel_exec(exec_id)
- case Session.Raw_Edits(doc_blobs, edits) if prover.defined =>
- handle_raw_edits(doc_blobs = doc_blobs, edits = edits)
+ case Session.Raw_Edits(doc_blobs, edits, share_common_data) if prover.defined =>
+ handle_raw_edits(doc_blobs = doc_blobs, edits = edits,
+ share_common_data = share_common_data)
case Session.Dialog_Result(id, serial, result) if prover.defined =>
prover.get.dialog_result(serial, result)
@@ -703,8 +714,13 @@
def cancel_exec(exec_id: Document_ID.Exec)
{ manager.send(Cancel_Exec(exec_id)) }
- def update(doc_blobs: Document.Blobs, edits: List[Document.Edit_Text])
- { if (edits.nonEmpty) manager.send_wait(Session.Raw_Edits(doc_blobs, edits)) }
+ def update(
+ doc_blobs: Document.Blobs,
+ edits: List[Document.Edit_Text],
+ share_common_data: Boolean = false)
+ {
+ if (edits.nonEmpty) manager.send_wait(Session.Raw_Edits(doc_blobs, edits, share_common_data))
+ }
def update_options(options: Options)
{ manager.send_wait(Update_Options(options)) }