| 1 | /* |
| 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | * |
| 6 | * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. |
| 7 | */ |
| 8 | |
| 9 | /* |
| 10 | * @f run_isolate |
| 11 | * @a M. Kersten |
| 12 | * @+ Run isolation |
| 13 | * Run isolation involves making available a private copy of the MAL |
| 14 | * block being executed for further massaging, e.g. code replacements |
| 15 | * or flow-of-control adjustments. |
| 16 | * These changes should be confined to a single execution. The next time around |
| 17 | * there may be a different situation to take care off. This is achieved by |
| 18 | * replacing the current program with a private copy. |
| 19 | * |
| 20 | * The easiest way is to duplicate the MAL program and assign the old |
| 21 | * version to its history. This way any reference to individual instructions |
| 22 | * remain valid and the result of the schedule action can be inspected |
| 23 | * with the debugger. |
| 24 | * Its lifetime then is identical to that of the main program call. |
| 25 | * |
| 26 | * @end example |
| 27 | * This function with its history remain available as long as f() |
| 28 | * is defined. |
| 29 | */ |
| 30 | /* |
| 31 | * @+ Isolation implementation |
| 32 | */ |
| 33 | #include "monetdb_config.h" |
| 34 | #include "run_isolate.h" |
| 35 | |
| 36 | str |
| 37 | RUNisolation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p) |
| 38 | { |
| 39 | (void) cntxt; |
| 40 | (void) stk; |
| 41 | addtoMalBlkHistory(mb); |
| 42 | removeInstruction(mb, p); |
| 43 | return MAL_SUCCEED; |
| 44 | } |
| 45 | |