~zorba-coders/zorba/trunk

« back to all changes in this revision

Viewing changes to src/runtime/dctx/dctx_impl.cpp

  • Committer: Zorba Jenkins
  • Author(s): Federico Cavalieri
  • Date: 2014-04-29 20:37:35 UTC
  • mfrom: (11714.2.7 feature-caching-annotations)
  • Revision ID: jenkins@lambda.nu-20140429203735-mgu2acarnn71p66l
Greatly improved function caching.

* Changed function annotations:
  - %an:deterministic: disables caching (previously %an:no-cache)
  - %an:strictlydeterministic: enables caching for deterministic and non-deterministic functions. Cache is only within the same snapshot.
  - %an:cache enables caching  for deterministic, non-deterministic and sequential functions. Caches is across snapshots. (unchanged)
  - %an:exclude-from-cache-key(n) specifies that a function argument has to be ignored when computing the cache key
  - %an:compare-with-deep-equal(n) specifies that a function argument has to be compared with deep-equal semantics
  
* Changed criteria for default annotations of internal and external functions:
  - Functions which have no %an:deterministic, %an:nondeterministic or %an:strictlydeterministic annotations and all their parameter and the return types are atomics are now automatically annotated %an:strictlydeterministic
  - All the other functions are annotated %an:deterministic
* Added snapshot id in global dynamic context
* Added dynamic context xquery module
* Added strict equality hashmap
* Reimplemented %an:cache
* Enabled caching for function that have non atomic arguments
* Whenever the eager evaluation of a function arguments raises an error, the evaluation is retried without cache. The function cache is then disabled if it was automatically detected.
Approved: Matthias Brantner, Federico Cavalieri

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2006-2008 The FLWOR Foundation.
 
3
 * 
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at
 
7
 * 
 
8
 * http://www.apache.org/licenses/LICENSE-2.0
 
9
 * 
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
#include "stdafx.h"
 
17
 
 
18
#include "runtime/dctx/dctx.h"
 
19
 
 
20
#include "system/globalenv.h"
 
21
 
 
22
#include "runtime/visitors/planiter_visitor.h"
 
23
 
 
24
#include "context/dynamic_context.h"
 
25
#include "context/static_context.h"
 
26
 
 
27
#include "store/api/item_factory.h"
 
28
#include "zorbatypes/integer.h"
 
29
 
 
30
 
 
31
namespace zorba
 
32
{
 
33
bool
 
34
DctxSnapshotIdIterator::nextImpl(store::Item_t& result, PlanState& planState) const
 
35
{
 
36
  PlanIteratorState *state;
 
37
  DEFAULT_STACK_INIT( PlanIteratorState, state, planState );
 
38
  GENV_ITEMFACTORY->createUnsignedLong( result, xs_unsignedLong(planState.theGlobalDynCtx->getSnapshotID()) );
 
39
  STACK_PUSH( true, state );
 
40
  STACK_END( state );
 
41
}
 
42
 
 
43
}/* namespace zorba */
 
44
/* vim:set et sw=2 ts=2: */