Permalink
Browse files

Synchronize QtCollider with latest SC

Conflicts:
	CMakeLists.txt
  • Loading branch information...
2 parents 455dd9a + 31558e3 commit c9683662a03d8cf9e15a9354708ad41433370348 @jleben jleben committed Jan 26, 2011
Showing with 493 additions and 488 deletions.
  1. +11 −1 CMakeLists.txt
  2. +76 −72 SCClassLibrary/JITLib/ProxySpace/NodeProxy.sc
  3. +15 −2 common/SC_AllocPool.cpp
  4. +9 −15 include/lang/GC.h
  5. +2 −2 include/plugin_interface/SC_Complex.h
  6. +1 −1 include/plugin_interface/Unroll.h
  7. +4 −0 lang/CMakeLists.txt
  8. +4 −4 lang/LangPrimSource/OSCData.cpp
  9. +26 −27 lang/LangPrimSource/PyrPrimitive.cpp
  10. +7 −9 lang/LangPrimSource/PyrSched.cpp
  11. +3 −3 lang/LangSource/DumpParseNode.cpp
  12. +15 −16 lang/LangSource/GC.cpp
  13. +12 −18 lang/LangSource/PyrInterpreter3.cpp
  14. +1 −1 lang/LangSource/PyrLexer.cpp
  15. +26 −27 lang/LangSource/PyrMessage.cpp
  16. +13 −16 lang/LangSource/PyrObject.cpp
  17. +6 −6 lang/LangSource/PyrParseNode.cpp
  18. +2 −1 platform/CMakeLists.txt
  19. BIN platform/mac/Resources/Japanese.lproj/MainMenu.nib/objects.nib
  20. +68 −8 platform/mac/Synth.xcodeproj/project.pbxproj
  21. +1 −1 server/plugins/BinaryOpUGens.cpp
  22. +142 −99 server/plugins/DelayUGens.cpp
  23. +1 −1 server/plugins/DemandUGens.cpp
  24. +1 −1 server/plugins/DiskIO_UGens.cpp
  25. +2 −2 server/plugins/LFUGens.cpp
  26. +1 −1 server/plugins/MouseUGens.cpp
  27. +2 −2 server/plugins/MulAddUGens.cpp
  28. +2 −5 server/plugins/TriggerUGens.cpp
  29. +1 −1 server/plugins/UnaryOpUGens.cpp
  30. +1 −1 server/scsynth/SC_Audio_Android.cpp
  31. +1 −1 server/scsynth/SC_Carbon.cpp
  32. +1 −1 server/scsynth/SC_ComPort.cpp
  33. +17 −17 server/scsynth/SC_CoreAudio.cpp
  34. +8 −5 server/supernova/sc/sc_synth.cpp
  35. +7 −1 server/supernova/sc/sc_synthdef.cpp
  36. +1 −1 server/supernova/sc/sc_ugen_factory.cpp
  37. +0 −13 server/supernova/server/node_graph.cpp
  38. +3 −106 server/supernova/server/node_types.hpp
