internal/core: add runtime hooks

These hooks are temporary and are there to facilitate
the port of the old API on top of the new evaluator.

Eventually some of these hooks can go away.

Change-Id: I54b79194546d26e27dda1c0939e467951bf5e4a2
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6517
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
diff --git a/internal/core/adt/context.go b/internal/core/adt/context.go
index a9d37e3..19955ec 100644
--- a/internal/core/adt/context.go
+++ b/internal/core/adt/context.go
@@ -115,6 +115,11 @@
 	tentative int // set during comprehension evaluation
 }
 
+// Impl is for internal use only. This will go.
+func (c *OpContext) Impl() Runtime {
+	return c.config.Runtime
+}
+
 // If IsTentative is set, evaluation of an arc should not finalize
 // to non-concrete values.
 func (c *OpContext) IsTentative() bool {
diff --git a/internal/core/runtime/runtime.go b/internal/core/runtime/runtime.go
index 258314a..3a3c6cc 100644
--- a/internal/core/runtime/runtime.go
+++ b/internal/core/runtime/runtime.go
@@ -29,6 +29,9 @@
 // A Runtime maintains data structures for indexing and resuse for evaluation.
 type Runtime struct {
 	index *Index
+
+	// Data holds the legacy index strut. It is for transitional purposes only.
+	Data interface{}
 }
 
 // New creates a new Runtime.
diff --git a/internal/internal.go b/internal/internal.go
index ec94f5d..8585992 100644
--- a/internal/internal.go
+++ b/internal/internal.go
@@ -74,6 +74,9 @@
 // GetRuntime reports the runtime for an Instance or Value.
 var GetRuntime func(instance interface{}) interface{}
 
+// GetRuntime reports the runtime for an Instance or Value.
+var GetRuntimeNew func(instance interface{}) interface{}
+
 // MakeInstance makes a new instance from a value.
 var MakeInstance func(value interface{}) (instance interface{})
 
@@ -82,6 +85,11 @@
 // keys.
 var CheckAndForkRuntime func(runtime, value interface{}) interface{}
 
+// CheckAndForkRuntime checks that value is created using runtime, panicking
+// if it does not, and returns a forked runtime that will discard additional
+// keys.
+var CheckAndForkRuntimeNew func(runtime, value interface{}) interface{}
+
 // BaseContext is used as CUEs default context for arbitrary-precision decimals
 var BaseContext = apd.BaseContext.WithPrecision(24)