Changeset 107
- Timestamp:
- 07/10/05 18:24:36 (3 years ago)
- Files:
-
- trunk/dsp/ServletCompiler.d (modified) (1 diff)
- trunk/dsp/ServletGenerator.d (modified) (1 diff)
- trunk/dsp/servlet/DSPLibraryCache.d (modified) (1 diff)
- trunk/misc/Exportable.d (modified) (1 diff)
- trunk/misc/TypeLibraryDLLStub.d (modified) (1 diff)
- trunk/server.d (modified) (2 diffs)
- trunk/xml/xpath/fn.d (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/dsp/ServletCompiler.d
r102 r107 85 85 " " ~ requestConfig.options ~ 86 86 " -op" ~ 87 " -LNOM" ~ 87 88 " -od" ~ requestConfig.tempDirectory ~ 88 89 " -of" ~ requestConfig.destServletFilename ~ trunk/dsp/ServletGenerator.d
r104 r107 41 41 T opCall(Box value) 42 42 { 43 assert (value.type ! ==null);43 assert (value.type !is null); 44 44 45 45 if (typeid(T) is value.type) trunk/dsp/servlet/DSPLibraryCache.d
r98 r107 28 28 private import dsp.servlet.DSPLibrary; 29 29 30 /* 31 /+ 32 Behavior: 33 34 As each library is used, it is promoted up one position in the cache. 35 The overall action is not unlike a bubble-sort, where multiple sorting 36 actions eventually sort the cache out. 37 +/ 38 class DSPLibraryCache{ 39 struct CacheEntry{ 40 DSPLibrary lib; 41 char[] key; 42 } 43 44 CacheEntry[] positions; 45 DSPLibrary[char[]] cache; 46 uint freeCount; 47 48 this(uint capacity){ 49 freeCount = capacity; 50 positions.length = capacity; 51 } 52 53 protected void addLibrary(DSPLibrary lib,char[] key){ 54 debug printf("addLibrary\n"); 55 56 if(freeCount==0){ 57 // search for the lowest ranking library that is not in use 58 for(uint i=positions.length-1; i>=0; i--){ 59 if(!positions[i].lib.inUse){ 60 61 // close out the library 62 positions[i].lib.unload(); 63 64 // remove the entry from the cache 65 cache.remove(positions[i].key); 66 67 // replace the idle library with this one instead 68 positions[i].lib = lib; 69 positions[i].key = key; 70 cache[key] = lib; 71 72 return; 73 } 74 } 75 76 // balloon the cache since all libs are being used 77 freeCount++; 78 79 //(fallthrough) 80 } 81 82 positions[$-freeCount] = lib; 83 cache[key] = lib; 84 freeCount--; 85 } 86 87 protected void removeLibrary(DSPLibrary lib){ 88 debug printf("removeLibrary\n"); 89 assert(!lib.inUse); 90 91 for(uint i=0; i<positions.length; i++){ 92 if(positions[i].lib == lib){ 93 char[] key = positions[i].key; 94 if(i < positions.length-1){ 95 positions[i..$-1] = [i+1..$]; // move entire array up to fill the gap 96 } 97 positions[$-1] = null; 98 freeCount++; 99 cache.remove(key); 100 return; 101 } 102 } 103 assert(false); 104 } 105 106 protected void getLibrary(char[] key){ 107 debug printf("getLibrary\n"); 108 if(key in cache){ 109 for(uint i=0; i<positions.length; i++){ 110 111 } 112 return cache[key]; 113 } 114 return null; 115 } 116 117 118 void put(char[] path,DSPLibrary lib){ 119 // place entry in the queue 120 if(lib){ 121 synchronized(this){ 122 assert(!(path in cache)); 123 addLibrary(lib,path.dup); 124 } 125 } 126 127 // remove the entry from the queue 128 else{ 129 //remove this entry from the list 130 synchronized(this){ 131 removeLibrary(lib); 132 } 133 } 134 } 135 136 DSPLibrary get(char[] path){ 137 DSPLibrary result; 138 synchronized(this) result = getLibrary(lib); 139 return result; 140 } 141 142 char[] toString(){ 143 char[] output = ""; 144 return output; 145 } 146 }*/ 147 148 149 30 150 private import mango.cache.HashMap; 151 31 152 32 153 class DSPLibraryCache{ trunk/misc/Exportable.d
r40 r107 59 59 } 60 60 c = c.base; 61 }while(c ! ==null);61 }while(c !is null); 62 62 return null; 63 63 } trunk/misc/TypeLibraryDLLStub.d
r40 r107 64 64 obj = typeConstructors[typename](); 65 65 version(externalGC){} else{ 66 if(obj ! ==null){66 if(obj !is null){ 67 67 watchList[(cast(Object)obj).toHash()] = obj; 68 68 } trunk/server.d
r97 r107 38 38 39 39 // for threads 40 import mango. base.System;40 import mango.sys.System; 41 41 42 42 //for logging … … 120 120 121 121 int main () 122 { 122 { 123 123 BasicConfigurator.configure (); 124 124 mainLogger = Logger.getLogger ("dsp.servlets"); 125 125 mainLogger.setLevel (mainLogger.Level.Info); 126 126 127 127 try { 128 128 testServletEngine(); trunk/xml/xpath/fn.d
r69 r107 38 38 static XPathVar abs(XPathContext context,XPathVar[] args){ 39 39 mixin XPathFunctionAssert!(xtd.numeric); 40 smartAssert(arg1 ! ==null);40 smartAssert(arg1 !is null); 41 41 42 42 return arg1.abs.toVar(); … … 46 46 static XPathVar ceiling(XPathContext context,XPathVar[] args){ 47 47 mixin XPathFunctionAssert!(xtd.numeric); 48 smartAssert(arg1 ! ==null);48 smartAssert(arg1 !is null); 49 49 50 50 return arg1.ceiling.toVar(); … … 54 54 static XPathVar floor(XPathContext context,XPathVar[] args){ 55 55 mixin XPathFunctionAssert!(xtd.numeric); 56 smartAssert(arg1 ! ==null);56 smartAssert(arg1 !is null); 57 57 58 58 return arg1.floor.toVar(); … … 62 62 static XPathVar round(XPathContext context,XPathVar[] args){ 63 63 mixin XPathFunctionAssert!(xtd.numeric); 64 smartAssert(arg1 ! ==null);64 smartAssert(arg1 !is null); 65 65 66 66 return arg1.round.toVar(); … … 71 71 static XPathVar roundHalfToEven(XPathContext context,XPathVar[] args){ 72 72 mixin XPathFunctionAssert!(xtd.numeric,xs.integer); 73 smartAssert(arg1 ! ==null);73 smartAssert(arg1 !is null); 74 74 75 75 return arg1.roundHalfToEven(arg2).toVar(); … … 82 82 static XPathVar codepointsToString(XPathContext context,XPathVar[] args){ 83 83 mixin XPathFunctionAssert!(Sequence!(xs.integer)); 84 smartAssert(arg1 ! ==null);84 smartAssert(arg1 !is null); 85 85 86 86 xs.string result = new xs.string(); … … 96 96 static XPathVar stringToCodepoints(XPathContext context,XPathVar[] args){ 97 97 mixin XPathFunctionAssert!(xs.string); 98 smartAssert(arg1 ! ==null);98 smartAssert(arg1 !is null); 99 99 100 100 XPathVar result;