View
12 CMakeLists.txt
@@ -56,6 +56,9 @@ if(APPLE)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_definitions("-DSC_LINUX")
add_definitions(-DSC_DATA_DIR="${CMAKE_INSTALL_PREFIX}/share/SuperCollider")
+elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ add_definitions("-DSC_FREEBSD")
+ add_definitions(-DSC_DATA_DIR="${CMAKE_INSTALL_PREFIX}/share/SuperCollider")
endif()
if(WIN32)
@@ -107,7 +110,10 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
elseif()
option(SUPERNOVA "Build with supernova as optional audio synthesis server" OFF)
endif()
+
option(SN_MEMORY_DEBUGGING "Build supernova for memory debugging (disable memory pools).")
+option(SC_MEMORY_DEBUGGING "Build sclang&scsynth for memory debugging (disable memory pools).")
+option(GC_SANITYCHECK "Enable sanity checks in the sclang garbage collector.")
option(NO_LIBSNDFILE "Disable soundfile functionality. (Not recommended.)" OFF)
mark_as_advanced(NO_LIBSNDFILE)
@@ -148,6 +154,10 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif()
endif()
+if (SC_MEMORY_DEBUGGING)
+ add_definitions(-DDISABLE_MEMORY_POOLS)
+endif()
+
#############################################
# subdirectories
add_subdirectory(server)
@@ -163,7 +173,7 @@ if (SC_QT)
add_subdirectory(QtCollider)
endif (SC_QT)
-if(CMAKE_SYSTEM_NAME MATCHES "Linux")
+if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
install(DIRECTORY include
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/SuperCollider
PATTERN app* EXCLUDE
View
148 SCClassLibrary/JITLib/ProxySpace/NodeProxy.sc
@@ -37,7 +37,7 @@ NodeProxy : BusPlug {
this.stop(0, reset);
}
}
-
+
isPlaying { ^group.isPlaying }
free { | fadeTime, freeGroup = true |
@@ -53,8 +53,8 @@ NodeProxy : BusPlug {
}
}
- release { | fadeTime |
- this.free(fadeTime, false)
+ release { | fadeTime |
+ this.free(fadeTime, false)
}
pause {
@@ -70,11 +70,11 @@ NodeProxy : BusPlug {
fadeTime_ { | dur |
if(dur.isNil) { this.unset(\fadeTime) } { this.set(\fadeTime, dur) };
}
-
+
fadeTime {
^nodeMap.at(\fadeTime).value ? 0.02;
}
-
+
prFadeTime { ^nodeMap.at(\fadeTime).value }
asGroup { ^group.asGroup }
@@ -91,22 +91,22 @@ NodeProxy : BusPlug {
// setting the source
-
+
source_ { | obj |
this.put(nil, obj, 0)
}
-
+
prime { | obj |
this.put(nil, obj, 0, nil, false);
}
-
+
sources_ { | list |
this[0..] = list;
}
source { ^objects.at(0).source }
sources { ^objects.array.collect(_.source) }
-
+
add { | obj, channelOffset = 0, extraArgs, now = true |
this.put(objects.pos, obj, channelOffset, extraArgs, now)
}
@@ -168,8 +168,8 @@ NodeProxy : BusPlug {
last = last ?? { max(1, max(objects.size, value.size)) - 1 };
this.putAll(value.asArray, (first, second..last))
}
-
- filter { | i, func |
+
+ filter { | i, func |
this.put(i, \filter -> func)
}
@@ -183,7 +183,7 @@ NodeProxy : BusPlug {
{ this.removeToBundle(bundle, index, fadeTime) };
bundle.schedSend(server);
}
-
+
rebuild {
var bundle;
if(this.isPlaying) {
@@ -218,7 +218,7 @@ NodeProxy : BusPlug {
};
server = inServer;
}
-
+
bus_ { | inBus |
if(server != inBus.server) { Error("can't change the server").throw };
super.bus_(inBus);
@@ -239,13 +239,13 @@ NodeProxy : BusPlug {
} { group = inGroup };
}
-
+
read { | proxies |
proxies = proxies.asCollection;
proxies.do { arg item; item.wakeUp };
this.readFromBus(proxies)
}
-
+
readFromBus { | busses |
var n, x;
busses = busses.asCollection;
@@ -266,7 +266,7 @@ NodeProxy : BusPlug {
// modifying context, setting controls
-
+
set { | ... args | // pairs of keys or indices and value
nodeMap.set(*args);
if(this.isPlaying) {
@@ -287,7 +287,7 @@ NodeProxy : BusPlug {
};
}
- map { | ... args | // key(s), proxy, key(s), proxy ...
+ map { | ... args | // key(s), proxy, key(s), proxy ...
var bundle;
if(this.isPlaying) {
bundle = List.new;
@@ -302,7 +302,7 @@ NodeProxy : BusPlug {
"NodeProxy: mapn is deprecated, please use map instead".postln;
^this.map(*args)
}
-
+
xset { | ... args |
this.xFadePerform(\set, args)
}
@@ -323,14 +323,14 @@ NodeProxy : BusPlug {
xFadePerform { | selector, args |
var bundle;
if(this.isPlaying)
- {
+ {
nodeMap.performList(selector, args);
- this.sendEach(nil, true)
- } {
+ this.sendEach(nil, true)
+ } {
this.performList(selector, args)
}
}
-
+
mapEnvir { | ... keys | // map to current environment
nodeMap.mapEnvir(*keys);
if(this.isPlaying) {
@@ -356,7 +356,7 @@ NodeProxy : BusPlug {
};
nodeMap.unmap(*keys);
}
-
+
nodeMap_ { | map |
this.setNodeMap(map, false)
}
@@ -377,8 +377,8 @@ NodeProxy : BusPlug {
}
};
}
-
-
+
+
// play proxy as source of receiver
<-- { | proxy |
var bundle = MixedBundle.new;
@@ -393,14 +393,14 @@ NodeProxy : BusPlug {
bundle.add(proxy.moveBeforeMsg(this));
bundle.send(server, server.latency);
}
-
+
// map receiver to proxy input
// second argument is an adverb
<>> { | proxy, key = \in |
proxy.perform('<<>', this, key);
^proxy
}
-
+
// map proxy to receiver input
// second argument is an adverb
<<> { | proxy, key = \in |
@@ -409,7 +409,7 @@ NodeProxy : BusPlug {
ctl = this.controlNames.detect { |x| x.name == key };
rate = ctl.rate ?? {
if(proxy.isNeutral) {
- if(this.isNeutral) { \audio } { this.rate }
+ if(this.isNeutral) { \audio } { this.rate }
} {
proxy.rate
}
@@ -419,7 +419,7 @@ NodeProxy : BusPlug {
if(this.isNeutral) { this.defineBus(rate, numChannels) };
this.xmap(key, proxy);
} {
- "Could not link node proxies, no matching input found.".warn
+ "Could not link node proxies, no matching input found.".warn
};
^proxy // returns first argument for further chaining
}
@@ -429,7 +429,7 @@ NodeProxy : BusPlug {
// starting processes
-
+
spawn { | extraArgs, index = 0 |
var bundle, obj, i;
obj = objects.at(index);
@@ -486,7 +486,7 @@ NodeProxy : BusPlug {
}
wakeUp { // do not touch internal state if already playing
- if(this.isPlaying.not) { this.deepWakeUp }
+ if(this.isPlaying.not) { this.deepWakeUp }
}
deepWakeUp {
@@ -501,7 +501,7 @@ NodeProxy : BusPlug {
// gui support
-
+
typeStr {
if(this.rate === 'audio') { ^"ar" + this.numChannels };
if(this.rate === 'control') { ^"kr" + this.numChannels };
@@ -516,7 +516,7 @@ NodeProxy : BusPlug {
// interproxy structure and reading other busses
-
+
orderNodes { | ... proxies |
var msg = this.moveBeforeMsg(*proxies);
msg !? {
@@ -552,7 +552,7 @@ NodeProxy : BusPlug {
};
^nil
}
-
+
moveBeforeMsg { | ... proxies |
var list;
([this] ++ proxies).do { |el|
@@ -565,18 +565,18 @@ NodeProxy : BusPlug {
};
^list !? { Node.orderNodesMsg(list) }
}
-
+
// node map settings
-
+
internalKeys {
^#[\out, \i_out, \gate, \fadeTime];
}
-
+
// return names in the order they have in .objects
controlNames { | except, addNodeMap = true |
var all = Array.new; // Set doesn't work, because equality undefined for ControlName
@@ -590,39 +590,43 @@ NodeProxy : BusPlug {
}
};
};
- ^if (addNodeMap.not or: nodeMap.isNil) { all } {
- this.addNodeMapControlNames(all, except)
+ ^if (addNodeMap.not or: nodeMap.isNil) { all } {
+ this.addNodeMapControlNames(all, except)
};
}
-
+
// if a name is set in nodemap, overwrite the values in objCtlNames;
- // if a key is set in the nodemap, but is not used in the objects yet, add at the end.
- addNodeMapControlNames { |objCtlNames, except = #[]|
+ // if a key is set in the nodemap, but is not used in the objects yet, add at the end.
+ addNodeMapControlNames { |objCtlNames, except = #[]|
nodeMap.controlNames
.reject { |ctlname| except.includes(ctlname.name) }
.do { |mapCtl|
var index = objCtlNames.detectIndex { |objCtl| objCtl.name == mapCtl.name };
- if (index.notNil) {
+ if (index.notNil) {
objCtlNames.put(index, mapCtl)
- } {
+ } {
objCtlNames = objCtlNames.add(mapCtl)
}
};
^objCtlNames
}
-
- resetNodeMap {
+
+ resetNodeMap {
this.nodeMap = ProxyNodeMap.new;
}
-
- cleanNodeMap {
- var nodeMapKeys, keysToRemove;
+
+ cleanNodeMap {
+ var nodeMapSettingKeys, nodeMapMappingKeys, keysToUnset, keysToUnmap, currentKeys;
if (nodeMap.isNil) { ^this };
-
- nodeMapKeys = nodeMap.settings.keys.difference(this.internalKeys);
- keysToRemove = nodeMapKeys.difference(this.controlNames(addNodeMap: false).collect(_.name));
-
- keysToRemove.do(this.unset(_));
+
+ nodeMapSettingKeys = difference(nodeMap.settingKeys, this.internalKeys);
+ nodeMapMappingKeys = difference(nodeMap.mappingKeys, this.internalKeys);
+ currentKeys = this.controlNames(addNodeMap: false).collect(_.name);
+ keysToUnset = difference(nodeMapSettingKeys, currentKeys);
+ keysToUnmap = difference(nodeMapMappingKeys, currentKeys);
+
+ keysToUnset.do(this.unset(_));
+ keysToUnmap.do(this.unmap(_));
}
controlKeys { | except, noInternalKeys = true |
@@ -634,7 +638,7 @@ NodeProxy : BusPlug {
}
^list
}
-
+
getKeysValues { | keys, except, withDefaults = true, noInternalKeys = true |
var pairs, result = [], myKeys, defaults, mapSettings;
if (noInternalKeys) { except = except ++ this.internalKeys; };
@@ -734,7 +738,7 @@ NodeProxy : BusPlug {
nodes = Array(4);
objects.doRange({ arg obj;
var id = obj.nodeID;
- if(id.notNil and: { id != synthID })
+ if(id.notNil and: { id != synthID })
{ nodes = nodes ++ id ++ synthID };
}, index + 1);
if(nodes.size > 0) { bundle.add(["/n_before"] ++ nodes.reverse) };
@@ -771,8 +775,8 @@ NodeProxy : BusPlug {
stopAllToBundle { | bundle, fadeTime |
var obj, dt;
dt = fadeTime ? this.fadeTime;
- if(this.isPlaying) {
- objects.do { |obj| obj.stopToBundle(bundle, dt) }
+ if(this.isPlaying) {
+ objects.do { |obj| obj.stopToBundle(bundle, dt) }
}
}
@@ -785,7 +789,7 @@ NodeProxy : BusPlug {
};
loaded = true;
}
-
+
unsetToBundle { | bundle, keys |
var pairs = this.controlKeysValues(keys);
if(this.isPlaying) {
@@ -819,14 +823,14 @@ NodeProxy : BusPlug {
-
+
// allocation
-
+
defineBus { | rate = \audio, numChannels |
super.defineBus(rate, numChannels);
this.linkNodeMap;
}
-
+
reallocBusIfNeeded { // bus is reallocated only if the server was not booted on creation.
if(busLoaded.not and: { bus.notNil }) {
bus.realloc;
@@ -840,11 +844,11 @@ NodeProxy : BusPlug {
// network support
-
+
shouldAddObject { | obj | ^obj.readyForPlay } // shared node proxy overrides this
defaultGroupID { ^server.nextNodeID }
-
+
@@ -858,7 +862,7 @@ NodeProxy : BusPlug {
if(index.notNil) { nodeMap.set(\out, index, \i_out, index) };
nodeMap.proxy = this;
}
-
+
generateUniqueName {
^server.clientID.asString ++ this.identityHash.abs
}
@@ -876,14 +880,14 @@ NodeProxy : BusPlug {
^child.isPlaying;
}
-
+
}
Ndef : NodeProxy {
-
+
classvar <>defaultServer, <>all;
var <>key;
@@ -921,7 +925,7 @@ Ndef : NodeProxy {
*kr { | key, numChannels, offset = 0 |
^this.new(key).kr(numChannels, offset)
}
-
+
*clear { | fadeTime |
all.do(_.clear(fadeTime));
all.clear;
@@ -935,18 +939,18 @@ Ndef : NodeProxy {
dict.registerServer;
};
^dict
- }
+ }
storeOn { | stream |
this.printOn(stream);
}
printOn { | stream |
- var serverString = if (server == Server.default) { "" } {
+ var serverString = if (server == Server.default) { "" } {
" ->" + server.name.asCompileString;
};
stream << this.class.name << "(" <<< this.key << serverString << ")"
}
-
-
+
+
}
View
17 common/SC_AllocPool.cpp
@@ -154,6 +154,10 @@ void AllocPool::Reinit()
void AllocPool::Free(void *inPtr)
{
+#ifdef DISABLE_MEMORY_POOLS
+ free(inPtr);
+ return;
+#endif
check_pool();
if (inPtr == 0) return; /* free(0) has no effect */
@@ -269,8 +273,8 @@ size_t AllocPool::LargestFreeChunk()
int bitPosition = NUMBITS(binBits) - 1;
int index = (word << 5) + bitPosition;
AllocChunkPtr bin = mBins + index;
- //postbuf("** %08X %08X %08X %08X\n", mBinBlocks[0], mBinBlocks[1], mBinBlocks[2], mBinBlocks[3]);
- //postbuf("%d %d %d %08X %08X %08X\n", word, bitPosition, index, binBits, bin->Prev(), bin->Next());
+ //postbuf("** %p %p %p %p\n", mBinBlocks[0], mBinBlocks[1], mBinBlocks[2], mBinBlocks[3]);
+ //postbuf("%d %d %d %p %p %p\n", word, bitPosition, index, binBits, bin->Prev(), bin->Next());
AllocChunkPtr candidate;
size_t maxsize = 0;
@@ -291,6 +295,10 @@ size_t AllocPool::LargestFreeChunk()
void* AllocPool::Alloc(size_t inReqSize)
{
+#ifdef DISABLE_MEMORY_POOLS
+ return malloc(inReqSize);
+#endif
+
// OK it has a lot of gotos, but these remove a whole lot of common code
// that was obfuscating the original version of this function.
// So here I am choosing the OnceAndOnlyOnce principle over the caveats on gotos.
@@ -421,6 +429,11 @@ void* AllocPool::Alloc(size_t inReqSize)
void* AllocPool::Realloc(void* inPtr, size_t inReqSize)
{
+#ifdef DISABLE_MEMORY_POOLS
+ return realloc(inPtr, inReqSize);
+#endif
+
+
void *outPtr;
AllocChunkPtr prev;
check_pool();
View
24 include/lang/GC.h
@@ -77,21 +77,15 @@ class PyrGC
PyrObject* NewFinalizer(ObjFuncPtr finalizeFunc, PyrObject *inObject, bool inCollect);
-#if 0
-// Codewarrior is not inlining these.. why?
- bool IsBlack(PyrObjectHdr* inObj) { return inObj->gc_color == mBlackColor; }
- bool IsWhite(PyrObjectHdr* inObj) { return inObj->gc_color == mWhiteColor; }
- bool IsGrey(PyrObjectHdr* inObj) { return inObj->gc_color == mGreyColor; }
- bool IsMarker(PyrObjectHdr* inObj) { return inObj->gc_color == obj_gcmarker; }
-#else
-
-#define IsBlack(inObj) ((inObj)->gc_color == mBlackColor)
-#define IsWhite(inObj) ((inObj)->gc_color == mWhiteColor)
-#define IsGrey(inObj) ((inObj)->gc_color == mGreyColor)
-#define IsFree(inObj) (!(IsMarker(inObj) || inObj->IsPermanent() || \
- IsBlack(inObj) || IsWhite(inObj) || IsGrey(inObj)))
-#define IsMarker(inObj) ((inObj)->gc_color == obj_gcmarker)
-#endif
+ bool IsBlack(PyrObjectHdr* inObj) { return inObj->gc_color == mBlackColor; }
+ bool IsWhite(PyrObjectHdr* inObj) { return inObj->gc_color == mWhiteColor; }
+ bool IsGrey(PyrObjectHdr* inObj) { return inObj->gc_color == mGreyColor; }
+ static bool IsMarker(PyrObjectHdr* inObj) { return inObj->gc_color == obj_gcmarker; }
+ bool IsFree(PyrObjectHdr* inObj) { return (!(IsMarker(inObj) ||
+ inObj->IsPermanent() ||
+ IsBlack(inObj) ||
+ IsWhite(inObj) ||
+ IsGrey(inObj))); }
bool ObjIsBlack(PyrObjectHdr* inObj) { return IsBlack(inObj); }
bool ObjIsGrey(PyrObjectHdr* inObj) { return IsGrey(inObj); }
View
4 include/plugin_interface/SC_Complex.h
@@ -155,7 +155,7 @@ inline Polar Complex::ToPolarApx()
} else {
return Polar(mag, (float)(pi + phase));
}
- } else {
+ } else if (absimag > 0) {
slope = real/imag;
index = (int32)(kPolarLUTSize2 + kPolarLUTSize2 * slope);
mag = gMagLUT[index] * absimag;
@@ -165,7 +165,7 @@ inline Polar Complex::ToPolarApx()
} else {
return Polar(mag, (float)(pi32 - phase));
}
- }
+ } else return Polar(0, 0);
}
inline void Complex::ToPolarInPlace()
View
2 include/plugin_interface/Unroll.h
@@ -204,7 +204,7 @@ inline void Scale(int numSamples, float *out, float *in, float level)
}
// in these the pointers are assumed to already have been pre-offset.
-inline void ZCopy(int numSamples, float *out, float *in)
+inline void ZCopy(int numSamples, float *out, const float *in)
{
// pointers must be 8 byte aligned
//assert((((long)(out+ZOFF) & 7) == 0) && (((long)(in+ZOFF) & 7) == 0));
View
4 lang/CMakeLists.txt
@@ -220,6 +220,10 @@ elseif(NOT NO_LIBSNDFILE)
message(SEND_ERROR "Cannot find libsndfile")
endif(SNDFILE_FOUND)
+if (GC_SANITYCHECK)
+ add_definitions(-DGC_SANITYCHECK)
+endif()
+
target_link_libraries(libsclang ${PTHREADS_LIBRARY})
add_executable(sclang LangSource/cmdLineFuncs.cpp)
View
8 lang/LangPrimSource/OSCData.cpp
@@ -450,7 +450,7 @@ int prNetAddr_SendMsg(VMGlobals *g, int numArgsPushed)
int numargs = numArgsPushed - 1;
makeSynthMsgWithTags(&packet, args, numargs);
- //for (int i=0; i<packet.size()/4; i++) post("%d %08X\n", i, packet.buf[i]);
+ //for (int i=0; i<packet.size()/4; i++) post("%d %p\n", i, packet.buf[i]);
return netAddrSend(slotRawObject(netAddrSlot), packet.size(), (char*)packet.buf);
}
@@ -472,7 +472,7 @@ int prNetAddr_SendBundle(VMGlobals *g, int numArgsPushed)
int numargs = numArgsPushed - 1;
makeSynthBundle(&packet, args, numargs, true);
- //for (int i=0; i<packet.size()/4; i++) post("%d %08X\n", i, packet.buf[i]);
+ //for (int i=0; i<packet.size()/4; i++) post("%d %p\n", i, packet.buf[i]);
return netAddrSend(slotRawObject(netAddrSlot), packet.size(), (char*)packet.buf);
}
@@ -586,7 +586,7 @@ int prArray_OSCBytes(VMGlobals *g, int numArgsPushed)
obj->size = size;
memcpy(obj->b, packet.data(), size);
SetObject(a, (PyrObject*)obj);
- //for (int i=0; i<packet.size()/4; i++) post("%d %08X\n", i, packet.buf[i]);
+ //for (int i=0; i<packet.size()/4; i++) post("%d %p\n", i, packet.buf[i]);
return errNone;
}
@@ -742,7 +742,7 @@ void PerformOSCMessage(int inSize, char *inData, PyrObject *replyObj)
void FreeOSCPacket(OSC_Packet *inPacket)
{
- //post("->FreeOSCPacket %08X\n", inPacket);
+ //post("->FreeOSCPacket %p\n", inPacket);
if (inPacket) {
free(inPacket->mData);
free(inPacket);
View
53 lang/LangPrimSource/PyrPrimitive.cpp
@@ -46,7 +46,6 @@
//#include "Wacom.h"
#include "InitAlloc.h"
-#define SANITYCHECK 0
int yyparse();
extern bool gTraceInterpreter;
@@ -669,7 +668,7 @@ int prFunctionDefDumpContexts(struct VMGlobals *g, int numArgsPushed)
int i=0;
while (slotRawBlock(a)) {
- post("%2d context %s %08X\n", i++, slotRawSymbol(&slotRawObject(a)->classptr->name)->name, slotRawInt(&slotRawBlock(a)->contextDef));
+ post("%2d context %s %p\n", i++, slotRawSymbol(&slotRawObject(a)->classptr->name)->name, slotRawInt(&slotRawBlock(a)->contextDef));
a = &slotRawBlock(a)->contextDef;
}
return errNone;
@@ -2781,9 +2780,9 @@ void switchToThread(VMGlobals *g, PyrThread *newthread, int oldstate, int *numAr
oldthread = g->thread;
if (newthread == oldthread) return;
- //postfl("->switchToThread %d %08X -> %08X\n", oldstate, oldthread, newthread);
+ //postfl("->switchToThread %d %p -> %p\n", oldstate, oldthread, newthread);
//post("->switchToThread from %s:%s\n", slotRawClass(&g->method->ownerclass)->name.us->name, g->slotRawSymbol(&method->name)->name);
- //post("->stack %08X g->sp %08X [%d] g->top %08X [%d]\n",
+ //post("->stack %p g->sp %p [%d] g->top %p [%d]\n",
// g->gc->Stack()->slots, g->sp, g->sp - g->gc->Stack()->slots, g->top, g->top - g->gc->Stack()->slots);
//assert(g->gc->SanityCheck());
//CallStackSanity(g, "switchToThreadA");
@@ -2830,7 +2829,7 @@ void switchToThread(VMGlobals *g, PyrThread *newthread, int oldstate, int *numAr
SetObject(&oldthread->stack, gc->Stack());
gc->ToWhite(gc->Stack());
gc->Stack()->size = g->sp - gc->Stack()->slots + 1;
- //post("else %08X %08X\n", slotRawObject(&oldthread->stack), gc->Stack());
+ //post("else %p %p\n", slotRawObject(&oldthread->stack), gc->Stack());
SetObject(&oldthread->method, g->method);
SetObject(&oldthread->block, g->block);
@@ -2880,7 +2879,7 @@ void switchToThread(VMGlobals *g, PyrThread *newthread, int oldstate, int *numAr
g->execMethod = 99;
- //post("switchToThread ip %08X\n", g->ip);
+ //post("switchToThread ip %p\n", g->ip);
//post(slotRawInt(&"switchToThread newthread->ip) %d\n", slotRawInt(&newthread->ip));
//post(slotRawInt(&"switchToThread oldthread->ip) %d\n", slotRawInt(&oldthread->ip));
@@ -2899,16 +2898,16 @@ void switchToThread(VMGlobals *g, PyrThread *newthread, int oldstate, int *numAr
slotCopy(currentEnvironmentSlot,&g->thread->environment);
g->gc->GCWrite(g->classvars, currentEnvironmentSlot);
- //post("old thread %08X stack %08X\n", oldthread, slotRawObject(&oldthread->stack));
- //post("new thread %08X stack %08X\n", g->thread, slotRawObject(&g->thread->stack));
- //post("main thread %08X stack %08X\n", slotRawThread(&g->process->mainThread), slotRawObject(&slotRawThread(&g->process->mainThread)->stack));
+ //post("old thread %p stack %p\n", oldthread, slotRawObject(&oldthread->stack));
+ //post("new thread %p stack %p\n", g->thread, slotRawObject(&g->thread->stack));
+ //post("main thread %p stack %p\n", slotRawThread(&g->process->mainThread), slotRawObject(&slotRawThread(&g->process->mainThread)->stack));
//postfl("<-switchToThread\n");
- //post("<-stack %08X g->sp %08X [%d] g->top %08X [%d]\n",
+ //post("<-stack %p g->sp %p [%d] g->top %p [%d]\n",
// g->gc->Stack()->slots, g->sp, g->sp - g->gc->Stack()->slots, g->top, g->top - g->gc->Stack()->slots);
//assert(g->gc->SanityCheck());
//CallStackSanity(g, "switchToThreadB");
- //post("switchToThread ip2 %08X\n", g->ip);
+ //post("switchToThread ip2 %p\n", g->ip);
}
void initPyrThread(VMGlobals *g, PyrThread *thread, PyrSlot *func, int stacksize, PyrInt32Array* rgenArray,
@@ -3100,7 +3099,7 @@ int prRoutineYield(struct VMGlobals *g, int numArgsPushed)
{
PyrSlot value;
- //postfl("->prRoutineYield %08X\n", g->thread);
+ //postfl("->prRoutineYield %p\n", g->thread);
//assert(g->gc->SanityCheck());
//CallStackSanity(g, "prRoutineYield");
//postfl("->numArgsPushed %d\n", numArgsPushed);
@@ -3115,7 +3114,7 @@ int prRoutineYield(struct VMGlobals *g, int numArgsPushed)
PyrThread *parent = slotRawThread(&g->thread->parent);
SetNil(&g->thread->parent);
slotCopy(&g->process->nowExecutingPath, &g->thread->oldExecutingPath);
- //debugf("yield from thread %08X to parent %08X\n", g->thread, slotRawThread(&g->thread->parent));
+ //debugf("yield from thread %p to parent %p\n", g->thread, slotRawThread(&g->thread->parent));
switchToThread(g, parent, tSuspended, &numArgsPushed);
// on the other side of the looking glass, put the yielded value on the stack as the result..
@@ -3133,7 +3132,7 @@ int prRoutineAlwaysYield(struct VMGlobals *g, int numArgsPushed)
{
PyrSlot value;
- //postfl("->prRoutineAlwaysYield ip %08X\n", g->ip);
+ //postfl("->prRoutineAlwaysYield ip %p\n", g->ip);
//assert(g->gc->SanityCheck());
//CallStackSanity(g, "prRoutineAlwaysYield");
if (!isKindOf((PyrObject*)g->thread, class_routine)) {
@@ -3148,13 +3147,13 @@ int prRoutineAlwaysYield(struct VMGlobals *g, int numArgsPushed)
PyrThread *parent = slotRawThread(&g->thread->parent);
SetNil(&g->thread->parent);
slotCopy(&g->process->nowExecutingPath, &g->thread->oldExecutingPath);
- //post("alwaysYield from thread %08X to parent %08X\n", g->thread, parent);
+ //post("alwaysYield from thread %p to parent %p\n", g->thread, parent);
switchToThread(g, parent, tDone, &numArgsPushed);
// on the other side of the looking glass, put the yielded value on the stack as the result..
slotCopy((g->sp - numArgsPushed + 1),&value);
- //postfl("<-prRoutineAlwaysYield ip %08X\n", g->ip);
+ //postfl("<-prRoutineAlwaysYield ip %p\n", g->ip);
//assert(g->gc->SanityCheck());
//CallStackSanity(g, "<prRoutineAlwaysYield");
return errNone;
@@ -3182,8 +3181,8 @@ int prRoutineResume(struct VMGlobals *g, int numArgsPushed)
slotCopy(&threadSlot,a);
slotCopy(&value,b);
- //post("g->thread %08X\n", g->thread);
- //post("thread %08X\n", thread);
+ //post("g->thread %p\n", g->thread);
+ //post("thread %p\n", thread);
SetObject(&thread->parent, g->thread);
g->gc->GCWrite(thread, g->thread);
@@ -3192,11 +3191,11 @@ int prRoutineResume(struct VMGlobals *g, int numArgsPushed)
slotCopy(&thread->clock, &g->thread->clock);
g->gc->GCWrite(thread, &g->thread->clock);
- //postfl("start into thread %08X from parent %08X\n", thread, g->thread);
+ //postfl("start into thread %p from parent %p\n", thread, g->thread);
switchToThread(g, thread, tSuspended, &numArgsPushed);
// set stack
- //post("set stack %08X %08X\n", g->sp, g->gc->Stack()->slots - 1);
+ //post("set stack %p %p\n", g->sp, g->gc->Stack()->slots - 1);
g->sp = g->gc->Stack()->slots - 1;
slotCopy((++g->sp), &threadSlot);
slotCopy(&g->receiver, &threadSlot);
@@ -3216,7 +3215,7 @@ int prRoutineResume(struct VMGlobals *g, int numArgsPushed)
g->gc->GCWrite(thread, &g->thread->clock);
slotCopy(&value,b);
- //debugf("resume into thread %08X from parent %08X\n", thread, g->thread);
+ //debugf("resume into thread %p from parent %p\n", thread, g->thread);
switchToThread(g, thread, tSuspended, &numArgsPushed);
// on the other side of the looking glass, put the yielded value on the stack as the result..
slotCopy((g->sp - numArgsPushed + 1),&value);
@@ -3521,7 +3520,7 @@ void doPrimitive(VMGlobals* g, PyrMethod* meth, int numArgsPushed)
{
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
@@ -3553,11 +3552,11 @@ void doPrimitive(VMGlobals* g, PyrMethod* meth, int numArgsPushed)
g->args = g->sp - numArgsNeeded;
int err;
try {
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
err = (*def->func)(g, numArgsNeeded);
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
} catch (std::exception& ex) {
@@ -3575,7 +3574,7 @@ void doPrimitive(VMGlobals* g, PyrMethod* meth, int numArgsPushed)
SetInt(&g->thread->primitiveError, err);
executeMethod(g, meth, numArgsNeeded);
}
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
}
@@ -3586,7 +3585,7 @@ void doPrimitiveWithKeys(VMGlobals* g, PyrMethod* meth, int allArgsPushed, int n
PyrSlot *pslot, *qslot;
int numArgsNeeded, numArgsPushed;
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
//post("doPrimitive %s:%s\n", slotRawSymbol(&slotRawClass(&meth->ownerclass)->name)->name, slotRawSymbol(&meth->name)->name);
@@ -3687,7 +3686,7 @@ void doPrimitiveWithKeys(VMGlobals* g, PyrMethod* meth, int allArgsPushed, int n
executeMethod(g, meth, numArgsNeeded);
}
}
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
}
View
16 lang/LangPrimSource/PyrSched.cpp
@@ -37,8 +37,6 @@
#include "SC_Win32Utils.h"
-#define SANITYCHECK 0
-
static const double dInfinity = std::numeric_limits<double>::infinity();
@@ -49,8 +47,8 @@ bool addheap(VMGlobals *g, PyrObject *heap, double schedtime, PyrSlot *task)
short mom; /* parent and sibling in the heap, not in the task hierarchy */
PyrSlot *pme, *pmom;
-#if SANITYCHECK
- gcSanity(g->gc);
+#ifdef GC_SANITYCHECK
+ g->gc->SanityCheck();
#endif
if (heap->size >= ARRAYMAXINDEXSIZE(heap)) return false;
//dumpheap(heap);
@@ -71,8 +69,8 @@ bool addheap(VMGlobals *g, PyrObject *heap, double schedtime, PyrSlot *task)
g->gc->GCWrite(heap, task);
heap->size += 2;
-#if SANITYCHECK
- gcSanity(g->gc);
+#ifdef GC_SANITYCHECK
+ g->gc->SanityCheck();
#endif
//dumpheap(heap);
//post("<-addheap %g\n", schedtime);
@@ -160,7 +158,7 @@ void dumpheap(PyrObject *heap)
mintime = slotRawFloat(&heap->slots[0]);
post("SCHED QUEUE (%d)\n", heap->size);
for (i=0; i<heap->size; i+=2) {
- post("%3d %9.2f %08X\n", i>>1, slotRawFloat(&heap->slots[i]), slotRawInt(&heap->slots[i+1]));
+ post("%3d %9.2f %p\n", i>>1, slotRawFloat(&heap->slots[i]), slotRawInt(&heap->slots[i+1]));
if (slotRawFloat(&heap->slots[i]) < mintime)
post("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
}
@@ -709,7 +707,7 @@ void* TempoClock_stop_func(void* p)
void TempoClock_stopAll(void)
{
- //printf("->TempoClock_stopAll %08X\n", TempoClock::sAll);
+ //printf("->TempoClock_stopAll %p\n", TempoClock::sAll);
TempoClock *clock = TempoClock::sAll;
while (clock) {
TempoClock* next = clock->mNext;
@@ -718,7 +716,7 @@ void TempoClock_stopAll(void)
delete clock;
clock = next;
}
- //printf("<-TempoClock_stopAll %08X\n", TempoClock::sAll);
+ //printf("<-TempoClock_stopAll %p\n", TempoClock::sAll);
TempoClock::sAll = 0;
}
View
6 lang/LangSource/DumpParseNode.cpp
@@ -344,7 +344,7 @@ void slotString(PyrSlot *slot, char *str)
double f;
} u;
u.f = slotRawFloat(slot);
- sprintf(str, "Float %f %08X %08X", u.f, u.i[0], u.i[1]);
+ sprintf(str, "Float %f %p %p", u.f, u.i[0], u.i[1]);
break;
}
}
@@ -472,7 +472,7 @@ bool postString(PyrSlot *slot, char *str)
slotRawSymbol(&slotRawClass(&slotRawMethod(slot)->ownerclass)->name)->name,
slotRawSymbol(&slotRawMethod(slot)->name)->name);
} else {
- sprintf(str, "instance of %s (%08X, size=%d, set=%02X)",
+ sprintf(str, "instance of %s (%p, size=%d, set=%02X)",
slotRawSymbol(&slotRawObject(slot)->classptr->name)->name,
slotRawObject(slot), slotRawObject(slot)->size,
slotRawObject(slot)->obj_sizeclass);
@@ -538,7 +538,7 @@ bool postString(PyrSlot *slot, char *str)
} else {
str[0] = 0;
res = false;
-// sprintf(str, "instance of %s (%08X, size=%d, gcset=%02X)",
+// sprintf(str, "instance of %s (%p, size=%d, gcset=%02X)",
// slotRawSymbol(&slotRawObject(slot)->classptr->name)->name,
// slotRawObject(slot), slotRawObject(slot)->size,
// slotRawObject(slot)->obj_sizeclass);
View
31 lang/LangSource/GC.cpp
@@ -26,7 +26,6 @@
#include <string.h>
#include <stdexcept>
-#define SANITYCHECK 0
#define PAUSETIMES 0
const int kScanThreshold = 256;
@@ -192,7 +191,7 @@ void GCSet::MajorFlip()
{
// move all white items to beginning of free list
mFree = mWhite.next;
- if (!IsMarker(mBlack.next)) {
+ if (!PyrGC::IsMarker(mBlack.next)) {
// move all black items to white list
mWhite.next = mBlack.next;
mFree->prev = mWhite.prev;
@@ -323,7 +322,7 @@ PyrObject *PyrGC::New(size_t inNumBytes, long inFlags, long inFormat, bool inCol
return NewPermanent(inNumBytes, inFlags, inFormat);
}
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
SanityCheck();
#endif
@@ -374,7 +373,7 @@ PyrObject *PyrGC::New(size_t inNumBytes, long inFlags, long inFormat, bool inCol
obj->classptr = class_object;
obj->gc_color = mWhiteColor;
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
SanityCheck();
#endif
return obj;
@@ -386,7 +385,7 @@ PyrObject *PyrGC::NewFrame(size_t inNumBytes, long inFlags, long inFormat, bool
{
PyrObject *obj = NULL;
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
SanityCheck();
#endif
@@ -437,7 +436,7 @@ PyrObject *PyrGC::NewFrame(size_t inNumBytes, long inFlags, long inFormat, bool
obj->classptr = class_frame;
obj->gc_color = mWhiteColor;
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
SanityCheck();
#endif
return obj;
@@ -447,7 +446,7 @@ PyrObject *PyrGC::NewFinalizer(ObjFuncPtr finalizeFunc, PyrObject *inObject, boo
{
PyrObject *obj = NULL;
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
SanityCheck();
#endif
@@ -497,7 +496,7 @@ PyrObject *PyrGC::NewFinalizer(ObjFuncPtr finalizeFunc, PyrObject *inObject, boo
SetPtr(obj->slots+0, (void*)finalizeFunc);
SetObject(obj->slots+1, inObject);
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
SanityCheck();
#endif
return obj;
@@ -642,7 +641,7 @@ void PyrGC::ScanFrames()
void PyrGC::Flip()
{
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
SanityCheck();
#endif
@@ -679,7 +678,7 @@ void PyrGC::Flip()
mFlips++;
//post("flips %d collects %d nalloc %d alloc %d grey %d\n", mFlips, mCollects, mNumAllocs, mAllocTotal, mNumGrey);
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
SanityCheck();
#endif
}
@@ -703,7 +702,7 @@ void PyrGC::Collect()
bool stackScanned = false;
mCollects++;
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
SanityCheck();
#endif
@@ -743,7 +742,7 @@ void PyrGC::Collect()
//TraceAnyPathToAllGrey();
}
//post("mNumToScan %d\n", mNumToScan);
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
SanityCheck();
#endif
ENDPAUSE
@@ -801,11 +800,11 @@ bool PyrGC::SanityCheck()
{
if (!mRunning) return true;
-
//postfl("PyrGC::SanityCheck\n");
bool res = LinkSanity() && ListSanity()
- //&& SanityMarkObj((PyrObject*)mProcess,NULL,0) && SanityMarkObj(mStack,NULL,0)
- //&& SanityClearObj((PyrObject*)mProcess,0) && SanityClearObj(mStack,0)
+ && SanityMarkObj((PyrObject*)mProcess,NULL,0) && SanityMarkObj(mStack,NULL,0)
+ && SanityClearObj((PyrObject*)mProcess,0) && SanityClearObj(mStack,0)
+ && SanityCheck2()
;
//if (!res) DumpInfo();
//if (!res) Debugger();
@@ -1037,7 +1036,7 @@ bool PyrGC::BlackToWhiteCheck(PyrObject *objA)
if (IsObj(slot) && slotRawObject(slot)) {
objB = slotRawObject(slot);
}
- if (objB && (long)objB < 100) {
+ if (objB && (unsigned long)objB < 100) {
fprintf(stderr, "weird obj ptr\n");
return false;
}
View
30 lang/LangSource/PyrInterpreter3.cpp
@@ -72,17 +72,11 @@ extern PyrObject *gSynth;
void debugf(char *fmt, ...) ;
-#define SANITYCHECK 0
#define DEBUGINTERPRETER 0
#define METHODMETER 0
#define BCSTAT 0
#define CHECK_MAX_STACK_USE 0
-#if SANITYCHECK
-#define SANITYCHECKLITE 1
-#else
-#define SANITYCHECKLITE 0
-#endif
#if CHECK_MAX_STACK_USE
int gMaxStackDepth = 0;
@@ -109,27 +103,27 @@ extern PyrClass *gClassList;
void runInterpreter(VMGlobals *g, PyrSymbol *selector, int numArgsPushed)
{
//postfl("->runInterpreter\n");
-#if SANITYCHECKLITE
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
//postfl(" >initInterpreter\n");
if (initInterpreter(g, selector, numArgsPushed)) {
-#if SANITYCHECKLITE
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
// if (strcmp(selector->name, "tick") != 0) post("%s %d execMethod %d\n", selector->name, numArgsPushed, g->execMethod);
- //post("->Interpret thread %08X\n", g->thread);
+ //post("->Interpret thread %p\n", g->thread);
if (g->execMethod) Interpret(g);
- //post("<-Interpret thread %08X\n", g->thread);
-#if SANITYCHECKLITE
+ //post("<-Interpret thread %p\n", g->thread);
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
}
//postfl(" >endInterpreter\n");
endInterpreter(g);
-#if SANITYCHECKLITE
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
//postfl("<-runInterpreter\n");
@@ -337,7 +331,7 @@ bool initRuntime(VMGlobals *g, int poolSize, AllocPool *inPool)
initPatterns();
initUniqueMethods();
initGUI();
-#if SANITYCHECKLITE
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
//tellPlugInsAboutToRun();
@@ -347,7 +341,7 @@ bool initRuntime(VMGlobals *g, int poolSize, AllocPool *inPool)
#endif
assert((g->gc->SanityCheck()));
-#if SANITYCHECKLITE
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
@@ -356,7 +350,7 @@ bool initRuntime(VMGlobals *g, int poolSize, AllocPool *inPool)
static bool initAwakeMessage(VMGlobals *g)
{
- //post("initAwakeMessage %08X %08X\n", g->thread, slotRawThread(&g->process->mainThread));
+ //post("initAwakeMessage %p %p\n", g->thread, slotRawThread(&g->process->mainThread));
slotCopy(&g->process->curThread, &g->process->mainThread); //??
g->thread = slotRawThread(&g->process->mainThread); //??
@@ -836,8 +830,8 @@ void Interpret(VMGlobals *g)
prevop = op1;
#endif
//printf("op1 %d\n", op1);
- //postfl("sp %08X frame %08X caller %08X ip %08X\n", sp, g->frame, g->frame->caller.uof, slotRawInt(&g->frame->caller.uof->ip));
- //postfl("sp %08X frame %08X diff %d caller %08X\n", sp, g->frame, ((int)sp - (int)g->frame)>>3, g->frame->caller.uof);
+ //postfl("sp %p frame %p caller %p ip %p\n", sp, g->frame, g->frame->caller.uof, slotRawInt(&g->frame->caller.uof->ip));
+ //postfl("sp %p frame %p diff %d caller %p\n", sp, g->frame, ((int)sp - (int)g->frame)>>3, g->frame->caller.uof);
#if DEBUGINTERPRETER
if (gTraceInterpreter) {
//DumpStack(g, sp);
@@ -855,7 +849,7 @@ void Interpret(VMGlobals *g)
dumpOneByteCode(g->block, NULL, ip);
}
#endif
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
// gcLinkSanity(g->gc);
g->gc->SanityCheck();
// do_check_pool(pyr_pool_runtime);
View
2 lang/LangSource/PyrLexer.cpp
@@ -1801,7 +1801,7 @@ void compileClass(PyrSymbol *fileSym, int startPos, int endPos, int lineOffset)
//postfl("<-Parsing %s %d\n", fileSym->name, parseFailed); fflush(stdout);
//post("parseFailed %d\n", parseFailed); fflush(stdout);
if (!parseFailed && gRootParseNode) {
- //postfl("Compiling nodes %08X\n", gRootParseNode);fflush(stdout);
+ //postfl("Compiling nodes %p\n", gRootParseNode);fflush(stdout);
compilingCmdLine = false;
compileNodeList(gRootParseNode, true);
//postfl("done compiling\n");fflush(stdout);
View
53 lang/LangSource/PyrMessage.cpp
@@ -30,7 +30,6 @@
#include "PredefinedSymbols.h"
#define DEBUGMETHODS 0
-#define SANITYCHECK 0
#define METHODMETER 0
PyrMethod **gRowTable;
@@ -62,7 +61,7 @@ void sendMessageWithKeys(VMGlobals *g, PyrSymbol *selector, long numArgsPushed,
PyrObject *obj;
//postfl("->sendMessage\n");
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
CallStackSanity(g, "sendMessageWithKeys");
#endif
@@ -168,7 +167,7 @@ void sendMessageWithKeys(VMGlobals *g, PyrSymbol *selector, long numArgsPushed,
goto lookup_again;
case methPrimitive : /* primitive */
doPrimitiveWithKeys(g, meth, numArgsPushed, numKeyArgsPushed);
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
break;
@@ -177,7 +176,7 @@ void sendMessageWithKeys(VMGlobals *g, PyrSymbol *selector, long numArgsPushed,
#if TAILCALLOPTIMIZE
g->tailCall = 0;
#endif
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
CallStackSanity(g, "<sendMessageWithKeys");
#endif
@@ -195,7 +194,7 @@ void sendMessage(VMGlobals *g, PyrSymbol *selector, long numArgsPushed)
PyrObject *obj;
//postfl("->sendMessage\n");
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
CallStackSanity(g, "sendMessage");
#endif
@@ -330,7 +329,7 @@ void sendMessage(VMGlobals *g, PyrSymbol *selector, long numArgsPushed)
goto lookup_again;
case methPrimitive : /* primitive */
doPrimitive(g, meth, numArgsPushed);
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
break;
@@ -362,7 +361,7 @@ void sendMessage(VMGlobals *g, PyrSymbol *selector, long numArgsPushed)
#if TAILCALLOPTIMIZE
g->tailCall = 0;
#endif
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
CallStackSanity(g, "<sendMessage");
#endif
@@ -380,7 +379,7 @@ void sendSuperMessageWithKeys(VMGlobals *g, PyrSymbol *selector, long numArgsPus
PyrObject *obj;
//postfl("->sendMessage\n");
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
CallStackSanity(g, "sendSuperMessageWithKeys");
#endif
@@ -487,7 +486,7 @@ void sendSuperMessageWithKeys(VMGlobals *g, PyrSymbol *selector, long numArgsPus
goto lookup_again;
case methPrimitive : /* primitive */
doPrimitiveWithKeys(g, meth, numArgsPushed, numKeyArgsPushed);
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
break;
@@ -496,7 +495,7 @@ void sendSuperMessageWithKeys(VMGlobals *g, PyrSymbol *selector, long numArgsPus
#if TAILCALLOPTIMIZE
g->tailCall = 0;
#endif
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
CallStackSanity(g, "<sendSuperMessageWithKeys");
#endif
@@ -514,7 +513,7 @@ void sendSuperMessage(VMGlobals *g, PyrSymbol *selector, long numArgsPushed)
PyrObject *obj;
//postfl("->sendMessage\n");
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
CallStackSanity(g, "sendSuperMessage");
#endif
@@ -650,7 +649,7 @@ void sendSuperMessage(VMGlobals *g, PyrSymbol *selector, long numArgsPushed)
goto lookup_again;
case methPrimitive : /* primitive */
doPrimitive(g, meth, numArgsPushed);
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
break;
@@ -682,7 +681,7 @@ void sendSuperMessage(VMGlobals *g, PyrSymbol *selector, long numArgsPushed)
#if TAILCALLOPTIMIZE
g->tailCall = 0;
#endif
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
CallStackSanity(g, "<sendSuperMessage");
#endif
@@ -701,7 +700,7 @@ void doesNotUnderstandWithKeys(VMGlobals *g, PyrSymbol *selector,
PyrMethod *meth;
PyrObject *array;
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
// move args up by one to make room for selector
@@ -757,7 +756,7 @@ void doesNotUnderstandWithKeys(VMGlobals *g, PyrSymbol *selector,
executeMethodWithKeys(g, meth, numArgsPushed+1, numKeyArgsPushed);
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
}
@@ -774,7 +773,7 @@ void doesNotUnderstand(VMGlobals *g, PyrSymbol *selector,
PyrMethod *meth;
PyrObject *array;
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
// move args up by one to make room for selector
@@ -830,7 +829,7 @@ void doesNotUnderstand(VMGlobals *g, PyrSymbol *selector,
executeMethod(g, meth, numArgsPushed+1);
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
}
@@ -846,7 +845,7 @@ void executeMethodWithKeys(VMGlobals *g, PyrMethod *meth, long allArgsPushed, lo
PyrObject *proto;
long i, j, m, mmax, numtemps, numargs, numArgsPushed;
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
CallStackSanity(g, "executeMethodWithKeys");
#endif
@@ -984,7 +983,7 @@ void executeMethodWithKeys(VMGlobals *g, PyrMethod *meth, long allArgsPushed, lo
}
slotCopy(&g->receiver, &vars[1]);
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
CallStackSanity(g, "<executeMethodWithKeys");
#endif
@@ -1002,7 +1001,7 @@ void executeMethod(VMGlobals *g, PyrMethod *meth, long numArgsPushed)
PyrObject *proto;
long i, m, mmax, numtemps, numargs;
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
CallStackSanity(g, "executeMethod");
#endif
@@ -1118,7 +1117,7 @@ void executeMethod(VMGlobals *g, PyrMethod *meth, long numArgsPushed)
}
slotCopy(&g->receiver, &vars[1]);
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
CallStackSanity(g, "<executeMethod");
#endif
@@ -1138,7 +1137,7 @@ void returnFromBlock(VMGlobals *g)
//if (gTraceInterpreter) postfl("->returnFromBlock\n");
//printf("->returnFromBlock\n");
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
CallStackSanity(g, "returnFromBlock");
#endif
@@ -1177,7 +1176,7 @@ void returnFromBlock(VMGlobals *g)
longjmp(g->escapeInterpreter, 1);
}
//if (gTraceInterpreter) postfl("<-returnFromBlock\n");
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
CallStackSanity(g, "returnFromBlock");
#endif
@@ -1197,7 +1196,7 @@ void returnFromMethod(VMGlobals *g)
post("returnFromMethod %s:%s\n", slotRawClass(&g->method->ownerclass)->name.us->name, g->slotRawSymbol(&method->name)->name);
post("tailcall %d\n", g->tailCall);
}*/
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
homeContext = slotRawFrame(&slotRawFrame(&curframe->context)->homeContext);
@@ -1217,8 +1216,8 @@ void returnFromMethod(VMGlobals *g)
slotRawClass(&g->method->ownerclass)->name.us->name, g->slotRawSymbol(&method->name)->name
);
post("tailcall %d\n", g->tailCall);
- post("homeContext %08X\n", homeContext);
- post("returnFrame %08X\n", returnFrame);
+ post("homeContext %p\n", homeContext);
+ post("returnFrame %p\n", returnFrame);
dumpObjectSlot(&homeContext->caller);
DumpStack(g, g->sp);
DumpBackTrace(g);
@@ -1307,7 +1306,7 @@ if (gTraceInterpreter) {
slotCopy(&g->receiver, &homeContext->vars[0]);
}
-#if SANITYCHECK
+#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
#endif
}
View
29 lang/LangSource/PyrObject.cpp
@@ -1163,7 +1163,7 @@ void buildBigMethodMatrix()
post("\t%d method selectors, %d classes\n", numSelectors, numClasses);
post("\tmethod table size %d bytes, ", rowTableSize);
post("big table size %d\n", numSelectors * numClasses * sizeof(PyrMethod*));
- //postfl("%08X %08X %08X\n", classes, bigTable, sels);
+ //postfl("%p %p %p\n", classes, bigTable, sels);
/*
// not necessary since the entire pool will be freed..
pyr_pool_compile->Free(classes);
@@ -1586,10 +1586,10 @@ void initClasses()
slotRawSymbolArray(&o_argnamethis)->symbols[0] = s_this;
/*
- post("array %08X '%s'\n", class_array, class_array->name.us->name);
- post("o_emptyarray %08X '%s'\n", slotRawObject(&o_emptyarray)->classptr, slotRawObject(&o_emptyarray)->classptr->name.us->name);
- post("o_argnamethis %08X '%s'\n", slotRawObject(&o_argnamethis)->classptr, slotRawObject(&o_argnamethis)->classptr->name.us->name);
- post("o_onenilarray %08X '%s'\n", slotRawObject(&o_onenilarray)->classptr, slotRawObject(&o_onenilarray)->classptr->name.us->name);
+ post("array %p '%s'\n", class_array, class_array->name.us->name);
+ post("o_emptyarray %p '%s'\n", slotRawObject(&o_emptyarray)->classptr, slotRawObject(&o_emptyarray)->classptr->name.us->name);
+ post("o_argnamethis %p '%s'\n", slotRawObject(&o_argnamethis)->classptr, slotRawObject(&o_argnamethis)->classptr->name.us->name);
+ post("o_onenilarray %p '%s'\n", slotRawObject(&o_onenilarray)->classptr, slotRawObject(&o_onenilarray)->classptr->name.us->name);
dumpObjectSlot(&o_emptyarray);
dumpObjectSlot(&o_argnamethis);
dumpObjectSlot(&o_onenilarray);
@@ -1721,10 +1721,10 @@ void dumpObject(PyrObject *obj)
}
classobj = obj->classptr;
if (isKindOf(obj, class_class)) {
- post("class %s (%08X) {\n", slotRawSymbol(&((PyrClass*)obj)->name)->name, obj);
+ post("class %s (%p) {\n", slotRawSymbol(&((PyrClass*)obj)->name)->name, obj);
} else {
- //post("Instance of %s (%08X) {\n", slotRawSymbol(&classobj->name)->name, obj);
- post("Instance of %s { (%08X, gc=%02X, fmt=%02X, flg=%02X, set=%02X)\n",
+ //post("Instance of %s (%p) {\n", slotRawSymbol(&classobj->name)->name, obj);
+ post("Instance of %s { (%p, gc=%02X, fmt=%02X, flg=%02X, set=%02X)\n",
slotRawSymbol(&classobj->name)->name, obj, obj->gc_color, obj->obj_format, obj->obj_flags,
obj->obj_sizeclass);
}
@@ -1816,10 +1816,10 @@ void dumpBadObject(PyrObject *obj)
}
classobj = obj->classptr;
if (isKindOf(obj, class_class)) {
- postfl("class %s (%08X) {\n", slotRawSymbol(&((PyrClass*)obj)->name)->name, obj);
+ postfl("class %s (%p) {\n", slotRawSymbol(&((PyrClass*)obj)->name)->name, obj);
} else {
- //postfl("Instance of %s (%08X) {\n", slotRawSymbol(&classobj->name)->name, obj);
- postfl("Instance of %s { (%08X, gc=%02X, fmt=%02X, flg=%02X, set=%02X)\n",
+ //postfl("Instance of %s (%p) {\n", slotRawSymbol(&classobj->name)->name, obj);
+ postfl("Instance of %s { (%p, gc=%02X, fmt=%02X, flg=%02X, set=%02X)\n",
slotRawSymbol(&classobj->name)->name, obj, obj->gc_color, obj->obj_format, obj->obj_flags,
obj->obj_sizeclass);
}
@@ -1992,9 +1992,7 @@ void DumpFrame(PyrFrame *frame)
meth = slotRawMethod(&frame->method);
methraw = METHRAW(meth);
if (methraw->numtemps) {
- post("\t%s %08X\n", str, frame);
-//#ifndef SC_LINUX
-// sk: crashes on linux when accessing meth->argNames.uosym->symbols[i]
+ post("\t%s %p\n", str, frame);
numargs = methraw->numargs + methraw->varargs;
for (i=0; i<methraw->numtemps; ++i) {
slotOneWord(frame->vars + i, str);
@@ -2005,7 +2003,6 @@ void DumpFrame(PyrFrame *frame)
post("\t\tvar %s = %s\n", slotRawSymbolArray(&meth->varNames)->symbols[i - numargs]->name, str);
}
}
-//#endif // !SC_LINUX
} else {
post("\t%s (no arguments or variables)\n", str);
}
@@ -2294,7 +2291,7 @@ PyrMethod* initPyrMethod(PyrMethod* method)
nilSlots(&method->code, numSlots-2);
//slotCopy(&method->byteMeter, &o_zero);
//slotCopy(&method->callMeter, &o_zero);
- //post("<- newPyrMethod %08X %08X\n", method, methraw);
+ //post("<- newPyrMethod %p %p\n", method, methraw);
return method;
}
View
12 lang/LangSource/PyrParseNode.cpp
@@ -182,9 +182,9 @@ void compileNodeList(PyrParseNode *node, bool onTailBranch)
PyrSlot dummy;
//postfl("->compileNodeList\n");
for (; node; node = node->mNext) {
- //postfl("-->compileNodeList %08X\n", node);
+ //postfl("-->compileNodeList %p\n", node);
COMPILENODE(node, &dummy, onTailBranch);
- //postfl("<--compileNodeList %08X\n", node);
+ //postfl("<--compileNodeList %p\n", node);
}
//postfl("<-compileNodeList\n");
}
@@ -1270,7 +1270,7 @@ void PyrMethodNode::compile(PyrSlot *result)
methraw->unused1 = 0;
methraw->unused2 = 0;
- //postfl("method %08X raw %08X\n", method, methraw);
+ //postfl("method %p raw %p\n", method, methraw);
method->contextDef = o_nil;
method->name = mMethodName->mSlot;
if (gCompilingFileSym) SetSymbol(&method->filenameSym, gCompilingFileSym);
@@ -2655,14 +2655,14 @@ PyrCallNode* buildCase(PyrParseNode *arg1)
}
/*
- post("arg1->mNext %08X arg2 %08X\n", arg1->mNext, arg2);
+ post("arg1->mNext %p arg2 %p\n", arg1->mNext, arg2);
if (arg2) {
- post("arg2->mNext %08X arg3 %08X\n", arg2->mNext, arg3);
+ post("arg2->mNext %p arg3 %p\n", arg2->mNext, arg3);
post("isAnInlineableBlock arg2 %d\n", isAnInlineableBlock(arg2));
}
if (arg3) {
post("isAnInlineableBlock arg3 %d\n", isAnInlineableBlock(arg3));
- post("arg3->mNext %08X\n", arg3->mNext);
+ post("arg3->mNext %p\n", arg3->mNext);
}
DUMPNODE(arg1, 0);
*/
View
3 platform/CMakeLists.txt
@@ -2,6 +2,7 @@ if(APPLE)
add_subdirectory(mac)
endif()
-if(CMAKE_SYSTEM_NAME MATCHES "Linux")
+# NB freebsd currently OK to ride on linux for this subdir. eventually may need separating.
+if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
add_subdirectory(linux)
endif()
View
BIN platform/mac/Resources/Japanese.lproj/MainMenu.nib/objects.nib
Binary file not shown.
View
76 platform/mac/Synth.xcodeproj/project.pbxproj
@@ -67,6 +67,36 @@
D53110B10EF9A91B004BAF31 /* SuperColliderAUVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = D53110A40EF9A91B004BAF31 /* SuperColliderAUVersion.h */; };
D53110C80EF9AB24004BAF31 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D55DEBD70EF32CE300968B95 /* InfoPlist.strings */; };
D53110D00EF9AB2C004BAF31 /* serverConfig.plist in Resources */ = {isa = PBXBuildFile; fileRef = D55DEBDC0EF32CE300968B95 /* serverConfig.plist */; };
+ D559CA5E12D0EAC000EF3862 /* SC_AllocPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F436B12C2936E00621B91 /* SC_AllocPool.cpp */; };
+ D559CA5F12D0EAE200EF3862 /* SC_AU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43B212C2936F00621B91 /* SC_AU.cpp */; };
+ D559CA6012D0EB3C00EF3862 /* SC_DirUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F436C12C2936E00621B91 /* SC_DirUtils.cpp */; };
+ D559CA6112D0EB3C00EF3862 /* SC_BufGen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43B412C2936F00621B91 /* SC_BufGen.cpp */; };
+ D559CA6212D0EB3C00EF3862 /* SC_Carbon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43B512C2936F00621B91 /* SC_Carbon.cpp */; };
+ D559CA6412D0EB3C00EF3862 /* SC_ComPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43B712C2936F00621B91 /* SC_ComPort.cpp */; };
+ D559CA6512D0EB3C00EF3862 /* SC_CoreAudio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43B812C2936F00621B91 /* SC_CoreAudio.cpp */; };
+ D559CA6612D0EB3C00EF3862 /* SC_Errors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43B912C2936F00621B91 /* SC_Errors.cpp */; };
+ D559CA6712D0EB3C00EF3862 /* SC_Graph.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43BA12C2936F00621B91 /* SC_Graph.cpp */; };
+ D559CA6812D0EB3C00EF3862 /* SC_GraphDef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43BB12C2936F00621B91 /* SC_GraphDef.cpp */; };
+ D559CA6912D0EB3C00EF3862 /* SC_Group.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43BC12C2936F00621B91 /* SC_Group.cpp */; };
+ D559CA6A12D0EB3C00EF3862 /* SC_Lib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43BE12C2936F00621B91 /* SC_Lib.cpp */; };
+ D559CA6B12D0EB3C00EF3862 /* SC_Lib_Cintf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43BF12C2936F00621B91 /* SC_Lib_Cintf.cpp */; };
+ D559CA6C12D0EB3C00EF3862 /* SC_MiscCmds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43C012C2936F00621B91 /* SC_MiscCmds.cpp */; };
+ D559CA6D12D0EB3C00EF3862 /* SC_Node.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43C112C2936F00621B91 /* SC_Node.cpp */; };
+ D559CA6E12D0EB3C00EF3862 /* SC_Rate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43C212C2936F00621B91 /* SC_Rate.cpp */; };
+ D559CA6F12D0EB3C00EF3862 /* SC_SequencedCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43C312C2936F00621B91 /* SC_SequencedCommand.cpp */; };
+ D559CA7012D0EB3C00EF3862 /* SC_Str4.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43C412C2936F00621B91 /* SC_Str4.cpp */; };
+ D559CA7112D0EB3C00EF3862 /* SC_Unit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43C512C2936F00621B91 /* SC_Unit.cpp */; };
+ D559CA7212D0EB3C00EF3862 /* SC_UnitDef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43C612C2936F00621B91 /* SC_UnitDef.cpp */; };
+ D559CA7312D0EB3C00EF3862 /* SC_World.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43C712C2936F00621B91 /* SC_World.cpp */; };
+ D559CA7412D0EB3C00EF3862 /* scsynth_main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43C812C2936F00621B91 /* scsynth_main.cpp */; };
+ D559CA9412D0EC8500EF3862 /* SC_StringParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F437212C2936E00621B91 /* SC_StringParser.cpp */; };
+ D559CA9712D0EC9400EF3862 /* SC_StringBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F437112C2936E00621B91 /* SC_StringBuffer.cpp */; };
+ D559CA9812D0ECA900EF3862 /* scsynthsend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F437412C2936E00621B91 /* scsynthsend.cpp */; };
+ D559CAA012D0ECCE00EF3862 /* SC_fftlib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F436D12C2936E00621B91 /* SC_fftlib.cpp */; };
+ D559CAA412D0ECF000EF3862 /* SC_StandAloneInfo_Darwin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F437012C2936E00621B91 /* SC_StandAloneInfo_Darwin.cpp */; };
+ D559CAA812D0ED4A00EF3862 /* Samp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43B112C2936F00621B91 /* Samp.cpp */; };
+ D559CAAB12D0ED7500EF3862 /* SC_Sem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F436F12C2936E00621B91 /* SC_Sem.cpp */; };
+ D559CAB512D0EDA400EF3862 /* Rendezvous.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F43B012C2936F00621B91 /* Rendezvous.cpp */; };
D55DEE3C0EF3304300968B95 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D55DEE3B0EF3304300968B95 /* AudioUnit.framework */; };
D55DEF140EF333C000968B95 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F53F78F503B2842D011C068F /* CoreServices.framework */; };
D55DEF1C0EF333C600968B95 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94B6B0C30AF5390900E478BB /* CoreAudio.framework */; };
@@ -978,6 +1008,36 @@
D53110A90EF9A91B004BAF31 /* Resources.cpp in Sources */,
D53110AB0EF9A91B004BAF31 /* SCProcess.cpp in Sources */,
D53110AD0EF9A91B004BAF31 /* SuperColliderAU.cpp in Sources */,
+ D559CA5E12D0EAC000EF3862 /* SC_AllocPool.cpp in Sources */,
+ D559CA5F12D0EAE200EF3862 /* SC_AU.cpp in Sources */,
+ D559CA6012D0EB3C00EF3862 /* SC_DirUtils.cpp in Sources */,
+ D559CA6112D0EB3C00EF3862 /* SC_BufGen.cpp in Sources */,
+ D559CA6212D0EB3C00EF3862 /* SC_Carbon.cpp in Sources */,
+ D559CA6412D0EB3C00EF3862 /* SC_ComPort.cpp in Sources */,
+ D559CA6512D0EB3C00EF3862 /* SC_CoreAudio.cpp in Sources */,
+ D559CA6612D0EB3C00EF3862 /* SC_Errors.cpp in Sources */,
+ D559CA6712D0EB3C00EF3862 /* SC_Graph.cpp in Sources */,
+ D559CA6812D0EB3C00EF3862 /* SC_GraphDef.cpp in Sources */,
+ D559CA6912D0EB3C00EF3862 /* SC_Group.cpp in Sources */,
+ D559CA6A12D0EB3C00EF3862 /* SC_Lib.cpp in Sources */,
+ D559CA6B12D0EB3C00EF3862 /* SC_Lib_Cintf.cpp in Sources */,
+ D559CA6C12D0EB3C00EF3862 /* SC_MiscCmds.cpp in Sources */,
+ D559CA6D12D0EB3C00EF3862 /* SC_Node.cpp in Sources */,
+ D559CA6E12D0EB3C00EF3862 /* SC_Rate.cpp in Sources */,
+ D559CA6F12D0EB3C00EF3862 /* SC_SequencedCommand.cpp in Sources */,
+ D559CA7012D0EB3C00EF3862 /* SC_Str4.cpp in Sources */,
+ D559CA7112D0EB3C00EF3862 /* SC_Unit.cpp in Sources */,
+ D559CA7212D0EB3C00EF3862 /* SC_UnitDef.cpp in Sources */,
+ D559CA7312D0EB3C00EF3862 /* SC_World.cpp in Sources */,
+ D559CA7412D0EB3C00EF3862 /* scsynth_main.cpp in Sources */,
+ D559CA9412D0EC8500EF3862 /* SC_StringParser.cpp in Sources */,
+ D559CA9712D0EC9400EF3862 /* SC_StringBuffer.cpp in Sources */,
+ D559CA9812D0ECA900EF3862 /* scsynthsend.cpp in Sources */,
+ D559CAA012D0ECCE00EF3862 /* SC_fftlib.cpp in Sources */,
+ D559CAA412D0ECF000EF3862 /* SC_StandAloneInfo_Darwin.cpp in Sources */,
+ D559CAA812D0ED4A00EF3862 /* Samp.cpp in Sources */,
+ D559CAAB12D0ED7500EF3862 /* SC_Sem.cpp in Sources */,
+ D559CAB512D0EDA400EF3862 /* Rendezvous.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1030,8 +1090,8 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_VERSION = "";
HEADER_SEARCH_PATHS = (
- "../common/Headers/common",
- "../../external_libraries/libsndfile/",
+ ../common/Headers/common,
+ ../../external_libraries/libsndfile/,
);
MACOSX_DEPLOYMENT_TARGET = 10.5;
OBJROOT = "$(PROJECT_DIR)/Intermediate Build Files";
@@ -1202,8 +1262,8 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_VERSION = "";
HEADER_SEARCH_PATHS = (
- "../common/Headers/common",
- "../../external_libraries/libsndfile/",
+ ../common/Headers/common,
+ ../../external_libraries/libsndfile/,
);
MACOSX_DEPLOYMENT_TARGET = 10.4;
OBJROOT = "$(PROJECT_DIR)/Intermediate Build Files";
@@ -1227,8 +1287,8 @@
GCC_OPTIMIZATION_LEVEL = 3;
GCC_VERSION = "";
HEADER_SEARCH_PATHS = (
- "../common/Headers/common",
- "../../external_libraries/libsndfile/",
+ ../common/Headers/common,
+ ../../external_libraries/libsndfile/,
);
MACOSX_DEPLOYMENT_TARGET = 10.4;
OBJROOT = "$(PROJECT_DIR)/Intermediate Build Files";
@@ -1428,8 +1488,8 @@
GCC_OPTIMIZATION_LEVEL = 3;
GCC_VERSION = 4.2;
HEADER_SEARCH_PATHS = (
- "../common/Headers/common",
- "../../external_libraries/libsndfile/",
+ ../common/Headers/common,
+ ../../external_libraries/libsndfile/,
);
MACOSX_DEPLOYMENT_TARGET = 10.5;
OBJROOT = "$(PROJECT_DIR)/Intermediate Build Files";
View
2 server/plugins/BinaryOpUGens.cpp
@@ -7725,7 +7725,7 @@ bool ChooseOperatorFunc(BinaryOpUGen *unit)
func = ChooseNormalFunc(unit);
}
unit->mCalcFunc = (UnitCalcFunc)func;
- //Print("<-ChooseOperatorFunc %08X\n", func);
+ //Print("<-ChooseOperatorFunc %p\n", func);
//Print("calc %d\n", unit->mCalcRate);
return ret;
}
View
241 server/plugins/DelayUGens.cpp
@@ -2174,7 +2174,7 @@ void DelayUnit_AllocDelayLine(DelayUnit *unit)
int size = delaybufsize * sizeof(float);
//Print("->RTAlloc %d\n", size);
unit->m_dlybuf = (float*)RTAlloc(unit->mWorld, size);
- //Print("<-RTAlloc %08X\n", unit->m_dlybuf);
+ //Print("<-RTAlloc %p\n", unit->m_dlybuf);
unit->m_mask = delaybufsize - 1;
}
#endif
@@ -2263,6 +2263,87 @@ struct DelayN_helper<true>
}
};
+template <bool initializing>
+static inline void DelayN_delay_loop(float * out, const float * in, long & iwrphase, float dsamp, long mask,
+ float * dlybuf, int inNumSamples, int idelaylen)
+{
+ long irdphase = iwrphase - (long)dsamp;
+ float* dlybuf1 = dlybuf - ZOFF;
+ float* dlyrd = dlybuf1 + (irdphase & mask);
+ float* dlywr = dlybuf1 + (iwrphase & mask);
+ float* dlyN = dlybuf1 + idelaylen;
+ long remain = inNumSamples;
+ while (remain) {
+ long rdspace = dlyN - dlyrd;
+ long wrspace = dlyN - dlywr;
+ if (initializing) {
+ long nsmps = sc_min(rdspace, wrspace);
+ nsmps = sc_min(remain, nsmps);
+ remain -= nsmps;
+ if (irdphase < 0) {
+ if ((dlywr - dlyrd) > nsmps) {
+#ifdef NOVA_SIMD
+ if ((nsmps & 15) == 0) {
+ nova::copyvec_nn_simd(dlywr + ZOFF, in + ZOFF, nsmps);
+ nova::zerovec_na_simd(out + ZOFF, nsmps);
+ } else
+#endif
+ {
+ ZCopy(nsmps, dlywr, in);
+ ZClear(nsmps, out);
+ }
+ out += nsmps;
+ in += nsmps;
+ dlyrd += nsmps;
+ dlywr += nsmps;
+ } else
+ LOOP(nsmps,
+ ZXP(dlywr) = ZXP(in);
+ ZXP(out) = 0.f;
+ );
+ } else {
+ LOOP(nsmps,
+ ZXP(dlywr) = ZXP(in);
+ ZXP(out) = ZXP(dlyrd);
+ );
+ }
+ irdphase += nsmps;
+ if (dlyrd == dlyN) dlyrd = dlybuf1;
+ if (dlywr == dlyN) dlywr = dlybuf1;
+ }
+ else {
+ long nsmps = sc_min(rdspace, wrspace);
+ nsmps = sc_min(remain, nsmps);
+ remain -= nsmps;
+
+ if (std::abs(dlyrd - dlywr) > nsmps) {
+#ifdef NOVA_SIMD
+ if ((nsmps & 15) == 0) {
+ nova::copyvec_nn_simd(dlywr + ZOFF, in + ZOFF, nsmps);
+ nova::copyvec_nn_simd(out + ZOFF, dlyrd + ZOFF, nsmps);
+ } else
+#endif
+ {
+ ZCopy(nsmps, dlywr, in);
+ ZCopy(nsmps, out, dlyrd);
+ }
+ out += nsmps;
+ in += nsmps;
+ dlyrd += nsmps;
+ dlywr += nsmps;
+ } else
+ LOOP(nsmps,
+ ZXP(dlywr) = ZXP(in);
+ ZXP(out) = ZXP(dlyrd);
+ );
+ if (dlyrd == dlyN) dlyrd = dlybuf1;
+ if (dlywr == dlyN) dlywr = dlybuf1;
+ }
+ }
+ iwrphase += inNumSamples;
+}
+
+
template <bool Checked = false>
struct DelayL_helper
{
@@ -2821,26 +2902,7 @@ void BufDelayN_next(BufDelayN *unit, int inNumSamples)
float dsamp = unit->m_dsamp;
if (delaytime == unit->m_delaytime) {
- long irdphase = iwrphase - (long)dsamp;
- float* dlybuf1 = bufData - ZOFF;
- float* dlyrd = dlybuf1 + (irdphase & mask);
- float* dlywr = dlybuf1 + (iwrphase & mask);
- float* dlyN = dlybuf1 + PREVIOUSPOWEROFTWO(bufSamples);
- long remain = inNumSamples;
- while (remain) {
- long rdspace = dlyN - dlyrd;
- long wrspace = dlyN - dlywr;
- long nsmps = sc_min(rdspace, wrspace);
- nsmps = sc_min(remain, nsmps);
- remain -= nsmps;
- LOOP1(nsmps,
- ZXP(dlywr) = ZXP(in);
- ZXP(out) = ZXP(dlyrd);
- );
- if (dlyrd == dlyN) dlyrd = dlybuf1;
- if (dlywr == dlyN) dlywr = dlybuf1;
- }
- iwrphase += inNumSamples;
+ DelayN_delay_loop<false>(out, in, iwrphase, dsamp, mask, bufData, inNumSamples, PREVIOUSPOWEROFTWO(bufSamples));
} else {
float next_dsamp = BufCalcDelay(delaytime);
float dsamp_slope = CALCSLOPE(next_dsamp, dsamp);
@@ -2870,32 +2932,7 @@ void BufDelayN_next_z(BufDelayN *unit, int inNumSamples)
float dsamp = unit->m_dsamp;
if (delaytime == unit->m_delaytime) {
- long irdphase = iwrphase - (long)dsamp;
- float* dlybuf1 = bufData - ZOFF;
- float* dlyN = dlybuf1 + PREVIOUSPOWEROFTWO(bufSamples);
- long remain = inNumSamples;
- while (remain) {
- float* dlywr = dlybuf1 + (iwrphase & mask);
- float* dlyrd = dlybuf1 + (irdphase & mask);
- long rdspace = dlyN - dlyrd;
- long wrspace = dlyN - dlywr;
- long nsmps = sc_min(rdspace, wrspace);
- nsmps = sc_min(remain, nsmps);
- remain -= nsmps;
- if (irdphase < 0) {
- LOOP1(nsmps,
- ZXP(dlywr) = ZXP(in);
- ZXP(out) = 0.f;
- );
- } else {
- LOOP1(nsmps,
- ZXP(dlywr) = ZXP(in);
- ZXP(out) = ZXP(dlyrd);
- );
- }
- iwrphase += nsmps;
- irdphase += nsmps;
- }
+ DelayN_delay_loop<true>(out, in, iwrphase, dsamp, mask, bufData, inNumSamples, PREVIOUSPOWEROFTWO(bufSamples));
} else {
float next_dsamp = BufCalcDelay(delaytime);
@@ -3862,10 +3899,52 @@ inline void DelayX_perform_a(DelayX *unit, int inNumSamples, UnitCalcFunc resetF
////////////////////////////////////////////////////////////////////////////////////////////////////////
+void Delay_next_0(DelayUnit *unit, int inNumSamples)
+{
+ float *out = OUT(0);
+ const float *in = IN(0);
+
+ memcpy(out, in, inNumSamples * sizeof(float));
+}
+
+void Delay_next_0_nop(DelayUnit *unit, int inNumSamples)
+{}
+
+#ifdef NOVA_SIMD
+void Delay_next_0_nova(DelayUnit *unit, int inNumSamples)
+{
+ nova::copyvec_simd(OUT(0), IN(0), inNumSamples);
+}
+#endif
+
+static bool DelayUnit_init_0(DelayUnit *unit)
+{
+ if (INRATE(2) == calc_ScalarRate && ZIN0(2) == 0) {
+ if (ZIN(0) == ZOUT(0))
+ SETCALC(Delay_next_0_nop);
+#ifdef NOVA_SIMD
+ else if (BUFLENGTH & 15 == 0)
+ SETCALC(Delay_next_0_nova);
+#endif
+ else
+ SETCALC(Delay_next_0);
+
+ ZOUT0(0) = ZIN0(0);
+ return true;
+ } else
+ return false;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+
void DelayN_Ctor(DelayN *unit)
{
DelayUnit_Reset(unit);
- if(INRATE(2) == calc_FullRate)
+