diff options
author | dos-reis <gdr@axiomatics.org> | 2013-05-11 01:24:23 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2013-05-11 01:24:23 +0000 |
commit | 157ed93b6265cbae38aa14127cdeb9c2d3048961 (patch) | |
tree | 0a755ce00ef09931a23968937b0d3ede5d5e649d /src/interp | |
parent | 1570ef4a2c61066611edaf7c7e34c9dd3baec27b (diff) | |
download | open-axiom-157ed93b6265cbae38aa14127cdeb9c2d3048961.tar.gz |
Introduce opcodes for arrays constructions
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/g-opt.boot | 20 | ||||
-rw-r--r-- | src/interp/lisp-backend.boot | 7 |
2 files changed, 25 insertions, 2 deletions
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index 782fb33f..6e379d21 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -657,12 +657,14 @@ $VMsideEffectFreeOperators == %sname %strlength %streq %i2s %schar %strlt %strconc %strcopy %bytevec2str %str2bytevec + %array %simpleArray %emptyArray %list2array %initialElement %initialContents %vector %aref %vref %vlength %vcopy %bitvector %bitvecnot %bitvecand %bitvecnand %bivecor %bitvecnor %bitvecxor %bitveccopy %bitvecconc %bitveclength %bitvecref %bitveceq %bitveclt %before? %equal %sptreq %ident? %property %tref - %void %retract %pullback %lambda %closure %external) + %void %retract %pullback %lambda %closure %external + %type2form) ++ List of simple VM operators $simpleVMoperators == @@ -991,6 +993,17 @@ optIquo(x is ['%iquo,a,b]) == integer? a and integer? b => a quo b x +--% Arrays + +optEmptyArray ['%emptyArray,t] == + ['%array,'%icst0,'%elementType,['%type2form,t]] + +optSimpleArray ['%simpleArray,t,n,x] == + ['%array,n,'%elementType,['%type2form,t],'%initialElement,x] + +optList2Array ['%list2array,l,t] == + ['%array,['%llength, l],'%elementType,['%type2form,t],'%initialContents,l] + --% --% optimizer hash table --% @@ -1028,7 +1041,10 @@ for x in '((%call optCall) _ (%scope optScope)_ (%when optCond)_ (%retract optRetract)_ - (%pullback optPullback)) _ + (%pullback optPullback)_ + (%emptyArray optEmptyArray)_ + (%simpleArray optSimpleArray)_ + (%list2array optList2Array)) _ repeat property(first x,'OPTIMIZE) := second x --much quicker to call functions if they have an SBC diff --git a/src/interp/lisp-backend.boot b/src/interp/lisp-backend.boot index 73af3a96..efc3e8a6 100644 --- a/src/interp/lisp-backend.boot +++ b/src/interp/lisp-backend.boot @@ -486,6 +486,11 @@ expandTry ['%try,expr,handlers,cleanup] == ++ Opcodes with direct mapping to target operations. for x in [ + -- Lisp keywords + ['%elementType, : KEYWORD::ELEMENT_-TYPE], + ['%initialElement, : KEYWORD::INITIAL_-ELEMENT], + ['%initialContents, : KEYWORD::INITIAL_-CONTENTS], + -- Boolean constants -- ['%false, :'NIL], ['%true, :'T], @@ -620,6 +625,7 @@ for x in [ ['%lconcat, :'APPEND], -- simple vector operations + ['%array, :'MAKE_-ARRAY], ['%vfill, :'FILL], ['%vlength, :'sizeOfSimpleArray], ['%vector, :'VECTOR], @@ -642,6 +648,7 @@ for x in [ ['%strcopy, :'COPY_-SEQ], -- general utility + ['%type2form,:'getVMType], ['%hash, :'SXHASH], ['%equal, :'EQUAL], ['%tref, :'shellEntry], |