Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Below is the source code snippet for the circular buffer:
- (defclass circular-buffer ()
- ((store :accessor store :type vector)
- (head :accessor head :type (integer 0) :initform 0)
- (tail :accessor tail :type (integer 0) :initform 0)
- (granularity :accessor granularity :type (integer 0) :initarg :granularity)
- (charge :accessor charge :type (integer 0) :initform 0))
- (:default-initargs
- :granularity 16))
- (defmethod initialize-instance :after ((o circular-buffer) &rest rest &key size granularity)
- (declare (ignore rest) (type (integer 1) size))
- (let ((actual-size (+ (- size (mod size granularity)) granularity)))
- (setf (store o) (make-array actual-size :initial-element nil :adjustable t)
- (charge o) (- actual-size (1+ size)))))
- Below is the SLDB stack trace in slime. The lowest frame does not show any of the actual variables one would expect:
- Evaluating call:
- (+ SIZE 1)
- With unknown arguments
- [Condition of type SB-EXT:STEP-FORM-CONDITION]
- Restarts:
- 0: [STEP-CONTINUE] Resume normal execution
- 1: [STEP-OUT] Resume stepping after returning from this function
- 2: [STEP-NEXT] Step over call
- 3: [STEP-INTO] Step into call
- 4: [*ABORT] Return to SLIME's top level.
- 5: [ABORT] abort thread (#<THREAD "worker" RUNNING {10043AECD3}>)
- Backtrace:
- 0: ((:METHOD INITIALIZE-INSTANCE :AFTER (CIRCULAR-BUFFER:CIRCULAR-BUFFER)) #<CIRCULAR-BUFFER:CIRCULAR-BUFFER {10049AE8F3}> :SIZE 89 :GRANULARITY 16) [fast-method]
- Locals:
- #:.DEFAULTING-TEMP. = 89
- #:.DEFAULTING-TEMP.#1 = 16
- CIRCULAR-BUFFER::O = #<CIRCULAR-BUFFER:CIRCULAR-BUFFER {10049AE8F3}>
- 1: ((LAMBDA (SB-PCL::|.P0.|) :IN "/home/nick/quicklisp/local-projects/trading-core/examples/backtesting-simulation.fasl") #<unavailable argument>)
- 2: ((:METHOD INITIALIZE-INSTANCE :AFTER (SIMPLE-MOVING-AVERAGE)) #<SIMPLE-MOVING-AVERAGE {10042040A3}>) [fast-method]
- 3: ((LAMBDA (SB-PCL::|.P0.|) :IN "/home/nick/qu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement