diff modules/string.tp @ 243:5b830147c1cd

Use a lightweight substring object in a few places in the parser to improve performance for large files.
author Mike Pavone <pavone@retrodev.com>
date Sun, 05 Jan 2014 23:07:26 -0800
parents 38140b7dbe3d
children 32964a4e7a33
line wrap: on
line diff
--- a/modules/string.tp	Sun Jan 05 20:56:25 2014 -0800
+++ b/modules/string.tp	Sun Jan 05 23:07:26 2014 -0800
@@ -27,6 +27,18 @@
 		}
 	}
 
+	llMessage: compareSub withVars: {
+		argb <- string ptr
+		myoff <- obj_int32 ptr
+		boff <- obj_int32 ptr
+		clen <- obj_int32 ptr
+		intret <- obj_int32 ptr
+	} andCode: :argb myoff boff clen {
+		intret <- make_object: (addr_of: obj_int32_meta) NULL 0
+		intret num!: (memcmp: data + (myoff num) (argb data) + (boff num) (clen num))
+		intret
+	}
+
 	llMessage: NEQ_ withVars: {
 		argb <- (string ptr)
 	} andCode: :argb {
@@ -275,4 +287,5 @@
 
 	isInteger? <- { false }
 	isString? <- { true }
+	isBasicString? <- { true }
 }